mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-18 00:43:19 +03:00
a4b9611e66
- Do not add spaces after opening or before closing parenthesis // Wrong if( !is_null($var) ) { ... } // Right if(!is_null($var)) { ... } - Add space after closing parenthesis // Wrong if(true){ ... } // Right if(true) { ... } - Add body into new line - Close body in new line // Wrong if(true) { ... } // Right if(true) { ... } Notice: Spaces after keywords are not detected: // Wrong (not detected) // -> space after 'if' and missing space after 'else' if (true) { ... } else{ ... } // Right if(true) { ... } else { ... }
36 lines
996 B
PHP
36 lines
996 B
PHP
<?php
|
|
class GizmodoBridge extends FeedExpander {
|
|
|
|
const MAINTAINER = 'polopollo';
|
|
const NAME = 'Gizmodo';
|
|
const URI = 'http://gizmodo.com/';
|
|
const CACHE_TIMEOUT = 1800; // 30min
|
|
const DESCRIPTION = 'Returns the newest posts from Gizmodo (full text).';
|
|
|
|
protected function parseItem($item){
|
|
$item = parent::parseItem($item);
|
|
|
|
$articleHTMLContent = getSimpleHTMLDOMCached($item['uri']);
|
|
if(!$articleHTMLContent) {
|
|
$text = 'Could not load ' . $item['uri'];
|
|
} else {
|
|
$text = $articleHTMLContent->find('div.entry-content', 0)->innertext;
|
|
foreach($articleHTMLContent->find('pagespeed_iframe') as $element) {
|
|
$text .= '<p>link to a iframe (could be a video): <a href="'
|
|
. $element->src
|
|
. '">'
|
|
. $element->src
|
|
. '</a></p><br>';
|
|
}
|
|
|
|
$text = strip_tags($text, '<p><b><a><blockquote><img><em>');
|
|
}
|
|
|
|
$item['content'] = $text;
|
|
return $item;
|
|
}
|
|
|
|
public function collectData(){
|
|
$this->collectExpandableDatas('http://feeds.gawker.com/gizmodo/full');
|
|
}
|
|
}
|