1
0
Fork 0
forked from blallo/rss-bridge

fixing indentation on FrandroidBridge

This commit is contained in:
Enzo PALMA 2015-03-05 15:01:45 +01:00
parent 401663aac0
commit 14af7d93ba

View file

@ -1,33 +1,37 @@
<?php <?php
/** /**
* RssBridgeFrandroid * RssBridgeFrandroid
* Returns the 5 newest posts from http://www.frandroid.com (full text) * Returns the 5 newest posts from http://www.frandroid.com (full text)
* 2014-05-25 * 2014-05-25
* *
* @name Frandroid * @name Frandroid
* @homepage http://www.frandroid.com/ * @homepage http://www.frandroid.com/
* @description Returns the 5 newest posts from Frandroid (full text) * @description Returns the 5 newest posts from Frandroid (full text)
* @maintainer cjohnson * @maintainer cjohnson
*/ */
class FrandroidBridge extends BridgeAbstract{ class FrandroidBridge extends BridgeAbstract
{
public function collectData(array $param){ public function collectData(array $param)
{
function FrandroidStripCDATA($string) { function FrandroidStripCDATA($string)
{
$string = str_replace('<![CDATA[', '', $string); $string = str_replace('<![CDATA[', '', $string);
$string = str_replace(']]>', '', $string); $string = str_replace(']]>', '', $string);
return $string; return $string;
} }
function FrandroidExtractContent($url) { function FrandroidExtractContent($url)
{
$html2 = file_get_html($url); $html2 = file_get_html($url);
$html3 = $html2->find('div.post-content', 0); $html3 = $html2->find('div.post-content', 0);
$html3->find('div.no-sidebar-ad-top',0)->outertext=''; $html3->find('div.no-sidebar-ad-top', 0)->outertext = '';
$ret=$html3->find('div.shortcode-container'); $ret = $html3->find('div.shortcode-container');
foreach ($ret as $value){ foreach ($ret as $value) {
$value->outertext=''; $value->outertext = '';
} }
$html3->find('div#hrr-link',0)->outertext=''; $html3->find('div#hrr-link', 0)->outertext = '';
$text = $html3->innertext; $text = $html3->innertext;
$text = strip_tags($text, '<h1><span><h2><p><b><a><blockquote><img><em><ul><ol>'); $text = strip_tags($text, '<h1><span><h2><p><b><a><blockquote><img><em><ul><ol>');
return $text; return $text;
@ -35,8 +39,8 @@ class FrandroidBridge extends BridgeAbstract{
$html = file_get_html('http://feeds.feedburner.com/Frandroid?format=xml') or $this->returnError('Could not request Frandroid.', 404); $html = file_get_html('http://feeds.feedburner.com/Frandroid?format=xml') or $this->returnError('Could not request Frandroid.', 404);
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach ($html->find('item') as $element) {
if($limit < 5) { if ($limit < 5) {
$item = new \Item(); $item = new \Item();
$item->title = FrandroidStripCDATA($element->find('title', 0)->innertext); $item->title = FrandroidStripCDATA($element->find('title', 0)->innertext);
$item->uri = FrandroidStripCDATA($element->find('guid', 0)->plaintext); $item->uri = FrandroidStripCDATA($element->find('guid', 0)->plaintext);
@ -49,15 +53,18 @@ class FrandroidBridge extends BridgeAbstract{
} }
public function getName(){ public function getName()
{
return 'Frandroid'; return 'Frandroid';
} }
public function getURI(){ public function getURI()
{
return 'http://www.frandroid.com/'; return 'http://www.frandroid.com/';
} }
public function getCacheDuration(){ public function getCacheDuration()
{
return 300; // 5min return 300; // 5min
} }
} }