diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index d44cba24..2e451e28 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -13,8 +13,7 @@ class ABCTabsBridge extends BridgeAbstract { $table = $html->find('table#myTable', 0)->children(1); - foreach ($table->find('tr') as $tab) - { + foreach ($table->find('tr') as $tab) { $item = array(); $item['author'] = $tab->find('td', 1)->plaintext . ' - ' diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php index d5f2b7e3..604199b2 100644 --- a/bridges/AllocineFRBridge.php +++ b/bridges/AllocineFRBridge.php @@ -22,9 +22,9 @@ class AllocineFRBridge extends BridgeAbstract { )); public function getURI(){ - if(!is_null($this->getInput('category'))){ + if(!is_null($this->getInput('category'))) { - switch($this->getInput('category')){ + switch($this->getInput('category')) { case 'faux-raccord': $uri = static::URI . 'video/programme-12284/saison-29841/'; break; @@ -43,7 +43,7 @@ class AllocineFRBridge extends BridgeAbstract { } public function getName(){ - if(!is_null($this->getInput('category'))){ + if(!is_null($this->getInput('category'))) { return self::NAME . ' : ' .array_search( $this->getInput('category'), @@ -64,15 +64,14 @@ class AllocineFRBridge extends BridgeAbstract { self::PARAMETERS[$this->queriedContext]['category']['values'] ); - foreach($html->find('figure.media-meta-fig') as $element){ + foreach($html->find('figure.media-meta-fig') as $element) { $item = array(); $title = $element->find('div.titlebar h3.title a', 0); $content = trim($element->innertext); $figCaption = strpos($content, $category); - if($figCaption !== false) - { + if($figCaption !== false) { $content = str_replace('src="/', 'src="' . static::URI, $content); $content = str_replace('href="/', 'href="' . static::URI, $content); $content = str_replace('src=\'/', 'src=\'' . static::URI, $content); diff --git a/bridges/AmazonBridge.php b/bridges/AmazonBridge.php index d7f77c51..cbc61190 100644 --- a/bridges/AmazonBridge.php +++ b/bridges/AmazonBridge.php @@ -51,7 +51,7 @@ class AmazonBridge extends BridgeAbstract { )); public function getName(){ - if(!is_null($this->getInput('tld')) && !is_null($this->getInput('q'))){ + if(!is_null($this->getInput('tld')) && !is_null($this->getInput('q'))) { return 'Amazon.'.$this->getInput('tld').': '.$this->getInput('q'); } diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index caedba1e..6c5427e5 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -120,7 +120,7 @@ class AnimeUltimeBridge extends BridgeAbstract { } public function getName() { - if(!is_null($this->getInput('type'))){ + if(!is_null($this->getInput('type'))) { $typeFilter = array_search( $this->getInput('type'), self::PARAMETERS[$this->queriedContext]['type']['values'] diff --git a/bridges/Arte7Bridge.php b/bridges/Arte7Bridge.php index 09a1ee4d..3d7ae9de 100644 --- a/bridges/Arte7Bridge.php +++ b/bridges/Arte7Bridge.php @@ -44,7 +44,7 @@ class Arte7Bridge extends BridgeAbstract { ); public function collectData(){ - switch($this->queriedContext){ + switch($this->queriedContext) { case 'Catégorie (Français)': $category = $this->getInput('catfr'); $lang = 'fr'; @@ -58,7 +58,7 @@ class Arte7Bridge extends BridgeAbstract { $url = self::URI . 'guide/' . $lang . '/plus7/' . $category; $input = getContents($url) or die('Could not request ARTE.'); - if(strpos($input, 'categoryVideoSet') !== false){ + if(strpos($input, 'categoryVideoSet') !== false) { $input = explode('categoryVideoSet="', $input); $input = explode('}}', $input[1]); $input = $input[0] . '}}'; diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index 4b1597db..e2274618 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -19,7 +19,7 @@ class AskfmBridge extends BridgeAbstract { $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Requested username can\'t be found.'); - foreach($html->find('div.streamItem-answer') as $element){ + foreach($html->find('div.streamItem-answer') as $element) { $item = array(); $item['uri'] = self::URI . $element->find('a.streamItemsAge', 0)->href; $question = trim($element->find('h1.streamItemContent-question', 0)->innertext); @@ -38,7 +38,7 @@ class AskfmBridge extends BridgeAbstract { // This probably should be cleaned up, especially for YouTube embeds $visual = $element->find('div.streamItemContent-visual', 0)->innertext; //Fix tracking links, also doesn't work - foreach($element->find('a') as $link){ + foreach($element->find('a') as $link) { if(strpos($link->href, 'l.ask.fm') !== false) { // Too slow @@ -57,7 +57,7 @@ class AskfmBridge extends BridgeAbstract { } public function getName(){ - if(!is_null($this->getInput('u'))){ + if(!is_null($this->getInput('u'))) { return self::NAME . ' : ' . $this->getInput('u'); } @@ -65,7 +65,7 @@ class AskfmBridge extends BridgeAbstract { } public function getURI(){ - if(!is_null($this->getInput('u'))){ + if(!is_null($this->getInput('u'))) { return self::URI . urlencode($this->getInput('u')) . '/answers/more?page=0'; } diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index 28e9ba57..0527da03 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -18,7 +18,7 @@ class BandcampBridge extends BridgeAbstract { $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('No results for this query.'); - foreach($html->find('li.item') as $release){ + foreach($html->find('li.item') as $release) { $script = $release->find('div.art', 0)->getAttribute('onclick'); $uri = ltrim($script, "return 'url("); $uri = rtrim($uri, "')"); @@ -46,7 +46,7 @@ class BandcampBridge extends BridgeAbstract { } public function getURI(){ - if(!is_null($this->getInput('tag'))){ + if(!is_null($this->getInput('tag'))) { return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date'; } @@ -54,7 +54,7 @@ class BandcampBridge extends BridgeAbstract { } public function getName(){ - if(!is_null($this->getInput('tag'))){ + if(!is_null($this->getInput('tag'))) { return $this->getInput('tag') . ' - Bandcamp Tag'; } diff --git a/bridges/BastaBridge.php b/bridges/BastaBridge.php index 11a31ac8..17d3da76 100644 --- a/bridges/BastaBridge.php +++ b/bridges/BastaBridge.php @@ -19,8 +19,8 @@ class BastaBridge extends BridgeAbstract { $limit = 0; - foreach($html->find('item') as $element){ - if($limit < 10){ + foreach($html->find('item') as $element) { + if($limit < 10) { $item = array(); $item['title'] = $element->find('title', 0)->innertext; $item['uri'] = $element->find('guid', 0)->plaintext; diff --git a/bridges/BlaguesDeMerdeBridge.php b/bridges/BlaguesDeMerdeBridge.php index 12814a50..25c018a8 100644 --- a/bridges/BlaguesDeMerdeBridge.php +++ b/bridges/BlaguesDeMerdeBridge.php @@ -11,11 +11,11 @@ class BlaguesDeMerdeBridge extends BridgeAbstract { $html = getSimpleHTMLDOM(self::URI) or returnServerError('Could not request BDM.'); - foreach($html->find('article.joke_contener') as $element){ + foreach($html->find('article.joke_contener') as $element) { $item = array(); $temp = $element->find('a'); - if(isset($temp[2])){ + if(isset($temp[2])) { $item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext); $uri = $temp[2]->href; $item['uri'] = $uri; diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php index 1219b72f..6815d370 100644 --- a/bridges/BooruprojectBridge.php +++ b/bridges/BooruprojectBridge.php @@ -28,7 +28,7 @@ class BooruprojectBridge extends GelbooruBridge { const PIDBYPAGE = 20; public function getURI(){ - if(!is_null($this->getInput('i'))){ + if(!is_null($this->getInput('i'))) { return 'http://' . $this->getInput('i') . '.booru.org/'; } @@ -36,7 +36,7 @@ class BooruprojectBridge extends GelbooruBridge { } public function getName(){ - if(!is_null($this->getInput('i'))){ + if(!is_null($this->getInput('i'))) { return static::NAME . ' ' . $this->getInput('i'); } diff --git a/bridges/CADBridge.php b/bridges/CADBridge.php index 761d77f4..09e3e65a 100644 --- a/bridges/CADBridge.php +++ b/bridges/CADBridge.php @@ -25,7 +25,7 @@ class CADBridge extends FeedExpander { $htmlpart = explode("/", $url); - switch ($htmlpart[3]){ + switch ($htmlpart[3]) { case 'cad': preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2); break; diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index 0abd02cc..eefb7051 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -17,7 +17,7 @@ topic found in some section URLs, else all topics are selected.'; public function collectData(){ function extractFromDelimiters($string, $start, $end){ - if(strpos($string, $start) !== false){ + if(strpos($string, $start) !== false) { $section_retrieved = substr($string, strpos($string, $start) + strlen($start)); $section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end)); return $section_retrieved; @@ -27,7 +27,7 @@ topic found in some section URLs, else all topics are selected.'; } function stripWithDelimiters($string, $start, $end){ - while(strpos($string, $start) !== false){ + while(strpos($string, $start) !== false) { $section_to_remove = substr($string, strpos($string, $start)); $section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end)); $string = str_replace($section_to_remove, '', $string); @@ -49,14 +49,14 @@ topic found in some section URLs, else all topics are selected.'; $html = getSimpleHTMLDOM($pageUrl) or returnServerError('Could not request CNET: ' . $pageUrl); $limit = 0; - foreach($html->find('div.assetBody') as $element){ - if($limit < 8){ + foreach($html->find('div.assetBody') as $element) { + if($limit < 8) { $article_title = trim($element->find('h2', 0)->plaintext); $article_uri = self::URI . ($element->find('a', 0)->href); $article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext); $article_author = trim($element->find('a[rel=author]', 0)->plaintext); - if(!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false){ + if(!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) { $article_html = getSimpleHTMLDOM($article_uri) or returnServerError('Could not request CNET: ' . $article_uri); $article_content = trim( @@ -83,7 +83,7 @@ topic found in some section URLs, else all topics are selected.'; } public function getName(){ - if(!is_null($this->getInput('topic'))){ + if(!is_null($this->getInput('topic'))) { $topic = $this->getInput('topic'); return 'CNET News Bridge' . (empty($topic) ? '' : ' - ' . $topic); } diff --git a/bridges/CastorusBridge.php b/bridges/CastorusBridge.php index 119d3535..3ed1331e 100644 --- a/bridges/CastorusBridge.php +++ b/bridges/CastorusBridge.php @@ -57,7 +57,7 @@ class CastorusBridge extends BridgeAbstract { if(!$nodes) returnServerError('Cannot find nodes!'); - foreach($nodes as $node){ + foreach($nodes as $node) { $node->outertext = ''; } @@ -88,7 +88,7 @@ class CastorusBridge extends BridgeAbstract { if(!$activities) returnServerError('Failed to find activities!'); - foreach($activities as $activity){ + foreach($activities as $activity) { $item = array(); $item['title'] = $this->extractActivityTitle($activity); @@ -103,12 +103,12 @@ class CastorusBridge extends BridgeAbstract { . '
'; if(isset($zip_filter) - && !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)){ + && !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)) { continue; // Skip this item } if(isset($city_filter) - && !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)){ + && !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)) { continue; // Skip this item } diff --git a/bridges/CollegeDeFranceBridge.php b/bridges/CollegeDeFranceBridge.php index 6a570948..1f816832 100644 --- a/bridges/CollegeDeFranceBridge.php +++ b/bridges/CollegeDeFranceBridge.php @@ -37,7 +37,7 @@ class CollegeDeFranceBridge extends BridgeAbstract { . 'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all') or returnServerError('Could not request CollegeDeFrance.'); - foreach($html->find('a[data-target]') as $element){ + foreach($html->find('a[data-target]') as $element) { $item = array(); $item['title'] = $element->find('.title', 0)->plaintext; @@ -60,7 +60,7 @@ class CollegeDeFranceBridge extends BridgeAbstract { $timezone ); - if(!$d){ + if(!$d) { $d = DateTime::createFromFormat( '!d m Y', trim(str_replace( diff --git a/bridges/CopieDoubleBridge.php b/bridges/CopieDoubleBridge.php index af805f21..767cdce3 100644 --- a/bridges/CopieDoubleBridge.php +++ b/bridges/CopieDoubleBridge.php @@ -13,16 +13,16 @@ class CopieDoubleBridge extends BridgeAbstract { $table = $html->find('table table', 2); - foreach($table->find('tr') as $element){ + foreach($table->find('tr') as $element) { $td = $element->find('td', 0); - if($td->class === 'couleur_1'){ + if($td->class === 'couleur_1') { $item = array(); $title = $td->innertext; $pos = strpos($title, 'innertext, '/images/suivant.gif') === false){ + } elseif(strpos($element->innertext, '/images/suivant.gif') === false) { $a = $element->find('a', 0); $item['uri'] = self::URI . $a->href; $content = str_replace('src="/', 'src="/' . self::URI, $element->find("td", 0)->innertext); diff --git a/bridges/CourrierInternationalBridge.php b/bridges/CourrierInternationalBridge.php index e666bfd5..15738633 100644 --- a/bridges/CourrierInternationalBridge.php +++ b/bridges/CourrierInternationalBridge.php @@ -14,12 +14,12 @@ class CourrierInternationalBridge extends BridgeAbstract { $element = $html->find("article"); $article_count = 1; - foreach($element as $article){ + foreach($element as $article) { $item = array(); $item['uri'] = $article->parent->getAttribute('href'); - if(strpos($item['uri'], 'http') === false){ + if(strpos($item['uri'], 'http') === false) { $item['uri'] = self::URI . $item['uri']; } @@ -27,7 +27,7 @@ class CourrierInternationalBridge extends BridgeAbstract { $content = $page->find('.article-text', 0); - if(!$content){ + if(!$content) { $content = $page->find('.depeche-text', 0); } diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php index 9ca95f44..19efd84a 100644 --- a/bridges/CpasbienBridge.php +++ b/bridges/CpasbienBridge.php @@ -20,9 +20,9 @@ class CpasbienBridge extends BridgeAbstract { $html = getSimpleHTMLDOM(self::URI . '/recherche/' . urlencode($request) . '.html') or returnServerError('No results for this query.'); - foreach($html->find('#gauche', 0)->find('div') as $episode){ + foreach($html->find('#gauche', 0)->find('div') as $episode) { if($episode->getAttribute('class') == 'ligne0' - || $episode->getAttribute('class') == 'ligne1'){ + || $episode->getAttribute('class') == 'ligne1') { $urlepisode = $episode->find('a', 0)->getAttribute('href'); $htmlepisode = getSimpleHTMLDOMCached($urlepisode, 86400 * 366 * 30); @@ -33,11 +33,11 @@ class CpasbienBridge extends BridgeAbstract { $item['pubdate'] = $this->getCachedDate($urlepisode); $textefiche = $htmlepisode->find('#textefiche', 0)->find('p', 1); - if(isset($textefiche)){ + if(isset($textefiche)) { $item['content'] = $textefiche->text(); } else { $p = $htmlepisode->find('#textefiche', 0)->find('p'); - if(!empty($p)){ + if(!empty($p)) { $item['content'] = $htmlepisode->find('#textefiche', 0)->find('p', 0)->text(); } } @@ -50,7 +50,7 @@ class CpasbienBridge extends BridgeAbstract { } public function getName(){ - if(!is_null($this->getInput('q'))){ + if(!is_null($this->getInput('q'))) { return $this->getInput('q') . ' : ' . self::NAME; } diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index 78fec3c1..8a3936f4 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -23,12 +23,12 @@ class CryptomeBridge extends BridgeAbstract { $number = $this->getInput('n'); /* number of documents */ - if(!empty($number)){ + if(!empty($number)) { $num = min($number, 20); } - foreach($html->find('pre') as $element){ - for($i = 0; $i < $num; ++$i){ + foreach($html->find('pre') as $element) { + for($i = 0; $i < $num; ++$i) { $item = array(); $item['uri'] = self::URI . substr($element->find('a', $i)->href, 20); $item['title'] = substr($element->find('b', $i)->plaintext, 22); diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index 15ea52ff..d075041c 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -35,7 +35,7 @@ class DailymotionBridge extends BridgeAbstract { protected function getMetadata($id){ $metadata = array(); $html2 = getSimpleHTMLDOM(self::URI . 'video/' . $id); - if(!$html2){ + if(!$html2) { return $metadata; } @@ -56,12 +56,12 @@ class DailymotionBridge extends BridgeAbstract { $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request Dailymotion.'); - foreach($html->find('div.media a.preview_link') as $element){ - if($count < $limit){ + foreach($html->find('div.media a.preview_link') as $element) { + if($count < $limit) { $item = array(); $item['id'] = str_replace('/video/', '', strtok($element->href, '_')); $metadata = $this->getMetadata($item['id']); - if(empty($metadata)){ + if(empty($metadata)) { continue; } $item['uri'] = $metadata['uri']; @@ -85,7 +85,7 @@ class DailymotionBridge extends BridgeAbstract { } public function getName(){ - switch($this->queriedContext){ + switch($this->queriedContext) { case 'By username': $specific = $this->getInput('u'); break; @@ -103,7 +103,7 @@ class DailymotionBridge extends BridgeAbstract { public function getURI(){ $uri = self::URI; - switch($this->queriedContext){ + switch($this->queriedContext) { case 'By username': $uri .= 'user/' . urlencode($this->getInput('u')) . '/1'; break; @@ -112,7 +112,7 @@ class DailymotionBridge extends BridgeAbstract { break; case 'From search results': $uri .= 'search/' . urlencode($this->getInput('s')); - if($this->getInput('pa')){ + if($this->getInput('pa')) { $uri .= '/' . $this->getInput('pa'); } break; diff --git a/bridges/DansTonChatBridge.php b/bridges/DansTonChatBridge.php index 56bb4c19..545f1628 100644 --- a/bridges/DansTonChatBridge.php +++ b/bridges/DansTonChatBridge.php @@ -12,7 +12,7 @@ class DansTonChatBridge extends BridgeAbstract { $html = getSimpleHTMLDOM(self::URI . 'latest.html') or returnServerError('Could not request DansTonChat.'); - foreach($html->find('div.item') as $element){ + foreach($html->find('div.item') as $element) { $item = array(); $item['uri'] = $element->find('a', 0)->href; $item['title'] = 'DansTonChat ' . $element->find('a', 1)->plaintext; diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 35783358..7547d740 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -34,7 +34,7 @@ class DauphineLibereBridge extends FeedExpander { public function collectData(){ $url = self::URI . 'rss'; - if(empty($this->getInput('u'))){ + if(empty($this->getInput('u'))) { $url = self::URI . $this->getInput('u') . '/rss'; } diff --git a/bridges/DilbertBridge.php b/bridges/DilbertBridge.php index 2c5e6396..959a91a2 100644 --- a/bridges/DilbertBridge.php +++ b/bridges/DilbertBridge.php @@ -12,7 +12,7 @@ class DilbertBridge extends BridgeAbstract { $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request Dilbert: ' . $this->getURI()); - foreach($html->find('section.comic-item') as $element){ + foreach($html->find('section.comic-item') as $element) { $img = $element->find('img', 0); $link = $element->find('a', 0); diff --git a/bridges/DuckDuckGoBridge.php b/bridges/DuckDuckGoBridge.php index 554a050f..8533be5e 100644 --- a/bridges/DuckDuckGoBridge.php +++ b/bridges/DuckDuckGoBridge.php @@ -31,7 +31,7 @@ class DuckDuckGoBridge extends BridgeAbstract { $html = getSimpleHTMLDOM(self::URI . 'html/?kd=-1&q=' . $this->getInput('u') . $this->getInput('sort')) or returnServerError('Could not request DuckDuckGo.'); - foreach($html->find('div.results_links') as $element){ + foreach($html->find('div.results_links') as $element) { $item = array(); $item['uri'] = $element->find('a', 0)->href; $item['title'] = $element->find('a', 1)->innertext; diff --git a/bridges/EZTVBridge.php b/bridges/EZTVBridge.php index f17c2b46..4fb9e578 100644 --- a/bridges/EZTVBridge.php +++ b/bridges/EZTVBridge.php @@ -23,7 +23,7 @@ on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.'; $relativeDays = 0; $relativeHours = 0; - foreach(explode(" ", $relativeReleaseTime) as $relativeTimeElement){ + foreach(explode(" ", $relativeReleaseTime) as $relativeTimeElement) { if(substr($relativeTimeElement, -1) == "d") $relativeDays = substr($relativeTimeElement, 0, -1); if(substr($relativeTimeElement, -1) == "h") $relativeHours = substr($relativeTimeElement, 0, -1); } @@ -32,14 +32,14 @@ on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.'; // Loop on show ids $showList = explode(",", $this->getInput('i')); - foreach($showList as $showID){ + foreach($showList as $showID) { // Get show page $html = getSimpleHTMLDOM(self::URI . 'shows/' . rawurlencode($showID) . '/') or returnServerError('Could not request EZTV for id "' . $showID . '"'); // Loop on each element that look like an episode entry... - foreach($html->find('.forum_header_border') as $element){ + foreach($html->find('.forum_header_border') as $element) { // Filter entries that are not episode entries $ep = $element->find('td', 1); diff --git a/bridges/EliteDangerousGalnetBridge.php b/bridges/EliteDangerousGalnetBridge.php index 4c3362da..86a1bbfc 100644 --- a/bridges/EliteDangerousGalnetBridge.php +++ b/bridges/EliteDangerousGalnetBridge.php @@ -11,7 +11,7 @@ class EliteDangerousGalnetBridge extends BridgeAbstract { $html = getSimpleHTMLDOM(self::URI) or returnServerError('Error while downloading the website content'); - foreach($html->find('div.article') as $element){ + foreach($html->find('div.article') as $element) { $item = array(); $uri = $element->find('h3 a', 0)->href; diff --git a/bridges/ElsevierBridge.php b/bridges/ElsevierBridge.php index af9f3971..f6ba7ddb 100644 --- a/bridges/ElsevierBridge.php +++ b/bridges/ElsevierBridge.php @@ -27,7 +27,7 @@ class ElsevierBridge extends BridgeAbstract { // Extracts the timestamp from an article private function extractArticleTimestamp($article){ $time = $article->find('.article-info', 0); - if($time){ + if($time) { $timestring = trim($time->plaintext); /* The format depends on the age of an article: @@ -35,11 +35,11 @@ class ElsevierBridge extends BridgeAbstract { - July 2016 - May–June 2016 */ - if(preg_match('/\S*(\d+\s\S+\s\d{4})/ims', $timestring, $matches)){ + if(preg_match('/\S*(\d+\s\S+\s\d{4})/ims', $timestring, $matches)) { return strtotime($matches[0]); - } elseif (preg_match('/[A-Za-z]+\-([A-Za-z]+\s\d{4})/ims', $timestring, $matches)){ + } elseif (preg_match('/[A-Za-z]+\-([A-Za-z]+\s\d{4})/ims', $timestring, $matches)) { return strtotime($matches[0]); - } elseif (preg_match('/([A-Za-z]+\s\d{4})/ims', $timestring, $matches)){ + } elseif (preg_match('/([A-Za-z]+\s\d{4})/ims', $timestring, $matches)) { return strtotime($matches[0]); } else { return 0; @@ -51,7 +51,7 @@ class ElsevierBridge extends BridgeAbstract { // Extracts the content from an article private function extractArticleContent($article){ $content = $article->find('.article-content', 0); - if($content){ + if($content) { return trim($content->plaintext); } return ''; @@ -62,7 +62,7 @@ class ElsevierBridge extends BridgeAbstract { $html = getSimpleHTMLDOM($uri) or returnServerError('No results for Elsevier journal ' . $this->getInput('j')); - foreach($html->find('.pod-listing') as $article){ + foreach($html->find('.pod-listing') as $article) { $item = array(); $item['uri'] = $article->find('.pod-listing-header>a', 0)->getAttribute('href') . '?np=y'; $item['title'] = $article->find('.pod-listing-header>a', 0)->plaintext; diff --git a/bridges/EstCeQuonMetEnProdBridge.php b/bridges/EstCeQuonMetEnProdBridge.php index 5526eae2..db9d1d5f 100644 --- a/bridges/EstCeQuonMetEnProdBridge.php +++ b/bridges/EstCeQuonMetEnProdBridge.php @@ -9,7 +9,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract { public function collectData(){ function extractFromDelimiters($string, $start, $end){ - if(strpos($string, $start) !== false){ + if(strpos($string, $start) !== false) { $section_retrieved = substr($string, strpos($string, $start) + strlen($start)); $section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end)); return $section_retrieved; diff --git a/bridges/EtsyBridge.php b/bridges/EtsyBridge.php index 756ab107..311d9109 100644 --- a/bridges/EtsyBridge.php +++ b/bridges/EtsyBridge.php @@ -38,7 +38,7 @@ class EtsyBridge extends BridgeAbstract { $results = $html->find('div.block-grid-item'); - foreach($results as $result){ + foreach($results as $result) { // Skip banner cards (ads for categories) if($result->find('a.banner-card')) continue; @@ -57,7 +57,7 @@ class EtsyBridge extends BridgeAbstract { $image = $result->find('img.placeholder', 0)->src; - if($this->getInput('showimage')){ + if($this->getInput('showimage')) { $item['content'] .= ''; } @@ -68,10 +68,10 @@ class EtsyBridge extends BridgeAbstract { } public function getURI(){ - if(!is_null($this->getInput('query'))){ + if(!is_null($this->getInput('query'))) { $uri = self::URI . '/search?q=' . urlencode($this->getInput('query')); - if(!is_null($this->getInput('queryextension'))){ + if(!is_null($this->getInput('queryextension'))) { $uri .= $this->getInput('queryextension'); } diff --git a/bridges/FB2Bridge.php b/bridges/FB2Bridge.php index 779b48aa..7d78b87f 100644 --- a/bridges/FB2Bridge.php +++ b/bridges/FB2Bridge.php @@ -18,7 +18,7 @@ class FB2Bridge extends BridgeAbstract { public function collectData(){ function extractFromDelimiters($string, $start, $end){ - if(strpos($string, $start) !== false){ + if(strpos($string, $start) !== false) { $section_retrieved = substr($string, strpos($string, $start) + strlen($start)); $section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end)); return $section_retrieved; @@ -29,7 +29,7 @@ class FB2Bridge extends BridgeAbstract { //Utility function for cleaning a Facebook link $unescape_fb_link = function($matches){ - if(is_array($matches) && count($matches) > 1){ + if(is_array($matches) && count($matches) > 1) { $link = $matches[1]; if(strpos($link, '/') === 0) $link = self::URI . $link . '"'; @@ -72,12 +72,12 @@ class FB2Bridge extends BridgeAbstract { return $matches[0]; }; - if($this->getInput('u') !== null){ + if($this->getInput('u') !== null) { $page = 'https://touch.facebook.com/' . $this->getInput('u'); $cookies = $this->getCookies($page); $pageID = $this->getPageID($page, $cookies); - if($pageID === null){ + if($pageID === null) { echo <<No updates available
"; @@ -130,14 +130,14 @@ class MangareaderBridge extends BridgeAbstract { // Query each item (consists of Manga + chapters) $nodes = $xpath->query("//*[@id='latestchapters']/table//td"); - foreach ($nodes as $node){ + foreach ($nodes as $node) { // Query the manga $manga = $xpath->query("a[@class='chapter']", $node)->item(0); // Collect the chapters for each Manga $chapters = $xpath->query("a[@class='chaptersrec']", $node); - if (isset($manga) && $chapters->length >= 1){ + if (isset($manga) && $chapters->length >= 1) { $item = array(); $item['uri'] = self::URI . htmlspecialchars($manga->getAttribute('href')); $item['title'] = htmlspecialchars($manga->nodeValue); @@ -145,8 +145,8 @@ class MangareaderBridge extends BridgeAbstract { // Add each chapter to the feed $item['content'] = ""; - foreach ($chapters as $chapter){ - if($item['content'] <> ""){ + foreach ($chapters as $chapter) { + if($item['content'] <> "") { $item['content'] .= "Could not request ' . $this->getName() . ': ' . $item['uri'] . '
'; return $item; } diff --git a/bridges/WebfailBridge.php b/bridges/WebfailBridge.php index a1060f4f..2a637407 100644 --- a/bridges/WebfailBridge.php +++ b/bridges/WebfailBridge.php @@ -49,7 +49,7 @@ class WebfailBridge extends BridgeAbstract { $type = array_search($this->getInput('type'), self::PARAMETERS[$this->queriedContext]['type']['values']); - switch(strtolower($type)){ + switch(strtolower($type)) { case 'facebook': case 'videos': $this->extractNews($html, $type); @@ -65,14 +65,14 @@ class WebfailBridge extends BridgeAbstract { private function extractNews($html, $type){ $news = $html->find('#main', 0)->find('a.wf-list-news'); - foreach($news as $element){ + foreach($news as $element) { $item = array(); $item['title'] = $this->fixTitle($element->find('div.wf-news-title', 0)->innertext); $item['uri'] = $this->getURI() . $element->href; $img = $element->find('img.wf-image', 0)->src; // Load high resolution image for 'facebook' - switch(strtolower($type)){ + switch(strtolower($type)) { case 'facebook': $img = $this->getImageHiResUri($item['uri']); break; @@ -80,7 +80,7 @@ class WebfailBridge extends BridgeAbstract { } $description = ''; - if(!is_null($element->find('div.wf-news-description', 0))){ + if(!is_null($element->find('div.wf-news-description', 0))) { $description = $element->find('div.wf-news-description', 0)->innertext; } @@ -98,19 +98,19 @@ class WebfailBridge extends BridgeAbstract { private function extractArticle($html){ $articles = $html->find('article'); - foreach($articles as $article){ + foreach($articles as $article) { $item = array(); $item['title'] = $this->fixTitle($article->find('a', 1)->innertext); // Images, videos and gifs are provided in their own unique way - if(!is_null($article->find('img.wf-image', 0))){ // Image type + if(!is_null($article->find('img.wf-image', 0))) { // Image type $item['uri'] = $this->getURI() . $article->find('a', 2)->href; $item['content'] = ''; - } elseif(!is_null($article->find('div.wf-video', 0))){ // Video type + } elseif(!is_null($article->find('div.wf-video', 0))) { // Video type $videoId = $this->getVideoId($article->find('div.wf-play', 0)->onclick); $item['uri'] = 'https://youtube.com/watch?v=' . $videoId; $item['content'] = ''; - } elseif(!is_null($article->find('video[id*=gif-]', 0))){ // Gif type + } elseif(!is_null($article->find('video[id*=gif-]', 0))) { // Gif type $item['uri'] = $this->getURI() . $article->find('a', 2)->href; $item['content'] = '