Merge pull request #169 from teromene/new-attribute-system

Update 2 to the new attribute system.
This commit is contained in:
Mitsu 2015-11-05 11:50:41 +01:00
commit fe37f9711f
50 changed files with 488 additions and 384 deletions

View file

@ -1,19 +1,18 @@
<?php <?php
/**
* ABCTabsBridge
* Returns the newest tabs
*
* @name ABC Tabs Bridge
* @homepage http://www.abc-tabs.com/
* @description Returns 22 newest tabs
* @maintainer kranack
* @update 2014-07-23
*
*/
class ABCTabsBridge extends BridgeAbstract{ class ABCTabsBridge extends BridgeAbstract{
private $request; private $request;
public function loadMetadatas() {
$this->maintainer = "kranack";
$this->name = "ABC Tabs Bridge";
$this->uri = "http://www.abc-tabs.com/";
$this->description = "Returns 22 newest tabs";
$this->update = "2014-07-23";
}
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $html = '';
$html = file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404); $html = file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404);
@ -30,12 +29,17 @@ class ABCTabsBridge extends BridgeAbstract{
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function getName(){
return 'ABC Tabs Bridge'; public function getName() {
return "ABC Tabs Bridge";
} }
public function getURI(){ public function getURI() {
return 'http://www.abc-tabs.com/';
return "http://www.abc-tabs.com/";
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -1,11 +1,4 @@
<?php <?php
/**
*
* @name Acrimed Bridge
* @homepage http://www.acrimed.org/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class AcrimedBridge extends BridgeAbstract{ class AcrimedBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
@ -46,6 +39,17 @@ class AcrimedBridge extends BridgeAbstract{
} }
public function getName() {
return "Acrimed Bridge";
}
public function getURI() {
return "http://www.acrimed.org/";
}
public function getCacheDuration(){ public function getCacheDuration(){
return 3600*2; // 2 hours return 3600*2; // 2 hours

View file

@ -1,16 +1,17 @@
<?php <?php
/**
* RssBridgeBastabag
* Returns the newest articles
* 2014-05-25
*
* @name Bastamag Bridge
* @homepage http://www.bastamag.net/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class BastaBridge extends BridgeAbstract{ class BastaBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "Bastamag Bridge";
$this->uri = "http://www.bastamag.net/";
$this->description = "Returns the newest articles.";
$this->update = "2014-05-25";
}
public function collectData(array $param){ public function collectData(array $param){

View file

@ -1,14 +1,16 @@
<?php <?php
/**
*
* @name Blagues De Merde
* @homepage http://www.blaguesdemerde.fr/
* @description Blagues De Merde
* @update 16/10/2013
* initial maintainer: superbaillot.net
*/
class BlaguesDeMerdeBridge extends BridgeAbstract{ class BlaguesDeMerdeBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "superbaillot.net";
$this->name = "Blagues De Merde";
$this->uri = "http://www.blaguesdemerde.fr/";
$this->description = "Blagues De Merde";
$this->update = "16/10/2013";
}
public function collectData(array $param){ public function collectData(array $param){
$html = file_get_html('http://www.blaguesdemerde.fr/') or $this->returnError('Could not request BDM.', 404); $html = file_get_html('http://www.blaguesdemerde.fr/') or $this->returnError('Could not request BDM.', 404);

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeCAD
* Returns the newest articles
* 2015-04-03
*
* @name CAD Bridge
* @homepage http://www.cad-comic.com/
* @description Returns the newest articles.
* @maintainer nyutag
*/
class CADBridge extends BridgeAbstract{ class CADBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "nyutag";
$this->name = "CAD Bridge";
$this->uri = "http://www.cad-comic.com/";
$this->description = "Returns the newest articles.";
$this->update = "2015-04-03";
}
public function collectData(array $param){ public function collectData(array $param){
function CADUrl($string) { function CADUrl($string) {

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeCoinDesk
* Returns the 5 newest posts from coindesk.com (full text)
*
* @name CoinDesk
* @homepage http://www.coindesk.com/
* @description Returns the 5 newest posts from CoinDesk (full text)
* @maintainer mitsukarenai
* @update 2014-05-30
*/
class CoinDeskBridge extends BridgeAbstract{ class CoinDeskBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "mitsukarenai";
$this->name = "CoinDesk";
$this->uri = "http://www.coindesk.com/";
$this->description = "Returns the 5 newest posts from CoinDesk (full text)";
$this->update = "2014-05-30";
}
public function collectData(array $param){ public function collectData(array $param){
function CoinDeskStripCDATA($string) { function CoinDeskStripCDATA($string) {

View file

@ -1,15 +1,16 @@
<?php <?php
/**
* RssBridgeCollegeDeFrance
* Returns the 10 newest posts from http://www.college-de-france.fr
*
* @name CollegeDeFrance
* @homepage http://www.college-de-france.fr/
* @description Returns the 10 newest posts from CollegeDeFrance
* @maintainer pit-fgfjiudghdf
* @update 2014-05-26
*/
class CollegeDeFranceBridge extends BridgeAbstract{ class CollegeDeFranceBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "pit-fgfjiudghdf";
$this->name = "CollegeDeFrance";
$this->uri = "http://www.college-de-france.fr/";
$this->description = "Returns the 10 newest posts from CollegeDeFrance";
$this->update = "2014-05-26";
}
public function collectData(array $param){ public function collectData(array $param){
$find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre'); $find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre');
$replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeCommonDreams
* Returns the newest articles
* 2015-04-03
*
* @name CommonDreams Bridge
* @homepage http://www.commondreams.org/
* @description Returns the newest articles.
* @maintainer nyutag
*/
class CommonDreamsBridge extends BridgeAbstract{ class CommonDreamsBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "nyutag";
$this->name = "CommonDreams Bridge";
$this->uri = "http://www.commondreams.org/";
$this->description = "Returns the newest articles.";
$this->update = "2015-04-03";
}
public function collectData(array $param){ public function collectData(array $param){
function CommonDreamsUrl($string) { function CommonDreamsUrl($string) {

View file

@ -1,14 +1,17 @@
<?php <?php
/**
*
* @name CopieDouble
* @homepage http://www.copie-double.com/
* @description CopieDouble
* @update 12/12/2013
* initial maintainer: superbaillot.net
*/
class CopieDoubleBridge extends BridgeAbstract{ class CopieDoubleBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "superbaillot.net";
$this->name = "CopieDouble";
$this->uri = "http://www.copie-double.com/";
$this->description = "CopieDouble";
$this->update = "12/12/2013";
}
public function collectData(array $param){ public function collectData(array $param){
$html = file_get_html('http://www.copie-double.com/') or $this->returnError('Could not request CopieDouble.', 404); $html = file_get_html('http://www.copie-double.com/') or $this->returnError('Could not request CopieDouble.', 404);
$table = $html->find('table table', 2); $table = $html->find('table table', 2);

View file

@ -1,15 +1,16 @@
<?php <?php
/**
*
* @name CourrierInternational
* @homepage http://CourrierInternational.fr/
* @description Courrier International bridge
* @update 01/09/2015
* @maintainer teromene
*/
class CourrierInternationalBridge extends BridgeAbstract{ class CourrierInternationalBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "teromene";
$this->name = "CourrierInternational";
$this->uri = "http://CourrierInternational.fr/";
$this->description = "Courrier International bridge";
$this->update = "01/09/2015";
}
public function collectData(array $param){ public function collectData(array $param){
function fetchArticle($link) { function fetchArticle($link) {

View file

@ -1,17 +1,16 @@
<?php <?php
/**
* RssBridgeDansTonChat
* Retrieve lastest quotes from DansTonChat.
* Returns the most recent quotes, sorting by date (most recent first).
* 2014-05-25
*
* @name DansTonChat Bridge
* @homepage http://danstonchat.com/latest.html
* @description Returns latest quotes from DansTonChat.
* @maintainer Astalaseven
*/
class DansTonChatBridge extends BridgeAbstract{ class DansTonChatBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "Astalaseven";
$this->name = "DansTonChat Bridge";
$this->uri = "http://danstonchat.com/latest.html";
$this->description = "Returns latest quotes from DansTonChat.";
$this->update = "2014-05-25";
}
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $html = '';
$link = 'http://danstonchat.com/latest.html'; $link = 'http://danstonchat.com/latest.html';

View file

@ -1,15 +1,4 @@
<?php <?php
/**
* ABCTabsBridge
* Returns the newest tabs
*
* @name ABC Tabs Bridge
* @homepage http://www.abc-tabs.com/
* @description Returns 22 newest tabs
* @maintainer kranack
* @update 2014-07-23
*
*/
class DemoBridge extends BridgeAbstract{ class DemoBridge extends BridgeAbstract{
public function loadMetadatas() { public function loadMetadatas() {
@ -64,6 +53,18 @@ class DemoBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
}
public function getName() {
return "DemoBridge";
}
public function getURI() {
return "http://github.com/sebsauvage/rss-bridge";
} }
public function getCacheDuration(){ public function getCacheDuration(){

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeDeveloppezDotCom
* Returns the 15 newest posts from http://www.developpez.com (full text)
* 2014-07-14
*
* @name Developpez.com Actus (FR)
* @homepage http://www.developpez.com/
* @description Returns the 15 newest posts from DeveloppezDotCom (full text).
* @maintainer polopollo
*/
class DeveloppezDotComBridge extends BridgeAbstract{ class DeveloppezDotComBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "polopollo";
$this->name = "Developpez.com Actus (FR)";
$this->uri = "http://www.developpez.com/";
$this->description = "Returns the 15 newest posts from DeveloppezDotCom (full text).";
$this->update = "2014-07-14";
}
public function collectData(array $param){ public function collectData(array $param){
function DeveloppezDotComStripCDATA($string) { function DeveloppezDotComStripCDATA($string) {

View file

@ -1,15 +1,16 @@
<?php <?php
/**
*
* @name Dilbert Daily Strip
* @homepage http://dilbert.com/strips/
* @description The Unofficial Dilbert Daily Comic Strip
* @update 30/01/2015
* initial maintainer: superbaillot.net
* @maintainer kranack
*/
class DilbertBridge extends BridgeAbstract{ class DilbertBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "kranack";
$this->name = "Dilbert Daily Strip";
$this->uri = "http://dilbert.com/strips/";
$this->description = "The Unofficial Dilbert Daily Comic Strip";
$this->update = "30/01/2015";
}
public function collectData(array $param){ public function collectData(array $param){
$html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404); $html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404);

View file

@ -1,19 +1,15 @@
<?php <?php
/**
* RssBridgeFS
* Returns the 5 newest posts from http://www.futura-sciences.com (full text)
*
* @name Futurasciences
* @description Returns the 5 newest posts from FS (full text)
* @homepage http://www.futura-sciences.com
*@maintainer qwertygc
*/
class FSBridge extends BridgeAbstract{ class FSBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "Futurasciences";
$this->uri = "http://www.futura-sciences.com";
$this->description = "Returns the 5 newest posts from FS (full text)";
$this->update = "03/11/2015";
}
public function collectData(array $param){ public function collectData(array $param){

View file

@ -1,14 +1,16 @@
<?php <?php
/**
*
* @name Footito
* @homepage http://www.footito.fr/
* @description Footito
* @update 21/11/2013
* initial maintainer: superbaillot.net
*/
class FootitoBridge extends BridgeAbstract{ class FootitoBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "superbaillot.net";
$this->name = "Footito";
$this->uri = "http://www.footito.fr/";
$this->description = "Footito";
$this->update = "21/11/2013";
}
public function collectData(array $param){ public function collectData(array $param){
$html = file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404); $html = file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404);

View file

@ -1,16 +1,15 @@
<?php <?php
/**
* RssBridgeFrandroid
* Returns the RSS feed from Frandroid (full text articles)
*
* @name Frandroid
* @homepage http://www.frandroid.com/
* @description Returns the RSS feed from Frandroid (full text articles)
* @maintainer Daiyousei
* @update 2015-03-05
*/
class FrandroidBridge extends BridgeAbstract class FrandroidBridge extends BridgeAbstract
{ {
public function loadMetadatas() {
$this->maintainer = "Daiyousei";
$this->name = "Frandroid";
$this->uri = "http://www.frandroid.com/";
$this->description = "Returns the RSS feed from Frandroid (full text articles)";
$this->update = "2015-03-05";
}
public function collectData(array $param) public function collectData(array $param)
{ {

View file

@ -12,7 +12,7 @@
* @use2(n="max number of returned items") * @use2(n="max number of returned items")
*/ */
define(GIPHY_LIMIT, 10); define('GIPHY_LIMIT', 10);
class GiphyBridge extends BridgeAbstract{ class GiphyBridge extends BridgeAbstract{

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeGizmodoFR
* Returns the 15 newest posts from http://www.gizmodo.fr (full text)
* 2014-07-14
*
* @name GizmodoFR
* @homepage http://www.gizmodo.fr/
* @description Returns the 15 newest posts from GizmodoFR (full text).
* @maintainer polopollo
*/
class GizmodoFRBridge extends BridgeAbstract{ class GizmodoFRBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "polopollo";
$this->name = "GizmodoFR";
$this->uri = "http://www.gizmodo.fr/";
$this->description = "Returns the 15 newest posts from GizmodoFR (full text).";
$this->update = "2014-07-14";
}
public function collectData(array $param){ public function collectData(array $param){
function GizmodoFRExtractContent($url) { function GizmodoFRExtractContent($url) {

View file

@ -1,18 +1,15 @@
<?php <?php
/**
* RssBridgeGuruMed
* Returns the 5 newest posts from http://www.gurumed.org (full text)
*
* @name GuruMed
* @description Returns the 5 newest posts from Gurumed (full text)
* @homepage http://www.gurumed.org
*@maintainer qwertygc
*/
class GuruMedBridge extends BridgeAbstract{ class GuruMedBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "GuruMed";
$this->uri = "http://www.gurumed.org";
$this->description = "Returns the 5 newest posts from Gurumed (full text)";
$this->update = "03/10/2015";
}
public function collectData(array $param){ public function collectData(array $param){

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeKoreus
* Returns the 5 newest posts from Koreus (full text)
*
* @name Koreus
* @homepage http://www.koreus.com/
* @description Returns the 5 newest posts from Koreus (full text)
* @maintainer pit-fgfjiudghdf
* @update 2014-05-26
*/
class KoreusBridge extends BridgeAbstract{ class KoreusBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "pit-fgfjiudghdf";
$this->name = "Koreus";
$this->uri = "http://www.koreus.com/";
$this->description = "Returns the 5 newest posts from Koreus (full text)";
$this->update = "2014-05-26";
}
public function collectData(array $param){ public function collectData(array $param){
function KoreusStripCDATA($string) { function KoreusStripCDATA($string) {

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeLeJournalDuGeek
* Returns the 15 newest posts from http://www.journaldugeek.com (full text)
* 2014-07-14
*
* @name journaldugeek.com (FR)
* @homepage http://www.journaldugeek.com/
* @description Returns the 5 newest posts from LeJournalDuGeek (full text).
* @maintainer polopollo
*/
class LeJournalDuGeekBridge extends BridgeAbstract{ class LeJournalDuGeekBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "polopollo";
$this->name = "journaldugeek.com (FR)";
$this->uri = "http://www.journaldugeek.com/";
$this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text).";
$this->update = "2014-07-14";
}
public function collectData(array $param){ public function collectData(array $param){
function LeJournalDuGeekStripCDATA($string) { function LeJournalDuGeekStripCDATA($string) {

View file

@ -1,17 +1,16 @@
<?php <?php
/**
* LeMondeInformatique Bridge
* Returns the newest articles
* 2015-09-08
*
* @name Le Monde Informatique
* @homepage http://www.lemondeinformatique.fr/
* @description Returns the newest articles.
* @maintainer ORelio
* @update 2015-09-08
*/
class LeMondeInformatiqueBridge extends BridgeAbstract { class LeMondeInformatiqueBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = "ORelio";
$this->name = "Le Monde Informatique";
$this->uri = "http://www.lemondeinformatique.fr/";
$this->description = "Returns the newest articles.";
$this->update = "2015-09-08";
}
public function collectData(array $param) { public function collectData(array $param) {
function StripCDATA($string) { function StripCDATA($string) {

View file

@ -1,13 +1,16 @@
<?php <?php
/**
* 2014-05-25
* @name LeMotDuJour Bridge
* @homepage http://www.lemotdujour.com/
* @description Returns the newest articles.
* @maintainer qwertygc
*/
class LeMotDuJourBridge extends BridgeAbstract{ class LeMotDuJourBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "LeMotDuJour Bridge";
$this->uri = "http://www.lemotdujour.com/";
$this->description = "Returns the newest articles.";
$this->update = "2014-05-25";
}
public function collectData(array $param){ public function collectData(array $param){
function StripCDATA($string) { function StripCDATA($string) {

View file

@ -1,21 +1,26 @@
<?php <?php
/**
*
* @name Les 400 Culs
* @description La planète sexe vue par Agnès Girard via rss-bridge
* @update 20/02/2014
*/
require_once 'bridges/RssExpander.php'; require_once 'bridges/RssExpander.php';
define("SEXE", "http://sexes.blogs.liberation.fr"); define("SEXE", "http://sexes.blogs.liberation.fr");
define("RSS", "http://sexes.blogs.liberation.fr/feeds/"); define("SEXE_FEED", "http://sexes.blogs.liberation.fr/feeds/");
/** /**
* As it seems that Les 400 culs currently offer a full feed, we won't change it content here. * As it seems that Les 400 culs currently offer a full feed, we won't change it content here.
* But I'm ready for the day where it will ... again ... provide some truncated content * But I'm ready for the day where it will ... again ... provide some truncated content
*/ */
class Les400Culs extends RssExpander{ class Les400Culs extends RssExpander{
public function loadMetadatas() {
$this->maintainer = "unknown";
$this->name = "Les 400 Culs";
$this->uri = "http://sexes.blogs.liberation.fr";
$this->description = "La planète sexe vue par Agnès Girard via rss-bridge";
$this->update = "20/02/2014";
}
public function collectData(array $param){ public function collectData(array $param){
$param['url'] = RSS; $param['url'] = SEXE_FEED;
parent::collectData($param); parent::collectData($param);
} }

View file

@ -1,14 +1,16 @@
<?php <?php
/**
*
* @name Les Joies Du Code
* @homepage http://lesjoiesducode.fr/
* @description LesJoiesDuCode
* @update 04/02/2015
* initial maintainer: superbaillot.net
*/
class LesJoiesDuCodeBridge extends BridgeAbstract{ class LesJoiesDuCodeBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "superbaillot.net";
$this->name = "Les Joies Du Code";
$this->uri = "http://lesjoiesducode.fr/";
$this->description = "LesJoiesDuCode";
$this->update = "04/02/2015";
}
public function collectData(array $param){ public function collectData(array $param){
$html = file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404); $html = file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404);

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeMaliki
* Returns Maliki's newest strips
*
* @name Maliki
* @homepage http://www.maliki.com/
* @description Returns Maliki's newest strips
* @maintainer mitsukarenai
* @update 2014-05-30
*/
class MalikiBridge extends BridgeAbstract{ class MalikiBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "mitsukarenai";
$this->name = "Maliki";
$this->uri = "http://www.maliki.com/";
$this->description = "Returns Maliki's newest strips";
$this->update = "2014-05-30";
}
public function collectData(array $param){ public function collectData(array $param){
$html = file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404); $html = file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404);
$count=0; $count=0;

View file

@ -1,13 +1,16 @@
<?php <?php
/**
* @name MemoLinux
* @homepage http://memo-linux.com/
* @description Returns the 10 newest posts from MemoLinux (full text)
* @maintainer qwertygc
* @update 2015-01-30
*/
class MemoLinuxBridge extends BridgeAbstract{ class MemoLinuxBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "MemoLinux";
$this->uri = "http://memo-linux.com/";
$this->description = "Returns the 10 newest posts from MemoLinux (full text)";
$this->update = "2015-01-30";
}
public function collectData(array $param){ public function collectData(array $param){
function StripCDATA($string) { function StripCDATA($string) {

View file

@ -1,18 +1,16 @@
<?php <?php
/**
* RssBridgeMondeDiplo
* Search MondeDiplo for most recent pages.
* Returns the most recent links in results.
* 2014-07-22
*
* @name MondeDiplo
* @homepage http://www.monde-diplomatique.fr
* @description Returns most recent results from MondeDiplo.
* @maintainer Pitchoule
*/
class MondeDiploBridge extends BridgeAbstract{ class MondeDiploBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "Pitchoule";
$this->name = "MondeDiplo";
$this->uri = "http://www.monde-diplomatique.fr";
$this->description = "Returns most recent results from MondeDiplo.";
$this->update = "2014-07-22";
}
public function collectData(array $param){ public function collectData(array $param){
$link = 'http://www.monde-diplomatique.fr'; $link = 'http://www.monde-diplomatique.fr';

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeMsnMonde
* Returns the 10 newest posts from MSN Actualités (full text)
*
* @name MSN Actu Monde
* @homepage http://www.msn.com/fr-fr/actualite/monde
* @description Returns the 10 newest posts from MSN Actualités (full text)
* @maintainer kranack
* @update 2015-01-30
*/
class MsnMondeBridge extends BridgeAbstract{ class MsnMondeBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "kranack";
$this->name = "MSN Actu Monde";
$this->uri = "http://www.msn.com/fr-fr/actualite/monde";
$this->description = "Returns the 10 newest posts from MSN Actualités (full text)";
$this->update = "2015-01-30";
}
public function collectData(array $param){ public function collectData(array $param){
function MsnMondeExtractContent($url, &$item) { function MsnMondeExtractContent($url, &$item) {

View file

@ -1,13 +1,16 @@
<?php <?php
/**
* 2014-08-27
* @name NASA APOD Bridge
* @homepage http://apod.nasa.gov/apod/astropix.html
* @description Returns the 3 latest NASA APOD pictures and explanations
* @maintainer corenting
*/
class NasaApodBridge extends BridgeAbstract{ class NasaApodBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "corenting";
$this->name = "NASA APOD Bridge";
$this->uri = "http://apod.nasa.gov/apod/astropix.html";
$this->description = "Returns the 3 latest NASA APOD pictures and explanations";
$this->update = "2014-08-27";
}
public function collectData(array $param) { public function collectData(array $param) {
$html = file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnError('Error while downloading the website content', 404); $html = file_get_html('http://apod.nasa.gov/apod/archivepix.html') or $this->returnError('Error while downloading the website content', 404);

View file

@ -1,17 +1,16 @@
<?php <?php
/**
* RssBridgeNextinpact
* Returns the newest articles
* 2014-05-25
*
* @name NextInpact Bridge
* @homepage http://www.nextinpact.com/
* @description Returns the newest articles.
* @maintainer qwertygc
* @update 2015-10-23
*/
class NextInpactBridge extends BridgeAbstract { class NextInpactBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "NextInpact Bridge";
$this->uri = "http://www.nextinpact.com/";
$this->description = "Returns the newest articles.";
$this->update = "2015-10-23";
}
public function collectData(array $param) { public function collectData(array $param) {
function StripCDATA($string) { function StripCDATA($string) {

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeNiceMatin
* Returns the 10 newest posts from Nice Matin (full text)
*
* @name NiceMatin
* @homepage http://www.nicematin.com/
* @description Returns the 10 newest posts from NiceMatin (full text)
* @maintainer pit-fgfjiudghdf
* @update 2014-05-26
*/
class NiceMatinBridge extends BridgeAbstract{ class NiceMatinBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "pit-fgfjiudghdf";
$this->name = "NiceMatin";
$this->uri = "http://www.nicematin.com/";
$this->description = "Returns the 10 newest posts from NiceMatin (full text)";
$this->update = "2014-05-26";
}
public function collectData(array $param){ public function collectData(array $param){
function NiceMatinUrl($string) { function NiceMatinUrl($string) {

View file

@ -1,16 +1,16 @@
<?php <?php
/**
* RssBridgeNumerama
* Returns the 5 newest posts from http://www.numerama.com (full text)
*
* @name Numerama
* @homepage http://www.numerama.com/
* @description Returns the 5 newest posts from Numerama (full text)
* @maintainer mitsukarenai
* @update 2015-10-12
*/
class NumeramaBridge extends BridgeAbstract{ class NumeramaBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "mitsukarenai";
$this->name = "Numerama";
$this->uri = "http://www.numerama.com/";
$this->description = "Returns the 5 newest posts from Numerama (full text)";
$this->update = "2015-10-12";
}
public function collectData(array $param){ public function collectData(array $param){
function NumeramaStripCDATA($string) { function NumeramaStripCDATA($string) {

View file

@ -1,18 +1,15 @@
<?php <?php
/**
* RssBridgeOpenTheory
* Returns the 5 newest posts from http://open1theory.com (full text)
*
* @name Opentheory
* @description Returns the 5 newest posts from OpenTheory (full text)
* @homepage http://open1theory.com
*@maintainer qwertygc
*/
class OpenTheoryBridge extends BridgeAbstract{ class OpenTheoryBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "qwertygc";
$this->name = "Opentheory";
$this->uri = "http://open1theory.com";
$this->description = "Returns the 5 newest posts from OpenTheory (full text)";
$this->update = "02-08-2014";
}
public function collectData(array $param){ public function collectData(array $param){

View file

@ -1,15 +1,16 @@
<?php <?php
/**
* RssBridgePlanetLibre
* Returns the 5 newest posts from PlanetLibre (full text)
*
* @name PlanetLibre
* @homepage http://www.planet-libre.org
* @description Returns the 5 newest posts from PlanetLibre (full text)
* @maintainer pit-fgfjiudghdf
* @update 2014-05-26
*/
class PlanetLibreBridge extends BridgeAbstract{ class PlanetLibreBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "pit-fgfjiudghdf";
$this->name = "PlanetLibre";
$this->uri = "http://www.planet-libre.org";
$this->description = "Returns the 5 newest posts from PlanetLibre (full text)";
$this->update = "2014-05-26";
}
public function collectData(array $param){ public function collectData(array $param){
function PlanetLibreExtractContent($url) { function PlanetLibreExtractContent($url) {

View file

@ -1,13 +1,17 @@
<?php <?php
/**
* 2014-08-27
* @name Project M Game Bridge
* @homepage http://projectmgame.com/en/
* @description Returns the newest articles.
* @maintainer corenting
*/
class ProjectMGameBridge extends BridgeAbstract{ class ProjectMGameBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "corenting";
$this->name = "Project M Game Bridge";
$this->uri = "http://projectmgame.com/en/";
$this->description = "Returns the newest articles.";
$this->update = "2014-08-27";
}
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $html = '';
$html = file_get_html('http://projectmgame.com/en/') or $this->returnError('Error while downloading the Project M homepage', 404); $html = file_get_html('http://projectmgame.com/en/') or $this->returnError('Error while downloading the Project M homepage', 404);

View file

@ -9,9 +9,9 @@
*/ */
abstract class RssExpander extends HttpCachingBridgeAbstract{ abstract class RssExpander extends HttpCachingBridgeAbstract{
protected $name; public $name;
private $uri; public $uri;
private $description; public $description;
public function collectData(array $param){ public function collectData(array $param){
if (empty($param['url'])) { if (empty($param['url'])) {
$this->returnError('There is no $param[\'url\'] for this RSS expander', 404); $this->returnError('There is no $param[\'url\'] for this RSS expander', 404);

View file

@ -14,7 +14,7 @@
class SoundCloudBridge extends BridgeAbstract{ class SoundCloudBridge extends BridgeAbstract{
private $request; private $request;
private $name; public $name;
const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875'; const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875';
public function collectData(array $param){ public function collectData(array $param){

View file

@ -10,11 +10,11 @@
*/ */
require_once 'bridges/RssExpander.php'; require_once 'bridges/RssExpander.php';
define("THE_OATMEAL", "http://theoatmeal.com/"); define("THE_OATMEAL", "http://theoatmeal.com/");
define("RSS", "http://feeds.feedburner.com/oatmealfeed"); define("THE_OATMEAL_RSS", "http://feeds.feedburner.com/oatmealfeed");
class TheOatmealBridge extends RssExpander{ class TheOatmealBridge extends RssExpander{
public function collectData(array $param){ public function collectData(array $param){
$param['url'] = RSS; $param['url'] = THE_OATMEAL_RSS;
parent::collectData($param); parent::collectData($param);
} }

View file

@ -15,8 +15,8 @@
* Description for the API is available on GitHub: https://github.com/justintv/twitch-api * Description for the API is available on GitHub: https://github.com/justintv/twitch-api
*/ */
define(TWITCH_LIMIT, 10); // The default limit define('TWITCH_LIMIT', 10); // The default limit
define(TWITCH_BROADCASTS, 'false'); // The default flag for broadcasts define('TWITCH_BROADCASTS', 'false'); // The default flag for broadcasts
class TwitchApiBridge extends BridgeAbstract{ class TwitchApiBridge extends BridgeAbstract{

View file

@ -14,7 +14,7 @@
class WhydBridge extends BridgeAbstract{ class WhydBridge extends BridgeAbstract{
private $request; private $request;
private $name; public $name;
public function collectData(array $param){ public function collectData(array $param){
$html = ''; $html = '';

View file

@ -0,0 +1,48 @@
<?php
/**
* WikipediaDEBridge
* Retrieve latest highlighted articles from Wikipedia in German.
* 2015-11-04
*
* @name Wikipedia DE "Today's Featured Article..."
* @homepage https://de.wikipedia.org/
* @description Returns the highlighted en.wikipedia.org article.
* @maintainer cnlpete
*/
class WikipediaDEBridge extends BridgeAbstract{
public function collectData(array $param){
$html = '';
$host = 'http://de.wikipedia.org';
// If you want HTTPS access instead, uncomment the following line:
//$host = 'https://en.wikipedia.org';
$link = '/wiki/Wikipedia:Hauptseite';
$html = file_get_html($host.$link) or $this->returnError('Could not request Wikipedia DE.', 404);
$element = $html->find('div[id=mf-tfa]', 0);
$element->find('div', -1)->outertext = '';
$item = new \Item();
$item->uri = $host.$element->find('p', 0)->find('a', 0)->href;
$item->title = $element->find('p',0)->find('a',0)->title;
$html2 = file_get_html($item->uri) or $this->returnError('Could not request Wikipedia DE '.$item->title.'.', 404);
$element2 = $html2->find('div[id=mw-content-text]', 0);
$item->content = str_replace('href="/', 'href="'.$host.'/', $element2->innertext);
$this->items[] = $item;
}
public function getName(){
return 'Wikipedia DE "Today\'s Featured Article"';
}
public function getURI(){
return 'https://de.wikipedia.org/wiki/Wikipedia:Hauptseite';
}
public function getCacheDuration(){
return 3600*8; // 8 hours
}
}

View file

@ -14,7 +14,7 @@
class WordPressBridge extends BridgeAbstract { class WordPressBridge extends BridgeAbstract {
private $url; private $url;
private $name; public $name;
public function collectData(array $param) { public function collectData(array $param) {
$this->processParams($param); $this->processParams($param);

View file

@ -10,8 +10,8 @@ define('WORLD_OF_TANKS', 'http://worldoftanks.eu/');
define('NEWS', '/news/'); define('NEWS', '/news/');
class WorldOfTanks extends HttpCachingBridgeAbstract{ class WorldOfTanks extends HttpCachingBridgeAbstract{
private $lang = "fr"; private $lang = "fr";
private $uri = WORLD_OF_TANKS; public $uri = WORLD_OF_TANKS;
private $name = 'World of tanks news'; public $name = 'World of tanks news';
public function collectData(array $param){ public function collectData(array $param){
if (!empty($param['lang'])) { if (!empty($param['lang'])) {

View file

@ -24,7 +24,13 @@ class FileCache extends CacheAbstract{
public function saveData($datas){ public function saveData($datas){
$this->isPrepareCache(); $this->isPrepareCache();
file_put_contents($this->getCacheFile(), json_encode($datas)); $writeStream = file_put_contents($this->getCacheFile(), json_encode($datas));
if(!$writeStream) {
throw new \Exception("Cannot write the cache... Do you have the right permissions ?");
}
return $this; return $this;
} }

View file

@ -1,5 +1,4 @@
<?php <?php
$time_start = microtime(true);
/* /*
TODO : TODO :
- manage SSL detection because if library isn't loaded, some bridge crash ! - manage SSL detection because if library isn't loaded, some bridge crash !
@ -14,7 +13,7 @@ TODO :
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
error_reporting(0); error_reporting(0);
ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only. //ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only.
// extensions check // extensions check
if (!extension_loaded('openssl')) if (!extension_loaded('openssl'))
@ -98,14 +97,20 @@ try{
$bridge->setDatas($_REQUEST); $bridge->setDatas($_REQUEST);
$bridge->loadMetadatas(); $bridge->loadMetadatas();
// Data transformation // Data transformation
try {
$format = Format::create($format); $format = Format::create($format);
$format $format
->setDatas($bridge->getDatas()) ->setDatas($bridge->getDatas())
->setExtraInfos(array( ->setExtraInfos(array(
'name' => $bridge->name, 'name' => $bridge->getName(),
'uri' => $bridge->uri, 'uri' => $bridge->getURI(),
)) ))
->display(); ->display();
} catch(Exception $e) {
echo "The brige has crashed. You should report this to the bridges maintainer";
}
die; die;
} }
break; break;
@ -140,7 +145,11 @@ function getHelperButtonsFormat($formats){
function displayBridgeCard($bridgeName, $formats, $isActive = true) function displayBridgeCard($bridgeName, $formats, $isActive = true)
{ {
$bridgeElement = Bridge::create($bridgeName); $bridgeElement = Bridge::create($bridgeName);
if($bridgeElement == false) {
return "";
}
$bridgeElement->loadMetadatas(); $bridgeElement->loadMetadatas();
$name = '<a href="'.$bridgeElement->uri.'">'.$bridgeElement->name.'</a>'; $name = '<a href="'.$bridgeElement->uri.'">'.$bridgeElement->name.'</a>';
@ -269,10 +278,7 @@ $formats = Format::searchInformation();
?> ?>
<footer> <footer>
<?= $activeFoundBridgeCount; ?>/<?= count($whitelist_selection) ?> active bridges (<a href="?show_inactive=1">Show inactive</a>)<br /> <?= $activeFoundBridgeCount; ?>/<?= count($whitelist_selection) ?> active bridges (<a href="?show_inactive=1">Show inactive</a>)<br />
<a href="https://github.com/sebsauvage/rss-bridge">RSS-Bridge alpha 0.1 ~ Public Domain</a> <a href="https://github.com/sebsauvage/rss-bridge">RSS-Bridge alpha 0.2 ~ Public Domain</a>
</footer> </footer>
</body> </body>
</html> </html>
<?php
echo "Ran for ". (microtime(true) - $time_start);
?>

View file

@ -8,6 +8,8 @@ interface BridgeInterface{
public function collectData(array $param); public function collectData(array $param);
public function getCacheDuration(); public function getCacheDuration();
public function loadMetadatas(); public function loadMetadatas();
public function getName();
public function getURI();
} }
abstract class BridgeAbstract implements BridgeInterface{ abstract class BridgeAbstract implements BridgeInterface{
@ -207,6 +209,19 @@ class Bridge{
throw new \LogicException('Please use ' . __CLASS__ . '::create for new object.'); throw new \LogicException('Please use ' . __CLASS__ . '::create for new object.');
} }
/**
* Checks if a bridge is an instantiable bridge.
* @param string $nameBridge name of the bridge that you want to use
* @return true if it is an instantiable bridge, false otherwise.
*/
static public function isInstantiable($nameBridge) {
$re = new ReflectionClass($nameBridge);
return $re->IsInstantiable();
}
/** /**
* Create a new bridge object * Create a new bridge object
* @param string $nameBridge Defined bridge name you want use * @param string $nameBridge Defined bridge name you want use
@ -225,7 +240,11 @@ class Bridge{
require_once $pathBridge; require_once $pathBridge;
if(Bridge::isInstantiable($nameBridge)) {
return new $nameBridge(); return new $nameBridge();
} else {
return FALSE;
}
} }
static public function setDir($dirBridge){ static public function setDir($dirBridge){