bridges: Fix bridges failing unit test

This commit is contained in:
logmanoriginal 2018-08-05 15:53:45 +02:00
parent 6bceb2b2db
commit 5fea9fc1f5
9 changed files with 15 additions and 17 deletions

View file

@ -26,7 +26,7 @@ class ContainerLinuxReleasesBridge extends BridgeAbstract {
]
];
public function getReleaseFeed($jsonUrl) {
private function getReleaseFeed($jsonUrl) {
$json = getContents($jsonUrl)
or returnServerError('Could not request Core OS Website.');
return json_decode($json, true);

View file

@ -157,7 +157,7 @@ class PepperBridgeAbstract extends BridgeAbstract {
/**
* Get the Deal data from the choosen group in the choosed order
*/
public function collectDataGroup()
protected function collectDataGroup()
{
$group = $this->getInput('group');
@ -171,7 +171,7 @@ class PepperBridgeAbstract extends BridgeAbstract {
/**
* Get the Deal data from the choosen keywords and parameters
*/
public function collectDataKeywords()
protected function collectDataKeywords()
{
$q = $this->getInput('q');
$hide_expired = $this->getInput('hide_expired');
@ -199,7 +199,7 @@ class PepperBridgeAbstract extends BridgeAbstract {
/**
* Get the Deal data using the given URL
*/
public function collectDeals($url){
protected function collectDeals($url){
$html = getSimpleHTMLDOM($url)
or returnServerError($this->i8n('request-error'));
$list = $html->find('article[id]');
@ -575,7 +575,7 @@ class PepperBridgeAbstract extends BridgeAbstract {
* the "$lang" class variable in the local class
* @return various the local content needed
*/
public function i8n($key)
protected function i8n($key)
{
if (array_key_exists($key, $this->lang)) {
return $this->lang[$key];

View file

@ -58,7 +58,7 @@ class ElloBridge extends BridgeAbstract {
}
public function findText($path) {
private function findText($path) {
foreach($path as $summaryElement) {
@ -72,7 +72,7 @@ class ElloBridge extends BridgeAbstract {
}
public function getPostContent($path) {
private function getPostContent($path) {
$content = '';
foreach($path as $summaryElement) {
@ -93,7 +93,7 @@ class ElloBridge extends BridgeAbstract {
}
public function getEnclosures($post, $postData) {
private function getEnclosures($post, $postData) {
$assets = [];
foreach($post->links->assets as $asset) {
@ -109,7 +109,7 @@ class ElloBridge extends BridgeAbstract {
}
public function getUsername($post, $postData) {
private function getUsername($post, $postData) {
foreach($postData->linked->users as $user) {
if($user->id == $post->links->author->id) {
@ -119,7 +119,7 @@ class ElloBridge extends BridgeAbstract {
}
public function getAPIKey() {
private function getAPIKey() {
$cache = Cache::create('FileCache');
$cache->setPath(CACHE_DIR);
$cache->setParameters(['key']);

View file

@ -275,7 +275,4 @@ EOD;
return 'http://facebook.com';
}
public function getCacheDuration(){
return 60 * 60 * 3; // 5 minutes
}
}

View file

@ -6,6 +6,7 @@ class FilterBridge extends FeedExpander {
const NAME = 'Filter';
const CACHE_TIMEOUT = 3600; // 1h
const DESCRIPTION = 'Filters a feed of your choice';
const URI = 'https://github.com/rss-bridge/rss-bridge';
const PARAMETERS = array(array(
'url' => array(

View file

@ -48,7 +48,7 @@ class PixivBridge extends BridgeAbstract {
}
}
public function cacheImage($url, $illustId) {
private function cacheImage($url, $illustId) {
$url = str_replace('_master1200', '', $url);
$url = str_replace('c/240x240/img-master/', 'img-original/', $url);

View file

@ -31,7 +31,7 @@ class SupInfoBridge extends BridgeAbstract {
}
}
public function fetchArticle($link) {
private function fetchArticle($link) {
$articleHTML = getSimpleHTMLDOM(self::URI . $link)
or returnServerError('Unable to fetch article !');

View file

@ -354,7 +354,7 @@ class VkBridge extends BridgeAbstract
}
public function getContents()
private function getContents()
{
ini_set('user-agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0');

View file

@ -127,7 +127,7 @@ class YGGTorrentBridge extends BridgeAbstract {
}
public function collectTorrentData($url) {
private function collectTorrentData($url) {
//For weird reason, the link we get can be invalid, we fix it.
$url_full = explode('/', $url);