本文整理匯總了PHP中float::cloneNode方法的典型用法代碼示例。如果您正苦於以下問題:PHP float::cloneNode方法的具體用法?PHP float::cloneNode怎麽用?PHP float::cloneNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類float
的用法示例。
在下文中一共展示了float::cloneNode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: filter
/**
* Filter XHtml document
*
* Filter for the document, which may modify / restructure a document and
* assign semantic information bits to the elements in the tree.
*
* @param DOMDocument $document
* @return DOMDocument
*/
public function filter(DOMDocument $document)
{
$xpath = new DOMXPath($document);
$body = $xpath->query('/*[local-name() = "html"]/*[local-name() = "body"]')->item(0);
$this->calculateContentFactors($body);
if ($this->mostImportantNode !== false) {
// Replace contents of body node with the found "most important"
// section, so we keep the metadata, but omit everything we consider as
// layout.
$contentNode = $this->mostImportantNode->cloneNode(true);
// Remove all childs from HTML body
for ($i = $body->childNodes->length - 1; $i >= 0; --$i) {
$body->removeChild($body->childNodes->item($i));
}
// Readd detected content node
$body->appendChild($contentNode);
}
}