By idflorin on
I want to add a filter to content before is stored into database.
if ($this->strip_ads)
{
$data = preg_replace('/<a [^>]*href=[^>]*click\.phdo\?s=.*?<\/a>/msi', '', $data); // Pheedo links (tested with Dooce.com)
$data = preg_replace('/<p[^>]*>[^<]*<a href="http:\/\/ad.doubleclick.net\/jump\/.*?<\/p>/msi', '', $data); // Doubleclick links (tested with InfoWorld.com)
$data = preg_replace('/<p><map [^>]*name=[^>]*google_ad_map.*?<\/p>/msi', '', $data); // Google AdSense for Feeds (tested with tuaw.com).
$data = preg_replace('/<div class="feedflare">.*?<\/div>/msi', '', $data); // Feedflare, from Feedburner
$data = preg_replace('/(tags:\s*)?<a [^>]*href="http:\/\/technorati\.com\/tag\/.*?<\/a>/msi', '', $data); // Technorati tags
}
from - http://simplepie.org/support/viewtopic.php?id=555
Something very simple. Activate and Deactivate.
Some help ?
Comments
at least
please point me to an existing filter who filters the content before is stored to db
hook_nodeapi
If you created a new module, and used hook_nodeapi, you could run your filter code before it was saved.