adicionada regra removeElementsByTag

This commit is contained in:
Renan Bernordi 2025-01-23 16:48:47 -03:00
parent 2444c30a3e
commit d4ab2c4cd8
3 changed files with 25 additions and 3 deletions

View file

@ -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']");