[IdenticaBridge] remove useless code and fix getURI()

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-27 14:47:52 +02:00
parent c061057861
commit d95fa6117a

View file

@ -1,8 +1,6 @@
<?php <?php
class IdenticaBridge extends BridgeAbstract{ class IdenticaBridge extends BridgeAbstract{
private $request;
public function loadMetadatas() { public function loadMetadatas() {
$this->maintainer = "mitsukarenai"; $this->maintainer = "mitsukarenai";
@ -20,15 +18,9 @@ class IdenticaBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = ''; $html = '';
if (isset($param['u']['value'])) { /* user timeline mode */ $html = $this->getSimpleHTMLDOM($this->getURI())
$this->request = $param['u']['value']; or $this->returnServerError('Requested username can\'t be found.');
$html = $this->getSimpleHTMLDOM('https://identi.ca/'.urlencode($this->request)) or $this->returnServerError('Requested username can\'t be found.');
}
else {
$this->returnClientError('You must specify an Identica username (?u=...).');
}
foreach($html->find('li.major') as $dent) { foreach($html->find('li.major') as $dent) {
$item = array(); $item = array();
@ -41,11 +33,13 @@ class IdenticaBridge extends BridgeAbstract{
} }
public function getName(){ public function getName(){
return (!empty($this->request) ? $this->request .' - ' : '') .'Identica Bridge'; $param=$this->parameters[$this->queriedContext];
return $param['u']['value'] .' - Identica Bridge';
} }
public function getURI(){ public function getURI(){
return 'https://identica.com'; $param=$this->parameters[$this->queriedContext];
return $this->uri.urlencode($param['u']['value']);
} }
public function getCacheDuration(){ public function getCacheDuration(){