本文整理汇总了PHP中simple_html_dom::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP simple_html_dom::remove方法的具体用法?PHP simple_html_dom::remove怎么用?PHP simple_html_dom::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simple_html_dom
的用法示例。
在下文中一共展示了simple_html_dom::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: a587_getPlaintext
function a587_getPlaintext($_text, $_remove)
{
global $REX;
foreach (explode(',', $REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['order']) as $elem) {
switch ($elem) {
case 'selectors':
// remove elements selected by css-selectors
$html = new simple_html_dom();
$html->load($_text);
$html->remove($_remove);
$html->load($html->outertext);
$_text = $html->plaintext;
break;
case 'regex':
// regex
if (!empty($REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['regex'])) {
$regex = array();
$replacement = array();
$odd = true;
foreach (explode("\n", $REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['regex']) as $line) {
if ($line != '') {
if ($odd) {
$regex[] = trim($line);
} else {
$replacement[] = $line;
}
$odd = !$odd;
}
}
$_text = preg_replace($regex, $replacement, $_text);
}
break;
case 'textile':
// strip HTML-tags
if (!empty($REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['textile']) and function_exists('rex_a79_textile')) {
$_text = rex_a79_textile($_text);
}
break;
case 'striptags':
// strip HTML-tags
if (!empty($REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['striptags'])) {
$_text = strip_tags($_text);
}
break;
}
}
return $_text;
}