maintainer = 'ORelio'; $this->name = 'Anime-Ultime'; $this->uri = 'http://www.anime-ultime.net/'; $this->description = 'Returns the 10 newest releases posted on Anime-Ultime'; $this->parameters[] = array( 'type'=>array( 'name'=>'Type', 'type'=>'list', 'values'=>array( 'Everything'=>'', 'Anime'=>'A', 'Drama'=>'D', 'Tokusatsu'=>'T' ) ) ); } public function collectData(){ $param=$this->parameters[$this->queriedContext]; //Add type filter if provided $typeFilter = ''; if (!empty($param['type']['value'])) { if ($param['type']['value'] == 'A' || $param['type']['value'] == 'D' || $param['type']['value'] == 'T') { $typeFilter = $param['type']['value']; 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'); } //Build date and filters for making requests $thismonth = date('mY').$typeFilter; $lastmonth = date('mY', mktime(0, 0, 0, date('n') - 1, 1, date('Y'))).$typeFilter; //Process each HTML page until having 10 releases $processedOK = 0; 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); //Relases are sorted by day : process each day individually foreach ($html->find('div.history', 0)->find('h3') as $daySection) { //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)); $release = $daySection->next_sibling()->next_sibling()->first_child(); //