From 512a4f292b48de827357cbef6874d4c5df6d9e20 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 14 Feb 2017 22:36:33 +0100 Subject: [PATCH] bridges: Return parent::getURI by default --- bridges/AskfmBridge.php | 6 +++++- bridges/BandcampBridge.php | 6 +++++- bridges/BooruprojectBridge.php | 6 +++++- bridges/DailymotionBridge.php | 1 + bridges/FourchanBridge.php | 6 +++++- bridges/GithubIssueBridge.php | 16 ++++++++++------ bridges/GoComicsBridge.php | 6 +++++- bridges/GooglePlusPostBridge.php | 2 +- bridges/IdenticaBridge.php | 6 +++++- bridges/InstagramBridge.php | 6 +++++- bridges/NovelUpdatesBridge.php | 6 +++++- bridges/OpenClassroomsBridge.php | 6 +++++- bridges/PickyWallpapersBridge.php | 20 ++++++++++++-------- bridges/RTBFBridge.php | 6 +++++- bridges/TwitterBridge.php | 1 + bridges/VkBridge.php | 6 +++++- bridges/WebfailBridge.php | 2 +- bridges/WikipediaBridge.php | 10 +++++++--- bridges/WordPressBridge.php | 2 +- bridges/WorldOfTanksBridge.php | 16 ++++++++++------ lib/FeedExpander.php | 2 +- 21 files changed, 100 insertions(+), 38 deletions(-) diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index e871c9c0..7d6639b6 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -65,6 +65,10 @@ class AskfmBridge extends BridgeAbstract { } public function getURI(){ - return self::URI . urlencode($this->getInput('u')) . '/answers/more?page=0'; + if(!is_null($this->getInput('u'))){ + return self::URI . urlencode($this->getInput('u')) . '/answers/more?page=0'; + } + + return parent::getURI(); } } diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index 818a2d08..96c96da9 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -46,7 +46,11 @@ class BandcampBridge extends BridgeAbstract { } public function getURI(){ - return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date'; + if(!is_null($this->getInput('tag'))){ + return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date'; + } + + return parent::getURI(); } public function getName(){ diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php index 35b51491..1219b72f 100644 --- a/bridges/BooruprojectBridge.php +++ b/bridges/BooruprojectBridge.php @@ -28,7 +28,11 @@ class BooruprojectBridge extends GelbooruBridge { const PIDBYPAGE = 20; public function getURI(){ - return 'http://' . $this->getInput('i') . '.booru.org/'; + if(!is_null($this->getInput('i'))){ + return 'http://' . $this->getInput('i') . '.booru.org/'; + } + + return parent::getURI(); } public function getName(){ diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index 566d4a40..15ea52ff 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -116,6 +116,7 @@ class DailymotionBridge extends BridgeAbstract { $uri .= '/' . $this->getInput('pa'); } break; + default: return parent::getURI(); } return $uri; } diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index 7a83142e..5cfc6ea4 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -20,7 +20,11 @@ class FourchanBridge extends BridgeAbstract { )); public function getURI(){ - return static::URI . $this->getInput('c') . '/thread/' . $this->getInput('t'); + if(!is_null($this->getInput('c')) && !is_null($this->getInput('t'))){ + return static::URI . $this->getInput('c') . '/thread/' . $this->getInput('t'); + } + + return parent::getURI(); } public function collectData(){ diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index d1f1cc6f..d008f073 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -53,13 +53,17 @@ class GithubIssueBridge extends BridgeAbstract { } public function getURI(){ - $uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues'; - if($this->queriedContext === 'Issue comments'){ - $uri .= '/' . $this->getInput('i'); - } elseif($this->getInput('c')){ - $uri .= '?q=is%3Aissue+sort%3Aupdated-desc'; + if(!is_null($this->getInput('u')) && !is_null($this->getInput('p'))){ + $uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues'; + if($this->queriedContext === 'Issue comments'){ + $uri .= '/' . $this->getInput('i'); + } elseif($this->getInput('c')){ + $uri .= '?q=is%3Aissue+sort%3Aupdated-desc'; + } + return $uri; } - return $uri; + + return parent::getURI(); } protected function extractIssueComment($issueNbr, $title, $comment){ diff --git a/bridges/GoComicsBridge.php b/bridges/GoComicsBridge.php index 851e11fe..d4a6be21 100644 --- a/bridges/GoComicsBridge.php +++ b/bridges/GoComicsBridge.php @@ -42,7 +42,11 @@ class GoComicsBridge extends BridgeAbstract { } public function getURI(){ - return self::URI . urlencode($this->getInput('comicname')); + if(!is_null($this->getInput('comicname'))){ + return self::URI . urlencode($this->getInput('comicname')); + } + + return parent::getURI(); } public function getName(){ diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index 1ea5e202..39cfb9a0 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -97,6 +97,6 @@ class GooglePlusPostBridge extends BridgeAbstract{ } public function getURI(){ - return $this->_url ?: self::URI; + return $this->_url ?: parent::getURI(); } } diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php index ca101f41..826ff5b9 100644 --- a/bridges/IdenticaBridge.php +++ b/bridges/IdenticaBridge.php @@ -43,6 +43,10 @@ class IdenticaBridge extends BridgeAbstract { } public function getURI(){ - return self::URI . urlencode($this->getInput('u')); + if(!is_null($this->getInput('u'))){ + return self::URI . urlencode($this->getInput('u')); + } + + return parent::getURI(); } } diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index 555a2558..2bb94638 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -61,6 +61,10 @@ class InstagramBridge extends BridgeAbstract { } public function getURI(){ - return self::URI . urlencode($this->getInput('u')); + if(!is_null($this->getInput('u'))){ + return self::URI . urlencode($this->getInput('u')); + } + + return parent::getURI(); } } diff --git a/bridges/NovelUpdatesBridge.php b/bridges/NovelUpdatesBridge.php index 1a5880c7..5a2a8dab 100644 --- a/bridges/NovelUpdatesBridge.php +++ b/bridges/NovelUpdatesBridge.php @@ -17,7 +17,11 @@ class NovelUpdatesBridge extends BridgeAbstract { private $seriesTitle = ''; public function getURI(){ - return static::URI . '/series/' . $this->getInput('n') . '/'; + if(!is_null($this->getInput('n'))){ + return static::URI . '/series/' . $this->getInput('n') . '/'; + } + + return parent::getURI(); } public function collectData(){ diff --git a/bridges/OpenClassroomsBridge.php b/bridges/OpenClassroomsBridge.php index 24afb29c..eb4366cc 100644 --- a/bridges/OpenClassroomsBridge.php +++ b/bridges/OpenClassroomsBridge.php @@ -27,7 +27,11 @@ class OpenClassroomsBridge extends BridgeAbstract { )); public function getURI(){ - return self::URI . '/courses?categories=' . $this->getInput('u') . '&title=&sort=updatedAt+desc'; + if(!is_null($this->getInput('u'))){ + return self::URI . '/courses?categories=' . $this->getInput('u') . '&title=&sort=updatedAt+desc'; + } + + return parent::getURI(); } public function collectData(){ diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index 43e91c5b..340474e3 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -70,15 +70,19 @@ class PickyWallpapersBridge extends BridgeAbstract { } public function getURI(){ - $subcategory = $this->getInput('s'); - $link = self::URI - . $this->getInput('r') - . '/' - . $this->getInput('c') - . '/' - . $subcategory; + if(!is_null($this->getInput('s')) && !is_null($this->getInput('r')) && !is_null($this->getInput('c'))){ + $subcategory = $this->getInput('s'); + $link = self::URI + . $this->getInput('r') + . '/' + . $this->getInput('c') + . '/' + . $subcategory; - return $link; + return $link; + } + + return parent::getURI(); } public function getName(){ diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php index 6109704f..d8f5c67b 100644 --- a/bridges/RTBFBridge.php +++ b/bridges/RTBFBridge.php @@ -49,7 +49,11 @@ class RTBFBridge extends BridgeAbstract { } public function getURI(){ - return self::URI . 'detail?id=' . $this->getInput('c'); + if(!is_null($this->getInput('c'))){ + return self::URI . 'detail?id=' . $this->getInput('c'); + } + + return parent::getURI(); } public function getName(){ diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 60f2eaed..ef34285b 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -62,6 +62,7 @@ class TwitterBridge extends BridgeAbstract { return self::URI . urlencode($this->getInput('u')) . ($this->getInput('norep') ? '' : '/with_replies'); + default: return parent::getURI(); } } diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index d32782c4..97987f6b 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -16,7 +16,11 @@ class VkBridge extends BridgeAbstract { ); public function getURI(){ - return static::URI . urlencode($this->getInput('u')); + if(!is_null($this->getInput('u'))){ + return static::URI . urlencode($this->getInput('u')); + } + + return parent::getURI(); } public function collectData(){ diff --git a/bridges/WebfailBridge.php b/bridges/WebfailBridge.php index 55a5a683..46711223 100644 --- a/bridges/WebfailBridge.php +++ b/bridges/WebfailBridge.php @@ -34,7 +34,7 @@ class WebfailBridge extends BridgeAbstract { public function getURI(){ if(is_null($this->getInput('language'))) - return self::URI; + return parent::getURI(); // e.g.: https://en.webfail.com return 'https://' . $this->getInput('language') . '.webfail.com'; diff --git a/bridges/WikipediaBridge.php b/bridges/WikipediaBridge.php index 2410656d..ed024946 100644 --- a/bridges/WikipediaBridge.php +++ b/bridges/WikipediaBridge.php @@ -43,9 +43,13 @@ class WikipediaBridge extends BridgeAbstract { )); public function getURI(){ - return 'https://' - . strtolower($this->getInput('language')) - . '.wikipedia.org'; + if(!is_null($this->getInput('language'))){ + return 'https://' + . strtolower($this->getInput('language')) + . '.wikipedia.org'; + } + + return parent::getURI(); } public function getName(){ diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index 40e29e7f..954325e6 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -56,7 +56,7 @@ class WordPressBridge extends FeedExpander { public function getURI(){ $url = $this->getInput('url'); if(empty($url)){ - $url = static::URI; + $url = parent::getURI(); } return $url; } diff --git a/bridges/WorldOfTanksBridge.php b/bridges/WorldOfTanksBridge.php index 21f37d76..1cc41b73 100644 --- a/bridges/WorldOfTanksBridge.php +++ b/bridges/WorldOfTanksBridge.php @@ -28,13 +28,17 @@ class WorldOfTanksBridge extends BridgeAbstract { private $title = ''; - function getURI(){ - $lang = $this->getInput('lang'); - $uri = self::URI . $lang . '/news/'; - if(!empty($this->getInput('category'))) { - $uri .= 'pc-browser/' . $this->getInput('category') . '/'; + public function getURI(){ + if(!is_null($this->getInput('lang'))){ + $lang = $this->getInput('lang'); + $uri = self::URI . $lang . '/news/'; + if(!empty($this->getInput('category'))) { + $uri .= 'pc-browser/' . $this->getInput('category') . '/'; + } + return $uri; } - return $uri; + + return parent::getURI(); } public function getName(){ diff --git a/lib/FeedExpander.php b/lib/FeedExpander.php index eb9940f2..87545c99 100644 --- a/lib/FeedExpander.php +++ b/lib/FeedExpander.php @@ -190,7 +190,7 @@ abstract class FeedExpander extends BridgeAbstract { } public function getURI(){ - return $this->uri; + return $this->uri ?: parent::getURI(); } public function getName(){