1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-14 12:34:07 +02:00

[core] extract BridgeAbstract methods to make them functions

- returnError, returnServerError, returnClientError ,debugMessage are
  moved to lib/error.php

- getContents, getSimpleHTMLDOM, getSimpleHTMLDOMCached are moved to
  lib/contents.php

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière
2016-09-25 23:22:33 +02:00
parent ad534444fa
commit f1fb95b257
111 changed files with 485 additions and 477 deletions

View File

@@ -8,17 +8,17 @@ class ShanaprojectBridge extends BridgeAbstract {
// Returns an html object for the Season Anime List (latest season)
private function LoadSeasonAnimeList(){
// First we need to find the URI to the latest season from the 'seasons' page searching for 'Season Anime List'
$html = $this->getSimpleHTMLDOM($this->getURI() . '/seasons');
$html = getSimpleHTMLDOM($this->getURI() . '/seasons');
if(!$html)
$this->returnServerError('Could not load \'seasons\' page!');
returnServerError('Could not load \'seasons\' page!');
$season = $html->find('div.follows_menu/a', 1);
if(!$season)
$this->returnServerError('Could not find \'Season Anime List\'!');
returnServerError('Could not find \'Season Anime List\'!');
$html = $this->getSimpleHTMLDOM($this->getURI() . $season->href);
$html = getSimpleHTMLDOM($this->getURI() . $season->href);
if(!$html)
$this->returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!');
returnServerError('Could not load \'Season Anime List\' from \'' . $season->innertext . '\'!');
return $html;
}
@@ -27,7 +27,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeTitle($anime){
$title = $anime->find('a', 0);
if(!$title)
$this->returnServerError('Could not find anime title!');
returnServerError('Could not find anime title!');
return trim($title->innertext);
}
@@ -35,7 +35,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeURI($anime){
$uri = $anime->find('a', 0);
if(!$uri)
$this->returnServerError('Could not find anime URI!');
returnServerError('Could not find anime URI!');
return $this->getURI() . $uri->href;
}
@@ -43,7 +43,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeTimestamp($anime){
$timestamp = $anime->find('span.header_info_block', 1);
if(!$timestamp)
$this->returnServerError('Could not find anime timestamp!');
returnServerError('Could not find anime timestamp!');
return strtotime($timestamp->innertext);
}
@@ -59,7 +59,7 @@ class ShanaprojectBridge extends BridgeAbstract {
private function ExtractAnimeEpisodeInformation($anime){
$episode = $anime->find('div.header_info_episode', 0);
if(!$episode)
$this->returnServerError('Could not find anime episode information!');
returnServerError('Could not find anime episode information!');
return preg_replace('/\r|\n/', ' ', $episode->plaintext);
}
@@ -71,7 +71,7 @@ class ShanaprojectBridge extends BridgeAbstract {
if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches))
return $matches[1];
$this->returnServerError('Could not extract background image!');
returnServerError('Could not extract background image!');
}
// Builds an URI to search for a specific anime (subber is left empty)
@@ -94,7 +94,7 @@ class ShanaprojectBridge extends BridgeAbstract {
$animes = $html->find('div.header_display_box_info');
if(!$animes)
$this->returnServerError('Could not find anime headers!');
returnServerError('Could not find anime headers!');
foreach($animes as $anime){
$item = array();