Merge pull request #11 from rangerer/cleanup_adv
Advanced cleanup features, thanks to @rangerer
This commit is contained in:
commit
ba2c227740
10
init.php
10
init.php
@ -118,10 +118,18 @@ 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) {
|
||||
$node->parentNode->removeChild($node);
|
||||
if ($node instanceof DOMAttr) {
|
||||
$node->ownerElement->removeAttributeNode($node);
|
||||
}
|
||||
else {
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user