mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-09-01 20:23:39 +02:00
[Various] getKey replacements and docu (#3283)
* [Various] getKey replacements and docu * more bridges and fix to the abstract * linting * revert bandcampdaily. doing more than i thought
This commit is contained in:
@@ -75,11 +75,7 @@ class AllocineFRBridge extends BridgeAbstract
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('category'))) {
|
||||
return self::NAME . ' : '
|
||||
. array_search(
|
||||
$this->getInput('category'),
|
||||
self::PARAMETERS[$this->queriedContext]['category']['values']
|
||||
);
|
||||
return self::NAME . ' : ' . $this->getKey('category');
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
@@ -89,10 +85,6 @@ class AllocineFRBridge extends BridgeAbstract
|
||||
{
|
||||
$html = getSimpleHTMLDOM($this->getURI());
|
||||
|
||||
$category = array_search(
|
||||
$this->getInput('category'),
|
||||
self::PARAMETERS[$this->queriedContext]['category']['values']
|
||||
);
|
||||
foreach ($html->find('div[class=gd-col-left]', 0)->find('div[class*=video-card]') as $element) {
|
||||
$item = [];
|
||||
|
||||
|
@@ -25,10 +25,7 @@ class AnimeUltimeBridge extends BridgeAbstract
|
||||
public function collectData()
|
||||
{
|
||||
//Add type filter if provided
|
||||
$typeFilter = array_search(
|
||||
$this->getInput('type'),
|
||||
self::PARAMETERS[$this->queriedContext]['type']['values']
|
||||
);
|
||||
$typeFilter = $this->getKey('type');
|
||||
|
||||
//Build date and filters for making requests
|
||||
$thismonth = date('mY') . $typeFilter;
|
||||
@@ -128,12 +125,7 @@ class AnimeUltimeBridge extends BridgeAbstract
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('type'))) {
|
||||
$typeFilter = array_search(
|
||||
$this->getInput('type'),
|
||||
self::PARAMETERS[$this->queriedContext]['type']['values']
|
||||
);
|
||||
|
||||
return 'Latest ' . $typeFilter . ' - Anime-Ultime Bridge';
|
||||
return 'Latest ' . $this->getKey('type') . ' - Anime-Ultime Bridge';
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
@@ -97,13 +97,8 @@ EOD;
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('edition')) && !is_null($this->getInput('category'))) {
|
||||
$parameters = $this->getParameters();
|
||||
|
||||
$editionValues = array_flip($parameters[0]['edition']['values']);
|
||||
$categoryValues = array_flip($parameters[0]['category']['values']);
|
||||
|
||||
return $categoryValues[$this->getInput('category')] . ' - ' .
|
||||
$editionValues[$this->getInput('edition')] . ' - Brut.';
|
||||
return $this->getKey('category') . ' - ' .
|
||||
$this->getKey('edition') . ' - Brut.';
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
@@ -146,11 +146,7 @@ class GBAtempBridge extends BridgeAbstract
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('type'))) {
|
||||
$type = array_search(
|
||||
$this->getInput('type'),
|
||||
self::PARAMETERS[$this->queriedContext]['type']['values']
|
||||
);
|
||||
return 'GBAtemp ' . $type . ' Bridge';
|
||||
return 'GBAtemp ' . $this->getKey('type') . ' Bridge';
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
@@ -625,8 +625,7 @@ class GithubTrendingBridge extends BridgeAbstract
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('language'))) {
|
||||
$language = array_search($this->getInput('language'), self::PARAMETERS['By language']['language']['values']);
|
||||
return self::NAME . ': ' . $language;
|
||||
return self::NAME . ': ' . $this->getKey('language');
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
@@ -138,9 +138,7 @@ class InternetArchiveBridge extends BridgeAbstract
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('username')) && !is_null($this->getInput('content'))) {
|
||||
$contentValues = array_flip(self::PARAMETERS['Account']['content']['values']);
|
||||
|
||||
return $contentValues[$this->getInput('content')] . ' - '
|
||||
return $this->getKey('content') . ' - '
|
||||
. $this->processUsername() . ' - Internet Archive';
|
||||
}
|
||||
|
||||
|
@@ -181,11 +181,11 @@ class NineGagBridge extends BridgeAbstract
|
||||
public function getName()
|
||||
{
|
||||
if ($this->getInput('d')) {
|
||||
$name = sprintf('%s - %s', '9GAG', $this->getParameterKey('d'));
|
||||
$name = sprintf('%s - %s', '9GAG', $this->getKey('d'));
|
||||
} elseif ($this->getInput('g')) {
|
||||
$name = sprintf('%s - %s', '9GAG', $this->getParameterKey('g'));
|
||||
$name = sprintf('%s - %s', '9GAG', $this->getKey('g'));
|
||||
if ($this->getInput('t')) {
|
||||
$name = sprintf('%s [%s]', $name, $this->getParameterKey('t'));
|
||||
$name = sprintf('%s [%s]', $name, $this->getKey('t'));
|
||||
}
|
||||
}
|
||||
if (!empty($name)) {
|
||||
@@ -236,23 +236,6 @@ class NineGagBridge extends BridgeAbstract
|
||||
return $this->p;
|
||||
}
|
||||
|
||||
protected function getParameterKey($input = '')
|
||||
{
|
||||
$params = $this->getParameters();
|
||||
$tab = 'Sections';
|
||||
if ($input === 'd') {
|
||||
$tab = 'Popular';
|
||||
}
|
||||
if (!isset($params[$tab][$input])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return array_search(
|
||||
$this->getInput($input),
|
||||
$params[$tab][$input]['values']
|
||||
);
|
||||
}
|
||||
|
||||
protected static function getContent($post)
|
||||
{
|
||||
if ($post['type'] === 'Animated') {
|
||||
|
@@ -47,13 +47,9 @@ class NpciBridge extends BridgeAbstract
|
||||
|
||||
public function getName()
|
||||
{
|
||||
$product = $this->getInput('product');
|
||||
if ($product) {
|
||||
$productNameMap = array_flip(self::PARAMETERS[0]['product']['values']);
|
||||
$productName = $productNameMap[$product];
|
||||
return "NPCI Circulars: $productName";
|
||||
if ($this->getInput('product')) {
|
||||
return 'NPCI Circulars: ' . $this->getKey('product');
|
||||
}
|
||||
|
||||
return 'NPCI Circulars';
|
||||
}
|
||||
|
||||
|
@@ -592,9 +592,7 @@ HEREDOC;
|
||||
return $this->i8n('bridge-name') . ' - ' . $this->i8n('title-keyword') . ' : ' . $this->getInput('q');
|
||||
break;
|
||||
case $this->i8n('context-group'):
|
||||
$values = $this->getParameters()[$this->i8n('context-group')]['group']['values'];
|
||||
$group = array_search($this->getInput('group'), $values);
|
||||
return $this->i8n('bridge-name') . ' - ' . $this->i8n('title-group') . ' : ' . $group;
|
||||
return $this->i8n('bridge-name') . ' - ' . $this->i8n('title-group') . ' : ' . $this->getKey('group');
|
||||
break;
|
||||
case $this->i8n('context-talk'):
|
||||
return $this->i8n('bridge-name') . ' - ' . $this->i8n('title-talk') . ' : ' . $this->getTalkTitle();
|
||||
|
@@ -76,11 +76,7 @@ class PixivBridge extends BridgeAbstract
|
||||
default:
|
||||
return parent::getName();
|
||||
}
|
||||
$mode = array_search(
|
||||
$this->getInput('mode'),
|
||||
self::PARAMETERS['global']['mode']['values']
|
||||
);
|
||||
return "Pixiv ${mode} from ${context} ${query}";
|
||||
return 'Pixiv ' . $this->getKey('mode') . " from ${context} ${query}";
|
||||
}
|
||||
|
||||
public function getURI()
|
||||
@@ -149,7 +145,6 @@ class PixivBridge extends BridgeAbstract
|
||||
public function collectData()
|
||||
{
|
||||
$content = $this->collectWorksArray();
|
||||
|
||||
$content = array_filter($content, function ($v, $k) {
|
||||
return !array_key_exists('isAdContainer', $v);
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
|
@@ -54,11 +54,7 @@ class SplCenterBridge extends FeedExpander
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('content'))) {
|
||||
$parameters = $this->getParameters();
|
||||
|
||||
$contentValues = array_flip($parameters[0]['content']['values']);
|
||||
|
||||
return $contentValues[$this->getInput('content')] . ' - Southern Poverty Law Center';
|
||||
return $this->getKey('content') . ' - Southern Poverty Law Center';
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
@@ -147,10 +147,7 @@ EOD;
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('country'))) {
|
||||
$parameters = $this->getParameters();
|
||||
$values = array_flip($parameters[0]['country']['values']);
|
||||
|
||||
return $values[$this->getInput('country')] . ' - TwitScoop';
|
||||
return $this->getKey('country') . ' - TwitScoop';
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
@@ -76,7 +76,7 @@ class UnogsBridge extends BridgeAbstract
|
||||
if ($this->queriedContext == 'Global') {
|
||||
$feedName .= 'Netflix Global - ';
|
||||
} elseif ($this->queriedContext == 'Country') {
|
||||
$feedName .= 'Netflix ' . $this->getParametersKey('country_code') . ' - ';
|
||||
$feedName .= 'Netflix ' . $this->getKey('country_code') . ' - ';
|
||||
}
|
||||
if ($this->getInput('feed') == 'expiring') {
|
||||
$feedName .= 'Expiring title';
|
||||
@@ -88,20 +88,6 @@ class UnogsBridge extends BridgeAbstract
|
||||
return $feedName;
|
||||
}
|
||||
|
||||
private function getParametersKey($input = '')
|
||||
{
|
||||
$params = $this->getParameters();
|
||||
$tab = 'Country';
|
||||
if (!isset($params[$tab][$input])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return array_search(
|
||||
$this->getInput($input),
|
||||
$params[$tab][$input]['values']
|
||||
);
|
||||
}
|
||||
|
||||
private function getJSON($url)
|
||||
{
|
||||
$header = [
|
||||
|
@@ -48,10 +48,7 @@ class WebfailBridge extends BridgeAbstract
|
||||
{
|
||||
$html = getSimpleHTMLDOM($this->getURI() . $this->getInput('type'));
|
||||
|
||||
$type = array_search(
|
||||
$this->getInput('type'),
|
||||
self::PARAMETERS[$this->queriedContext]['type']['values']
|
||||
);
|
||||
$type = $this->getKey('type');
|
||||
|
||||
switch (strtolower($type)) {
|
||||
case 'facebook':
|
||||
|
Reference in New Issue
Block a user