[bridges] use constants instead of variable members

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-30 11:23:55 +02:00
parent 556b8a2452
commit 9a0da733ef
129 changed files with 834 additions and 834 deletions

View file

@ -1,12 +1,12 @@
<?php
class FlickrTagBridge extends BridgeAbstract{
public $maintainer = "erwang";
public $name = "Flickr TagUser";
public $uri = "http://www.flickr.com/";
public $description = "Returns the tagged or user images from Flickr";
const MAINTAINER = "erwang";
const NAME = "Flickr TagUser";
const URI = "http://www.flickr.com/";
const DESCRIPTION = "Returns the tagged or user images from Flickr";
public $parameters = array(
const PARAMETERS = array(
'By keyword' => array(
'q'=>array(
'name'=>'keyword',
@ -25,18 +25,18 @@ class FlickrTagBridge extends BridgeAbstract{
public function collectData(){
switch($this->queriedContext){
case 'By keyword':
$html = $this->getSimpleHTMLDOM($this->uri.'search/?q='.urlencode($this->getInput('q')).'&s=rec')
$html = $this->getSimpleHTMLDOM(self::URI.'search/?q='.urlencode($this->getInput('q')).'&s=rec')
or $this->returnServerError('No results for this query.');
break;
case 'by username':
$html = $this->getSimpleHTMLDOM($this->uri.'photos/'.urlencode($this->getInput('u')).'/')
$html = $this->getSimpleHTMLDOM(self::URI.'photos/'.urlencode($this->getInput('u')).'/')
or $this->returnServerError('Requested username can\'t be found.');
break;
}
foreach($html->find('span.photo_container') as $element) {
$item = array();
$item['uri'] = $this->uri.$element->find('a',0)->href;
$item['uri'] = self::URI.$element->find('a',0)->href;
$thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src');
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a>'; // FIXME: Filter javascript ?
$item['title'] = $element->find('a',0)->title;