<?php fof_add_item_filter('strip_comments', 0); function strip_comments($text) { $text = preg_replace('/<!--.+-->/Us', '', $text); return $text; }
<?php /* Remove spurious <link> tags, which have no business belonging in a syndicated item */ fof_add_item_filter('remove_link_tags'); function remove_link_tags($content) { $old_xml_err = libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHtml(mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8")); foreach ($dom->getElementsByTagName('link') as $link) { $link->parentNode->removeChild($link); } $content_out = ''; $node = $dom->firstChild; while ($node) { $content_out .= $dom->saveHTML($node); /* repeat for all nodes at this level */ $node = $node->nextSibling; } foreach (libxml_get_errors() as $error) { /* just ignore warnings */ if ($error->level === LIBXML_ERR_WARNING) { continue; } fof_log(__FUNCTION__ . ': ' . $error->message); } libxml_clear_errors(); libxml_use_internal_errors($old_xml_err); return $content_out; }
<?php fof_add_item_filter('fof_plain'); fof_add_pref('Strip (most) markup from items', 'plugin_plain_enable', 'boolean'); function fof_plain($text) { $prefs = fof_prefs(); $enable = $prefs['plugin_plain_enable']; if (!$enable) { return $text; } return strip_tags($text, "<a><b><i><blockquote>"); }
<?php fof_add_item_filter('fof_fixdivs'); function fof_fixdivs($text) { $text = str_ireplace('<div"', '<div "', $text); $text = str_ireplace('<div ...', '', $text); return $text; }
<?php fof_add_item_filter('fof_balancetags', 100); /* balanceTags Balances Tags of string using a modified stack. @param text Text to be balanced @param force Forces balancing, ignoring the value of the option @return Returns balanced text @author Leonard Lin (leonard@acm.org) @version v1.1 @date November 4, 2001 @license GPL v2.0 @notes @changelog --- Modified by Scott Reilly (coffee2code) 02 Aug 2004 1.2 ***TODO*** Make better - change loop condition to $text 1.1 Fixed handling of append/stack pop order of end text Added Cleaning Hooks 1.0 First Version */ function fof_balancetags($text) { $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; # WP bug fix for comments - in case you REALLY meant to type '< !--' $text = str_replace('< !--', '< !--', $text);