本文整理匯總了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;
}