1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-13 03:54:04 +02:00

Reformat codebase v4 (#2872)

Reformat code base to PSR12

Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
Dag
2022-07-01 15:10:30 +02:00
committed by GitHub
parent 66568e3a39
commit 4f75591060
398 changed files with 58607 additions and 56442 deletions

View File

@@ -1,58 +1,62 @@
<?php
class WorldOfTanksBridge extends FeedExpander {
const MAINTAINER = 'Riduidel';
const NAME = 'World of Tanks';
const URI = 'https://worldoftanks.eu/';
const DESCRIPTION = 'News about the tank slaughter game.';
class WorldOfTanksBridge extends FeedExpander
{
const MAINTAINER = 'Riduidel';
const NAME = 'World of Tanks';
const URI = 'https://worldoftanks.eu/';
const DESCRIPTION = 'News about the tank slaughter game.';
const PARAMETERS = array( array(
'lang' => array(
'name' => 'Langue',
'type' => 'list',
'values' => array(
'Français' => 'fr',
'English' => 'en',
'Español' => 'es',
'Deutsch' => 'de',
'Čeština' => 'cs',
'Polski' => 'pl',
'Türkçe' => 'tr'
)
)
));
const PARAMETERS = [ [
'lang' => [
'name' => 'Langue',
'type' => 'list',
'values' => [
'Français' => 'fr',
'English' => 'en',
'Español' => 'es',
'Deutsch' => 'de',
'Čeština' => 'cs',
'Polski' => 'pl',
'Türkçe' => 'tr'
]
]
]];
const POSSIBLE_ARTICLES = array('article', 'rich-article');
const POSSIBLE_ARTICLES = ['article', 'rich-article'];
public function collectData() {
$this->collectExpandableDatas(sprintf('https://worldoftanks.eu/%s/rss/news/', $this->getInput('lang')));
}
public function collectData()
{
$this->collectExpandableDatas(sprintf('https://worldoftanks.eu/%s/rss/news/', $this->getInput('lang')));
}
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->loadFullArticle($item['uri']);
return $item;
}
protected function parseItem($newsItem)
{
$item = parent::parseItem($newsItem);
$item['content'] = $this->loadFullArticle($item['uri']);
return $item;
}
/**
* Loads the full article and returns the contents
* @param $uri The article URI
* @return The article content
*/
private function loadFullArticle($uri){
$html = getSimpleHTMLDOMCached($uri);
/**
* Loads the full article and returns the contents
* @param $uri The article URI
* @return The article content
*/
private function loadFullArticle($uri)
{
$html = getSimpleHTMLDOMCached($uri);
foreach(self::POSSIBLE_ARTICLES as $article_class) {
$content = $html->find('article', 0);
foreach (self::POSSIBLE_ARTICLES as $article_class) {
$content = $html->find('article', 0);
if($content !== null) {
// Remove the scripts, please
foreach($content->find('script') as $script) {
$script->outertext = '';
}
return $content->innertext;
}
}
return null;
}
if ($content !== null) {
// Remove the scripts, please
foreach ($content->find('script') as $script) {
$script->outertext = '';
}
return $content->innertext;
}
}
return null;
}
}