replace self:: with -> for methodcalls in Nordbayern bridge (#4195)

This commit is contained in:
Christian Schabesberger 2024-08-07 15:51:44 +02:00 committed by GitHub
parent 4faaa79101
commit 313be4c512
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,6 +53,19 @@ class NordbayernBridge extends BridgeAbstract
] ]
]]; ]];
public function collectData()
{
$region = $this->getInput('region');
if ($region === 'rothenburg-o-d-t') {
$region = 'rothenburg-ob-der-tauber';
}
$url = self::URI . '/region/' . $region;
$listSite = getSimpleHTMLDOM($url);
$this->handleNewsblock($listSite);
}
private function getValidImage($picture) private function getValidImage($picture)
{ {
$img = $picture->find('img', 0); $img = $picture->find('img', 0);
@ -75,23 +88,23 @@ class NordbayernBridge extends BridgeAbstract
) { ) {
$content .= $element; $content .= $element;
} elseif ($element->tag === 'main') { } elseif ($element->tag === 'main') {
$content .= self::getUseFullContent($element->find('article', 0)); $content .= $this->getUseFullContent($element->find('article', 0));
} elseif ($element->tag === 'header') { } elseif ($element->tag === 'header') {
$content .= self::getUseFullContent($element); $content .= $this->getUseFullContent($element);
} elseif ( } elseif (
$element->tag === 'div' && $element->tag === 'div' &&
!str_contains($element->class, 'article__infobox') && !str_contains($element->class, 'article__infobox') &&
!str_contains($element->class, 'authorinfo') !str_contains($element->class, 'authorinfo')
) { ) {
$content .= self::getUseFullContent($element); $content .= $this->getUseFullContent($element);
} elseif ( } elseif (
$element->tag === 'section' && $element->tag === 'section' &&
(str_contains($element->class, 'article__richtext') || (str_contains($element->class, 'article__richtext') ||
str_contains($element->class, 'article__context')) str_contains($element->class, 'article__context'))
) { ) {
$content .= self::getUseFullContent($element); $content .= $this->getUseFullContent($element);
} elseif ($element->tag === 'picture') { } elseif ($element->tag === 'picture') {
$content .= self::getValidImage($element); $content .= $this->getValidImage($element);
} elseif ($element->tag === 'ul') { } elseif ($element->tag === 'ul') {
$content .= $element; $content .= $element;
} }
@ -146,8 +159,8 @@ class NordbayernBridge extends BridgeAbstract
// of the title image. If we didn't do this some rss programs // of the title image. If we didn't do this some rss programs
// would show the subtitle of the title image as teaser instead // would show the subtitle of the title image as teaser instead
// of the actuall article teaser. // of the actuall article teaser.
$item['content'] .= self::getTeaser($content); $item['content'] .= $this->getTeaser($content);
$item['content'] .= self::getUseFullContent($content); $item['content'] .= $this->getUseFullContent($content);
} }
@ -169,7 +182,7 @@ class NordbayernBridge extends BridgeAbstract
continue; continue;
} }
$item = self::getArticle($url); $item = $this->getArticle($url);
// exclude police reports if desired // exclude police reports if desired
if ( if (
@ -190,16 +203,4 @@ class NordbayernBridge extends BridgeAbstract
$this->items[] = $item; $this->items[] = $item;
} }
} }
public function collectData()
{
$region = $this->getInput('region');
if ($region === 'rothenburg-o-d-t') {
$region = 'rothenburg-ob-der-tauber';
}
$url = self::URI . '/region/' . $region;
$listSite = getSimpleHTMLDOM($url);
self::handleNewsblock($listSite);
}
} }