diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php index 1b31c988..9799a70e 100644 --- a/bridges/AllocineFRBridge.php +++ b/bridges/AllocineFRBridge.php @@ -8,32 +8,20 @@ class AllocineFRBridge extends BridgeAbstract{ $this->uri = "http://www.allocine.fr"; $this->description = "Bridge for allocine.fr"; - $this->parameters[] = - '[ - { - "name" : "category", - "identifier" : "category", - "type" : "list", - "required" : true, - "exampleValue" : "Faux Raccord", - "title" : "Select your category", - "values" : - [ - { - "name" : "Faux Raccord", - "value" : "faux-raccord" - }, - { - "name" : "Top 5", - "value" : "top-5" - }, - { - "name" : "Tueurs En Serie", - "value" : "tuers-en-serie" - } - ] - } - ]'; + $this->parameters[] = array( + 'category'=>array( + 'name'=>'category', + 'type'=>'list', + 'required'=>true, + 'exampleValue'=>'Faux Raccord', + 'title'=>'Select your category', + 'values'=>array( + 'Faux Raccord'=>'faux-raccord', + 'Top 5'=>'top-5', + 'Tueurs En Serie'=>'tuers-en-serie' + ) + ) + ); } public function collectData(array $params){ diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 7f2d4996..5c25a7dc 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -10,36 +10,18 @@ class AnimeUltimeBridge extends BridgeAbstract { $this->uri = 'http://www.anime-ultime.net/'; $this->description = 'Returns the 10 newest releases posted on Anime-Ultime'; - $this->parameters[] = - '[ - { - "name" : "Type", - "type" : "list", - "identifier" : "type", - "values" : - [ - { - "name" : "Everything", - "value" : "" - - }, - { - "name" : "Anime", - "value" : "A" - - }, - { - "name" : "Drama", - "value" : "D" - }, - { - "name" : "Tokusatsu", - "value" : "T" - - } - ] - } - ]'; + $this->parameters[] = array( + 'type'=>array( + 'name'=>'Type', + 'type'=>'list', + 'values'=>array( + 'Everything'=>'', + 'Anime'=>'A', + 'Drama'=>'D', + 'Tokusatsu'=>'T' + ) + ) + ); } public function collectData(array $param) { diff --git a/bridges/Arte7Bridge.php b/bridges/Arte7Bridge.php index a3165610..6714dfd7 100644 --- a/bridges/Arte7Bridge.php +++ b/bridges/Arte7Bridge.php @@ -7,105 +7,42 @@ class Arte7Bridge extends BridgeAbstract{ $this->name = "Arte +7"; $this->uri = "http://www.arte.tv/"; $this->description = "Returns newest videos from ARTE +7"; - $this->parameters["Catégorie (Français)"] = - '[ - { - "type" : "list", - "identifier" : "catfr", - "name" : "Catégorie", - "values" : [ - { - "name" : "Toutes les vidéos (français)", - "value" : "toutes-les-videos" - }, - { - "name" : "Actu & société", - "value" : "actu-société" - }, - { - "name" : "Séries & fiction", - "value" : "séries-fiction" - }, - { - "name" : "Cinéma", - "value" : "cinéma" - }, - { - "name" : "Arts & spectacles classiques", - "value" : "arts-spectacles-classiques" - }, - { - "name" : "Culture pop", - "value" : "culture-pop" - }, - { - "name" : "Découverte", - "value" : "découverte" - }, - { - "name" : "Histoire", - "value" : "histoire" - }, - { - "name" : "Junior", - "value" : "junior" - } + $this->parameters["Catégorie (Français)"] = array( + 'catfr'=>array( + 'type'=>'list', + 'name'=>'Catégorie', + 'values'=>array( + 'Toutes les vidéos (français)'=>'toutes-les-videos', + 'Actu & société'=>'actu-société', + 'Séries & fiction'=>'séries-fiction', + 'Cinéma'=>'cinéma', + 'Arts & spectacles classiques'=>'arts-spectacles-classiques', + 'Culture pop'=>'culture-pop', + 'Découverte'=>'découverte', + 'Histoire'=>'histoire', + 'Junior'=>'junior' - ] + ) + ) + ); - - } - - ]'; - $this->parameters["Catégorie (Allemand)"] = - '[ - { - "type" : "list", - "identifier" : "catde", - "name" : "Catégorie", - "values" : [ - { - "name" : "Alle Videos (deutsch)", - "value" : "alle-videos" - }, - { - "name" : "Aktuelles & Gesellschaft", - "value" : "aktuelles-gesellschaft" - }, - { - "name" : "Fernsehfilme & Serien", - "value" : "fernsehfilme-serien" - }, - { - "name" : "Kino", - "value" : "kino" - }, - { - "name" : "Kunst & Kultur", - "value" : "kunst-kultur" - }, - { - "name" : "Popkultur & Alternativ", - "value" : "popkultur-alternativ" - }, - { - "name" : "Entdeckung", - "value" : "entdeckung" - }, - { - "name" : "Geschichte", - "value" : "geschichte" - }, - { - "name" : "Junior", - "value" : "junior" - } - ] - - - } - - ]'; + $this->parameters["Catégorie (Allemand)"] = array( + 'catde'=>array( + 'type'=>'list', + 'name'=>'Catégorie', + 'values'=>array( + 'Alle Videos (deutsch)'=>'alle-videos', + 'Aktuelles & Gesellschaft'=>'aktuelles-gesellschaft', + 'Fernsehfilme & Serien'=>'fernsehfilme-serien', + 'Kino'=>'kino', + 'Kunst & Kultur'=>'kunst-kultur', + 'Popkultur & Alternativ'=>'popkultur-alternativ', + 'Entdeckung'=>'entdeckung', + 'Geschichte'=>'geschichte', + 'Junior'=>'junior' + ) + ) + ); } diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index 6086d1ff..d69e366b 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -8,13 +8,11 @@ class AskfmBridge extends BridgeAbstract{ $this->uri = "http://ask.fm/"; $this->description = "Returns answers from an Ask.fm user"; - $this->parameters["Ask.fm username"] = - '[ - { - "name" : "Username", - "identifier" : "u" - } - ]'; + $this->parameters["Ask.fm username"] = array( + 'u'=>array( + 'name'=>'Username' + ) + ); } public function collectData(array $param){ diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index 61c3fc02..9d9bf60d 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -10,15 +10,12 @@ class BandcampBridge extends BridgeAbstract{ $this->uri = "http://bandcamp.com/"; $this->description = "New bandcamp release by tag"; - $this->parameters[] = - '[ - { - "name" : "tag", - "type" : "text", - "identifier" : "tag" - - } - ]'; + $this->parameters[] = array( + 'tag'=>array( + 'name'=>'tag', + 'type'=>'text' + ) + ); } public function collectData(array $param){ diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php index 1a572994..39ed3f78 100644 --- a/bridges/BooruprojectBridge.php +++ b/bridges/BooruprojectBridge.php @@ -8,24 +8,14 @@ class BooruprojectBridge extends BridgeAbstract{ $this->uri = "http://booru.org/"; $this->description = "Returns images from given page and booruproject instance (****.booru.org)"; - $this->parameters[] = - '[ - { - "name" : "instance (required)", - "required" : true, - "identifier" : "i" - }, - { - "name" : "page", - "identifier" : "p" - }, - { - "name" : "tags", - "identifier" : "t" - } - - - ]'; + $this->parameters[] = array( + 'i'=>array( + 'name'=>'instance (required)', + 'required'=>true + ), + 'p'=>array('name'=>'page'), + 't'=>array('name'=>'tags') + ); } diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index f905bdd5..dee0a2a9 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -10,13 +10,9 @@ class CNETBridge extends BridgeAbstract { $this->uri = 'http://www.cnet.com/'; $this->description = 'Returns the newest articles.
You may specify a topic found in some section URLs, else all topics are selected.'; - $this->parameters[] = - '[ - { - "name" : "Topic name", - "identifier" : "topic" - } - ]'; + $this->parameters[] = array( + 'topic'=>array('name'=>'Topic name') + ); } public function collectData(array $param) { diff --git a/bridges/CastorusBridge.php b/bridges/CastorusBridge.php index 7ab2113b..bfb8b0af 100644 --- a/bridges/CastorusBridge.php +++ b/bridges/CastorusBridge.php @@ -6,29 +6,25 @@ class CastorusBridge extends BridgeAbstract { $this->uri = 'http://www.castorus.com'; $this->description = "Returns the latest changes"; - $this->parameters["Get latest changes"] = '[]'; - $this->parameters["Get latest changes via ZIP code"] = - '[ - { - "name": "ZIP code", - "identifier" : "zip", - "type" : "text", - "required" : true, - "exampleValue" : "74910, 74", - "title" : "Insert ZIP code (complete or partial)" - } - ]'; - $this->parameters["Get latest changes via city name"] = - '[ - { - "name": "City name", - "identifier" : "city", - "type" : "text", - "required" : true, - "exampleValue" : "Seyssel, Seys", - "title" : "Insert city name (complete or partial)" - } - ]'; + $this->parameters["Get latest changes"] = array(); + $this->parameters["Get latest changes via ZIP code"] = array( + 'zip'=>array( + 'name'=>'ZIP code', + 'type'=>'text', + 'required'=>true, + 'exampleValue'=>'74910, 74', + 'title'=>'Insert ZIP code (complete or partial)' + ) + ); + $this->parameters["Get latest changes via city name"] = array( + 'city'=>array( + 'name'=>'City name', + 'type'=>'text', + 'required'=>true, + 'exampleValue'=>'Seyssel, Seys', + 'title'=>'Insert city name (complete or partial)' + ) + ); } // Extracts the tile from an actitiy diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php index 2c578fbe..77720375 100644 --- a/bridges/CpasbienBridge.php +++ b/bridges/CpasbienBridge.php @@ -25,15 +25,13 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{ $this->uri = "http://www.cpasbien.io"; $this->description = "Returns latest torrents from a request query"; - $this->parameters[] = - '[ - { - "name" : "Search", - "identifier" : "q", - "required" : true, - "title" : "Type your search" - } - ]'; + $this->parameters[] = array( + 'q'=>array( + 'name'=>'Search', + 'required'=>true, + 'title'=>'Type your search' + ) + ); } diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index 888b1042..f9981328 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -8,15 +8,13 @@ class CryptomeBridge extends BridgeAbstract{ $this->uri = "http://cryptome.org/"; $this->description = "Returns the N most recent documents."; - $this->parameters[] = - '[ - { - "name" : "number of elements", - "identifier" : "n", - "type" : "number", - "exampleValue" : "10" - } - ]'; + $this->parameters[] = array( + 'n'=>array( + 'name'=>'number of elements', + 'type'=>'number', + 'exampleValue'=>10 + ) + ); } diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index de837ad1..351f56e2 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -10,35 +10,23 @@ class DailymotionBridge extends BridgeAbstract{ $this->uri = "https://www.dailymotion.com/"; $this->description = "Returns the 5 newest videos by username/playlist or search"; - $this->parameters["By username"] = - '[ - { - "name" : "username", - "identifier" : "u" - } - ]'; + $this->parameters["By username"] = array( + 'u'=>array('name'=>'username') + ); - $this->parameters["By playlist id"] = - '[ - { - "name" : "playlist id", - "identifier" : "p", - "type" : "text" - } - ]'; + $this->parameters["By playlist id"] = array( + 'p'=>array( + 'name'=>'playlist id', + 'type'=>'text') + ); - $this->parameters["From search results"] = - '[ - { - "name" : "Search keyword", - "identifier" : "s" - }, - { - "name" : "Page", - "identifier" : "pa", - "type" : "number" - } - ]'; + $this->parameters["From search results"] = array( + 's'=>array('name'=>'Search keyword'), + 'pa'=>array( + 'name'=>'Page', + 'type'=>'number' + ) + ); } function getMetadata($id) { diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php index 3de45734..997d9639 100644 --- a/bridges/DanbooruBridge.php +++ b/bridges/DanbooruBridge.php @@ -8,18 +8,10 @@ class DanbooruBridge extends BridgeAbstract{ $this->uri = "http://donmai.us/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; - + $this->parameters[] = array( + 'p'=>array('name'=>'page'), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 8e2db946..075879ef 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -8,76 +8,29 @@ class DauphineLibereBridge extends BridgeAbstract { $this->uri = "http://www.ledauphine.com/"; $this->description = "Returns the newest articles."; - $this->parameters[] = - '[ - { - "name" : "Catégorie de l\'article", - "identifier" : "u", - "type" : "list", - "values" : [ - { - "name" : "À la une", - "value" : "" - }, - { - "name" : "France Monde", - "value" : "france-monde" - }, - { - "name" : "Faits Divers", - "value" : "faits-divers" - }, - { - "name" : "Économie et Finance", - "value" : "economie-et-finance" - }, - { - "name" : "Politique", - "value" : "politique" - }, - { - "name" : "Sport", - "value" : "sport" - }, - { - "name" : "Ain", - "value" : "ain" - }, - { - "name" : "Alpes-de-Haute-Provence", - "value" : "haute-provence" - }, - { - "name" : "Hautes-Alpes", - "value" : "hautes-alpes" - }, - { - "name" : "Ardèche", - "value" : "ardeche" - }, - { - "name" : "Drôme", - "value" : "drome" - }, - { - "name" : "Isère Sud", - "value" : "isere-sud" - }, - { - "name" : "Savoie", - "value" : "savoie" - }, - { - "name" : "Haute-Savoie", - "value" : "haute-savoie" - }, - { - "name" : "Vaucluse", - "value" : "vaucluse" - } - ] - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'Catégorie de l\'article', + 'type'=>'list', + 'values'=>array( + 'À la une'=>'', + 'France Monde'=>'france-monde', + 'Faits Divers'=>'faits-divers', + 'Économie et Finance'=>'economie-et-finance', + 'Politique'=>'politique', + 'Sport'=>'sport', + 'Ain'=>'ain', + 'Alpes-de-Haute-Provence'=>'haute-provence', + 'Hautes-Alpes'=>'hautes-alpes', + 'Ardèche'=>'ardeche', + 'Drôme'=>'drome', + 'Isère Sud'=>'isere-sud', + 'Savoie'=>'savoie', + 'Haute-Savoie'=>'haute-savoie', + 'Vaucluse'=>'vaucluse' + ) + ) + ); } private function ExtractContent($url, $context) { diff --git a/bridges/DemoBridge.php b/bridges/DemoBridge.php index 55d1d621..0ea65d03 100644 --- a/bridges/DemoBridge.php +++ b/bridges/DemoBridge.php @@ -8,46 +8,31 @@ class DemoBridge extends BridgeAbstract{ $this->uri = "http://github.com/sebsauvage/rss-bridge"; $this->description = "Bridge used for demos"; - $this->parameters['testCheckbox'] = - '[ - { - "type" : "checkbox", - "identifier" : "testCheckbox", - "name" : "test des checkbox" - } + $this->parameters['testCheckbox'] = array( + 'testCheckbox'=>array( + 'type'=>'checkbox', + 'name'=>'test des checkbox' + ) + ); - ]'; - - $this->parameters['testList'] = - '[ - { - "type" : "list", - "identifier" : "testList", - "name" : "test des listes", - "values" : [ - { - "name" : "Test", - "value" : "test" - }, - { - "name" : "Test 2", - "value" : "test2" - } - ] - } - ]'; - $this->parameters['testNumber'] = - '[ - { - "type" : "number", - "identifier" : "testNumber", - "name" : "test des numéros", - "exampleValue" : "1515632" - - } - - ]'; + $this->parameters['testList'] = array( + 'testList'=>array( + 'type'=>'list', + 'name'=>'test des listes', + 'values'=>array( + 'Test'=>'test', + 'Test 2'=>'test2' + ) + ) + ); + $this->parameters['testNumber'] = array( + 'testNumber'=>array( + 'type'=>'number', + 'name'=>'test des numéros', + 'exampleValue'=>'1515632' + ) + ); } public function collectData(array $param){ diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php index 54a4d449..ca3ba745 100644 --- a/bridges/DollbooruBridge.php +++ b/bridges/DollbooruBridge.php @@ -9,18 +9,13 @@ class DollbooruBridge extends BridgeAbstract{ $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "type" : "number", - "identifier" : "p" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/DuckDuckGoBridge.php b/bridges/DuckDuckGoBridge.php index ae6459d2..7f5d2d43 100644 --- a/bridges/DuckDuckGoBridge.php +++ b/bridges/DuckDuckGoBridge.php @@ -8,14 +8,11 @@ class DuckDuckGoBridge extends BridgeAbstract{ $this->uri = "https://duckduckgo.com/"; $this->description = "Returns most recent results from DuckDuckGo."; - $this->parameters[] = - '[ - { - "name" : "keyword", - "identifier" : "u", - "required":true - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'keyword', + 'required'=>true) + ); } public function collectData(array $param){ diff --git a/bridges/EZTVBridge.php b/bridges/EZTVBridge.php index b0e4ac16..813e70f4 100644 --- a/bridges/EZTVBridge.php +++ b/bridges/EZTVBridge.php @@ -8,16 +8,13 @@ class EZTVBridge extends BridgeAbstract{ $this->uri = "https://eztv.ch/"; $this->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."; - $this->parameters[] = - '[ - { - "name" : "Show ids", - "identifier" : "i", - "exampleValue" : "showID1,showID2,...", - "required": true - } - ]'; - + $this->parameters[] = array( + 'i'=>array( + 'name'=>'Show ids', + 'exampleValue'=>'showID1,showID2,…', + 'required'=>true + ) + ); } public function collectData(array $param){ diff --git a/bridges/ElsevierBridge.php b/bridges/ElsevierBridge.php index cc3e6188..aa4b486f 100644 --- a/bridges/ElsevierBridge.php +++ b/bridges/ElsevierBridge.php @@ -7,16 +7,14 @@ class ElsevierBridge extends BridgeAbstract{ $this->uri = 'http://www.journals.elsevier.com'; $this->description = 'Returns the recent articles published in Elsevier journals'; - $this->parameters[] = - '[ - { - "name" : "Journal name", - "identifier" : "j", - "required" : true, - "exampleValue" : "academic-pediatrics", - "title" : "Insert html-part of your journal" - } - ]'; + $this->parameters[] = array( + 'j'=>array( + 'name'=>'Journal name', + 'required'=>true, + 'exampleValue'=>'academic-pediactrics', + 'title'=>'Insert html-part of your journal' + ) + ); } // Extracts the list of names from an article as string diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index 4feb0bf4..da40eec9 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -8,14 +8,12 @@ class FacebookBridge extends BridgeAbstract{ $this->uri = "http://www.facebook.com/"; $this->description = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117"; - $this->parameters[] = - '[ - { - "name" : "Username", - "identifier" : "u", - "required" : true - } - ]'; + $this->parameters[] =array( + 'u'=>array( + 'name'=>'Username', + 'required'=>true + ) + ); } public function collectData(array $param) { diff --git a/bridges/FlickrTagBridge.php b/bridges/FlickrTagBridge.php index 59a9cd98..7ec7c268 100644 --- a/bridges/FlickrTagBridge.php +++ b/bridges/FlickrTagBridge.php @@ -8,21 +8,13 @@ class FlickrTagBridge extends BridgeAbstract{ $this->uri = "http://www.flickr.com/"; $this->description = "Returns the tagged or user images from Flickr"; - $this->parameters["By keyword"] = - '[ - { - "name" : "Keyword", - "identifier" : "q" - } - ]'; + $this->parameters["By keyword"] = array( + 'q'=>array('name'=>'keyword') + ); - $this->parameters["By username"] = - '[ - { - "name" : "Username", - "identifier" : "u" - } - ]'; + $this->parameters["By username"] = array( + 'u'=>array('name'=>'Username') + ); } public function collectData(array $param){ diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index 3ca63597..abc6b6d1 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -8,13 +8,9 @@ class FourchanBridge extends BridgeAbstract{ $this->uri = "https://www.4chan.org/"; $this->description = "Returns posts from the specified thread"; - $this->parameters[] = - '[ - { - "name" : "Thread URL", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 't'=>array('name'=>'Thread URL') + ); } diff --git a/bridges/Freenews.php b/bridges/Freenews.php index 0ebe3598..c4ec7fbc 100644 --- a/bridges/Freenews.php +++ b/bridges/Freenews.php @@ -9,19 +9,15 @@ class Freenews extends RssExpander { $this->uri = "http://freenews.fr"; $this->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."; - $this->parameters[] = - '[ - { - "name" : "Id de la rubrique (sans le \'-\')", - "identifier" : "id" - } - ]'; + $this->parameters[] = array( + 'id'=>array('name'=>'Id de la rubrique (sans le \'-\')') + ); } public function collectData(array $param){ parent::collectExpandableDatas($param, FREENEWS_RSS); } - + protected function parseRSSItem($newsItem) { $item = new Item(); $item->title = trim($newsItem->title); diff --git a/bridges/FuturaSciencesBridge.php b/bridges/FuturaSciencesBridge.php index c15e1b12..54f372f6 100644 --- a/bridges/FuturaSciencesBridge.php +++ b/bridges/FuturaSciencesBridge.php @@ -8,104 +8,77 @@ class FuturaSciencesBridge extends BridgeAbstract { $this->uri = 'http://www.futura-sciences.com/'; $this->description = 'Returns the newest articles.'; - $this->parameters[] = - '[ - { - "name" : "Feed", - "type" : "list", - "identifier" : "feed", - "values" : - [ - { "name" : "---- Select ----", "value" : "" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux multi-magazines", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Sciences", "value" : "actualites" }, - { "name" : "    Les dernières définitions de Futura-Sciences", "value" : "definitions" }, - { "name" : "    Les dernières photos de Futura-Sciences", "value" : "photos" }, - { "name" : "    Les dernières questions - réponses de Futura-Sciences", "value" : "questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Sciences", "value" : "dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Services", "value" : "" }, - - { "name" : "    Les cartes virtuelles de Futura-Sciences", "value" : "services/cartes-virtuelles" }, - { "name" : "    Les fonds d\'écran de Futura-Sciences", "value" : "services/fonds-ecran" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Santé", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Santé", "value" : "sante/actualites" }, - { "name" : "    Les dernières définitions de Futura-Santé", "value" : "sante/definitions" }, - { "name" : "    Les dernières questions-réponses de Futura-Santé", "value" : "sante/questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Santé", "value" : "sante/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux High-Tech", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura High-Tech", "value" : "high-tech/actualites" }, - { "name" : "    Les dernières astuces de Futura High-Tech", "value" : "high-tech/questions-reponses" }, - { "name" : "    Les dernières définitions de Futura High-Tech", "value" : "high-tech/definitions" }, - { "name" : "    Les derniers dossiers de Futura High-Tech", "value" : "high-tech/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Espace", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Espace", "value" : "espace/actualites" }, - { "name" : "    Les dernières définitions de Futura-Espace", "value" : "espace/definitions" }, - { "name" : "    Les dernières questions-réponses de Futura-Espace", "value" : "espace/questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Espace", "value" : "espace/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Environnement", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Environnement", "value" : "environnement/actualites" }, - { "name" : "    Les dernières définitions de Futura-Environnement", "value" : "environnement/definitions" }, - { "name" : "    Les dernières questions - réponses de Futura-Environnement", "value" : "environnement/questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Environnement", "value" : "environnement/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Maison", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Maison", "value" : "maison/actualites" }, - { "name" : "    Les dernières astuces de Futura-Maison", "value" : "maison/questions-reponses" }, - { "name" : "    Les dernières définitions de Futura-Maison", "value" : "maison/definitions" }, - { "name" : "    Les derniers dossiers de Futura-Maison", "value" : "maison/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Nature", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Nature", "value" : "nature/actualites" }, - { "name" : "    Les dernières définitions de Futura-Nature", "value" : "nature/definitions" }, - { "name" : "    Les dernières questions-réponses de Futura-Nature", "value" : "nature/questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Nature", "value" : "nature/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Terre", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Terre", "value" : "terre/actualites" }, - { "name" : "    Les dernières définitions de Futura-Terre", "value" : "terre/definitions" }, - { "name" : "    Les dernières questions-réponses de Futura-Terre", "value" : "terre/questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Terre", "value" : "terre/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Matière", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Matière", "value" : "matiere/actualites" }, - { "name" : "    Les dernières définitions de Futura-Matière", "value" : "matiere/definitions" }, - { "name" : "    Les dernières questions-réponses de Futura-Matière", "value" : "matiere/questions-reponses" }, - { "name" : "    Les derniers dossiers de Futura-Matière", "value" : "matiere/dossiers" }, - - { "name" : "", "value" : "" }, - { "name" : "Les flux Mathématiques", "value" : "" }, - - { "name" : "    Les dernières actualités de Futura-Mathématiques", "value" : "mathematiques/actualites" }, - { "name" : "    Les derniers dossiers de Futura-Mathématiques", "value" : "mathematiques/dossiers" } - ] - } - ]'; - + $this->parameters[] = array( + 'feed'=> array( + 'name'=>'Feed', + 'type'=>'list', + 'values'=>array( + 'Les flux multi-magazines'=>array( + 'Les dernières actualités de Futura-Sciences'=>'actualites', + 'Les dernières définitions de Futura-Sciences'=>'definitions', + 'Les dernières photos de Futura-Sciences'=>'photos', + 'Les dernières questions - réponses de Futura-Sciences'=>'questions-reponses', + 'Les derniers dossiers de Futura-Sciences'=>'dossiers' + ), + 'Les flux Services'=> array( + 'Les cartes virtuelles de Futura-Sciences'=>'services/cartes-virtuelles', + 'Les fonds d\'écran de Futura-Sciences'=>'services/fonds-ecran' + ), + 'Les flux Santé'=>array( + 'Les dernières actualités de Futura-Santé'=>'sante/actualites', + 'Les dernières définitions de Futura-Santé'=>'sante/definitions', + 'Les dernières questions-réponses de Futura-Santé'=>'sante/question-reponses', + 'Les derniers dossiers de Futura-Santé'=>'sante/dossiers' + ), + 'Les flux High-Tech'=>array( + 'Les dernières actualités de Futura-High-Tech'=>'high-tech/actualites', + 'Les dernières astuces de Futura-High-Tech'=>'high-tech/question-reponses', + 'Les dernières définitions de Futura-High-Tech'=>'high-tech/definitions', + 'Les derniers dossiers de Futura-High-Tech'=>'high-tech/dossiers' + ), + 'Les flux Espace'=>array( + 'Les dernières actualités de Futura-Espace'=>'espace/actualites', + 'Les dernières définitions de Futura-Espace'=>'espace/definitions', + 'Les dernières questions-réponses de Futura-Espace'=>'espace/question-reponses', + 'Les derniers dossiers de Futura-Espace'=>'espace/dossiers' + ), + 'Les flux Environnement'=>array( + 'Les dernières actualités de Futura-Environnement'=>'environnement/actualites', + 'Les dernières définitions de Futura-Environnement'=>'environnement/definitions', + 'Les dernières questions-réponses de Futura-Environnement'=>'environnement/question-reponses', + 'Les derniers dossiers de Futura-Environnement'=>'environnement/dossiers' + ), + 'Les flux Maison'=>array( + 'Les dernières actualités de Futura-Maison'=>'maison/actualites', + 'Les dernières astuces de Futura-Maison'=>'maison/question-reponses', + 'Les dernières définitions de Futura-Maison'=>'maison/definitions', + 'Les derniers dossiers de Futura-Maison'=>'maison/dossiers' + ), + 'Les flux Nature'=>array( + 'Les dernières actualités de Futura-Nature'=>'nature/actualites', + 'Les dernières définitions de Futura-Nature'=>'nature/definitions', + 'Les dernières questions-réponses de Futura-Nature'=>'nature/question-reponses', + 'Les derniers dossiers de Futura-Nature'=>'nature/dossiers' + ), + 'Les flux Terre'=>array( + 'Les dernières actualités de Futura-Terre'=>'terre/actualites', + 'Les dernières définitions de Futura-Terre'=>'terre/definitions', + 'Les dernières questions-réponses de Futura-Terre'=>'terre/question-reponses', + 'Les derniers dossiers de Futura-Terre'=>'terre/dossiers' + ), + 'Les flux Matière'=>array( + 'Les dernières actualités de Futura-Matière'=>'matiere/actualites', + 'Les dernières définitions de Futura-Matière'=>'matiere/definitions', + 'Les dernières questions-réponses de Futura-Matière'=>'matiere/question-reponses', + 'Les derniers dossiers de Futura-Matière'=>'matiere/dossiers' + ), + 'Les flux Mathématiques'=>array( + 'Les dernières actualités de Futura-Mathématiques'=>'mathematiques/actualites', + 'Les derniers dossiers de Futura-Mathématiques'=>'mathematiques/dossiers' + ) + ) + ) + ); } public function collectData(array $param) { diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php index 5cad1008..868393c2 100644 --- a/bridges/GBAtempBridge.php +++ b/bridges/GBAtempBridge.php @@ -10,33 +10,18 @@ class GBAtempBridge extends BridgeAbstract { $this->uri = 'http://gbatemp.net/'; $this->description = 'GBAtemp is a user friendly underground video game community.'; - $this->parameters[] = - '[ - { - "name" : "Type", - "type" : "list", - "identifier" : "type", - "values" : - [ - { - "name" : "News", - "value" : "N" - }, - { - "name" : "Reviews", - "value" : "R" - }, - { - "name" : "Tutorials", - "value" : "T" - }, - { - "name" : "Forum", - "value" : "F" - } - ] - } - ]'; + $this->parameters[] = array( + 'type'=>array( + 'name'=>'Type', + 'type'=>'list', + 'values'=>array( + 'News'=>'N', + 'Reviews'=>'R', + 'Tutorials'=>'T', + 'Forum'=>'F' + ) + ) + ); } private function ExtractFromDelimiters($string, $start, $end) { diff --git a/bridges/Gawker.php b/bridges/Gawker.php index f8ea8441..d03c20de 100644 --- a/bridges/Gawker.php +++ b/bridges/Gawker.php @@ -11,13 +11,9 @@ class Gawker extends RssExpander{ $this->uri = "http://feeds.gawker.com/"; $this->description = "A bridge allowing access to any of the numerous Gawker media blogs (Lifehacker, deadspin, Kotaku, Jezebel, and so on. Notice you have to give its id to find the RSS stream in gawker maze"; - $this->parameters[] = - '[ - { - "name" : "site id to put in uri between feeds.gawker.com and /full .. which is obviously not full AT ALL", - "identifier" : "site" - } - ]'; + $this->parameters[] = array( + 'site'=>array('name'=>'site id to put in uri between feeds.gawker.com and /full .. which is obviously not full AT ALL') + ); } @@ -35,7 +31,7 @@ class Gawker extends RssExpander{ // $this->message("loading feed from ".$this->getURI()); parent::collectExpandableDatas($param, $url); } - + protected function parseRSSItem($newsItem) { $item = new Item(); $item->uri = trim($newsItem->link); diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php index c6c6a627..bd73bbad 100644 --- a/bridges/GelbooruBridge.php +++ b/bridges/GelbooruBridge.php @@ -8,18 +8,13 @@ class GelbooruBridge extends BridgeAbstract{ $this->uri = "http://gelbooru.com/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php index 82dbc8b1..61548c5a 100644 --- a/bridges/GiphyBridge.php +++ b/bridges/GiphyBridge.php @@ -10,22 +10,16 @@ class GiphyBridge extends BridgeAbstract{ $this->uri = "http://giphy.com/"; $this->description = "Bridge for giphy.com"; - $this->parameters["By tag"] = - '[ - { - "name" : "search tag", - "identifier" : "s" - } - ]'; + $this->parameters["By tag"] = array( + 's'=>array('name'=>'search tag') + ); - $this->parameters["Without tag"] = - '[ - { - "name" : "max number of returned items", - "type" : "number", - "identifier" : "n" - } - ]'; + $this->parameters["Without tag"] = array( + 'n'=>array( + 'name'=>'max number of returned items', + 'type'=>'number' + ) + ); } public function collectData(array $param){ diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index 33fdc6b3..e5358988 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -13,22 +13,21 @@ class GithubIssueBridge extends BridgeAbstract{ $this->uri = ''; $this->description = 'Returns the comments of a github project issue'; - $this->parameters[]= - '[ - { - "name" : "User name", - "identifier" : "u" - }, - { - "name" : "Project name", - "identifier" : "p" - }, - { - "name" : "Issue number", - "identifier" : "i" - } - - ]'; + $this->parameters[]=array ( + 'u'=>array( + 'name'=>'User name', + 'required'=>true + ), + 'p'=>array( + 'name'=>'Project name', + 'required'=>true + ), + 'i'=>array( + 'name'=>'Issue number', + 'type'=>'number', + 'required'=>true + ) + ); } public function collectData(array $param){ diff --git a/bridges/GitlabCommitsBridge.php b/bridges/GitlabCommitsBridge.php index 69f0be63..85c18b8f 100644 --- a/bridges/GitlabCommitsBridge.php +++ b/bridges/GitlabCommitsBridge.php @@ -13,30 +13,24 @@ class GitlabCommitsBridge extends BridgeAbstract{ $this->uri = ''; $this->description = 'Returns the commits of a project hosted on a gitlab instance'; - $this->parameters[] = - '[ - { - "name" : "Base URI", - "identifier" : "uri", - "defaultValue":"https://gitlab.com" - }, - { - "name" : "User name", - "identifier" : "u", - "required": true - }, - { - "name" : "Project name", - "identifier" : "p", - "required":true - }, - { - "name" : "Project branch", - "identifier" : "b", - "defaultValue":"master" - } - - ]'; + $this->parameters[] = array( + 'uri'=>array( + 'name'=>'Base URI', + 'defaultValue'=>'https://gitlab.com' + ), + 'u'=>array( + 'name'=>'User name', + 'required'=>true + ), + 'p'=>array( + 'name'=>'Project name', + 'required'=>true + ), + 'b'=>array( + 'name'=>'Project branch', + 'defaultValue'=>'master' + ) + ); } public function collectData(array $param){ diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index 0e2470b4..6f106ee6 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -11,13 +11,9 @@ class GooglePlusPostBridge extends BridgeAbstract $this->uri = "http://plus.google.com/"; $this->description = "Returns user public post (without API)."; - $this->parameters[] = - '[ - { - "name" : "username or Id", - "identifier" : "username" - } - ]'; + $this->parameters[] = array( + 'username'=>array('name'=>'username or Id') + ); } diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index f3dfbb0f..0e9da844 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -18,13 +18,9 @@ class GoogleSearchBridge extends BridgeAbstract{ $this->uri = "https://www.google.com/"; $this->description = "Returns most recent results from Google search."; - $this->parameters[] = - '[ - { - "name" : "keyword", - "identifier" : "q" - } - ]'; + $this->parameters[] = array( + 'q'=>array('name'=>"keyword") + ); } diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php index 98c252fb..4beb1a7b 100644 --- a/bridges/HDWallpapersBridge.php +++ b/bridges/HDWallpapersBridge.php @@ -11,22 +11,14 @@ class HDWallpapersBridge extends BridgeAbstract { $this->uri = "http://www.hdwallpapers.in/"; $this->description = "Returns the latests wallpapers from HDWallpapers"; - $this->parameters[] = - '[ - { - "name" : "category", - "identifier" : "c" - }, - { - "name" : "max number of wallpapers", - "identifier" : "m" - }, - { - "name" : "resolution", - "identifier" : "r", - "exampleValue" : "1920x1200, 1680x1050, ..." - } - ]'; + $this->parameters[] = array( + 'c'=>array('name'=>'category'), + 'm'=>array('name'=>'max number of wallpapers'), + 'r'=>array( + 'name'=>'resolution', + 'exampleValue'=>'1920x1200, 1680x1050,…' + ) + ); } public function collectData(array $param){ diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php index a853e066..5b696052 100644 --- a/bridges/IdenticaBridge.php +++ b/bridges/IdenticaBridge.php @@ -10,13 +10,9 @@ class IdenticaBridge extends BridgeAbstract{ $this->uri = "https://identi.ca/"; $this->description = "Returns user timelines"; - $this->parameters[] = - '[ - { - "name" : "username", - "identifier" : "u" - } - ]'; + $this->parameters[] = array( + 'u'=>array('name'=>'username') + ); } diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index b029b0d8..c48ea947 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -10,13 +10,9 @@ class InstagramBridge extends BridgeAbstract{ $this->uri = "http://instagram.com/"; $this->description = "Returns the newest images"; - $this->parameters[] = - '[ - { - "name" : "username", - "identifier" : "u" - } - ]'; + $this->parameters[] = array( + 'u'=>array('name'=>'username') + ); } diff --git a/bridges/IsoHuntBridge.php b/bridges/IsoHuntBridge.php index 6a4f1af0..718fe473 100644 --- a/bridges/IsoHuntBridge.php +++ b/bridges/IsoHuntBridge.php @@ -11,164 +11,82 @@ class IsoHuntBridge extends BridgeAbstract{ * Notice: The categories "News" and "Top Searches" are received from the main page * Elements are sorted by name ascending! */ - $this->parameters['By "Latest" category'] = - '[ - { - "name" : "Latest category", - "identifier" : "latest_category", - "type" : "list", - "required" : true, - "title" : "Select your category", - "defaultValue" : "News", - "values" : - [ - { - "name" : "Hot Torrents", - "value" : "hot_torrents" - }, - { - "name" : "News", - "value" : "news" - }, - { - "name" : "Releases", - "value" : "releases" - }, - { - "name" : "Torrents", - "value" : "torrents" - } - ] - } - ]'; + $this->parameters['By "Latest" category'] = array( + 'latest_category'=>array( + 'name'=>'Latest category', + 'type'=>'list', + 'required'=>true, + 'title'=>'Select your category', + 'defaultValue'=>'News', + 'values'=>array( + 'Hot Torrents'=>'hot_torrents', + 'News'=>'news', + 'Releases'=>'releases', + 'Torrents'=>'torrents' + ) + ) + ); /* * Get feeds for one of the "torrent" categories * Make sure to add new categories also to get_torrent_category_index($)! * Elements are sorted by name ascending! */ - $this->parameters['By "Torrent" category'] = - '[ - { - "name" : "Torrent category", - "identifier" : "torrent_category", - "type" : "list", - "required" : true, - "title" : "Select your category", - "defaultValue" : "Anime", - "values" : - [ - { - "name" : "Adult", - "value" : "adult" - }, - { - "name" : "Anime", - "value" : "anime" - }, - { - "name" : "Books", - "value" : "books" - }, - { - "name" : "Games", - "value" : "games" - }, - { - "name" : "Movies", - "value" : "movies" - }, - { - "name" : "Music", - "value" : "music" - }, - { - "name" : "Other", - "value" : "other" - }, - { - "name" : "Series & TV", - "value" : "series_tv" - }, - { - "name" : "Software", - "value" : "software" - } - ] - }, - { - "name" : "Sort by popularity", - "identifier" : "torrent_popularity", - "type" : "checkbox", - "title" : "Activate to receive results by popularity" - } - ]'; + $this->parameters['By "Torrent" category'] = array( + 'torrent_category'=>array( + 'name'=>'Torrent category', + 'type'=>'list', + 'required'=>true, + 'title'=>'Select your category', + 'defaultValue'=>'Anime', + 'values'=>array( + 'Adult'=>'adult', + 'Anime'=>'anime', + 'Books'=>'books', + 'Games'=>'games', + 'Movies'=>'movies', + 'Music'=>'music', + 'Other'=>'other', + 'Series & TV'=>'series_tv', + 'Software'=>'software' + ) + ), + 'torrent_popularity'=>array( + 'name'=>'Sort by popularity', + 'type'=>'checkbox', + 'title'=>'Activate to receive results by popularity' + ) + ); /* * Get feeds for a specific search request */ - $this->parameters['Search torrent by name'] = - '[ - { - "name" : "Name", - "identifier" : "search_name", - "type" : "text", - "required" : true, - "title" : "Insert your search query", - "exampleValue" : "Bridge" - }, - { - "name" : "Category", - "identifier" : "search_category", - "type" : "list", - "required" : false, - "title" : "Select your category", - "defaultValue" : "All", - "values" : - [ - { - "name" : "Adult", - "value" : "adult" - }, - { - "name" : "All", - "value" : "all" - }, - { - "name" : "Anime", - "value" : "anime" - }, - { - "name" : "Books", - "value" : "books" - }, - { - "name" : "Games", - "value" : "games" - }, - { - "name" : "Movies", - "value" : "movies" - }, - { - "name" : "Music", - "value" : "music" - }, - { - "name" : "Other", - "value" : "other" - }, - { - "name" : "Series & TV", - "value" : "series_tv" - }, - { - "name" : "Software", - "value" : "software" - } - ] - } - ]'; + $this->parameters['Search torrent by name'] = array( + 'search_name'=>array( + 'name'=>'Name', + 'required'=>true, + 'title'=>'Insert your search query', + 'exampleValue'=>'Bridge' + ), + 'search_category'=>array( + 'name'=>'Category', + 'type'=>'list', + 'title'=>'Select your category', + 'defaultValue'=>'All', + 'values'=>array( + 'Adult'=>'adult', + 'All'=>'all', + 'Anime'=>'anime', + 'Books'=>'books', + 'Games'=>'games', + 'Movies'=>'movies', + 'Music'=>'music', + 'Other'=>'other', + 'Series & TV'=>'series_tv', + 'Software'=>'software' + ) + ) + ); } public function collectData(array $params){ @@ -215,13 +133,13 @@ class IsoHuntBridge extends BridgeAbstract{ } private function get_torrent_category_name($category){ - $parameter = json_decode($this->parameters['By "Torrent" category'], true); - $languages = $parameter[0]['values']; + $parameter = $this->parameters['By "Torrent" category']; + $languages = $parameter['torrent_category']['values']; + + foreach($languages as $name=>$value) + if(strtolower(trim($value)) === strtolower(trim($category))) + return $name; - foreach($languages as $language) - if(strtolower(trim($language['value'])) === strtolower(trim($category))) - return $language['name']; - return 'Unknown category'; } @@ -244,19 +162,19 @@ class IsoHuntBridge extends BridgeAbstract{ private function request_latest_category($category){ switch($category){ - case 'hot_torrents': + case 'hot_torrents': $this->name = 'Latest hot torrents - ' . $this->name; $this->uri .= '/statistic/hot/torrents'; break; - case 'news': + case 'news': $this->name = 'Latest news - ' . $this->name; $this->uri .= '/'; break; - case 'releases': + case 'releases': $this->name = 'Latest releases - ' . $this->name; $this->uri .= '/releases.php'; break; - case 'torrents': + case 'torrents': $this->name = 'Latest torrents - ' . $this->name; $this->uri .= '/latest.php'; break; @@ -288,13 +206,13 @@ class IsoHuntBridge extends BridgeAbstract{ } private function get_search_category_name($category){ - $parameter = json_decode($this->parameters['Search torrent by name'], true); - $languages = $parameter[1]['values']; + $parameter = $this->parameters['Search torrent by name']; + $languages = $parameter['search_category']['values']; + + foreach($languages as $name=>$value) + if(strtolower(trim($value)) === strtolower(trim($category))) + return $name; - foreach($languages as $language) - if(strtolower(trim($language['value'])) === strtolower(trim($category))) - return $language['name']; - return 'Unknown category'; } @@ -332,7 +250,7 @@ class IsoHuntBridge extends BridgeAbstract{ $item->uri = $this->fix_relative_uri($anchor->href); $item->title = $anchor->title; - // $item->author = + // $item->author = $item->timestamp = strtotime($date->plaintext); $item->content = $this->fix_relative_uri($torrent->innertext); @@ -370,9 +288,9 @@ class IsoHuntBridge extends BridgeAbstract{ $item->uri = $element->href; $item->title = $element->plaintext; - // $item->author = - // $item->timestamp = - // $item->content = + // $item->author = + // $item->timestamp = + // $item->content = $this->items[] = $item; } @@ -453,7 +371,7 @@ class IsoHuntBridge extends BridgeAbstract{ $content = $post->find('div', 0); if(!$content) $this->returnServerError('Unable to find content!'); - + // Remove

...

(title) foreach($content->find('h2') as $element){ $element->outertext = ''; @@ -497,7 +415,7 @@ class IsoHuntBridge extends BridgeAbstract{ $cell = $torrent->find('td.title-row', 0); if(!$cell) $this->returnServerError('Unable to find title cell!'); - + $title = $cell->find('span', 0); if(!$title) $this->returnServerError('Unable to find title!'); @@ -509,7 +427,7 @@ class IsoHuntBridge extends BridgeAbstract{ $cell = $torrent->find('td.title-row', 0); if(!$cell) $this->returnServerError('Unable to find title cell!'); - + $uri = $cell->find('a', 0); if(!$uri) $this->returnServerError('Unable to find uri!'); @@ -521,7 +439,7 @@ class IsoHuntBridge extends BridgeAbstract{ $cell = $torrent->find('td.user-row', 0); if(!$cell) return; // No author - + $user = $cell->find('a', 0); if(!$user) $this->returnServerError('Unable to find user!'); @@ -545,7 +463,7 @@ class IsoHuntBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($uri); if(!$html) $this->returnServerError('Unable to load ' . $uri . '!'); - + return $html; } diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php index 03c835d3..fcb3796b 100644 --- a/bridges/JapanExpoBridge.php +++ b/bridges/JapanExpoBridge.php @@ -6,25 +6,16 @@ class JapanExpoBridge extends BridgeAbstract{ $this->name = 'Japan Expo Actualités'; $this->uri = 'http://www.japan-expo-paris.com/fr/actualites'; $this->description = 'Returns most recent entries from Japan Expo actualités.'; - $this->parameters[] = - '[ - { - "name" : "Mode", - "type" : "list", - "identifier" : "mode", - "values" : - [ - { - "name" : "Titles only", - "value" : "light" - }, - { - "name" : "Full Contents", - "value" : "full" - } - ] - } - ]'; + $this->parameters[] = array( + 'mode'=>array( + 'name'=>'Mode', + 'type'=>'list', + 'values'=>array( + 'Titles only'=>'light', + 'Full Contents'=>'full' + ) + ) + ); } public function collectData(array $param) { diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php index b8dbb5cd..6a42ac3e 100644 --- a/bridges/KonachanBridge.php +++ b/bridges/KonachanBridge.php @@ -8,18 +8,13 @@ class KonachanBridge extends BridgeAbstract{ $this->uri = "http://konachan.com/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index 7f3278ea..05b80c4a 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -6,56 +6,37 @@ class KununuBridge extends BridgeAbstract{ $this->uri = "https://www.kununu.com"; /* This will be replaced later! */ $this->description = "Returns the latest reviews for a company and site of your choice."; - $this->parameters['global'] = - '[ - { - "name" : "Site", - "identifier" : "site", - "type" : "list", - "required" : true, - "exampleValue" : "United States", - "title" : "Select your site", - "values" : - [ - { - "name" : "Austria", - "value" : "at" - }, - { - "name" : "Germany", - "value" : "de" - }, - { - "name" : "Switzerland", - "value" : "ch" - }, - { - "name" : "United States", - "value" : "us" - } - ] - }, - { - "name" : "Load full article", - "identifier" : "full", - "type" : "checkbox", - "required" : false, - "exampleValue" : "checked", - "title" : "Activate to load full article" - } - ]'; + $this->parameters['global'] = array( + 'site'=>array( + 'name'=>'Site', + 'type'=>'list', + 'required'=>true, + 'exampleValue'=>'United States', + 'title'=>'Select your site', + 'values'=>array( + 'Austria'=>'at', + 'Germany'=>'de', + 'Switzerland'=>'ch', + 'United States'=>'us' + ) + ), + 'full'=>array( + 'name'=>'Load full article', + 'type'=>'checkbox', + 'required'=>false, + 'exampleValue'=>'checked', + 'title'=>'Activate to load full article' + ) + ); - $this->parameters[] = - '[ - { - "name" : "Company", - "identifier" : "company", - "type" : "text", - "required" : true, - "exampleValue" : "kununu-us", - "title" : "Insert company name (i.e. Kununu US) or URI path (i.e. kununu-us)" - } - ]'; + $this->parameters[] = array( + 'company'=>array( + 'name'=>'Company', + 'required'=>true, + 'exampleValue'=>'kununu-us', + 'title'=>'Insert company name (i.e. Kununu US) or URI path (i.e. kununu-us)' + ) + ); } public function collectData(array $params){ @@ -132,17 +113,17 @@ class KununuBridge extends BridgeAbstract{ return 86400; // 1 day } - /** + /** * Returns true if the given site is part of the parameters list */ private function site_is_valid($site){ - $parameter = json_decode($this->parameters['global'], true); - $sites = $parameter[0]['values']; + $parameter = $this->parameters['global']; + $sites = $parameter['site']['values']; $site_names = array(); - foreach($sites as $site_item) - $site_names[] = $site_item['value']; + foreach($sites as $name=>$value) + $site_names[] = $value; return in_array($site, $site_names); } @@ -171,11 +152,11 @@ class KununuBridge extends BridgeAbstract{ $panel = $html->find('div.panel', 0); if($panel === false) $this->returnServerError('Cannot find panel for company name!'); - + $company_name = $panel->find('h1', 0); if($company_name === false) $this->returnServerError('Cannot find company name!'); - + return $company_name->plaintext; } @@ -187,7 +168,7 @@ class KununuBridge extends BridgeAbstract{ $date = $article->find('time[itemprop=dtreviewed]', 0); if($date === false) $this->returnServerError('Cannot find article date!'); - + return strtotime($date->datetime); } @@ -198,7 +179,7 @@ class KununuBridge extends BridgeAbstract{ $rating = $article->find('span.rating', 0); if($rating === false) $this->returnServerError('Cannot find article rating!'); - + return $rating->getAttribute('aria-label'); } @@ -209,7 +190,7 @@ class KununuBridge extends BridgeAbstract{ $summary = $article->find('[itemprop=summary]', 0); if($summary === false) $this->returnServerError('Cannot find article summary!'); - + return strip_tags($summary->innertext); } @@ -225,7 +206,7 @@ class KununuBridge extends BridgeAbstract{ $anchor = $summary->find('a', 0); if($anchor === false) $this->returnServerError('Cannot find article URI!'); - + return 'https://www.kununu.com' . $anchor->href; } @@ -246,7 +227,7 @@ class KununuBridge extends BridgeAbstract{ break; } } - + return $author_position; } @@ -257,7 +238,7 @@ class KununuBridge extends BridgeAbstract{ $description = $article->find('div[itemprop=description]', 0); if($description === false) $this->returnServerError('Cannot find article description!'); - + return $this->fix_url($description->innertext); } diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php index 89c150f6..6dd56b42 100755 --- a/bridges/LeBonCoinBridge.php +++ b/bridges/LeBonCoinBridge.php @@ -8,223 +8,132 @@ class LeBonCoinBridge extends BridgeAbstract{ $this->uri = "http://www.leboncoin.fr"; $this->description = "Returns most recent results from LeBonCoin for a region, and optionally a category and a keyword ."; - $this->parameters[] = - '[ - - { - "name" : "Mot Clé", - "identifier" : "k" - }, - - { - "name" : "Région", - "identifier" : "r", - "type" : "list", - "values" : [ - { - "name" : "Alsace", - "value" : "alsace" - }, - { - "name" : "Aquitaine", - "value" : "aquitaine" - }, - { - "name" : "Auvergne", - "value" : "auvergne" - }, - { - "name" : "Basse Normandie", - "value" : "basse_normandie" - }, - { - "name" : "Bourgogne", - "value" : "bourgogne" - }, - { - "name" : "Bretagne", - "value" : "bretagne" - }, - { - "name" : "Centre", - "value" : "centre" - }, - { - "name" : "Champagne Ardenne", - "value" : "champagne_ardenne" - }, - { - "name" : "Corse", - "value" : "corse" - }, - { - "name" : "Franche Comté", - "value" : "franche_comte" - }, - { - "name" : "Haute Normandie", - "value" : "haute_normandie" - }, - { - "name" : "Ile de France", - "value" : "ile_de_france" - }, - { - "name" : "Languedoc Roussillon", - "value" : "languedoc_roussillon" - }, - { - "name" : "Limousin", - "value" : "limousin" - }, - { - "name" : "Lorraine", - "value" : "lorraine" - }, - { - "name" : "Midi Pyrénées", - "value" : "midi_pyrenees" - }, - { - "name" : "Nord Pas De Calais", - "value" : "nord_pas_de_calais" - }, - { - "name" : "Pays de la Loire", - "value" : "pays_de_la_loire" - }, - { - "name" : "Picardie", - "value" : "picardie" - }, - { - "name" : "Poitou Charentes", - "value" : "poitou_charentes" - }, - { - "name" : "Provence Alpes Côte d\'Azur", - "value" : "provence_alpes_cote_d_azur" - }, - { - "name" : "Rhône-Alpes", - "value" : "rhone_alpes" - }, - { - "name" : "Guadeloupe", - "value" : "guadeloupe" - }, - { - "name" : "Martinique", - "value" : "martinique" - }, - { - "name" : "Guyane", - "value" : "guyane" - }, - { - "name" : "Réunion", - "value" : "reunion" - } - ] - }, - { - "name" : "Catégorie", - "identifier" : "c", - "type" : "list", - "values" : [ - { "name" : "---- Select ----", "value" : "" }, - - { "name" : "", "value" : "" }, - { "name" : "EMPLOI", "value" : "_emploi_" }, - - { "name" : "", "value" : "" }, - { "name" : "VEHICULES", "value" : "_vehicules_" }, - { "name" : "    Voitures", "value" : "voitures" }, - { "name" : "    Motos", "value" : "motos" }, - { "name" : "    Caravaning", "value" : "caravaning" }, - { "name" : "    Utilitaires", "value" : "utilitaires" }, - { "name" : "    Equipement Auto", "value" : "equipement_auto" }, - { "name" : "    Equipement Moto", "value" : "equipement_moto" }, - { "name" : "    Equipement Caravaning", "value" : "equipement_caravaning" }, - { "name" : "    Nautisme", "value" : "nautisme" }, - { "name" : "    Equipement Nautisme", "value" : "equipement_nautisme" }, - - { "name" : "", "value" : "" }, - { "name" : "IMMOBILIER", "value" : "_immobilier_" }, - { "name" : "    Ventes immobilieres", "value" : "ventes_immobilieres" }, - { "name" : "    Locations", "value" : "locations" }, - { "name" : "    Colocations", "value" : "colocations" }, - { "name" : "    Bureaux & Commerces", "value" : "bureaux_commerces" }, - - { "name" : "", "value" : "" }, - { "name" : "VACANCES", "value" : "_vacances_" }, - { "name" : "    Locations gites", "value" : "locations_gites" }, - { "name" : "    Chambres d\'hôtes", "value" : "chambres_d_hotes" }, - { "name" : "    Campings", "value" : "campings" }, - { "name" : "    Hôtels", "value" : "hotels" }, - { "name" : "    Hébergements insolites", "value" : "hebergements_insolites" }, - - { "name" : "", "value" : "" }, - { "name" : "MULTIMEDIA", "value" : "_multimedia_" }, - { "name" : "    Informatique", "value" : "informatique" }, - { "name" : "    Consoles & Jeux vidéo", "value" : "consoles_jeux_video" }, - { "name" : "    Image & Son", "value" : "image_son" }, - { "name" : "    Téléphonie", "value" : "telephonie" }, - - { "name" : "", "value" : "" }, - { "name" : "LOISIRS", "value" : "_loisirs_" }, - { "name" : "    DVD / Films", "value" : "dvd_films" }, - { "name" : "    CD / Musique", "value" : "cd_musique" }, - { "name" : "    Livres", "value" : "livres" }, - { "name" : "    Animaux", "value" : "animaux" }, - { "name" : "    Vélos", "value" : "velos" }, - { "name" : "    Sports & Hobbies", "value" : "sports_hobbies" }, - { "name" : "    Instruments de musique", "value" : "instruments_de_musique" }, - { "name" : "    Collection", "value" : "collection" }, - { "name" : "    Jeux & Jouets", "value" : "jeux_jouets" }, - { "name" : "    Vins & Gastronomie", "value" : "vins_gastronomie" }, - - { "name" : "", "value" : "" }, - { "name" : "MATERIEL PROFESSIONNEL", "value" : "_materiel_professionnel_" }, - { "name" : "    Materiel Agricole", "value" : "materiel_agricole" }, - { "name" : "    Transport - Manutention", "value" : "transport_manutention" }, - { "name" : "    BTP - Chantier - Gros-oeuvre", "value" : "btp_chantier_gros_oeuvre" }, - { "name" : "    Outillage - Materiaux 2nd-oeuvre", "value" : "outillage_materiaux_2nd_oeuvre" }, - { "name" : "    Equipements Industriels", "value" : "equipements_industriels" }, - { "name" : "    Restauration - Hôtellerie", "value" : "restauration_hotellerie" }, - { "name" : "    Fournitures de Bureau", "value" : "fournitures_de_bureau" }, - { "name" : "    Commerces & Marchés", "value" : "commerces_marches" }, - { "name" : "    Matériel médical", "value" : "materiel_medical" }, - - { "name" : "", "value" : "" }, - { "name" : "SERVICES", "value" : "_services_" }, - { "name" : "    Prestations de services", "value" : "prestations_de_services" }, - { "name" : "    Billetterie", "value" : "billetterie" }, - { "name" : "    Evénements", "value" : "evenements" }, - { "name" : "    Cours particuliers", "value" : "cours_particuliers" }, - { "name" : "    Covoiturage", "value" : "covoiturage" }, - - { "name" : "", "value" : "" }, - { "name" : "MAISON", "value" : "_maison_" }, - { "name" : "    Ameublement", "value" : "ameublement" }, - { "name" : "    Electroménager", "value" : "electromenager" }, - { "name" : "    Arts de la table", "value" : "arts_de_la_table" }, - { "name" : "    Décoration", "value" : "decoration" }, - { "name" : "    Linge de maison", "value" : "linge_de_maison" }, - { "name" : "    Bricolage", "value" : "bricolage" }, - { "name" : "    Jardinage", "value" : "jardinage" }, - { "name" : "    Vêtements", "value" : "vetements" }, - { "name" : "    Chaussures", "value" : "chaussures" }, - { "name" : "    Accessoires & Bagagerie", "value" : "accessoires_bagagerie" }, - { "name" : "    Montres & Bijoux", "value" : "montres_bijoux" }, - { "name" : "    Equipement bébé", "value" : "equipement_bebe" }, - { "name" : "    Vêtements bébé", "value" : "vetements_bebe" }, - - { "name" : "", "value" : "" }, - { "name" : "AUTRES", "value" : "autres" } - ] - } - ]'; + $this->parameters[] = array( + 'k'=>array('name'=>'Mot Clé'), + 'r'=>array( + 'name'=>'Région', + 'type'=>'list', + 'values'=>array( + 'Alsace'=>'alsace', + 'Aquitaine'=>'aquitaine', + 'Auvergne'=>'auvergne', + 'Basse Normandie'=>'basse_normandie', + 'Bourgogne'=>'bourgogne', + 'Bretagne'=>'bretagne', + 'Centre'=>'centre', + 'Champagne Ardenne'=>'champagne_ardenne', + 'Corse'=>'corse', + 'Franche Comté'=>'franche_comte', + 'Haute Normandie'=>'haute_normandie', + 'Ile de France'=>'ile_de_france', + 'Languedoc Roussillon'=>'languedoc_roussillon', + 'Limousin'=>'limousin', + 'Lorraine'=>'lorraine', + 'Midi Pyrénées'=>'midi_pyrenees', + 'Nord Pas De Calais'=>'nord_pas_de_calais', + 'Pays de la Loire'=>'pays_de_la_loire', + 'Picardie'=>'picardie', + 'Poitou Charentes'=>'poitou_charentes', + 'Provence Alpes Côte d\'Azur'=>'provence_alpes_cote_d_azur', + 'Rhône-Alpes'=>'rhone_alpes', + 'Guadeloupe'=>'guadeloupe', + 'Martinique'=>'martinique', + 'Guyane'=>'guyane', + 'Réunion'=>'reunion' + ) + ), + 'c'=>array( + 'name'=>'Catégorie', + 'type'=>'list', + 'values'=>array( + 'EMPLOI'=>'_emploi_', + 'VEHICULES'=>array( + 'Tous'=>'_vehicules_', + 'Voitures'=>'voitures', + 'Motos'=>'motos', + 'Caravaning'=>'caravaning', + 'Utilitaires'=>'utilitaires', + 'Équipement Auto'=>'equipement_auto', + 'Équipement Moto'=>'equipement_moto', + 'Équipement Caravaning'=>'equipement_caravaning', + 'Nautisme'=>'nautisme', + 'Équipement Nautisme'=>'equipement_nautisme' + ), + 'IMMOBILIER'=>array( + 'Tous'=>'_immobilier_', + 'Ventes immobilières'=>'ventes_immobilieres', + 'Locations'=>'locations', + 'Colocations'=>'colocations', + 'Bureaux & Commerces'=>'bureaux_commerces' + ), + 'VACANCES'=>array( + 'Tous'=>'_vacances_', + 'Location gîtes'=>'locations_gites', + 'Chambres d\'hôtes'=>'chambres_d_hotes', + 'Campings'=>'campings', + 'Hôtels'=>'hotels', + 'Hébergements insolites'=>'hebergements_insolites' + ), + 'MULTIMEDIA'=>array( + 'Tous'=>'_multumedia_', + 'Informatique'=>'informatique', + 'Consoles & Jeux vidéo'=>'consoles_jeux_video', + 'Image & Son'=>'image_son', + 'Téléphonie'=>'telephonie' + ), + 'LOISIRS'=>array( + 'Tous'=>'_loisirs_', + 'DVD / Films'=>'dvd_films', + 'CD / Musique'=>'cd_musique', + 'Livres'=>'livres', + 'Animaux'=>'animaux', + 'Vélos'=>'velos', + 'Sports & Hobbies'=>'sports_hobbies', + 'Instruments de musique'=>'instruments_de_musique', + 'Collection'=>'collection', + 'Jeux & Jouets'=>'jeux_jouets', + 'Vins & Gastronomie'=>'vins_gastronomie' + ), + 'MATÉRIEL PROFESSIONNEL'=>array( + 'Tous'=>'_materiel_professionnel_', + 'Matériel Agricole'=>'mateiel_agricole', + 'Transport - Manutention'=>'transport_manutention', + 'BTP - Chantier - Gros-œuvre'=>'btp_chantier_gros_oeuvre', + 'Outillage - Matériaux 2nd-œuvre'=>'outillage_materiaux_2nd_oeuvre', + 'Équipements Industriels'=>'equipement_industriels', + 'Restauration - Hôtellerie'=>'restauration_hotellerie', + 'Fournitures de Bureau'=>'fournitures_de_bureau', + 'Commerces & Marchés'=>'commerces_marches', + 'Matériel médical'=>'materiel_medical' + ), + 'SERVICES'=>array( + 'Tous'=>'_services_', + 'Prestations de services'=>'prestations_de_services', + 'Billetterie'=>'billetterie', + 'Évènements'=>'evenements', + 'Cours particuliers'=>'cours_particuliers', + 'Covoiturage'=>'covoiturage' + ), + 'MAISON'=>array( + 'Tous'=>'_maison_', + 'Ameublement'=>'ameublement', + 'Électroménager'=>'electromenager', + 'Arts de la table'=>'arts_de_la_table', + 'Décoration'=>'decoration', + 'Linge de maison'=>'linge_de_maison', + 'Bricolage'=>'bricolage', + 'Jardinage'=>'jardinage', + 'Vêtements'=>'vetements', + 'Chaussures'=>'chaussures', + 'Accessoires & Bagagerie'=>'accessoires_bagagerie', + 'Montres & Bijoux'=>'montres_bijoux', + 'Équipement bébé'=>'equipement_bebe', + 'Vêtements bébé'=>'vetements_bebe' + ), + 'AUTRES'=>'autres' + ) + ) + ); } diff --git a/bridges/LinkedInCompany.php b/bridges/LinkedInCompany.php index 61a95f63..7d4dc572 100644 --- a/bridges/LinkedInCompany.php +++ b/bridges/LinkedInCompany.php @@ -8,14 +8,12 @@ class LinkedInCompany extends BridgeAbstract{ $this->uri = "https://www.linkedin.com/"; $this->description = "Returns most recent actus from Company on LinkedIn. (https://www.linkedin.com/company/apple)"; - $this->parameters[] = - '[ - { - "name" : "Company name", - "identifier" : "c", - "required": true - } - ]'; + $this->parameters[] = array( + 'c'=>array( + 'name'=>'Company name', + 'required'=>true + ) + ); } public function collectData(array $param){ diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php index 623a6225..032ca84b 100644 --- a/bridges/LolibooruBridge.php +++ b/bridges/LolibooruBridge.php @@ -8,19 +8,13 @@ class LolibooruBridge extends BridgeAbstract{ $this->uri = "http://lolibooru.moe/"; $this->description = "Returns images from given page and tags"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; - + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 51f13913..64420cf1 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -9,193 +9,73 @@ class MangareaderBridge extends BridgeAbstract{ $this->uri = "http://www.mangareader.net"; $this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; - $this->parameters["Get latest updates"] = '[]'; - $this->parameters["Get popular mangas"] = - '[ - { - "name" : "Category", - "identifier" : "category", - "type" : "list", - "required" : true, - "values" : [ - { - "name" : "All", - "value" : "all" - }, - { - "name" : "Action", - "value" : "action" - }, - { - "name" : "Adventure", - "value" : "adventure" - }, - { - "name" : "Comedy", - "value" : "comedy" - }, - { - "name" : "Demons", - "value" : "demons" - }, - { - "name" : "Drama", - "value" : "drama" - }, - { - "name" : "Ecchi", - "value" : "ecchi" - }, - { - "name" : "Fantasy", - "value" : "fantasy" - }, - { - "name" : "Gender Bender", - "value" : "gender-bender" - }, - { - "name" : "Harem", - "value" : "harem" - }, - { - "name" : "Historical", - "value" : "historical" - }, - { - "name" : "Horror", - "value" : "horror" - }, - { - "name" : "Josei", - "value" : "josei" - }, - { - "name" : "Magic", - "value" : "magic" - }, - { - "name" : "Martial Arts", - "value" : "martial-arts" - }, - { - "name" : "Mature", - "value" : "mature" - }, - { - "name" : "Mecha", - "value" : "mecha" - }, - { - "name" : "Military", - "value" : "military" - }, - { - "name" : "Mystery", - "value" : "mystery" - }, - { - "name" : "One Shot", - "value" : "one-shot" - }, - { - "name" : "Psychological", - "value" : "psychological" - }, - { - "name" : "Romance", - "value" : "romance" - }, - { - "name" : "School Life", - "value" : "school-life" - }, - { - "name" : "Sci-Fi", - "value" : "sci-fi" - }, - { - "name" : "Seinen", - "value" : "seinen" - }, - { - "name" : "Shoujo", - "value" : "shoujo" - }, - { - "name" : "Shoujoai", - "value" : "shoujoai" - }, - { - "name" : "Shounen", - "value" : "shounen" - }, - { - "name" : "Shounenai", - "value" : "shounenai" - }, - { - "name" : "Slice of Life", - "value" : "slice-of-life" - }, - { - "name" : "Smut", - "value" : "smut" - }, - { - "name" : "Sports", - "value" : "sports" - }, - { - "name" : "Super Power", - "value" : "super-power" - }, - { - "name" : "Supernatural", - "value" : "supernatural" - }, - { - "name" : "Tragedy", - "value" : "tragedy" - }, - { - "name" : "Vampire", - "value" : "vampire" - }, - { - "name" : "Yaoi", - "value" : "yaoi" - }, - { - "name" : "Yuri", - "value" : "yuri" - } - ], - "exampleValue" : "All", - "title" : "Select your category" - } - ]'; - $this->parameters["Get manga updates"] = - '[ - { - "name" : "Path", - "identifier" : "path", - "type" : "text", - "required" : true, - "pattern" : "[a-zA-Z0-9-_]*", - "exampleValue" : "bleach, umi-no-kishidan", - "title" : "URL part of desired manga" - }, - { - "name" : "Limit", - "identifier" : "limit", - "type" : "number", - "exampleValue" : "10", - "title" : "Number of items to return.\n-1 returns all" - } - ]'; + $this->parameters["Get latest updates"] = array(); + $this->parameters["Get popular mangas"] = array( + 'category'=>array( + 'name'=>'Category', + 'type'=>'list', + 'required'=>true, + 'values'=>array( + 'All'=>'all', + 'Action'=>'action', + 'Adventure'=>'adventure', + 'Comedy'=>'comedy', + 'Demons'=>'demons', + 'Drama'=>'drama', + 'Ecchi'=>'ecchi', + 'Fantasy'=>'fantasy', + 'Gender Bender'=>'gender-bender', + 'Harem'=>'harem', + 'Historical'=>'historical', + 'Horror'=>'horror', + 'Josei'=>'josei', + 'Magic'=>'magic', + 'Martial Arts'=>'martial-arts', + 'Mature'=>'mature', + 'Mecha'=>'mecha', + 'Military'=>'military', + 'Mystery'=>'mystery', + 'One Shot'=>'one-shot', + 'Psychological'=>'psychological', + 'Romance'=>'romance', + 'School Life'=>'school-life', + 'Sci-Fi'=>'sci-fi', + 'Seinen'=>'seinen', + 'Shoujo'=>'shoujo', + 'Shoujoai'=>'shoujoai', + 'Shounen'=>'shounen', + 'Shounenai'=>'shounenai', + 'Slice of Life'=>'slice-of-life', + 'Smut'=>'smut', + 'Sports'=>'sports', + 'Super Power'=>'super-power', + 'Supernatural'=>'supernatural', + 'Tragedy'=>'tragedy', + 'Vampire'=>'vampire', + 'Yaoi'=>'yaoi', + 'Yuri'=>'yuri' + ), + 'exampleValue'=>'All', + 'title'=>'Select your category' + ) + ); + $this->parameters["Get manga updates"] = array( + 'path'=>array( + 'name'=>'Path', + 'required'=>true, + 'pattern'=>'[a-zA-Z0-9-_]*', + 'exampleValue'=>'bleach, umi-no-kishidan', + 'title'=>'URL part of desired manga' + ), + 'limit'=>array( + 'name'=>'Limit', + 'type'=>'number', + 'exampleValue'=>10, + 'title'=>'Number of items to return [-1 returns all]' + ) + ); } - + public function collectData(array $param){ $this->request = ''; @@ -203,7 +83,7 @@ class MangareaderBridge extends BridgeAbstract{ $type = "latest"; // can be "latest", "popular" or "path". Default is "latest"! $path = "latest"; $limit = MANGAREADER_LIMIT; - + if(isset($param['category'])){ // Get popular updates $type = "popular"; $path = "popular"; @@ -211,16 +91,16 @@ class MangareaderBridge extends BridgeAbstract{ $path .= "/" . $param['category']; } } - + if(isset($param['path'])){ // Get manga updates $type = "path"; $path = $param['path']; - } - + } + if(isset($param['limit']) && $param['limit'] !== ""){ // Get manga updates (optional parameter) $limit = $param['limit']; } - + // We'll use the DOM parser for this as it makes navigation easier $html = file_get_contents("http://www.mangareader.net/" . $path); if(!$html){ @@ -228,22 +108,22 @@ class MangareaderBridge extends BridgeAbstract{ } $doc = new DomDocument; @$doc->loadHTML($html); - + // Navigate via XPath $xpath = new DomXPath($doc); // Build feed based on the context (site updates or manga updates) if($type === "latest"){ - + $this->request = 'Latest updates'; - + // Query each item (consists of Manga + chapters) $nodes = $xpath->query("//*[@id='latestchapters']/table//td"); foreach ($nodes as $node){ // Query the manga $manga = $xpath->query("a[@class='chapter']", $node)->item(0); - + // Collect the chapters for each Manga $chapters = $xpath->query("a[@class='chaptersrec']", $node); @@ -251,35 +131,35 @@ class MangareaderBridge extends BridgeAbstract{ $item = new \Item(); $item->uri = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); $item->title = htmlspecialchars($manga->nodeValue); - - // Add each chapter to the feed + + // Add each chapter to the feed $item->content = ""; - + foreach ($chapters as $chapter){ if($item->content <> ""){ $item->content .= "
"; } $item->content .= "" . htmlspecialchars($chapter->nodeValue) . ""; } - + $this->items[] = $item; } } - } - + } + if($type === "popular"){ - + $pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue; $this->request = substr($pagetitle, 0, strrpos($pagetitle, " -")); // "Popular mangas for ..." - + // Query all mangas $mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']"); - - foreach ($mangas as $manga){ - + + foreach ($mangas as $manga){ + // The thumbnail is encrypted in a css-style... // format: "background-image:url('')" - $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); + $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); $thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24); $item = new \Item(); @@ -292,35 +172,35 @@ class MangareaderBridge extends BridgeAbstract{ $this->items[] = $item; } } - + if($type === "path") { - + $this->request = $xpath->query(".//*[@id='mangaproperties']//*[@class='aname']")->item(0)->nodeValue; - + $query = "(.//*[@id='listing']//tr)[position() > 1]"; - + if($limit !== -1){ $query = "(.//*[@id='listing']//tr)[position() > 1][position() > last() - " . $limit . "]"; - } - + } + $chapters = $xpath->query($query); - + foreach ($chapters as $chapter){ $item = new \Item(); $item->title = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); $item->timestamp = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue); array_unshift($this->items, $item); - } + } } - + // Return some dummy-data if no content available if(count($this->items) == 0){ $item = new \Item(); $item->content = "

No updates available

"; - + $this->items[] = $item; - } + } } public function getName(){ @@ -331,4 +211,4 @@ class MangareaderBridge extends BridgeAbstract{ return 10800; // 3 hours } } -?> \ No newline at end of file +?> diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php index 1702cad6..34fa1451 100644 --- a/bridges/MilbooruBridge.php +++ b/bridges/MilbooruBridge.php @@ -8,18 +8,13 @@ class MilbooruBridge extends BridgeAbstract{ $this->uri = "http://sheslostcontrol.net/moe/shimmie/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php index a33d7a2d..7005a408 100644 --- a/bridges/MspabooruBridge.php +++ b/bridges/MspabooruBridge.php @@ -8,18 +8,13 @@ class MspabooruBridge extends BridgeAbstract{ $this->uri = "http://mspabooru.com/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } diff --git a/bridges/NextgovBridge.php b/bridges/NextgovBridge.php index b44d766c..5c086a11 100644 --- a/bridges/NextgovBridge.php +++ b/bridges/NextgovBridge.php @@ -8,28 +8,24 @@ class NextgovBridge extends BridgeAbstract { $this->uri = 'https://www.nextgov.com/'; $this->description = 'USA Federal technology news, best practices, and web 2.0 tools.'; - $this->parameters[] = - '[ - { - "name" : "Category", - "type" : "list", - "identifier" : "category", - "values" : - [ - { "name" : "All", "value" : "all" }, - { "name" : "Technology News", "value" : "technology-news" }, - { "name" : "CIO Briefing", "value" : "cio-briefing" }, - { "name" : "Emerging Tech", "value" : "emerging-tech" }, - { "name" : "Cloud", "value" : "cloud-computing" }, - { "name" : "Cybersecurity", "value" : "cybersecurity" }, - { "name" : "Mobile", "value" : "mobile" }, - { "name" : "Health", "value" : "health" }, - { "name" : "Defense", "value" : "defense" }, - { "name" : "Big Data", "value" : "big-data" } - ] - } - ]'; - + $this->parameters[] = array( + 'category'=>array( + 'name'=>'Category', + 'type'=>'list', + 'values'=>array( + 'All'=>'all', + 'Technology News'=>'technology-news', + 'CIO Briefing'=>'cio-briefing', + 'Emerging Tech'=>'emerging-tech', + 'Cloud'=>'cloud-computing', + 'Cybersecurity'=>'cybersecurity', + 'Mobile'=>'mobile', + 'Health'=>'health', + 'Defense'=>'defense', + 'Big Data'=>'big-data' + ) + ) + ); } public function collectData(array $param) { diff --git a/bridges/NovelUpdatesBridge.php b/bridges/NovelUpdatesBridge.php index 2a99ad4c..a9dccde8 100644 --- a/bridges/NovelUpdatesBridge.php +++ b/bridges/NovelUpdatesBridge.php @@ -7,14 +7,12 @@ class NovelUpdatesBridge extends BridgeAbstract{ $this->name = "Novel Updates"; $this->uri = "http://www.novelupdates.com/"; $this->description = "Returns releases from Novel Updates"; - $this->parameters[] = - '[ - { - "name" : "Novel URL", - "identifier" : "n", - "required": true - } - ]'; + $this->parameters[] = array( + 'n'=>array( + 'name'=>'Novel URL', + 'required'=>true + ) + ); } public function collectData(array $param){ diff --git a/bridges/OpenClassroomsBridge.php b/bridges/OpenClassroomsBridge.php index d435ef9f..34866937 100644 --- a/bridges/OpenClassroomsBridge.php +++ b/bridges/OpenClassroomsBridge.php @@ -9,52 +9,23 @@ class OpenClassroomsBridge extends BridgeAbstract{ $this->description = "Returns latest tutorials from OpenClassrooms."; - $this->parameters[] = - '[ - { - "name" : "Catégorie", - "identifier" : "u", - "type" : "list", - "values" : [ - { - "name" : "Arts & Culture", - "value" : "arts" - }, - { - "name" : "Code", - "value" : "code" - }, - { - "name" : "Design", - "value" : "design" - }, - { - "name" : "Entreprise", - "value" : "business" - }, - { - "name" : "Numérique", - "value" : "digital" - }, - { - "name" : "Sciences", - "value" : "sciences" - }, - { - "name" : "Sciences Humaines", - "value" : "humainities" - }, - { - "name" : "Systèmes d\'information", - "value" : "it" - }, - { - "name" : "Autres", - "value" : "others" - } - ] - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'Catégorie', + 'type'=>'list', + 'values'=>array( + 'Arts & Culture'=>'arts', + 'Code'=>'code', + 'Design'=>'design', + 'Entreprise'=>'business', + 'Numérique'=>'digital', + 'Sciences'=>'sciences', + 'Sciences Humaines'=>'humainities', + 'Systèmes d\'information'=>'it', + 'Autres'=>'others' + ) + ) + ); } diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php index 43149cd7..8cab0112 100644 --- a/bridges/ParuVenduImmoBridge.php +++ b/bridges/ParuVenduImmoBridge.php @@ -12,31 +12,21 @@ class ParuVenduImmoBridge extends BridgeAbstract $this->description = "Returns the ads from the first page of search result."; - $this->parameters[] = - '[ - { - "name": "Minimal surface m²", - "type" : "number", - "identifier" : "minarea" - }, - { - "name" : "Max price", - "type" : "number", - "identifier" : "maxprice" - }, - { - "name" : "Country code", - "type" : "text", - "identifier" : "pa", - "exampleValue" : "FR" - }, - { - "name" : "department numbers or postal codes, comma-separated", - "type" : "text", - "identifier" : "lo" - } - - ]'; + $this->parameters[] = array( + 'minarea'=>array( + 'name'=>'Minimal surface m²', + 'type'=>'number' + ), + 'maxprice'=>array( + 'name'=>'Max price', + 'type'=>'number' + ), + 'pa'=>array( + 'name'=>'Country code', + 'exampleValue'=>'FR' + ), + 'lo'=>array('name'=>'department numbers or postal codes, comma-separated') + ); } public function collectData(array $param) diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index c26a1ebe..66d97ff6 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -12,29 +12,20 @@ class PickyWallpapersBridge extends BridgeAbstract { $this->uri = "http://www.pickywallpapers.com/"; $this->description = "Returns the latests wallpapers from PickyWallpapers"; - $this->parameters[] = - '[ - { - "name" : "Category", - "identifier" : "c" - }, - { - "name" : "subcategory", - "identifier" : "s" - }, - { - "name" : "Max number of wallpapers", - "identifier" : "m", - "type" : "number" - }, - { - "name" : "resolution", - "identifier" : "r", - "exampleValue" : "1920x1200, 1680x1050, ...", - "pattern" : "[0-9]{3,4}x[0-9]{3,4}" - } + $this->parameters[] = array( + 'c'=>array('name'=>'category'), + 's'=>array('name'=>'subcategory'), + 'm'=>array( + 'name'=>'Max number of wallpapers', + 'type'=>'number' + ), + 'r'=>array( + 'name'=>'resolution', + 'exampleValue'=>'1920x1200, 1680x1050,…', + 'pattern'=>'[0-9]{3,4}x[0-9]{3,4}' + ) + ); - ]'; } public function collectData(array $param){ diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 7d4a6684..2cf2f00a 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -12,26 +12,14 @@ class PinterestBridge extends BridgeAbstract{ $this->uri = "http://www.pinterest.com"; $this->description = "Returns the newest images on a board"; - $this->parameters["By username and board"] = - '[ - { - "name" : "username", - "identifier" : "u" - }, - { - "name" : "board", - "identifier" : "b" + $this->parameters["By username and board"] = array( + 'u'=>array('name'=>'username'), + 'b'=>array('name'=>'board') + ); - } - ]'; - - $this->parameters["From search"] = - '[ - { - "name" : "Keyword", - "identifier" : "q" - } - ]'; + $this->parameters["From search"] = array( + 'q'=>array('name'=>'Keyword') + ); } public function collectData(array $param){ diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php index 310f289f..4c6e6c80 100644 --- a/bridges/RTBFBridge.php +++ b/bridges/RTBFBridge.php @@ -6,16 +6,13 @@ class RTBFBridge extends BridgeAbstract { $this->description = "Returns the newest RTBF videos by series ID"; $this->maintainer = "Frenzie"; - $this->parameters[] = - '[ - { - "type" : "text", - "identifier" : "c", - "name" : "series id", - "exampleValue" : "9500", - "required" : true - } - ]'; + $this->parameters[] = array( + 'c'=>array( + 'name'=>'series id', + 'exampleValue'=>9500, + 'required'=>true + ) + ); } public function collectData(array $param) { diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php index 1e2323d9..96362402 100644 --- a/bridges/Rule34Bridge.php +++ b/bridges/Rule34Bridge.php @@ -8,18 +8,14 @@ class Rule34Bridge extends BridgeAbstract{ $this->uri = "http://rule34.xxx/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); + } public function collectData(array $param){ diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php index 17209fc7..43d6a71d 100644 --- a/bridges/Rule34pahealBridge.php +++ b/bridges/Rule34pahealBridge.php @@ -8,18 +8,13 @@ class Rule34pahealBridge extends BridgeAbstract{ $this->uri = "http://rule34.paheal.net/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php index b4c64f2d..a3e3ec87 100644 --- a/bridges/SafebooruBridge.php +++ b/bridges/SafebooruBridge.php @@ -8,18 +8,13 @@ class SafebooruBridge extends BridgeAbstract{ $this->uri = "http://safebooru.org/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php index e1c13a12..e2ce7f95 100644 --- a/bridges/SakugabooruBridge.php +++ b/bridges/SakugabooruBridge.php @@ -8,18 +8,14 @@ class SakugabooruBridge extends BridgeAbstract{ $this->uri = "http://sakuga.yshi.org/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); + } public function collectData(array $param){ diff --git a/bridges/ScoopItBridge.php b/bridges/ScoopItBridge.php index 248c9357..60d04168 100644 --- a/bridges/ScoopItBridge.php +++ b/bridges/ScoopItBridge.php @@ -8,14 +8,12 @@ class ScoopItBridge extends BridgeAbstract{ $this->uri = "http://www.scoop.it"; $this->description = "Returns most recent results from ScoopIt."; - $this->parameters[] = - '[ - { - "name" : "keyword", - "identifier" : "u", - "required": true - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'keyword', + 'required'=>true + ) + ); } diff --git a/bridges/SensCritiqueBridge.php b/bridges/SensCritiqueBridge.php index c51cccb4..a051ea2d 100644 --- a/bridges/SensCritiqueBridge.php +++ b/bridges/SensCritiqueBridge.php @@ -9,40 +9,33 @@ class SensCritiqueBridge extends BridgeAbstract { $this->uri = "http://www.senscritique.com"; $this->description = "Sens Critique news"; - $this->parameters[] = - '[ - { - "name" : "Movies", - "identifier" : "m", - "type": "checkbox" - }, - { - "name" : "Series", - "identifier" : "s", - "type": "checkbox" - }, - { - "name" : "Video Games", - "identifier" : "g", - "type": "checkbox" - }, - { - "name" : "Books", - "identifier" : "b", - "type": "checkbox" - }, - { - "name" : "BD", - "identifier" : "bd", - "type": "checkbox" - }, - { - "name" : "Music", - "identifier" : "mu", - "type": "checkbox" - } - ]'; - } + $this->parameters[] = array( + 'm'=>array( + 'name'=>'Movies', + 'type'=>'checkbox' + ), + 's'=>array( + 'name'=>'Series', + 'type'=>'checkbox' + ), + 'g'=>array( + 'name'=>'Video Games', + 'type'=>'checkbox' + ), + 'b'=>array( + 'name'=>'Books', + 'type'=>'checkbox' + ), + 'bd'=>array( + 'name'=>'BD', + 'type'=>'checkbox' + ), + 'mu'=>array( + 'name'=>'Music', + 'type'=>'checkbox' + ) + ); + } public function collectData(array $param) { if ((isset($param['m']) && $param['m'])) { diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 01a60912..64df0790 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -11,14 +11,12 @@ class SoundCloudBridge extends BridgeAbstract{ $this->uri = "http://www.soundcloud.com/"; $this->description = "Returns 10 newest music from user profile"; - $this->parameters[] = - '[ - { - "name" : "username", - "identifier" : "u", - "required": true - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'username', + 'required'=>true + ) + ); } diff --git a/bridges/SuperbWallpapersBridge.php b/bridges/SuperbWallpapersBridge.php index 74eab646..4a6bba08 100644 --- a/bridges/SuperbWallpapersBridge.php +++ b/bridges/SuperbWallpapersBridge.php @@ -11,24 +11,17 @@ class SuperbWallpapersBridge extends BridgeAbstract { $this->uri = "http://www.superbwallpapers.com/"; $this->description = "Returns the latests wallpapers from SuperbWallpapers"; - $this->parameters[] = - '[ - { - "name" : "Category", - "identifier" : "c" - }, - { - "name" : "Max number of wallpapers", - "identifier" : "m", - "type" : "number" - }, - { - "name" : "resolution", - "identifier" : "r", - "exampleValue" : "1920x1200, 1680x1050, ..." - } - - ]'; + $this->parameters[] = array( + 'c'=>array('name'=>'category'), + 'm'=>array( + 'name'=>'Max number of wallpapers', + 'type'=>'number' + ), + 'r'=>array( + 'name'=>'resolution', + 'exampleValue'=>'1920x1200, 1680x1050,…' + ) + ); } diff --git a/bridges/T411Bridge.php b/bridges/T411Bridge.php index 8d880c5d..0d54062f 100644 --- a/bridges/T411Bridge.php +++ b/bridges/T411Bridge.php @@ -8,14 +8,12 @@ class T411Bridge extends BridgeAbstract { $this->uri = 'https://t411.ch/'; $this->description = 'Returns the 10 newest torrents with specified search terms
Use url part after "?" mark when using their search engine.'; - $this->parameters[] = - '[ - { - "name" : "Search criteria", - "identifier" : "search", - "required": true - } - ]'; + $this->parameters[] = array( + 'search'=>array( + 'name'=>'Search criteria', + 'required'=>true + ) + ); } public function collectData(array $param) { diff --git a/bridges/TagBoardBridge.php b/bridges/TagBoardBridge.php index 05c3807a..4fb4f2f6 100644 --- a/bridges/TagBoardBridge.php +++ b/bridges/TagBoardBridge.php @@ -8,14 +8,12 @@ class TagBoardBridge extends BridgeAbstract{ $this->uri = "http://www.TagBoard.com"; $this->description = "Returns most recent results from TagBoard."; - $this->parameters[] = - '[ - { - "name" : "keyword", - "identifier" : "u", - "required" :true - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'keyword', + 'required'=>true + ) + ); } diff --git a/bridges/TbibBridge.php b/bridges/TbibBridge.php index dfa1a158..eff0f65e 100644 --- a/bridges/TbibBridge.php +++ b/bridges/TbibBridge.php @@ -8,18 +8,13 @@ class TbibBridge extends BridgeAbstract{ $this->uri = "http://tbib.org/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/ThePirateBayBridge.php b/bridges/ThePirateBayBridge.php index f3de6bf8..77036d37 100644 --- a/bridges/ThePirateBayBridge.php +++ b/bridges/ThePirateBayBridge.php @@ -8,14 +8,12 @@ class ThePirateBayBridge extends BridgeAbstract{ $this->uri = "https://thepiratebay.org/"; $this->description = "Returns results for the keywords. You can put several list of keywords by separating them with a semicolon (e.g. \"one show;another show\")"; - $this->parameters[] = - '[ - { - "name" : "keywords, separated by semicolons", - "identifier" : "q", - "exampleValue" : "first list;second list;..." - } - ]'; + $this->parameters[] = array( + 'q'=>array( + 'name'=>'keywords, separated by semicolons', + 'exampleValue'=>'first list;second list;…' + ) + ); } public function collectData(array $param){ diff --git a/bridges/TwitchApiBridge.php b/bridges/TwitchApiBridge.php index 35c2920c..f86c616c 100644 --- a/bridges/TwitchApiBridge.php +++ b/bridges/TwitchApiBridge.php @@ -14,64 +14,45 @@ class TwitchApiBridge extends BridgeAbstract{ $this->uri = "http://www.twitch.tv"; $this->description = "Returns the newest broadcasts or highlights by channel name using the Twitch API (v3)"; - $this->parameters["Get channel without limit"] = - '[ - { - "name" : "Channel", - "identifier" : "channel", - "required" : true - }, - { - "name" : "Broadcasts", - "identifier" : "broadcasts", - "type" : "list", - "values" : [ - { - "name" : "Show broadcasts", - "value" : "true" - }, - { - "name" : "Show highlights", - "value" : "false" - } - ] - } - ]'; - $this->parameters["Get channel with limit"] = - '[ - { - "name" : "Channel", - "identifier" : "channel", - "required" : true - }, - { - "name" : "Limit", - "identifier" : "limit", - "type" : "number" - }, - { - "name" : "Broadcasts", - "identifier" : "broadcasts", - "type" : "list", - "values" : [ - { - "name" : "Show broadcasts", - "value" : "true" - }, - { - "name" : "Show highlights", - "value" : "false" - } - ] - } - ]'; + $this->parameters["Get channel without limit"] = array( + 'channel'=>array( + 'name'=>'Channel', + 'required'=>true + ), + 'broadcasts'=>array( + 'name'=>'Broadcasts', + 'type'=>'list', + 'values'=>array( + 'Show broadcasts'=>'true', + 'Show highlights'=>'false' + ) + ) + ); + $this->parameters["Get channel with limit"] = array( + 'channel'=>array( + 'name'=>'Channel', + 'required'=>true + ), + 'limit'=>array( + 'name'=>'Limit', + 'type'=>'number' + ), + 'broadcasts'=>array( + 'name'=>'Broadcasts', + 'type'=>'list', + 'values'=>array( + 'Show broadcasts'=>'true', + 'Show highlights'=>'false' + ) + ) + ); } - + public function collectData(array $param){ - /* In accordance with API description: - * "When specifying a version for a request to the Twitch API, set the Accept HTTP header to the API version you prefer." + /* In accordance with API description: + * "When specifying a version for a request to the Twitch API, set the Accept HTTP header to the API version you prefer." * Now we prefer v3 right now and need to build the context options. */ $opts = array('https' => array( @@ -79,22 +60,22 @@ class TwitchApiBridge extends BridgeAbstract{ 'header' => 'Accept: application/vnd.twitchtv.v3+json' ) ); - + $context = stream_context_create($opts); - + $channel = ''; $limit = TWITCH_LIMIT; $broadcasts = TWITCH_BROADCASTS; $requests = 1; - + if(isset($param['channel'])) { $channel = $param['channel']; } else { $this->returnClientError('You must specify a valid channel name! Received: &channel=' . $param['channel']); } - + $this->channel = $channel; - + if(isset($param['limit'])) { try { $limit = (int)$param['limit']; @@ -104,39 +85,39 @@ class TwitchApiBridge extends BridgeAbstract{ } else { $limit = TWITCH_LIMIT; } - + // The Twitch API allows a limit between 1 .. 100. Therefore any value below must be set to 1, any greater must result in multiple requests. if($limit < 1) { $limit = 1; } - if($limit > 100) { - $requests = (int)($limit / 100); + if($limit > 100) { + $requests = (int)($limit / 100); if($limit % 100 != 0) { $requests++; } } - + if(isset($param['broadcasts']) && ($param['broadcasts'] == 'true' || $param['broadcasts'] == 'false')) { $broadcasts = $param['broadcasts']; } else { $this->returnClientError('The value for broadcasts you specified is not valid! Received: &broadcasts=' . $param['broadcasts'] . ' Expected: &broadcasts=false or &broadcasts=true'); } - + // Build the initial request, see also: https://github.com/justintv/Twitch-API/blob/master/v3_resources/videos.md#get-channelschannelvideos $request = ''; - + if($requests == 1) { $request = 'https://api.twitch.tv/kraken/channels/' . $channel . '/videos?limit=' . $limit . '&broadcasts=' . $broadcasts; } else { $request = 'https://api.twitch.tv/kraken/channels/' . $channel . '/videos?limit=100&broadcasts=' . $broadcasts; } - + /* Finally we're ready to request data from the API. Each response provides information for the next request. */ for($i = 0; $i < $requests; $i++) { $response = $this->getSimpleHTMLDOM($request, false, $context); - - if($response == false) { - $this->returnServerError('Request failed! Check if the channel name is valid!'); + + if($response == false) { + $this->returnServerError('Request failed! Check if the channel name is valid!'); } - + $data = json_decode($response); - + foreach($data->videos as $video) { $item = new \Item(); $item->id = $video->_id; @@ -145,13 +126,13 @@ class TwitchApiBridge extends BridgeAbstract{ $item->timestamp = strtotime($video->recorded_at); $item->content = '
' . $item->title . ''; $this->items[] = $item; - + // Stop once the number of requested items is reached if(count($this->items) >= $limit) { break; } } - + // Get next request (if available) if(isset($data->_links->next)) { $request = $data->_links->next; diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 6edfc7a4..3e2a8c36 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -8,50 +8,36 @@ class TwitterBridge extends BridgeAbstract{ $this->uri = "https://twitter.com/"; $this->description = "Returns tweets by keyword/hashtag or user name"; - $this->parameters["global"] = - '[ - { - "name" : "Hide profile pictures", - "identifier" : "nopic", - "type" : "checkbox", - "required" : false, - "exampleValue" : "checked", - "title" : "Activate to hide profile pictures in content" - } - ]'; + $this->parameters["global"] = array( + 'nopic'=>array( + 'name'=>'Hide profile pictures', + 'type'=>'checkbox', + 'title'=>'Activate to hide profile pictures in content' + ) + ); - $this->parameters["By keyword or hashtag"] = - '[ - { - "name" : "Keyword or #hashtag", - "identifier" : "q", - "type" : "text", - "required" : true, - "exampleValue" : "rss-bridge, #rss-bridge", - "title" : "Insert a keyword or hashtag" - } - ]'; - - $this->parameters["By username"] = - '[ - { - "name" : "username", - "identifier" : "u", - "type" : "text", - "required" : true, - "exampleValue" : "sebsauvage", - "title" : "Insert a user name" - }, - { - "name" : "Without replies", - "identifier" : "norep", - "type" : "checkbox", - "required" : false, - "exampleValue" : "checked", - "title" : "Only return initial tweets" - } - ]'; + $this->parameters["By keyword or hashtag"] = array( + 'q'=>array( + 'name'=>'Keyword or #hashtag', + 'required'=>true, + 'exampleValue'=>'rss-bridge, #rss-bridge', + 'title'=>'Insert a keyword or hashtag' + ) + ); + $this->parameters["By username"] = array( + 'u'=>array( + 'name'=>'username', + 'required'=>true, + 'exampleValue'=>'sebsauvage', + 'title'=>'Insert a user name' + ), + 'norep'=>array( + 'name'=>'Without replies', + 'type'=>'checkbox', + 'title'=>'Only return initial tweets' + ) + ); } public function collectData(array $param){ diff --git a/bridges/UnsplashBridge.php b/bridges/UnsplashBridge.php index 23383d6c..f9d1e34c 100644 --- a/bridges/UnsplashBridge.php +++ b/bridges/UnsplashBridge.php @@ -8,26 +8,20 @@ class UnsplashBridge extends BridgeAbstract { $this->uri = "http://unsplash.com/"; $this->description = "Returns the latests photos from Unsplash"; - $this->parameters[] = - '[ - { - "name" : "Max number of photos", - "identifier" : "m", - "type" : "number" - }, - { - "name" : "Width", - "identifier" : "w", - "exampleValue" : "1920, 1680, ..." - }, - { - "name" : "JPEG quality", - "identifier" : "q", - "type" : "number" - - } - - ]'; + $this->parameters[] = array( + 'm'=>array( + 'name'=>'Max number of photos', + 'type'=>'number' + ), + 'w'=>array( + 'name'=>'Width', + 'exampleValue'=>'1920, 1680, …' + ), + 'q'=>array( + 'name'=>'JPEG quality', + 'type'=>'number' + ) + ); } public function collectData(array $param){ diff --git a/bridges/ViadeoCompany.php b/bridges/ViadeoCompany.php index 88466afd..d491a056 100644 --- a/bridges/ViadeoCompany.php +++ b/bridges/ViadeoCompany.php @@ -8,14 +8,12 @@ class ViadeoCompany extends BridgeAbstract{ $this->uri = "https://www.viadeo.com/"; $this->description = "Returns most recent actus from Company on Viadeo. (http://www.viadeo.com/fr/company/apple)"; - $this->parameters[] = - '[ - { - "name" : "Company name", - "identifier" : "c", - "required" : true - } - ]'; + $this->parameters[] = array( + 'c'=>array( + 'name'=>'Company name', + 'required'=>true + ) + ); } public function collectData(array $param){ diff --git a/bridges/VineBridge.php b/bridges/VineBridge.php index ff16d873..679ff05b 100644 --- a/bridges/VineBridge.php +++ b/bridges/VineBridge.php @@ -8,15 +8,12 @@ class VineBridge extends BridgeAbstract { $this->uri = "http://vine.co/"; $this->description = "Returns the latests vines from vine user page"; - $this->parameters[] = - '[ - { - "name" : "User id", - "identifier" : "u", - "type" : "text", - "required" : true - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'User id', + 'required'=>true + ) + ); } public function collectData(array $param){ diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index 37194d9b..c936a735 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -9,13 +9,12 @@ class VkBridge extends BridgeAbstract { $this->name = "VK.com"; $this->uri = "http://www.vk.com/"; $this->description = "Working with open pages"; - $this->parameters["Url on page group or user"] = '[ - { - "name" : "Url", - "identifier" : "u", - "required" : true - } - ]'; + $this->parameters["Url on page group or user"] = array( + 'u'=>array( + 'name'=>'Url', + 'required'=>true + ) + ); } public function collectData(array $param) { diff --git a/bridges/WallpaperStopBridge.php b/bridges/WallpaperStopBridge.php index 0f5da00d..70c84e40 100644 --- a/bridges/WallpaperStopBridge.php +++ b/bridges/WallpaperStopBridge.php @@ -12,29 +12,18 @@ class WallpaperStopBridge extends BridgeAbstract { $this->uri = "http://www.wallpaperstop.com/"; $this->description = "Returns the latests wallpapers from WallpaperStop"; - $this->parameters[] = - '[ - { - "name" : "Category", - "identifier" : "c" - }, - { - "name" : "subcategory", - "identifier" : "s" - }, - { - "name" : "Max number of wallpapers", - "identifier" : "m", - "type" : "number" - }, - { - "name" : "resolution", - "identifier" : "r", - "exampleValue" : "1920x1200, 1680x1050, ..." - } - - ]'; - + $this->parameters[] = array( + 'c'=>array('name'=>'Category'), + 's'=>array('name'=>'subcategory'), + 'm'=>array( + 'name'=>'Max number of wallpapers', + 'type'=>'number' + ), + 'r'=>array( + 'name'=>'resolution', + 'exampleValue'=>'1920x1200, 1680x1050,…', + ) + ); } diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php index 568e2ded..0e9d82b8 100644 --- a/bridges/WhydBridge.php +++ b/bridges/WhydBridge.php @@ -11,14 +11,12 @@ class WhydBridge extends BridgeAbstract{ $this->uri = "http://www.whyd.com/"; $this->description = "Returns 10 newest music from user profile"; - $this->parameters[] = - '[ - { - "name" : "username/id", - "identifier" : "u", - "required" :true - } - ]'; + $this->parameters[] = array( + 'u'=>array( + 'name'=>'username/id', + 'required'=>true + ) + ); } diff --git a/bridges/WikipediaBridge.php b/bridges/WikipediaBridge.php index 10a74f77..5c6909c6 100644 --- a/bridges/WikipediaBridge.php +++ b/bridges/WikipediaBridge.php @@ -10,73 +10,49 @@ class WikipediaBridge extends BridgeAbstract{ $this->uri = 'https://www.wikipedia.org/'; $this->description = 'Returns articles for a language of your choice'; - $this->parameters[] = - '[ - { - "name": "Language", - "identifier": "language", - "type": "list", - "required": true, - "title": "Select your language", - "exampleValue": "English", - "values": [ - { - "name": "English", - "value": "en" - }, - { - "name": "German", - "value": "de" - }, - { - "name": "French", - "value": "fr" - }, - { - "name": "Esperanto", - "value": "eo" - } - ] - }, - { - "name": "Subject", - "identifier": "subject", - "type": "list", - "required": true, - "title": "What subject are you interested in?", - "exampleValue": "Today\'s featured article", - "values": [ - { - "name": "Today\'s featured article", - "value": "tfa" - }, - { - "name": "Did you know...", - "value": "dyk" - } - ] - }, - { - "name": "Load full article", - "identifier": "fullarticle", - "type": "checkbox", - "required": false, - "title": "Activate to always load the full article", - "exampleValue": "false" - } - ]'; + $this->parameters[] = array( + 'language'=>array( + 'name'=>'Language', + 'type'=>'list', + 'required'=>true, + 'title'=>'Select your language', + 'exampleValue'=>'English', + 'values'=>array( + 'English'=>'en', + 'German'=>'de', + 'French'=>'fr', + 'Esperanto'=>'es' + ) + ), + 'subject'=>array( + 'name'=>'Subject', + 'type'=>'list', + 'required'=>true, + 'title'=>'What subject are you interested in?', + 'exampleValue'=>'Today\'s featured article', + 'values'=>array( + 'Today\'s featured article'=>'tfa', + 'Did you know…'=>'dyk' + ) + ), + 'fullarticle'=>array( + 'name'=>'Load full article', + 'type'=>'checkbox', + 'title'=>'Activate to always load the full article' + ) + ); } public function collectData(array $params){ if(!isset($params['language'])) $this->returnClientError('You must specify a valid language via \'&language=\'!'); - + if(!$this->CheckLanguageCode(strtolower($params['language']))) $this->returnClientError('The language code you provided (\'' . $params['language'] . '\') is not supported!'); - + if(!isset($params['subject'])) $this->returnClientError('You must specify a valid subject via \'&subject=\'!'); - + $subject = WIKIPEDIA_SUBJECT_TFA; switch($params['subject']){ case 'tfa': @@ -116,7 +92,7 @@ class WikipediaBridge extends BridgeAbstract{ if(!$html) $this->returnServerError('Could not load site: ' . $this->uri . '!'); - /* + /* * Now read content depending on the language (make sure to create one function per language!) * We build the function name automatically, just make sure you create a private function ending * with your desired language code, where the language code is upper case! (en -> GetContentsEN). @@ -125,25 +101,24 @@ class WikipediaBridge extends BridgeAbstract{ if(!method_exists($this, $function)) $this->returnServerError('A function to get the contents for your langauage is missing (\'' . $function . '\')!'); - + /* * The method takes care of creating all items. */ $this->$function($html, $subject, $fullArticle); } - /** + /** * Returns true if the language code is part of the parameters list */ private function CheckLanguageCode($languageCode){ - $parameter = json_decode($this->parameters[0], true); - $languages = $parameter[0]['values']; + $languages = $this->parameters[0]['language']['values']; $language_names = array(); - foreach($languages as $language) - $language_names[] = $language['value']; - + foreach($languages as $name=>$value) + $language_names[] = $value; + return in_array($languageCode, $language_names); } @@ -169,7 +144,7 @@ class WikipediaBridge extends BridgeAbstract{ if(strpos($anchor->innertext, '...') !== false){ $target = $anchor; break; - } + } } $item = new \Item(); @@ -178,7 +153,7 @@ class WikipediaBridge extends BridgeAbstract{ if(!$fullArticle) $item->content = strip_tags($this->ReplaceURIInHTMLElement($element), '


'); - else + else $item->content = $this->LoadFullArticle($item->uri); $this->items[] = $item; @@ -190,14 +165,14 @@ class WikipediaBridge extends BridgeAbstract{ private function AddDidYouKnowGeneric($element, $fullArticle){ foreach($element->find('ul', 0)->find('li') as $entry){ $item = new \Item(); - + // We can only use the first anchor, there is no way of finding the 'correct' one if there are multiple $item->uri = $this->uri . $entry->find('a', 0)->href; $item->title = strip_tags($entry->innertext); if(!$fullArticle) $item->content = $this->ReplaceURIInHTMLElement($entry); - else + else $item->content = $this->LoadFullArticle($item->uri); $this->items[] = $item; @@ -209,15 +184,15 @@ class WikipediaBridge extends BridgeAbstract{ */ private function LoadFullArticle($uri){ $content_html = $this->getSimpleHTMLDOM($uri); - + if(!$content_html) $this->returnServerError('Could not load site: ' . $uri . '!'); - + $content = $content_html->find('#mw-content-text', 0); if(!$content) $this->returnServerError('Could not find content in page: ' . $uri . '!'); - + // Let's remove a couple of things from the article $table = $content->find('#toc', 0); // Table of contents if(!$table === false) @@ -234,7 +209,7 @@ class WikipediaBridge extends BridgeAbstract{ */ private function GetContentsDE($html, $subject, $fullArticle){ switch($subject){ - case WIKIPEDIA_SUBJECT_TFA: + case WIKIPEDIA_SUBJECT_TFA: $element = $html->find('div[id=mf-tfa]', 0); $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle); break; @@ -252,7 +227,7 @@ class WikipediaBridge extends BridgeAbstract{ */ private function GetContentsFR($html, $subject, $fullArticle){ switch($subject){ - case WIKIPEDIA_SUBJECT_TFA: + case WIKIPEDIA_SUBJECT_TFA: $element = $html->find('div[id=accueil-lumieresur]', 0); $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle); break; @@ -270,7 +245,7 @@ class WikipediaBridge extends BridgeAbstract{ */ private function GetContentsEN($html, $subject, $fullArticle){ switch($subject){ - case WIKIPEDIA_SUBJECT_TFA: + case WIKIPEDIA_SUBJECT_TFA: $element = $html->find('div[id=mp-tfa]', 0); $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle); break; @@ -288,7 +263,7 @@ class WikipediaBridge extends BridgeAbstract{ */ private function GetContentsEO($html, $subject, $fullArticle){ switch($subject){ - case WIKIPEDIA_SUBJECT_TFA: + case WIKIPEDIA_SUBJECT_TFA: $element = $html->find('div[id=mf-artikolo-de-la-semajno]', 0); $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle); break; diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index eaa3e647..70e17ee4 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -13,14 +13,12 @@ class WordPressBridge extends BridgeAbstract { $this->uri = "https://wordpress.org/"; $this->description = "Returns the 3 newest full posts of a Wordpress blog"; - $this->parameters[] = - '[ - { - "name" : "blog URL", - "required" : true, - "identifier" : "url" - } - ]'; + $this->parameters[] = array( + 'url'=>array( + 'name'=>'Blog URL', + 'required'=>true + ) + ); } // Returns the content type for a given html dom diff --git a/bridges/WorldOfTanks.php b/bridges/WorldOfTanks.php index 5d84b268..5601d834 100644 --- a/bridges/WorldOfTanks.php +++ b/bridges/WorldOfTanks.php @@ -13,50 +13,25 @@ class WorldOfTanks extends HttpCachingBridgeAbstract{ $this->uri = "http://worldoftanks.eu/"; $this->description = "News about the tank slaughter game."; - $this->parameters[] = - '[ - { - "name" : "ID de la catégorie", - "type" : "number", - "identifier" : "category" - }, - { - "name" : "Langue", - "identifier" : "lang", - "type" : "list", - "values" : [ - { - "name" : "Français", - "value" : "fr" - }, - { - "name" : "English", - "value" : "en" - }, - { - "name" : "Español", - "value" : "es" - }, - { - "name" : "Deutsch", - "value" : "de" - }, - { - "name" : "Čeština", - "value" : "cs" - }, - { - "name" : "Polski", - "value" : "pl" - }, - { - "name" : "Türkçe", - "value" : "tr" - } - ] - - } - ]'; + $this->parameters[] = array( + 'category'=>array( + 'name'=>'ID de la catégorie', + 'type'=>'number' + ), + 'lang'=>array( + 'name'=>'Langue', + 'type'=>'list', + 'values'=>array( + 'Français'=>'fr', + 'English'=>'en', + 'Español'=>'es', + 'Deutsch'=>'de', + 'Čeština'=>'cs', + 'Polski'=>'pl', + 'Türkçe'=>'tr' + ) + ) + ); } diff --git a/bridges/XbooruBridge.php b/bridges/XbooruBridge.php index 4d8543bf..28e6226d 100644 --- a/bridges/XbooruBridge.php +++ b/bridges/XbooruBridge.php @@ -8,18 +8,13 @@ class XbooruBridge extends BridgeAbstract{ $this->uri = "http://xbooru.com/"; $this->description = "Returns images from given page"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/YandereBridge.php b/bridges/YandereBridge.php index c7aa3090..0b894294 100644 --- a/bridges/YandereBridge.php +++ b/bridges/YandereBridge.php @@ -8,18 +8,13 @@ class YandereBridge extends BridgeAbstract{ $this->uri = "https://yande.re/"; $this->description = "Returns images from given page and tags"; - $this->parameters[] = - '[ - { - "name" : "page", - "identifier" : "p", - "type" : "number" - }, - { - "name" : "tags", - "identifier" : "t" - } - ]'; + $this->parameters[] = array( + 'p'=>array( + 'name'=>'page', + 'type'=>'number' + ), + 't'=>array('name'=>'tags') + ); } public function collectData(array $param){ diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php index 5a46cf51..ed032537 100644 --- a/bridges/YoutubeBridge.php +++ b/bridges/YoutubeBridge.php @@ -15,55 +15,40 @@ class YoutubeBridge extends BridgeAbstract { $this->description = 'Returns the 10 newest videos by username/channel/playlist or search'; $this->maintainer = 'mitsukarenai'; - $this->parameters['By username'] = - '[ - { - "type" : "text", - "identifier" : "u", - "name" : "username", - "exampleValue" : "test", - "required" : true - } - ]'; + $this->parameters['By username'] = array( + 'u'=>array( + 'name'=>'username', + 'exampleValue'=>'test', + 'required'=>true + ) + ); - $this->parameters['By channel id'] = - '[ - { - "type" : "text", - "identifier" : "c", - "name" : "channel id", - "exampleValue" : "15", - "required" : true - } - ]'; + $this->parameters['By channel id'] = array( + 'c'=>array( + 'name'=>'channel id', + 'exampleValue'=>"15", + 'required'=>true + ) + ); - $this->parameters['By playlist Id'] = - '[ - { - "type" : "text", - "identifier" : "p", - "name" : "playlist id", - "exampleValue" : "15" - } - ]'; + $this->parameters['By playlist Id'] = array( + 'p'=>array( + 'name'=>'playlist id', + 'exampleValue'=>"15" + ) + ); - $this->parameters['Search result'] = - '[ - { - "type" : "text", - "identifier" : "s", - "name" : "search keyword", - "exampleValue" : "test" - - }, - { - "type" : "number", - "identifier" : "pa", - "name" : "page", - "exampleValue" : "1" - - } - ]'; + $this->parameters['Search result'] = array( + 's'=>array( + 'name'=>'search keyword', + 'exampleValue'=>'test' + ), + 'pa'=>array( + 'name'=>'page', + 'type'=>'number', + 'exampleValue'=>1 + ) + ); } private function ytBridgeQueryVideoInfo($vid, &$author, &$desc, &$time) { diff --git a/bridges/ZDNetBridge.php b/bridges/ZDNetBridge.php index 6b14eaa6..1ef71bbf 100644 --- a/bridges/ZDNetBridge.php +++ b/bridges/ZDNetBridge.php @@ -8,173 +8,158 @@ class ZDNetBridge extends BridgeAbstract { $this->uri = 'http://www.zdnet.com/'; $this->description = 'Technology News, Analysis, Comments and Product Reviews for IT Professionals.'; - $this->parameters[] = // http://www.zdnet.com/zdnet.opml - '[ - { - "name" : "Feed", - "type" : "list", - "identifier" : "feed", - "values" : - [ - { "name" : "---- Select ----", "value" : "" }, - - { "name" : "", "value" : "" }, - { "name" : "Subscribe to ZDNet RSS Feeds", "value" : "" }, - - { "name" : "    All Blogs", "value" : "blog" }, - { "name" : "    Just News", "value" : "news" }, - { "name" : "    All Reviews", "value" : "topic/reviews" }, - { "name" : "    Latest Downloads", "value" : "downloads!recent" }, - { "name" : "    Latest Articles", "value" : "/" }, - { "name" : "    Latest Australia Articles", "value" : "au" }, - { "name" : "    Latest UK Articles", "value" : "uk" }, - { "name" : "    Latest US Articles", "value" : "us" }, - { "name" : "    Latest Asia Articles", "value" : "as" }, - - { "name" : "", "value" : "" }, - { "name" : "Keep up with ZDNet Blogs RSS:", "value" : "" }, - - { "name" : "    Transforming the Datacenter", "value" : "blog/transforming-datacenter" }, - { "name" : "    SMB India", "value" : "blog/smb-india" }, - { "name" : "    Indonesia BizTech", "value" : "blog/indonesia-biztech" }, - { "name" : "    Hong Kong Techie", "value" : "blog/hong-kong-techie" }, - { "name" : "    Tech Taiwan", "value" : "blog/tech-taiwan" }, - { "name" : "    Startup India", "value" : "blog/startup-india" }, - { "name" : "    Starting Up Asia", "value" : "blog/starting-up-asia" }, - { "name" : "    Next-Gen Partner", "value" : "blog/partner" }, - { "name" : "    Post-PC Developments", "value" : "blog/post-pc" }, - { "name" : "    Benelux", "value" : "blog/benelux" }, - { "name" : "    Heat Sink", "value" : "blog/heat-sink" }, - { "name" : "    Italy's got tech", "value" : "blog/italy" }, - { "name" : "    African Enterprise", "value" : "blog/african-enterprise" }, - { "name" : "    New Tech for Old India", "value" : "blog/new-india" }, - { "name" : "    Estonia Uncovered", "value" : "blog/estonia" }, - { "name" : "    IT Iberia", "value" : "blog/iberia" }, - { "name" : "    Brazil Tech", "value" : "blog/brazil" }, - { "name" : "    500 words into the future", "value" : "blog/500-words-into-the-future" }, - { "name" : "    ÜberTech", "value" : "blog/ubertech" }, - { "name" : "    All About Microsoft", "value" : "blog/microsoft" }, - { "name" : "    Back office", "value" : "blog/back-office" }, - { "name" : "    Barker Bites Back", "value" : "blog/barker-bites-back" }, - { "name" : "    Between the Lines", "value" : "blog/btl" }, - { "name" : "    Big on Data", "value" : "blog/big-data" }, - { "name" : "    bootstrappr", "value" : "blog/bootstrappr" }, - { "name" : "    By The Way", "value" : "blog/by-the-way" }, - { "name" : "    Central European Processing", "value" : "blog/central-europe" }, - { "name" : "    Cloud Builders", "value" : "blog/cloud-builders" }, - { "name" : "    Communication Breakdown", "value" : "blog/communication-breakdown" }, - { "name" : "    Collaboration 2.0", "value" : "blog/collaboration" }, - { "name" : "    Constellation Research", "value" : "blog/constellation" }, - { "name" : "    Consumerization: BYOD", "value" : "blog/consumerization" }, - { "name" : "    DIY-IT", "value" : "blog/diy-it" }, - { "name" : "    Enterprise Web 2.0", "value" : "blog/hinchcliffe" }, - { "name" : "    Five Nines: The Next Gen Datacenter", "value" : "blog/datacenter" }, - { "name" : "    Forrester Research", "value" : "blog/forrester" }, - { "name" : "    Full Duplex", "value" : "blog/full-duplex" }, - { "name" : "    Gen Why?", "value" : "blog/gen-why" }, - { "name" : "    Hardware 2.0", "value" : "blog/hardware" }, - { "name" : "    Identity Matters", "value" : "blog/identity" }, - { "name" : "    iGeneration", "value" : "blog/igeneration" }, - { "name" : "    Internet of Everything", "value" : "blog/cisco" }, - { "name" : "    Beyond IT Failure", "value" : "blog/projectfailures" }, - { "name" : "    Jamie's Mostly Linux Stuff", "value" : "blog/jamies-mostly-linux-stuff" }, - { "name" : "    Jack's Blog", "value" : "blog/jacks-blog" }, - { "name" : "    Laptops & Desktops", "value" : "blog/computers" }, - { "name" : "    Linux and Open Source", "value" : "blog/open-source" }, - { "name" : "    London Calling", "value" : "blog/london" }, - { "name" : "    Mapping Babel", "value" : "blog/mapping-babel" }, - { "name" : "    Mixed Signals", "value" : "blog/mixed-signals" }, - { "name" : "    Mobile India", "value" : "blog/mobile-india" }, - { "name" : "    Mobile News", "value" : "blog/mobile-news" }, - { "name" : "    Networking", "value" : "blog/networking" }, - { "name" : "    Norse Code", "value" : "blog/norse-code" }, - { "name" : "    Null Pointer", "value" : "blog/null-pointer" }, - { "name" : "    The Full Tilt", "value" : "blog/the-full-tilt" }, - { "name" : "    Pinoy Post", "value" : "blog/pinoy-post" }, - { "name" : "    Practically Tech", "value" : "blog/practically-tech" }, - { "name" : "    Product Central", "value" : "blog/product-central" }, - { "name" : "    Pulp Tech", "value" : "blog/violetblue" }, - { "name" : "    Qubits and Pieces", "value" : "blog/qubits-and-pieces" }, - { "name" : "    Securify This!", "value" : "blog/securify-this" }, - { "name" : "    Service Oriented", "value" : "blog/service-oriented" }, - { "name" : "    Small Talk", "value" : "blog/small-talk" }, - { "name" : "    Small Business Matters", "value" : "blog/small-business-matters" }, - { "name" : "    Smartphones and Cell Phones", "value" : "blog/cell-phones" }, - { "name" : "    Social Business", "value" : "blog/feeds" }, - { "name" : "    Social CRM: The Conversation", "value" : "blog/crm" }, - { "name" : "    Software & Services Safari", "value" : "blog/sommer" }, - { "name" : "    Storage Bits", "value" : "blog/storage" }, - { "name" : "    Stacking up Open Clouds", "value" : "blog/apac-redhat" }, - { "name" : "    Techie Isles", "value" : "blog/techie-isles" }, - { "name" : "    Technolatte", "value" : "blog/technolatte" }, - { "name" : "    Tech Podium", "value" : "blog/tech-podium" }, - { "name" : "    Tel Aviv Tech", "value" : "blog/tel-aviv" }, - { "name" : "    Tech Broiler", "value" : "blog/perlow" }, - { "name" : "    The SANMAN", "value" : "blog/the-sanman" }, - { "name" : "    The open source revolution", "value" : "blog/the-open-source-revolution" }, - { "name" : "    The German View", "value" : "blog/german" }, - { "name" : "    The Ed Bott Report", "value" : "blog/bott" }, - { "name" : "    The Mobile Gadgeteer", "value" : "blog/mobile-gadgeteer" }, - { "name" : "    The Apple Core", "value" : "blog/apple" }, - { "name" : "    Tom Foremski: IMHO", "value" : "blog/foremski" }, - { "name" : "    Twisted Wire", "value" : "blog/twisted-wire" }, - { "name" : "    Vive la tech", "value" : "blog/france" }, - { "name" : "    Virtually Speaking", "value" : "blog/virtualization" }, - { "name" : "    View from China", "value" : "blog/china" }, - { "name" : "    Web design & Free Software", "value" : "blog/web-design-and-free-software" }, - { "name" : "    ZDNet Government", "value" : "blog/government" }, - { "name" : "    ZDNet UK Book Reviews", "value" : "blog/zdnet-uk-book-reviews" }, - { "name" : "    ZDNet UK First Take", "value" : "blog/zdnet-uk-first-take" }, - { "name" : "    Zero Day", "value" : "blog/security" }, - - { "name" : "", "value" : "" }, - { "name" : "ZDNet Hot Topics RSS:", "value" : "" }, - - { "name" : "    Apple", "value" : "topic/apple" }, - { "name" : "    Collaboration", "value" : "topic/collaboration" }, - { "name" : "    Enterprise Software", "value" : "topic/enterprise-software" }, - { "name" : "    Google", "value" : "topic/google" }, - { "name" : "    Great debate", "value" : "topic/great-debate" }, - { "name" : "    Hardware", "value" : "topic/hardware" }, - { "name" : "    IBM", "value" : "topic/ibm" }, - { "name" : "    iOS", "value" : "topic/ios" }, - { "name" : "    iPhone", "value" : "topic/iphone" }, - { "name" : "    iPad", "value" : "topic/ipad" }, - { "name" : "    IT Priorities", "value" : "topic/it-priorities" }, - { "name" : "    Laptops", "value" : "topic/laptops" }, - { "name" : "    Legal", "value" : "topic/legal" }, - { "name" : "    Linux", "value" : "topic/linux" }, - { "name" : "    Microsoft", "value" : "topic/microsoft" }, - { "name" : "    Mobile OS", "value" : "topic/mobile-os" }, - { "name" : "    Mobility", "value" : "topic/mobility" }, - { "name" : "    Networking", "value" : "topic/networking" }, - { "name" : "    Oracle", "value" : "topic/oracle" }, - { "name" : "    Processors", "value" : "topic/processors" }, - { "name" : "    Samsung", "value" : "topic/samsung" }, - { "name" : "    Security", "value" : "topic/security" }, - { "name" : "    Small business: going big on mobility", "value" : "topic/small-business-going-big-on-mobility" }, - - { "name" : "", "value" : "" }, - { "name" : "Product Blogs:", "value" : "" }, - - { "name" : "    Digital Cameras & Camcorders", "value" : "blog/digitalcameras" }, - { "name" : "    Home Theater", "value" : "blog/home-theater" }, - { "name" : "    Laptops and Desktops", "value" : "blog/computers" }, - { "name" : "    The Mobile Gadgeteer", "value" : "blog/mobile-gadgeteer" }, - { "name" : "    Smartphones and Cell Phones", "value" : "blog/cell-phones" }, - { "name" : "    The ToyBox", "value" : "blog/gadgetreviews" }, - - { "name" : "", "value" : "" }, - { "name" : "Vertical Blogs:", "value" : "" }, - - { "name" : "    ZDNet Education", "value" : "blog/education" }, - { "name" : "    ZDNet Healthcare", "value" : "blog/healthcare" }, - { "name" : "    ZDNet Government", "value" : "blog/government" } - ] - } - ]'; - + $this->parameters[] = array( + 'feed'=>array( + 'name'=>'Feed', + 'type'=>'list', + 'values'=>array( + 'Subscribe to ZDNet RSS Feeds'=>array( + 'All Blogs'=>'blog', + 'Just News'=>'news', + 'All Reviews'=>'topic/reviews', + 'Latest Downloads'=>'downloads!recent', + 'Latest Articles'=>'/', + 'Latest Australia Articles'=>'au', + 'Latest UK Articles'=>'uk', + 'Latest US Articles'=>'us', + 'Latest Asia Articles'=>'as' + ), + 'Keep up with ZDNet Blogs RSS:'=>array( + 'Transforming the Datacenter'=>'blog/transforming-datacenter', + 'SMB India'=>'blog/smb-india', + 'Indonesia BizTech'=>'blog/indonesia-biztech', + 'Hong Kong Techie'=>'blog/hong-kong-techie', + 'Tech Taiwan'=>'blog/tech-taiwan', + 'Startup India'=>'blog/startup-india', + 'Starting Up Asia'=>'blog/starting-up-asia', + 'Next-Gen Partner'=>'blog/partner', + 'Post-PC Developments'=>'blog/post-pc', + 'Benelux'=>'blog/benelux', + 'Heat Sink'=>'blog/heat-sink', + 'Italy\'s got tech'=>'blog/italy', + 'African Enterprise'=>'blog/african-enterprise', + 'New Tech for Old India'=>'blog/new-india', + 'Estonia Uncovered'=>'blog/estonia', + 'IT Iberia'=>'blog/iberia', + 'Brazil Tech'=>'blog/brazil', + '500 words into the future'=>'blog/500-words-into-the-future', + 'ÜberTech'=>'blog/ubertech', + 'All About Microsoft'=>'blog/microsoft', + 'Back office'=>'blog/back-office', + 'Barker Bites Back'=>'blog/barker-bites-back', + 'Between the Lines'=>'blog/btl', + 'Big on Data'=>'blog/big-data', + 'bootstrappr'=>'blog/bootstrappr', + 'By The Way'=>'blog/by-the-way', + 'Central European Processing'=>'blog/central-europe', + 'Cloud Builders'=>'blog/cloud-builders', + 'Communication Breakdown'=>'blog/communication-breakdown', + 'Collaboration 2.0'=>'blog/collaboration', + 'Constellation Research'=>'blog/constellation', + 'Consumerization: BYOD'=>'blog/consumerization', + 'DIY-IT'=>'blog/diy-it', + 'Enterprise Web 2.0'=>'blog/hinchcliffe', + 'Five Nines: The Next Gen Datacenter'=>'blog/datacenter', + 'Forrester Research'=>'blog/forrester', + 'Full Duplex'=>'blog/full-duplex', + 'Gen Why?'=>'blog/gen-why', + 'Hardware 2.0'=>'blog/hardware', + 'Identity Matters'=>'blog/identity', + 'iGeneration'=>'blog/igeneration', + 'Internet of Everything'=>'blog/cisco', + 'Beyond IT Failure'=>'blog/projectfailures', + 'Jamie\'s Mostly Linux Stuff'=>'blog/jamies-mostly-linux-stuff', + 'Jack\'s Blog'=>'blog/jacks-blog', + 'Laptops & Desktops'=>'blog/computers', + 'Linux and Open Source'=>'blog/open-source', + 'London Calling'=>'blog/london', + 'Mapping Babel'=>'blog/mapping-babel', + 'Mixed Signals'=>'blog/mixed-signals', + 'Mobile India'=>'blog/mobile-india', + 'Mobile News'=>'blog/mobile-news', + 'Networking'=>'blog/networking', + 'Norse Code'=>'blog/norse-code', + 'Null Pointer'=>'blog/null-pointer', + 'The Full Tilt'=>'blog/the-full-tilt', + 'Pinoy Post'=>'blog/pinoy-post', + 'Practically Tech'=>'blog/practically-tech', + 'Product Central'=>'blog/product-central', + 'Pulp Tech'=>'blog/violetblue', + 'Qubits and Pieces'=>'blog/qubits-and-pieces', + 'Securify This!'=>'blog/securify-this', + 'Service Oriented'=>'blog/service-oriented', + 'Small Talk'=>'blog/small-talk', + 'Small Business Matters'=>'blog/small-business-matters', + 'Smartphones and Cell Phones'=>'blog/cell-phones', + 'Social Business'=>'blog/feeds', + 'Social CRM: The Conversation'=>'blog/crm', + 'Software & Services Safari'=>'blog/sommer', + 'Storage Bits'=>'blog/storage', + 'Stacking up Open Clouds'=>'blog/apac-redhat', + 'Techie Isles'=>'blog/techie-isles', + 'Technolatte'=>'blog/technolatte', + 'Tech Podium'=>'blog/tech-podium', + 'Tel Aviv Tech'=>'blog/tel-aviv', + 'Tech Broiler'=>'blog/perlow', + 'The SANMAN'=>'blog/the-sanman', + 'The open source revolution'=>'blog/the-open-source-revolution', + 'The German View'=>'blog/german', + 'The Ed Bott Report'=>'blog/bott', + 'The Mobile Gadgeteer'=>'blog/mobile-gadgeteer', + 'The Apple Core'=>'blog/apple', + 'Tom Foremski: IMHO'=>'blog/foremski', + 'Twisted Wire'=>'blog/twisted-wire', + 'Vive la tech'=>'blog/france', + 'Virtually Speaking'=>'blog/virtualization', + 'View from China'=>'blog/china', + 'Web design & Free Software'=>'blog/web-design-and-free-software', + 'ZDNet Government'=>'blog/government', + 'ZDNet UK Book Reviews'=>'blog/zdnet-uk-book-reviews', + 'ZDNet UK First Take'=>'blog/zdnet-uk-first-take', + 'Zero Day'=>'blog/security' + ), + 'ZDNet Hot Topics RSS:'=>array( + 'Apple'=>'topic/apple', + 'Collaboration'=>'topic/collaboration', + 'Enterprise Software'=>'topic/enterprise-software', + 'Google'=>'topic/google', + 'Great debate'=>'topic/great-debate', + 'Hardware'=>'topic/hardware', + 'IBM'=>'topic/ibm', + 'iOS'=>'topic/ios', + 'iPhone'=>'topic/iphone', + 'iPad'=>'topic/ipad', + 'IT Priorities'=>'topic/it-priorities', + 'Laptops'=>'topic/laptops', + 'Legal'=>'topic/legal', + 'Linux'=>'topic/linux', + 'Microsoft'=>'topic/microsoft', + 'Mobile OS'=>'topic/mobile-os', + 'Mobility'=>'topic/mobility', + 'Networking'=>'topic/networking', + 'Oracle'=>'topic/oracle', + 'Processors'=>'topic/processors', + 'Samsung'=>'topic/samsung', + 'Security'=>'topic/security', + 'Small business: going big on mobility'=>'topic/small-business-going-big-on-mobility' + ), + 'Product Blogs:'=>array( + 'Digital Cameras & Camcorders'=>'blog/digitalcameras', + 'Home Theater'=>'blog/home-theater', + 'Laptops and Desktops'=>'blog/computers', + 'The Mobile Gadgeteer'=>'blog/mobile-gadgeteer', + 'Smartphones and Cell Phones'=>'blog/cell-phones', + 'The ToyBox'=>'blog/gadgetreviews' + ), + 'Vertical Blogs:'=>array( + 'ZDNet Education'=>'blog/education', + 'ZDNet Healthcare'=>'blog/healthcare', + 'ZDNet Government'=>'blog/government' + ) + ) + ) + ); } public function collectData(array $param) { diff --git a/bridges/ZoneTelechargementBridge.php b/bridges/ZoneTelechargementBridge.php index a0338f50..70f10f4e 100644 --- a/bridges/ZoneTelechargementBridge.php +++ b/bridges/ZoneTelechargementBridge.php @@ -8,13 +8,9 @@ class ZoneTelechargementBridge extends BridgeAbstract { $this->uri = 'https://www.zone-telechargement.com/'; $this->description = 'RSS proxy returning the newest releases.
You may specify a category found in RSS URLs, else main feed is selected.'; - $this->parameters[] = - '[ - { - "name" : "Category", - "identifier" : "category" - } - ]'; + $this->parameters[] = array( + 'category'=>array('name'=>'Category') + ); } public function collectData(array $param) {