diff --git a/bridges/IGNBridge.php b/bridges/IGNBridge.php index 6a254b377a7..ef5088f2e9b 100644 --- a/bridges/IGNBridge.php +++ b/bridges/IGNBridge.php @@ -19,6 +19,27 @@ protected function parseItem($newsItem){ // $articlePage gets the entire page's contents $articlePage = getSimpleHTMLDOM($newsItem->link); + // List of BS elements + $uselessElements = array( + '.wiki-page-tools', + '.feedback-container', + '.paging-container', + '.dropdown-wrapper', + '.mw-editsection', + '.jsx-4115608983', + '.jsx-4213937408', + '.commerce-container', + '.widget-container', + '.newsletter-signup-button' + ); + + // Remove useless elements + foreach($uselessElements as $uslElement) { + foreach($articlePage->find($uslElement) as $jsWidget) { + $jsWidget->remove(); + } + } + /* * NOTE: Though articles and wiki/howtos have seperate styles of pages, there is no mechanism * for handling them seperately as it just ignores the DOM querys which it does not find. @@ -33,19 +54,8 @@ protected function parseItem($newsItem){ } // For Wikis and HowTos - $uselessWikiElements = array( - '.wiki-page-tools', - '.feedback-container', - '.paging-container' - ); foreach($articlePage->find('.wiki-page') as $wikiContents) { - $copy = clone $wikiContents; - // Remove useless elements present in IGN wiki/howtos - foreach($uselessWikiElements as $uslElement) { - $toRemove = $wikiContents->find($uslElement, 0); - $copy = str_replace($toRemove, '', $copy); - } - $article = $article . $copy; + $article = $article . $wikiContents; } // Add content to feed