forked from blallo/rss-bridge
[phpcs] Add missing rules
- Do not add spaces after opening or before closing parenthesis // Wrong if( !is_null($var) ) { ... } // Right if(!is_null($var)) { ... } - Add space after closing parenthesis // Wrong if(true){ ... } // Right if(true) { ... } - Add body into new line - Close body in new line // Wrong if(true) { ... } // Right if(true) { ... } Notice: Spaces after keywords are not detected: // Wrong (not detected) // -> space after 'if' and missing space after 'else' if (true) { ... } else{ ... } // Right if(true) { ... } else { ... }
This commit is contained in:
parent
38b56bf23a
commit
a4b9611e66
128 changed files with 692 additions and 694 deletions
|
@ -13,8 +13,7 @@ class ABCTabsBridge extends BridgeAbstract {
|
|||
|
||||
$table = $html->find('table#myTable', 0)->children(1);
|
||||
|
||||
foreach ($table->find('tr') as $tab)
|
||||
{
|
||||
foreach ($table->find('tr') as $tab) {
|
||||
$item = array();
|
||||
$item['author'] = $tab->find('td', 1)->plaintext
|
||||
. ' - '
|
||||
|
|
|
@ -22,9 +22,9 @@ class AllocineFRBridge extends BridgeAbstract {
|
|||
));
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('category'))){
|
||||
if(!is_null($this->getInput('category'))) {
|
||||
|
||||
switch($this->getInput('category')){
|
||||
switch($this->getInput('category')) {
|
||||
case 'faux-raccord':
|
||||
$uri = static::URI . 'video/programme-12284/saison-29841/';
|
||||
break;
|
||||
|
@ -43,7 +43,7 @@ class AllocineFRBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('category'))){
|
||||
if(!is_null($this->getInput('category'))) {
|
||||
return self::NAME . ' : '
|
||||
.array_search(
|
||||
$this->getInput('category'),
|
||||
|
@ -64,15 +64,14 @@ class AllocineFRBridge extends BridgeAbstract {
|
|||
self::PARAMETERS[$this->queriedContext]['category']['values']
|
||||
);
|
||||
|
||||
foreach($html->find('figure.media-meta-fig') as $element){
|
||||
foreach($html->find('figure.media-meta-fig') as $element) {
|
||||
$item = array();
|
||||
|
||||
$title = $element->find('div.titlebar h3.title a', 0);
|
||||
$content = trim($element->innertext);
|
||||
$figCaption = strpos($content, $category);
|
||||
|
||||
if($figCaption !== false)
|
||||
{
|
||||
if($figCaption !== false) {
|
||||
$content = str_replace('src="/', 'src="' . static::URI, $content);
|
||||
$content = str_replace('href="/', 'href="' . static::URI, $content);
|
||||
$content = str_replace('src=\'/', 'src=\'' . static::URI, $content);
|
||||
|
|
|
@ -51,7 +51,7 @@ class AmazonBridge extends BridgeAbstract {
|
|||
));
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('tld')) && !is_null($this->getInput('q'))){
|
||||
if(!is_null($this->getInput('tld')) && !is_null($this->getInput('q'))) {
|
||||
return 'Amazon.'.$this->getInput('tld').': '.$this->getInput('q');
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName() {
|
||||
if(!is_null($this->getInput('type'))){
|
||||
if(!is_null($this->getInput('type'))) {
|
||||
$typeFilter = array_search(
|
||||
$this->getInput('type'),
|
||||
self::PARAMETERS[$this->queriedContext]['type']['values']
|
||||
|
|
|
@ -44,7 +44,7 @@ class Arte7Bridge extends BridgeAbstract {
|
|||
);
|
||||
|
||||
public function collectData(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Catégorie (Français)':
|
||||
$category = $this->getInput('catfr');
|
||||
$lang = 'fr';
|
||||
|
@ -58,7 +58,7 @@ class Arte7Bridge extends BridgeAbstract {
|
|||
$url = self::URI . 'guide/' . $lang . '/plus7/' . $category;
|
||||
$input = getContents($url) or die('Could not request ARTE.');
|
||||
|
||||
if(strpos($input, 'categoryVideoSet') !== false){
|
||||
if(strpos($input, 'categoryVideoSet') !== false) {
|
||||
$input = explode('categoryVideoSet="', $input);
|
||||
$input = explode('}}', $input[1]);
|
||||
$input = $input[0] . '}}';
|
||||
|
|
|
@ -19,7 +19,7 @@ class AskfmBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Requested username can\'t be found.');
|
||||
|
||||
foreach($html->find('div.streamItem-answer') as $element){
|
||||
foreach($html->find('div.streamItem-answer') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . $element->find('a.streamItemsAge', 0)->href;
|
||||
$question = trim($element->find('h1.streamItemContent-question', 0)->innertext);
|
||||
|
@ -38,7 +38,7 @@ class AskfmBridge extends BridgeAbstract {
|
|||
// This probably should be cleaned up, especially for YouTube embeds
|
||||
$visual = $element->find('div.streamItemContent-visual', 0)->innertext;
|
||||
//Fix tracking links, also doesn't work
|
||||
foreach($element->find('a') as $link){
|
||||
foreach($element->find('a') as $link) {
|
||||
if(strpos($link->href, 'l.ask.fm') !== false) {
|
||||
|
||||
// Too slow
|
||||
|
@ -57,7 +57,7 @@ class AskfmBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return self::NAME . ' : ' . $this->getInput('u');
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class AskfmBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return self::URI . urlencode($this->getInput('u')) . '/answers/more?page=0';
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class BandcampBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
foreach($html->find('li.item') as $release){
|
||||
foreach($html->find('li.item') as $release) {
|
||||
$script = $release->find('div.art', 0)->getAttribute('onclick');
|
||||
$uri = ltrim($script, "return 'url(");
|
||||
$uri = rtrim($uri, "')");
|
||||
|
@ -46,7 +46,7 @@ class BandcampBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('tag'))){
|
||||
if(!is_null($this->getInput('tag'))) {
|
||||
return self::URI . 'tag/' . urlencode($this->getInput('tag')) . '?sort_field=date';
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class BandcampBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('tag'))){
|
||||
if(!is_null($this->getInput('tag'))) {
|
||||
return $this->getInput('tag') . ' - Bandcamp Tag';
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ class BastaBridge extends BridgeAbstract {
|
|||
|
||||
$limit = 0;
|
||||
|
||||
foreach($html->find('item') as $element){
|
||||
if($limit < 10){
|
||||
foreach($html->find('item') as $element) {
|
||||
if($limit < 10) {
|
||||
$item = array();
|
||||
$item['title'] = $element->find('title', 0)->innertext;
|
||||
$item['uri'] = $element->find('guid', 0)->plaintext;
|
||||
|
|
|
@ -11,11 +11,11 @@ class BlaguesDeMerdeBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request BDM.');
|
||||
|
||||
foreach($html->find('article.joke_contener') as $element){
|
||||
foreach($html->find('article.joke_contener') as $element) {
|
||||
$item = array();
|
||||
$temp = $element->find('a');
|
||||
|
||||
if(isset($temp[2])){
|
||||
if(isset($temp[2])) {
|
||||
$item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
|
||||
$uri = $temp[2]->href;
|
||||
$item['uri'] = $uri;
|
||||
|
|
|
@ -28,7 +28,7 @@ class BooruprojectBridge extends GelbooruBridge {
|
|||
const PIDBYPAGE = 20;
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('i'))){
|
||||
if(!is_null($this->getInput('i'))) {
|
||||
return 'http://' . $this->getInput('i') . '.booru.org/';
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class BooruprojectBridge extends GelbooruBridge {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('i'))){
|
||||
if(!is_null($this->getInput('i'))) {
|
||||
return static::NAME . ' ' . $this->getInput('i');
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class CADBridge extends FeedExpander {
|
|||
|
||||
$htmlpart = explode("/", $url);
|
||||
|
||||
switch ($htmlpart[3]){
|
||||
switch ($htmlpart[3]) {
|
||||
case 'cad':
|
||||
preg_match_all("/http:\/\/cdn2\.cad-comic\.com\/comics\/cad-\S*png/", $html3, $url2);
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,7 @@ topic found in some section URLs, else all topics are selected.';
|
|||
public function collectData(){
|
||||
|
||||
function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
@ -27,7 +27,7 @@ topic found in some section URLs, else all topics are selected.';
|
|||
}
|
||||
|
||||
function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
@ -49,14 +49,14 @@ topic found in some section URLs, else all topics are selected.';
|
|||
$html = getSimpleHTMLDOM($pageUrl) or returnServerError('Could not request CNET: ' . $pageUrl);
|
||||
$limit = 0;
|
||||
|
||||
foreach($html->find('div.assetBody') as $element){
|
||||
if($limit < 8){
|
||||
foreach($html->find('div.assetBody') as $element) {
|
||||
if($limit < 8) {
|
||||
$article_title = trim($element->find('h2', 0)->plaintext);
|
||||
$article_uri = self::URI . ($element->find('a', 0)->href);
|
||||
$article_timestamp = strtotime($element->find('time.assetTime', 0)->plaintext);
|
||||
$article_author = trim($element->find('a[rel=author]', 0)->plaintext);
|
||||
|
||||
if(!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false){
|
||||
if(!empty($article_title) && !empty($article_uri) && strpos($article_uri, '/news/') !== false) {
|
||||
$article_html = getSimpleHTMLDOM($article_uri)
|
||||
or returnServerError('Could not request CNET: ' . $article_uri);
|
||||
$article_content = trim(
|
||||
|
@ -83,7 +83,7 @@ topic found in some section URLs, else all topics are selected.';
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('topic'))){
|
||||
if(!is_null($this->getInput('topic'))) {
|
||||
$topic = $this->getInput('topic');
|
||||
return 'CNET News Bridge' . (empty($topic) ? '' : ' - ' . $topic);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class CastorusBridge extends BridgeAbstract {
|
|||
if(!$nodes)
|
||||
returnServerError('Cannot find nodes!');
|
||||
|
||||
foreach($nodes as $node){
|
||||
foreach($nodes as $node) {
|
||||
$node->outertext = '';
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class CastorusBridge extends BridgeAbstract {
|
|||
if(!$activities)
|
||||
returnServerError('Failed to find activities!');
|
||||
|
||||
foreach($activities as $activity){
|
||||
foreach($activities as $activity) {
|
||||
$item = array();
|
||||
|
||||
$item['title'] = $this->extractActivityTitle($activity);
|
||||
|
@ -103,12 +103,12 @@ class CastorusBridge extends BridgeAbstract {
|
|||
. '</p>';
|
||||
|
||||
if(isset($zip_filter)
|
||||
&& !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)){
|
||||
&& !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)) {
|
||||
continue; // Skip this item
|
||||
}
|
||||
|
||||
if(isset($city_filter)
|
||||
&& !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)){
|
||||
&& !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)) {
|
||||
continue; // Skip this item
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class CollegeDeFranceBridge extends BridgeAbstract {
|
|||
. 'components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all')
|
||||
or returnServerError('Could not request CollegeDeFrance.');
|
||||
|
||||
foreach($html->find('a[data-target]') as $element){
|
||||
foreach($html->find('a[data-target]') as $element) {
|
||||
$item = array();
|
||||
$item['title'] = $element->find('.title', 0)->plaintext;
|
||||
|
||||
|
@ -60,7 +60,7 @@ class CollegeDeFranceBridge extends BridgeAbstract {
|
|||
$timezone
|
||||
);
|
||||
|
||||
if(!$d){
|
||||
if(!$d) {
|
||||
$d = DateTime::createFromFormat(
|
||||
'!d m Y',
|
||||
trim(str_replace(
|
||||
|
|
|
@ -13,16 +13,16 @@ class CopieDoubleBridge extends BridgeAbstract {
|
|||
|
||||
$table = $html->find('table table', 2);
|
||||
|
||||
foreach($table->find('tr') as $element){
|
||||
foreach($table->find('tr') as $element) {
|
||||
$td = $element->find('td', 0);
|
||||
|
||||
if($td->class === 'couleur_1'){
|
||||
if($td->class === 'couleur_1') {
|
||||
$item = array();
|
||||
$title = $td->innertext;
|
||||
$pos = strpos($title, '<a');
|
||||
$title = substr($title, 0, $pos);
|
||||
$item['title'] = $title;
|
||||
} elseif(strpos($element->innertext, '/images/suivant.gif') === false){
|
||||
} elseif(strpos($element->innertext, '/images/suivant.gif') === false) {
|
||||
$a = $element->find('a', 0);
|
||||
$item['uri'] = self::URI . $a->href;
|
||||
$content = str_replace('src="/', 'src="/' . self::URI, $element->find("td", 0)->innertext);
|
||||
|
|
|
@ -14,12 +14,12 @@ class CourrierInternationalBridge extends BridgeAbstract {
|
|||
$element = $html->find("article");
|
||||
$article_count = 1;
|
||||
|
||||
foreach($element as $article){
|
||||
foreach($element as $article) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = $article->parent->getAttribute('href');
|
||||
|
||||
if(strpos($item['uri'], 'http') === false){
|
||||
if(strpos($item['uri'], 'http') === false) {
|
||||
$item['uri'] = self::URI . $item['uri'];
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class CourrierInternationalBridge extends BridgeAbstract {
|
|||
|
||||
$content = $page->find('.article-text', 0);
|
||||
|
||||
if(!$content){
|
||||
if(!$content) {
|
||||
$content = $page->find('.depeche-text', 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ class CpasbienBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI . '/recherche/' . urlencode($request) . '.html')
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
foreach($html->find('#gauche', 0)->find('div') as $episode){
|
||||
foreach($html->find('#gauche', 0)->find('div') as $episode) {
|
||||
if($episode->getAttribute('class') == 'ligne0'
|
||||
|| $episode->getAttribute('class') == 'ligne1'){
|
||||
|| $episode->getAttribute('class') == 'ligne1') {
|
||||
|
||||
$urlepisode = $episode->find('a', 0)->getAttribute('href');
|
||||
$htmlepisode = getSimpleHTMLDOMCached($urlepisode, 86400 * 366 * 30);
|
||||
|
@ -33,11 +33,11 @@ class CpasbienBridge extends BridgeAbstract {
|
|||
$item['pubdate'] = $this->getCachedDate($urlepisode);
|
||||
$textefiche = $htmlepisode->find('#textefiche', 0)->find('p', 1);
|
||||
|
||||
if(isset($textefiche)){
|
||||
if(isset($textefiche)) {
|
||||
$item['content'] = $textefiche->text();
|
||||
} else {
|
||||
$p = $htmlepisode->find('#textefiche', 0)->find('p');
|
||||
if(!empty($p)){
|
||||
if(!empty($p)) {
|
||||
$item['content'] = $htmlepisode->find('#textefiche', 0)->find('p', 0)->text();
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class CpasbienBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('q'))){
|
||||
if(!is_null($this->getInput('q'))) {
|
||||
return $this->getInput('q') . ' : ' . self::NAME;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ class CryptomeBridge extends BridgeAbstract {
|
|||
$number = $this->getInput('n');
|
||||
|
||||
/* number of documents */
|
||||
if(!empty($number)){
|
||||
if(!empty($number)) {
|
||||
$num = min($number, 20);
|
||||
}
|
||||
|
||||
foreach($html->find('pre') as $element){
|
||||
for($i = 0; $i < $num; ++$i){
|
||||
foreach($html->find('pre') as $element) {
|
||||
for($i = 0; $i < $num; ++$i) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . substr($element->find('a', $i)->href, 20);
|
||||
$item['title'] = substr($element->find('b', $i)->plaintext, 22);
|
||||
|
|
|
@ -35,7 +35,7 @@ class DailymotionBridge extends BridgeAbstract {
|
|||
protected function getMetadata($id){
|
||||
$metadata = array();
|
||||
$html2 = getSimpleHTMLDOM(self::URI . 'video/' . $id);
|
||||
if(!$html2){
|
||||
if(!$html2) {
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,12 @@ class DailymotionBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request Dailymotion.');
|
||||
|
||||
foreach($html->find('div.media a.preview_link') as $element){
|
||||
if($count < $limit){
|
||||
foreach($html->find('div.media a.preview_link') as $element) {
|
||||
if($count < $limit) {
|
||||
$item = array();
|
||||
$item['id'] = str_replace('/video/', '', strtok($element->href, '_'));
|
||||
$metadata = $this->getMetadata($item['id']);
|
||||
if(empty($metadata)){
|
||||
if(empty($metadata)) {
|
||||
continue;
|
||||
}
|
||||
$item['uri'] = $metadata['uri'];
|
||||
|
@ -85,7 +85,7 @@ class DailymotionBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By username':
|
||||
$specific = $this->getInput('u');
|
||||
break;
|
||||
|
@ -103,7 +103,7 @@ class DailymotionBridge extends BridgeAbstract {
|
|||
|
||||
public function getURI(){
|
||||
$uri = self::URI;
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By username':
|
||||
$uri .= 'user/' . urlencode($this->getInput('u')) . '/1';
|
||||
break;
|
||||
|
@ -112,7 +112,7 @@ class DailymotionBridge extends BridgeAbstract {
|
|||
break;
|
||||
case 'From search results':
|
||||
$uri .= 'search/' . urlencode($this->getInput('s'));
|
||||
if($this->getInput('pa')){
|
||||
if($this->getInput('pa')) {
|
||||
$uri .= '/' . $this->getInput('pa');
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -12,7 +12,7 @@ class DansTonChatBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI . 'latest.html')
|
||||
or returnServerError('Could not request DansTonChat.');
|
||||
|
||||
foreach($html->find('div.item') as $element){
|
||||
foreach($html->find('div.item') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('a', 0)->href;
|
||||
$item['title'] = 'DansTonChat ' . $element->find('a', 1)->plaintext;
|
||||
|
|
|
@ -34,7 +34,7 @@ class DauphineLibereBridge extends FeedExpander {
|
|||
public function collectData(){
|
||||
$url = self::URI . 'rss';
|
||||
|
||||
if(empty($this->getInput('u'))){
|
||||
if(empty($this->getInput('u'))) {
|
||||
$url = self::URI . $this->getInput('u') . '/rss';
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class DilbertBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request Dilbert: ' . $this->getURI());
|
||||
|
||||
foreach($html->find('section.comic-item') as $element){
|
||||
foreach($html->find('section.comic-item') as $element) {
|
||||
|
||||
$img = $element->find('img', 0);
|
||||
$link = $element->find('a', 0);
|
||||
|
|
|
@ -31,7 +31,7 @@ class DuckDuckGoBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI . 'html/?kd=-1&q=' . $this->getInput('u') . $this->getInput('sort'))
|
||||
or returnServerError('Could not request DuckDuckGo.');
|
||||
|
||||
foreach($html->find('div.results_links') as $element){
|
||||
foreach($html->find('div.results_links') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('a', 0)->href;
|
||||
$item['title'] = $element->find('a', 1)->innertext;
|
||||
|
|
|
@ -23,7 +23,7 @@ on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.';
|
|||
$relativeDays = 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) == "h") $relativeHours = substr($relativeTimeElement, 0, -1);
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ on EZTV. Get showID from URLs in https://eztv.ch/shows/showID/show-full-name.';
|
|||
|
||||
// Loop on show ids
|
||||
$showList = explode(",", $this->getInput('i'));
|
||||
foreach($showList as $showID){
|
||||
foreach($showList as $showID) {
|
||||
|
||||
// Get show page
|
||||
$html = getSimpleHTMLDOM(self::URI . 'shows/' . rawurlencode($showID) . '/')
|
||||
or returnServerError('Could not request EZTV for id "' . $showID . '"');
|
||||
|
||||
// Loop on each element that look like an episode entry...
|
||||
foreach($html->find('.forum_header_border') as $element){
|
||||
foreach($html->find('.forum_header_border') as $element) {
|
||||
|
||||
// Filter entries that are not episode entries
|
||||
$ep = $element->find('td', 1);
|
||||
|
|
|
@ -11,7 +11,7 @@ class EliteDangerousGalnetBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Error while downloading the website content');
|
||||
|
||||
foreach($html->find('div.article') as $element){
|
||||
foreach($html->find('div.article') as $element) {
|
||||
$item = array();
|
||||
|
||||
$uri = $element->find('h3 a', 0)->href;
|
||||
|
|
|
@ -27,7 +27,7 @@ class ElsevierBridge extends BridgeAbstract {
|
|||
// Extracts the timestamp from an article
|
||||
private function extractArticleTimestamp($article){
|
||||
$time = $article->find('.article-info', 0);
|
||||
if($time){
|
||||
if($time) {
|
||||
$timestring = trim($time->plaintext);
|
||||
/*
|
||||
The format depends on the age of an article:
|
||||
|
@ -35,11 +35,11 @@ class ElsevierBridge extends BridgeAbstract {
|
|||
- July 2016
|
||||
- May–June 2016
|
||||
*/
|
||||
if(preg_match('/\S*(\d+\s\S+\s\d{4})/ims', $timestring, $matches)){
|
||||
if(preg_match('/\S*(\d+\s\S+\s\d{4})/ims', $timestring, $matches)) {
|
||||
return strtotime($matches[0]);
|
||||
} elseif (preg_match('/[A-Za-z]+\-([A-Za-z]+\s\d{4})/ims', $timestring, $matches)){
|
||||
} elseif (preg_match('/[A-Za-z]+\-([A-Za-z]+\s\d{4})/ims', $timestring, $matches)) {
|
||||
return strtotime($matches[0]);
|
||||
} elseif (preg_match('/([A-Za-z]+\s\d{4})/ims', $timestring, $matches)){
|
||||
} elseif (preg_match('/([A-Za-z]+\s\d{4})/ims', $timestring, $matches)) {
|
||||
return strtotime($matches[0]);
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -51,7 +51,7 @@ class ElsevierBridge extends BridgeAbstract {
|
|||
// Extracts the content from an article
|
||||
private function extractArticleContent($article){
|
||||
$content = $article->find('.article-content', 0);
|
||||
if($content){
|
||||
if($content) {
|
||||
return trim($content->plaintext);
|
||||
}
|
||||
return '';
|
||||
|
@ -62,7 +62,7 @@ class ElsevierBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($uri)
|
||||
or returnServerError('No results for Elsevier journal ' . $this->getInput('j'));
|
||||
|
||||
foreach($html->find('.pod-listing') as $article){
|
||||
foreach($html->find('.pod-listing') as $article) {
|
||||
$item = array();
|
||||
$item['uri'] = $article->find('.pod-listing-header>a', 0)->getAttribute('href') . '?np=y';
|
||||
$item['title'] = $article->find('.pod-listing-header>a', 0)->plaintext;
|
||||
|
|
|
@ -9,7 +9,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
|
|||
|
||||
public function collectData(){
|
||||
function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
|
|
@ -38,7 +38,7 @@ class EtsyBridge extends BridgeAbstract {
|
|||
|
||||
$results = $html->find('div.block-grid-item');
|
||||
|
||||
foreach($results as $result){
|
||||
foreach($results as $result) {
|
||||
// Skip banner cards (ads for categories)
|
||||
if($result->find('a.banner-card'))
|
||||
continue;
|
||||
|
@ -57,7 +57,7 @@ class EtsyBridge extends BridgeAbstract {
|
|||
|
||||
$image = $result->find('img.placeholder', 0)->src;
|
||||
|
||||
if($this->getInput('showimage')){
|
||||
if($this->getInput('showimage')) {
|
||||
$item['content'] .= '<img src="' . $image . '">';
|
||||
}
|
||||
|
||||
|
@ -68,10 +68,10 @@ class EtsyBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('query'))){
|
||||
if(!is_null($this->getInput('query'))) {
|
||||
$uri = self::URI . '/search?q=' . urlencode($this->getInput('query'));
|
||||
|
||||
if(!is_null($this->getInput('queryextension'))){
|
||||
if(!is_null($this->getInput('queryextension'))) {
|
||||
$uri .= $this->getInput('queryextension');
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class FB2Bridge extends BridgeAbstract {
|
|||
public function collectData(){
|
||||
|
||||
function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
@ -29,7 +29,7 @@ class FB2Bridge extends BridgeAbstract {
|
|||
|
||||
//Utility function for cleaning a Facebook link
|
||||
$unescape_fb_link = function($matches){
|
||||
if(is_array($matches) && count($matches) > 1){
|
||||
if(is_array($matches) && count($matches) > 1) {
|
||||
$link = $matches[1];
|
||||
if(strpos($link, '/') === 0)
|
||||
$link = self::URI . $link . '"';
|
||||
|
@ -72,12 +72,12 @@ class FB2Bridge extends BridgeAbstract {
|
|||
return $matches[0];
|
||||
};
|
||||
|
||||
if($this->getInput('u') !== null){
|
||||
if($this->getInput('u') !== null) {
|
||||
$page = 'https://touch.facebook.com/' . $this->getInput('u');
|
||||
$cookies = $this->getCookies($page);
|
||||
$pageID = $this->getPageID($page, $cookies);
|
||||
|
||||
if($pageID === null){
|
||||
if($pageID === null) {
|
||||
echo <<<EOD
|
||||
Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge
|
||||
EOD;
|
||||
|
@ -103,7 +103,7 @@ EOD;
|
|||
$html = $this->buildContent($fileContent);
|
||||
$author = $this->getInput('u');
|
||||
|
||||
foreach($html->find("article") as $content){
|
||||
foreach($html->find("article") as $content) {
|
||||
|
||||
$item = array();
|
||||
|
||||
|
@ -223,8 +223,8 @@ EOD;
|
|||
|
||||
//First request to get the cookie
|
||||
$cookies = "";
|
||||
foreach($http_response_header as $hdr){
|
||||
if(strpos($hdr, "Set-Cookie") !== false){
|
||||
foreach($http_response_header as $hdr) {
|
||||
if(strpos($hdr, "Set-Cookie") !== false) {
|
||||
$cLine = explode(":", $hdr)[1];
|
||||
$cLine = explode(";", $cLine)[0];
|
||||
$cookies .= ";" . $cLine;
|
||||
|
@ -255,7 +255,7 @@ EOD;
|
|||
$regex = "/page_id=([0-9]*)&/";
|
||||
preg_match($regex, $pageContent, $matches);
|
||||
|
||||
if(count($matches) > 0){
|
||||
if(count($matches) > 0) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class FacebookBridge extends BridgeAbstract {
|
|||
|
||||
//Extract a string using start and end delimiters
|
||||
function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
@ -43,7 +43,7 @@ class FacebookBridge extends BridgeAbstract {
|
|||
|
||||
//Utility function for cleaning a Facebook link
|
||||
$unescape_fb_link = function($matches){
|
||||
if(is_array($matches) && count($matches) > 1){
|
||||
if(is_array($matches) && count($matches) > 1) {
|
||||
$link = $matches[1];
|
||||
if(strpos($link, '/') === 0)
|
||||
$link = self::URI . $link . '"';
|
||||
|
@ -89,12 +89,10 @@ class FacebookBridge extends BridgeAbstract {
|
|||
$html = null;
|
||||
|
||||
//Handle captcha response sent by the viewer
|
||||
if (isset($_POST['captcha_response']))
|
||||
{
|
||||
if (isset($_POST['captcha_response'])) {
|
||||
if (session_status() == PHP_SESSION_NONE)
|
||||
session_start();
|
||||
if (isset($_SESSION['captcha_fields'], $_SESSION['captcha_action']))
|
||||
{
|
||||
if (isset($_SESSION['captcha_fields'], $_SESSION['captcha_action'])) {
|
||||
$captcha_action = $_SESSION['captcha_action'];
|
||||
$captcha_fields = $_SESSION['captcha_fields'];
|
||||
$captcha_fields['captcha_response'] = preg_replace("/[^a-zA-Z0-9]+/", "", $_POST['captcha_response']);
|
||||
|
@ -110,7 +108,7 @@ class FacebookBridge extends BridgeAbstract {
|
|||
$context = stream_context_create($http_options);
|
||||
$html = getContents($captcha_action, false, $context);
|
||||
|
||||
if($html === false){
|
||||
if($html === false) {
|
||||
returnServerError('Failed to submit captcha response back to Facebook');
|
||||
}
|
||||
unset($_SESSION['captcha_fields']);
|
||||
|
@ -121,7 +119,7 @@ class FacebookBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
//Retrieve page contents
|
||||
if(is_null($html)){
|
||||
if(is_null($html)) {
|
||||
$http_options = array(
|
||||
'http' => array(
|
||||
'method' => 'GET',
|
||||
|
@ -130,7 +128,7 @@ class FacebookBridge extends BridgeAbstract {
|
|||
)
|
||||
);
|
||||
$context = stream_context_create($http_options);
|
||||
if(!strpos($this->getInput('u'), "/")){
|
||||
if(!strpos($this->getInput('u'), "/")) {
|
||||
$html = getSimpleHTMLDOM(self::URI . urlencode($this->getInput('u')) . '?_fb_noscript=1',
|
||||
false,
|
||||
$context)
|
||||
|
@ -145,8 +143,7 @@ class FacebookBridge extends BridgeAbstract {
|
|||
|
||||
//Handle captcha form?
|
||||
$captcha = $html->find('div.captcha_interstitial', 0);
|
||||
if (!is_null($captcha))
|
||||
{
|
||||
if (!is_null($captcha)) {
|
||||
//Save form for submitting after getting captcha response
|
||||
if (session_status() == PHP_SESSION_NONE)
|
||||
session_start();
|
||||
|
@ -182,7 +179,7 @@ EOD;
|
|||
->next_sibling()
|
||||
->children(0);
|
||||
|
||||
if(isset($element)){
|
||||
if(isset($element)) {
|
||||
|
||||
$author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext);
|
||||
$profilePic = 'https://graph.facebook.com/'
|
||||
|
@ -191,17 +188,17 @@ EOD;
|
|||
|
||||
$this->authorName = $author;
|
||||
|
||||
foreach($element->children() as $cell){
|
||||
foreach($element->children() as $cell) {
|
||||
// Manage summary posts
|
||||
if(strpos($cell->class, '_3xaf') !== false){
|
||||
if(strpos($cell->class, '_3xaf') !== false) {
|
||||
$posts = $cell->children();
|
||||
} else {
|
||||
$posts = array($cell);
|
||||
}
|
||||
|
||||
foreach($posts as $post){
|
||||
foreach($posts as $post) {
|
||||
// Check media type
|
||||
switch($this->getInput('media_type')){
|
||||
switch($this->getInput('media_type')) {
|
||||
case 'all': break;
|
||||
case 'video':
|
||||
if(empty($post->find('[aria-label=Video]'))) continue 2;
|
||||
|
@ -214,7 +211,7 @@ EOD;
|
|||
|
||||
$item = array();
|
||||
|
||||
if(count($post->find('abbr')) > 0){
|
||||
if(count($post->find('abbr')) > 0) {
|
||||
|
||||
//Retrieve post contents
|
||||
$content = preg_replace(
|
||||
|
@ -270,7 +267,7 @@ EOD;
|
|||
|
||||
//Retrieve date of the post
|
||||
$date = $post->find("abbr")[0];
|
||||
if(isset($date) && $date->hasAttribute('data-utime')){
|
||||
if(isset($date) && $date->hasAttribute('data-utime')) {
|
||||
$date = $date->getAttribute('data-utime');
|
||||
} else {
|
||||
$date = 0;
|
||||
|
@ -298,7 +295,7 @@ EOD;
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!empty($this->authorName)){
|
||||
if(!empty($this->authorName)) {
|
||||
return isset($this->extraInfos['name']) ? $this->extraInfos['name'] : $this->authorName
|
||||
. ' - Facebook Bridge';
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class FeedExpanderExampleBridge extends FeedExpander {
|
|||
);
|
||||
|
||||
public function collectData(){
|
||||
switch($this->getInput('version')){
|
||||
switch($this->getInput('version')) {
|
||||
case 'rss_0_9_1':
|
||||
parent::collectExpandableDatas('http://static.userland.com/gems/backend/sampleRss.xml');
|
||||
break;
|
||||
|
@ -43,7 +43,7 @@ class FeedExpanderExampleBridge extends FeedExpander {
|
|||
}
|
||||
|
||||
protected function parseItem($newsItem) {
|
||||
switch($this->getInput('version')){
|
||||
switch($this->getInput('version')) {
|
||||
case 'rss_0_9_1':
|
||||
return $this->parseRSS_0_9_1_Item($newsItem);
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ class FierPandaBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request Fier Panda.');
|
||||
|
||||
foreach($html->find('div.container-content article') as $element){
|
||||
foreach($html->find('div.container-content article') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI() . $element->find('a', 0)->href;
|
||||
$item['title'] = trim($element->find('h1 a', 0)->innertext);
|
||||
|
|
|
@ -31,7 +31,7 @@ class FilterBridge extends FeedExpander {
|
|||
protected function parseItem($newItem){
|
||||
$item = parent::parseItem($newItem);
|
||||
|
||||
switch(true){
|
||||
switch(true) {
|
||||
case $this->getFilterType() === 'permit':
|
||||
if (preg_match($this->getFilter(), $item['title'])) {
|
||||
return $item;
|
||||
|
@ -57,20 +57,20 @@ class FilterBridge extends FeedExpander {
|
|||
public function getURI(){
|
||||
$url = $this->getInput('url');
|
||||
|
||||
if(empty($url)){
|
||||
if(empty($url)) {
|
||||
$url = parent::getURI();
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
if($this->getInput('url') && substr($this->getInput('url'), 0, strlen('http')) !== 'http'){
|
||||
if($this->getInput('url') && substr($this->getInput('url'), 0, strlen('http')) !== 'http') {
|
||||
// just in case someone find a way to access local files by playing with the url
|
||||
returnClientError('The url parameter must either refer to http or https protocol.');
|
||||
}
|
||||
try{
|
||||
$this->collectExpandableDatas($this->getURI());
|
||||
}catch (HttpException $e){
|
||||
} catch (HttpException $e) {
|
||||
$this->collectExpandableDatas($this->getURI());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class FlickrBridge extends BridgeAbstract {
|
|||
);
|
||||
|
||||
public function collectData(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Explore':
|
||||
$key = 'photos';
|
||||
$html = getSimpleHTMLDOM(self::URI . 'explore')
|
||||
|
@ -68,7 +68,7 @@ class FlickrBridge extends BridgeAbstract {
|
|||
|
||||
$model_json = json_decode($model_text, true);
|
||||
|
||||
foreach($html->find('.photo-list-photo-view') as $element){
|
||||
foreach($html->find('.photo-list-photo-view') as $element) {
|
||||
// Get the styles
|
||||
$style = explode(';', $element->style);
|
||||
|
||||
|
@ -83,17 +83,17 @@ class FlickrBridge extends BridgeAbstract {
|
|||
$imageID = reset($imageURIs);
|
||||
|
||||
// Use JSON data to build items
|
||||
foreach(reset($model_json)[0][$key]['_data'] as $element){
|
||||
if($element['id'] === $imageID){
|
||||
foreach(reset($model_json)[0][$key]['_data'] as $element) {
|
||||
if($element['id'] === $imageID) {
|
||||
$item = array();
|
||||
|
||||
/* Author name depends on scope. On a keyword search the
|
||||
* author is part of the picture data. On a username search
|
||||
* the author is part of the owner data.
|
||||
*/
|
||||
if(array_key_exists('username', $element)){
|
||||
if(array_key_exists('username', $element)) {
|
||||
$item['author'] = $element['username'];
|
||||
} elseif (array_key_exists('owner', reset($model_json)[0])){
|
||||
} elseif (array_key_exists('owner', reset($model_json)[0])) {
|
||||
$item['author'] = reset($model_json)[0]['owner']['username'];
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class FootitoBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request Footito.');
|
||||
|
||||
foreach($html->find('div.post') as $element){
|
||||
foreach($html->find('div.post') as $element) {
|
||||
$item = array();
|
||||
|
||||
$content = trim($element->innertext);
|
||||
|
|
|
@ -20,7 +20,7 @@ class FourchanBridge extends BridgeAbstract {
|
|||
));
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('c')) && !is_null($this->getInput('t'))){
|
||||
if(!is_null($this->getInput('c')) && !is_null($this->getInput('t'))) {
|
||||
return static::URI . $this->getInput('c') . '/thread/' . $this->getInput('t');
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class FourchanBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
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['id'] = $element->find('.post', 0)->getAttribute('id');
|
||||
$item['uri'] = $this->getURI() . '#' . $item['id'];
|
||||
|
@ -41,19 +41,19 @@ class FourchanBridge extends BridgeAbstract {
|
|||
|
||||
$file = $element->find('.file', 0);
|
||||
|
||||
if(!empty($file)){
|
||||
if(!empty($file)) {
|
||||
$item['image'] = $element->find('.file a', 0)->href;
|
||||
$item['imageThumb'] = $element->find('.file img', 0)->src;
|
||||
if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== false)
|
||||
$item['imageThumb'] = 'http://i.imgur.com/eO0cxf9.jpg';
|
||||
}
|
||||
|
||||
if(!empty($element->find('span.subject', 0)->innertext)){
|
||||
if(!empty($element->find('span.subject', 0)->innertext)) {
|
||||
$item['subject'] = $element->find('span.subject', 0)->innertext;
|
||||
}
|
||||
|
||||
$item['title'] = 'reply ' . $item['id'] . ' | ' . $item['author'];
|
||||
if(isset($item['subject'])){
|
||||
if(isset($item['subject'])) {
|
||||
$item['title'] = $item['subject'] . ' - ' . $item['title'];
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class FourchanBridge extends BridgeAbstract {
|
|||
$content = str_replace('href="#p', 'href="' . $this->getURI() . '#p', $content);
|
||||
$item['content'] = '<span id="' . $item['id'] . '">' . $content . '</span>';
|
||||
|
||||
if(isset($item['image'])){
|
||||
if(isset($item['image'])) {
|
||||
$item['content'] = '<a href="'
|
||||
. $item['image']
|
||||
. '"><img alt="'
|
||||
|
|
|
@ -95,7 +95,7 @@ class FuturaSciencesBridge extends FeedExpander {
|
|||
}
|
||||
|
||||
private function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
@ -106,8 +106,8 @@ class FuturaSciencesBridge extends FeedExpander {
|
|||
$open_tag = '<' . $tag_name;
|
||||
$close_tag = '</' . $tag_name . '>';
|
||||
$close_tag_length = strlen($close_tag);
|
||||
if(strpos($tag_start, $open_tag) === 0){
|
||||
while(strpos($string, $tag_start) !== false){
|
||||
if(strpos($tag_start, $open_tag) === 0) {
|
||||
while(strpos($string, $tag_start) !== false) {
|
||||
$max_recursion = 100;
|
||||
$section_to_remove = null;
|
||||
$section_start = strpos($string, $tag_start);
|
||||
|
@ -165,7 +165,7 @@ class FuturaSciencesBridge extends FeedExpander {
|
|||
// Extracts the author from an article or element
|
||||
private function extractAuthor($article){
|
||||
$article_author = $article->find('h3.epsilon', 0);
|
||||
if($article_author){
|
||||
if($article_author) {
|
||||
return trim(str_replace(', Futura-Sciences', '', $article_author->plaintext));
|
||||
}
|
||||
return '';
|
||||
|
|
|
@ -21,7 +21,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
));
|
||||
|
||||
private function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
@ -31,7 +31,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
private function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
@ -59,7 +59,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
|
||||
private function fetchPostContent($uri, $site_url){
|
||||
$html = getSimpleHTMLDOM($uri);
|
||||
if(!$html){
|
||||
if(!$html) {
|
||||
return 'Could not request GBAtemp ' . $uri;
|
||||
}
|
||||
|
||||
|
@ -72,9 +72,9 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request GBAtemp.');
|
||||
|
||||
switch($this->getInput('type')){
|
||||
switch($this->getInput('type')) {
|
||||
case 'N':
|
||||
foreach($html->find('li[class=news_item full]') as $newsItem){
|
||||
foreach($html->find('li[class=news_item full]') as $newsItem) {
|
||||
$url = self::URI . $newsItem->find('a', 0)->href;
|
||||
$time = intval(
|
||||
$this->extractFromDelimiters(
|
||||
|
@ -89,7 +89,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
|
||||
}
|
||||
case 'R':
|
||||
foreach($html->find('li.portal_review') as $reviewItem){
|
||||
foreach($html->find('li.portal_review') as $reviewItem) {
|
||||
$url = self::URI . $reviewItem->find('a', 0)->href;
|
||||
$title = $reviewItem->find('span.review_title', 0)->plaintext;
|
||||
$content = getSimpleHTMLDOM($url)
|
||||
|
@ -111,7 +111,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
|
||||
}
|
||||
case 'T':
|
||||
foreach($html->find('li.portal-tutorial') as $tutorialItem){
|
||||
foreach($html->find('li.portal-tutorial') as $tutorialItem) {
|
||||
$url = self::URI . $tutorialItem->find('a', 0)->href;
|
||||
$title = $tutorialItem->find('a', 0)->plaintext;
|
||||
$time = intval(
|
||||
|
@ -126,7 +126,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
$this->items[] = $this->buildItem($url, $title, $author, $time, $content);
|
||||
}
|
||||
case 'F':
|
||||
foreach($html->find('li.rc_item') as $postItem){
|
||||
foreach($html->find('li.rc_item') as $postItem) {
|
||||
$url = self::URI . $postItem->find('a', 1)->href;
|
||||
$title = $postItem->find('a', 1)->plaintext;
|
||||
$time = intval(
|
||||
|
@ -144,7 +144,7 @@ class GBAtempBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName() {
|
||||
if(!is_null($this->getInput('type'))){
|
||||
if(!is_null($this->getInput('type'))) {
|
||||
$type = array_search(
|
||||
$this->getInput('type'),
|
||||
self::PARAMETERS[$this->queriedContext]['type']['values']
|
||||
|
|
|
@ -27,14 +27,14 @@ class GiphyBridge extends BridgeAbstract {
|
|||
or returnServerError('No results for this query.');
|
||||
|
||||
$max = GIPHY_LIMIT;
|
||||
if($this->getInput('n')){
|
||||
if($this->getInput('n')) {
|
||||
$max = $this->getInput('n');
|
||||
}
|
||||
|
||||
$limit = 0;
|
||||
$kw = urlencode($this->getInput('s'));
|
||||
foreach($html->find('div.hoverable-gif') as $entry){
|
||||
if($limit < $max){
|
||||
foreach($html->find('div.hoverable-gif') as $entry) {
|
||||
if($limit < $max) {
|
||||
$node = $entry->first_child();
|
||||
$href = $node->getAttribute('href');
|
||||
|
||||
|
@ -54,7 +54,7 @@ class GiphyBridge extends BridgeAbstract {
|
|||
$title = str_replace($kw, '', $title);
|
||||
$title = preg_replace('/\s+/', ' ', $title);
|
||||
$title = trim($title);
|
||||
if(strlen($title) <= 0){
|
||||
if(strlen($title) <= 0) {
|
||||
$title = $item['id'];
|
||||
}
|
||||
$item['title'] = trim($title);
|
||||
|
|
|
@ -35,9 +35,9 @@ class GithubIssueBridge extends BridgeAbstract {
|
|||
|
||||
public function getName(){
|
||||
$name = $this->getInput('u') . '/' . $this->getInput('p');
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Project Issues':
|
||||
if($this->getInput('c')){
|
||||
if($this->getInput('c')) {
|
||||
$prefix = static::NAME . 's comments for ';
|
||||
} else {
|
||||
$prefix = static::NAME . 's for ';
|
||||
|
@ -53,11 +53,11 @@ class GithubIssueBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('u')) && !is_null($this->getInput('p'))){
|
||||
if(!is_null($this->getInput('u')) && !is_null($this->getInput('p'))) {
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues';
|
||||
if($this->queriedContext === 'Issue comments'){
|
||||
if($this->queriedContext === 'Issue comments') {
|
||||
$uri .= '/' . $this->getInput('i');
|
||||
} elseif($this->getInput('c')){
|
||||
} elseif($this->getInput('c')) {
|
||||
$uri .= '?q=is%3Aissue+sort%3Aupdated-desc';
|
||||
}
|
||||
return $uri;
|
||||
|
@ -70,29 +70,29 @@ class GithubIssueBridge extends BridgeAbstract {
|
|||
$class = $comment->getAttribute('class');
|
||||
$classes = explode(' ', $class);
|
||||
$event = false;
|
||||
if(in_array('discussion-item', $classes)){
|
||||
if(in_array('discussion-item', $classes)) {
|
||||
$event = true;
|
||||
}
|
||||
|
||||
$author = 'unknown';
|
||||
if($comment->find('.author', 0)){
|
||||
if($comment->find('.author', 0)) {
|
||||
$author = $comment->find('.author', 0)->plaintext;
|
||||
}
|
||||
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
|
||||
|
||||
$comment = $comment->firstChild();
|
||||
if(!$event){
|
||||
if(!$event) {
|
||||
$comment = $comment->nextSibling();
|
||||
}
|
||||
|
||||
if($event){
|
||||
if($event) {
|
||||
$title .= ' / ' . substr($class, strpos($class, 'discussion-item-') + strlen('discussion-item-'));
|
||||
if(!$comment->hasAttribute('id')){
|
||||
if(!$comment->hasAttribute('id')) {
|
||||
$items = array();
|
||||
$timestamp = strtotime($comment->find('relative-time', 0)->getAttribute('datetime'));
|
||||
$content = $comment->innertext;
|
||||
while($comment = $comment->nextSibling()){
|
||||
while($comment = $comment->nextSibling()) {
|
||||
$item = array();
|
||||
$item['author'] = $author;
|
||||
$item['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
||||
|
@ -123,12 +123,12 @@ class GithubIssueBridge extends BridgeAbstract {
|
|||
$title = $issue->find('.gh-header-title', 0)->plaintext;
|
||||
$issueNbr = trim(substr($issue->find('.gh-header-number', 0)->plaintext, 1));
|
||||
$comments = $issue->find('.js-discussion', 0);
|
||||
foreach($comments->children() as $comment){
|
||||
foreach($comments->children() as $comment) {
|
||||
$classes = explode(' ', $comment->getAttribute('class'));
|
||||
if(in_array('discussion-item', $classes)
|
||||
|| in_array('timeline-comment-wrapper', $classes)){
|
||||
|| in_array('timeline-comment-wrapper', $classes)) {
|
||||
$item = $this->extractIssueComment($issueNbr, $title, $comment);
|
||||
if(array_keys($item) !== range(0, count($item) - 1)){
|
||||
if(array_keys($item) !== range(0, count($item) - 1)) {
|
||||
$item = array($item);
|
||||
}
|
||||
$items = array_merge($items, $item);
|
||||
|
@ -141,22 +141,22 @@ class GithubIssueBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('No results for Github Issue ' . $this->getURI());
|
||||
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Issue comments':
|
||||
$this->items = $this->extractIssueComments($html);
|
||||
break;
|
||||
case 'Project Issues':
|
||||
foreach($html->find('.js-active-navigation-container .js-navigation-item') as $issue){
|
||||
foreach($html->find('.js-active-navigation-container .js-navigation-item') as $issue) {
|
||||
$info = $issue->find('.opened-by', 0);
|
||||
$issueNbr = substr(trim($info->plaintext), 1, strpos(trim($info->plaintext), ' '));
|
||||
|
||||
$item = array();
|
||||
$item['content'] = '';
|
||||
|
||||
if($this->getInput('c')){
|
||||
if($this->getInput('c')) {
|
||||
$uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
|
||||
$issue = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT);
|
||||
if($issue){
|
||||
if($issue) {
|
||||
$this->items = array_merge($this->items, $this->extractIssueComments($issue));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class GithubSearchBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($url)
|
||||
or returnServerError('Error while downloading the website content');
|
||||
|
||||
foreach($html->find('div.repo-list-item') as $element){
|
||||
foreach($html->find('div.repo-list-item') as $element) {
|
||||
$item = array();
|
||||
|
||||
$uri = $element->find('h3 a', 0)->href;
|
||||
|
@ -34,10 +34,9 @@ class GithubSearchBridge extends BridgeAbstract {
|
|||
$title = $element->find('h3', 0)->plaintext;
|
||||
$item['title'] = $title;
|
||||
|
||||
if (count($element->find('p')) == 2){
|
||||
if (count($element->find('p')) == 2) {
|
||||
$content = $element->find('p', 0)->innertext;
|
||||
}
|
||||
else{
|
||||
} else{
|
||||
$content = '';
|
||||
}
|
||||
$item['content'] = $content;
|
||||
|
|
|
@ -11,11 +11,11 @@ class GizmodoBridge extends FeedExpander {
|
|||
$item = parent::parseItem($item);
|
||||
|
||||
$articleHTMLContent = getSimpleHTMLDOMCached($item['uri']);
|
||||
if(!$articleHTMLContent){
|
||||
if(!$articleHTMLContent) {
|
||||
$text = 'Could not load ' . $item['uri'];
|
||||
} else {
|
||||
$text = $articleHTMLContent->find('div.entry-content', 0)->innertext;
|
||||
foreach($articleHTMLContent->find('pagespeed_iframe') as $element){
|
||||
foreach($articleHTMLContent->find('pagespeed_iframe') as $element) {
|
||||
$text .= '<p>link to a iframe (could be a video): <a href="'
|
||||
. $element->src
|
||||
. '">'
|
||||
|
|
|
@ -18,7 +18,7 @@ class GoComicsBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request GoComics: ' . $this->getURI());
|
||||
|
||||
foreach($html->find('div.item-comic-container') as $element){
|
||||
foreach($html->find('div.item-comic-container') as $element) {
|
||||
|
||||
$img = $element->find('img', 0);
|
||||
$link = $element->find('a.item-comic-link', 0);
|
||||
|
@ -42,7 +42,7 @@ class GoComicsBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('comicname'))){
|
||||
if(!is_null($this->getInput('comicname'))) {
|
||||
return self::URI . urlencode($this->getInput('comicname'));
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class GoComicsBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('comicname'))){
|
||||
if(!is_null($this->getInput('comicname'))) {
|
||||
return $this->getInput('comicname') . ' - GoComics';
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class GooglePlusPostBridge extends BridgeAbstract{
|
|||
$username = $this->getInput('username');
|
||||
|
||||
// Usernames start with a + if it's not an ID
|
||||
if(!is_numeric($username) && substr($username, 0, 1) !== '+'){
|
||||
if(!is_numeric($username) && substr($username, 0, 1) !== '+') {
|
||||
$username = '+' . $username;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class GooglePlusPostBridge extends BridgeAbstract{
|
|||
$this->_url = $html->find('meta[property=og:url]', 0)->getAttribute('content');
|
||||
|
||||
// I don't even know where to start with this discusting html...
|
||||
foreach($html->find('div[jsname=WsjYwc]') as $post){
|
||||
foreach($html->find('div[jsname=WsjYwc]') as $post) {
|
||||
$item = array();
|
||||
|
||||
$item['author'] = $item['fullname'] = $post->find('div div div div a', 0)->innertext;
|
||||
|
@ -44,7 +44,7 @@ class GooglePlusPostBridge extends BridgeAbstract{
|
|||
|
||||
$timestamp = $post->find('a.qXj2He span', 0);
|
||||
|
||||
if($timestamp){
|
||||
if($timestamp) {
|
||||
$item['timestamp'] = strtotime('+' . preg_replace(
|
||||
'/[^0-9A-Za-z]/',
|
||||
'',
|
||||
|
@ -77,15 +77,15 @@ class GooglePlusPostBridge extends BridgeAbstract{
|
|||
|
||||
// XXX ugly but I don't have any idea how to do a better stuff,
|
||||
// str_replace on link doesn't work as expected and ask too many checks
|
||||
foreach($content->find('a') as $link){
|
||||
foreach($content->find('a') as $link) {
|
||||
$hasHttp = strpos($link->href, 'http');
|
||||
$hasDoubleSlash = strpos($link->href, '//');
|
||||
|
||||
if((!$hasHttp && !$hasDoubleSlash)
|
||||
|| (false !== $hasHttp && strpos($link->href, 'http') != 0)
|
||||
|| (false === $hasHttp && false !== $hasDoubleSlash && $hasDoubleSlash != 0)){
|
||||
|| (false === $hasHttp && false !== $hasDoubleSlash && $hasDoubleSlash != 0)) {
|
||||
// skipp bad link, for some hashtag or other stuff
|
||||
if(strpos($link->href, '/') == 0){
|
||||
if(strpos($link->href, '/') == 0) {
|
||||
$link->href = substr($link->href, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ class GoogleSearchBridge extends BridgeAbstract {
|
|||
|
||||
$emIsRes = $html->find('div[id=ires]', 0);
|
||||
|
||||
if(!is_null($emIsRes)){
|
||||
foreach($emIsRes->find('div[class=g]') as $element){
|
||||
if(!is_null($emIsRes)) {
|
||||
foreach($emIsRes->find('div[class=g]') as $element) {
|
||||
|
||||
$item = array();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class GoogleSearchBridge extends BridgeAbstract {
|
|||
$t = $element->find('a[href]', 0)->href;
|
||||
$item['uri'] = '' . $t;
|
||||
parse_str(parse_url($t, PHP_URL_QUERY), $parameters);
|
||||
if(isset($parameters['q'])){
|
||||
if(isset($parameters['q'])) {
|
||||
$item['uri'] = $parameters['q'];
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ class GoogleSearchBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('q'))){
|
||||
if(!is_null($this->getInput('q'))) {
|
||||
return $this->getInput('q') . ' - Google search';
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class HDWallpapersBridge extends BridgeAbstract {
|
|||
|
||||
public function collectData(){
|
||||
$category = $this->category;
|
||||
if(strrpos($category, 'wallpapers') !== strlen($category) - strlen('wallpapers')){
|
||||
if(strrpos($category, 'wallpapers') !== strlen($category) - strlen('wallpapers')) {
|
||||
$category .= '-desktop-wallpapers';
|
||||
}
|
||||
|
||||
|
@ -31,17 +31,17 @@ class HDWallpapersBridge extends BridgeAbstract {
|
|||
$max = $this->getInput('m') ?: 14;
|
||||
$lastpage = 1;
|
||||
|
||||
for($page = 1; $page <= $lastpage; $page++){
|
||||
for($page = 1; $page <= $lastpage; $page++) {
|
||||
$link = self::URI . '/' . $category . '/page/' . $page;
|
||||
$html = getSimpleHTMLDOM($link)
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
if($page === 1){
|
||||
if($page === 1) {
|
||||
preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches);
|
||||
$lastpage = min($matches[1], ceil($max / 14));
|
||||
}
|
||||
|
||||
foreach($html->find('.wallpapers .wall a') as $element){
|
||||
foreach($html->find('.wallpapers .wall a') as $element) {
|
||||
$thumbnail = $element->find('img', 0);
|
||||
|
||||
$item = array();
|
||||
|
@ -70,7 +70,7 @@ class HDWallpapersBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('c')) && !is_null($this->getInput('r'))){
|
||||
if(!is_null($this->getInput('c')) && !is_null($this->getInput('r'))) {
|
||||
return 'HDWallpapers - '
|
||||
. str_replace(['__', '_'], [' & ', ' '], $this->getInput('c'))
|
||||
. ' ['
|
||||
|
|
|
@ -11,7 +11,7 @@ class HentaiHavenBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request Hentai Haven.');
|
||||
|
||||
foreach($html->find('div.zoe-grid') as $element){
|
||||
foreach($html->find('div.zoe-grid') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('div.brick-content h3 a', 0)->href;
|
||||
$thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src');
|
||||
|
|
|
@ -18,7 +18,7 @@ class IdenticaBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Requested username can\'t be found.');
|
||||
|
||||
foreach($html->find('li.major') as $dent){
|
||||
foreach($html->find('li.major') as $dent) {
|
||||
$item = array();
|
||||
|
||||
// get dent link
|
||||
|
@ -35,7 +35,7 @@ class IdenticaBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return $this->getInput('u') . ' - Identica Bridge';
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class IdenticaBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return self::URI . urlencode($this->getInput('u'));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ class InstagramBridge extends BridgeAbstract {
|
|||
|
||||
$innertext = null;
|
||||
|
||||
foreach($html->find('script') as $script){
|
||||
if('' === $script->innertext){
|
||||
foreach($html->find('script') as $script) {
|
||||
if('' === $script->innertext) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pos = strpos(trim($script->innertext), 'window._sharedData');
|
||||
if(0 !== $pos){
|
||||
if(0 !== $pos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,9 @@ class InstagramBridge extends BridgeAbstract {
|
|||
|
||||
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
|
||||
|
||||
foreach($userMedia as $media){
|
||||
foreach($userMedia as $media) {
|
||||
// Check media type
|
||||
switch($this->getInput('media_type')){
|
||||
switch($this->getInput('media_type')) {
|
||||
case 'all': break;
|
||||
case 'video':
|
||||
if($media->is_video === false) continue 2;
|
||||
|
@ -65,7 +65,7 @@ class InstagramBridge extends BridgeAbstract {
|
|||
$item = array();
|
||||
$item['uri'] = self::URI . 'p/' . $media->code . '/';
|
||||
$item['content'] = '<img src="' . htmlentities($media->display_src) . '" />';
|
||||
if (isset($media->caption)){
|
||||
if (isset($media->caption)) {
|
||||
$item['title'] = $media->caption;
|
||||
} else {
|
||||
$item['title'] = basename($media->display_src);
|
||||
|
@ -76,7 +76,7 @@ class InstagramBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return $this->getInput('u') . ' - Instagram Bridge';
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ class InstagramBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return self::URI . urlencode($this->getInput('u'));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,9 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
|
||||
public function getURI(){
|
||||
$uri = self::URI;
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By "Latest" category':
|
||||
switch($this->getInput('latest_category')){
|
||||
switch($this->getInput('latest_category')) {
|
||||
case 'hot_torrents':
|
||||
$uri .= 'statistic/hot/torrents';
|
||||
break;
|
||||
|
@ -128,7 +128,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By "Latest" category':
|
||||
$categoryName = array_search(
|
||||
$this->getInput('latest_category'),
|
||||
|
@ -163,9 +163,9 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
public function collectData(){
|
||||
$html = $this->loadHtml($this->getURI());
|
||||
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By "Latest" category':
|
||||
switch($this->getInput('latest_category')){
|
||||
switch($this->getInput('latest_category')) {
|
||||
case 'hot_torrents':
|
||||
$this->getLatestHotTorrents($html);
|
||||
break;
|
||||
|
@ -179,7 +179,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
}
|
||||
break;
|
||||
case 'By "Torrent" category':
|
||||
if($this->getInput('torrent_category') === 'movies'){
|
||||
if($this->getInput('torrent_category') === 'movies') {
|
||||
// This one is special (content wise)
|
||||
$this->getMovieTorrents($html);
|
||||
} else {
|
||||
|
@ -187,7 +187,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
}
|
||||
break;
|
||||
case 'Search torrent by name':
|
||||
if( $this->getInput('search_category') === 'movies'){
|
||||
if($this->getInput('search_category') === 'movies') {
|
||||
// This one is special (content wise)
|
||||
$this->getMovieTorrents($html);
|
||||
} else {
|
||||
|
@ -208,7 +208,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
if(!$torrents)
|
||||
returnServerError('Unable to find torrents!');
|
||||
|
||||
foreach($torrents as $torrent){
|
||||
foreach($torrents as $torrent) {
|
||||
|
||||
$anchor = $torrent->find('a', 0);
|
||||
if(!$anchor)
|
||||
|
@ -246,7 +246,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
// Remove first element (header row)
|
||||
$torrents = array_slice($torrents, 1);
|
||||
|
||||
foreach($torrents as $torrent){
|
||||
foreach($torrents as $torrent) {
|
||||
|
||||
$cell = $torrent->find('td', 0);
|
||||
if(!$cell)
|
||||
|
@ -281,7 +281,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
if(!$posts)
|
||||
returnServerError('Unable to find posts!');
|
||||
|
||||
foreach($posts as $post){
|
||||
foreach($posts as $post) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = $this->latestNewsExtractUri($post);
|
||||
|
@ -316,7 +316,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
$timestamp = strtotime($matches[1]);
|
||||
|
||||
// Make sure date is not in the future (dates are given like 'Nov. 20' without year)
|
||||
if($timestamp > time()){
|
||||
if($timestamp > time()) {
|
||||
$timestamp = strtotime('-1 year', $timestamp);
|
||||
}
|
||||
|
||||
|
@ -345,12 +345,12 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
returnServerError('Unable to find content!');
|
||||
|
||||
// Remove <h2>...</h2> (title)
|
||||
foreach($content->find('h2') as $element){
|
||||
foreach($content->find('h2') as $element) {
|
||||
$element->outertext = '';
|
||||
}
|
||||
|
||||
// Remove <small>...</small> (author)
|
||||
foreach($content->find('small') as $element){
|
||||
foreach($content->find('small') as $element) {
|
||||
$element->outertext = '';
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
if(!$torrents)
|
||||
returnServerError('Unable to find torrents!');
|
||||
|
||||
foreach($torrents as $torrent){
|
||||
foreach($torrents as $torrent) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = $this->latestTorrentsExtractUri($torrent);
|
||||
|
@ -444,7 +444,7 @@ class IsoHuntBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
private function buildCategoryUri($category, $order_popularity = false){
|
||||
switch($category){
|
||||
switch($category) {
|
||||
case 'anime': $index = 1; break;
|
||||
case 'software' : $index = 2; break;
|
||||
case 'games' : $index = 3; break;
|
||||
|
|
|
@ -38,7 +38,7 @@ class JapanExpoBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
$convert_article_images = function($matches){
|
||||
if(is_array($matches) && count($matches) > 1){
|
||||
if(is_array($matches) && count($matches) > 1) {
|
||||
return '<img src="' . $matches[1] . '" />';
|
||||
}
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ class JapanExpoBridge extends BridgeAbstract {
|
|||
$fullcontent = $this->getInput('mode');
|
||||
$count = 0;
|
||||
|
||||
foreach($html->find('a._tile2') as $element){
|
||||
foreach($html->find('a._tile2') as $element) {
|
||||
|
||||
$url = $element->href;
|
||||
$thumbnail = 'http://s.japan-expo.com/katana/images/JES049/paris.png';
|
||||
|
@ -57,8 +57,8 @@ class JapanExpoBridge extends BridgeAbstract {
|
|||
if(count($img_search_result) >= 2)
|
||||
$thumbnail = trim($img_search_result[1], "'");
|
||||
|
||||
if($fullcontent){
|
||||
if($count >= 5){
|
||||
if($fullcontent) {
|
||||
if($count >= 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,23 +49,22 @@ class KATBridge extends BridgeAbstract {
|
|||
return $timestamp;
|
||||
}
|
||||
$catBool = $this->getInput('cat_check');
|
||||
if($catBool){
|
||||
if($catBool) {
|
||||
$catNum = $this->getInput('cat');
|
||||
}
|
||||
$critList = $this->getInput('crit');
|
||||
$trustedBool = $this->getInput('trusted');
|
||||
$keywordsList = explode(';', $this->getInput('q'));
|
||||
foreach($keywordsList as $keywords){
|
||||
switch($critList){
|
||||
foreach($keywordsList as $keywords) {
|
||||
switch($critList) {
|
||||
case 'search':
|
||||
if($catBool == false){
|
||||
if($catBool == false) {
|
||||
$html = getSimpleHTMLDOM(
|
||||
self::URI .
|
||||
'torrents-search.php?search=' .
|
||||
rawurlencode($keywords)
|
||||
) or returnServerError('Could not request KAT.');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$html = getSimpleHTMLDOM(
|
||||
self::URI .
|
||||
'torrents-search.php?search=' .
|
||||
|
@ -92,10 +91,10 @@ class KATBridge extends BridgeAbstract {
|
|||
}
|
||||
if ($html->find('table.ttable_headinner', 0) == false)
|
||||
returnServerError('No result for query ' . $keywords);
|
||||
foreach($html->find('tr.t-row') as $element){
|
||||
foreach($html->find('tr.t-row') as $element) {
|
||||
if(!$trustedBool
|
||||
|| !is_null($element->find('i[title="Elite Uploader"]', 0))
|
||||
|| !is_null($element->find('i[title="Verified Uploader"]', 0))){
|
||||
|| !is_null($element->find('i[title="Verified Uploader"]', 0))) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . $element->find('a', 2)->href;
|
||||
$item['id'] = self::URI . $element->find('a.cellMainLink', 0)->href;
|
||||
|
|
|
@ -66,18 +66,18 @@ class KernelBugTrackerBridge extends BridgeAbstract {
|
|||
// Get and limit comments
|
||||
$comments = $html->find('div.bz_comment');
|
||||
|
||||
if($limit > 0 && count($comments) > $limit){
|
||||
if($limit > 0 && count($comments) > $limit) {
|
||||
$comments = array_slice($comments, count($comments) - $limit, $limit);
|
||||
}
|
||||
|
||||
// Order comments
|
||||
switch($sorting){
|
||||
switch($sorting) {
|
||||
case 'lf': $comments = array_reverse($comments, true);
|
||||
case 'of':
|
||||
default: // Nothing to do, keep original order
|
||||
}
|
||||
|
||||
foreach($comments as $comment){
|
||||
foreach($comments as $comment) {
|
||||
$comment = $this->inlineStyles($comment);
|
||||
|
||||
$item = array();
|
||||
|
@ -99,7 +99,7 @@ class KernelBugTrackerBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Bug comments':
|
||||
return parent::getURI()
|
||||
. '/show_bug.cgi?id='
|
||||
|
@ -110,7 +110,7 @@ class KernelBugTrackerBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Bug comments':
|
||||
return 'Bug '
|
||||
. $this->bugid
|
||||
|
@ -142,7 +142,7 @@ class KernelBugTrackerBridge extends BridgeAbstract {
|
|||
* attributes.
|
||||
*/
|
||||
private function inlineStyles($html){
|
||||
foreach($html->find('.bz_obsolete') as $element){
|
||||
foreach($html->find('.bz_obsolete') as $element) {
|
||||
$element->style = 'text-decoration:line-through;';
|
||||
}
|
||||
|
||||
|
|
|
@ -41,13 +41,13 @@ class KununuBridge extends BridgeAbstract {
|
|||
private $companyName = '';
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('company')) && !is_null($this->getInput('site'))){
|
||||
if(!is_null($this->getInput('company')) && !is_null($this->getInput('site'))) {
|
||||
|
||||
$company = $this->fixCompanyName($this->getInput('company'));
|
||||
$site = $this->getInput('site');
|
||||
$section = '';
|
||||
|
||||
switch($site){
|
||||
switch($site) {
|
||||
case 'at':
|
||||
case 'de':
|
||||
case 'ch':
|
||||
|
@ -65,7 +65,7 @@ class KununuBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
function getName(){
|
||||
if(!is_null($this->getInput('company'))){
|
||||
if(!is_null($this->getInput('company'))) {
|
||||
$company = $this->fixCompanyName($this->getInput('company'));
|
||||
return ($this->companyName ?: $company) . ' - ' . self::NAME;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class KununuBridge extends BridgeAbstract {
|
|||
returnServerError('Unable to find articles!');
|
||||
|
||||
// Go through all articles
|
||||
foreach($articles as $article){
|
||||
foreach($articles as $article) {
|
||||
$item = array();
|
||||
|
||||
$item['author'] = $this->extractArticleAuthorPosition($article);
|
||||
|
@ -208,8 +208,8 @@ class KununuBridge extends BridgeAbstract {
|
|||
|
||||
// Go through all h2 elements to find index of required span (I know... it's stupid)
|
||||
$author_position = 'Unknown';
|
||||
foreach($user_content->find('div') as $content){
|
||||
if(stristr(strtolower($content->plaintext), 'position')){ /* This works for at, ch, de, us */
|
||||
foreach($user_content->find('div') as $content) {
|
||||
if(stristr(strtolower($content->plaintext), 'position')) { /* This works for at, ch, de, us */
|
||||
$author_position = $content->next_sibling()->plaintext;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
}
|
||||
|
||||
private function jumpToNextTag(&$node){
|
||||
while($node && $node->nodeType === XML_TEXT_NODE){
|
||||
while($node && $node->nodeType === XML_TEXT_NODE) {
|
||||
$nextNode = $node->nextSibling;
|
||||
if(!$nextNode){
|
||||
if(!$nextNode) {
|
||||
break;
|
||||
}
|
||||
$node = $nextNode;
|
||||
|
@ -21,9 +21,9 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
}
|
||||
|
||||
private function jumpToPreviousTag(&$node){
|
||||
while($node && $node->nodeType === XML_TEXT_NODE){
|
||||
while($node && $node->nodeType === XML_TEXT_NODE) {
|
||||
$previousNode = $node->previousSibling;
|
||||
if(!$previousNode){
|
||||
if(!$previousNode) {
|
||||
break;
|
||||
}
|
||||
$node = $previousNode;
|
||||
|
@ -44,8 +44,8 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
$cat1 = '';
|
||||
$cat2 = '';
|
||||
|
||||
foreach($html->getElementsByTagName('a') as $a){
|
||||
if($a->textContent === 'Multi-page format'){
|
||||
foreach($html->getElementsByTagName('a') as $a) {
|
||||
if($a->textContent === 'Multi-page format') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
substr($edition, strpos($edition, 'for ') + strlen('for '))
|
||||
);
|
||||
|
||||
foreach($html->getElementsByTagName('h2') as $h2){
|
||||
if($h2->getAttribute('class') !== 'SummaryHL'){
|
||||
foreach($html->getElementsByTagName('h2') as $h2) {
|
||||
if($h2->getAttribute('class') !== 'SummaryHL') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
$h2NextSibling = $h2->nextSibling;
|
||||
$this->jumpToNextTag($h2NextSibling);
|
||||
|
||||
switch($h2NextSibling->getAttribute('class')){
|
||||
switch($h2NextSibling->getAttribute('class')) {
|
||||
case 'FeatureByline':
|
||||
$item['author'] = $h2NextSibling->getElementsByTagName('b')->item(0)->textContent;
|
||||
break;
|
||||
|
@ -82,9 +82,9 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
|
||||
$h2FirstChild = $h2->firstChild;
|
||||
$this->jumpToNextTag($h2FirstChild);
|
||||
if($h2FirstChild->nodeName === 'a'){
|
||||
if($h2FirstChild->nodeName === 'a') {
|
||||
$item['uri'] = self::URI . $h2FirstChild->getAttribute('href');
|
||||
}else{
|
||||
} else{
|
||||
$item['uri'] = $realURI . '#' . $URICounter;
|
||||
}
|
||||
$URICounter++;
|
||||
|
@ -93,12 +93,12 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
|
||||
$h2PrevSibling = $h2->previousSibling;
|
||||
$this->jumpToPreviousTag($h2PrevSibling);
|
||||
switch($h2PrevSibling->getAttribute('class')){
|
||||
switch($h2PrevSibling->getAttribute('class')) {
|
||||
case 'Cat2HL':
|
||||
$cat2 = $h2PrevSibling->textContent;
|
||||
$h2PrevSibling = $h2PrevSibling->previousSibling;
|
||||
$this->jumpToPreviousTag($h2PrevSibling);
|
||||
if($h2PrevSibling->getAttribute('class') !== 'Cat1HL'){
|
||||
if($h2PrevSibling->getAttribute('class') !== 'Cat1HL') {
|
||||
break;
|
||||
}
|
||||
$cat1 = $h2PrevSibling->textContent;
|
||||
|
@ -113,7 +113,7 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
$h2PrevSibling = null;
|
||||
|
||||
$item['title'] = '';
|
||||
if(!empty($cat1)){
|
||||
if(!empty($cat1)) {
|
||||
$item['title'] .= '[' . $cat1 . ($cat2 ? '/' . $cat2 : '') . '] ';
|
||||
}
|
||||
$item['title'] .= $h2->textContent;
|
||||
|
@ -121,7 +121,7 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
$node = $h2;
|
||||
$content = '';
|
||||
$contentEnd = false;
|
||||
while(!$contentEnd){
|
||||
while(!$contentEnd) {
|
||||
$node = $node->nextSibling;
|
||||
if(!$node || (
|
||||
$node->nodeType !== XML_TEXT_NODE && (
|
||||
|
@ -132,9 +132,9 @@ class LWNprevBridge extends BridgeAbstract{
|
|||
)
|
||||
)
|
||||
)
|
||||
){
|
||||
) {
|
||||
$contentEnd = true;
|
||||
}else{
|
||||
} else{
|
||||
$content .= $node->C14N();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ region, and optionally a category and a keyword .';
|
|||
public function collectData(){
|
||||
|
||||
$category = $this->getInput('c');
|
||||
if(empty($category)){
|
||||
if(empty($category)) {
|
||||
$category = 'annonces';
|
||||
}
|
||||
|
||||
|
@ -154,13 +154,13 @@ region, and optionally a category and a keyword .';
|
|||
or returnServerError('Could not request LeBonCoin.');
|
||||
|
||||
$list = $html->find('.tabsContent', 0);
|
||||
if($list === null){
|
||||
if($list === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tags = $list->find('li');
|
||||
|
||||
foreach($tags as $element){
|
||||
foreach($tags as $element) {
|
||||
|
||||
$element = $element->find('a', 0);
|
||||
|
||||
|
@ -169,7 +169,7 @@ region, and optionally a category and a keyword .';
|
|||
$title = html_entity_decode($element->getAttribute('title'));
|
||||
$content_image = $element->find('div.item_image', 0)->find('.lazyload', 0);
|
||||
|
||||
if($content_image !== null){
|
||||
if($content_image !== null) {
|
||||
$content = '<img src="' . $content_image->getAttribute('data-imgsrc') . '" alt="thumbnail">';
|
||||
} else {
|
||||
$content = "";
|
||||
|
|
|
@ -27,7 +27,7 @@ class LeMondeInformatiqueBridge extends FeedExpander {
|
|||
}
|
||||
|
||||
private function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
|
|
@ -19,10 +19,10 @@ class LegifranceJOBridge extends BridgeAbstract {
|
|||
$item['uri'] = $this->uri . '#' . count($this->items);
|
||||
$item['title'] = $section->plaintext;
|
||||
|
||||
if(!is_null($origin)){
|
||||
if(!is_null($origin)) {
|
||||
$item['title'] = '[ ' . $item['title'] . ' / ' . $subsection->plaintext . ' ] ' . $origin->plaintext;
|
||||
$data = $origin;
|
||||
} elseif(!is_null($subsection)){
|
||||
} elseif(!is_null($subsection)) {
|
||||
$item['title'] = '[ ' . $item['title'] . ' ] ' . $subsection->plaintext;
|
||||
$data = $subsection;
|
||||
} else {
|
||||
|
@ -30,7 +30,7 @@ class LegifranceJOBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
$item['content'] = '';
|
||||
foreach($data->nextSibling()->find('a') as $content){
|
||||
foreach($data->nextSibling()->find('a') as $content) {
|
||||
$text = $content->plaintext;
|
||||
$href = $content->nextSibling()->getAttribute('resource');
|
||||
$item['content'] .= '<p><a href="' . $href . '">' . $text . '</a></p>';
|
||||
|
@ -47,19 +47,19 @@ class LegifranceJOBridge extends BridgeAbstract {
|
|||
$this->uri = trim(substr($uri, strpos($uri, 'https')));
|
||||
$this->timestamp = strtotime(substr($this->uri, strpos($this->uri, 'eli/jo/') + strlen('eli/jo/')));
|
||||
|
||||
foreach($html->find('h3') as $section){
|
||||
foreach($html->find('h3') as $section) {
|
||||
$subsections = $section->nextSibling()->find('h4');
|
||||
foreach($subsections as $subsection){
|
||||
foreach($subsections as $subsection) {
|
||||
$origins = $subsection->nextSibling()->find('h5');
|
||||
foreach($origins as $origin){
|
||||
foreach($origins as $origin) {
|
||||
$this->items[] = $this->extractItem($section, $subsection, $origin);
|
||||
}
|
||||
if(!empty($origins)){
|
||||
if(!empty($origins)) {
|
||||
continue;
|
||||
}
|
||||
$this->items[] = $this->extractItem($section, $subsection);
|
||||
}
|
||||
if(!empty($subsections)){
|
||||
if(!empty($subsections)) {
|
||||
continue;
|
||||
}
|
||||
$this->items[] = $this->extractItem($section);
|
||||
|
|
|
@ -11,7 +11,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request LesJoiesDuCode.');
|
||||
|
||||
foreach($html->find('div.blog-post') as $element){
|
||||
foreach($html->find('div.blog-post') as $element) {
|
||||
$item = array();
|
||||
$temp = $element->find('h1 a', 0);
|
||||
$titre = html_entity_decode($temp->innertext);
|
||||
|
@ -21,7 +21,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract {
|
|||
|
||||
// retrieve .gif instead of static .jpg
|
||||
$images = $temp->find('p img');
|
||||
foreach($images as $image){
|
||||
foreach($images as $image) {
|
||||
$img_src = str_replace(".jpg", ".gif", $image->src);
|
||||
$image->src = $img_src;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract {
|
|||
$auteur = $temp->find('i', 0);
|
||||
$pos = strpos($auteur->innertext, "by");
|
||||
|
||||
if($pos > 0){
|
||||
if($pos > 0) {
|
||||
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
|
||||
$item['author'] = $auteur;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ class LinkedInCompanyBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($link)
|
||||
or returnServerError('Could not request LinkedIn.');
|
||||
|
||||
foreach($html->find('//*[@id="my-feed-post"]/li') as $element){
|
||||
foreach($html->find('//*[@id="my-feed-post"]/li') as $element) {
|
||||
$title = $element->find('span.share-body', 0)->innertext;
|
||||
if($title){
|
||||
if($title) {
|
||||
$item = array();
|
||||
$item['uri'] = $link;
|
||||
$item['title'] = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0, 100);
|
||||
|
|
|
@ -80,7 +80,7 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
public function collectData(){
|
||||
// We'll use the DOM parser for this as it makes navigation easier
|
||||
$html = getContents($this->getURI());
|
||||
if(!$html){
|
||||
if(!$html) {
|
||||
returnClientError('Could not receive data for ' . $path . '!');
|
||||
}
|
||||
libxml_use_internal_errors(true);
|
||||
|
@ -92,7 +92,7 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
$xpath = new DomXPath($doc);
|
||||
|
||||
$this->request = '';
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Get latest updates':
|
||||
$this->request = 'Latest updates';
|
||||
$this->getLatestUpdates($xpath);
|
||||
|
@ -105,7 +105,7 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
break;
|
||||
case 'Get manga updates':
|
||||
$limit = $this->getInput('limit');
|
||||
if(empty($limit)){
|
||||
if(empty($limit)) {
|
||||
$limit = self::PARAMETERS[$this->queriedContext]['limit']['defaultValue'];
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
// Return some dummy-data if no content available
|
||||
if(empty($this->items)){
|
||||
if(empty($this->items)) {
|
||||
$item = array();
|
||||
$item['content'] = "<p>No updates available</p>";
|
||||
|
||||
|
@ -130,14 +130,14 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
// Query each item (consists of Manga + chapters)
|
||||
$nodes = $xpath->query("//*[@id='latestchapters']/table//td");
|
||||
|
||||
foreach ($nodes as $node){
|
||||
foreach ($nodes as $node) {
|
||||
// Query the manga
|
||||
$manga = $xpath->query("a[@class='chapter']", $node)->item(0);
|
||||
|
||||
// Collect the chapters for each Manga
|
||||
$chapters = $xpath->query("a[@class='chaptersrec']", $node);
|
||||
|
||||
if (isset($manga) && $chapters->length >= 1){
|
||||
if (isset($manga) && $chapters->length >= 1) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . htmlspecialchars($manga->getAttribute('href'));
|
||||
$item['title'] = htmlspecialchars($manga->nodeValue);
|
||||
|
@ -145,8 +145,8 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
// Add each chapter to the feed
|
||||
$item['content'] = "";
|
||||
|
||||
foreach ($chapters as $chapter){
|
||||
if($item['content'] <> ""){
|
||||
foreach ($chapters as $chapter) {
|
||||
if($item['content'] <> "") {
|
||||
$item['content'] .= "<br>";
|
||||
}
|
||||
$item['content'] .= "<a href='"
|
||||
|
@ -166,7 +166,7 @@ class MangareaderBridge extends BridgeAbstract {
|
|||
// Query all mangas
|
||||
$mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']");
|
||||
|
||||
foreach ($mangas as $manga){
|
||||
foreach ($mangas as $manga) {
|
||||
|
||||
// The thumbnail is encrypted in a css-style...
|
||||
// format: "background-image:url('<the part which is actually interesting>')"
|
||||
|
@ -203,13 +203,13 @@ EOD;
|
|||
private function getMangaUpdates($xpath, $limit){
|
||||
$query = "(.//*[@id='listing']//tr)[position() > 1]";
|
||||
|
||||
if($limit !== -1){
|
||||
if($limit !== -1) {
|
||||
$query = "(.//*[@id='listing']//tr)[position() > 1][position() > last() - {$limit}]";
|
||||
}
|
||||
|
||||
$chapters = $xpath->query($query);
|
||||
|
||||
foreach ($chapters as $chapter){
|
||||
foreach ($chapters as $chapter) {
|
||||
$item = array();
|
||||
$item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)
|
||||
->item(0)
|
||||
|
@ -225,13 +225,13 @@ EOD;
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'Get latest updates':
|
||||
$path = "latest";
|
||||
break;
|
||||
case 'Get popular mangas':
|
||||
$path = "popular";
|
||||
if($this->getInput('category') !== "all"){
|
||||
if($this->getInput('category') !== "all") {
|
||||
$path .= "/" . $this->getInput('category');
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -16,7 +16,7 @@ class MixCloudBridge extends BridgeAbstract {
|
|||
));
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return 'MixCloud - ' . $this->getInput('u');
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class MixCloudBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI . $this->getInput('u'))
|
||||
or returnServerError('Could not request MixCloud.');
|
||||
|
||||
foreach($html->find('section.card') as $element){
|
||||
foreach($html->find('section.card') as $element) {
|
||||
|
||||
$item = array();
|
||||
|
||||
|
@ -40,7 +40,7 @@ class MixCloudBridge extends BridgeAbstract {
|
|||
|
||||
$image = $element->find('a.album-art img', 0);
|
||||
|
||||
if($image){
|
||||
if($image) {
|
||||
$item['content'] = '<img src="' . $image->getAttribute('src') . '" />';
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class MoebooruBridge extends BridgeAbstract {
|
|||
$data[] = preg_replace('/}\)(.*)/', '}', $element);
|
||||
unset($data[0]);
|
||||
|
||||
foreach($data as $datai){
|
||||
foreach($data as $datai) {
|
||||
$json = json_decode($datai, true);
|
||||
$item = array();
|
||||
$item['uri'] = $this->getURI() . '/post/show/' . $json['id'];
|
||||
|
|
|
@ -92,17 +92,17 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
|
||||
$sections = $this->splitSections($html);
|
||||
|
||||
foreach($sections as $section){
|
||||
foreach($sections as $section) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = $this->findSectionAnchor($section[0]);
|
||||
|
||||
switch($this->getInput('content')){
|
||||
switch($this->getInput('content')) {
|
||||
case 'none': // Do not return any content
|
||||
break;
|
||||
case 'follow': // Follow the anchor
|
||||
// We can only follow anchors (use default otherwise)
|
||||
if($this->getInput('separator') === 'a'){
|
||||
if($this->getInput('separator') === 'a') {
|
||||
$content = $this->followAnchor($item['uri']);
|
||||
|
||||
// Return only actual content
|
||||
|
@ -124,14 +124,14 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
$item['title'] = strip_tags($section[1]);
|
||||
|
||||
// Skip items with empty title
|
||||
if(empty(trim($item['title']))){
|
||||
if(empty(trim($item['title']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->items[] = $item;
|
||||
|
||||
if($this->getInput('limit') > 0
|
||||
&& count($this->items) >= $this->getInput('limit')){
|
||||
&& count($this->items) >= $this->getInput('limit')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
);
|
||||
|
||||
// Some pages don't use headers, return page as one feed
|
||||
if(count($sections) === 0){
|
||||
if(count($sections) === 0) {
|
||||
return array(
|
||||
array(
|
||||
$content,
|
||||
|
@ -198,13 +198,13 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
|
||||
// For IDs
|
||||
$anchor = $html->find($this->getInput('separator') . '[id=]', 0);
|
||||
if(!is_null($anchor)){
|
||||
if(!is_null($anchor)) {
|
||||
return $this->getInput('source') . '#' . $anchor->id;
|
||||
}
|
||||
|
||||
// For actual anchors
|
||||
$anchor = $html->find($this->getInput('separator') . '[href=]', 0);
|
||||
if(!is_null($anchor)){
|
||||
if(!is_null($anchor)) {
|
||||
return $anchor->href;
|
||||
}
|
||||
|
||||
|
@ -225,11 +225,11 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
*/
|
||||
$pageinfo = $html->find('[id="pageinfo"]', 0);
|
||||
|
||||
if(is_null($pageinfo)){
|
||||
if(is_null($pageinfo)) {
|
||||
return null;
|
||||
} else {
|
||||
$author = $pageinfo->find('[title=]', 0);
|
||||
if(is_null($author)){
|
||||
if(is_null($author)) {
|
||||
return null;
|
||||
} else {
|
||||
return trim(explode('@', $author->title)[0]);
|
||||
|
@ -246,7 +246,7 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
// See example of findAuthor()
|
||||
$pageinfo = $html->find('[id="pageinfo"]', 0);
|
||||
|
||||
if(is_null($pageinfo)){
|
||||
if(is_null($pageinfo)) {
|
||||
return null;
|
||||
} else {
|
||||
$timestamp = $pageinfo->innertext;
|
||||
|
@ -264,8 +264,8 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
|
||||
$source = $source ?: $this->getURI();
|
||||
|
||||
foreach($html->find('a') as $anchor){
|
||||
switch(substr($anchor->href, 0, 1)){
|
||||
foreach($html->find('a') as $anchor) {
|
||||
switch(substr($anchor->href, 0, 1)) {
|
||||
case 'h': // http or https, no actions required
|
||||
break;
|
||||
case '/': // some relative path
|
||||
|
@ -287,12 +287,12 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
* wiki domain)
|
||||
*/
|
||||
private function followAnchor($anchor){
|
||||
if(strrpos($anchor, $this->findDomain($this->getInput('source')) === false)){
|
||||
if(strrpos($anchor, $this->findDomain($this->getInput('source')) === false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$html = getSimpleHTMLDOMCached($anchor);
|
||||
if(!$html){ // Cannot load article
|
||||
if(!$html) { // Cannot load article
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ class MoinMoinBridge extends BridgeAbstract {
|
|||
|
||||
/* This function is a copy from CNETBridge */
|
||||
private function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
|
|
@ -11,7 +11,7 @@ class MondeDiploBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request MondeDiplo. for : ' . self::URI);
|
||||
|
||||
foreach($html->find('div.unarticle') as $article){
|
||||
foreach($html->find('div.unarticle') as $article) {
|
||||
$element = $article->parent();
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . $element->href;
|
||||
|
|
|
@ -21,8 +21,8 @@ class MsnMondeBridge extends BridgeAbstract {
|
|||
or returnServerError('Could not request MsnMonde.');
|
||||
|
||||
$limit = 0;
|
||||
foreach($html->find('.smalla') as $article){
|
||||
if($limit < 10){
|
||||
foreach($html->find('.smalla') as $article) {
|
||||
if($limit < 10) {
|
||||
$item = array();
|
||||
$item['title'] = utf8_decode($article->find('h4', 0)->innertext);
|
||||
$item['uri'] = self::URI . utf8_decode($article->find('a', 0)->href);
|
||||
|
|
|
@ -14,7 +14,7 @@ class NasaApodBridge extends BridgeAbstract {
|
|||
|
||||
$list = explode("<br>", $html->find('b', 0)->innertext);
|
||||
|
||||
for($i = 0; $i < 3; $i++){
|
||||
for($i = 0; $i < 3; $i++) {
|
||||
$line = $list[$i];
|
||||
$item = array();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class NeuviemeArtBridge extends FeedExpander {
|
|||
const DESCRIPTION = 'Returns the newest articles.';
|
||||
|
||||
private function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
@ -20,21 +20,21 @@ class NeuviemeArtBridge extends FeedExpander {
|
|||
$item = parent::parseItem($item);
|
||||
|
||||
$article_html = getSimpleHTMLDOMCached($item['uri']);
|
||||
if(!$article_html){
|
||||
if(!$article_html) {
|
||||
$item['content'] = 'Could not request 9eme Art: ' . $item['uri'];
|
||||
return $item;
|
||||
}
|
||||
|
||||
$article_image = '';
|
||||
foreach ($article_html->find('img.img_full') as $img){
|
||||
if ($img->alt == $item['title']){
|
||||
foreach ($article_html->find('img.img_full') as $img) {
|
||||
if ($img->alt == $item['title']) {
|
||||
$article_image = self::URI . $img->src;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$article_content = '';
|
||||
if($article_image){
|
||||
if($article_image) {
|
||||
$article_content = '<p><img src="' . $article_image . '" /></p>';
|
||||
}
|
||||
$article_content .= str_replace(
|
||||
|
|
|
@ -35,9 +35,9 @@ class NextgovBridge extends FeedExpander {
|
|||
$item['content'] = '';
|
||||
|
||||
$namespaces = $newsItem->getNamespaces(true);
|
||||
if(isset($namespaces['media'])){
|
||||
if(isset($namespaces['media'])) {
|
||||
$media = $newsItem->children($namespaces['media']);
|
||||
if(isset($media->content)){
|
||||
if(isset($media->content)) {
|
||||
$attributes = $media->content->attributes();
|
||||
$item['content'] = '<img src="' . $attributes['url'] . '">';
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class NovelUpdatesBridge extends BridgeAbstract {
|
|||
private $seriesTitle = '';
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('n'))){
|
||||
if(!is_null($this->getInput('n'))) {
|
||||
return static::URI . '/series/' . $this->getInput('n') . '/';
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class NovelUpdatesBridge extends BridgeAbstract {
|
|||
$html = stristr($html, '<tbody>'); //strip thead
|
||||
$html = stristr($html, '<tr>'); //remove tbody
|
||||
$html = str_get_html(stristr($html, '</tbody>', true)); //remove last tbody and get back as an array
|
||||
foreach($html->find('tr') as $element){
|
||||
foreach($html->find('tr') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('td', 2)->find('a', 0)->href;
|
||||
$item['title'] = $element->find('td', 2)->find('a', 0)->plaintext;
|
||||
|
@ -60,7 +60,7 @@ class NovelUpdatesBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!empty($this->seriesTitle)){
|
||||
if(!empty($this->seriesTitle)) {
|
||||
return $this->seriesTitle . ' - ' . static::NAME;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class OpenClassroomsBridge extends BridgeAbstract {
|
|||
));
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return self::URI . '/courses?categories=' . $this->getInput('u') . '&title=&sort=updatedAt+desc';
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class OpenClassroomsBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request OpenClassrooms.');
|
||||
|
||||
foreach($html->find('.courseListItem') as $element){
|
||||
foreach($html->find('.courseListItem') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . $element->find('a', 0)->href;
|
||||
$item['title'] = $element->find('h3', 0)->plaintext;
|
||||
|
|
|
@ -29,15 +29,15 @@ class ParuVenduImmoBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request paruvendu.');
|
||||
|
||||
foreach($html->find('div.annonce a') as $element){
|
||||
foreach($html->find('div.annonce a') as $element) {
|
||||
|
||||
if(!$element->title){
|
||||
if(!$element->title) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$img = '';
|
||||
foreach($element->find('span.img img') as $img){
|
||||
if($img->original){
|
||||
foreach($element->find('span.img img') as $img) {
|
||||
if($img->original) {
|
||||
$img = '<img src="' . $img->original . '" />';
|
||||
}
|
||||
}
|
||||
|
@ -65,33 +65,33 @@ class ParuVenduImmoBridge extends BridgeAbstract {
|
|||
. $appartment
|
||||
. $maison;
|
||||
|
||||
if($this->getInput('minarea')){
|
||||
if($this->getInput('minarea')) {
|
||||
$link .= '&sur0=' . urlencode($this->getInput('minarea'));
|
||||
}
|
||||
|
||||
if($this->getInput('maxprice')){
|
||||
if($this->getInput('maxprice')) {
|
||||
$link .= '&px1=' . urlencode($this->getInput('maxprice'));
|
||||
}
|
||||
|
||||
if($this->getInput('pa')){
|
||||
if($this->getInput('pa')) {
|
||||
$link .= '&pa=' . urlencode($this->getInput('pa'));
|
||||
}
|
||||
|
||||
if($this->getInput('lo')){
|
||||
if($this->getInput('lo')) {
|
||||
$link .= '&lo=' . urlencode($this->getInput('lo'));
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('minarea'))){
|
||||
if(!is_null($this->getInput('minarea'))) {
|
||||
$request = '';
|
||||
$minarea = $this->getInput('minarea');
|
||||
if(!empty($minarea)){
|
||||
if(!empty($minarea)) {
|
||||
$request .= ' ' . $minarea . ' m2';
|
||||
}
|
||||
$location = $this->getInput('lo');
|
||||
if(!empty($location)){
|
||||
if(!empty($location)) {
|
||||
$request .= ' In: ' . $location;
|
||||
}
|
||||
return 'Paru Vendu Immobilier' . $request;
|
||||
|
|
|
@ -34,16 +34,16 @@ class PickyWallpapersBridge extends BridgeAbstract {
|
|||
$max = $this->getInput('m');
|
||||
$resolution = $this->getInput('r'); // Wide wallpaper default
|
||||
|
||||
for($page = 1; $page <= $lastpage; $page++){
|
||||
for($page = 1; $page <= $lastpage; $page++) {
|
||||
$html = getSimpleHTMLDOM($this->getURI() . '/page-' . $page . '/')
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
if($page === 1){
|
||||
if($page === 1) {
|
||||
preg_match('/page-(\d+)\/$/', $html->find('.pages li a', -2)->href, $matches);
|
||||
$lastpage = min($matches[1], ceil($max / 12));
|
||||
}
|
||||
|
||||
foreach($html->find('.items li img') as $element){
|
||||
foreach($html->find('.items li img') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = str_replace('www', 'wallpaper', self::URI)
|
||||
. '/'
|
||||
|
@ -70,7 +70,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('s')) && !is_null($this->getInput('r')) && !is_null($this->getInput('c'))){
|
||||
if(!is_null($this->getInput('s')) && !is_null($this->getInput('r')) && !is_null($this->getInput('c'))) {
|
||||
$subcategory = $this->getInput('s');
|
||||
$link = self::URI
|
||||
. $this->getInput('r')
|
||||
|
@ -86,7 +86,7 @@ class PickyWallpapersBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('s'))){
|
||||
if(!is_null($this->getInput('s'))) {
|
||||
$subcategory = $this->getInput('s');
|
||||
return 'PickyWallpapers - '
|
||||
. $this->getInput('c')
|
||||
|
|
|
@ -32,9 +32,9 @@ class PinterestBridge extends FeedExpander {
|
|||
);
|
||||
|
||||
public function collectData(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By username and board':
|
||||
if($this->getInput('r')){
|
||||
if($this->getInput('r')) {
|
||||
$html = getSimpleHTMLDOMCached($this->getURI());
|
||||
$this->getUserResults($html);
|
||||
} else {
|
||||
|
@ -55,7 +55,7 @@ class PinterestBridge extends FeedExpander {
|
|||
$fullname = $json['resourceDataCache'][0]['data']['owner']['full_name'];
|
||||
$avatar = $json['resourceDataCache'][0]['data']['owner']['image_small_url'];
|
||||
|
||||
foreach($results as $result){
|
||||
foreach($results as $result) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = $result['link'];
|
||||
|
@ -97,7 +97,7 @@ class PinterestBridge extends FeedExpander {
|
|||
$json = json_decode($html->find('#jsInit1', 0)->innertext, true);
|
||||
$results = $json['resourceDataCache'][0]['data']['results'];
|
||||
|
||||
foreach($results as $result){
|
||||
foreach($results as $result) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = self::URI . $result['board']['url'];
|
||||
|
@ -136,7 +136,7 @@ class PinterestBridge extends FeedExpander {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By username and board':
|
||||
$uri = self::URI . '/' . urlencode($this->getInput('u')) . '/' . urlencode($this->getInput('b'));// . '.rss';
|
||||
break;
|
||||
|
@ -149,7 +149,7 @@ class PinterestBridge extends FeedExpander {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By username and board':
|
||||
$specific = $this->getInput('u') . ' - ' . $this->getInput('b');
|
||||
break;
|
||||
|
|
|
@ -16,8 +16,8 @@ class PlanetLibreBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request PlanetLibre.');
|
||||
$limit = 0;
|
||||
foreach($html->find('div.post') as $element){
|
||||
if($limit < 5){
|
||||
foreach($html->find('div.post') as $element) {
|
||||
if($limit < 5) {
|
||||
$item = array();
|
||||
$item['title'] = $element->find('h1', 0)->plaintext;
|
||||
$item['uri'] = $element->find('a', 0)->href;
|
||||
|
|
|
@ -22,8 +22,8 @@ class RTBFBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('Could not request RTBF.');
|
||||
|
||||
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element){
|
||||
if($count >= $limit){
|
||||
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
|
||||
if($count >= $limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class RTBFBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
if(!is_null($this->getInput('c'))){
|
||||
if(!is_null($this->getInput('c'))) {
|
||||
return self::URI . 'emissions/detail?id=' . $this->getInput('c');
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class RTBFBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('c'))){
|
||||
if(!is_null($this->getInput('c'))) {
|
||||
return $this->getInput('c') .' - RTBF Bridge';
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class RainbowSixSiegeBridge extends BridgeAbstract {
|
|||
$json = $json['items'];
|
||||
|
||||
// Start at index 2 to remove highlighted articles
|
||||
for($i = 0; $i < count($json); $i++){
|
||||
for($i = 0; $i < count($json); $i++) {
|
||||
$jsonItem = $json[$i]['Content'];
|
||||
$article = str_get_html($jsonItem);
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ class ReadComicsBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
$keywordsList = explode(";", $this->getInput('q'));
|
||||
foreach($keywordsList as $keywords){
|
||||
foreach($keywordsList as $keywords) {
|
||||
$html = $this->getSimpleHTMLDOM(self::URI . 'comic/' . rawurlencode($keywords))
|
||||
or $this->returnServerError('Could not request readcomics.tv.');
|
||||
|
||||
foreach($html->find('li') as $element){
|
||||
foreach($html->find('li') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('a.ch-name', 0)->href;
|
||||
$item['id'] = $item['uri'];
|
||||
|
|
|
@ -10,7 +10,7 @@ class Releases3DSBridge extends BridgeAbstract {
|
|||
public function collectData(){
|
||||
|
||||
function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
@ -20,7 +20,7 @@ class Releases3DSBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
function typeToString($type){
|
||||
switch($type){
|
||||
switch($type) {
|
||||
case 1: return '3DS Game';
|
||||
case 4: return 'eShop';
|
||||
default: return '??? (' . $type . ')';
|
||||
|
@ -28,7 +28,7 @@ class Releases3DSBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
function cardToString($card){
|
||||
switch($card){
|
||||
switch($card) {
|
||||
case 1: return 'Regular (CARD1)';
|
||||
case 2: return 'NAND (CARD2)';
|
||||
default: return '??? (' . $card . ')';
|
||||
|
@ -40,17 +40,17 @@ class Releases3DSBridge extends BridgeAbstract {
|
|||
or returnServerError('Could not request 3dsdb: ' . $dataUrl);
|
||||
$limit = 0;
|
||||
|
||||
foreach(array_reverse(explode('<release>', $xml)) as $element){
|
||||
if($limit >= 5){
|
||||
foreach(array_reverse(explode('<release>', $xml)) as $element) {
|
||||
if($limit >= 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(strpos($element, '</release>') === false){
|
||||
if(strpos($element, '</release>') === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$releasename = extractFromDelimiters($element, '<releasename>', '</releasename>');
|
||||
if(empty($releasename)){
|
||||
if(empty($releasename)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ class Releases3DSBridge extends BridgeAbstract {
|
|||
$ignCoverArt = '';
|
||||
|
||||
$ignSearchUrl = 'http://www.ign.com/search?q=' . urlencode($name);
|
||||
if($ignResult = getSimpleHTMLDOM($ignSearchUrl)){
|
||||
if($ignResult = getSimpleHTMLDOM($ignSearchUrl)) {
|
||||
$ignCoverArt = $ignResult->find('div.search-item-media', 0)->find('img', 0)->src;
|
||||
$ignDesc = $ignResult->find('div.search-item-description', 0)->plaintext;
|
||||
$ignLink = $ignResult->find('div.search-item-sub-title', 0)->find('a', 1)->href;
|
||||
|
|
|
@ -9,7 +9,7 @@ class ReporterreBridge extends BridgeAbstract {
|
|||
private function extractContent($url){
|
||||
$html2 = getSimpleHTMLDOM($url);
|
||||
|
||||
foreach($html2->find('div[style=text-align:justify]') as $e){
|
||||
foreach($html2->find('div[style=text-align:justify]') as $e) {
|
||||
$text = $e->outertext;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ReporterreBridge extends BridgeAbstract {
|
|||
or returnServerError('Could not request Reporterre.');
|
||||
$limit = 0;
|
||||
|
||||
foreach($html->find('item') as $element){
|
||||
foreach($html->find('item') as $element) {
|
||||
if($limit < 5) {
|
||||
$item = array();
|
||||
$item['title'] = html_entity_decode($element->find('title', 0)->plaintext);
|
||||
|
|
|
@ -12,7 +12,7 @@ class ScmbBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request Se Coucher Moins Bete.');
|
||||
|
||||
foreach($html->find('article') as $article){
|
||||
foreach($html->find('article') as $article) {
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . $article->find('p.summary a', 0)->href;
|
||||
$item['title'] = $article->find('header h1 a', 0)->innertext;
|
||||
|
|
|
@ -21,7 +21,7 @@ class ScoopItBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($link)
|
||||
or returnServerError('Could not request ScoopIt. for : ' . $link);
|
||||
|
||||
foreach($html->find('div.post-view') as $element){
|
||||
foreach($html->find('div.post-view') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('a', 0)->href;
|
||||
$item['title'] = preg_replace(
|
||||
|
|
|
@ -36,10 +36,10 @@ class SensCritiqueBridge extends BridgeAbstract {
|
|||
|
||||
public function collectData(){
|
||||
$categories = array();
|
||||
foreach(self::PARAMETERS[$this->queriedContext] as $category => $properties){
|
||||
if($this->getInput($category)){
|
||||
foreach(self::PARAMETERS[$this->queriedContext] as $category => $properties) {
|
||||
if($this->getInput($category)) {
|
||||
$uri = self::URI;
|
||||
switch($category){
|
||||
switch($category) {
|
||||
case 'm': $uri .= 'films/cette-semaine';
|
||||
break;
|
||||
case 's': $uri .= 'series/actualite';
|
||||
|
@ -63,11 +63,11 @@ class SensCritiqueBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
private function extractDataFromList($list){
|
||||
if($list === null){
|
||||
if($list === null) {
|
||||
returnClientError('Cannot extract data from list');
|
||||
}
|
||||
|
||||
foreach($list->find('li') as $movie){
|
||||
foreach($list->find('li') as $movie) {
|
||||
$item = array();
|
||||
$item['author'] = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES)
|
||||
. ' '
|
||||
|
|
|
@ -24,11 +24,11 @@ class SexactuBridge extends BridgeAbstract {
|
|||
|
||||
$sexactu = $html->find('.container_sexactu', 0);
|
||||
$rowList = $sexactu->find('.row');
|
||||
foreach($rowList as $row){
|
||||
foreach($rowList as $row) {
|
||||
// only use first list as second one only contains pages numbers
|
||||
|
||||
$title = $row->find('.title', 0);
|
||||
if($title){
|
||||
if($title) {
|
||||
$item = array();
|
||||
$item['author'] = self::AUTHOR;
|
||||
$item['title'] = $title->plaintext;
|
||||
|
@ -36,9 +36,9 @@ class SexactuBridge extends BridgeAbstract {
|
|||
$uri = $title->$urlAttribute;
|
||||
if($uri === false)
|
||||
continue;
|
||||
if(substr($uri, 0, 1) === 'h'){ // absolute uri
|
||||
if(substr($uri, 0, 1) === 'h') { // absolute uri
|
||||
$item['uri'] = $uri;
|
||||
} else if(substr($uri, 0, 1) === '/'){ // domain relative url
|
||||
} else if(substr($uri, 0, 1) === '/') { // domain relative url
|
||||
$item['uri'] = self::URI . $uri;
|
||||
} else {
|
||||
$item['uri'] = $this->getURI() . $uri;
|
||||
|
@ -66,7 +66,7 @@ class SexactuBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOMCached($uri);
|
||||
|
||||
$content = $html->find('#article', 0);
|
||||
if($content){
|
||||
if($content) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class ShanaprojectBridge extends BridgeAbstract {
|
|||
if(!$animes)
|
||||
returnServerError('Could not find anime headers!');
|
||||
|
||||
foreach($animes as $anime){
|
||||
foreach($animes as $anime) {
|
||||
$item = array();
|
||||
$item['title'] = $this->extractAnimeTitle($anime);
|
||||
$item['author'] = $this->extractAnimeAuthor($anime);
|
||||
|
|
|
@ -32,7 +32,7 @@ class SoundCloudBridge extends BridgeAbstract {
|
|||
. self::CLIENT_ID
|
||||
)) or returnServerError('No results for this user');
|
||||
|
||||
for($i = 0; $i < 10; $i++){
|
||||
for($i = 0; $i < 10; $i++) {
|
||||
$item = array();
|
||||
$item['author'] = $tracks[$i]->user->username . ' - ' . $tracks[$i]->title;
|
||||
$item['title'] = $tracks[$i]->user->username . ' - ' . $tracks[$i]->title;
|
||||
|
@ -55,7 +55,7 @@ class SoundCloudBridge extends BridgeAbstract {
|
|||
|
||||
}
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return self::NAME . ' - ' . $this->getInput('u');
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class StripeAPIChangeLogBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('No results for Stripe API Changelog');
|
||||
|
||||
foreach($html->find('h3') as $change){
|
||||
foreach($html->find('h3') as $change) {
|
||||
$item = array();
|
||||
$item['title'] = trim($change->plaintext);
|
||||
$item['uri'] = self::URI . '#' . $item['title'];
|
||||
|
|
|
@ -38,12 +38,12 @@ class SuperbWallpapersBridge extends BridgeAbstract {
|
|||
|
||||
$lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max / 36));
|
||||
|
||||
for($page = 1; $page <= $lastpage; $page++){
|
||||
for($page = 1; $page <= $lastpage; $page++) {
|
||||
$link = self::URI . '/' . $category . '/' . $page . '.html';
|
||||
$html = getSimpleHTMLDOM($link)
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
foreach($html->find('.wpl .i a') as $element){
|
||||
foreach($html->find('.wpl .i a') as $element) {
|
||||
$thumbnail = $element->find('img', 0);
|
||||
|
||||
$item = array();
|
||||
|
@ -61,7 +61,7 @@ class SuperbWallpapersBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('c')) && !is_null($this->getInput('r'))){
|
||||
if(!is_null($this->getInput('c')) && !is_null($this->getInput('r'))) {
|
||||
return self::NAME . '- ' . $this->getInput('c') . ' [' . $this->getInput('r') . ']';
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class T411Bridge extends BridgeAbstract {
|
|||
|
||||
//Utility function for retrieving text based on start and end delimiters
|
||||
function extractFromDelimiters($string, $start, $end){
|
||||
if(strpos($string, $start) !== false){
|
||||
if(strpos($string, $start) !== false) {
|
||||
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
|
||||
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
|
||||
return $section_retrieved;
|
||||
|
@ -42,13 +42,13 @@ class T411Bridge extends BridgeAbstract {
|
|||
$limit = 0;
|
||||
|
||||
//Process each item individually
|
||||
foreach($results->find('tr') as $element){
|
||||
foreach($results->find('tr') as $element) {
|
||||
|
||||
//Limit total amount of requests and ignore table header
|
||||
if($limit >= 10){
|
||||
if($limit >= 10) {
|
||||
break;
|
||||
}
|
||||
if(is_object($element->find('th', 0))){
|
||||
if(is_object($element->find('th', 0))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class T411Bridge extends BridgeAbstract {
|
|||
|
||||
//Retrieve full description from torrent page
|
||||
$item_html = getSimpleHTMLDOM($item_uri);
|
||||
if(!$item_html){
|
||||
if(!$item_html) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ class TagBoardBridge extends BridgeAbstract {
|
|||
or returnServerError('Could not request TagBoard for : ' . $link);
|
||||
$parsed_json = json_decode($html);
|
||||
|
||||
foreach($parsed_json->{'posts'} as $element){
|
||||
foreach($parsed_json->{'posts'} as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->{'permalink'};
|
||||
$item['title'] = $element->{'text'};
|
||||
$thumbnailUri = $element->{'photos'}[0]->{'m'};
|
||||
if(isset($thumbnailUri)){
|
||||
if(isset($thumbnailUri)) {
|
||||
$item['content'] = '<a href="'
|
||||
. $item['uri']
|
||||
. '"><img src="'
|
||||
|
@ -40,7 +40,7 @@ class TagBoardBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('u'))){
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
return 'tagboard - ' . $this->getInput('u');
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class TheCodingLoveBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM(self::URI)
|
||||
or returnServerError('Could not request The Coding Love.');
|
||||
|
||||
foreach($html->find('div.post') as $element){
|
||||
foreach($html->find('div.post') as $element) {
|
||||
$item = array();
|
||||
$temp = $element->find('h3 a', 0);
|
||||
|
||||
|
@ -22,7 +22,7 @@ class TheCodingLoveBridge extends BridgeAbstract {
|
|||
|
||||
// retrieve .gif instead of static .jpg
|
||||
$images = $temp->find('p.e img');
|
||||
foreach($images as $image){
|
||||
foreach($images as $image) {
|
||||
$img_src = str_replace('.jpg', '.gif', $image->src);
|
||||
$image->src = $img_src;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class TheCodingLoveBridge extends BridgeAbstract {
|
|||
$auteur = $temp->find('i', 0);
|
||||
$pos = strpos($auteur->innertext, 'by');
|
||||
|
||||
if($pos > 0){
|
||||
if($pos > 0) {
|
||||
$auteur = trim(str_replace('*/', '', substr($auteur->innertext, ($pos + 2))));
|
||||
$item['author'] = $auteur;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ class TheHackerNewsBridge extends BridgeAbstract {
|
|||
public function collectData(){
|
||||
|
||||
function stripWithDelimiters($string, $start, $end){
|
||||
while(strpos($string, $start) !== false){
|
||||
while(strpos($string, $start) !== false) {
|
||||
$section_to_remove = substr($string, strpos($string, $start));
|
||||
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
|
||||
$string = str_replace($section_to_remove, '', $string);
|
||||
|
@ -22,8 +22,8 @@ class TheHackerNewsBridge extends BridgeAbstract {
|
|||
$open_tag = '<' . $tag_name;
|
||||
$close_tag = '</' . $tag_name . '>';
|
||||
$close_tag_length = strlen($close_tag);
|
||||
if(strpos($tag_start, $open_tag) === 0){
|
||||
while(strpos($string, $tag_start) !== false){
|
||||
if(strpos($tag_start, $open_tag) === 0) {
|
||||
while(strpos($string, $tag_start) !== false) {
|
||||
$max_recursion = 100;
|
||||
$section_to_remove = null;
|
||||
$section_start = strpos($string, $tag_start);
|
||||
|
@ -51,8 +51,8 @@ class TheHackerNewsBridge extends BridgeAbstract {
|
|||
or returnServerError('Could not request TheHackerNews: ' . $this->getURI());
|
||||
$limit = 0;
|
||||
|
||||
foreach($html->find('article') as $element){
|
||||
if($limit < 5){
|
||||
foreach($html->find('article') as $element) {
|
||||
if($limit < 5) {
|
||||
|
||||
$article_url = $element->find('a.entry-title', 0)->href;
|
||||
$article_author = trim($element->find('span.vcard', 0)->plaintext);
|
||||
|
|
|
@ -45,7 +45,7 @@ class ThePirateBayBridge extends BridgeAbstract {
|
|||
$guessedDate = explode('Uploaded ', $guessedDate)[1];
|
||||
$guessedDate = explode(',', $guessedDate)[0];
|
||||
|
||||
if(count(explode(':', $guessedDate)) == 1){
|
||||
if(count(explode(':', $guessedDate)) == 1) {
|
||||
$guessedDate = strptime($guessedDate, '%m-%d %Y');
|
||||
$timestamp = mktime(
|
||||
0,
|
||||
|
@ -55,7 +55,7 @@ class ThePirateBayBridge extends BridgeAbstract {
|
|||
$guessedDate['tm_mday'],
|
||||
1900 + $guessedDate['tm_year']
|
||||
);
|
||||
} elseif(explode(' ', $guessedDate)[0] == 'Today'){
|
||||
} elseif(explode(' ', $guessedDate)[0] == 'Today') {
|
||||
$guessedDate = strptime(
|
||||
explode(' ', $guessedDate)[1], '%H:%M'
|
||||
);
|
||||
|
@ -68,7 +68,7 @@ class ThePirateBayBridge extends BridgeAbstract {
|
|||
date('d'),
|
||||
date('Y')
|
||||
);
|
||||
} elseif(explode(' ', $guessedDate)[0] == 'Y-day'){
|
||||
} elseif(explode(' ', $guessedDate)[0] == 'Y-day') {
|
||||
$guessedDate = strptime(
|
||||
explode(' ', $guessedDate)[1], '%H:%M'
|
||||
);
|
||||
|
@ -95,17 +95,17 @@ class ThePirateBayBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
$catBool = $this->getInput('cat_check');
|
||||
if($catBool){
|
||||
if($catBool) {
|
||||
$catNum = $this->getInput('cat');
|
||||
}
|
||||
$critList = $this->getInput('crit');
|
||||
|
||||
$trustedBool = $this->getInput('trusted');
|
||||
$keywordsList = explode(';', $this->getInput('q'));
|
||||
foreach($keywordsList as $keywords){
|
||||
switch($critList){
|
||||
foreach($keywordsList as $keywords) {
|
||||
switch($critList) {
|
||||
case 'search':
|
||||
if($catBool == false){
|
||||
if($catBool == false) {
|
||||
$html = getSimpleHTMLDOM(
|
||||
self::URI .
|
||||
'search/' .
|
||||
|
@ -143,11 +143,11 @@ class ThePirateBayBridge extends BridgeAbstract {
|
|||
if ($html->find('table#searchResult', 0) == false)
|
||||
returnServerError('No result for query ' . $keywords);
|
||||
|
||||
foreach($html->find('tr') as $element){
|
||||
foreach($html->find('tr') as $element) {
|
||||
|
||||
if(!$trustedBool
|
||||
|| !is_null($element->find('img[alt=VIP]', 0))
|
||||
|| !is_null($element->find('img[alt=Trusted]', 0))){
|
||||
|| !is_null($element->find('img[alt=Trusted]', 0))) {
|
||||
$item = array();
|
||||
$item['uri'] = $element->find('a', 3)->href;
|
||||
$item['id'] = self::URI . $element->find('a.detLink', 0)->href;
|
||||
|
|
|
@ -55,7 +55,7 @@ class TheTVDBBridge extends BridgeAbstract {
|
|||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$token_json = (array)json_decode($result);
|
||||
if(isset($token_json['Error'])){
|
||||
if(isset($token_json['Error'])) {
|
||||
throw new Exception($token_json['Error']);
|
||||
die;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class TheTVDBBridge extends BridgeAbstract {
|
|||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$result_array = (array)json_decode($result);
|
||||
if(isset($result_array['Error'])){
|
||||
if(isset($result_array['Error'])) {
|
||||
throw new Exception($result_array['Error']);
|
||||
die;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class TheTVDBBridge extends BridgeAbstract {
|
|||
//than 100 episodes in every season
|
||||
$episodes = (array)$episodes['data'];
|
||||
$episodes = array_slice($episodes, -$nbepisodemin, $nbepisodemin);
|
||||
foreach($episodes as $episode){
|
||||
foreach($episodes as $episode) {
|
||||
$episodedata = array();
|
||||
$episodedata['uri'] = $this->getURI()
|
||||
. '?tab=episode&seriesid='
|
||||
|
@ -129,7 +129,7 @@ class TheTVDBBridge extends BridgeAbstract {
|
|||
. $episode->id;
|
||||
|
||||
// check if the absoluteNumber exist
|
||||
if(isset($episode->absoluteNumber)){
|
||||
if(isset($episode->absoluteNumber)) {
|
||||
$episodedata['title'] = 'S'
|
||||
. $episode->airedSeason
|
||||
. 'E'
|
||||
|
@ -166,7 +166,7 @@ class TheTVDBBridge extends BridgeAbstract {
|
|||
$maxseason = $this->getLatestSeasonNumber($token, $serie_id);
|
||||
$seriename = $this->getSerieName($token, $serie_id);
|
||||
$season = $maxseason;
|
||||
while(sizeof($episodelist) < $nbepisode && $season >= 1){
|
||||
while(sizeof($episodelist) < $nbepisode && $season >= 1) {
|
||||
$nbepisodetmp = $nbepisode - sizeof($episodelist);
|
||||
$this->getSeasonEpisodes(
|
||||
$token,
|
||||
|
@ -189,7 +189,7 @@ class TheTVDBBridge extends BridgeAbstract {
|
|||
$episodelist,
|
||||
$nbepisode
|
||||
);
|
||||
} catch(Exception $e){
|
||||
} catch(Exception $e) {
|
||||
unset($e);
|
||||
}
|
||||
// sort and keep the 10 last episodes, works bad with the netflix serie
|
||||
|
|
|
@ -36,7 +36,7 @@ class Torrent9Bridge extends BridgeAbstract {
|
|||
|
||||
public function collectData(){
|
||||
|
||||
if($this->queriedContext === 'From search'){
|
||||
if($this->queriedContext === 'From search') {
|
||||
$request = str_replace(' ', '-', trim($this->getInput('q')));
|
||||
$page = self::URI . '/search_torrent/' . urlencode($request) . '.html';
|
||||
} else {
|
||||
|
@ -47,8 +47,8 @@ class Torrent9Bridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($page)
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
foreach($html->find('table', 0)->find('tr') as $episode){
|
||||
if($episode->parent->tag == 'tbody'){
|
||||
foreach($html->find('table', 0)->find('tr') as $episode) {
|
||||
if($episode->parent->tag == 'tbody') {
|
||||
|
||||
$urlepisode = self::URI . $episode->find('a', 0)->getAttribute('href');
|
||||
|
||||
|
@ -62,11 +62,11 @@ class Torrent9Bridge extends BridgeAbstract {
|
|||
$item['pubdate'] = $this->getCachedDate($urlepisode);
|
||||
|
||||
$textefiche = $htmlepisode->find('.movie-information', 0)->find('p', 1);
|
||||
if(isset($textefiche)){
|
||||
if(isset($textefiche)) {
|
||||
$item['content'] = $textefiche->text();
|
||||
} else {
|
||||
$p = $htmlepisode->find('.movie-information', 0)->find('p');
|
||||
if(!empty($p)){
|
||||
if(!empty($p)) {
|
||||
$item['content'] = $htmlepisode->find('.movie-information', 0)->find('p', 0)->text();
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Torrent9Bridge extends BridgeAbstract {
|
|||
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('q'))){
|
||||
if(!is_null($this->getInput('q'))) {
|
||||
return $this->getInput('q') . ' : ' . self::NAME;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class TwitterBridge extends BridgeAbstract {
|
|||
);
|
||||
|
||||
public function getName(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By keyword or hashtag':
|
||||
$specific = 'search ';
|
||||
$param = 'q';
|
||||
|
@ -63,7 +63,7 @@ class TwitterBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
switch($this->queriedContext){
|
||||
switch($this->queriedContext) {
|
||||
case 'By keyword or hashtag':
|
||||
return self::URI
|
||||
. 'search?q='
|
||||
|
@ -82,8 +82,8 @@ class TwitterBridge extends BridgeAbstract {
|
|||
$html = '';
|
||||
|
||||
$html = getSimpleHTMLDOM($this->getURI());
|
||||
if(!$html){
|
||||
switch($this->queriedContext){
|
||||
if(!$html) {
|
||||
switch($this->queriedContext) {
|
||||
case 'By keyword or hashtag':
|
||||
returnServerError('No results for this query.');
|
||||
case 'By username':
|
||||
|
@ -93,16 +93,16 @@ class TwitterBridge extends BridgeAbstract {
|
|||
|
||||
$hidePictures = $this->getInput('nopic');
|
||||
|
||||
foreach($html->find('div.js-stream-tweet') as $tweet){
|
||||
foreach($html->find('div.js-stream-tweet') as $tweet) {
|
||||
|
||||
// Skip retweets?
|
||||
if($this->getInput('noretweet')
|
||||
&& $tweet->getAttribute('data-screen-name') !== $this->getInput('u')){
|
||||
&& $tweet->getAttribute('data-screen-name') !== $this->getInput('u')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// remove 'invisible' content
|
||||
foreach($tweet->find('.invisible') as $invisible){
|
||||
foreach($tweet->find('.invisible') as $invisible) {
|
||||
$invisible->outertext = '';
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ class TwitterBridge extends BridgeAbstract {
|
|||
|
||||
// Add picture to content
|
||||
$picture_html = '';
|
||||
if(!$hidePictures){
|
||||
if(!$hidePictures) {
|
||||
$picture_html = <<<EOD
|
||||
<a href="https://twitter.com/{$item['username']}">
|
||||
<img
|
||||
|
@ -154,7 +154,7 @@ EOD;
|
|||
// Add embeded image to content
|
||||
$image_html = '';
|
||||
$image = $this->getImageURI($tweet);
|
||||
if(!$this->getInput('noimg') && !is_null($image)){
|
||||
if(!$this->getInput('noimg') && !is_null($image)) {
|
||||
// add enclosures
|
||||
$item['enclosures'] = array($image . ':orig');
|
||||
|
||||
|
@ -182,7 +182,7 @@ EOD;
|
|||
|
||||
// add quoted tweet
|
||||
$quotedTweet = $tweet->find('div.QuoteTweet', 0);
|
||||
if($quotedTweet){
|
||||
if($quotedTweet) {
|
||||
// get tweet text
|
||||
$cleanedQuotedTweet = str_replace(
|
||||
'href="/',
|
||||
|
@ -196,7 +196,7 @@ EOD;
|
|||
// Add embeded image to content
|
||||
$quotedImage_html = '';
|
||||
$quotedImage = $this->getQuotedImageURI($tweet);
|
||||
if(!$this->getInput('noimg') && !is_null($quotedImage)){
|
||||
if(!$this->getInput('noimg') && !is_null($quotedImage)) {
|
||||
// add enclosures
|
||||
$item['enclosures'] = array($quotedImage . ':orig');
|
||||
|
||||
|
@ -228,15 +228,15 @@ EOD;
|
|||
|
||||
private function processEmojis($tweet){
|
||||
// process emojis (reduce size)
|
||||
foreach($tweet->find('img.Emoji') as $img){
|
||||
foreach($tweet->find('img.Emoji') as $img) {
|
||||
$img->style .= ' height: 1em;';
|
||||
}
|
||||
}
|
||||
|
||||
private function processContentLinks($tweet){
|
||||
// processing content links
|
||||
foreach($tweet->find('a') as $link){
|
||||
if($link->hasAttribute('data-expanded-url')){
|
||||
foreach($tweet->find('a') as $link) {
|
||||
if($link->hasAttribute('data-expanded-url')) {
|
||||
$link->href = $link->getAttribute('data-expanded-url');
|
||||
}
|
||||
$link->removeAttribute('data-expanded-url');
|
||||
|
@ -260,7 +260,7 @@ EOD;
|
|||
private function getImageURI($tweet){
|
||||
// Find media in tweet
|
||||
$container = $tweet->find('div.AdaptiveMedia-container', 0);
|
||||
if($container && $container->find('img', 0)){
|
||||
if($container && $container->find('img', 0)) {
|
||||
return $container->find('img', 0)->src;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ EOD;
|
|||
private function getQuotedImageURI($tweet){
|
||||
// Find media in tweet
|
||||
$container = $tweet->find('div.QuoteMedia-container', 0);
|
||||
if($container && $container->find('img', 0)){
|
||||
if($container && $container->find('img', 0)) {
|
||||
return $container->find('img', 0)->src;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ class UnsplashBridge extends BridgeAbstract {
|
|||
$quality = $this->getInput('q');
|
||||
$lastpage = 1;
|
||||
|
||||
for($page = 1; $page <= $lastpage; $page++){
|
||||
for($page = 1; $page <= $lastpage; $page++) {
|
||||
$link = self::URI . '/grid?page=' . $page;
|
||||
$html = getSimpleHTMLDOM($link)
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
if($page === 1){
|
||||
if($page === 1) {
|
||||
preg_match(
|
||||
'/=(\d+)$/',
|
||||
$html->find('.pagination > a[!class]', -1)->href,
|
||||
|
@ -47,7 +47,7 @@ class UnsplashBridge extends BridgeAbstract {
|
|||
$lastpage = min($matches[1], ceil($max / 40));
|
||||
}
|
||||
|
||||
foreach($html->find('.photo') as $element){
|
||||
foreach($html->find('.photo') as $element) {
|
||||
$thumbnail = $element->find('img', 0);
|
||||
$thumbnail->src = str_replace('https://', 'http://', $thumbnail->src);
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ class UsbekEtRicaBridge extends BridgeAbstract {
|
|||
|
||||
$articles = $html->find('div.details');
|
||||
|
||||
foreach($articles as $article){
|
||||
foreach($articles as $article) {
|
||||
$item = array();
|
||||
|
||||
$title = $article->find('div.card-title', 0);
|
||||
if($title){
|
||||
if($title) {
|
||||
$item['title'] = $title->plaintext;
|
||||
} else {
|
||||
// Sometimes we get rubbish, ignore.
|
||||
|
@ -43,32 +43,32 @@ class UsbekEtRicaBridge extends BridgeAbstract {
|
|||
}
|
||||
|
||||
$author = $article->find('div.author span', 0);
|
||||
if($author){
|
||||
if($author) {
|
||||
$item['author'] = $author->plaintext;
|
||||
}
|
||||
|
||||
$uri = $article->find('a.read', 0)->href;
|
||||
if(substr($uri, 0, 1) === 'h'){ // absolute uri
|
||||
if(substr($uri, 0, 1) === 'h') { // absolute uri
|
||||
$item['uri'] = $uri;
|
||||
} else { // relative uri
|
||||
$item['uri'] = $this->getURI() . $uri;
|
||||
}
|
||||
|
||||
if($fullarticle){
|
||||
if($fullarticle) {
|
||||
$content = $this->loadFullArticle($item['uri']);
|
||||
}
|
||||
|
||||
if($fullarticle && !is_null($content)){
|
||||
if($fullarticle && !is_null($content)) {
|
||||
$item['content'] = $content;
|
||||
} else {
|
||||
$excerpt = $article->find('div.card-excerpt', 0);
|
||||
if($excerpt){
|
||||
if($excerpt) {
|
||||
$item['content'] = $excerpt->plaintext;
|
||||
}
|
||||
}
|
||||
|
||||
$image = $article->find('div.card-img img', 0);
|
||||
if($image){
|
||||
if($image) {
|
||||
$item['enclosures'] = array(
|
||||
$image->src
|
||||
);
|
||||
|
@ -76,7 +76,7 @@ class UsbekEtRicaBridge extends BridgeAbstract {
|
|||
|
||||
$this->items[] = $item;
|
||||
|
||||
if($limit > 0 && count($this->items) >= $limit){
|
||||
if($limit > 0 && count($this->items) >= $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class UsbekEtRicaBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOMCached($uri);
|
||||
|
||||
$content = $html->find('section.main', 0);
|
||||
if($content){
|
||||
if($content) {
|
||||
return $this->replaceUriInHtmlElement($content);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ class ViadeoCompanyBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($link)
|
||||
or returnServerError('Could not request Viadeo.');
|
||||
|
||||
foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element){
|
||||
foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
|
||||
$title = $element->find('p', 0)->innertext;
|
||||
if($title){
|
||||
if($title) {
|
||||
$item = array();
|
||||
$item['uri'] = $link;
|
||||
$item['title'] = mb_substr($element->find('p', 0)->innertext, 0, 100);
|
||||
|
|
|
@ -20,7 +20,7 @@ class VineBridge extends BridgeAbstract {
|
|||
$html = getSimpleHTMLDOM($uri)
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
foreach($html->find('.post') as $element){
|
||||
foreach($html->find('.post') as $element) {
|
||||
$a = $element->find('a', 0);
|
||||
$a->href = str_replace('https://', 'http://', $a->href);
|
||||
$time = strtotime(ltrim($element->find('p', 0)->plaintext, ' Uploaded at '));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue