本文整理汇总了PHP中Frame::set_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Frame::set_id方法的具体用法?PHP Frame::set_id怎么用?PHP Frame::set_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::set_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function set_id($id)
{
$this->_frame->set_id($id);
}
示例2: _build_tree_r
/**
* Recursively adds {@link Frame} objects to the tree
*
* Recursively build a tree of Frame objects based on a dom tree.
* No layout information is calculated at this time, although the
* tree may be adjusted (i.e. nodes and frames for generated content
* and images may be created).
*
* @param DomNode $node the current DomNode being considered
* @return Frame
*/
protected function _build_tree_r(DomNode $node)
{
$frame = new Frame($node);
$frame->set_id($id = uniqid(rand()));
$this->_registry[$id] = $frame;
if (!$node->hasChildNodes()) {
return $frame;
}
foreach ($node->childNodes as $child) {
// Skip non-displaying nodes
if (in_array($child->nodeName, self::$_HIDDEN_TAGS)) {
continue;
}
// Skip empty #text nodes
if ($child->nodeName == "#text" && $child->nodeValue == "") {
continue;
}
// Add a container frame for images
if ($child->nodeName == "img") {
$img_node = $child->ownerDocument->createElement("img_inner");
// Move attributes to inner node
foreach ($child->attributes as $attr => $attr_node) {
// Skip style, but move all other attributes
if ($attr == "style") {
continue;
}
$img_node->setAttribute($attr, $attr_node->value);
}
foreach ($child->attributes as $attr => $node) {
if ($attr == "style") {
continue;
}
$child->removeAttribute($attr);
}
$child->appendChild($img_node);
}
$frame->append_child($this->_build_tree_r($child), false);
}
return $frame;
}