From 64a06e0c873b4f6429e130c66056a39d72c5c575 Mon Sep 17 00:00:00 2001 From: Roland Angerer Date: Wed, 19 Jun 2013 11:31:31 +0200 Subject: added cleanup option for nodes fetched via xpath --- init.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'init.php') diff --git a/init.php b/init.php index 3b65ce3..e99744a 100644 --- a/init.php +++ b/init.php @@ -116,6 +116,15 @@ class Af_Feedmod extends Plugin implements IHandler if ($entries->length > 0) $basenode = $entries->item(0); if ($basenode) { + // remove nodes from cleanup configuration + if (isset($config['cleanup'])) { + foreach ($config['cleanup'] as $cleanup) { + $nodelist = $xpath->query('//'.$cleanup, $basenode); + foreach ($nodelist as $node) { + $node->parentNode->removeChild($node); + } + } + } $article['content'] = $doc->saveXML($basenode); $article['plugin_data'] = "feedmod,$owner_uid:" . $article['plugin_data']; } -- cgit v1.3.1