mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-12 19:44:12 +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:
@@ -239,16 +239,16 @@ class JustETFBridge extends BridgeAbstract {
|
||||
or returnServerError('Article body not found!');
|
||||
|
||||
// Remove teaser image
|
||||
$element->find('img.teaser-img', 0)->outertext = '';
|
||||
$element->find('img.teaser-img', 0)->remove();
|
||||
|
||||
// Remove self advertisements
|
||||
foreach($element->find('.call-action') as $adv) {
|
||||
$adv->outertext = '';
|
||||
$adv->remove();
|
||||
}
|
||||
|
||||
// Remove tips
|
||||
foreach($element->find('.panel-edu') as $tip) {
|
||||
$tip->outertext = '';
|
||||
$tip->remove();
|
||||
}
|
||||
|
||||
// Remove inline scripts (used for i.e. interactive graphs) as they are
|
||||
@@ -318,7 +318,7 @@ class JustETFBridge extends BridgeAbstract {
|
||||
$description = $description->parent();
|
||||
|
||||
foreach($description->find('div') as $div) {
|
||||
$div->outertext = '';
|
||||
$div->remove();
|
||||
}
|
||||
|
||||
$quote = $html->find('div.infobox div.val', 0)
|
||||
|
Reference in New Issue
Block a user