diff --git a/bridges/StanfordSIRbookreviewBridge.php b/bridges/StanfordSIRbookreviewBridge.php new file mode 100644 index 00000000..f57a0b1b --- /dev/null +++ b/bridges/StanfordSIRbookreviewBridge.php @@ -0,0 +1,42 @@ + array( + 'name' => 'style', + 'type' => 'list', + 'values' => array( + 'reviews' => 'reviews', + 'excerpts' => 'excerpts', + ) + ) + ) + ); + + public function collectData() { + switch($this->getInput('style')) { + case 'reviews': + $url = self::URI . 'reviews'; + break; + case 'excerpts': + $url = self::URI . 'excerpts'; + break; + } + + $html = getSimpleHTMLDOM($url) + or returnServerError('Failed loading content!'); + foreach($html->find('article') as $element) { + $item = array(); + $item['title'] = $element->find('div > h4 > a', 0)->plaintext; + $item['uri'] = $element->find('div > h4 > a', 0)->href; + $item['content'] = $element->find('div > div.article-entry > p', 2)->plaintext; + $item['author'] = $element->find('div > div > p', 0)->plaintext; + $this->items[] = $item; + + } + } +}