diff --git a/bridges/NotAlwaysBridge.php b/bridges/NotAlwaysBridge.php new file mode 100644 index 0000000..45727a7 --- /dev/null +++ b/bridges/NotAlwaysBridge.php @@ -0,0 +1,57 @@ + array( + 'type' => 'list', + 'name' => 'Filter', + 'values' => array( + 'All' => 'all', + 'Right' => 'right', + 'Working' => 'working', + 'Romantic' => 'romantic', + 'Related' => 'related', + 'Learning' => 'learning', + 'Friendly' => 'friendly', + 'Hopeless' => 'hopeless', + 'Unfiltered' => 'unfiltered' + ), + 'required' => true + ) + )); + + public function collectData(){ + $html = getSimpleHTMLDOM($this->getURI()) + or returnServerError('Could not request NotAlways.'); + foreach($html->find('.post') as $post) { + #print_r($post); + $item = array(); + $item['uri'] = $post->find('h1', 0)->find('a', 0)->href; + $item['content'] = $post; + $item['title'] = $post->find('h1', 0)->find('a', 0)->innertext; + $this->items[] = $item; + } + } + + public function getName(){ + if(!is_null($this->getInput('filter'))) { + return $this->getInput('filter') . ' - NotAlways Bridge'; + } + + return parent::getName(); + } + + public function getURI(){ + if(!is_null($this->getInput('filter'))) { + return self::URI . $this->getInput('filter') . "/"; + } + + return parent::getURI(); + } +}