[phpcs] enforce single quotes (#732)
* [phpcs] Add rule to enforce single quoted strings
This commit is contained in:
parent
5ea79ac1fc
commit
193ca87afa
43 changed files with 283 additions and 279 deletions
|
@ -19,7 +19,7 @@ class BlaguesDeMerdeBridge extends BridgeAbstract {
|
||||||
$item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
|
$item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
|
||||||
$uri = $temp[2]->href;
|
$uri = $temp[2]->href;
|
||||||
$item['uri'] = $uri;
|
$item['uri'] = $uri;
|
||||||
$item['title'] = substr($uri, (strrpos($uri, "/") + 1));
|
$item['title'] = substr($uri, (strrpos($uri, '/') + 1));
|
||||||
$date = $element->find('li.bdm_date', 0)->innertext;
|
$date = $element->find('li.bdm_date', 0)->innertext;
|
||||||
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
|
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
|
||||||
$item['timestamp'] = $time;
|
$item['timestamp'] = $time;
|
||||||
|
|
|
@ -23,14 +23,14 @@ class CADBridge extends FeedExpander {
|
||||||
if($html3 == false)
|
if($html3 == false)
|
||||||
return 'Daily comic not released yet';
|
return 'Daily comic not released yet';
|
||||||
|
|
||||||
$htmlpart = explode("/", $url);
|
$htmlpart = explode('/', $url);
|
||||||
|
|
||||||
switch ($htmlpart[3]) {
|
switch ($htmlpart[3]) {
|
||||||
case 'cad':
|
case 'cad':
|
||||||
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2);
|
preg_match_all('/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/', $html3, $url2);
|
||||||
break;
|
break;
|
||||||
case 'sillies':
|
case 'sillies':
|
||||||
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/sillies-\S*gif/", $html3, $url2);
|
preg_match_all('/http:\/\/cdn2\.cad-comic\.com\/comics\/sillies-\S*gif/', $html3, $url2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 'Daily comic not released yet';
|
return 'Daily comic not released yet';
|
||||||
|
|
|
@ -25,7 +25,7 @@ class CopieDoubleBridge extends BridgeAbstract {
|
||||||
} elseif(strpos($element->innertext, '/images/suivant.gif') === false) {
|
} elseif(strpos($element->innertext, '/images/suivant.gif') === false) {
|
||||||
$a = $element->find('a', 0);
|
$a = $element->find('a', 0);
|
||||||
$item['uri'] = self::URI . $a->href;
|
$item['uri'] = self::URI . $a->href;
|
||||||
$content = str_replace('src="/', 'src="/' . self::URI, $element->find("td", 0)->innertext);
|
$content = str_replace('src="/', 'src="/' . self::URI, $element->find('td', 0)->innertext);
|
||||||
$content = str_replace('href="/', 'href="' . self::URI, $content);
|
$content = str_replace('href="/', 'href="' . self::URI, $content);
|
||||||
$item['content'] = $content;
|
$item['content'] = $content;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
|
@ -11,7 +11,7 @@ class CourrierInternationalBridge extends BridgeAbstract {
|
||||||
$html = getSimpleHTMLDOM(self::URI)
|
$html = getSimpleHTMLDOM(self::URI)
|
||||||
or returnServerError('Error.');
|
or returnServerError('Error.');
|
||||||
|
|
||||||
$element = $html->find("article");
|
$element = $html->find('article');
|
||||||
$article_count = 1;
|
$article_count = 1;
|
||||||
|
|
||||||
foreach($element as $article) {
|
foreach($element as $article) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CpasbienBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$request = str_replace(" ", "-", trim($this->getInput('q')));
|
$request = str_replace(' ', '-', trim($this->getInput('q')));
|
||||||
$html = getSimpleHTMLDOM(self::URI . '/recherche/' . urlencode($request) . '.html')
|
$html = getSimpleHTMLDOM(self::URI . '/recherche/' . urlencode($request) . '.html')
|
||||||
or returnServerError('No results for this query.');
|
or returnServerError('No results for this query.');
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class DanbooruBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = $element->find('a', 0)->href;
|
$item['uri'] = $element->find('a', 0)->href;
|
||||||
$item['postid'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE));
|
$item['postid'] = (int)preg_replace('/[^0-9]/', '', $element->getAttribute(static::IDATTRIBUTE));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $element->find('img', 0)->src;
|
$thumbnailUri = $element->find('img', 0)->src;
|
||||||
$item['tags'] = $this->getTags($element);
|
$item['tags'] = $this->getTags($element);
|
||||||
|
|
|
@ -35,11 +35,11 @@ class DemoBridge extends BridgeAbstract {
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['author'] = "Me!";
|
$item['author'] = 'Me!';
|
||||||
$item['title'] = "Test";
|
$item['title'] = 'Test';
|
||||||
$item['content'] = "Awesome content !";
|
$item['content'] = 'Awesome content !';
|
||||||
$item['id'] = "Lalala";
|
$item['id'] = 'Lalala';
|
||||||
$item['uri'] = "http://example.com/test";
|
$item['uri'] = 'http://example.com/test';
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,59 +42,59 @@ class DiscogsBridge extends BridgeAbstract {
|
||||||
if(!empty($this->getInput('artistid')) || !empty($this->getInput('labelid'))) {
|
if(!empty($this->getInput('artistid')) || !empty($this->getInput('labelid'))) {
|
||||||
|
|
||||||
if(!empty($this->getInput('artistid'))) {
|
if(!empty($this->getInput('artistid'))) {
|
||||||
$data = getContents("https://api.discogs.com/artists/"
|
$data = getContents('https://api.discogs.com/artists/'
|
||||||
. $this->getInput('artistid')
|
. $this->getInput('artistid')
|
||||||
. "/releases?sort=year&sort_order=desc")
|
. '/releases?sort=year&sort_order=desc')
|
||||||
or returnServerError("Unable to query discogs !");
|
or returnServerError('Unable to query discogs !');
|
||||||
} elseif(!empty($this->getInput('labelid'))) {
|
} elseif(!empty($this->getInput('labelid'))) {
|
||||||
$data = getContents("https://api.discogs.com/labels/"
|
$data = getContents('https://api.discogs.com/labels/'
|
||||||
. $this->getInput('labelid')
|
. $this->getInput('labelid')
|
||||||
. "/releases?sort=year&sort_order=desc")
|
. '/releases?sort=year&sort_order=desc')
|
||||||
or returnServerError("Unable to query discogs !");
|
or returnServerError('Unable to query discogs !');
|
||||||
}
|
}
|
||||||
|
|
||||||
$jsonData = json_decode($data, true);
|
$jsonData = json_decode($data, true);
|
||||||
foreach($jsonData["releases"] as $release) {
|
foreach($jsonData['releases'] as $release) {
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item["author"] = $release["artist"];
|
$item['author'] = $release['artist'];
|
||||||
$item["title"] = $release["title"];
|
$item['title'] = $release['title'];
|
||||||
$item["id"] = $release["id"];
|
$item['id'] = $release['id'];
|
||||||
$resId = array_key_exists("main_release", $release) ? $release["main_release"] : $release["id"];
|
$resId = array_key_exists('main_release', $release) ? $release['main_release'] : $release['id'];
|
||||||
$item["uri"] = self::URI . $this->getInput('artistid') . "/release/" . $resId;
|
$item['uri'] = self::URI . $this->getInput('artistid') . '/release/' . $resId;
|
||||||
$item["timestamp"] = DateTime::createFromFormat("Y", $release["year"])->getTimestamp();
|
$item['timestamp'] = DateTime::createFromFormat('Y', $release['year'])->getTimestamp();
|
||||||
$item["content"] = $item["author"] . " - " . $item["title"];
|
$item['content'] = $item['author'] . ' - ' . $item['title'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif(!empty($this->getInput("username_wantlist")) || !empty($this->getInput("username_folder"))) {
|
} elseif(!empty($this->getInput('username_wantlist')) || !empty($this->getInput('username_folder'))) {
|
||||||
|
|
||||||
if(!empty($this->getInput("username_wantlist"))) {
|
if(!empty($this->getInput('username_wantlist'))) {
|
||||||
$data = getContents("https://api.discogs.com/users/"
|
$data = getContents('https://api.discogs.com/users/'
|
||||||
. $this->getInput('username_wantlist')
|
. $this->getInput('username_wantlist')
|
||||||
. "/wants?sort=added&sort_order=desc")
|
. '/wants?sort=added&sort_order=desc')
|
||||||
or returnServerError("Unable to query discogs !");
|
or returnServerError('Unable to query discogs !');
|
||||||
$jsonData = json_decode($data, true)["wants"];
|
$jsonData = json_decode($data, true)['wants'];
|
||||||
|
|
||||||
} elseif(!empty($this->getInput("username_folder"))) {
|
} elseif(!empty($this->getInput('username_folder'))) {
|
||||||
$data = getContents("https://api.discogs.com/users/"
|
$data = getContents('https://api.discogs.com/users/'
|
||||||
. $this->getInput('username_folder')
|
. $this->getInput('username_folder')
|
||||||
. "/collection/folders/"
|
. '/collection/folders/'
|
||||||
. $this->getInput("folderid")
|
. $this->getInput('folderid')
|
||||||
."/releases?sort=added&sort_order=desc")
|
.'/releases?sort=added&sort_order=desc')
|
||||||
or returnServerError("Unable to query discogs !");
|
or returnServerError('Unable to query discogs !');
|
||||||
$jsonData = json_decode($data, true)["releases"];
|
$jsonData = json_decode($data, true)['releases'];
|
||||||
}
|
}
|
||||||
foreach($jsonData as $element) {
|
foreach($jsonData as $element) {
|
||||||
|
|
||||||
$infos = $element["basic_information"];
|
$infos = $element['basic_information'];
|
||||||
$item = array();
|
$item = array();
|
||||||
$item["title"] = $infos["title"];
|
$item['title'] = $infos['title'];
|
||||||
$item["author"] = $infos["artists"][0]["name"];
|
$item['author'] = $infos['artists'][0]['name'];
|
||||||
$item["id"] = $infos["artists"][0]["id"];
|
$item['id'] = $infos['artists'][0]['id'];
|
||||||
$item["uri"] = self::URI . $infos["artists"][0]["id"] . "/release/" . $infos["id"];
|
$item['uri'] = self::URI . $infos['artists'][0]['id'] . '/release/' . $infos['id'];
|
||||||
$item["timestamp"] = strtotime($element["date_added"]);
|
$item['timestamp'] = strtotime($element['date_added']);
|
||||||
$item["content"] = $item["author"] . " - " . $item["title"];
|
$item['content'] = $item['author'] . ' - ' . $item['title'];
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class ETTVBridge extends BridgeAbstract {
|
class ETTVBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const MAINTAINER = "GregThib";
|
const MAINTAINER = 'GregThib';
|
||||||
const NAME = 'ETTV';
|
const NAME = 'ETTV';
|
||||||
const URI = 'https://www.ettv.tv/';
|
const URI = 'https://www.ettv.tv/';
|
||||||
const DESCRIPTION = 'Returns list of 20 latest torrents for a specific search.';
|
const DESCRIPTION = 'Returns list of 20 latest torrents for a specific search.';
|
||||||
|
@ -113,7 +113,7 @@ class ETTVBridge extends BridgeAbstract {
|
||||||
$entry = $element->find('td', 1)->find('a', 0);
|
$entry = $element->find('td', 1)->find('a', 0);
|
||||||
|
|
||||||
// retrieve result page to get more details
|
// retrieve result page to get more details
|
||||||
$link = rtrim(self::URI, "/") . $entry->href;
|
$link = rtrim(self::URI, '/') . $entry->href;
|
||||||
$page = getSimpleHTMLDOM($link)
|
$page = getSimpleHTMLDOM($link)
|
||||||
or returnServerError('Could not request page ' . $link);
|
or returnServerError('Could not request page ' . $link);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class EZTVBridge extends BridgeAbstract {
|
class EZTVBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const MAINTAINER = "alexAubin";
|
const MAINTAINER = 'alexAubin';
|
||||||
const NAME = 'EZTV';
|
const NAME = 'EZTV';
|
||||||
const URI = 'https://eztv.ch/';
|
const URI = 'https://eztv.ch/';
|
||||||
const DESCRIPTION = 'Returns list of *recent* torrents for a specific show
|
const DESCRIPTION = 'Returns list of *recent* torrents for a specific show
|
||||||
|
@ -23,15 +23,15 @@ on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.';
|
||||||
$relativeDays = 0;
|
$relativeDays = 0;
|
||||||
$relativeHours = 0;
|
$relativeHours = 0;
|
||||||
|
|
||||||
foreach(explode(" ", $relativeReleaseTime) as $relativeTimeElement) {
|
foreach(explode(' ', $relativeReleaseTime) as $relativeTimeElement) {
|
||||||
if(substr($relativeTimeElement, -1) == "d") $relativeDays = substr($relativeTimeElement, 0, -1);
|
if(substr($relativeTimeElement, -1) == 'd') $relativeDays = substr($relativeTimeElement, 0, -1);
|
||||||
if(substr($relativeTimeElement, -1) == "h") $relativeHours = substr($relativeTimeElement, 0, -1);
|
if(substr($relativeTimeElement, -1) == 'h') $relativeHours = substr($relativeTimeElement, 0, -1);
|
||||||
}
|
}
|
||||||
return mktime(date('h') - $relativeHours, 0, 0, date('m'), date('d') - $relativeDays, date('Y'));
|
return mktime(date('h') - $relativeHours, 0, 0, date('m'), date('d') - $relativeDays, date('Y'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop on show ids
|
// Loop on show ids
|
||||||
$showList = explode(",", $this->getInput('i'));
|
$showList = explode(',', $this->getInput('i'));
|
||||||
foreach($showList as $showID) {
|
foreach($showList as $showID) {
|
||||||
|
|
||||||
// Get show page
|
// Get show page
|
||||||
|
|
|
@ -103,19 +103,19 @@ EOD;
|
||||||
$html = $this->buildContent($fileContent);
|
$html = $this->buildContent($fileContent);
|
||||||
$author = $this->getInput('u');
|
$author = $this->getInput('u');
|
||||||
|
|
||||||
foreach($html->find("article") as $content) {
|
foreach($html->find('article') as $content) {
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$item['uri'] = "http://touch.facebook.com"
|
$item['uri'] = 'http://touch.facebook.com'
|
||||||
. $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find("a", 0)->getAttribute("href");
|
. $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href');
|
||||||
|
|
||||||
if($content->find("header", 0) !== null) {
|
if($content->find('header', 0) !== null) {
|
||||||
$content->find("header", 0)->innertext = "";
|
$content->find('header', 0)->innertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($content->find("footer", 0) !== null) {
|
if($content->find('footer', 0) !== null) {
|
||||||
$content->find("footer", 0)->innertext = "";
|
$content->find('footer', 0)->innertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove html nodes, keep only img, links, basic formatting
|
//Remove html nodes, keep only img, links, basic formatting
|
||||||
|
@ -168,7 +168,7 @@ EOD;
|
||||||
$regex = implode(
|
$regex = implode(
|
||||||
'',
|
'',
|
||||||
array(
|
array(
|
||||||
"/timeline_unit",
|
'/timeline_unit',
|
||||||
"\\\\\\\\u00253A1",
|
"\\\\\\\\u00253A1",
|
||||||
"\\\\\\\\u00253A([0-9]*)",
|
"\\\\\\\\u00253A([0-9]*)",
|
||||||
"\\\\\\\\u00253A([0-9]*)",
|
"\\\\\\\\u00253A([0-9]*)",
|
||||||
|
@ -182,18 +182,18 @@ EOD;
|
||||||
return implode(
|
return implode(
|
||||||
'',
|
'',
|
||||||
array(
|
array(
|
||||||
"https://touch.facebook.com/pages_reaction_units/more/?page_id=",
|
'https://touch.facebook.com/pages_reaction_units/more/?page_id=',
|
||||||
$pageID,
|
$pageID,
|
||||||
"&cursor=%7B%22timeline_cursor%22%3A%22timeline_unit%3A1%3A",
|
'&cursor=%7B%22timeline_cursor%22%3A%22timeline_unit%3A1%3A',
|
||||||
$result[1],
|
$result[1],
|
||||||
"%3A",
|
'%3A',
|
||||||
$result[2],
|
$result[2],
|
||||||
"%3A",
|
'%3A',
|
||||||
$result[3],
|
$result[3],
|
||||||
"%3A",
|
'%3A',
|
||||||
$result[4],
|
$result[4],
|
||||||
"%22%2C%22timeline_section_cursor%22%3A%7B%7D%2C%22",
|
'%22%2C%22timeline_section_cursor%22%3A%7B%7D%2C%22',
|
||||||
"has_next_page%22%3Atrue%7D&surface=mobile_page_home&unit_count=3"
|
'has_next_page%22%3Atrue%7D&surface=mobile_page_home&unit_count=3'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ EOD;
|
||||||
//Builds the HTML from the encoded JS that Facebook provides.
|
//Builds the HTML from the encoded JS that Facebook provides.
|
||||||
private function buildContent($pageContent){
|
private function buildContent($pageContent){
|
||||||
|
|
||||||
$regex = "/\\\"html\\\":\\\"(.*?)\\\",\\\"replace/";
|
$regex = '/\\"html\\":\\"(.*?)\\",\\"replace/';
|
||||||
preg_match($regex, $pageContent, $result);
|
preg_match($regex, $pageContent, $result);
|
||||||
|
|
||||||
return str_get_html(html_entity_decode(json_decode('"' . $result[1] . '"')));
|
return str_get_html(html_entity_decode(json_decode('"' . $result[1] . '"')));
|
||||||
|
@ -214,7 +214,7 @@ EOD;
|
||||||
|
|
||||||
$ctx = stream_context_create(array(
|
$ctx = stream_context_create(array(
|
||||||
'http' => array(
|
'http' => array(
|
||||||
'user_agent' => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0",
|
'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0',
|
||||||
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -222,12 +222,12 @@ EOD;
|
||||||
$a = file_get_contents($pageURL, 0, $ctx);
|
$a = file_get_contents($pageURL, 0, $ctx);
|
||||||
|
|
||||||
//First request to get the cookie
|
//First request to get the cookie
|
||||||
$cookies = "";
|
$cookies = '';
|
||||||
foreach($http_response_header as $hdr) {
|
foreach($http_response_header as $hdr) {
|
||||||
if(strpos($hdr, "Set-Cookie") !== false) {
|
if(strpos($hdr, 'Set-Cookie') !== false) {
|
||||||
$cLine = explode(":", $hdr)[1];
|
$cLine = explode(':', $hdr)[1];
|
||||||
$cLine = explode(";", $cLine)[0];
|
$cLine = explode(';', $cLine)[0];
|
||||||
$cookies .= ";" . $cLine;
|
$cookies .= ';' . $cLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ EOD;
|
||||||
|
|
||||||
$context = stream_context_create(array(
|
$context = stream_context_create(array(
|
||||||
'http' => array(
|
'http' => array(
|
||||||
'user_agent' => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0",
|
'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0',
|
||||||
'header' => 'Cookie: ' . $cookies
|
'header' => 'Cookie: ' . $cookies
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -247,12 +247,12 @@ EOD;
|
||||||
|
|
||||||
$pageContent = file_get_contents($page, 0, $context);
|
$pageContent = file_get_contents($page, 0, $context);
|
||||||
|
|
||||||
if(strpos($pageContent, "signup-button") != false) {
|
if(strpos($pageContent, 'signup-button') != false) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the page ID if we don't have a captcha
|
//Get the page ID if we don't have a captcha
|
||||||
$regex = "/page_id=([0-9]*)&/";
|
$regex = '/page_id=([0-9]*)&/';
|
||||||
preg_match($regex, $pageContent, $matches);
|
preg_match($regex, $pageContent, $matches);
|
||||||
|
|
||||||
if(count($matches) > 0) {
|
if(count($matches) > 0) {
|
||||||
|
@ -260,7 +260,7 @@ EOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the page ID if we do have a captcha
|
//Get the page ID if we do have a captcha
|
||||||
$regex = "/\"pageID\":\"([0-9]*)\"/";
|
$regex = '/"pageID":"([0-9]*)"/';
|
||||||
preg_match($regex, $pageContent, $matches);
|
preg_match($regex, $pageContent, $matches);
|
||||||
|
|
||||||
return $matches[1];
|
return $matches[1];
|
||||||
|
|
|
@ -102,7 +102,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
if (isset($_SESSION['captcha_fields'], $_SESSION['captcha_action'])) {
|
if (isset($_SESSION['captcha_fields'], $_SESSION['captcha_action'])) {
|
||||||
$captcha_action = $_SESSION['captcha_action'];
|
$captcha_action = $_SESSION['captcha_action'];
|
||||||
$captcha_fields = $_SESSION['captcha_fields'];
|
$captcha_fields = $_SESSION['captcha_fields'];
|
||||||
$captcha_fields['captcha_response'] = preg_replace("/[^a-zA-Z0-9]+/", "", $_POST['captcha_response']);
|
$captcha_fields['captcha_response'] = preg_replace('/[^a-zA-Z0-9]+/', '', $_POST['captcha_response']);
|
||||||
|
|
||||||
$header = array("Content-type:
|
$header = array("Content-type:
|
||||||
application/x-www-form-urlencoded\r\nReferer: $captcha_action\r\nCookie: noscript=1\r\n");
|
application/x-www-form-urlencoded\r\nReferer: $captcha_action\r\nCookie: noscript=1\r\n");
|
||||||
|
@ -153,11 +153,11 @@ application/x-www-form-urlencoded\r\nReferer: $captcha_action\r\nCookie: noscrip
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// First character cannot be a forward slash
|
// First character cannot be a forward slash
|
||||||
if(strpos($this->getInput('u'), "/") === 0) {
|
if(strpos($this->getInput('u'), '/') === 0) {
|
||||||
returnClientError('Remove leading slash "/" from the username!');
|
returnClientError('Remove leading slash "/" from the username!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strpos($this->getInput('u'), "/")) {
|
if(!strpos($this->getInput('u'), '/')) {
|
||||||
$html = getSimpleHTMLDOM(self::URI . urlencode($this->getInput('u')) . '?_fb_noscript=1', $header)
|
$html = getSimpleHTMLDOM(self::URI . urlencode($this->getInput('u')) . '?_fb_noscript=1', $header)
|
||||||
or returnServerError('No results for this query.');
|
or returnServerError('No results for this query.');
|
||||||
} else {
|
} else {
|
||||||
|
@ -305,7 +305,7 @@ EOD;
|
||||||
);
|
);
|
||||||
|
|
||||||
//Retrieve date of the post
|
//Retrieve date of the post
|
||||||
$date = $post->find("abbr")[0];
|
$date = $post->find('abbr')[0];
|
||||||
if(isset($date) && $date->hasAttribute('data-utime')) {
|
if(isset($date) && $date->hasAttribute('data-utime')) {
|
||||||
$date = $date->getAttribute('data-utime');
|
$date = $date->getAttribute('data-utime');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,47 +15,47 @@ class FootitoBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$content = trim($element->innertext);
|
$content = trim($element->innertext);
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"<img",
|
'<img',
|
||||||
"<img style='float : left;'",
|
"<img style='float : left;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"logo\"",
|
'class="logo"',
|
||||||
"style='float : left;'",
|
"style='float : left;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"contenu\"",
|
'class="contenu"',
|
||||||
"style='margin-left : 60px;'",
|
"style='margin-left : 60px;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"responsive-comment\"",
|
'class="responsive-comment"',
|
||||||
"style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'",
|
"style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"jaime\"",
|
'class="jaime"',
|
||||||
"style='display : none;'",
|
"style='display : none;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"auteur-event responsive\"",
|
'class="auteur-event responsive"',
|
||||||
"style='display : none;'",
|
"style='display : none;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"report-abuse-button\"",
|
'class="report-abuse-button"',
|
||||||
"style='display : none;'",
|
"style='display : none;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"reaction clearfix\"",
|
'class="reaction clearfix"',
|
||||||
"style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'",
|
"style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
"class=\"infos\"",
|
'class="infos"',
|
||||||
"style='font-size : 0.7em;'",
|
"style='font-size : 0.7em;'",
|
||||||
$content );
|
$content );
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class FourchanBridge extends BridgeAbstract {
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($this->getURI())
|
$html = getSimpleHTMLDOM($this->getURI())
|
||||||
or returnServerError("Could not request 4chan, thread not found");
|
or returnServerError('Could not request 4chan, thread not found');
|
||||||
|
|
||||||
foreach($html->find('div.postContainer') as $element) {
|
foreach($html->find('div.postContainer') as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
|
@ -106,7 +106,7 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||||
$content = $comment->parent()->innertext;
|
$content = $comment->parent()->innertext;
|
||||||
} else {
|
} else {
|
||||||
$title .= ' / ' . trim($comment->firstChild()->plaintext);
|
$title .= ' / ' . trim($comment->firstChild()->plaintext);
|
||||||
$content = "<pre>" . $comment->find('.comment-body', 0)->innertext . "</pre>";
|
$content = '<pre>' . $comment->find('.comment-body', 0)->innertext . '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
|
@ -19,26 +19,26 @@ class GoComicsBridge extends BridgeAbstract {
|
||||||
or returnServerError('Could not request GoComics: ' . $this->getURI());
|
or returnServerError('Could not request GoComics: ' . $this->getURI());
|
||||||
|
|
||||||
//Get info from first page
|
//Get info from first page
|
||||||
$author = preg_replace('/By /', '', $html->find(".media-subheading", 0)->plaintext);
|
$author = preg_replace('/By /', '', $html->find('.media-subheading', 0)->plaintext);
|
||||||
|
|
||||||
$link = self::URI . $html->find(".gc-deck--cta-0", 0)->find('a', 0)->href;
|
$link = self::URI . $html->find('.gc-deck--cta-0', 0)->find('a', 0)->href;
|
||||||
for($i = 0; $i < 5; $i++) {
|
for($i = 0; $i < 5; $i++) {
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$page = getSimpleHTMLDOM($link)
|
$page = getSimpleHTMLDOM($link)
|
||||||
or returnServerError('Could not request GoComics: ' . $link);
|
or returnServerError('Could not request GoComics: ' . $link);
|
||||||
$imagelink = $page->find(".img-fluid", 1)->src;
|
$imagelink = $page->find('.img-fluid', 1)->src;
|
||||||
$date = explode("/", $link);
|
$date = explode('/', $link);
|
||||||
|
|
||||||
$item['id'] = $imagelink;
|
$item['id'] = $imagelink;
|
||||||
$item['uri'] = $link;
|
$item['uri'] = $link;
|
||||||
$item['author'] = $author;
|
$item['author'] = $author;
|
||||||
$item['title'] = 'GoComics ' . $this->getInput('comicname');
|
$item['title'] = 'GoComics ' . $this->getInput('comicname');
|
||||||
$item['timestamp'] = DateTime::createFromFormat("Ymd", $date[5] . $date[6] . $date[7])->getTimestamp();
|
$item['timestamp'] = DateTime::createFromFormat('Ymd', $date[5] . $date[6] . $date[7])->getTimestamp();
|
||||||
$item['content'] = '<img src="' . $imagelink . '" />';
|
$item['content'] = '<img src="' . $imagelink . '" />';
|
||||||
|
|
||||||
$link = self::URI . $page->find(".js-previous-comic", 0)->href;
|
$link = self::URI . $page->find('.js-previous-comic', 0)->href;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class GoogleSearchBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const PARAMETERS = array(array(
|
const PARAMETERS = array(array(
|
||||||
'q' => array(
|
'q' => array(
|
||||||
'name' => "keyword",
|
'name' => 'keyword',
|
||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
|
@ -85,7 +85,7 @@ class InstagramBridge extends BridgeAbstract {
|
||||||
$item['content'] = $data[0];
|
$item['content'] = $data[0];
|
||||||
$item['enclosures'] = $data[1];
|
$item['enclosures'] = $data[1];
|
||||||
} else {
|
} else {
|
||||||
$item['content'] = '<img src="' . htmlentities($media->display_url) . '" alt="'. $item["title"] . '" />';
|
$item['content'] = '<img src="' . htmlentities($media->display_url) . '" alt="'. $item['title'] . '" />';
|
||||||
$item['enclosures'] = array($media->display_url);
|
$item['enclosures'] = array($media->display_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,8 @@ class KununuBridge extends BridgeAbstract {
|
||||||
* Encodes unmlauts in the given text
|
* Encodes unmlauts in the given text
|
||||||
*/
|
*/
|
||||||
private function encodeUmlauts($text){
|
private function encodeUmlauts($text){
|
||||||
$umlauts = Array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
|
$umlauts = Array('/ä/','/ö/','/ü/','/Ä/','/Ö/','/Ü/','/ß/');
|
||||||
$replace = Array("ae","oe","ue","Ae","Oe","Ue","ss");
|
$replace = Array('ae','oe','ue','Ae','Oe','Ue','ss');
|
||||||
|
|
||||||
return preg_replace($umlauts, $replace, $text);
|
return preg_replace($umlauts, $replace, $text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ region, and optionally a category and a keyword .';
|
||||||
if($content_image !== null) {
|
if($content_image !== null) {
|
||||||
$content = '<img src="' . $content_image->getAttribute('data-imgsrc') . '" alt="thumbnail">';
|
$content = '<img src="' . $content_image->getAttribute('data-imgsrc') . '" alt="thumbnail">';
|
||||||
} else {
|
} else {
|
||||||
$content = "";
|
$content = '';
|
||||||
}
|
}
|
||||||
$date = $element->find('aside.item_absolute', 0)->find('p.item_sup', 0);
|
$date = $element->find('aside.item_absolute', 0)->find('p.item_sup', 0);
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,16 @@ class LesJoiesDuCodeBridge extends BridgeAbstract {
|
||||||
// retrieve .gif instead of static .jpg
|
// retrieve .gif instead of static .jpg
|
||||||
$images = $temp->find('p img');
|
$images = $temp->find('p img');
|
||||||
foreach($images as $image) {
|
foreach($images as $image) {
|
||||||
$img_src = str_replace(".jpg", ".gif", $image->src);
|
$img_src = str_replace('.jpg', '.gif', $image->src);
|
||||||
$image->src = $img_src;
|
$image->src = $img_src;
|
||||||
}
|
}
|
||||||
$content = $temp->innertext;
|
$content = $temp->innertext;
|
||||||
|
|
||||||
$auteur = $temp->find('i', 0);
|
$auteur = $temp->find('i', 0);
|
||||||
$pos = strpos($auteur->innertext, "by");
|
$pos = strpos($auteur->innertext, 'by');
|
||||||
|
|
||||||
if($pos > 0) {
|
if($pos > 0) {
|
||||||
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
|
$auteur = trim(str_replace('*/', '', substr($auteur->innertext, ($pos + 2))));
|
||||||
$item['author'] = $auteur;
|
$item['author'] = $auteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ class MangareaderBridge extends BridgeAbstract {
|
||||||
case 'Get popular mangas':
|
case 'Get popular mangas':
|
||||||
// Find manga name within "Popular mangas for ..."
|
// Find manga name within "Popular mangas for ..."
|
||||||
$pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue;
|
$pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue;
|
||||||
$this->request = substr($pagetitle, 0, strrpos($pagetitle, " -"));
|
$this->request = substr($pagetitle, 0, strrpos($pagetitle, ' -'));
|
||||||
$this->getPopularMangas($xpath);
|
$this->getPopularMangas($xpath);
|
||||||
break;
|
break;
|
||||||
case 'Get manga updates':
|
case 'Get manga updates':
|
||||||
|
@ -120,7 +120,7 @@ class MangareaderBridge extends BridgeAbstract {
|
||||||
// Return some dummy-data if no content available
|
// Return some dummy-data if no content available
|
||||||
if(empty($this->items)) {
|
if(empty($this->items)) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['content'] = "<p>No updates available</p>";
|
$item['content'] = '<p>No updates available</p>';
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
@ -143,18 +143,18 @@ class MangareaderBridge extends BridgeAbstract {
|
||||||
$item['title'] = htmlspecialchars($manga->nodeValue);
|
$item['title'] = htmlspecialchars($manga->nodeValue);
|
||||||
|
|
||||||
// Add each chapter to the feed
|
// Add each chapter to the feed
|
||||||
$item['content'] = "";
|
$item['content'] = '';
|
||||||
|
|
||||||
foreach ($chapters as $chapter) {
|
foreach ($chapters as $chapter) {
|
||||||
if($item['content'] <> "") {
|
if($item['content'] <> '') {
|
||||||
$item['content'] .= "<br>";
|
$item['content'] .= '<br>';
|
||||||
}
|
}
|
||||||
$item['content'] .= "<a href='"
|
$item['content'] .= "<a href='"
|
||||||
. self::URI
|
. self::URI
|
||||||
. htmlspecialchars($chapter->getAttribute('href'))
|
. htmlspecialchars($chapter->getAttribute('href'))
|
||||||
. "'>"
|
. "'>"
|
||||||
. htmlspecialchars($chapter->nodeValue)
|
. htmlspecialchars($chapter->nodeValue)
|
||||||
. "</a>";
|
. '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
@ -211,13 +211,13 @@ EOD;
|
||||||
|
|
||||||
foreach ($chapters as $chapter) {
|
foreach ($chapters as $chapter) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)
|
$item['title'] = htmlspecialchars($xpath->query('td[1]', $chapter)
|
||||||
->item(0)
|
->item(0)
|
||||||
->nodeValue);
|
->nodeValue);
|
||||||
$item['uri'] = self::URI . $xpath->query("td[1]/a", $chapter)
|
$item['uri'] = self::URI . $xpath->query('td[1]/a', $chapter)
|
||||||
->item(0)
|
->item(0)
|
||||||
->getAttribute('href');
|
->getAttribute('href');
|
||||||
$item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)
|
$item['timestamp'] = strtotime($xpath->query('td[2]', $chapter)
|
||||||
->item(0)
|
->item(0)
|
||||||
->nodeValue);
|
->nodeValue);
|
||||||
array_unshift($this->items, $item);
|
array_unshift($this->items, $item);
|
||||||
|
@ -227,12 +227,12 @@ EOD;
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Get latest updates':
|
case 'Get latest updates':
|
||||||
$path = "latest";
|
$path = 'latest';
|
||||||
break;
|
break;
|
||||||
case 'Get popular mangas':
|
case 'Get popular mangas':
|
||||||
$path = "popular";
|
$path = 'popular';
|
||||||
if($this->getInput('category') !== "all") {
|
if($this->getInput('category') !== 'all') {
|
||||||
$path .= "/" . $this->getInput('category');
|
$path .= '/' . $this->getInput('category');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Get manga updates':
|
case 'Get manga updates':
|
||||||
|
|
|
@ -12,7 +12,7 @@ class NasaApodBridge extends BridgeAbstract {
|
||||||
$html = getSimpleHTMLDOM(self::URI . 'archivepix.html')
|
$html = getSimpleHTMLDOM(self::URI . 'archivepix.html')
|
||||||
or returnServerError('Error while downloading the website content');
|
or returnServerError('Error while downloading the website content');
|
||||||
|
|
||||||
$list = explode("<br>", $html->find('b', 0)->innertext);
|
$list = explode('<br>', $html->find('b', 0)->innertext);
|
||||||
|
|
||||||
for($i = 0; $i < 3; $i++) {
|
for($i = 0; $i < 3; $i++) {
|
||||||
$line = $list[$i];
|
$line = $list[$i];
|
||||||
|
@ -32,7 +32,7 @@ class NasaApodBridge extends BridgeAbstract {
|
||||||
$explanation = $picture_html->find('p', 2)->innertext;
|
$explanation = $picture_html->find('p', 2)->innertext;
|
||||||
|
|
||||||
//Extract date from the picture page
|
//Extract date from the picture page
|
||||||
$date = explode(" ", $picture_html->find('p', 1)->innertext);
|
$date = explode(' ', $picture_html->find('p', 1)->innertext);
|
||||||
$item['timestamp'] = strtotime($date[4] . $date[3] . $date[2]);
|
$item['timestamp'] = strtotime($date[4] . $date[3] . $date[2]);
|
||||||
|
|
||||||
//Other informations
|
//Other informations
|
||||||
|
|
|
@ -49,7 +49,7 @@ class NotAlwaysBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI(){
|
||||||
if(!is_null($this->getInput('filter'))) {
|
if(!is_null($this->getInput('filter'))) {
|
||||||
return self::URI . $this->getInput('filter') . "/";
|
return self::URI . $this->getInput('filter') . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getURI();
|
return parent::getURI();
|
||||||
|
|
|
@ -44,7 +44,7 @@ class PinterestBridge extends FeedExpander {
|
||||||
$pattern = '/https\:\/\/i\.pinimg\.com\/[a-zA-Z0-9]*x\//';
|
$pattern = '/https\:\/\/i\.pinimg\.com\/[a-zA-Z0-9]*x\//';
|
||||||
foreach($this->items as $item) {
|
foreach($this->items as $item) {
|
||||||
|
|
||||||
$item["content"] = preg_replace($pattern, 'https://i.pinimg.com/originals/', $item["content"]);
|
$item['content'] = preg_replace($pattern, 'https://i.pinimg.com/originals/', $item['content']);
|
||||||
$newitems[] = $item;
|
$newitems[] = $item;
|
||||||
}
|
}
|
||||||
$this->items = $newitems;
|
$this->items = $newitems;
|
||||||
|
@ -64,10 +64,10 @@ class PinterestBridge extends FeedExpander {
|
||||||
// provide even less info. Thus we attempt multiple options.
|
// provide even less info. Thus we attempt multiple options.
|
||||||
$item['title'] = trim($result['title']);
|
$item['title'] = trim($result['title']);
|
||||||
|
|
||||||
if($item['title'] === "")
|
if($item['title'] === '')
|
||||||
$item['title'] = trim($result['rich_summary']['display_name']);
|
$item['title'] = trim($result['rich_summary']['display_name']);
|
||||||
|
|
||||||
if($item['title'] === "")
|
if($item['title'] === '')
|
||||||
$item['title'] = trim($result['grid_description']);
|
$item['title'] = trim($result['grid_description']);
|
||||||
|
|
||||||
$item['timestamp'] = strtotime($result['created_at']);
|
$item['timestamp'] = strtotime($result['created_at']);
|
||||||
|
|
|
@ -33,40 +33,40 @@ class PixivBridge extends BridgeAbstract {
|
||||||
$count++;
|
$count++;
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item["id"] = $result["illustId"];
|
$item['id'] = $result['illustId'];
|
||||||
$item["uri"] = "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=" . $result["illustId"];
|
$item['uri'] = 'https://www.pixiv.net/member_illust.php?mode=medium&illust_id=' . $result['illustId'];
|
||||||
$item["title"] = $result["illustTitle"];
|
$item['title'] = $result['illustTitle'];
|
||||||
$item["author"] = $result["userName"];
|
$item['author'] = $result['userName'];
|
||||||
|
|
||||||
preg_match_all($timeRegex, $result["url"], $dt, PREG_SET_ORDER, 0);
|
preg_match_all($timeRegex, $result['url'], $dt, PREG_SET_ORDER, 0);
|
||||||
$elementDate = DateTime::createFromFormat("YmdHis",
|
$elementDate = DateTime::createFromFormat('YmdHis',
|
||||||
$dt[0][1] . $dt[0][2] . $dt[0][3] . $dt[0][4] . $dt[0][5] . $dt[0][6]);
|
$dt[0][1] . $dt[0][2] . $dt[0][3] . $dt[0][4] . $dt[0][5] . $dt[0][6]);
|
||||||
$item["timestamp"] = $elementDate->getTimestamp();
|
$item['timestamp'] = $elementDate->getTimestamp();
|
||||||
|
|
||||||
$item["content"] = "<img src='" . $this->cacheImage($result['url'], $item["id"]) . "' />";
|
$item['content'] = "<img src='" . $this->cacheImage($result['url'], $item['id']) . "' />";
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cacheImage($url, $illustId) {
|
public function cacheImage($url, $illustId) {
|
||||||
|
|
||||||
$url = str_replace("_master1200", "", $url);
|
$url = str_replace('_master1200', '', $url);
|
||||||
$url = str_replace("c/240x240/img-master/", "img-original/", $url);
|
$url = str_replace('c/240x240/img-master/', 'img-original/', $url);
|
||||||
$path = CACHE_DIR . '/pixiv_img';
|
$path = CACHE_DIR . '/pixiv_img';
|
||||||
|
|
||||||
if(!is_dir($path))
|
if(!is_dir($path))
|
||||||
mkdir($path, 0755, true);
|
mkdir($path, 0755, true);
|
||||||
|
|
||||||
if(!is_file($path . '/' . $illustId . '.jpeg')) {
|
if(!is_file($path . '/' . $illustId . '.jpeg')) {
|
||||||
$headers = array("Referer: https://www.pixiv.net/member_illust.php?mode=medium&illust_id=" . $illustId);
|
$headers = array('Referer: https://www.pixiv.net/member_illust.php?mode=medium&illust_id=' . $illustId);
|
||||||
$illust = getContents($url, $headers);
|
$illust = getContents($url, $headers);
|
||||||
if(strpos($illust, "404 Not Found") !== false) {
|
if(strpos($illust, '404 Not Found') !== false) {
|
||||||
$illust = getContents(str_replace("jpg", "png", $url), $headers);
|
$illust = getContents(str_replace('jpg', 'png', $url), $headers);
|
||||||
}
|
}
|
||||||
file_put_contents($path . '/' . $illustId . '.jpeg', $illust);
|
file_put_contents($path . '/' . $illustId . '.jpeg', $illust);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'cache/pixiv_img/' . $illustId . ".jpeg";
|
return 'cache/pixiv_img/' . $illustId . '.jpeg';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ class RainbowSixSiegeBridge extends BridgeAbstract {
|
||||||
const DESCRIPTION = 'Latest articles from the Rainbow Six Siege blog';
|
const DESCRIPTION = 'Latest articles from the Rainbow Six Siege blog';
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$dlUrl = "https://prod-tridionservice.ubisoft.com/live/v1/News/Latest?templateId=tcm%3A152-7677";
|
$dlUrl = 'https://prod-tridionservice.ubisoft.com/live/v1/News/Latest?templateId=tcm%3A152-7677';
|
||||||
$dlUrl .= "8-32&pageIndex=0&pageSize=10&language=en-US&detailPageId=tcm%3A152-194572-64";
|
$dlUrl .= '8-32&pageIndex=0&pageSize=10&language=en-US&detailPageId=tcm%3A152-194572-64';
|
||||||
$dlUrl .= "&keywordList=175426&siteId=undefined&useSeoFriendlyUrl=true";
|
$dlUrl .= '&keywordList=175426&siteId=undefined&useSeoFriendlyUrl=true';
|
||||||
$jsonString = getContents($dlUrl) or returnServerError('Error while downloading the website content');
|
$jsonString = getContents($dlUrl) or returnServerError('Error while downloading the website content');
|
||||||
|
|
||||||
$json = json_decode($jsonString, true);
|
$json = json_decode($jsonString, true);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ReadComicsBridge extends BridgeAbstract {
|
||||||
return $timestamp;
|
return $timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
$keywordsList = explode(";", $this->getInput('q'));
|
$keywordsList = explode(';', $this->getInput('q'));
|
||||||
foreach($keywordsList as $keywords) {
|
foreach($keywordsList as $keywords) {
|
||||||
$html = $this->getSimpleHTMLDOM(self::URI . 'comic/' . rawurlencode($keywords))
|
$html = $this->getSimpleHTMLDOM(self::URI . 'comic/' . rawurlencode($keywords))
|
||||||
or $this->returnServerError('Could not request readcomics.tv.');
|
or $this->returnServerError('Could not request readcomics.tv.');
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ReporterreBridge extends BridgeAbstract {
|
||||||
// Replace all relative urls with absolute ones
|
// Replace all relative urls with absolute ones
|
||||||
$text = preg_replace(
|
$text = preg_replace(
|
||||||
'/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims',
|
'/(href|src)(\=[\"\'])(?!http)([^"\']+)/ims',
|
||||||
"$1$2" . self::URI . "$3",
|
'$1$2' . self::URI . '$3',
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ class Rue89Bridge extends FeedExpander {
|
||||||
protected function parseItem($item){
|
protected function parseItem($item){
|
||||||
$item = parent::parseItem($item);
|
$item = parent::parseItem($item);
|
||||||
|
|
||||||
$url = "http://api.rue89.nouvelobs.com/export/mobile2/node/"
|
$url = 'http://api.rue89.nouvelobs.com/export/mobile2/node/'
|
||||||
. str_replace(" ", "", substr($item['uri'], -8))
|
. str_replace(' ', '', substr($item['uri'], -8))
|
||||||
. "/full";
|
. '/full';
|
||||||
|
|
||||||
$datas = json_decode(getContents($url), true);
|
$datas = json_decode(getContents($url), true);
|
||||||
$item['content'] = $datas['node']['body'];
|
$item['content'] = $datas['node']['body'];
|
||||||
|
|
|
@ -32,7 +32,7 @@ class SexactuBridge extends BridgeAbstract {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['author'] = self::AUTHOR;
|
$item['author'] = self::AUTHOR;
|
||||||
$item['title'] = $title->plaintext;
|
$item['title'] = $title->plaintext;
|
||||||
$urlAttribute = "data-href";
|
$urlAttribute = 'data-href';
|
||||||
$uri = $title->$urlAttribute;
|
$uri = $title->$urlAttribute;
|
||||||
if($uri === false)
|
if($uri === false)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ShanaprojectBridge extends BridgeAbstract {
|
||||||
// Getting the picture is a little bit tricky as it is part of the style.
|
// Getting the picture is a little bit tricky as it is part of the style.
|
||||||
// Luckily the style is part of the parent div :)
|
// Luckily the style is part of the parent div :)
|
||||||
|
|
||||||
if(preg_match("/url\(\/\/([^\)]+)\)/i", $anime->parent->style, $matches))
|
if(preg_match('/url\(\/\/([^\)]+)\)/i', $anime->parent->style, $matches))
|
||||||
return $matches[1];
|
return $matches[1];
|
||||||
|
|
||||||
returnServerError('Could not extract background image!');
|
returnServerError('Could not extract background image!');
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Shimmie2Bridge extends DanbooruBridge {
|
||||||
protected function getItemFromElement($element){
|
protected function getItemFromElement($element){
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = $this->getURI() . $element->href;
|
$item['uri'] = $this->getURI() . $element->href;
|
||||||
$item['id'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE));
|
$item['id'] = (int)preg_replace('/[^0-9]/', '', $element->getAttribute(static::IDATTRIBUTE));
|
||||||
$item['timestamp'] = time();
|
$item['timestamp'] = time();
|
||||||
$thumbnailUri = $this->getURI() . $element->find('img', 0)->src;
|
$thumbnailUri = $this->getURI() . $element->find('img', 0)->src;
|
||||||
$item['tags'] = $element->getAttribute('data-tags');
|
$item['tags'] = $element->getAttribute('data-tags');
|
||||||
|
|
|
@ -8,7 +8,7 @@ class SuperSmashBlogBridge extends BridgeAbstract {
|
||||||
const DESCRIPTION = 'Latest articles from the Super Smash Blog blog';
|
const DESCRIPTION = 'Latest articles from the Super Smash Blog blog';
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$dlUrl = "https://www.smashbros.com/data/bs/en_US/json/en_US.json";
|
$dlUrl = 'https://www.smashbros.com/data/bs/en_US/json/en_US.json';
|
||||||
|
|
||||||
$jsonString = getContents($dlUrl) or returnServerError('Error while downloading the website content');
|
$jsonString = getContents($dlUrl) or returnServerError('Error while downloading the website content');
|
||||||
$json = json_decode($jsonString, true);
|
$json = json_decode($jsonString, true);
|
||||||
|
|
|
@ -66,7 +66,7 @@ class VkBridge extends BridgeAbstract
|
||||||
$post->find('a.wall_post_more', 0)->outertext = '';
|
$post->find('a.wall_post_more', 0)->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content_suffix = "";
|
$content_suffix = '';
|
||||||
|
|
||||||
// looking for external links
|
// looking for external links
|
||||||
$external_link_selectors = array(
|
$external_link_selectors = array(
|
||||||
|
@ -81,8 +81,8 @@ class VkBridge extends BridgeAbstract
|
||||||
$innertext = $a->innertext;
|
$innertext = $a->innertext;
|
||||||
$parsed_url = parse_url($a->getAttribute('href'));
|
$parsed_url = parse_url($a->getAttribute('href'));
|
||||||
if (strpos($parsed_url['path'], '/away.php') !== 0) continue;
|
if (strpos($parsed_url['path'], '/away.php') !== 0) continue;
|
||||||
parse_str($parsed_url["query"], $parsed_query);
|
parse_str($parsed_url['query'], $parsed_query);
|
||||||
$content_suffix .= "<br>External link: <a href='" . $parsed_query["to"] . "'>$innertext</a>";
|
$content_suffix .= "<br>External link: <a href='" . $parsed_query['to'] . "'>$innertext</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +100,17 @@ class VkBridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
// looking for article
|
// looking for article
|
||||||
$article = $post->find("a.article_snippet", 0);
|
$article = $post->find('a.article_snippet', 0);
|
||||||
if (is_object($article)) {
|
if (is_object($article)) {
|
||||||
if (strpos($article->getAttribute('class'), "article_snippet_mini") !== false) {
|
if (strpos($article->getAttribute('class'), 'article_snippet_mini') !== false) {
|
||||||
$article_title_selector = "div.article_snippet_mini_title";
|
$article_title_selector = 'div.article_snippet_mini_title';
|
||||||
$article_author_selector = "div.article_snippet_mini_info > .mem_link,
|
$article_author_selector = 'div.article_snippet_mini_info > .mem_link,
|
||||||
div.article_snippet_mini_info > .group_link";
|
div.article_snippet_mini_info > .group_link';
|
||||||
$article_thumb_selector = "div.article_snippet_mini_thumb";
|
$article_thumb_selector = 'div.article_snippet_mini_thumb';
|
||||||
} else {
|
} else {
|
||||||
$article_title_selector = "div.article_snippet__title";
|
$article_title_selector = 'div.article_snippet__title';
|
||||||
$article_author_selector = "div.article_snippet__author";
|
$article_author_selector = 'div.article_snippet__author';
|
||||||
$article_thumb_selector = "div.article_snippet__image";
|
$article_thumb_selector = 'div.article_snippet__image';
|
||||||
}
|
}
|
||||||
$article_title = $article->find($article_title_selector, 0)->innertext;
|
$article_title = $article->find($article_title_selector, 0)->innertext;
|
||||||
$article_author = $article->find($article_author_selector, 0)->innertext;
|
$article_author = $article->find($article_author_selector, 0)->innertext;
|
||||||
|
@ -136,7 +136,7 @@ class VkBridge extends BridgeAbstract
|
||||||
// get all other videos
|
// get all other videos
|
||||||
foreach($post->find('a.page_post_thumb_video') as $a) {
|
foreach($post->find('a.page_post_thumb_video') as $a) {
|
||||||
$video_title = $a->getAttribute('aria-label');
|
$video_title = $a->getAttribute('aria-label');
|
||||||
$temp = explode(" ", $video_title, 2);
|
$temp = explode(' ', $video_title, 2);
|
||||||
if (count($temp) > 1) $video_title = $temp[1];
|
if (count($temp) > 1) $video_title = $temp[1];
|
||||||
$video_link = self::URI . ltrim( $a->getAttribute('href'), '/' );
|
$video_link = self::URI . ltrim( $a->getAttribute('href'), '/' );
|
||||||
$content_suffix .= "<br>Video: <a href='$video_link'>$video_title</a>";
|
$content_suffix .= "<br>Video: <a href='$video_link'>$video_title</a>";
|
||||||
|
@ -163,8 +163,8 @@ class VkBridge extends BridgeAbstract
|
||||||
// get photo documents
|
// get photo documents
|
||||||
foreach($post->find('a.page_doc_photo_href') as $a) {
|
foreach($post->find('a.page_doc_photo_href') as $a) {
|
||||||
$doc_link = self::URI . ltrim($a->getAttribute('href'), '/');
|
$doc_link = self::URI . ltrim($a->getAttribute('href'), '/');
|
||||||
$doc_gif_label_element = $a->find(".page_gif_label", 0);
|
$doc_gif_label_element = $a->find('.page_gif_label', 0);
|
||||||
$doc_title_element = $a->find(".doc_label", 0);
|
$doc_title_element = $a->find('.doc_label', 0);
|
||||||
|
|
||||||
if (is_object($doc_gif_label_element)) {
|
if (is_object($doc_gif_label_element)) {
|
||||||
$gif_preview_img = backgroundToImg($a->find('.page_doc_photo', 0));
|
$gif_preview_img = backgroundToImg($a->find('.page_doc_photo', 0));
|
||||||
|
@ -184,7 +184,7 @@ class VkBridge extends BridgeAbstract
|
||||||
|
|
||||||
// get other documents
|
// get other documents
|
||||||
foreach($post->find('div.page_doc_row') as $div) {
|
foreach($post->find('div.page_doc_row') as $div) {
|
||||||
$doc_title_element = $div->find("a.page_doc_title", 0);
|
$doc_title_element = $div->find('a.page_doc_title', 0);
|
||||||
|
|
||||||
if (is_object($doc_title_element)) {
|
if (is_object($doc_title_element)) {
|
||||||
$doc_title = $doc_title_element->innertext;
|
$doc_title = $doc_title_element->innertext;
|
||||||
|
@ -204,7 +204,7 @@ class VkBridge extends BridgeAbstract
|
||||||
$poll_title = $div->find('.page_media_poll_title', 0)->innertext;
|
$poll_title = $div->find('.page_media_poll_title', 0)->innertext;
|
||||||
$content_suffix .= "<br>Poll: $poll_title";
|
$content_suffix .= "<br>Poll: $poll_title";
|
||||||
foreach($div->find('div.page_poll_text') as $poll_stat_title) {
|
foreach($div->find('div.page_poll_text') as $poll_stat_title) {
|
||||||
$content_suffix .= "<br>- " . $poll_stat_title->innertext;
|
$content_suffix .= '<br>- ' . $poll_stat_title->innertext;
|
||||||
}
|
}
|
||||||
$div->outertext = '';
|
$div->outertext = '';
|
||||||
}
|
}
|
||||||
|
@ -231,10 +231,10 @@ class VkBridge extends BridgeAbstract
|
||||||
|
|
||||||
// get post link
|
// get post link
|
||||||
$post_link = $post->find('a.post_link', 0)->getAttribute('href');
|
$post_link = $post->find('a.post_link', 0)->getAttribute('href');
|
||||||
preg_match("/wall-?\d+_(\d+)/", $post_link, $preg_match_result);
|
preg_match('/wall-?\d+_(\d+)/', $post_link, $preg_match_result);
|
||||||
$item['post_id'] = intval($preg_match_result[1]);
|
$item['post_id'] = intval($preg_match_result[1]);
|
||||||
if (substr(self::URI, -1) == '/') {
|
if (substr(self::URI, -1) == '/') {
|
||||||
$post_link = self::URI . ltrim($post_link, "/");
|
$post_link = self::URI . ltrim($post_link, '/');
|
||||||
} else {
|
} else {
|
||||||
$post_link = self::URI . $post_link;
|
$post_link = self::URI . $post_link;
|
||||||
}
|
}
|
||||||
|
@ -273,17 +273,17 @@ class VkBridge extends BridgeAbstract
|
||||||
$data = json_decode($arg, true);
|
$data = json_decode($arg, true);
|
||||||
if ($data == null) return;
|
if ($data == null) return;
|
||||||
|
|
||||||
$thumb = $data['temp']['base'] . $data['temp']['x_'][0] . ".jpg";
|
$thumb = $data['temp']['base'] . $data['temp']['x_'][0] . '.jpg';
|
||||||
$original = '';
|
$original = '';
|
||||||
foreach(array('y_', 'z_', 'w_') as $key) {
|
foreach(array('y_', 'z_', 'w_') as $key) {
|
||||||
if (!isset($data['temp'][$key])) continue;
|
if (!isset($data['temp'][$key])) continue;
|
||||||
if (!isset($data['temp'][$key][0])) continue;
|
if (!isset($data['temp'][$key][0])) continue;
|
||||||
if (substr($data['temp'][$key][0], 0, 4) == "http") {
|
if (substr($data['temp'][$key][0], 0, 4) == 'http') {
|
||||||
$base = "";
|
$base = '';
|
||||||
} else {
|
} else {
|
||||||
$base = $data['temp']['base'];
|
$base = $data['temp']['base'];
|
||||||
}
|
}
|
||||||
$original = $base . $data['temp'][$key][0] . ".jpg";
|
$original = $base . $data['temp'][$key][0] . '.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($original) {
|
if ($original) {
|
||||||
|
@ -296,7 +296,7 @@ class VkBridge extends BridgeAbstract
|
||||||
private function getTitle($content)
|
private function getTitle($content)
|
||||||
{
|
{
|
||||||
preg_match('/^["\w\ \p{Cyrillic}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
|
preg_match('/^["\w\ \p{Cyrillic}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
|
||||||
if (count($result) == 0) return "untitled";
|
if (count($result) == 0) return 'untitled';
|
||||||
return $result[0];
|
return $result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ class WhydBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = '';
|
$html = '';
|
||||||
if(strlen(preg_replace("/[^0-9a-f]/", '', $this->getInput('u'))) == 24) {
|
if(strlen(preg_replace('/[^0-9a-f]/', '', $this->getInput('u'))) == 24) {
|
||||||
// is input the userid ?
|
// is input the userid ?
|
||||||
$html = getSimpleHTMLDOM(
|
$html = getSimpleHTMLDOM(
|
||||||
self::URI . 'u/' . preg_replace("/[^0-9a-f]/", '', $this->getInput('u'))
|
self::URI . 'u/' . preg_replace('/[^0-9a-f]/', '', $this->getInput('u'))
|
||||||
) or returnServerError('No results for this query.');
|
) or returnServerError('No results for this query.');
|
||||||
} else { // input may be the username
|
} else { // input may be the username
|
||||||
$html = getSimpleHTMLDOM(
|
$html = getSimpleHTMLDOM(
|
||||||
|
|
|
@ -12,72 +12,72 @@ class YGGTorrentBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const PARAMETERS = array(
|
const PARAMETERS = array(
|
||||||
array(
|
array(
|
||||||
"cat" => array(
|
'cat' => array(
|
||||||
"name" => "category",
|
'name' => 'category',
|
||||||
"type" => "list",
|
'type' => 'list',
|
||||||
"values" => array(
|
'values' => array(
|
||||||
"Toute les catégories" => "all.all",
|
'Toute les catégories' => 'all.all',
|
||||||
"Film/Vidéo - Toutes les sous-catégories" => "2145.all",
|
'Film/Vidéo - Toutes les sous-catégories' => '2145.all',
|
||||||
"Film/Vidéo - Animation" => "2145.2178",
|
'Film/Vidéo - Animation' => '2145.2178',
|
||||||
"Film/Vidéo - Animation Série" => "2145.2179",
|
'Film/Vidéo - Animation Série' => '2145.2179',
|
||||||
"Film/Vidéo - Concert" => "2145.2180",
|
'Film/Vidéo - Concert' => '2145.2180',
|
||||||
"Film/Vidéo - Documentaire" => "2145.2181",
|
'Film/Vidéo - Documentaire' => '2145.2181',
|
||||||
"Film/Vidéo - Émission TV" => "2145.2182",
|
'Film/Vidéo - Émission TV' => '2145.2182',
|
||||||
"Film/Vidéo - Film" => "2145.2183",
|
'Film/Vidéo - Film' => '2145.2183',
|
||||||
"Film/Vidéo - Série TV" => "2145.2184",
|
'Film/Vidéo - Série TV' => '2145.2184',
|
||||||
"Film/Vidéo - Spectacle" => "2145.2185",
|
'Film/Vidéo - Spectacle' => '2145.2185',
|
||||||
"Film/Vidéo - Sport" => "2145.2186",
|
'Film/Vidéo - Sport' => '2145.2186',
|
||||||
"Film/Vidéo - Vidéo-clips" => "2145.2186",
|
'Film/Vidéo - Vidéo-clips' => '2145.2186',
|
||||||
"Audio - Toutes les sous-catégories" => "2139.all",
|
'Audio - Toutes les sous-catégories' => '2139.all',
|
||||||
"Audio - Karaoké" => "2139.2147",
|
'Audio - Karaoké' => '2139.2147',
|
||||||
"Audio - Musique" => "2139.2148",
|
'Audio - Musique' => '2139.2148',
|
||||||
"Audio - Podcast Radio" => "2139.2150",
|
'Audio - Podcast Radio' => '2139.2150',
|
||||||
"Audio - Samples" => "2139.2149",
|
'Audio - Samples' => '2139.2149',
|
||||||
"Jeu vidéo - Toutes les sous-catégories" => "2142.all",
|
'Jeu vidéo - Toutes les sous-catégories' => '2142.all',
|
||||||
"Jeu vidéo - Autre" => "2142.2167",
|
'Jeu vidéo - Autre' => '2142.2167',
|
||||||
"Jeu vidéo - Linux" => "2142.2159",
|
'Jeu vidéo - Linux' => '2142.2159',
|
||||||
"Jeu vidéo - MacOS" => "2142.2160",
|
'Jeu vidéo - MacOS' => '2142.2160',
|
||||||
"Jeu vidéo - Microsoft" => "2142.2162",
|
'Jeu vidéo - Microsoft' => '2142.2162',
|
||||||
"Jeu vidéo - Nintendo" => "2142.2163",
|
'Jeu vidéo - Nintendo' => '2142.2163',
|
||||||
"Jeu vidéo - Smartphone" => "2142.2165",
|
'Jeu vidéo - Smartphone' => '2142.2165',
|
||||||
"Jeu vidéo - Sony" => "2142.2164",
|
'Jeu vidéo - Sony' => '2142.2164',
|
||||||
"Jeu vidéo - Tablette" => "2142.2166",
|
'Jeu vidéo - Tablette' => '2142.2166',
|
||||||
"Jeu vidéo - Windows" => "2142.2161",
|
'Jeu vidéo - Windows' => '2142.2161',
|
||||||
"eBook - Toutes les sous-catégories" => "2140.all",
|
'eBook - Toutes les sous-catégories' => '2140.all',
|
||||||
"eBook - Audio" => "2140.2151",
|
'eBook - Audio' => '2140.2151',
|
||||||
"eBook - Bds" => "2140.2152",
|
'eBook - Bds' => '2140.2152',
|
||||||
"eBook - Comics" => "2140.2153",
|
'eBook - Comics' => '2140.2153',
|
||||||
"eBook - Livres" => "2140.2154",
|
'eBook - Livres' => '2140.2154',
|
||||||
"eBook - Mangas" => "2140.2155",
|
'eBook - Mangas' => '2140.2155',
|
||||||
"eBook - Presse" => "2140.2156",
|
'eBook - Presse' => '2140.2156',
|
||||||
"Emulation - Toutes les sous-catégories" => "2141.all",
|
'Emulation - Toutes les sous-catégories' => '2141.all',
|
||||||
"Emulation - Emulateurs" => "2141.2157",
|
'Emulation - Emulateurs' => '2141.2157',
|
||||||
"Emulation - Roms" => "2141.2158",
|
'Emulation - Roms' => '2141.2158',
|
||||||
"GPS - Toutes les sous-catégories" => "2141.all",
|
'GPS - Toutes les sous-catégories' => '2141.all',
|
||||||
"GPS - Applications" => "2141.2168",
|
'GPS - Applications' => '2141.2168',
|
||||||
"GPS - Cartes" => "2141.2169",
|
'GPS - Cartes' => '2141.2169',
|
||||||
"GPS - Divers" => "2141.2170"
|
'GPS - Divers' => '2141.2170'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"nom" => array(
|
'nom' => array(
|
||||||
"name" => "Nom",
|
'name' => 'Nom',
|
||||||
"description" => "Nom du torrent",
|
'description' => 'Nom du torrent',
|
||||||
"type" => "text"
|
'type' => 'text'
|
||||||
),
|
),
|
||||||
"description" => array(
|
'description' => array(
|
||||||
"name" => "Description",
|
'name' => 'Description',
|
||||||
"description" => "Description du torrent",
|
'description' => 'Description du torrent',
|
||||||
"type" => "text"
|
'type' => 'text'
|
||||||
),
|
),
|
||||||
"fichier" => array(
|
'fichier' => array(
|
||||||
"name" => "Fichier",
|
'name' => 'Fichier',
|
||||||
"description" => "Fichier du torrent",
|
'description' => 'Fichier du torrent',
|
||||||
"type" => "text"
|
'type' => 'text'
|
||||||
),
|
),
|
||||||
"uploader" => array(
|
'uploader' => array(
|
||||||
"name" => "Uploader",
|
'name' => 'Uploader',
|
||||||
"description" => "Uploader du torrent",
|
'description' => 'Uploader du torrent',
|
||||||
"type" => "text"
|
'type' => 'text'
|
||||||
),
|
),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -85,42 +85,42 @@ class YGGTorrentBridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function collectData() {
|
public function collectData() {
|
||||||
|
|
||||||
$catInfo = explode(".", $this->getInput("cat"));
|
$catInfo = explode('.', $this->getInput('cat'));
|
||||||
$category = $catInfo[0];
|
$category = $catInfo[0];
|
||||||
$subcategory = $catInfo[1];
|
$subcategory = $catInfo[1];
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM(self::URI . "/engine/search?name="
|
$html = getSimpleHTMLDOM(self::URI . '/engine/search?name='
|
||||||
. $this->getInput("nom")
|
. $this->getInput('nom')
|
||||||
. "&description="
|
. '&description='
|
||||||
. $this->getInput("description")
|
. $this->getInput('description')
|
||||||
. "&fichier="
|
. '&fichier='
|
||||||
. $this->getInput("fichier")
|
. $this->getInput('fichier')
|
||||||
. "&file="
|
. '&file='
|
||||||
. $this->getInput("uploader")
|
. $this->getInput('uploader')
|
||||||
. "&category="
|
. '&category='
|
||||||
. $category
|
. $category
|
||||||
. "&sub_category="
|
. '&sub_category='
|
||||||
. $subcategory
|
. $subcategory
|
||||||
. "&do=search")
|
. '&do=search')
|
||||||
or returnServerError("Unable to query Yggtorrent !");
|
or returnServerError('Unable to query Yggtorrent !');
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$results = $html->find(".results", 0);
|
$results = $html->find('.results', 0);
|
||||||
if(!$results) return;
|
if(!$results) return;
|
||||||
|
|
||||||
foreach($results->find("tr") as $row) {
|
foreach($results->find('tr') as $row) {
|
||||||
$count++;
|
$count++;
|
||||||
if($count == 1) continue;
|
if($count == 1) continue;
|
||||||
if($count == 12) break;
|
if($count == 12) break;
|
||||||
$item = array();
|
$item = array();
|
||||||
$item["timestamp"] = $row->find(".hidden", 1)->plaintext;
|
$item['timestamp'] = $row->find('.hidden', 1)->plaintext;
|
||||||
$item["title"] = $row->find("a", 1)->plaintext;
|
$item['title'] = $row->find('a', 1)->plaintext;
|
||||||
$torrentData = $this->collectTorrentData($row->find("a", 1)->href);
|
$torrentData = $this->collectTorrentData($row->find('a', 1)->href);
|
||||||
$item["author"] = $torrentData["author"];
|
$item['author'] = $torrentData['author'];
|
||||||
$item["content"] = $torrentData["content"];
|
$item['content'] = $torrentData['content'];
|
||||||
$item["seeders"] = $row->find("td", 7)->plaintext;
|
$item['seeders'] = $row->find('td', 7)->plaintext;
|
||||||
$item["leechers"] = $row->find("td", 8)->plaintext;
|
$item['leechers'] = $row->find('td', 8)->plaintext;
|
||||||
$item["size"] = $row->find("td", 5)->plaintext;
|
$item['size'] = $row->find('td', 5)->plaintext;
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
@ -130,14 +130,14 @@ class YGGTorrentBridge extends BridgeAbstract {
|
||||||
public function collectTorrentData($url) {
|
public function collectTorrentData($url) {
|
||||||
|
|
||||||
//For weird reason, the link we get can be invalid, we fix it.
|
//For weird reason, the link we get can be invalid, we fix it.
|
||||||
$url_full = explode("/", $url);
|
$url_full = explode('/', $url);
|
||||||
$url_full[4] = urlencode($url_full[4]);
|
$url_full[4] = urlencode($url_full[4]);
|
||||||
$url_full[5] = urlencode($url_full[5]);
|
$url_full[5] = urlencode($url_full[5]);
|
||||||
$url_full[6] = urlencode($url_full[6]);
|
$url_full[6] = urlencode($url_full[6]);
|
||||||
$url = implode("/", $url_full);
|
$url = implode('/', $url_full);
|
||||||
$page = getSimpleHTMLDOM($url) or returnServerError("Unable to query Yggtorrent page !");
|
$page = getSimpleHTMLDOM($url) or returnServerError('Unable to query Yggtorrent page !');
|
||||||
$author = $page->find(".informations", 0)->find("a", 4)->plaintext;
|
$author = $page->find('.informations', 0)->find('a', 4)->plaintext;
|
||||||
$content = $page->find(".default", 1);
|
$content = $page->find('.default', 1);
|
||||||
return array("author" => $author, "content" => $content);
|
return array('author' => $author, 'content' => $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
'By channel id' => array(
|
'By channel id' => array(
|
||||||
'c' => array(
|
'c' => array(
|
||||||
'name' => 'channel id',
|
'name' => 'channel id',
|
||||||
'exampleValue' => "15",
|
'exampleValue' => '15',
|
||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'By playlist Id' => array(
|
'By playlist Id' => array(
|
||||||
'p' => array(
|
'p' => array(
|
||||||
'name' => 'playlist id',
|
'name' => 'playlist id',
|
||||||
'exampleValue' => "15"
|
'exampleValue' => '15'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'Search result' => array(
|
'Search result' => array(
|
||||||
|
@ -195,7 +195,7 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
$this->request = $this->getInput('s');
|
$this->request = $this->getInput('s');
|
||||||
$page = 1;
|
$page = 1;
|
||||||
if($this->getInput('pa'))
|
if($this->getInput('pa'))
|
||||||
$page = (int)preg_replace("/[^0-9]/", '', $this->getInput('pa'));
|
$page = (int)preg_replace('/[^0-9]/', '', $this->getInput('pa'));
|
||||||
|
|
||||||
$url_listing = self::URI
|
$url_listing = self::URI
|
||||||
. 'results?search_query='
|
. 'results?search_query='
|
||||||
|
|
|
@ -19,7 +19,7 @@ class FileCache implements CacheInterface {
|
||||||
$writeStream = file_put_contents($this->getCacheFile(), serialize($datas));
|
$writeStream = file_put_contents($this->getCacheFile(), serialize($datas));
|
||||||
|
|
||||||
if($writeStream === false) {
|
if($writeStream === false) {
|
||||||
throw new \Exception("Cannot write the cache... Do you have the right permissions ?");
|
throw new \Exception('Cannot write the cache... Do you have the right permissions ?');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Configuration {
|
||||||
die('"curl" extension not loaded. Please check "php.ini"');
|
die('"curl" extension not loaded. Please check "php.ini"');
|
||||||
|
|
||||||
// configuration checks
|
// configuration checks
|
||||||
if(ini_get('allow_url_fopen') !== "1")
|
if(ini_get('allow_url_fopen') !== '1')
|
||||||
die('"allow_url_fopen" is not set to "1". Please check "php.ini');
|
die('"allow_url_fopen" is not set to "1". Please check "php.ini');
|
||||||
|
|
||||||
// Check cache folder permissions (write permissions required)
|
// Check cache folder permissions (write permissions required)
|
||||||
|
|
|
@ -24,15 +24,15 @@ abstract class FeedExpander extends BridgeAbstract {
|
||||||
switch(true) {
|
switch(true) {
|
||||||
case isset($rssContent->item[0]):
|
case isset($rssContent->item[0]):
|
||||||
debugMessage('Detected RSS 1.0 format');
|
debugMessage('Detected RSS 1.0 format');
|
||||||
$this->feedType = "RSS_1_0";
|
$this->feedType = 'RSS_1_0';
|
||||||
break;
|
break;
|
||||||
case isset($rssContent->channel[0]):
|
case isset($rssContent->channel[0]):
|
||||||
debugMessage('Detected RSS 0.9x or 2.0 format');
|
debugMessage('Detected RSS 0.9x or 2.0 format');
|
||||||
$this->feedType = "RSS_2_0";
|
$this->feedType = 'RSS_2_0';
|
||||||
break;
|
break;
|
||||||
case isset($rssContent->entry[0]):
|
case isset($rssContent->entry[0]):
|
||||||
debugMessage('Detected ATOM format');
|
debugMessage('Detected ATOM format');
|
||||||
$this->feedType = "ATOM_1_0";
|
$this->feedType = 'ATOM_1_0';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
debugMessage('Unknown feed format/version');
|
debugMessage('Unknown feed format/version');
|
||||||
|
|
|
@ -26,7 +26,7 @@ EOD;
|
||||||
$bridge = Bridge::create($bridgeName);
|
$bridge = Bridge::create($bridgeName);
|
||||||
|
|
||||||
if($bridge == false)
|
if($bridge == false)
|
||||||
return "";
|
return '';
|
||||||
|
|
||||||
$HTTPSWarning = '';
|
$HTTPSWarning = '';
|
||||||
if(strpos($bridge->getURI(), 'https') !== 0) {
|
if(strpos($bridge->getURI(), 'https') !== 0) {
|
||||||
|
|
|
@ -70,4 +70,8 @@
|
||||||
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||||
<!-- Do not add whitespace at start or end of a file or end of a line -->
|
<!-- Do not add whitespace at start or end of a file or end of a line -->
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
||||||
|
<!-- Whenever possible use single quote strings -->
|
||||||
|
<rule ref="Squiz.Strings.DoubleQuoteUsage">
|
||||||
|
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
|
||||||
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
Loading…
Reference in a new issue