mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-28 22:28:51 +03:00
[.travis] Fix several phpcs and phpunit errors (#1799)
This commit is contained in:
parent
64ec488f70
commit
645a8f62c6
14 changed files with 41 additions and 47 deletions
|
@ -10,13 +10,7 @@ class AlbionOnlineBridge extends BridgeAbstract {
|
||||||
const PARAMETERS = array( array(
|
const PARAMETERS = array( array(
|
||||||
'postcount' => array(
|
'postcount' => array(
|
||||||
'name' => 'Limit',
|
'name' => 'Limit',
|
||||||
'type' => 'list',
|
'type' => 'number',
|
||||||
'values' => array(
|
|
||||||
'2' => 2,
|
|
||||||
'5' => 5,
|
|
||||||
'10' => 10,
|
|
||||||
'15' => 15,
|
|
||||||
),
|
|
||||||
'title' => 'Maximum number of items to return',
|
'title' => 'Maximum number of items to return',
|
||||||
'defaultValue' => 5,
|
'defaultValue' => 5,
|
||||||
),
|
),
|
||||||
|
|
|
@ -74,8 +74,8 @@ class CeskaTelevizeBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUri() {
|
public function getURI() {
|
||||||
return isset($this->feedUri) ? $this->feedUri : parent::getUri();
|
return isset($this->feedUri) ? $this->feedUri : parent::getURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
|
|
|
@ -42,6 +42,7 @@ class DiarioDeNoticiasBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI() {
|
public function getURI() {
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'Tag':
|
case 'Tag':
|
||||||
|
|
|
@ -94,6 +94,6 @@ favicon-63b2904a073c89b52b19aa08cebc16a154bcf83fee8ecc6439968b1e6db569c7.ico';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFullSizeImagePath($preview_path){
|
private function getFullSizeImagePath($preview_path){
|
||||||
return explode("?compress=1", $preview_path)[0];
|
return explode('?compress=1', $preview_path)[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,7 @@ class EpicgamesBridge extends BridgeAbstract {
|
||||||
const PARAMETERS = array( array(
|
const PARAMETERS = array( array(
|
||||||
'postcount' => array(
|
'postcount' => array(
|
||||||
'name' => 'Limit',
|
'name' => 'Limit',
|
||||||
'type' => 'list',
|
'type' => 'number',
|
||||||
'values' => array(
|
|
||||||
'5' => 5,
|
|
||||||
'10' => 10,
|
|
||||||
'15' => 15,
|
|
||||||
'20' => 20,
|
|
||||||
'25' => 25,
|
|
||||||
),
|
|
||||||
'title' => 'Maximum number of items to return',
|
'title' => 'Maximum number of items to return',
|
||||||
'defaultValue' => 10,
|
'defaultValue' => 10,
|
||||||
),
|
),
|
||||||
|
|
|
@ -28,9 +28,9 @@ class FM4Bridge extends BridgeAbstract
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
public function getPageData($tag, $page) {
|
private function getPageData($tag, $page) {
|
||||||
if($tag)
|
if($tag)
|
||||||
$uri = self::URI . "/tags/" . $tag;
|
$uri = self::URI . '/tags/' . $tag;
|
||||||
else
|
else
|
||||||
$uri = self::URI;
|
$uri = self::URI;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class FM4Bridge extends BridgeAbstract
|
||||||
$item['uri'] = $article->find('a', 0)->href;
|
$item['uri'] = $article->find('a', 0)->href;
|
||||||
$item['title'] = $article->find('h2', 0)->plaintext;
|
$item['title'] = $article->find('h2', 0)->plaintext;
|
||||||
$item['author'] = $article->find('p[class*=keyword]', 0)->plaintext;
|
$item['author'] = $article->find('p[class*=keyword]', 0)->plaintext;
|
||||||
$item["timestamp"] = strtotime($article->find('p[class*=time]', 0)->plaintext);
|
$item['timestamp'] = strtotime($article->find('p[class*=time]', 0)->plaintext);
|
||||||
|
|
||||||
if ($this->getInput('loadcontent')) {
|
if ($this->getInput('loadcontent')) {
|
||||||
$item['content'] = getSimpleHTMLDOM($item['uri'])->find('div[class=storyText]', 0)->innertext
|
$item['content'] = getSimpleHTMLDOM($item['uri'])->find('div[class=storyText]', 0)->innertext
|
||||||
|
@ -58,9 +58,10 @@ class FM4Bridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
return $page_items;
|
return $page_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData() {
|
public function collectData() {
|
||||||
for ($cur_page = 1; $cur_page <= $this->getInput('pages'); $cur_page++) {
|
for ($cur_page = 1; $cur_page <= $this->getInput('pages'); $cur_page++) {
|
||||||
$this->items = array_merge($this->items,$this->getPageData($this->getInput('tag'), $cur_page));
|
$this->items = array_merge($this->items, $this->getPageData($this->getInput('tag'), $cur_page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FicbookBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$html = defaultLinkTo($html, self::URI);
|
$html = defaultLinkTo($html, self::URI);
|
||||||
|
|
||||||
if ($this->queriedContext == 'Fiction Updates' or $this->queriedContext == 'Fiction Comments' ) {
|
if ($this->queriedContext == 'Fiction Updates' or $this->queriedContext == 'Fiction Comments') {
|
||||||
$this->titleName = $html->find('.fanfic-main-info > h1', 0)->innertext;
|
$this->titleName = $html->find('.fanfic-main-info > h1', 0)->innertext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,8 @@ class MarktplaatsBridge extends BridgeAbstract {
|
||||||
$item['content'] .= "<br />\n<br />\n<br />\n" . json_encode($listing);
|
$item['content'] .= "<br />\n<br />\n<br />\n" . json_encode($listing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents/100;
|
$item['content'] .= "<br>\n<br>\nPrice: " . $listing->priceInfo->priceCents / 100;
|
||||||
$item['content'] .= " (" . $listing->priceInfo->priceType .")";
|
$item['content'] .= ' (' . $listing->priceInfo->priceType . ')';
|
||||||
if(!empty($listing->location->cityName)) {
|
if(!empty($listing->location->cityName)) {
|
||||||
$item['content'] .= "<br><br>\n" . $listing->location->cityName;
|
$item['content'] .= "<br><br>\n" . $listing->location->cityName;
|
||||||
}
|
}
|
||||||
|
@ -117,11 +117,11 @@ class MarktplaatsBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
if(!is_null($this->getInput('q'))) {
|
if(!is_null($this->getInput('q'))) {
|
||||||
return $this->getInput('q') . ' - Marktplaats';
|
return $this->getInput('q') . ' - Marktplaats';
|
||||||
}
|
}
|
||||||
return parent::getName();
|
return parent::getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ class MondeDiploBridge extends BridgeAbstract {
|
||||||
const CACHE_TIMEOUT = 21600; //6h
|
const CACHE_TIMEOUT = 21600; //6h
|
||||||
const DESCRIPTION = 'Returns most recent results from MondeDiplo.';
|
const DESCRIPTION = 'Returns most recent results from MondeDiplo.';
|
||||||
|
|
||||||
private function cleanText($text) {
|
private function cleanText($text) {
|
||||||
return trim(str_replace([' ', ' '], ' ', $text));
|
return trim(str_replace(array(' ', ' '), ' ', $text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = getSimpleHTMLDOM(self::URI)
|
$html = getSimpleHTMLDOM(self::URI)
|
||||||
|
@ -22,7 +22,7 @@ class MondeDiploBridge extends BridgeAbstract {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = self::URI . $element->href;
|
$item['uri'] = self::URI . $element->href;
|
||||||
$item['title'] = $this->cleanText($title) . ' - ' . $this->cleanText($datesAuteurs);
|
$item['title'] = $this->cleanText($title) . ' - ' . $this->cleanText($datesAuteurs);
|
||||||
$item['content'] = $this->cleanText(str_replace([$title, $datesAuteurs], '', $element->plaintext));
|
$item['content'] = $this->cleanText(str_replace(array($title, $datesAuteurs), '', $element->plaintext));
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class NasaApodBridge extends BridgeAbstract {
|
||||||
$picture_html_string = $picture_html->innertext;
|
$picture_html_string = $picture_html->innertext;
|
||||||
|
|
||||||
//Extract image and explanation
|
//Extract image and explanation
|
||||||
$image_wrapper = $picture_html->find('a',1);
|
$image_wrapper = $picture_html->find('a', 1);
|
||||||
$image_path = $image_wrapper->href;
|
$image_path = $image_wrapper->href;
|
||||||
$img_placeholder = $image_wrapper->find('img', 0);
|
$img_placeholder = $image_wrapper->find('img', 0);
|
||||||
$img_alt = $img_placeholder->alt;
|
$img_alt = $img_placeholder->alt;
|
||||||
|
|
|
@ -48,11 +48,16 @@ class NordbayernBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
private function getImageUrlFromScript($script) {
|
private function getImageUrlFromScript($script) {
|
||||||
preg_match("#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9%_]*\\.(jpg|JPG))#", $script->innertext, $matches, PREG_OFFSET_CAPTURE);
|
preg_match(
|
||||||
|
"#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9%_]*\\.(jpg|JPG))#",
|
||||||
|
$script->innertext,
|
||||||
|
$matches,
|
||||||
|
PREG_OFFSET_CAPTURE
|
||||||
|
);
|
||||||
if(isset($matches[1][0])) {
|
if(isset($matches[1][0])) {
|
||||||
return stripcslashes($matches[1][0]) . '?w=800';
|
return stripcslashes($matches[1][0]) . '?w=800';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handleArticle($link) {
|
private function handleArticle($link) {
|
||||||
|
|
|
@ -11,13 +11,11 @@ class OtrkeyFinderBridge extends BridgeAbstract {
|
||||||
'searchterm' => array(
|
'searchterm' => array(
|
||||||
'name' => 'Search term',
|
'name' => 'Search term',
|
||||||
'exampleValue' => 'Terminator',
|
'exampleValue' => 'Terminator',
|
||||||
'defaultValue' => '',
|
|
||||||
'title' => 'The search term is case-insensitive',
|
'title' => 'The search term is case-insensitive',
|
||||||
),
|
),
|
||||||
'station' => array(
|
'station' => array(
|
||||||
'name' => 'Station name',
|
'name' => 'Station name',
|
||||||
'exampleValue' => 'ARD',
|
'exampleValue' => 'ARD',
|
||||||
'defaultValue' => '',
|
|
||||||
),
|
),
|
||||||
'type' => array(
|
'type' => array(
|
||||||
'name' => 'Media type',
|
'name' => 'Media type',
|
||||||
|
@ -143,7 +141,11 @@ class OtrkeyFinderBridge extends BridgeAbstract {
|
||||||
$item['content'] = $content;
|
$item['content'] = $content;
|
||||||
|
|
||||||
if (preg_match(self::TIME_REGEX, $file, $matches) === 1) {
|
if (preg_match(self::TIME_REGEX, $file, $matches) === 1) {
|
||||||
$item['timestamp'] = DateTime::createFromFormat('y.m.d_H-i', $matches[0], new DateTimeZone('Europe/Berlin'))->getTimestamp();
|
$item['timestamp'] = DateTime::createFromFormat(
|
||||||
|
'y.m.d_H-i',
|
||||||
|
$matches[0],
|
||||||
|
new DateTimeZone('Europe/Berlin')
|
||||||
|
)->getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// This bridge depends on Releases3DSBridge
|
// This bridge depends on Releases3DSBridge
|
||||||
if (!class_exists('Releases3DSBridge')){
|
if (!class_exists('Releases3DSBridge')) {
|
||||||
include('Releases3DSBridge.php');
|
include('Releases3DSBridge.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
class WorldCosplayBridge extends BridgeAbstract {
|
class WorldCosplayBridge extends BridgeAbstract {
|
||||||
const NAME = 'WorldCosplay Bridge';
|
const NAME = 'WorldCosplay Bridge';
|
||||||
const URI = 'https://worldcosplay.net/';
|
const URI = 'https://worldcosplay.net/';
|
||||||
const DESCRIPTION ='Returns WorldCosplay photos';
|
const DESCRIPTION = 'Returns WorldCosplay photos';
|
||||||
const MAINTAINER = 'AxorPL';
|
const MAINTAINER = 'AxorPL';
|
||||||
|
|
||||||
const API_CHARACTER = 'api/photo/list.json?character_id=%u&limit=%u';
|
const API_CHARACTER = 'api/photo/list.json?character_id=%u&limit=%u';
|
||||||
|
@ -95,14 +95,12 @@ class WorldCosplayBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$json = json_decode(getContents($url))
|
$json = json_decode(getContents($url))
|
||||||
or returnServerError(sprintf(self::ERR_QUERY, $url));
|
or returnServerError(sprintf(self::ERR_QUERY, $url));
|
||||||
if($json->has_error)
|
if($json->has_error) {
|
||||||
{
|
|
||||||
returnServerError($json->message);
|
returnServerError($json->message);
|
||||||
}
|
}
|
||||||
$list = $json->list;
|
$list = $json->list;
|
||||||
|
|
||||||
foreach($list as $img)
|
foreach($list as $img) {
|
||||||
{
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = self::URI . substr($img->photo->url, 1);
|
$item['uri'] = self::URI . substr($img->photo->url, 1);
|
||||||
$item['title'] = $img->photo->subject;
|
$item['title'] = $img->photo->subject;
|
||||||
|
|
Loading…
Reference in a new issue