Merge pull request #11 from rangerer/cleanup_adv
Advanced cleanup features, thanks to @rangerer
This commit is contained in:
8
init.php
8
init.php
@ -118,13 +118,21 @@ class Af_Feedmod extends Plugin implements IHandler
|
||||
if ($basenode) {
|
||||
// remove nodes from cleanup configuration
|
||||
if (isset($config['cleanup'])) {
|
||||
if (!is_array($config['cleanup']) {
|
||||
$config['cleanup'] = array($config['cleanup']);
|
||||
}
|
||||
foreach ($config['cleanup'] as $cleanup) {
|
||||
$nodelist = $xpath->query('//'.$cleanup, $basenode);
|
||||
foreach ($nodelist as $node) {
|
||||
if ($node instanceof DOMAttr) {
|
||||
$node->ownerElement->removeAttributeNode($node);
|
||||
}
|
||||
else {
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$article['content'] = $doc->saveXML($basenode);
|
||||
$article['plugin_data'] = "feedmod,$owner_uid:" . $article['plugin_data'];
|
||||
}
|
||||
|
Reference in New Issue
Block a user