bridges: Return parent::getURI by default

This commit is contained in:
logmanoriginal 2017-02-14 22:36:33 +01:00
parent c4169f1579
commit 512a4f292b
21 changed files with 100 additions and 38 deletions

View File

@ -65,6 +65,10 @@ class AskfmBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('u'))){
return self::URI . urlencode($this->getInput('u')) . '/answers/more?page=0'; return self::URI . urlencode($this->getInput('u')) . '/answers/more?page=0';
} }
return parent::getURI();
}
} }

View File

@ -46,9 +46,13 @@ class BandcampBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('tag'))){
return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date'; return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date';
} }
return parent::getURI();
}
public function getName(){ public function getName(){
if(!is_null($this->getInput('tag'))){ if(!is_null($this->getInput('tag'))){
return $this->getInput('tag') . ' - Bandcamp Tag'; return $this->getInput('tag') . ' - Bandcamp Tag';

View File

@ -28,9 +28,13 @@ class BooruprojectBridge extends GelbooruBridge {
const PIDBYPAGE = 20; const PIDBYPAGE = 20;
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('i'))){
return 'http://' . $this->getInput('i') . '.booru.org/'; return 'http://' . $this->getInput('i') . '.booru.org/';
} }
return parent::getURI();
}
public function getName(){ public function getName(){
if(!is_null($this->getInput('i'))){ if(!is_null($this->getInput('i'))){
return static::NAME . ' ' . $this->getInput('i'); return static::NAME . ' ' . $this->getInput('i');

View File

@ -116,6 +116,7 @@ class DailymotionBridge extends BridgeAbstract {
$uri .= '/' . $this->getInput('pa'); $uri .= '/' . $this->getInput('pa');
} }
break; break;
default: return parent::getURI();
} }
return $uri; return $uri;
} }

View File

@ -20,9 +20,13 @@ class FourchanBridge extends BridgeAbstract {
)); ));
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('c')) && !is_null($this->getInput('t'))){
return static::URI . $this->getInput('c') . '/thread/' . $this->getInput('t'); return static::URI . $this->getInput('c') . '/thread/' . $this->getInput('t');
} }
return parent::getURI();
}
public function collectData(){ public function collectData(){
$html = getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())

View File

@ -53,6 +53,7 @@ class GithubIssueBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('u')) && !is_null($this->getInput('p'))){
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues'; $uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues';
if($this->queriedContext === 'Issue comments'){ if($this->queriedContext === 'Issue comments'){
$uri .= '/' . $this->getInput('i'); $uri .= '/' . $this->getInput('i');
@ -62,6 +63,9 @@ class GithubIssueBridge extends BridgeAbstract {
return $uri; return $uri;
} }
return parent::getURI();
}
protected function extractIssueComment($issueNbr, $title, $comment){ protected function extractIssueComment($issueNbr, $title, $comment){
$class = $comment->getAttribute('class'); $class = $comment->getAttribute('class');
$classes = explode(' ', $class); $classes = explode(' ', $class);

View File

@ -42,9 +42,13 @@ class GoComicsBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('comicname'))){
return self::URI . urlencode($this->getInput('comicname')); return self::URI . urlencode($this->getInput('comicname'));
} }
return parent::getURI();
}
public function getName(){ public function getName(){
if(!is_null($this->getInput('comicname'))){ if(!is_null($this->getInput('comicname'))){
return $this->getInput('comicname') . ' - GoComics'; return $this->getInput('comicname') . ' - GoComics';

View File

@ -97,6 +97,6 @@ class GooglePlusPostBridge extends BridgeAbstract{
} }
public function getURI(){ public function getURI(){
return $this->_url ?: self::URI; return $this->_url ?: parent::getURI();
} }
} }

View File

@ -43,6 +43,10 @@ class IdenticaBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('u'))){
return self::URI . urlencode($this->getInput('u')); return self::URI . urlencode($this->getInput('u'));
} }
return parent::getURI();
}
} }

View File

@ -61,6 +61,10 @@ class InstagramBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('u'))){
return self::URI . urlencode($this->getInput('u')); return self::URI . urlencode($this->getInput('u'));
} }
return parent::getURI();
}
} }

View File

