2013-08-15 11:02:43 +02:00
|
|
|
<?php
|
|
|
|
class IdenticaBridge extends BridgeAbstract{
|
2015-11-05 16:50:18 +01:00
|
|
|
|
2016-08-27 21:03:26 +02:00
|
|
|
public $maintainer = "mitsukarenai";
|
|
|
|
public $name = "Identica Bridge";
|
|
|
|
public $uri = "https://identi.ca/";
|
|
|
|
public $description = "Returns user timelines";
|
2015-11-05 16:50:18 +01:00
|
|
|
|
2016-08-27 21:03:26 +02:00
|
|
|
public $parameters = array( array(
|
|
|
|
'u'=>array(
|
|
|
|
'name'=>'username',
|
|
|
|
'required'=>true
|
|
|
|
)
|
|
|
|
));
|
2015-11-05 16:50:18 +01:00
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
2013-08-15 11:02:43 +02:00
|
|
|
$html = '';
|
2016-08-27 14:47:52 +02:00
|
|
|
$html = $this->getSimpleHTMLDOM($this->getURI())
|
|
|
|
or $this->returnServerError('Requested username can\'t be found.');
|
2013-08-15 11:02:43 +02:00
|
|
|
|
|
|
|
foreach($html->find('li.major') as $dent) {
|
2016-08-22 18:55:59 +02:00
|
|
|
$item = array();
|
|
|
|
$item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
|
|
|
|
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
|
|
|
|
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
|
2016-08-25 01:24:53 +02:00
|
|
|
$item['title'] = $param['u']['value'] . ' | ' . $item['content'];
|
2013-08-15 11:02:43 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(){
|
2016-08-27 14:47:52 +02:00
|
|
|
$param=$this->parameters[$this->queriedContext];
|
|
|
|
return $param['u']['value'] .' - Identica Bridge';
|
2013-08-15 11:02:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI(){
|
2016-08-27 14:47:52 +02:00
|
|
|
$param=$this->parameters[$this->queriedContext];
|
|
|
|
return $this->uri.urlencode($param['u']['value']);
|
2013-08-15 11:02:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
|
|
|
return 300; // 5 minutes
|
|
|
|
}
|
|
|
|
}
|