diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 6b65247..629f459 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -23,15 +23,10 @@ class AnimeUltimeBridge extends BridgeAbstract { public function collectData(){ //Add type filter if provided - $typeFilter = ''; - if (!empty($this->getInput('type'))) { - if ($this->getInput('type') == 'A' || $this->getInput('type') == 'D' || $this->getInput('type') == 'T') { - $typeFilter = $this->getInput('type'); - if ($typeFilter == 'A') { $this->filter = 'Anime'; } - if ($typeFilter == 'D') { $this->filter = 'Drama'; } - if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; } - } else $this->returnClientError('The provided type filter is invalid. Expecting A, D, T, or no filter'); - } + $typeFilter = array_search( + $this->getInput('type'), + $this->parameters[$this->queriedContext]['type']['values'] + ); //Build date and filters for making requests $thismonth = date('mY').$typeFilter; @@ -42,9 +37,9 @@ class AnimeUltimeBridge extends BridgeAbstract { foreach (array($thismonth, $lastmonth) as $requestFilter) { //Retrive page contents - $website = 'http://www.anime-ultime.net/'; - $url = $website.'history-0-1/'.$requestFilter; - $html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Anime-Ultime: '.$url); + $url = $this->uri.'history-0-1/'.$requestFilter; + $html = $this->getSimpleHTMLDOM($url) + or $this->returnServerError('Could not request Anime-Ultime: '.$url); //Relases are sorted by day : process each day individually foreach ($html->find('div.history', 0)->find('h3') as $daySection) { @@ -52,7 +47,9 @@ class AnimeUltimeBridge extends BridgeAbstract { //Retrieve day and build date information $dateString = $daySection->plaintext; $day = intval(substr($dateString, strpos($dateString, ' ') + 1, 2)); - $item_date = strtotime(str_pad($day, 2, '0', STR_PAD_LEFT).'-'.substr($requestFilter, 0, 2).'-'.substr($requestFilter, 2, 4)); + $item_date = strtotime(str_pad($day, 2, '0', STR_PAD_LEFT).'-' + .substr($requestFilter, 0, 2).'-' + .substr($requestFilter, 2, 4)); $release = $daySection->next_sibling()->next_sibling()->first_child(); //