@ -17,9 +17,13 @@ class NovelUpdatesBridge extends BridgeAbstract {
private $seriesTitle = ''; private $seriesTitle = '';
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('n'))){
return static::URI . '/series/' . $this->getInput('n') . '/'; return static::URI . '/series/' . $this->getInput('n') . '/';
} }
return parent::getURI();
}
public function collectData(){ public function collectData(){
$fullhtml = getSimpleHTMLDOM($this->getURI()) $fullhtml = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request NovelUpdates, novel "' . $this->getInput('n') . '" not found'); or returnServerError('Could not request NovelUpdates, novel "' . $this->getInput('n') . '" not found');

View File

@ -27,9 +27,13 @@ class OpenClassroomsBridge extends BridgeAbstract {
)); ));
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('u'))){
return self::URI . '/courses?categories=' . $this->getInput('u') . '&title=&sort=updatedAt+desc'; return self::URI . '/courses?categories=' . $this->getInput('u') . '&title=&sort=updatedAt+desc';
} }
return parent::getURI();
}
public function collectData(){ public function collectData(){
$html = getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request OpenClassrooms.'); or returnServerError('Could not request OpenClassrooms.');

View File

@ -70,6 +70,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('s')) && !is_null($this->getInput('r')) && !is_null($this->getInput('c'))){
$subcategory = $this->getInput('s'); $subcategory = $this->getInput('s');
$link = self::URI $link = self::URI
. $this->getInput('r') . $this->getInput('r')
@ -81,6 +82,9 @@ class PickyWallpapersBridge extends BridgeAbstract {
return $link; return $link;
} }
return parent::getURI();
}
public function getName(){ public function getName(){
if(!is_null($this->getInput('s'))){ if(!is_null($this->getInput('s'))){
$subcategory = $this->getInput('s'); $subcategory = $this->getInput('s');

View File

@ -49,9 +49,13 @@ class RTBFBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('c'))){
return self::URI . 'detail?id=' . $this->getInput('c'); return self::URI . 'detail?id=' . $this->getInput('c');
} }
return parent::getURI();
}
public function getName(){ public function getName(){
if(!is_null($this->getInput('c'))){ if(!is_null($this->getInput('c'))){
return $this->getInput('c') .' - RTBF Bridge'; return $this->getInput('c') .' - RTBF Bridge';

View File

@ -62,6 +62,7 @@ class TwitterBridge extends BridgeAbstract {
return self::URI return self::URI
. urlencode($this->getInput('u')) . urlencode($this->getInput('u'))
. ($this->getInput('norep') ? '' : '/with_replies'); . ($this->getInput('norep') ? '' : '/with_replies');
default: return parent::getURI();
} }
} }

View File

@ -16,9 +16,13 @@ class VkBridge extends BridgeAbstract {
); );
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('u'))){
return static::URI . urlencode($this->getInput('u')); return static::URI . urlencode($this->getInput('u'));
} }
return parent::getURI();
}
public function collectData(){ public function collectData(){
$text_html = getContents($this->getURI()) $text_html = getContents($this->getURI())
or returnServerError('No results for group or user name "' . $this->getInput('u') . '".'); or returnServerError('No results for group or user name "' . $this->getInput('u') . '".');

View File

@ -34,7 +34,7 @@ class WebfailBridge extends BridgeAbstract {
public function getURI(){ public function getURI(){
if(is_null($this->getInput('language'))) if(is_null($this->getInput('language')))
return self::URI; return parent::getURI();
// e.g.: https://en.webfail.com // e.g.: https://en.webfail.com
return 'https://' . $this->getInput('language') . '.webfail.com'; return 'https://' . $this->getInput('language') . '.webfail.com';

View File

@ -43,11 +43,15 @@ class WikipediaBridge extends BridgeAbstract {
)); ));
public function getURI(){ public function getURI(){
if(!is_null($this->getInput('language'))){
return 'https://' return 'https://'
. strtolower($this->getInput('language')) . strtolower($this->getInput('language'))
. '.wikipedia.org'; . '.wikipedia.org';
} }
return parent::getURI();
}
public function getName(){ public function getName(){
switch($this->getInput('subject')){ switch($this->getInput('subject')){
case 'tfa': case 'tfa':

View File

@ -56,7 +56,7 @@ class WordPressBridge extends FeedExpander {
public function getURI(){ public function getURI(){
$url = $this->getInput('url'); $url = $this->getInput('url');
if(empty($url)){ if(empty($url)){
$url = static::URI; $url = parent::getURI();
} }
return $url; return $url;
} }

View File

@ -28,7 +28,8 @@ class WorldOfTanksBridge extends BridgeAbstract {
private $title = ''; private $title = '';
function getURI(){ public function getURI(){
if(!is_null($this->getInput('lang'))){
$lang = $this->getInput('lang'); $lang = $this->getInput('lang');
$uri = self::URI . $lang . '/news/'; $uri = self::URI . $lang . '/news/';
if(!empty($this->getInput('category'))) { if(!empty($this->getInput('category'))) {
@ -37,6 +38,9 @@ class WorldOfTanksBridge extends BridgeAbstract {
return $uri; return $uri;
} }
return parent::getURI();
}
public function getName(){ public function getName(){
return $this->title ?: parent::getName(); return $this->title ?: parent::getName();
} }

View File

@ -190,7 +190,7 @@ abstract class FeedExpander extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
return $this->uri; return $this->uri ?: parent::getURI();
} }
public function getName(){ public function getName(){