array(), 'Title Updates' => array( 'title_uri' => array( 'name' => 'Title ID', 'type' => 'text', 'required' => true ) ) ); const CACHE_TIMEOUT = 3600; protected $pageName; public function getURI() { switch($this->queriedContext) { case 'Site News': return self::URI . 'news/'; case 'Title Updates': return self::URI . 'manga/' . urlencode($this->getInput('title_uri')) . '.html'; default: return parent::getURI(); } } public function getName() { if ($this->queriedContext) { return $this->pageName . ' | ' . self::NAME; } return parent::getName(); } public function collectDataNews($html) { foreach($html->find('.baseTop1') as $line) { $title = $line->find('.baseTitle > div', 0)->plaintext; $time = $line->find('.baseTitle > div', 1)->innertext; $time1 = explode(" | ", $time); $content = $line->find('.entry', 0)->innertext; $uri = $line->find('a', 0)->href; $item['uri'] = $uri; $item['title'] = $title; $item['timestamp'] = $time1[0]; $item['content'] = $content; $this->items[] = $item; } } public function collectDataItem($html) { $title = $html->find('.title_top_a', 0)->plaintext . ' — '; foreach($html->find('table.table_cha tr[class]') as $line) { $chapter = $line->find('.manga2', 0)->plaintext; $uri = $line->find('a', 0)->href; $time = $line->find('.date', 0)->plaintext; $item['uri'] = self::URI . $uri; $item['title'] = $title . $chapter; $item['timestamp'] = $time; $this->items[] = $item; } } public function collectData() { $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request ' . $this->getURI()); $name = $html->find('title', 0)->plaintext; $name = explode(' » ', $name); $this->pageName = $name[0]; switch($this->queriedContext) { case 'Site News': return $this->collectDataNews($html); case 'Title Updates': return $this->collectDataItem($html); } } }