aboutsummaryrefslogtreecommitdiff
path: root/bridges/BlaguesDeMerdeBridge.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2022-07-01 15:10:30 +0200
committerGravatar GitHub <noreply@github.com> 2022-07-01 15:10:30 +0200
commit4f75591060d95208a301bc6bf460d875631b29cc (patch)
tree4e37d86840e8d990a563ba75d3de6f84a53cc2de /bridges/BlaguesDeMerdeBridge.php
parent66568e3a39c61546c09a47a5688914a0bdf3c60c (diff)
downloadrss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.gz
rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.zst
rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.zip
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
Diffstat (limited to 'bridges/BlaguesDeMerdeBridge.php')
-rw-r--r--bridges/BlaguesDeMerdeBridge.php65
1 files changed, 32 insertions, 33 deletions
diff --git a/bridges/BlaguesDeMerdeBridge.php b/bridges/BlaguesDeMerdeBridge.php
index 9b776407..cc0f485e 100644
--- a/bridges/BlaguesDeMerdeBridge.php
+++ b/bridges/BlaguesDeMerdeBridge.php
@@ -1,45 +1,44 @@
<?php
-class BlaguesDeMerdeBridge extends BridgeAbstract {
- const MAINTAINER = 'superbaillot.net, logmanoriginal';
- const NAME = 'Blagues De Merde';
- const URI = 'http://www.blaguesdemerde.fr/';
- const CACHE_TIMEOUT = 7200; // 2h
- const DESCRIPTION = 'Blagues De Merde';
+class BlaguesDeMerdeBridge extends BridgeAbstract
+{
+ const MAINTAINER = 'superbaillot.net, logmanoriginal';
+ const NAME = 'Blagues De Merde';
+ const URI = 'http://www.blaguesdemerde.fr/';
+ const CACHE_TIMEOUT = 7200; // 2h
+ const DESCRIPTION = 'Blagues De Merde';
- public function getIcon() {
- return self::URI . 'assets/img/favicon.ico';
- }
+ public function getIcon()
+ {
+ return self::URI . 'assets/img/favicon.ico';
+ }
- public function collectData(){
+ public function collectData()
+ {
+ $html = getSimpleHTMLDOM(self::URI);
- $html = getSimpleHTMLDOM(self::URI);
+ foreach ($html->find('div.blague') as $element) {
+ $item = [];
- foreach($html->find('div.blague') as $element) {
+ $item['uri'] = static::URI . '#' . $element->id;
+ $item['author'] = $element->find('div[class="blague-footer"] p strong', 0)->plaintext;
- $item = array();
+ // Let the title be everything up to the first <br>
+ $item['title'] = trim(explode("\n", $element->find('div.text', 0)->plaintext)[0]);
- $item['uri'] = static::URI . '#' . $element->id;
- $item['author'] = $element->find('div[class="blague-footer"] p strong', 0)->plaintext;
+ $item['content'] = strip_tags($element->find('div.text', 0));
- // Let the title be everything up to the first <br>
- $item['title'] = trim(explode("\n", $element->find('div.text', 0)->plaintext)[0]);
+ // timestamp is part of:
+ // <p>Par <strong>{author}</strong> le {date} dans <strong>{category}</strong></p>
+ preg_match(
+ '/.+le(.+)dans.*/',
+ $element->find('div[class="blague-footer"]', 0)->plaintext,
+ $matches
+ );
- $item['content'] = strip_tags($element->find('div.text', 0));
+ $item['timestamp'] = strtotime($matches[1]);
- // timestamp is part of:
- // <p>Par <strong>{author}</strong> le {date} dans <strong>{category}</strong></p>
- preg_match(
- '/.+le(.+)dans.*/',
- $element->find('div[class="blague-footer"]', 0)->plaintext,
- $matches
- );
-
- $item['timestamp'] = strtotime($matches[1]);
-
- $this->items[] = $item;
-
- }
-
- }
+ $this->items[] = $item;
+ }
+ }
}