2019-06-18 23:18:52 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class SplCenterBridge extends FeedExpander
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2019-06-18 23:18:52 +03:00
|
|
|
const NAME = 'Southern Poverty Law Center Bridge';
|
|
|
|
const URI = 'https://www.splcenter.org';
|
|
|
|
const DESCRIPTION = 'Returns the newest posts from the Southern Poverty Law Center';
|
|
|
|
const MAINTAINER = 'VerifiedJoseph';
|
|
|
|
const PARAMETERS = [[
|
|
|
|
'content' => [
|
|
|
|
'name' => 'Content',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => [
|
|
|
|
'News' => 'news',
|
|
|
|
'Hatewatch' => 'hatewatch',
|
|
|
|
],
|
|
|
|
'defaultValue' => 'news',
|
2022-07-01 16:10:30 +03:00
|
|
|
]
|
|
|
|
]
|
2019-06-18 23:18:52 +03:00
|
|
|
];
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
const CACHE_TIMEOUT = 3600; // 1 hour
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2023-10-13 01:25:34 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$url = $this->getURI() . '/rss.xml';
|
|
|
|
$this->collectExpandableDatas($url);
|
|
|
|
}
|
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
protected function parseItem($item)
|
|
|
|
{
|
|
|
|
$item = parent::parseItem($item);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2022-01-02 12:36:09 +03:00
|
|
|
$articleHtml = getSimpleHTMLDOMCached($item['uri']);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
foreach ($articleHtml->find('.file') as $index => $media) {
|
|
|
|
$articleHtml->find('div.file', $index)->outertext = '<em>' . $media->outertext . '</em>';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
$item['content'] = $articleHtml->find('div#group-content-container', 0)->innertext;
|
|
|
|
$item['enclosures'][] = $articleHtml->find('meta[name="twitter:image"]', 0)->content;
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
return $item;
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
public function getURI()
|
|
|
|
{
|
|
|
|
if (!is_null($this->getInput('content'))) {
|
|
|
|
return self::URI . '/' . $this->getInput('content');
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
return parent::getURI();
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
if (!is_null($this->getInput('content'))) {
|
2023-03-06 22:01:51 +03:00
|
|
|
return $this->getKey('content') . ' - Southern Poverty Law Center';
|
2019-06-18 23:18:52 +03:00
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-06-18 23:18:52 +03:00
|
|
|
return parent::getName();
|
|
|
|
}
|
|
|
|
}
|