mirror of
https://github.com/manualdousuario/marreta.git
synced 2026-05-04 06:20:16 +00:00
adicionada regra removeElementsByTag
This commit is contained in:
parent
2444c30a3e
commit
d4ab2c4cd8
3 changed files with 25 additions and 3 deletions
|
|
@ -557,6 +557,21 @@ class URLAnalyzer
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($domainRules['removeElementsByTag'])) {
|
||||
$tagsToRemove = $domainRules['removeElementsByTag'];
|
||||
foreach ($tagsToRemove as $tag) {
|
||||
$tagElements = $xpath->query("//$tag");
|
||||
if ($tagElements !== false) {
|
||||
foreach ($tagElements as $element) {
|
||||
if ($element->parentNode) {
|
||||
$element->parentNode->removeChild($element);
|
||||
}
|
||||
}
|
||||
$this->activatedRules[] = "removeElementsByTag: $tag";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($domainRules['idElementRemove'])) {
|
||||
foreach ($domainRules['idElementRemove'] as $id) {
|
||||
$elements = $xpath->query("//*[@id='$id']");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue