2021-11-06 21:58:30 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
class PanacheDigitalGamesBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const NAME = 'Panache Digital Games';
|
|
|
|
const URI = 'https://www.panachedigitalgames.com';
|
|
|
|
const DESCRIPTION = 'Panache Digital Games News Blog';
|
|
|
|
const MAINTAINER = 'somini';
|
|
|
|
const PARAMETERS = [
|
|
|
|
];
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
public function getIcon()
|
|
|
|
{
|
|
|
|
return 'https://www.panachedigitalgames.com/favicon-32x32.png';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
public function getURI()
|
|
|
|
{
|
|
|
|
return self::URI . '/en/news/';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
2022-07-09 09:13:07 +03:00
|
|
|
$articles = $this->getURI();
|
2021-11-06 21:58:30 +03:00
|
|
|
$html = getSimpleHTMLDOMCached($articles);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
foreach ($html->find('.news-item') as $element) {
|
|
|
|
$item = [];
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
$title = $element->find('.news-item-texts-title', 0);
|
|
|
|
$link = $element->find('.news-item-texts a', 0);
|
|
|
|
$timestamp = $element->find('.news-item-texts-date', 0);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
$item['title'] = $title->plaintext;
|
|
|
|
$item['uri'] = self::URI . $link->href;
|
|
|
|
$item['timestamp'] = strtotime($timestamp->plaintext);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
$image_html = $element->find('.news-item-thumbnail-image', 0);
|
|
|
|
if ($image_html) {
|
|
|
|
$image_strings = explode('\'', $image_html);
|
|
|
|
/* Debug::log('S: ' . count($image_strings) . '||' . implode('_ _', $image_strings)); */
|
|
|
|
if (count($image_strings) == 4) {
|
|
|
|
$item['content'] = '<img src="' . $image_strings[1] . '" />';
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
}
|
|
|
|
|
2021-11-06 21:58:30 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|