diff --git a/bridges/SplCenterBridge.php b/bridges/SplCenterBridge.php new file mode 100644 index 00000000..7a690908 --- /dev/null +++ b/bridges/SplCenterBridge.php @@ -0,0 +1,64 @@ + array( + 'name' => 'Content', + 'type' => 'list', + 'values' => array( + 'News' => 'news', + 'Hatewatch' => 'hatewatch', + ), + 'defaultValue' => 'news', + ) + ) + ); + + const CACHE_TIMEOUT = 3600; // 1 hour + + protected function parseItem($item) { + $item = parent::parseItem($item); + + $articleHtml = getSimpleHTMLDOMCached($item['uri']) + or returnServerError('Could not request: ' . $item['uri']); + + foreach ($articleHtml->find('.file') as $index => $media) { + $articleHtml->find('div.file', $index)->outertext = '' . $media->outertext . ''; + } + + $item['content'] = $articleHtml->find('div#group-content-container', 0)->innertext; + $item['enclosures'][] = $articleHtml->find('meta[name="twitter:image"]', 0)->content; + + return $item; + } + + public function collectData() { + $this->collectExpandableDatas($this->getURI() . '/rss.xml'); + } + + public function getURI() { + + if (!is_null($this->getInput('content'))) { + return self::URI . '/' . $this->getInput('content'); + } + + return parent::getURI(); + } + + public function getName() { + + if (!is_null($this->getInput('content'))) { + $parameters = $this->getParameters(); + + $contentValues = array_flip($parameters[0]['content']['values']); + + return $contentValues[$this->getInput('content')] . ' - Southern Poverty Law Center'; + } + + return parent::getName(); + } +}