[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,10 +1,10 @@
<?php <?php
class ABCTabsBridge extends BridgeAbstract{ class ABCTabsBridge extends BridgeAbstract{
public $maintainer = "kranack"; const MAINTAINER = "kranack";
public $name = "ABC Tabs Bridge"; const NAME = "ABC Tabs Bridge";
public $uri = "http://www.abc-tabs.com/"; const URI = "http://www.abc-tabs.com/";
public $description = "Returns 22 newest tabs"; const DESCRIPTION = "Returns 22 newest tabs";
public function collectData(){ public function collectData(){
$html = ''; $html = '';

View file

@ -2,10 +2,10 @@
class AcrimedBridge extends RssExpander{ class AcrimedBridge extends RssExpander{
public $maintainer = "qwertygc"; const MAINTAINER = "qwertygc";
public $name = "Acrimed Bridge"; const NAME = "Acrimed Bridge";
public $uri = "http://www.acrimed.org/"; const URI = "http://www.acrimed.org/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
public function collectData(){ public function collectData(){

View file

@ -2,11 +2,11 @@
class AllocineFRBridge extends BridgeAbstract{ class AllocineFRBridge extends BridgeAbstract{
public $maintainer = "superbaillot.net"; const MAINTAINER = "superbaillot.net";
public $name = "Allo Cine Bridge"; const NAME = "Allo Cine Bridge";
public $uri = "http://www.allocine.fr"; const URI = "http://www.allocine.fr";
public $description = "Bridge for allocine.fr"; const DESCRIPTION = "Bridge for allocine.fr";
public $parameters = array( array( const PARAMETERS = array( array(
'category'=>array( 'category'=>array(
'name'=>'category', 'name'=>'category',
'type'=>'list', 'type'=>'list',
@ -38,10 +38,10 @@ class AllocineFRBridge extends BridgeAbstract{
} }
public function getName(){ public function getName(){
return $this->name.' : ' return self::NAME.' : '
.array_search( .array_search(
$this->getInput('category'), $this->getInput('category'),
$this->parameters[$this->queriedContext]['category']['values'] self::PARAMETERS[$this->queriedContext]['category']['values']
); );
} }
@ -52,7 +52,7 @@ class AllocineFRBridge extends BridgeAbstract{
$category=array_search( $category=array_search(
$this->getInput('category'), $this->getInput('category'),
$this->parameters[$this->queriedContext]['category']['values'] self::PARAMETERS[$this->queriedContext]['category']['values']
); );

View file

@ -1,11 +1,11 @@
<?php <?php
class AnimeUltimeBridge extends BridgeAbstract { class AnimeUltimeBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'Anime-Ultime'; const NAME = 'Anime-Ultime';
public $uri = 'http://www.anime-ultime.net/'; const URI = 'http://www.anime-ultime.net/';
public $description = 'Returns the 10 newest releases posted on Anime-Ultime'; const DESCRIPTION = 'Returns the 10 newest releases posted on Anime-Ultime';
public $parameters = array( array( const PARAMETERS = array( array(
'type'=>array( 'type'=>array(
'name'=>'Type', 'name'=>'Type',
'type'=>'list', 'type'=>'list',
@ -25,7 +25,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Add type filter if provided //Add type filter if provided
$typeFilter = array_search( $typeFilter = array_search(
$this->getInput('type'), $this->getInput('type'),
$this->parameters[$this->queriedContext]['type']['values'] self::PARAMETERS[$this->queriedContext]['type']['values']
); );
//Build date and filters for making requests //Build date and filters for making requests
@ -37,7 +37,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
foreach (array($thismonth, $lastmonth) as $requestFilter) { foreach (array($thismonth, $lastmonth) as $requestFilter) {
//Retrive page contents //Retrive page contents
$url = $this->uri.'history-0-1/'.$requestFilter; $url = self::URI.'history-0-1/'.$requestFilter;
$html = $this->getSimpleHTMLDOM($url) $html = $this->getSimpleHTMLDOM($url)
or $this->returnServerError('Could not request Anime-Ultime: '.$url); or $this->returnServerError('Could not request Anime-Ultime: '.$url);
@ -58,7 +58,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
//Retrieve metadata from table columns //Retrieve metadata from table columns
$item_link_element = $release->find('td', 0)->find('a', 0); $item_link_element = $release->find('td', 0)->find('a', 0);
$item_uri = $this->uri.$item_link_element->href; $item_uri = self::URI.$item_link_element->href;
$item_name = html_entity_decode($item_link_element->plaintext); $item_name = html_entity_decode($item_link_element->plaintext);
$item_episode = html_entity_decode(str_pad($release->find('td', 1)->plaintext, 2, '0', STR_PAD_LEFT)); $item_episode = html_entity_decode(str_pad($release->find('td', 1)->plaintext, 2, '0', STR_PAD_LEFT));
$item_fansub = $release->find('td', 2)->plaintext; $item_fansub = $release->find('td', 2)->plaintext;
@ -79,7 +79,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
strpos($item_description, '<div id="table">') strpos($item_description, '<div id="table">')
); );
$item_description = str_replace( $item_description = str_replace(
'src="images', 'src="'.$this->uri.'images', 'src="images', 'src="'.self::URI.'images',
$item_description $item_description
); );
$item_description = str_replace("\r", '', $item_description); $item_description = str_replace("\r", '', $item_description);
@ -109,7 +109,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
public function getName() { public function getName() {
$typeFilter = array_search( $typeFilter = array_search(
$this->getInput('type'), $this->getInput('type'),
$this->parameters[$this->queriedContext]['type']['values'] self::PARAMETERS[$this->queriedContext]['type']['values']
); );
return 'Latest '.$typeFilter.' - Anime-Ultime Bridge'; return 'Latest '.$typeFilter.' - Anime-Ultime Bridge';

View file

@ -3,10 +3,10 @@
#error_reporting(E_ALL); #error_reporting(E_ALL);
class ArstechnicaBridge extends BridgeAbstract { class ArstechnicaBridge extends BridgeAbstract {
public $maintainer = "prysme"; const MAINTAINER = "prysme";
public $name = "ArstechnicaBridge"; const NAME = "ArstechnicaBridge";
public $uri = "http://arstechnica.com"; const URI = "http://arstechnica.com";
public $description = "The PC enthusiast's resource. Power users and the tools they love, without computing religion"; const DESCRIPTION = "The PC enthusiast's resource. Power users and the tools they love, without computing religion";
function StripWithDelimiters($string, $start, $end) { function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) { while (strpos($string, $start) !== false) {

View file

@ -1,11 +1,11 @@
<?php <?php
class Arte7Bridge extends BridgeAbstract{ class Arte7Bridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Arte +7"; const NAME = "Arte +7";
public $uri = "http://www.arte.tv/"; const URI = "http://www.arte.tv/";
public $description = "Returns newest videos from ARTE +7"; const DESCRIPTION = "Returns newest videos from ARTE +7";
public $parameters = array( const PARAMETERS = array(
'Catégorie (Français)' => array( 'Catégorie (Français)' => array(
'catfr'=>array( 'catfr'=>array(
'type'=>'list', 'type'=>'list',
@ -56,7 +56,7 @@
break; break;
} }
$url = $this->uri.'guide/'.$lang.'/plus7/'.$category; $url = self::URI.'guide/'.$lang.'/plus7/'.$category;
$input = $this->getContents($url) or die('Could not request ARTE.'); $input = $this->getContents($url) or die('Could not request ARTE.');
if(strpos($input, 'categoryVideoSet') !== FALSE){ if(strpos($input, 'categoryVideoSet') !== FALSE){
$input = explode('categoryVideoSet: ', $input); $input = explode('categoryVideoSet: ', $input);

View file

@ -1,11 +1,11 @@
<?php <?php
class AskfmBridge extends BridgeAbstract{ class AskfmBridge extends BridgeAbstract{
public $maintainer = "az5he6ch"; const MAINTAINER = "az5he6ch";
public $name = "Ask.fm Answers"; const NAME = "Ask.fm Answers";
public $uri = "http://ask.fm/"; const URI = "http://ask.fm/";
public $description = "Returns answers from an Ask.fm user"; const DESCRIPTION = "Returns answers from an Ask.fm user";
public $parameters = array( const PARAMETERS = array(
'Ask.fm username'=>array( 'Ask.fm username'=>array(
'u'=>array( 'u'=>array(
'name'=>'Username', 'name'=>'Username',
@ -20,7 +20,7 @@ class AskfmBridge extends BridgeAbstract{
foreach($html->find('div.streamItem-answer') as $element) { foreach($html->find('div.streamItem-answer') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a.streamItemsAge',0)->href; $item['uri'] = self::URI.$element->find('a.streamItemsAge',0)->href;
$question = trim($element->find('h1.streamItemContent-question',0)->innertext); $question = trim($element->find('h1.streamItemContent-question',0)->innertext);
$item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES)); $item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES));
$answer = trim($element->find('p.streamItemContent-answer',0)->innertext); $answer = trim($element->find('p.streamItemContent-answer',0)->innertext);
@ -35,18 +35,18 @@ class AskfmBridge extends BridgeAbstract{
} }
$content = '<p>' . $question . '</p><p>' . $answer . '</p><p>' . $visual . '</p>'; $content = '<p>' . $question . '</p><p>' . $answer . '</p><p>' . $visual . '</p>';
// Fix relative links without breaking // scheme used by YouTube stuff // Fix relative links without breaking // scheme used by YouTube stuff
$content = preg_replace('#href="\/(?!\/)#', 'href="'.$this->uri,$content); $content = preg_replace('#href="\/(?!\/)#', 'href="'.self::URI,$content);
$item['content'] = $content; $item['content'] = $content;
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){ public function getName(){
return $this->name.' : '.$this->getInput('u'); return self::NAME.' : '.$this->getInput('u');
} }
public function getURI(){ public function getURI(){
return $this->uri.urlencode($this->getInput('u')).'/answers/more?page=0'; return self::URI.urlencode($this->getInput('u')).'/answers/more?page=0';
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -1,11 +1,11 @@
<?php <?php
class BandcampBridge extends BridgeAbstract{ class BandcampBridge extends BridgeAbstract{
public $maintainer = "sebsauvage"; const MAINTAINER = "sebsauvage";
public $name = "Bandcamp Tag"; const NAME = "Bandcamp Tag";
public $uri = "http://bandcamp.com/"; const URI = "http://bandcamp.com/";
public $description = "New bandcamp release by tag"; const DESCRIPTION = "New bandcamp release by tag";
public $parameters = array( array( const PARAMETERS = array( array(
'tag'=>array( 'tag'=>array(
'name'=>'tag', 'name'=>'tag',
'type'=>'text', 'type'=>'text',
@ -33,7 +33,7 @@ class BandcampBridge extends BridgeAbstract{
} }
public function getURI(){ public function getURI(){
return $this->uri.'tag/'.urlencode($this->getInput('tag')).'?sort_field=date'; return self::URI.'tag/'.urlencode($this->getInput('tag')).'?sort_field=date';
} }
public function getName(){ public function getName(){

View file

@ -1,17 +1,17 @@
<?php <?php
class BastaBridge extends BridgeAbstract{ class BastaBridge extends BridgeAbstract{
public $maintainer = "qwertygc"; const MAINTAINER = "qwertygc";
public $name = "Bastamag Bridge"; const NAME = "Bastamag Bridge";
public $uri = "http://www.bastamag.net/"; const URI = "http://www.bastamag.net/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
public function collectData(){ public function collectData(){
// Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'! // Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'!
function ReplaceImageUrl($content){ function ReplaceImageUrl($content){
return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\''.$this->uri.'$1\'', $content); return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\''.self::URI.'$1\'', $content);
} }
$html = $this->getSimpleHTMLDOM($this->uri.'spip.php?page=backend') $html = $this->getSimpleHTMLDOM(self::URI.'spip.php?page=backend')
or $this->returnServerError('Could not request Bastamag.'); or $this->returnServerError('Could not request Bastamag.');
$limit = 0; $limit = 0;

View file

@ -1,14 +1,14 @@
<?php <?php
class BlaguesDeMerdeBridge extends BridgeAbstract{ class BlaguesDeMerdeBridge extends BridgeAbstract{
public $maintainer = "superbaillot.net"; const MAINTAINER = "superbaillot.net";
public $name = "Blagues De Merde"; const NAME = "Blagues De Merde";
public $uri = "http://www.blaguesdemerde.fr/"; const URI = "http://www.blaguesdemerde.fr/";
public $description = "Blagues De Merde"; const DESCRIPTION = "Blagues De Merde";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request BDM.'); or $this->returnServerError('Could not request BDM.');
foreach($html->find('article.joke_contener') as $element) { foreach($html->find('article.joke_contener') as $element) {

View file

@ -1,12 +1,12 @@
<?php <?php
class BooruprojectBridge extends BridgeAbstract{ class BooruprojectBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Booruproject"; const NAME = "Booruproject";
public $uri = "http://booru.org/"; const URI = "http://booru.org/";
public $description = "Returns images from given page and booruproject instance (****.booru.org)"; const DESCRIPTION = "Returns images from given page and booruproject instance (****.booru.org)";
public $parameters = array( array( const PARAMETERS = array( array(
'i'=>array( 'i'=>array(
'name'=>'instance (required)', 'name'=>'instance (required)',
'required'=>true 'required'=>true

View file

@ -1,9 +1,9 @@
<?php <?php
class CADBridge extends BridgeAbstract{ class CADBridge extends BridgeAbstract{
public $maintainer = "nyutag"; const MAINTAINER = "nyutag";
public $name = "CAD Bridge"; const NAME = "CAD Bridge";
public $uri = "http://www.cad-comic.com/"; const URI = "http://www.cad-comic.com/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
private function CADExtractContent($url) { private function CADExtractContent($url) {
$html3 = $this->getSimpleHTMLDOM($url); $html3 = $this->getSimpleHTMLDOM($url);

View file

@ -1,12 +1,12 @@
<?php <?php
class CNETBridge extends BridgeAbstract { class CNETBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'CNET News'; const NAME = 'CNET News';
public $uri = 'http://www.cnet.com/'; const URI = 'http://www.cnet.com/';
public $description = 'Returns the newest articles. <br /> You may specify a topic found in some section URLs, else all topics are selected.'; const DESCRIPTION = 'Returns the newest articles. <br /> You may specify a topic found in some section URLs, else all topics are selected.';
public $parameters = array( array( const PARAMETERS = array( array(
'topic'=>array('name'=>'Topic name') 'topic'=>array('name'=>'Topic name')
)); ));
@ -37,7 +37,7 @@ class CNETBridge extends BridgeAbstract {
return $article_html; return $article_html;
} }
$pageUrl = $this->uri.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/'); $pageUrl = self::URI.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/');
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl); $html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl);
$limit = 0; $limit = 0;
@ -45,7 +45,7 @@ class CNETBridge extends BridgeAbstract {
if ($limit < 8) { if ($limit < 8) {
$article_title = trim($element->find('h2', 0)->plaintext); $article_title = trim($element->find('h2', 0)->plaintext);
$article_uri = $this->uri.($element->find('a', 0)->href); $article_uri = self::URI.($element->find('a', 0)->href);
$article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext); $article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext);
$article_author = trim($element->find('a[rel=author]', 0)->plaintext); $article_author = trim($element->find('a[rel=author]', 0)->plaintext);

View file

@ -1,11 +1,11 @@
<?php <?php
class CastorusBridge extends BridgeAbstract { class CastorusBridge extends BridgeAbstract {
public $maintainer = "logmanoriginal"; const MAINTAINER = "logmanoriginal";
public $name = "Castorus Bridge"; const NAME = "Castorus Bridge";
public $uri = 'http://www.castorus.com'; const URI = 'http://www.castorus.com';
public $description = "Returns the latest changes"; const DESCRIPTION = "Returns the latest changes";
public $parameters = array( const PARAMETERS = array(
'Get latest changes' => array(), 'Get latest changes' => array(),
'Get latest changes via ZIP code' => array( 'Get latest changes via ZIP code' => array(
'zip'=>array( 'zip'=>array(
@ -44,7 +44,7 @@ class CastorusBridge extends BridgeAbstract {
if(!$url) if(!$url)
$this->returnServerError('Cannot find url!'); $this->returnServerError('Cannot find url!');
return $this->uri . $url->href; return self::URI . $url->href;
} }
// Extracts the time from an activity // Extracts the time from an activity
@ -77,10 +77,10 @@ class CastorusBridge extends BridgeAbstract {
$zip_filter = trim($this->getInput('zip')); $zip_filter = trim($this->getInput('zip'));
$city_filter = trim($this->getInput('city')); $city_filter = trim($this->getInput('city'));
$html = $this->getSimpleHTMLDOM($this->uri); $html = $this->getSimpleHTMLDOM(self::URI);
if(!$html) if(!$html)
$this->returnServerError('Could not load data from ' . $this->uri . '!'); $this->returnServerError('Could not load data from ' . self::URI . '!');
$activities = $html->find('div#activite/li'); $activities = $html->find('div#activite/li');

View file

@ -1,10 +1,10 @@
<?php <?php
class CollegeDeFranceBridge extends BridgeAbstract{ class CollegeDeFranceBridge extends BridgeAbstract{
public $maintainer = "pit-fgfjiudghdf"; const MAINTAINER = "pit-fgfjiudghdf";
public $name = "CollegeDeFrance"; const NAME = "CollegeDeFrance";
public $uri = "http://www.college-de-france.fr/"; const URI = "http://www.college-de-france.fr/";
public $description = "Returns the latest audio and video from CollegeDeFrance"; const DESCRIPTION = "Returns the latest audio and video from CollegeDeFrance";
public function collectData(){ public function collectData(){
$months = array( $months = array(
@ -30,7 +30,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{
* </a> * </a>
* </li> * </li>
*/ */
$html = $this->getSimpleHTMLDOM($this->uri.'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all') $html = $this->getSimpleHTMLDOM(self::URI.'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all')
or $this->returnServerError('Could not request CollegeDeFrance.'); or $this->returnServerError('Could not request CollegeDeFrance.');
foreach($html->find('a[data-target]') as $element) { foreach($html->find('a[data-target]') as $element) {
$item = array(); $item = array();
@ -62,7 +62,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{
} }
$item['timestamp'] = $d->format('U'); $item['timestamp'] = $d->format('U');
$item['content'] = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext; $item['content'] = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext;
$item['uri'] = $this->uri . $element->href; $item['uri'] = self::URI . $element->href;
$this->items[] = $item; $this->items[] = $item;
} }
} }

View file

@ -1,10 +1,10 @@
<?php <?php
class CommonDreamsBridge extends BridgeAbstract{ class CommonDreamsBridge extends BridgeAbstract{
public $maintainer = "nyutag"; const MAINTAINER = "nyutag";
public $name = "CommonDreams Bridge"; const NAME = "CommonDreams Bridge";
public $uri = "http://www.commondreams.org/"; const URI = "http://www.commondreams.org/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
private function CommonDreamsExtractContent($url) { private function CommonDreamsExtractContent($url) {
$html3 = $this->getSimpleHTMLDOM($url); $html3 = $this->getSimpleHTMLDOM($url);

View file

@ -1,13 +1,13 @@
<?php <?php
class CopieDoubleBridge extends BridgeAbstract{ class CopieDoubleBridge extends BridgeAbstract{
public $maintainer = "superbaillot.net"; const MAINTAINER = "superbaillot.net";
public $name = "CopieDouble"; const NAME = "CopieDouble";
public $uri = "http://www.copie-double.com/"; const URI = "http://www.copie-double.com/";
public $description = "CopieDouble"; const DESCRIPTION = "CopieDouble";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request CopieDouble.'); or $this->returnServerError('Could not request CopieDouble.');
$table = $html->find('table table', 2); $table = $html->find('table table', 2);
@ -26,10 +26,10 @@ class CopieDoubleBridge extends BridgeAbstract{
elseif(strpos($element->innertext, "/images/suivant.gif") === false) elseif(strpos($element->innertext, "/images/suivant.gif") === false)
{ {
$a=$element->find("a", 0); $a=$element->find("a", 0);
$item['uri'] = $this->uri . $a->href; $item['uri'] = self::URI . $a->href;
$content = str_replace('src="/', 'src="/'.$this->uri,$element->find("td", 0)->innertext); $content = str_replace('src="/', 'src="/'.self::URI,$element->find("td", 0)->innertext);
$content = str_replace('href="/', 'href="'.$this->uri,$content); $content = str_replace('href="/', 'href="'.self::URI,$content);
$item['content'] = $content; $item['content'] = $content;
$this->items[] = $item; $this->items[] = $item;
} }

View file

@ -1,14 +1,14 @@
<?php <?php
class CourrierInternationalBridge extends BridgeAbstract{ class CourrierInternationalBridge extends BridgeAbstract{
public $maintainer = "teromene"; const MAINTAINER = "teromene";
public $name = "Courrier International Bridge"; const NAME = "Courrier International Bridge";
public $uri = "http://CourrierInternational.com/"; const URI = "http://CourrierInternational.com/";
public $description = "Courrier International bridge"; const DESCRIPTION = "Courrier International bridge";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Error.'); or $this->returnServerError('Error.');
$element = $html->find("article"); $element = $html->find("article");
@ -22,7 +22,7 @@ class CourrierInternationalBridge extends BridgeAbstract{
$item['uri'] = $article->parent->getAttribute("href"); $item['uri'] = $article->parent->getAttribute("href");
if(strpos($item['uri'], "http") === FALSE) { if(strpos($item['uri'], "http") === FALSE) {
$item['uri'] = $this->uri.$item['uri']; $item['uri'] = self::URI.$item['uri'];
} }
$page = $this->getSimpleHTMLDOM($item['uri']); $page = $this->getSimpleHTMLDOM($item['uri']);

View file

@ -1,12 +1,12 @@
<?php <?php
class CpasbienBridge extends HttpCachingBridgeAbstract{ class CpasbienBridge extends HttpCachingBridgeAbstract{
public $maintainer = "lagaisse"; const MAINTAINER = "lagaisse";
public $name = "Cpasbien Bridge"; const NAME = "Cpasbien Bridge";
public $uri = "http://www.cpasbien.io"; const URI = "http://www.cpasbien.io";
public $description = "Returns latest torrents from a request query"; const DESCRIPTION = "Returns latest torrents from a request query";
public $parameters = array( array( const PARAMETERS = array( array(
'q'=>array( 'q'=>array(
'name'=>'Search', 'name'=>'Search',
'required'=>true, 'required'=>true,
@ -16,7 +16,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
public function collectData(){ public function collectData(){
$request = str_replace(" ","-",trim($this->getInput('q'))); $request = str_replace(" ","-",trim($this->getInput('q')));
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($request).'.html') $html = $this->getSimpleHTMLDOM(self::URI.'/recherche/'.urlencode($request).'.html')
or $this->returnServerError('No results for this query.'); or $this->returnServerError('No results for this query.');
foreach ($html->find('#gauche',0)->find('div') as $episode) { foreach ($html->find('#gauche',0)->find('div') as $episode) {
@ -40,7 +40,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
} }
$item['id'] = $episode->find('a', 0)->getAttribute('href'); $item['id'] = $episode->find('a', 0)->getAttribute('href');
$item['uri'] = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href'); $item['uri'] = self::URI . $htmlepisode->find('#telecharger',0)->getAttribute('href');
$this->items[] = $item; $this->items[] = $item;
} }
} }
@ -48,7 +48,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
public function getName(){ public function getName(){
return $this->getInput('q').' : '.$this->name; return $this->getInput('q').' : '.self::NAME;
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -1,12 +1,12 @@
<?php <?php
class CryptomeBridge extends BridgeAbstract{ class CryptomeBridge extends BridgeAbstract{
public $maintainer = "BoboTiG"; const MAINTAINER = "BoboTiG";
public $name = "Cryptome"; const NAME = "Cryptome";
public $uri = "https://cryptome.org/"; const URI = "https://cryptome.org/";
public $description = "Returns the N most recent documents."; const DESCRIPTION = "Returns the N most recent documents.";
public $parameters = array( array( const PARAMETERS = array( array(
'n'=>array( 'n'=>array(
'name'=>'number of elements', 'name'=>'number of elements',
'type'=>'number', 'type'=>'number',
@ -16,7 +16,7 @@ class CryptomeBridge extends BridgeAbstract{
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Cryptome.'); or $this->returnServerError('Could not request Cryptome.');
if (!empty($this->getInput('n'))) { /* number of documents */ if (!empty($this->getInput('n'))) { /* number of documents */
$num = min($this->getInput('n'), 20); $num = min($this->getInput('n'), 20);
@ -26,9 +26,9 @@ class CryptomeBridge extends BridgeAbstract{
foreach($html->find('pre') as $element) { foreach($html->find('pre') as $element) {
for ( $i = 0; $i < $num; ++$i ) { for ( $i = 0; $i < $num; ++$i ) {
$item = array(); $item = array();
$item['uri'] = $this->uri.substr($element->find('a', $i)->href, 20); $item['uri'] = self::URI.substr($element->find('a', $i)->href, 20);
$item['title'] = substr($element->find('b', $i)->plaintext, 22); $item['title'] = substr($element->find('b', $i)->plaintext, 22);
$item['content'] = preg_replace('#http://cryptome.org/#', $this->uri, $element->find('b', $i)->innertext); $item['content'] = preg_replace('#http://cryptome.org/#', self::URI, $element->find('b', $i)->innertext);
$this->items[] = $item; $this->items[] = $item;
} }
break; break;

View file

@ -1,12 +1,12 @@
<?php <?php
class DailymotionBridge extends BridgeAbstract{ class DailymotionBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Dailymotion Bridge"; const NAME = "Dailymotion Bridge";
public $uri = "https://www.dailymotion.com/"; const URI = "https://www.dailymotion.com/";
public $description = "Returns the 5 newest videos by username/playlist or search"; const DESCRIPTION = "Returns the 5 newest videos by username/playlist or search";
public $parameters = array ( const PARAMETERS = array (
'By username' => array( 'By username' => array(
'u'=>array( 'u'=>array(
'name'=>'username', 'name'=>'username',
@ -35,7 +35,7 @@ class DailymotionBridge extends BridgeAbstract{
function getMetadata($id) { function getMetadata($id) {
$metadata=array(); $metadata=array();
$html2 = $this->getSimpleHTMLDOM($this->uri.'video/'.$id); $html2 = $this->getSimpleHTMLDOM(self::URI.'video/'.$id);
if(!$html2){ if(!$html2){
return $metadata; return $metadata;
} }
@ -90,7 +90,7 @@ class DailymotionBridge extends BridgeAbstract{
} }
public function getURI(){ public function getURI(){
$uri=$this->uri; $uri=self::URI;
switch($this->queriedContext){ switch($this->queriedContext){
case 'By username': case 'By username':
$uri.='user/' $uri.='user/'

View file

@ -1,12 +1,12 @@
<?php <?php
class DanbooruBridge extends BridgeAbstract{ class DanbooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Danbooru"; const NAME = "Danbooru";
public $uri = "http://donmai.us/"; const URI = "http://donmai.us/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -18,14 +18,14 @@ class DanbooruBridge extends BridgeAbstract{
$page = $this->getInput('p')?$this->getInput('p'):1; $page = $this->getInput('p')?$this->getInput('p'):1;
$tags = urlencode($this->getInput('t')); $tags = urlencode($this->getInput('t'));
$html = $this->getSimpleHTMLDOM($this->uri."posts?&page=$page&tags=$tags") $html = $this->getSimpleHTMLDOM(self::URI."posts?&page=$page&tags=$tags")
or $this->returnServerError('Could not request Danbooru.'); or $this->returnServerError('Could not request Danbooru.');
foreach($html->find('div[id=posts] article') as $element) { foreach($html->find('div[id=posts] article') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $this->uri.$element->find('img', 0)->src; $thumbnailUri = self::URI.$element->find('img', 0)->src;
$item['tags'] = $element->find('img', 0)->getAttribute('alt'); $item['tags'] = $element->find('img', 0)->getAttribute('alt');
$item['title'] = 'Danbooru | '.$item['postid']; $item['title'] = 'Danbooru | '.$item['postid'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags']; $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];

View file

@ -1,14 +1,14 @@
<?php <?php
class DansTonChatBridge extends BridgeAbstract{ class DansTonChatBridge extends BridgeAbstract{
public $maintainer = "Astalaseven"; const MAINTAINER = "Astalaseven";
public $name = "DansTonChat Bridge"; const NAME = "DansTonChat Bridge";
public $uri = "http://danstonchat.com/"; const URI = "http://danstonchat.com/";
public $description = "Returns latest quotes from DansTonChat."; const DESCRIPTION = "Returns latest quotes from DansTonChat.";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'latest.html') $html = $this->getSimpleHTMLDOM(self::URI.'latest.html')
or $this->returnServerError('Could not request DansTonChat.'); or $this->returnServerError('Could not request DansTonChat.');
foreach($html->find('div.item') as $element) { foreach($html->find('div.item') as $element) {

View file

@ -1,12 +1,12 @@
<?php <?php
class DauphineLibereBridge extends BridgeAbstract { class DauphineLibereBridge extends BridgeAbstract {
public $maintainer = "qwertygc"; const MAINTAINER = "qwertygc";
public $name = "Dauphine Bridge"; const NAME = "Dauphine Bridge";
public $uri = "http://www.ledauphine.com/"; const URI = "http://www.ledauphine.com/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
public $parameters = array( array( const PARAMETERS = array( array(
'u'=>array( 'u'=>array(
'name'=>'Catégorie de l\'article', 'name'=>'Catégorie de l\'article',
'type'=>'list', 'type'=>'list',
@ -42,10 +42,10 @@ class DauphineLibereBridge extends BridgeAbstract {
$context = stream_context_create($opts); $context = stream_context_create($opts);
if (empty($this->getInput('u'))) { if (empty($this->getInput('u'))) {
$html = $this->getSimpleHTMLDOM($this->uri.$this->getInput('u').'/rss') $html = $this->getSimpleHTMLDOM(self::URI.$this->getInput('u').'/rss')
or $this->returnServerError('Could not request DauphineLibere.'); or $this->returnServerError('Could not request DauphineLibere.');
} else { } else {
$html = $this->getSimpleHTMLDOM($this->uri.'rss') $html = $this->getSimpleHTMLDOM(self::URI.'rss')
or $this->returnServerError('Could not request DauphineLibere.'); or $this->returnServerError('Could not request DauphineLibere.');
} }
$limit = 0; $limit = 0;

View file

@ -1,12 +1,12 @@
<?php <?php
class DemoBridge extends BridgeAbstract{ class DemoBridge extends BridgeAbstract{
public $maintainer = "teromene"; const MAINTAINER = "teromene";
public $name = "DemoBridge"; const NAME = "DemoBridge";
public $uri = "http://github.com/rss-bridge/rss-bridge"; const URI = "http://github.com/rss-bridge/rss-bridge";
public $description = "Bridge used for demos"; const DESCRIPTION = "Bridge used for demos";
public $parameters = array( const PARAMETERS = array(
'testCheckbox' => array( 'testCheckbox' => array(
'testCheckbox'=>array( 'testCheckbox'=>array(
'type'=>'checkbox', 'type'=>'checkbox',

View file

@ -1,10 +1,10 @@
<?php <?php
class DeveloppezDotComBridge extends BridgeAbstract{ class DeveloppezDotComBridge extends BridgeAbstract{
public $maintainer = "polopollo"; const MAINTAINER = "polopollo";
public $name = "Developpez.com Actus (FR)"; const NAME = "Developpez.com Actus (FR)";
public $uri = "http://www.developpez.com/"; const URI = "http://www.developpez.com/";
public $description = "Returns the 15 newest posts from DeveloppezDotCom (full text)."; const DESCRIPTION = "Returns the 15 newest posts from DeveloppezDotCom (full text).";
private function DeveloppezDotComStripCDATA($string) { private function DeveloppezDotComStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string); $string = str_replace('<![CDATA[', '', $string);
@ -39,8 +39,8 @@ class DeveloppezDotComBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$rssFeed = $this->getSimpleHTMLDOM($this->uri.'index/rss') $rssFeed = $this->getSimpleHTMLDOM(self::URI.'index/rss')
or $this->returnServerError('Could not request '.$this->uri.'index/rss'); or $this->returnServerError('Could not request '.self::URI.'index/rss');
$limit = 0; $limit = 0;
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {

View file

@ -1,10 +1,10 @@
<?php <?php
class DilbertBridge extends BridgeAbstract { class DilbertBridge extends BridgeAbstract {
public $maintainer = 'kranack'; const MAINTAINER = 'kranack';
public $name = 'Dilbert Daily Strip'; const NAME = 'Dilbert Daily Strip';
public $uri = 'http://dilbert.com'; const URI = 'http://dilbert.com';
public $description = 'The Unofficial Dilbert Daily Comic Strip'; const DESCRIPTION = 'The Unofficial Dilbert Daily Comic Strip';
public function collectData(){ public function collectData(){

View file

@ -1,13 +1,13 @@
<?php <?php
class DollbooruBridge extends BridgeAbstract{ class DollbooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Dollbooru"; const NAME = "Dollbooru";
public $uri = "http://dollbooru.org/"; const URI = "http://dollbooru.org/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -18,16 +18,16 @@ class DollbooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$page=$this->getInput('p'); $page=$this->getInput('p');
$tags = urlencode($this->getInput('t')); $tags = urlencode($this->getInput('t'));
$html = $this->getSimpleHTMLDOM($this->uri."post/list/$tags/$page") $html = $this->getSimpleHTMLDOM(self::URI."post/list/$tags/$page")
or $this->returnServerError('Could not request Dollbooru.'); or $this->returnServerError('Could not request Dollbooru.');
foreach($html->find('div[class=shm-image-list] a') as $element) { foreach($html->find('div[class=shm-image-list] a') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->href; $item['uri'] = self::URI.$element->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $this->uri.$element->find('img', 0)->src; $thumbnailUri = self::URI.$element->find('img', 0)->src;
$item['tags'] = $element->getAttribute('data-tags'); $item['tags'] = $element->getAttribute('data-tags');
$item['title'] = 'Dollbooru | '.$item['postid']; $item['title'] = 'Dollbooru | '.$item['postid'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags']; $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];

View file

@ -1,19 +1,19 @@
<?php <?php
class DuckDuckGoBridge extends BridgeAbstract{ class DuckDuckGoBridge extends BridgeAbstract{
public $maintainer = "Astalaseven"; const MAINTAINER = "Astalaseven";
public $name = "DuckDuckGo"; const NAME = "DuckDuckGo";
public $uri = "https://duckduckgo.com/"; const URI = "https://duckduckgo.com/";
public $description = "Returns most recent results from DuckDuckGo."; const DESCRIPTION = "Returns most recent results from DuckDuckGo.";
public $parameters = array( array( const PARAMETERS = array( array(
'u'=>array( 'u'=>array(
'name'=>'keyword', 'name'=>'keyword',
'required'=>true) 'required'=>true)
)); ));
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'html/?q='.$this->getInput('u').'+sort:date') $html = $this->getSimpleHTMLDOM(self::URI.'html/?q='.$this->getInput('u').'+sort:date')
or $this->returnServerError('Could not request DuckDuckGo.'); or $this->returnServerError('Could not request DuckDuckGo.');
foreach($html->find('div.results_links') as $element) { foreach($html->find('div.results_links') as $element) {

View file

@ -1,12 +1,12 @@
<?php <?php
class EZTVBridge extends BridgeAbstract{ class EZTVBridge extends BridgeAbstract{
public $maintainer = "alexAubin"; const MAINTAINER = "alexAubin";
public $name = "EZTV"; const NAME = "EZTV";
public $uri = "https://eztv.ch/"; const URI = "https://eztv.ch/";
public $description = "Returns list of *recent* torrents for a specific show on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name."; const DESCRIPTION = "Returns list of *recent* torrents for a specific show on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.";
public $parameters = array( array( const PARAMETERS = array( array(
'i'=>array( 'i'=>array(
'name'=>'Show ids', 'name'=>'Show ids',
'exampleValue'=>'showID1,showID2,…', 'exampleValue'=>'showID1,showID2,…',
@ -34,7 +34,7 @@ class EZTVBridge extends BridgeAbstract{
foreach($showList as $showID){ foreach($showList as $showID){
// Get show page // Get show page
$html = $this->getSimpleHTMLDOM($this->uri.'shows/'.rawurlencode($showID).'/') $html = $this->getSimpleHTMLDOM(self::URI.'shows/'.rawurlencode($showID).'/')
or $this->returnServerError('Could not request EZTV for id "'.$showID.'"'); or $this->returnServerError('Could not request EZTV for id "'.$showID.'"');
// Loop on each element that look like an episode entry... // Loop on each element that look like an episode entry...
@ -53,7 +53,7 @@ class EZTVBridge extends BridgeAbstract{
// Fill item // Fill item
$item = array(); $item = array();
$item['uri'] = $this->uri.$epinfo->href; $item['uri'] = self::URI.$epinfo->href;
$item['id'] = $item['uri']; $item['id'] = $item['uri'];
$item['timestamp'] = makeTimestamp($released->plaintext); $item['timestamp'] = makeTimestamp($released->plaintext);
$item['title'] = $epinfo->plaintext; $item['title'] = $epinfo->plaintext;

View file

@ -1,20 +1,20 @@
<?php <?php
class EliteDangerousGalnetBridge extends BridgeAbstract class EliteDangerousGalnetBridge extends BridgeAbstract
{ {
public $maintainer = "corenting"; const MAINTAINER = "corenting";
public $name = "Elite: Dangerous Galnet"; const NAME = "Elite: Dangerous Galnet";
public $uri = "https://community.elitedangerous.com/galnet/"; const URI = "https://community.elitedangerous.com/galnet/";
public $description = "Returns the latest page of news from Galnet"; const DESCRIPTION = "Returns the latest page of news from Galnet";
public function collectData() public function collectData()
{ {
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Error while downloading the website content'); or $this->returnServerError('Error while downloading the website content');
foreach($html->find('div.article') as $element) { foreach($html->find('div.article') as $element) {
$item = array(); $item = array();
$uri = $element->find('h3 a', 0)->href; $uri = $element->find('h3 a', 0)->href;
$uri = $this->uri . substr($uri,strlen('/galnet/')); $uri = self::URI . substr($uri,strlen('/galnet/'));
$item['uri'] = $uri; $item['uri'] = $uri;
$title = $element->find('h3 a', 0)->plaintext; $title = $element->find('h3 a', 0)->plaintext;

View file

@ -1,11 +1,11 @@
<?php <?php
class ElsevierBridge extends BridgeAbstract{ class ElsevierBridge extends BridgeAbstract{
public $maintainer = 'Pierre Mazière'; const MAINTAINER = 'Pierre Mazière';
public $name = 'Elsevier journals recent articles'; const NAME = 'Elsevier journals recent articles';
public $uri = 'http://www.journals.elsevier.com/'; const URI = 'http://www.journals.elsevier.com/';
public $description = 'Returns the recent articles published in Elsevier journals'; const DESCRIPTION = 'Returns the recent articles published in Elsevier journals';
public $parameters = array( array( const PARAMETERS = array( array(
'j'=>array( 'j'=>array(
'name'=>'Journal name', 'name'=>'Journal name',
'required'=>true, 'required'=>true,
@ -56,7 +56,7 @@ class ElsevierBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$uri = $this->uri . $this->getInput('j') . '/recent-articles/'; $uri = self::URI . $this->getInput('j') . '/recent-articles/';
$html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$this->getInput('j')); $html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$this->getInput('j'));
foreach($html->find('.pod-listing') as $article){ foreach($html->find('.pod-listing') as $article){

View file

@ -1,10 +1,10 @@
<?php <?php
class EstCeQuonMetEnProdBridge extends BridgeAbstract { class EstCeQuonMetEnProdBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'Est-ce qu\'on met en prod aujourd\'hui ?'; const NAME = 'Est-ce qu\'on met en prod aujourd\'hui ?';
public $uri = 'https://www.estcequonmetenprodaujourdhui.info/'; const URI = 'https://www.estcequonmetenprodaujourdhui.info/';
public $description = 'Should we put a website in production today? (French)'; const DESCRIPTION = 'Should we put a website in production today? (French)';
public function collectData(){ public function collectData(){
function ExtractFromDelimiters($string, $start, $end) { function ExtractFromDelimiters($string, $start, $end) {

View file

@ -1,12 +1,12 @@
<?php <?php
class FacebookBridge extends BridgeAbstract{ class FacebookBridge extends BridgeAbstract{
public $maintainer = "teromene"; const MAINTAINER = "teromene";
public $name = "Facebook"; const NAME = "Facebook";
public $uri = "https://www.facebook.com/"; const URI = "https://www.facebook.com/";
public $description = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117"; const DESCRIPTION = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117";
public $parameters =array( array( const PARAMETERS =array( array(
'u'=>array( 'u'=>array(
'name'=>'Username', 'name'=>'Username',
'required'=>true 'required'=>true
@ -31,7 +31,7 @@ class FacebookBridge extends BridgeAbstract{
if (is_array($matches) && count($matches) > 1) { if (is_array($matches) && count($matches) > 1) {
$link = $matches[1]; $link = $matches[1];
if (strpos($link, '/') === 0) if (strpos($link, '/') === 0)
$link = $this->uri.$link.'"'; $link = self::URI.$link.'"';
if (strpos($link, 'facebook.com/l.php?u=') !== false) if (strpos($link, 'facebook.com/l.php?u=') !== false)
$link = urldecode(ExtractFromDelimiters($link, 'facebook.com/l.php?u=', '&')); $link = urldecode(ExtractFromDelimiters($link, 'facebook.com/l.php?u=', '&'));
return ' href="'.$link.'"'; return ' href="'.$link.'"';
@ -104,10 +104,10 @@ class FacebookBridge extends BridgeAbstract{
//Retrieve page contents //Retrieve page contents
if (is_null($html)) { if (is_null($html)) {
if (!strpos($this->getInput('u'), "/")) { if (!strpos($this->getInput('u'), "/")) {
$html = $this->getSimpleHTMLDOM($this->uri.urlencode($this->getInput('u')).'?_fb_noscript=1') $html = $this->getSimpleHTMLDOM(self::URI.urlencode($this->getInput('u')).'?_fb_noscript=1')
or $this->returnServerError('No results for this query.'); or $this->returnServerError('No results for this query.');
} else { } else {
$html = $this->getSimpleHTMLDOM($this->uri.'pages/'.$this->getInput('u').'?_fb_noscript=1') $html = $this->getSimpleHTMLDOM(self::URI.'pages/'.$this->getInput('u').'?_fb_noscript=1')
or $this->returnServerError('No results for this query.'); or $this->returnServerError('No results for this query.');
} }
} }
@ -123,7 +123,7 @@ class FacebookBridge extends BridgeAbstract{
foreach ($captcha->find('input, button') as $input) foreach ($captcha->find('input, button') as $input)
$captcha_fields[$input->name] = $input->value; $captcha_fields[$input->name] = $input->value;
$_SESSION['captcha_fields'] = $captcha_fields; $_SESSION['captcha_fields'] = $captcha_fields;
$_SESSION['captcha_action'] = $this->uri.$captcha->find('form', 0)->action; $_SESSION['captcha_action'] = self::URI.$captcha->find('form', 0)->action;
//Show captcha filling form to the viewer, proxying the captcha image //Show captcha filling form to the viewer, proxying the captcha image
$img = base64_encode($this->getContents($captcha->find('img', 0)->src)); $img = base64_encode($this->getContents($captcha->find('img', 0)->src));
@ -192,7 +192,7 @@ class FacebookBridge extends BridgeAbstract{
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...'; $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...';
//Build and add final item //Build and add final item
$item['uri'] = $this->uri.$post->find('abbr')[0]->parent()->getAttribute('href'); $item['uri'] = self::URI.$post->find('abbr')[0]->parent()->getAttribute('href');
$item['content'] = $content; $item['content'] = $content;
$item['title'] = $title; $item['title'] = $title;
$item['author'] = $author; $item['author'] = $author;

View file

@ -1,13 +1,13 @@
<?php <?php
class FierPandaBridge extends BridgeAbstract { class FierPandaBridge extends BridgeAbstract {
public $maintainer = "snroki"; const MAINTAINER = "snroki";
public $name = "Fier Panda Bridge"; const NAME = "Fier Panda Bridge";
public $uri = "http://www.fier-panda.fr/"; const URI = "http://www.fier-panda.fr/";
public $description = "Returns latest articles from Fier Panda."; const DESCRIPTION = "Returns latest articles from Fier Panda.";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request Fier Panda.'); $html = $this->getSimpleHTMLDOM(self::URI) or $this->returnServerError('Could not request Fier Panda.');
foreach($html->find('div.container-content article') as $element) { foreach($html->find('div.container-content article') as $element) {
$item = array(); $item = array();

View file

@ -1,13 +1,13 @@
<?php <?php
class FlickrExploreBridge extends BridgeAbstract{ class FlickrExploreBridge extends BridgeAbstract{
public $maintainer = "sebsauvage"; const MAINTAINER = "sebsauvage";
public $name = "Flickr Explore"; const NAME = "Flickr Explore";
public $uri = "https://www.flickr.com/"; const URI = "https://www.flickr.com/";
public $description = "Returns the latest interesting images from Flickr"; const DESCRIPTION = "Returns the latest interesting images from Flickr";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'explore') $html = $this->getSimpleHTMLDOM(self::URI.'explore')
or $this->returnServerError('Could not request Flickr.'); or $this->returnServerError('Could not request Flickr.');
foreach($html->find('.photo-list-photo-view') as $element) { foreach($html->find('.photo-list-photo-view') as $element) {
@ -32,7 +32,7 @@ class FlickrExploreBridge extends BridgeAbstract{
)) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long... )) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long...
$item = array(); $item = array();
$item['uri'] = $this->uri.'photo.gne?id='.$imageID; $item['uri'] = self::URI.'photo.gne?id='.$imageID;
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $imageURI . '" /></a>'; // FIXME: Filter javascript ? $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $imageURI . '" /></a>'; // FIXME: Filter javascript ?
$item['title'] = $imageJSON->photo->title->_content; $item['title'] = $imageJSON->photo->title->_content;
$this->items[] = $item; $this->items[] = $item;

View file

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

View file

@ -1,13 +1,13 @@
<?php <?php
class FootitoBridge extends BridgeAbstract{ class FootitoBridge extends BridgeAbstract{
public $maintainer = "superbaillot.net"; const MAINTAINER = "superbaillot.net";
public $name = "Footito"; const NAME = "Footito";
public $uri = "http://www.footito.fr/"; const URI = "http://www.footito.fr/";
public $description = "Footito"; const DESCRIPTION = "Footito";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Footito.'); or $this->returnServerError('Could not request Footito.');
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {

View file

@ -1,12 +1,12 @@
<?php <?php
class FourchanBridge extends BridgeAbstract{ class FourchanBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "4chan"; const NAME = "4chan";
public $uri = "https://www.4chan.org/"; const URI = "https://www.4chan.org/";
public $description = "Returns posts from the specified thread"; const DESCRIPTION = "Returns posts from the specified thread";
public $parameters = array( array( const PARAMETERS = array( array(
't'=>array( 't'=>array(
'name'=>'Thread URL', 'name'=>'Thread URL',
'pattern'=>'(https:\/\/)?boards\.4chan\.org\/.*thread\/.*', 'pattern'=>'(https:\/\/)?boards\.4chan\.org\/.*thread\/.*',

View file

@ -2,10 +2,10 @@
define("FREENEWS_RSS", 'http://feeds.feedburner.com/Freenews-Freebox?format=xml'); define("FREENEWS_RSS", 'http://feeds.feedburner.com/Freenews-Freebox?format=xml');
class FreenewsBridge extends RssExpander { class FreenewsBridge extends RssExpander {
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Freenews"; const NAME = "Freenews";
public $uri = "http://freenews.fr"; const URI = "http://freenews.fr";
public $description = "Un site d'actualité pour les freenautes (mais ne parlant pas que de la freebox). Ne rentrez pas d'id si vous voulez accéder aux actualités générales."; const DESCRIPTION = "Un site d'actualité pour les freenautes (mais ne parlant pas que de la freebox). Ne rentrez pas d'id si vous voulez accéder aux actualités générales.";
public function collectData(){ public function collectData(){
parent::collectExpandableDatas(FREENEWS_RSS); parent::collectExpandableDatas(FREENEWS_RSS);

View file

@ -1,12 +1,12 @@
<?php <?php
class FuturaSciencesBridge extends BridgeAbstract { class FuturaSciencesBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'Futura-Sciences Bridge'; const NAME = 'Futura-Sciences Bridge';
public $uri = 'http://www.futura-sciences.com/'; const URI = 'http://www.futura-sciences.com/';
public $description = 'Returns the newest articles.'; const DESCRIPTION = 'Returns the newest articles.';
public $parameters = array( array( const PARAMETERS = array( array(
'feed'=> array( 'feed'=> array(
'name'=>'Feed', 'name'=>'Feed',
'type'=>'list', 'type'=>'list',

View file

@ -1,12 +1,12 @@
<?php <?php
class GBAtempBridge extends BridgeAbstract { class GBAtempBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'GBAtemp'; const NAME = 'GBAtemp';
public $uri = 'http://gbatemp.net/'; const URI = 'http://gbatemp.net/';
public $description = 'GBAtemp is a user friendly underground video game community.'; const DESCRIPTION = 'GBAtemp is a user friendly underground video game community.';
public $parameters = array( array( const PARAMETERS = array( array(
'type'=>array( 'type'=>array(
'name'=>'Type', 'name'=>'Type',
'type'=>'list', 'type'=>'list',
@ -65,22 +65,22 @@ class GBAtempBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request GBAtemp.'); or $this->returnServerError('Could not request GBAtemp.');
switch($this->getInput('type')){ switch($this->getInput('type')){
case 'N': case 'N':
foreach ($html->find('li[class=news_item full]') as $newsItem) { foreach ($html->find('li[class=news_item full]') as $newsItem) {
$url = $this->uri.$newsItem->find('a', 0)->href; $url = self::URI.$newsItem->find('a', 0)->href;
$time = intval($this->ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$author = $newsItem->find('a.username', 0)->plaintext; $author = $newsItem->find('a.username', 0)->plaintext;
$title = $newsItem->find('a', 1)->plaintext; $title = $newsItem->find('a', 1)->plaintext;
$content = $this->fetch_post_content($url, $this->uri); $content = $this->fetch_post_content($url, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
case 'R': case 'R':
foreach ($html->find('li.portal_review') as $reviewItem) { foreach ($html->find('li.portal_review') as $reviewItem) {
$url = $this->uri.$reviewItem->find('a', 0)->href; $url = self::URI.$reviewItem->find('a', 0)->href;
$title = $reviewItem->find('span.review_title', 0)->plaintext; $title = $reviewItem->find('span.review_title', 0)->plaintext;
$content = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request GBAtemp: '.$uri); $content = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request GBAtemp: '.$uri);
$author = $content->find('a.username', 0)->plaintext; $author = $content->find('a.username', 0)->plaintext;
@ -90,25 +90,25 @@ class GBAtempBridge extends BridgeAbstract {
$subheader = '<p><b>'.$content->find('div.review_subheader', 0)->plaintext.'</b></p>'; $subheader = '<p><b>'.$content->find('div.review_subheader', 0)->plaintext.'</b></p>';
$procons = $content->find('table.review_procons', 0)->outertext; $procons = $content->find('table.review_procons', 0)->outertext;
$scores = $content->find('table.reviewscores', 0)->outertext; $scores = $content->find('table.reviewscores', 0)->outertext;
$content = $this->cleanup_post_content($intro.$review.$subheader.$procons.$scores, $this->uri); $content = $this->cleanup_post_content($intro.$review.$subheader.$procons.$scores, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
case 'T': case 'T':
foreach ($html->find('li.portal-tutorial') as $tutorialItem) { foreach ($html->find('li.portal-tutorial') as $tutorialItem) {
$url = $this->uri.$tutorialItem->find('a', 0)->href; $url = self::URI.$tutorialItem->find('a', 0)->href;
$title = $tutorialItem->find('a', 0)->plaintext; $title = $tutorialItem->find('a', 0)->plaintext;
$time = intval($this->ExtractFromDelimiters($tutorialItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($tutorialItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$author = $tutorialItem->find('a.username', 0)->plaintext; $author = $tutorialItem->find('a.username', 0)->plaintext;
$content = $this->fetch_post_content($url, $this->uri); $content = $this->fetch_post_content($url, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
case 'F': case 'F':
foreach ($html->find('li.rc_item') as $postItem) { foreach ($html->find('li.rc_item') as $postItem) {
$url = $this->uri.$postItem->find('a', 1)->href; $url = self::URI.$postItem->find('a', 1)->href;
$title = $postItem->find('a', 1)->plaintext; $title = $postItem->find('a', 1)->plaintext;
$time = intval($this->ExtractFromDelimiters($postItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); $time = intval($this->ExtractFromDelimiters($postItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
$author = $postItem->find('a.username', 0)->plaintext; $author = $postItem->find('a.username', 0)->plaintext;
$content = $this->fetch_post_content($url, $this->uri); $content = $this->fetch_post_content($url, self::URI);
$this->items[] = $this->build_item($url, $title, $author, $time, $content); $this->items[] = $this->build_item($url, $title, $author, $time, $content);
} }
} }
@ -117,7 +117,7 @@ class GBAtempBridge extends BridgeAbstract {
public function getName() { public function getName() {
$type=array_search( $type=array_search(
$this->getInput('type'), $this->getInput('type'),
$this->parameters[$this->queriedContext]['type']['values'] self::PARAMETERS[$this->queriedContext]['type']['values']
); );
return 'GBAtemp '.$type.' Bridge'; return 'GBAtemp '.$type.' Bridge';
} }

View file

@ -1,12 +1,12 @@
<?php <?php
class GelbooruBridge extends BridgeAbstract{ class GelbooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Gelbooru"; const NAME = "Gelbooru";
public $uri = "http://gelbooru.com/"; const URI = "http://gelbooru.com/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -16,14 +16,14 @@ class GelbooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&' self::URI.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*63:'') .'&pid='.($this->getInput('p')?($this->getInput('p') -1)*63:'')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Gelbooru.'); ) or $this->returnServerError('Could not request Gelbooru.');
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;

View file

@ -3,12 +3,12 @@ define('GIPHY_LIMIT', 10);
class GiphyBridge extends BridgeAbstract{ class GiphyBridge extends BridgeAbstract{
public $maintainer = "kraoc"; const MAINTAINER = "kraoc";
public $name = "Giphy Bridge"; const NAME = "Giphy Bridge";
public $uri = "http://giphy.com/"; const URI = "http://giphy.com/";
public $description = "Bridge for giphy.com"; const DESCRIPTION = "Bridge for giphy.com";
public $parameters = array( array( const PARAMETERS = array( array(
's'=>array( 's'=>array(
'name'=>'search tag', 'name'=>'search tag',
'required'=>true 'required'=>true
@ -22,7 +22,7 @@ class GiphyBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$base_url = 'http://giphy.com'; $base_url = 'http://giphy.com';
$html = $this->getSimpleHTMLDOM($this->uri.'/search/'.urlencode($this->getInput('s').'/')) $html = $this->getSimpleHTMLDOM(self::URI.'/search/'.urlencode($this->getInput('s').'/'))
or $this->returnServerError('No results for this query.'); or $this->returnServerError('No results for this query.');
$max = GIPHY_LIMIT; $max = GIPHY_LIMIT;
@ -37,7 +37,7 @@ class GiphyBridge extends BridgeAbstract{
$node = $entry->first_child(); $node = $entry->first_child();
$href = $node->getAttribute('href'); $href = $node->getAttribute('href');
$html2 = $this->getSimpleHTMLDOM($this->uri . $href) $html2 = $this->getSimpleHTMLDOM(self::URI . $href)
or $this->returnServerError('No results for this query.'); or $this->returnServerError('No results for this query.');
$figure = $html2->getElementByTagName('figure'); $figure = $html2->getElementByTagName('figure');
$img = $figure->firstChild(); $img = $figure->firstChild();

View file

@ -1,12 +1,12 @@
<?php <?php
class GithubIssueBridge extends BridgeAbstract{ class GithubIssueBridge extends BridgeAbstract{
public $maintainer = 'Pierre Mazière'; const MAINTAINER = 'Pierre Mazière';
public $name = 'Github Issue'; const NAME = 'Github Issue';
public $uri = 'https://github.com/'; const URI = 'https://github.com/';
public $description = 'Returns the issues or comments of an issue of a github project'; const DESCRIPTION = 'Returns the issues or comments of an issue of a github project';
public $parameters=array( const PARAMETERS=array(
'global'=>array ( 'global'=>array (
'u'=>array( 'u'=>array(
'name'=>'User name', 'name'=>'User name',
@ -29,7 +29,7 @@ class GithubIssueBridge extends BridgeAbstract{
); );
public function collectData(){ public function collectData(){
$uri = $this->uri.$this->getInput('u').'/'.$this->getInput('p') $uri = self::URI.$this->getInput('u').'/'.$this->getInput('p')
.'/issues/'.$this->getInput('i'); .'/issues/'.$this->getInput('i');
$html = $this->getSimpleHTMLDOM($uri) $html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p')); or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p'));
@ -60,7 +60,7 @@ class GithubIssueBridge extends BridgeAbstract{
$item['title']=$issue->find('.js-navigation-open',0)->plaintext; $item['title']=$issue->find('.js-navigation-open',0)->plaintext;
$comments=$issue->find('.col-5',0)->plaintext; $comments=$issue->find('.col-5',0)->plaintext;
$item['content']='Comments: '.($comments?$comments:'0'); $item['content']='Comments: '.($comments?$comments:'0');
$item['uri']=$this->uri.$issue->find('.js-navigation-open',0)->getAttribute('href'); $item['uri']=self::URI.$issue->find('.js-navigation-open',0)->getAttribute('href');
$this->items[]=$item; $this->items[]=$item;
} }
break; break;

View file

@ -1,12 +1,12 @@
<?php <?php
class GitlabCommitsBridge extends BridgeAbstract{ class GitlabCommitsBridge extends BridgeAbstract{
public $maintainer = 'Pierre Mazière'; const MAINTAINER = 'Pierre Mazière';
public $name = 'Gitlab Commits'; const NAME = 'Gitlab Commits';
public $uri = ''; const URI = '';
public $description = 'Returns the commits of a project hosted on a gitlab instance'; const DESCRIPTION = 'Returns the commits of a project hosted on a gitlab instance';
public $parameters = array( array( const PARAMETERS = array( array(
'uri'=>array( 'uri'=>array(
'name'=>'Base URI', 'name'=>'Base URI',
'defaultValue'=>'https://gitlab.com' 'defaultValue'=>'https://gitlab.com'

View file

@ -1,10 +1,10 @@
<?php <?php
class GizmodoFRBridge extends BridgeAbstract{ class GizmodoFRBridge extends BridgeAbstract{
public $maintainer = "polopollo"; const MAINTAINER = "polopollo";
public $name = "GizmodoFR"; const NAME = "GizmodoFR";
public $uri = "http://www.gizmodo.fr/"; const URI = "http://www.gizmodo.fr/";
public $description = "Returns the 15 newest posts from GizmodoFR (full text)."; const DESCRIPTION = "Returns the 15 newest posts from GizmodoFR (full text).";
public function collectData(){ public function collectData(){
@ -24,8 +24,8 @@ class GizmodoFRBridge extends BridgeAbstract{
return $text; return $text;
} }
$rssFeed = $this->getSimpleHTMLDOM($this->uri.'/feed') $rssFeed = $this->getSimpleHTMLDOM(self::URI.'/feed')
or $this->returnServerError('Could not request '.$this->uri.'/feed'); or $this->returnServerError('Could not request '.self::URI.'/feed');
$limit = 0; $limit = 0;
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {

View file

@ -4,12 +4,12 @@ class GooglePlusPostBridge extends BridgeAbstract
protected $_title; protected $_title;
protected $_url; protected $_url;
public $maintainer = "Grummfy"; const MAINTAINER = "Grummfy";
public $name = "Google Plus Post Bridge"; const NAME = "Google Plus Post Bridge";
public $uri = "https://plus.google.com/"; const URI = "https://plus.google.com/";
public $description = "Returns user public post (without API)."; const DESCRIPTION = "Returns user public post (without API).";
public $parameters = array( array( const PARAMETERS = array( array(
'username'=>array( 'username'=>array(
'name'=>'username or Id', 'name'=>'username or Id',
'required'=>true 'required'=>true
@ -20,7 +20,7 @@ class GooglePlusPostBridge extends BridgeAbstract
{ {
// get content parsed // get content parsed
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html' // $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
$html = $this->getSimpleHTMLDOM($this->uri . urlencode($this->getInput('username')) . '/posts' $html = $this->getSimpleHTMLDOM(self::URI . urlencode($this->getInput('username')) . '/posts'
// force language // force language
, false, stream_context_create(array('http'=> array( , false, stream_context_create(array('http'=> array(
'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n" 'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n"
@ -48,7 +48,7 @@ class GooglePlusPostBridge extends BridgeAbstract
// $item['title'] = $item['fullname'] = $post->find('header.lea', 0)->plaintext; // $item['title'] = $item['fullname'] = $post->find('header.lea', 0)->plaintext;
$item['avatar'] = $post->find('div.ys img', 0)->src; $item['avatar'] = $post->find('div.ys img', 0)->src;
// var_dump((($post->find('a.o-U-s', 0)->getAllAttributes()))); // var_dump((($post->find('a.o-U-s', 0)->getAllAttributes())));
$item['uri'] = $this->uri . $post->find('a.o-U-s', 0)->href; $item['uri'] = self::URI . $post->find('a.o-U-s', 0)->href;
$item['timestamp'] = strtotime($post->find('a.o-U-s', 0)->plaintext); $item['timestamp'] = strtotime($post->find('a.o-U-s', 0)->plaintext);
$this->items[] = $item; $this->items[] = $item;
@ -56,21 +56,21 @@ class GooglePlusPostBridge extends BridgeAbstract
$hashtags = array(); $hashtags = array();
foreach($post->find('a.d-s') as $hashtag) foreach($post->find('a.d-s') as $hashtag)
{ {
$hashtags[ trim($hashtag->plaintext) ] = $this->uri . $hashtag->href; $hashtags[ trim($hashtag->plaintext) ] = self::URI . $hashtag->href;
} }
$item['content'] = ''; $item['content'] = '';
// avatar display // avatar display
$item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . $this->uri . urlencode($this->getInput('username')); $item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . self::URI . urlencode($this->getInput('username'));
$item['content'] .= '"><img align="top" alt="avatar" src="' . $item['avatar'].'" />' . $item['username'] . '</a></div>'; $item['content'] .= '"><img align="top" alt="avatar" src="' . $item['avatar'].'" />' . $item['username'] . '</a></div>';
$content = $post->find('div.Al', 0); $content = $post->find('div.Al', 0);
// alter link // alter link
// $content = $content->innertext; // $content = $content->innertext;
// $content = str_replace('href="./', 'href="' . $this->uri, $content); // $content = str_replace('href="./', 'href="' . self::URI, $content);
// $content = str_replace('href="photos', 'href="' . $this->uri . 'photos', $content); // $content = str_replace('href="photos', 'href="' . self::URI . 'photos', $content);
// XXX ugly but I don't have any idea how to do a better stuff, str_replace on link doesn't work as expected and ask too many checks // XXX ugly but I don't have any idea how to do a better stuff, str_replace on link doesn't work as expected and ask too many checks
foreach($content->find('a') as $link) foreach($content->find('a') as $link)
{ {
@ -86,7 +86,7 @@ class GooglePlusPostBridge extends BridgeAbstract
{ {
$link->href = substr($link->href, 1); $link->href = substr($link->href, 1);
} }
$link->href = $this->uri . $link->href; $link->href = self::URI . $link->href;
} }
} }
$content = $content->innertext; $content = $content->innertext;
@ -107,7 +107,7 @@ class GooglePlusPostBridge extends BridgeAbstract
public function getURI() public function getURI()
{ {
return $this->_url ?: $this->uri; return $this->_url ?: self::URI;
} }
public function getCacheDuration() public function getCacheDuration()

View file

@ -9,12 +9,12 @@
*/ */
class GoogleSearchBridge extends BridgeAbstract{ class GoogleSearchBridge extends BridgeAbstract{
public $maintainer = "sebsauvage"; const MAINTAINER = "sebsauvage";
public $name = "Google search"; const NAME = "Google search";
public $uri = "https://www.google.com/"; const URI = "https://www.google.com/";
public $description = "Returns most recent results from Google search."; const DESCRIPTION = "Returns most recent results from Google search.";
public $parameters = array( array( const PARAMETERS = array( array(
'q'=>array( 'q'=>array(
'name'=>"keyword", 'name'=>"keyword",
'required'=>true 'required'=>true
@ -25,7 +25,7 @@ class GoogleSearchBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$html = $this->getSimpleHTMLDOM($this->uri $html = $this->getSimpleHTMLDOM(self::URI
.'search?q=' . urlencode($this->getInput('q')) .'search?q=' . urlencode($this->getInput('q'))
.'&num=100&complete=0&tbs=qdr:y,sbd:1') .'&num=100&complete=0&tbs=qdr:y,sbd:1')
or $this->returnServerError('No results for this query.'); or $this->returnServerError('No results for this query.');

View file

@ -1,10 +1,10 @@
<?php <?php
class GuruMedBridge extends BridgeAbstract{ class GuruMedBridge extends BridgeAbstract{
public $maintainer = "qwertygc"; const MAINTAINER = "qwertygc";
public $name = "GuruMed"; const NAME = "GuruMed";
public $uri = "http://www.gurumed.org"; const URI = "http://www.gurumed.org";
public $description = "Returns the 5 newest posts from Gurumed (full text)"; const DESCRIPTION = "Returns the 5 newest posts from Gurumed (full text)";
private function GurumedStripCDATA($string) { private function GurumedStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string); $string = str_replace('<![CDATA[', '', $string);
@ -13,7 +13,7 @@ class GuruMedBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'feed') $html = $this->getSimpleHTMLDOM(self::URI.'feed')
or $this->returnServerError('Could not request Gurumed.'); or $this->returnServerError('Could not request Gurumed.');
$limit = 0; $limit = 0;

View file

@ -1,11 +1,11 @@
<?php <?php
class HDWallpapersBridge extends BridgeAbstract { class HDWallpapersBridge extends BridgeAbstract {
public $maintainer = "nel50n"; const MAINTAINER = "nel50n";
public $name = "HD Wallpapers Bridge"; const NAME = "HD Wallpapers Bridge";
public $uri = "http://www.hdwallpapers.in/"; const URI = "http://www.hdwallpapers.in/";
public $description = "Returns the latests wallpapers from HDWallpapers"; const DESCRIPTION = "Returns the latests wallpapers from HDWallpapers";
public $parameters = array( array( const PARAMETERS = array( array(
'c'=>array( 'c'=>array(
'name'=>'category', 'name'=>'category',
'defaultValue'=>'latest_wallpapers' 'defaultValue'=>'latest_wallpapers'
@ -29,7 +29,7 @@ class HDWallpapersBridge extends BridgeAbstract {
$lastpage = 1; $lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) { for ($page = 1; $page <= $lastpage; $page++) {
$link = $this->uri.'/'.$category.'/page/'.$page; $link = self::URI.'/'.$category.'/page/'.$page;
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.'); $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('No results for this query.');
if ($page === 1) { if ($page === 1) {
@ -42,10 +42,10 @@ class HDWallpapersBridge extends BridgeAbstract {
$item = array(); $item = array();
// http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg // http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
$item['uri'] = $this->uri.'/download'.str_replace('wallpapers.html', $this->getInput('r').'.jpg', $element->href); $item['uri'] = self::URI.'/download'.str_replace('wallpapers.html', $this->getInput('r').'.jpg', $element->href);
$item['timestamp'] = time(); $item['timestamp'] = time();
$item['title'] = $element->find('p', 0)->text(); $item['title'] = $element->find('p', 0)->text();
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'"><img src="'.$this->uri.$thumbnail->src.'" /></a>'; $item['content'] = $item['title'].'<br><a href="'.$item['uri'].'"><img src="'.self::URI.$thumbnail->src.'" /></a>';
$this->items[] = $item; $this->items[] = $item;
$num++; $num++;

View file

@ -1,13 +1,13 @@
<?php <?php
class HentaiHavenBridge extends BridgeAbstract{ class HentaiHavenBridge extends BridgeAbstract{
public $maintainer = "albirew"; const MAINTAINER = "albirew";
public $name = "Hentai Haven"; const NAME = "Hentai Haven";
public $uri = "http://hentaihaven.org/"; const URI = "http://hentaihaven.org/";
public $description = "Returns releases from Hentai Haven"; const DESCRIPTION = "Returns releases from Hentai Haven";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Hentai Haven.'); or $this->returnServerError('Could not request Hentai Haven.');
foreach($html->find('div.zoe-grid') as $element) { foreach($html->find('div.zoe-grid') as $element) {
$item = array(); $item = array();

View file

@ -1,12 +1,12 @@
<?php <?php
class IdenticaBridge extends BridgeAbstract{ class IdenticaBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Identica Bridge"; const NAME = "Identica Bridge";
public $uri = "https://identi.ca/"; const URI = "https://identi.ca/";
public $description = "Returns user timelines"; const DESCRIPTION = "Returns user timelines";
public $parameters = array( array( const PARAMETERS = array( array(
'u'=>array( 'u'=>array(
'name'=>'username', 'name'=>'username',
'required'=>true 'required'=>true
@ -32,7 +32,7 @@ class IdenticaBridge extends BridgeAbstract{
} }
public function getURI(){ public function getURI(){
return $this->uri.urlencode($this->getInput('u')); return self::URI.urlencode($this->getInput('u'));
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -1,12 +1,12 @@
<?php <?php
class InstagramBridge extends BridgeAbstract{ class InstagramBridge extends BridgeAbstract{
public $maintainer = "pauder"; const MAINTAINER = "pauder";
public $name = "Instagram Bridge"; const NAME = "Instagram Bridge";
public $uri = "http://instagram.com/"; const URI = "http://instagram.com/";
public $description = "Returns the newest images"; const DESCRIPTION = "Returns the newest images";
public $parameters = array( array( const PARAMETERS = array( array(
'u'=>array( 'u'=>array(
'name'=>'username', 'name'=>'username',
'required'=>true 'required'=>true
@ -46,7 +46,7 @@ class InstagramBridge extends BridgeAbstract{
{ {
$item = array(); $item = array();
$item['uri'] = $this->uri.'/p/'.$media->code.'/'; $item['uri'] = self::URI.'/p/'.$media->code.'/';
$item['content'] = '<img src="' . htmlentities($media->display_src) . '" />'; $item['content'] = '<img src="' . htmlentities($media->display_src) . '" />';
if (isset($media->caption)) if (isset($media->caption))
{ {
@ -65,7 +65,7 @@ class InstagramBridge extends BridgeAbstract{
} }
public function getURI(){ public function getURI(){
return $this->uri.urlencode($this->getInput('u')); return self::URI.urlencode($this->getInput('u'));
} }
} }

View file

@ -1,11 +1,11 @@
<?php <?php
class IsoHuntBridge extends BridgeAbstract{ class IsoHuntBridge extends BridgeAbstract{
public $maintainer = 'logmanoriginal'; const MAINTAINER = 'logmanoriginal';
public $name = 'isoHunt Bridge'; const NAME = 'isoHunt Bridge';
public $uri = 'https://isohunt.to/'; const URI = 'https://isohunt.to/';
public $description = 'Returns the latest results by category or search result'; const DESCRIPTION = 'Returns the latest results by category or search result';
public $parameters = array( const PARAMETERS = array(
/* /*
* Get feeds for one of the "latest" categories * Get feeds for one of the "latest" categories
* Notice: The categories "News" and "Top Searches" are received from the main page * Notice: The categories "News" and "Top Searches" are received from the main page
@ -90,7 +90,7 @@ class IsoHuntBridge extends BridgeAbstract{
); );
public function getURI(){ public function getURI(){
$uri=$this->uri; $uri=self::URI;
switch($this->queriedContext){ switch($this->queriedContext){
case 'By "Latest" category': case 'By "Latest" category':
switch($this->getInput('latest_category')){ switch($this->getInput('latest_category')){
@ -132,27 +132,27 @@ class IsoHuntBridge extends BridgeAbstract{
$categoryName = $categoryName =
array_search( array_search(
$this->getInput('latest_category'), $this->getInput('latest_category'),
$this->parameters['By "Latest" category']['latest_category']['values'] self::PARAMETERS['By "Latest" category']['latest_category']['values']
); );
$name = 'Latest '.$categoryName.' - ' . $this->name; $name = 'Latest '.$categoryName.' - ' . self::NAME;
break; break;
case 'By "Torrent" category': case 'By "Torrent" category':
$categoryName = $categoryName =
array_search( array_search(
$this->getInput('torrent_category'), $this->getInput('torrent_category'),
$this->parameters['By "Torrent" category']['torrent_category']['values'] self::PARAMETERS['By "Torrent" category']['torrent_category']['values']
); );
$name = 'Category: ' . $categoryName . ' - ' . $this->name; $name = 'Category: ' . $categoryName . ' - ' . self::NAME;
break; break;
case 'Search torrent by name': case 'Search torrent by name':
$categoryName = $categoryName =
array_search( array_search(
$this->getInput('search_category'), $this->getInput('search_category'),
$this->parameters['Search torrent by name']['search_category']['values'] self::PARAMETERS['Search torrent by name']['search_category']['values']
); );
$name = 'Search: "' . $this->getInput('search_name') . '" in category: ' . $categoryName . ' - ' . $this->name; $name = 'Search: "' . $this->getInput('search_name') . '" in category: ' . $categoryName . ' - ' . self::NAME;
break; break;
} }
@ -446,7 +446,7 @@ class IsoHuntBridge extends BridgeAbstract{
} }
private function fix_relative_uri($uri){ private function fix_relative_uri($uri){
return preg_replace('/\//i', $this->uri, $uri, 1); return preg_replace('/\//i', self::URI, $uri, 1);
} }
private function build_category_uri($category, $order_popularity = false){ private function build_category_uri($category, $order_popularity = false){

View file

@ -1,11 +1,11 @@
<?php <?php
class JapanExpoBridge extends HttpCachingBridgeAbstract { class JapanExpoBridge extends HttpCachingBridgeAbstract {
public $maintainer = 'Ginko'; const MAINTAINER = 'Ginko';
public $name = 'Japan Expo Actualités'; const NAME = 'Japan Expo Actualités';
public $uri = 'http://www.japan-expo-paris.com/fr/actualites'; const URI = 'http://www.japan-expo-paris.com/fr/actualites';
public $description = 'Returns most recent entries from Japan Expo actualités.'; const DESCRIPTION = 'Returns most recent entries from Japan Expo actualités.';
public $parameters = array( array( const PARAMETERS = array( array(
'mode'=>array( 'mode'=>array(
'name'=>'Show full contents', 'name'=>'Show full contents',
'type'=>'checkbox', 'type'=>'checkbox',
@ -42,8 +42,8 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract {
} }
}; };
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request JapanExpo: '.$this->uri); or $this->returnServerError('Could not request JapanExpo: '.self::URI);
$fullcontent = $this->getInput('mode'); $fullcontent = $this->getInput('mode');
$count = 0; $count = 0;

View file

@ -1,12 +1,12 @@
<?php <?php
class KonachanBridge extends BridgeAbstract{ class KonachanBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Konachan"; const NAME = "Konachan";
public $uri = "http://konachan.com/"; const URI = "http://konachan.com/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'defaultValue'=>1, 'defaultValue'=>1,
@ -17,7 +17,7 @@ class KonachanBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'/post?' self::URI.'/post?'
.'&page='.$this->getInput('p') .'&page='.$this->getInput('p')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Konachan.'); ) or $this->returnServerError('Could not request Konachan.');
@ -30,7 +30,7 @@ class KonachanBridge extends BridgeAbstract{
foreach($data as $datai) { foreach($data as $datai) {
$json = json_decode($datai, TRUE); $json = json_decode($datai, TRUE);
$item = array(); $item = array();
$item['uri'] = $this->uri.'/post/show/'.$json['id']; $item['uri'] = self::URI.'/post/show/'.$json['id'];
$item['postid'] = $json['id']; $item['postid'] = $json['id'];
$item['timestamp'] = $json['created_at']; $item['timestamp'] = $json['created_at'];
$item['imageUri'] = $json['file_url']; $item['imageUri'] = $json['file_url'];

View file

@ -1,10 +1,10 @@
<?php <?php
class KoreusBridge extends BridgeAbstract{ class KoreusBridge extends BridgeAbstract{
public $maintainer = "pit-fgfjiudghdf"; const MAINTAINER = "pit-fgfjiudghdf";
public $name = "Koreus"; const NAME = "Koreus";
public $uri = "http://www.koreus.com/"; const URI = "http://www.koreus.com/";
public $description = "Returns the 5 newest posts from Koreus (full text)"; const DESCRIPTION = "Returns the 5 newest posts from Koreus (full text)";
private function KoreusStripCDATA($string) { private function KoreusStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string); $string = str_replace('<![CDATA[', '', $string);

View file

@ -1,11 +1,11 @@
<?php <?php
class KununuBridge extends HttpCachingBridgeAbstract { class KununuBridge extends HttpCachingBridgeAbstract {
public $maintainer = "logmanoriginal"; const MAINTAINER = "logmanoriginal";
public $name = "Kununu Bridge"; const NAME = "Kununu Bridge";
public $uri = "https://www.kununu.com/"; const URI = "https://www.kununu.com/";
public $description = "Returns the latest reviews for a company and site of your choice."; const DESCRIPTION = "Returns the latest reviews for a company and site of your choice.";
public $parameters = array( const PARAMETERS = array(
'global' => array( 'global' => array(
'site'=>array( 'site'=>array(
'name'=>'Site', 'name'=>'Site',
@ -55,12 +55,12 @@ class KununuBridge extends HttpCachingBridgeAbstract {
break; break;
} }
return $this->uri.$site.'/'.$company.'/'.$section; return self::URI.$site.'/'.$company.'/'.$section;
} }
function getName(){ function getName(){
$company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($this->getInput('company'))))); $company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($this->getInput('company')))));
return ($this->companyName?:$company).' - '.$this->name; return ($this->companyName?:$company).' - '.self::NAME;
} }
public function collectData(){ public function collectData(){
@ -109,7 +109,7 @@ class KununuBridge extends HttpCachingBridgeAbstract {
* Fixes relative URLs in the given text * Fixes relative URLs in the given text
*/ */
private function fix_url($text){ private function fix_url($text){
return preg_replace('/href=(\'|\")\//i', 'href="'.$this->uri, $text); return preg_replace('/href=(\'|\")\//i', 'href="'.self::URI, $text);
} }
/** /**
@ -184,7 +184,7 @@ class KununuBridge extends HttpCachingBridgeAbstract {
if($anchor === false) if($anchor === false)
$this->returnServerError('Cannot find article URI!'); $this->returnServerError('Cannot find article URI!');
return $this->uri . $anchor->href; return self::URI . $anchor->href;
} }
/** /**

View file

@ -1,12 +1,12 @@
<?php <?php
class LWNprevBridge extends BridgeAbstract{ class LWNprevBridge extends BridgeAbstract{
public $maintainer = 'Pierre Mazière'; const MAINTAINER = 'Pierre Mazière';
public $name = 'LWN Free Weekly Edition'; const NAME = 'LWN Free Weekly Edition';
public $uri = 'https://lwn.net/'; const URI = 'https://lwn.net/';
public $description = 'LWN Free Weekly Edition available one week late'; const DESCRIPTION = 'LWN Free Weekly Edition available one week late';
function getURI(){ function getURI(){
return $this->uri.'free/bigpage'; return self::URI.'free/bigpage';
} }
private function jumpToNextTag(&$node){ private function jumpToNextTag(&$node){
@ -48,7 +48,7 @@ class LWNprevBridge extends BridgeAbstract{
break; break;
} }
} }
$realURI=$this->uri.$a->getAttribute('href'); $realURI=self::URI.$a->getAttribute('href');
$URICounter=0; $URICounter=0;
$edition=$html->getElementsByTagName('h1')->item(0)->textContent; $edition=$html->getElementsByTagName('h1')->item(0)->textContent;
@ -82,7 +82,7 @@ class LWNprevBridge extends BridgeAbstract{
$h2FirstChild=$h2->firstChild; $h2FirstChild=$h2->firstChild;
$this->jumpToNextTag($h2FirstChild); $this->jumpToNextTag($h2FirstChild);
if($h2FirstChild->nodeName==='a'){ if($h2FirstChild->nodeName==='a'){
$item['uri']=$this->uri.$h2FirstChild->getAttribute('href'); $item['uri']=self::URI.$h2FirstChild->getAttribute('href');
}else{ }else{
$item['uri']=$realURI.'#'.$URICounter; $item['uri']=$realURI.'#'.$URICounter;
} }

View file

@ -1,12 +1,12 @@
<?php <?php
class LeBonCoinBridge extends BridgeAbstract{ class LeBonCoinBridge extends BridgeAbstract{
public $maintainer = "16mhz"; const MAINTAINER = "16mhz";
public $name = "LeBonCoin"; const NAME = "LeBonCoin";
public $uri = "http://www.leboncoin.fr/"; const URI = "http://www.leboncoin.fr/";
public $description = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword ."; const DESCRIPTION = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword .";
public $parameters = array( array( const PARAMETERS = array( array(
'k'=>array('name'=>'Mot Clé'), 'k'=>array('name'=>'Mot Clé'),
'r'=>array( 'r'=>array(
'name'=>'Région', 'name'=>'Région',
@ -143,7 +143,7 @@ class LeBonCoinBridge extends BridgeAbstract{
} }
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.$category.'/offres/' . $this->getInput('r') . '/?' self::URI.$category.'/offres/' . $this->getInput('r') . '/?'
.'f=a&th=1&' .'f=a&th=1&'
.'q=' . urlencode($this->getInput('k')) .'q=' . urlencode($this->getInput('k'))
) or $this->returnServerError('Could not request LeBonCoin.'); ) or $this->returnServerError('Could not request LeBonCoin.');

View file

@ -1,10 +1,10 @@
<?php <?php
class LeJournalDuGeekBridge extends BridgeAbstract{ class LeJournalDuGeekBridge extends BridgeAbstract{
public $maintainer = "polopollo"; const MAINTAINER = "polopollo";
public $name = "journaldugeek.com (FR)"; const NAME = "journaldugeek.com (FR)";
public $uri = "http://www.journaldugeek.com/"; const URI = "http://www.journaldugeek.com/";
public $description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; const DESCRIPTION = "Returns the 5 newest posts from LeJournalDuGeek (full text).";
private function LeJournalDuGeekStripCDATA($string) { private function LeJournalDuGeekStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string); $string = str_replace('<![CDATA[', '', $string);
@ -35,8 +35,8 @@ class LeJournalDuGeekBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$rssFeed = $this->getSimpleHTMLDOM($this->uri.'rss') $rssFeed = $this->getSimpleHTMLDOM(self::URI.'rss')
or $this->returnServerError('Could not request '.$this->uri.'/rss'); or $this->returnServerError('Could not request '.self::URI.'/rss');
$limit = 0; $limit = 0;
foreach($rssFeed->find('item') as $element) { foreach($rssFeed->find('item') as $element) {

View file

@ -1,10 +1,10 @@
<?php <?php
class LeMondeInformatiqueBridge extends BridgeAbstract { class LeMondeInformatiqueBridge extends BridgeAbstract {
public $maintainer = "ORelio"; const MAINTAINER = "ORelio";
public $name = "Le Monde Informatique"; const NAME = "Le Monde Informatique";
public $uri = "http://www.lemondeinformatique.fr/"; const URI = "http://www.lemondeinformatique.fr/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
public function collectData(){ public function collectData(){
@ -28,9 +28,9 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
return $article_html; return $article_html;
} }
$html = $this->getSimpleHTMLDOM($this->uri.'rss/rss.xml') $html = $this->getSimpleHTMLDOM(self::URI.'rss/rss.xml')
or $this->returnServerError('Could not request LeMondeInformatique: ' or $this->returnServerError('Could not request LeMondeInformatique: '
.$this->uri.'rss/rss.xml'); .self::URI.'rss/rss.xml');
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -1,14 +1,14 @@
<?php <?php
class Les400CulsBridge extends RssExpander{ class Les400CulsBridge extends RssExpander{
public $maintainer = "unknown"; const MAINTAINER = "unknown";
public $name = "Les 400 Culs"; const NAME = "Les 400 Culs";
public $uri = "http://sexes.blogs.liberation.fr/"; const URI = "http://sexes.blogs.liberation.fr/";
public $description = "La planete sexe vue par Agnes Girard via rss-bridge"; const DESCRIPTION = "La planete sexe vue par Agnes Girard via rss-bridge";
public function collectData(){ public function collectData(){
$this->collectExpandableDatas($this->uri.'feeds/'); $this->collectExpandableDatas(self::URI.'feeds/');
} }
protected function parseRSSItem($newsItem) { protected function parseRSSItem($newsItem) {

View file

@ -1,13 +1,13 @@
<?php <?php
class LesJoiesDuCodeBridge extends BridgeAbstract{ class LesJoiesDuCodeBridge extends BridgeAbstract{
public $maintainer = "superbaillot.net"; const MAINTAINER = "superbaillot.net";
public $name = "Les Joies Du Code"; const NAME = "Les Joies Du Code";
public $uri = "http://lesjoiesducode.fr/"; const URI = "http://lesjoiesducode.fr/";
public $description = "LesJoiesDuCode"; const DESCRIPTION = "LesJoiesDuCode";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request LesJoiesDuCode.'); or $this->returnServerError('Could not request LesJoiesDuCode.');
foreach($html->find('div.blog-post') as $element) { foreach($html->find('div.blog-post') as $element) {

View file

@ -2,14 +2,14 @@
class LichessBridge extends HttpCachingBridgeAbstract class LichessBridge extends HttpCachingBridgeAbstract
{ {
public $maintainer = 'AmauryCarrade'; const MAINTAINER = 'AmauryCarrade';
public $name = 'Lichess Blog'; const NAME = 'Lichess Blog';
public $uri = 'http://fr.lichess.org/blog'; const URI = 'http://fr.lichess.org/blog';
public $description = 'Returns the 5 newest posts from the Lichess blog (full text)'; const DESCRIPTION = 'Returns the 5 newest posts from the Lichess blog (full text)';
public function collectData() public function collectData()
{ {
$xml_feed = $this->getSimpleHTMLDOM($this->uri.'.atom') $xml_feed = $this->getSimpleHTMLDOM(self::URI.'.atom')
or $this->returnServerError('Could not retrieve Lichess blog feed.'); or $this->returnServerError('Could not retrieve Lichess blog feed.');
$posts_loaded = 0; $posts_loaded = 0;

View file

@ -1,12 +1,12 @@
<?php <?php
class LinkedInCompanyBridge extends BridgeAbstract{ class LinkedInCompanyBridge extends BridgeAbstract{
public $maintainer = "regisenguehard"; const MAINTAINER = "regisenguehard";
public $name = "LinkedIn Company"; const NAME = "LinkedIn Company";
public $uri = "https://www.linkedin.com/"; const URI = "https://www.linkedin.com/";
public $description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)"; const DESCRIPTION = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)";
public $parameters = array( array( const PARAMETERS = array( array(
'c'=>array( 'c'=>array(
'name'=>'Company name', 'name'=>'Company name',
'required'=>true 'required'=>true
@ -15,7 +15,7 @@ class LinkedInCompanyBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$link = $this->uri.'company/'.$this->getInput('c'); $link = self::URI.'company/'.$this->getInput('c');
$html = $this->getSimpleHTMLDOM($link) $html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request LinkedIn.'); or $this->returnServerError('Could not request LinkedIn.');

View file

@ -1,12 +1,12 @@
<?php <?php
class LolibooruBridge extends BridgeAbstract{ class LolibooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Lolibooru"; const NAME = "Lolibooru";
public $uri = "http://lolibooru.moe/"; const URI = "http://lolibooru.moe/";
public $description = "Returns images from given page and tags"; const DESCRIPTION = "Returns images from given page and tags";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'defaultValue'=>1, 'defaultValue'=>1,
@ -17,7 +17,7 @@ class LolibooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'post?' self::URI.'post?'
.'&page='.$this->getInput('p') .'&page='.$this->getInput('p')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Lolibooru.'); ) or $this->returnServerError('Could not request Lolibooru.');
@ -30,7 +30,7 @@ class LolibooruBridge extends BridgeAbstract{
foreach($data as $datai) { foreach($data as $datai) {
$json = json_decode($datai, TRUE); $json = json_decode($datai, TRUE);
$item = array(); $item = array();
$item['uri'] = $this->uri.'post/show/'.$json['id']; $item['uri'] = self::URI.'post/show/'.$json['id'];
$item['postid'] = $json['id']; $item['postid'] = $json['id'];
$item['timestamp'] = $json['created_at']; $item['timestamp'] = $json['created_at'];
$item['imageUri'] = $json['file_url']; $item['imageUri'] = $json['file_url'];

View file

@ -2,12 +2,12 @@
define('MANGAREADER_LIMIT', 10); // The default limit define('MANGAREADER_LIMIT', 10); // The default limit
class MangareaderBridge extends BridgeAbstract{ class MangareaderBridge extends BridgeAbstract{
public $maintainer = "logmanoriginal"; const MAINTAINER = "logmanoriginal";
public $name = "Mangareader Bridge"; const NAME = "Mangareader Bridge";
public $uri = "http://www.mangareader.net/"; const URI = "http://www.mangareader.net/";
public $description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; const DESCRIPTION = "Returns the latest updates, popular mangas or manga updates (new chapters)";
public $parameters = array( const PARAMETERS = array(
'Get latest updates' => array(), 'Get latest updates' => array(),
'Get popular mangas' => array( 'Get popular mangas' => array(
'category'=>array( 'category'=>array(
@ -108,7 +108,7 @@ class MangareaderBridge extends BridgeAbstract{
if (isset($manga) && $chapters->length >= 1){ if (isset($manga) && $chapters->length >= 1){
$item = array(); $item = array();
$item['uri'] = $this->uri. htmlspecialchars($manga->getAttribute('href')); $item['uri'] = self::URI. htmlspecialchars($manga->getAttribute('href'));
$item['title'] = htmlspecialchars($manga->nodeValue); $item['title'] = htmlspecialchars($manga->nodeValue);
// Add each chapter to the feed // Add each chapter to the feed
@ -118,7 +118,7 @@ class MangareaderBridge extends BridgeAbstract{
if($item['content'] <> ""){ if($item['content'] <> ""){
$item['content'] .= "<br>"; $item['content'] .= "<br>";
} }
$item['content'] .= "<a href='" .$this->uri. htmlspecialchars($chapter->getAttribute('href')) . "'>" . htmlspecialchars($chapter->nodeValue) . "</a>"; $item['content'] .= "<a href='" .self::URI. htmlspecialchars($chapter->getAttribute('href')) . "'>" . htmlspecialchars($chapter->nodeValue) . "</a>";
} }
$this->items[] = $item; $this->items[] = $item;
@ -142,7 +142,7 @@ class MangareaderBridge extends BridgeAbstract{
$item = array(); $item = array();
$item['title'] = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue); $item['title'] = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue);
$item['uri'] = $this->uri . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); $item['uri'] = self::URI . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href');
$item['author'] = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue); $item['author'] = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue);
$item['chaptercount'] = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; $item['chaptercount'] = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue;
$item['genre'] = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue); $item['genre'] = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue);
@ -170,7 +170,7 @@ class MangareaderBridge extends BridgeAbstract{
foreach ($chapters as $chapter){ foreach ($chapters as $chapter){
$item = array(); $item = array();
$item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); $item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue);
$item['uri'] = $this->uri . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); $item['uri'] = self::URI . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href');
$item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue); $item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue);
array_unshift($this->items, $item); array_unshift($this->items, $item);
} }
@ -201,7 +201,7 @@ class MangareaderBridge extends BridgeAbstract{
$path = $this->getInput('path'); $path = $this->getInput('path');
break; break;
} }
return $this->uri . $path; return self::URI . $path;
} }

View file

@ -2,12 +2,12 @@
class MilbooruBridge extends BridgeAbstract{ class MilbooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Milbooru"; const NAME = "Milbooru";
public $uri = "http://sheslostcontrol.net/moe/shimmie/"; const URI = "http://sheslostcontrol.net/moe/shimmie/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -17,15 +17,15 @@ class MilbooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'?q=/post/list/'.urlencode($this->getInput('t')).'/'.$this->getInput('p') self::URI.'?q=/post/list/'.urlencode($this->getInput('t')).'/'.$this->getInput('p')
)or $this->returnServerError('Could not request Milbooru.'); )or $this->returnServerError('Could not request Milbooru.');
foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) { foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $this->uri.$element->find('img', 0)->src; $thumbnailUri = self::URI.$element->find('img', 0)->src;
$item['tags'] = $element->find('a', 0)->getAttribute('data-tags'); $item['tags'] = $element->find('a', 0)->getAttribute('data-tags');
$item['title'] = 'Milbooru | '.$item['postid']; $item['title'] = 'Milbooru | '.$item['postid'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags']; $item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $thumbnailUri . '" /></a><br>Tags: '.$item['tags'];

View file

@ -1,19 +1,19 @@
<?php <?php
class MondeDiploBridge extends BridgeAbstract{ class MondeDiploBridge extends BridgeAbstract{
public $maintainer = "Pitchoule"; const MAINTAINER = "Pitchoule";
public $name = 'Monde Diplomatique'; const NAME = 'Monde Diplomatique';
public $uri = 'http://www.monde-diplomatique.fr/'; const URI = 'http://www.monde-diplomatique.fr/';
public $description = "Returns most recent results from MondeDiplo."; const DESCRIPTION = "Returns most recent results from MondeDiplo.";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request MondeDiplo. for : ' . $this->uri); or $this->returnServerError('Could not request MondeDiplo. for : ' . self::URI);
foreach($html->find('div.unarticle') as $article) { foreach($html->find('div.unarticle') as $article) {
$element = $article->parent(); $element = $article->parent();
$item = array(); $item = array();
$item['uri'] = $this->uri . $element->href; $item['uri'] = self::URI . $element->href;
$item['title'] = $element->find('h3', 0)->plaintext; $item['title'] = $element->find('h3', 0)->plaintext;
$item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true); $item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
$this->items[] = $item; $this->items[] = $item;

View file

@ -1,13 +1,13 @@
<?php <?php
class MsnMondeBridge extends BridgeAbstract{ class MsnMondeBridge extends BridgeAbstract{
public $maintainer = "kranack"; const MAINTAINER = "kranack";
public $name = 'MSN Actu Monde'; const NAME = 'MSN Actu Monde';
public $uri = 'http://www.msn.com/'; const URI = 'http://www.msn.com/';
public $description = "Returns the 10 newest posts from MSN Actualités (full text)"; const DESCRIPTION = "Returns the 10 newest posts from MSN Actualités (full text)";
public function getURI(){ public function getURI(){
return $this->uri.'fr-fr/actualite/monde'; return self::URI.'fr-fr/actualite/monde';
} }
private function MsnMondeExtractContent($url, &$item) { private function MsnMondeExtractContent($url, &$item) {
@ -23,7 +23,7 @@ class MsnMondeBridge extends BridgeAbstract{
if($limit < 10) { if($limit < 10) {
$item = array(); $item = array();
$item['title'] = utf8_decode($article->find('h4', 0)->innertext); $item['title'] = utf8_decode($article->find('h4', 0)->innertext);
$item['uri'] = $this->uri . utf8_decode($article->find('a', 0)->href); $item['uri'] = self::URI . utf8_decode($article->find('a', 0)->href);
$this->MsnMondeExtractContent($item['uri'], $item); $this->MsnMondeExtractContent($item['uri'], $item);
$this->items[] = $item; $this->items[] = $item;
$limit++; $limit++;

View file

@ -2,12 +2,12 @@
class MspabooruBridge extends BridgeAbstract{ class MspabooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Mspabooru"; const NAME = "Mspabooru";
public $uri = "http://mspabooru.com/"; const URI = "http://mspabooru.com/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -17,7 +17,7 @@ class MspabooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&' self::URI.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'') .'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Mspabooru.'); ) or $this->returnServerError('Could not request Mspabooru.');
@ -25,7 +25,7 @@ class MspabooruBridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;

View file

@ -1,10 +1,10 @@
<?php <?php
class NakedSecurityBridge extends BridgeAbstract { class NakedSecurityBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'Naked Security'; const NAME = 'Naked Security';
public $uri = 'https://nakedsecurity.sophos.com/'; const URI = 'https://nakedsecurity.sophos.com/';
public $description = 'Returns the newest articles.'; const DESCRIPTION = 'Returns the newest articles.';
public function collectData(){ public function collectData(){

View file

@ -1,14 +1,14 @@
<?php <?php
class NasaApodBridge extends BridgeAbstract{ class NasaApodBridge extends BridgeAbstract{
public $maintainer = "corenting"; const MAINTAINER = "corenting";
public $name = "NASA APOD Bridge"; const NAME = "NASA APOD Bridge";
public $uri = "http://apod.nasa.gov/apod/"; const URI = "http://apod.nasa.gov/apod/";
public $description = "Returns the 3 latest NASA APOD pictures and explanations"; const DESCRIPTION = "Returns the 3 latest NASA APOD pictures and explanations";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'archivepix.html') or $this->returnServerError('Error while downloading the website content'); $html = $this->getSimpleHTMLDOM(self::URI.'archivepix.html') or $this->returnServerError('Error while downloading the website content');
$list = explode("<br>", $html->find('b', 0)->innertext); $list = explode("<br>", $html->find('b', 0)->innertext);
for($i = 0; $i < 3;$i++) for($i = 0; $i < 3;$i++)
@ -17,7 +17,7 @@ class NasaApodBridge extends BridgeAbstract{
$item = array(); $item = array();
$uri_page = $html->find('a',$i + 3)->href; $uri_page = $html->find('a',$i + 3)->href;
$uri = $this->uri.$uri_page; $uri = self::URI.$uri_page;
$item['uri'] = $uri; $item['uri'] = $uri;
$picture_html = $this->getSimpleHTMLDOM($uri); $picture_html = $this->getSimpleHTMLDOM($uri);

View file

@ -1,10 +1,10 @@
<?php <?php
class NeuviemeArtBridge extends BridgeAbstract { class NeuviemeArtBridge extends BridgeAbstract {
public $maintainer = "ORelio"; const MAINTAINER = "ORelio";
public $name = '9ème Art Bridge'; const NAME = '9ème Art Bridge';
public $uri = "http://www.9emeart.fr/"; const URI = "http://www.9emeart.fr/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
public function collectData(){ public function collectData(){
@ -16,7 +16,7 @@ class NeuviemeArtBridge extends BridgeAbstract {
} return $string; } return $string;
} }
$feedUrl = $this->uri.'9emeart.rss'; $feedUrl = self::URI.'9emeart.rss';
$html = $this->getSimpleHTMLDOM($feedUrl) or $this->returnServerError('Could not request 9eme Art: '.$feedUrl); $html = $this->getSimpleHTMLDOM($feedUrl) or $this->returnServerError('Could not request 9eme Art: '.$feedUrl);
$limit = 0; $limit = 0;
@ -32,9 +32,9 @@ class NeuviemeArtBridge extends BridgeAbstract {
$article_image = $element->find('enclosure', 0)->url; $article_image = $element->find('enclosure', 0)->url;
foreach ($article_html->find('img.img_full') as $img) foreach ($article_html->find('img.img_full') as $img)
if ($img->alt == $article_title) if ($img->alt == $article_title)
$article_image = $this->uri.$img->src; $article_image = self::URI.$img->src;
$article_content = '<p><img src="'.$article_image.'" /></p>' $article_content = '<p><img src="'.$article_image.'" /></p>'
.str_replace('src="/', 'src="'.$this->uri, $article_html->find('div.newsGenerique_con', 0)->innertext); .str_replace('src="/', 'src="'.self::URI, $article_html->find('div.newsGenerique_con', 0)->innertext);
$article_content = StripWithDelimiters($article_content, '<script', '</script>'); $article_content = StripWithDelimiters($article_content, '<script', '</script>');
$article_content = StripWithDelimiters($article_content, '<style', '</style>'); $article_content = StripWithDelimiters($article_content, '<style', '</style>');
$article_content = StripWithDelimiters($article_content, '<link', '>'); $article_content = StripWithDelimiters($article_content, '<link', '>');

View file

@ -1,10 +1,10 @@
<?php <?php
class NextInpactBridge extends BridgeAbstract { class NextInpactBridge extends BridgeAbstract {
public $maintainer = "qwertygc"; const MAINTAINER = "qwertygc";
public $name = "NextInpact Bridge"; const NAME = "NextInpact Bridge";
public $uri = "http://www.nextinpact.com/"; const URI = "http://www.nextinpact.com/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
private function StripCDATA($string) { private function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string); $string = str_replace('<![CDATA[', '', $string);
@ -24,7 +24,7 @@ class NextInpactBridge extends BridgeAbstract {
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'rss/news.xml') or $this->returnServerError('Could not request NextInpact.'); $html = $this->getSimpleHTMLDOM(self::URI.'rss/news.xml') or $this->returnServerError('Could not request NextInpact.');
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -1,12 +1,12 @@
<?php <?php
class NextgovBridge extends BridgeAbstract { class NextgovBridge extends BridgeAbstract {
public $maintainer = 'ORelio'; const MAINTAINER = 'ORelio';
public $name = 'Nextgov Bridge'; const NAME = 'Nextgov Bridge';
public $uri = 'https://www.nextgov.com/'; const URI = 'https://www.nextgov.com/';
public $description = 'USA Federal technology news, best practices, and web 2.0 tools.'; const DESCRIPTION = 'USA Federal technology news, best practices, and web 2.0 tools.';
public $parameters = array( array( const PARAMETERS = array( array(
'category'=>array( 'category'=>array(
'name'=>'Category', 'name'=>'Category',
'type'=>'list', 'type'=>'list',

View file

@ -1,10 +1,10 @@
<?php <?php
class NiceMatinBridge extends BridgeAbstract{ class NiceMatinBridge extends BridgeAbstract{
public $maintainer = "pit-fgfjiudghdf"; const MAINTAINER = "pit-fgfjiudghdf";
public $name = "NiceMatin"; const NAME = "NiceMatin";
public $uri = "http://www.nicematin.com/"; const URI = "http://www.nicematin.com/";
public $description = "Returns the 10 newest posts from NiceMatin (full text)"; const DESCRIPTION = "Returns the 10 newest posts from NiceMatin (full text)";
private function NiceMatinExtractContent($url) { private function NiceMatinExtractContent($url) {
$html = $this->getSimpleHTMLDOM($url); $html = $this->getSimpleHTMLDOM($url);
@ -21,7 +21,7 @@ class NiceMatinBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'derniere-minute/rss') $html = $this->getSimpleHTMLDOM(self::URI.'derniere-minute/rss')
or $this->returnServerError('Could not request NiceMatin.'); or $this->returnServerError('Could not request NiceMatin.');
$limit = 0; $limit = 0;

View file

@ -1,11 +1,11 @@
<?php <?php
class NovelUpdatesBridge extends BridgeAbstract{ class NovelUpdatesBridge extends BridgeAbstract{
public $maintainer = "albirew"; const MAINTAINER = "albirew";
public $name = "Novel Updates"; const NAME = "Novel Updates";
public $uri = "http://www.novelupdates.com/"; const URI = "http://www.novelupdates.com/";
public $description = "Returns releases from Novel Updates"; const DESCRIPTION = "Returns releases from Novel Updates";
public $parameters = array( array( const PARAMETERS = array( array(
'n'=>array( 'n'=>array(
'name'=>'Novel URL', 'name'=>'Novel URL',
'patterns'=>'http:\/\/www.novelupdates.com\/.*', 'patterns'=>'http:\/\/www.novelupdates.com\/.*',
@ -22,7 +22,7 @@ class NovelUpdatesBridge extends BridgeAbstract{
$this->returnClientError('NovelUpdates URL only.'); $this->returnClientError('NovelUpdates URL only.');
if(strpos($thread['path'], 'series/') === FALSE) if(strpos($thread['path'], 'series/') === FALSE)
$this->returnClientError('You must specify the novel URL.'); $this->returnClientError('You must specify the novel URL.');
$url = $this->uri.$thread['path'].''; $url = self::URI.$thread['path'].'';
$fullhtml = $this->getSimpleHTMLDOM($url) or $this->returnServerError("Could not request NovelUpdates, novel not found"); $fullhtml = $this->getSimpleHTMLDOM($url) or $this->returnServerError("Could not request NovelUpdates, novel not found");
$this->seriesTitle = $fullhtml->find('h4.seriestitle', 0)->plaintext; $this->seriesTitle = $fullhtml->find('h4.seriestitle', 0)->plaintext;
// dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259 // dirty fix for nasty simpledom bug: https://github.com/sebsauvage/rss-bridge/issues/259

View file

@ -1,10 +1,10 @@
<?php <?php
class NumeramaBridge extends HttpCachingBridgeAbstract { class NumeramaBridge extends HttpCachingBridgeAbstract {
public $maintainer = 'mitsukarenai'; const MAINTAINER = 'mitsukarenai';
public $name = 'Numerama'; const NAME = 'Numerama';
public $uri = 'http://www.numerama.com/'; const URI = 'http://www.numerama.com/';
public $description = 'Returns the 5 newest posts from Numerama (full text)'; const DESCRIPTION = 'Returns the 5 newest posts from Numerama (full text)';
public function collectData(){ public function collectData(){
@ -14,7 +14,7 @@ class NumeramaBridge extends HttpCachingBridgeAbstract {
return $string; return $string;
} }
$feed = $this->uri.'feed/'; $feed = self::URI.'feed/';
$html = $this->getSimpleHTMLDOM($feed) or $this->returnServerError('Could not request Numerama: '.$feed); $html = $this->getSimpleHTMLDOM($feed) or $this->returnServerError('Could not request Numerama: '.$feed);
$limit = 0; $limit = 0;

View file

@ -1,12 +1,12 @@
<?php <?php
class OpenClassroomsBridge extends BridgeAbstract{ class OpenClassroomsBridge extends BridgeAbstract{
public $maintainer = "sebsauvage"; const MAINTAINER = "sebsauvage";
public $name = "OpenClassrooms Bridge"; const NAME = "OpenClassrooms Bridge";
public $uri = "https://openclassrooms.com/"; const URI = "https://openclassrooms.com/";
public $description = "Returns latest tutorials from OpenClassrooms."; const DESCRIPTION = "Returns latest tutorials from OpenClassrooms.";
public $parameters = array( array( const PARAMETERS = array( array(
'u'=>array( 'u'=>array(
'name'=>'Catégorie', 'name'=>'Catégorie',
'type'=>'list', 'type'=>'list',
@ -26,7 +26,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
)); ));
public function getURI(){ public function getURI(){
return $this->uri.'/courses?categories='.$this->getInput('u').'&' return self::URI.'/courses?categories='.$this->getInput('u').'&'
.'title=&sort=updatedAt+desc'; .'title=&sort=updatedAt+desc';
} }
@ -36,7 +36,7 @@ class OpenClassroomsBridge extends BridgeAbstract{
foreach($html->find('.courseListItem') as $element) { foreach($html->find('.courseListItem') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['title'] = $element->find('h3', 0)->plaintext; $item['title'] = $element->find('h3', 0)->plaintext;
$item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext; $item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext;
$this->items[] = $item; $this->items[] = $item;

View file

@ -1,13 +1,13 @@
<?php <?php
class ParuVenduImmoBridge extends BridgeAbstract class ParuVenduImmoBridge extends BridgeAbstract
{ {
public $maintainer = "polo2ro"; const MAINTAINER = "polo2ro";
public $name = "Paru Vendu Immobilier"; const NAME = "Paru Vendu Immobilier";
public $uri = "http://www.paruvendu.fr"; const URI = "http://www.paruvendu.fr";
public $description = "Returns the ads from the first page of search result."; const DESCRIPTION = "Returns the ads from the first page of search result.";
public $parameters = array( array( const PARAMETERS = array( array(
'minarea'=>array( 'minarea'=>array(
'name'=>'Minimal surface m²', 'name'=>'Minimal surface m²',
'type'=>'number' 'type'=>'number'
@ -49,7 +49,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
list($href) = explode('#', $element->href); list($href) = explode('#', $element->href);
$item = array(); $item = array();
$item['uri'] = $this->uri.$href; $item['uri'] = self::URI.$href;
$item['title'] = $element->title; $item['title'] = $element->title;
$item['content'] = $img.$desc.$price; $item['content'] = $img.$desc.$price;
$this->items[] = $item; $this->items[] = $item;
@ -60,7 +60,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
public function getURI(){ public function getURI(){
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1'; $appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1'; $maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
$link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison; $link = self::URI.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
if ($this->getInput('minarea')) { if ($this->getInput('minarea')) {
$link .= '&sur0='.urlencode($this->getInput('minarea')); $link .= '&sur0='.urlencode($this->getInput('minarea'));

View file

@ -1,12 +1,12 @@
<?php <?php
class PickyWallpapersBridge extends BridgeAbstract { class PickyWallpapersBridge extends BridgeAbstract {
public $maintainer = "nel50n"; const MAINTAINER = "nel50n";
public $name = "PickyWallpapers Bridge"; const NAME = "PickyWallpapers Bridge";
public $uri = "http://www.pickywallpapers.com/"; const URI = "http://www.pickywallpapers.com/";
public $description = "Returns the latests wallpapers from PickyWallpapers"; const DESCRIPTION = "Returns the latests wallpapers from PickyWallpapers";
public $parameters = array( array( const PARAMETERS = array( array(
'c'=>array( 'c'=>array(
'name'=>'category', 'name'=>'category',
'required'=>true 'required'=>true
@ -44,7 +44,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
foreach($html->find('.items li img') as $element) { foreach($html->find('.items li img') as $element) {
$item = array(); $item = array();
$item['uri'] = str_replace('www', 'wallpaper', $this->uri).'/'.$resolution.'/'.basename($element->src); $item['uri'] = str_replace('www', 'wallpaper', self::URI).'/'.$resolution.'/'.basename($element->src);
$item['timestamp'] = time(); $item['timestamp'] = time();
$item['title'] = $element->alt; $item['title'] = $element->alt;
$item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>'; $item['content'] = $item['title'].'<br><a href="'.$item['uri'].'">'.$element.'</a>';
@ -59,7 +59,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
public function getURI(){ public function getURI(){
$subcategory = $this->getInput('s'); $subcategory = $this->getInput('s');
$link = $this->uri.$this->getInput('r').'/'.$this->getInput('c').'/'.$subcategory; $link = self::URI.$this->getInput('r').'/'.$this->getInput('c').'/'.$subcategory;
return $link; return $link;
} }

View file

@ -1,12 +1,12 @@
<?php <?php
class PinterestBridge extends BridgeAbstract{ class PinterestBridge extends BridgeAbstract{
public $maintainer = "pauder"; const MAINTAINER = "pauder";
public $name = "Pinterest Bridge"; const NAME = "Pinterest Bridge";
public $uri = "http://www.pinterest.com/"; const URI = "http://www.pinterest.com/";
public $description = "Returns the newest images on a board"; const DESCRIPTION = "Returns the newest images on a board";
public $parameters = array( const PARAMETERS = array(
'By username and board' => array( 'By username and board' => array(
'u'=>array( 'u'=>array(
'name'=>'username', 'name'=>'username',
@ -77,10 +77,10 @@ class PinterestBridge extends BridgeAbstract{
public function getURI(){ public function getURI(){
switch($this->queriedContext){ switch($this->queriedContext){
case 'By username and board': case 'By username and board':
$uri = $this->uri.urlencode($this->getInput('u')).'/'.urlencode($this->getInput('b')); $uri = self::URI.urlencode($this->getInput('u')).'/'.urlencode($this->getInput('b'));
break; break;
case 'From search': case 'From search':
$uri = $this->uri.'search/?q='.urlencode($this->getInput('q')); $uri = self::URI.'search/?q='.urlencode($this->getInput('q'));
break; break;
} }
@ -96,6 +96,6 @@ class PinterestBridge extends BridgeAbstract{
$specific = $this->getInput('q'); $specific = $this->getInput('q');
break; break;
} }
return $specific .' - '.$this->name; return $specific .' - '.self::NAME;
} }
} }

View file

@ -1,10 +1,10 @@
<?php <?php
class PlanetLibreBridge extends BridgeAbstract{ class PlanetLibreBridge extends BridgeAbstract{
public $maintainer = "pit-fgfjiudghdf"; const MAINTAINER = "pit-fgfjiudghdf";
public $name = "PlanetLibre"; const NAME = "PlanetLibre";
public $uri = "http://www.planet-libre.org"; const URI = "http://www.planet-libre.org";
public $description = "Returns the 5 newest posts from PlanetLibre (full text)"; const DESCRIPTION = "Returns the 5 newest posts from PlanetLibre (full text)";
private function PlanetLibreExtractContent($url){ private function PlanetLibreExtractContent($url){
$html2 = $this->getSimpleHTMLDOM($url); $html2 = $this->getSimpleHTMLDOM($url);
@ -13,7 +13,7 @@ class PlanetLibreBridge extends BridgeAbstract{
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request PlanetLibre.'); or $this->returnServerError('Could not request PlanetLibre.');
$limit = 0; $limit = 0;
foreach($html->find('div.post') as $element) { foreach($html->find('div.post') as $element) {

View file

@ -1,19 +1,19 @@
<?php <?php
class ProjectMGameBridge extends BridgeAbstract{ class ProjectMGameBridge extends BridgeAbstract{
public $maintainer = "corenting"; const MAINTAINER = "corenting";
public $name = "Project M Game Bridge"; const NAME = "Project M Game Bridge";
public $uri = "http://projectmgame.com/en/"; const URI = "http://projectmgame.com/en/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Error while downloading the Project M homepage'); or $this->returnServerError('Error while downloading the Project M homepage');
foreach($html->find('article') as $article) { foreach($html->find('article') as $article) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$article->find('section div.info_block a',0)->href; $item['uri'] = self::URI.$article->find('section div.info_block a',0)->href;
$item['title'] = $article->find('h1 p',0)->innertext; $item['title'] = $article->find('h1 p',0)->innertext;
$p_list = $article->find('section p'); $p_list = $article->find('section p');

View file

@ -1,11 +1,11 @@
<?php <?php
class RTBFBridge extends BridgeAbstract { class RTBFBridge extends BridgeAbstract {
public $name = "RTBF Bridge"; const NAME = "RTBF Bridge";
public $uri = "http://www.rtbf.be/auvio/emissions/"; const URI = "http://www.rtbf.be/auvio/emissions/";
public $description = "Returns the newest RTBF videos by series ID"; const DESCRIPTION = "Returns the newest RTBF videos by series ID";
public $maintainer = "Frenzie"; const MAINTAINER = "Frenzie";
public $parameters = array( array( const PARAMETERS = array( array(
'c'=>array( 'c'=>array(
'name'=>'series id', 'name'=>'series id',
'exampleValue'=>9500, 'exampleValue'=>9500,
@ -27,7 +27,7 @@ class RTBFBridge extends BridgeAbstract {
} }
$item = array(); $item = array();
$item['id'] = $element->getAttribute('data-id'); $item['id'] = $element->getAttribute('data-id');
$item['uri'] = $this->uri.'detail?id='.$item['id']; $item['uri'] = self::URI.'detail?id='.$item['id'];
$thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset')); $thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
$thumbnailUriLastSrc = end($thumbnailUriSrcSet); $thumbnailUriLastSrc = end($thumbnailUriSrcSet);
$thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0]; $thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
@ -40,7 +40,7 @@ class RTBFBridge extends BridgeAbstract {
} }
public function getURI(){ public function getURI(){
return $this->uri.'detail?id='.$this->getInput('c'); return self::URI.'detail?id='.$this->getInput('c');
} }
public function getName(){ public function getName(){

View file

@ -1,10 +1,10 @@
<?php <?php
class Releases3DSBridge extends BridgeAbstract { class Releases3DSBridge extends BridgeAbstract {
public $maintainer = "ORelio"; const MAINTAINER = "ORelio";
public $name = "3DS Scene Releases"; const NAME = "3DS Scene Releases";
public $uri = "http://www.3dsdb.com/"; const URI = "http://www.3dsdb.com/";
public $description = "Returns the newest scene releases."; const DESCRIPTION = "Returns the newest scene releases.";
public function collectData(){ public function collectData(){
@ -32,7 +32,7 @@ class Releases3DSBridge extends BridgeAbstract {
} }
} }
$dataUrl = $this->uri.'xml.php'; $dataUrl = self::URI.'xml.php';
$xml = $this->getContents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl); $xml = $this->getContents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl);
$limit = 0; $limit = 0;

View file

@ -1,10 +1,10 @@
<?php <?php
class ReporterreBridge extends BridgeAbstract{ class ReporterreBridge extends BridgeAbstract{
public $maintainer = "nyutag"; const MAINTAINER = "nyutag";
public $name = "Reporterre Bridge"; const NAME = "Reporterre Bridge";
public $uri = "http://www.reporterre.net/"; const URI = "http://www.reporterre.net/";
public $description = "Returns the newest articles."; const DESCRIPTION = "Returns the newest articles.";
private function ExtractContentReporterre($url) { private function ExtractContentReporterre($url) {
$html2 = $this->getSimpleHTMLDOM($url); $html2 = $this->getSimpleHTMLDOM($url);
@ -17,14 +17,14 @@ class ReporterreBridge extends BridgeAbstract{
unset ($html2); unset ($html2);
// Replace all relative urls with absolute ones // Replace all relative urls with absolute ones
$text = preg_replace('/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims', "$1$2" . $this->uri . "$3", $text); $text = preg_replace('/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims', "$1$2" . self::URI . "$3", $text);
$text = strip_tags($text, '<p><br><a><img>'); $text = strip_tags($text, '<p><br><a><img>');
return $text; return $text;
} }
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.'); $html = $this->getSimpleHTMLDOM(self::URI.'spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.');
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {

View file

@ -1,10 +1,10 @@
<?php <?php
class Rue89Bridge extends BridgeAbstract{ class Rue89Bridge extends BridgeAbstract{
public $maintainer = "pit-fgfjiudghdf"; const MAINTAINER = "pit-fgfjiudghdf";
public $name = "Rue89"; const NAME = "Rue89";
public $uri = "http://rue89.nouvelobs.com/"; const URI = "http://rue89.nouvelobs.com/";
public $description = "Returns the 5 newest posts from Rue89 (full text)"; const DESCRIPTION = "Returns the 5 newest posts from Rue89 (full text)";
private function rue89getDatas($url){ private function rue89getDatas($url){

View file

@ -1,12 +1,12 @@
<?php <?php
class Rule34Bridge extends BridgeAbstract{ class Rule34Bridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Rule34"; const NAME = "Rule34";
public $uri = "http://rule34.xxx/"; const URI = "http://rule34.xxx/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -16,7 +16,7 @@ class Rule34Bridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&' self::URI.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'') .'&pid='.($this->getInput('p')?($this->getInput('p') -1)*50:'')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Rule34.'); ) or $this->returnServerError('Could not request Rule34.');
@ -24,7 +24,7 @@ class Rule34Bridge extends BridgeAbstract{
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;

View file

@ -1,12 +1,12 @@
<?php <?php
class Rule34pahealBridge extends BridgeAbstract{ class Rule34pahealBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Rule34paheal"; const NAME = "Rule34paheal";
public $uri = "http://rule34.paheal.net/"; const URI = "http://rule34.paheal.net/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -16,13 +16,13 @@ class Rule34pahealBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri.'post/list/'.$tags.'/'.$page) $html = $this->getSimpleHTMLDOM(self::URI.'post/list/'.$tags.'/'.$page)
or $this->returnServerError('Could not request Rule34paheal.'); or $this->returnServerError('Could not request Rule34paheal.');
foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) { foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;

View file

@ -1,12 +1,12 @@
<?php <?php
class SafebooruBridge extends BridgeAbstract{ class SafebooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Safebooru"; const NAME = "Safebooru";
public $uri = "http://safebooru.org/"; const URI = "http://safebooru.org/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'type'=>'number' 'type'=>'number'
@ -16,14 +16,14 @@ class SafebooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'index.php?page=post&s=list&' self::URI.'index.php?page=post&s=list&'
.'&pid='.($this->getInput('p')?($this->getInput('p') -1)*40:'') .'&pid='.($this->getInput('p')?($this->getInput('p') -1)*40:'')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Safebooru.'); ) or $this->returnServerError('Could not request Safebooru.');
foreach($html->find('div[class=content] span') as $element) { foreach($html->find('div[class=content] span') as $element) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$element->find('a', 0)->href; $item['uri'] = self::URI.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item['timestamp'] = time(); $item['timestamp'] = time();
$thumbnailUri = $element->find('img', 0)->src; $thumbnailUri = $element->find('img', 0)->src;

View file

@ -1,12 +1,12 @@
<?php <?php
class SakugabooruBridge extends BridgeAbstract{ class SakugabooruBridge extends BridgeAbstract{
public $maintainer = "mitsukarenai"; const MAINTAINER = "mitsukarenai";
public $name = "Sakugabooru"; const NAME = "Sakugabooru";
public $uri = "http://sakuga.yshi.org/"; const URI = "http://sakuga.yshi.org/";
public $description = "Returns images from given page"; const DESCRIPTION = "Returns images from given page";
public $parameters = array( array( const PARAMETERS = array( array(
'p'=>array( 'p'=>array(
'name'=>'page', 'name'=>'page',
'defaultValue'=>1, 'defaultValue'=>1,
@ -17,7 +17,7 @@ class SakugabooruBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$html = $this->getSimpleHTMLDOM( $html = $this->getSimpleHTMLDOM(
$this->uri.'post?' self::URI.'post?'
.'&page='.$this->getInput('p') .'&page='.$this->getInput('p')
.'&tags='.urlencode($this->getInput('t')) .'&tags='.urlencode($this->getInput('t'))
) or $this->returnServerError('Could not request Sakugabooru.'); ) or $this->returnServerError('Could not request Sakugabooru.');
@ -30,7 +30,7 @@ class SakugabooruBridge extends BridgeAbstract{
foreach($data as $datai) { foreach($data as $datai) {
$json = json_decode($datai, TRUE); $json = json_decode($datai, TRUE);
$item = array(); $item = array();
$item['uri'] = $this->uri.'/post/show/'.$json['id']; $item['uri'] = self::URI.'/post/show/'.$json['id'];
$item['postid'] = $json['id']; $item['postid'] = $json['id'];
$item['timestamp'] = $json['created_at']; $item['timestamp'] = $json['created_at'];
$item['imageUri'] = $json['file_url']; $item['imageUri'] = $json['file_url'];

View file

@ -1,19 +1,19 @@
<?php <?php
class ScmbBridge extends BridgeAbstract{ class ScmbBridge extends BridgeAbstract{
public $maintainer = "Astalaseven"; const MAINTAINER = "Astalaseven";
public $name = "Se Coucher Moins Bête Bridge"; const NAME = "Se Coucher Moins Bête Bridge";
public $uri = "http://secouchermoinsbete.fr/"; const URI = "http://secouchermoinsbete.fr/";
public $description = "Returns the newest anecdotes."; const DESCRIPTION = "Returns the newest anecdotes.";
public function collectData(){ public function collectData(){
$html = ''; $html = '';
$html = $this->getSimpleHTMLDOM($this->uri) $html = $this->getSimpleHTMLDOM(self::URI)
or $this->returnServerError('Could not request Se Coucher Moins Bete.'); or $this->returnServerError('Could not request Se Coucher Moins Bete.');
foreach($html->find('article') as $article) { foreach($html->find('article') as $article) {
$item = array(); $item = array();
$item['uri'] = $this->uri.$article->find('p.summary a',0)->href; $item['uri'] = self::URI.$article->find('p.summary a',0)->href;
$item['title'] = $article->find('header h1 a',0)->innertext; $item['title'] = $article->find('header h1 a',0)->innertext;
$article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content $article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content

View file

@ -1,12 +1,12 @@
<?php <?php
class ScoopItBridge extends BridgeAbstract{ class ScoopItBridge extends BridgeAbstract{
public $maintainer = "Pitchoule"; const MAINTAINER = "Pitchoule";
public $name = "ScoopIt"; const NAME = "ScoopIt";
public $uri = "http://www.scoop.it/"; const URI = "http://www.scoop.it/";
public $description = "Returns most recent results from ScoopIt."; const DESCRIPTION = "Returns most recent results from ScoopIt.";
public $parameters = array( array( const PARAMETERS = array( array(
'u'=>array( 'u'=>array(
'name'=>'keyword', 'name'=>'keyword',
'required'=>true 'required'=>true
@ -15,7 +15,7 @@ class ScoopItBridge extends BridgeAbstract{
public function collectData(){ public function collectData(){
$this->request = $this->getInput('u'); $this->request = $this->getInput('u');
$link = $this->uri.'search?q=' .urlencode($this->getInput('u')); $link = self::URI.'search?q=' .urlencode($this->getInput('u'));
$html = $this->getSimpleHTMLDOM($link) $html = $this->getSimpleHTMLDOM($link)
or $this->returnServerError('Could not request ScoopIt. for : ' . $link); or $this->returnServerError('Could not request ScoopIt. for : ' . $link);

View file

@ -1,12 +1,12 @@
<?php <?php
class SensCritiqueBridge extends BridgeAbstract { class SensCritiqueBridge extends BridgeAbstract {
public $maintainer = "kranack"; const MAINTAINER = "kranack";
public $name = "Sens Critique"; const NAME = "Sens Critique";
public $uri = "http://www.senscritique.com/"; const URI = "http://www.senscritique.com/";
public $description = "Sens Critique news"; const DESCRIPTION = "Sens Critique news";
public $parameters = array( array( const PARAMETERS = array( array(
'm'=>array( 'm'=>array(
'name'=>'Movies', 'name'=>'Movies',
'type'=>'checkbox' 'type'=>'checkbox'
@ -35,9 +35,9 @@ class SensCritiqueBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
$categories=array(); $categories=array();
foreach($this->parameters[$this->queriedContext] as $category=>$properties){ foreach(self::PARAMETERS[$this->queriedContext] as $category=>$properties){
if($this->getInput($category)){ if($this->getInput($category)){
$uri=$this->uri; $uri=self::URI;
switch($category){ switch($category){
case 'm': $uri.='films/cette-semaine'; break; case 'm': $uri.='films/cette-semaine'; break;
case 's': $uri.='series/actualite'; break; case 's': $uri.='series/actualite'; break;

View file

@ -1,10 +1,10 @@
<?php <?php
class Sexactu extends BridgeAbstract{ class Sexactu extends BridgeAbstract{
public $maintainer = "Riduidel"; const MAINTAINER = "Riduidel";
public $name = "Sexactu"; const NAME = "Sexactu";
public $uri = "http://www.gqmagazine.fr"; const URI = "http://www.gqmagazine.fr";
public $description = "Sexactu via rss-bridge"; const DESCRIPTION = "Sexactu via rss-bridge";
public function collectData(){ public function collectData(){
$find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre'); $find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre');
@ -27,7 +27,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
$titleData = $titleDetails->find('h2', 0)->find('a',0); $titleData = $titleDetails->find('h2', 0)->find('a',0);
$titleTimestamp =$titleDetails->find('h4',0); $titleTimestamp =$titleDetails->find('h4',0);
$item['title'] = $this->correctCase(trim($titleData->innertext)); $item['title'] = $this->correctCase(trim($titleData->innertext));
$item['uri'] = $this->uri.$titleData->href; $item['uri'] = self::URI.$titleData->href;
// Fugly date parsing due to the fact my DNS-323 doesn't support php intl extension // Fugly date parsing due to the fact my DNS-323 doesn't support php intl extension
$dateText = $titleTimestamp->innertext; $dateText = $titleTimestamp->innertext;
@ -40,7 +40,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
$elementText = $element->find('.text-container', 0); $elementText = $element->find('.text-container', 0);
// don't forget to replace images server url with gq one // don't forget to replace images server url with gq one
foreach($elementText->find('img') as $image) { foreach($elementText->find('img') as $image) {
$image->src = $this->uri.$image->src; $image->src = self::URI.$image->src;
} }
$item['content'] = $elementText->innertext; $item['content'] = $elementText->innertext;
$this->items[] = $item; $this->items[] = $item;
@ -53,7 +53,7 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July',
} }
public function getURI(){ public function getURI(){
return $this->uri.'/sexactu'; return self::URI.'/sexactu';
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -1,9 +1,9 @@
<?php <?php
class ShanaprojectBridge extends BridgeAbstract { class ShanaprojectBridge extends BridgeAbstract {
public $maintainer = 'logmanoriginal'; const MAINTAINER = 'logmanoriginal';
public $name = 'Shanaproject Bridge'; const NAME = 'Shanaproject Bridge';
public $uri = 'http://www.shanaproject.com'; const URI = 'http://www.shanaproject.com';
public $description = 'Returns a list of anime from the current Season Anime List'; const DESCRIPTION = 'Returns a list of anime from the current Season Anime List';
// Returns an html object for the Season Anime List (latest season) // Returns an html object for the Season Anime List (latest season)
private function LoadSeasonAnimeList(){ private function LoadSeasonAnimeList(){

Some files were not shown because too many files have changed in this diff Show more