mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-09-01 08:15:57 +02:00
all: Use ->remove() instead of ->outertext = ''
simplehtmldom 1.9 introduced new functions to recursively remove nodes from the DOM. This allows removing elements without the need to re-load the document by using $html->load($html->save()), which is very inefficient. Find more information about remove() at https://simplehtmldom.sourceforge.io/docs/1.9/api/simple_html_dom_node/remove/
This commit is contained in:
parent
014b698f67
commit
052844f5e1
21 changed files with 44 additions and 49 deletions
|
@ -36,7 +36,7 @@ function sanitize($html,
|
|||
if(in_array($element->tag, $text_to_keep)) {
|
||||
$element->outertext = $element->plaintext;
|
||||
} elseif(in_array($element->tag, $tags_to_remove)) {
|
||||
$element->outertext = '';
|
||||
$element->remove();
|
||||
} else {
|
||||
foreach($element->getAllAttributes() as $attributeName => $attribute) {
|
||||
if(!in_array($attributeName, $attributes_to_keep))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue