2018-04-15 14:02:37 +03:00
|
|
|
<?php
|
|
|
|
class NotAlwaysBridge extends BridgeAbstract {
|
|
|
|
|
|
|
|
const MAINTAINER = 'mozes';
|
|
|
|
const NAME = 'Not Always family Bridge';
|
|
|
|
const URI = 'https://notalwaysright.com/';
|
|
|
|
const DESCRIPTION = 'Returns the latest stories';
|
|
|
|
const CACHE_TIMEOUT = 1800; // 30 minutes
|
|
|
|
|
|
|
|
const PARAMETERS = array( array(
|
|
|
|
'filter' => 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'
|
2019-01-22 20:24:32 +03:00
|
|
|
)
|
2018-04-15 14:02:37 +03:00
|
|
|
)
|
|
|
|
));
|
|
|
|
|
2018-10-26 19:07:34 +03:00
|
|
|
public function getIcon() {
|
|
|
|
return self::URI . 'favicon_nar.png';
|
|
|
|
}
|
|
|
|
|
2018-04-15 14:02:37 +03:00
|
|
|
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'))) {
|
2018-06-30 00:55:33 +03:00
|
|
|
return self::URI . $this->getInput('filter') . '/';
|
2018-04-15 14:02:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getURI();
|
|
|
|
}
|
|
|
|
}
|