diff --git a/app/data/global_rules.php b/app/data/global_rules.php index e18c4e7..1f0250a 100644 --- a/app/data/global_rules.php +++ b/app/data/global_rules.php @@ -79,6 +79,7 @@ return [ 'navdmp.com', 'getblue.io', 'smartocto.com', - 'cdn.pn.vg' + 'cdn.pn.vg', + 'static.vocstatic.com' ] ]; diff --git a/app/inc/URLAnalyzer.php b/app/inc/URLAnalyzer.php index f70b503..e005983 100644 --- a/app/inc/URLAnalyzer.php +++ b/app/inc/URLAnalyzer.php @@ -623,6 +623,41 @@ class URLAnalyzer } } } + + if (isset($domainRules['removeCustomAttr'])) { + foreach ($domainRules['removeCustomAttr'] as $attrPattern) { + if (strpos($attrPattern, '*') !== false) { + // For wildcard attributes (e.g. data-*) / Para atributos com wildcard (ex: data-*) + $elements = $xpath->query('//*'); + if ($elements !== false) { + $pattern = '/^' . str_replace('*', '.*', $attrPattern) . '$/'; + foreach ($elements as $element) { + if ($element->hasAttributes()) { + $attrs = []; + foreach ($element->attributes as $attr) { + if (preg_match($pattern, $attr->name)) { + $attrs[] = $attr->name; + } + } + foreach ($attrs as $attr) { + $element->removeAttribute($attr); + } + } + } + $this->activatedRules[] = "removeCustomAttr: $attrPattern"; + } + } else { + // For non-wildcard attributes / Para atributos sem wildcard + $elements = $xpath->query("//*[@$attrPattern]"); + if ($elements !== false && $elements->length > 0) { + foreach ($elements as $element) { + $element->removeAttribute($attrPattern); + } + $this->activatedRules[] = "removeCustomAttr: $attrPattern"; + } + } + } + } } /**