MemoLinux SegFaultMint fixes

This commit is contained in:
Mitsukarenai 2014-07-08 16:39:57 +02:00
parent 206bcdf712
commit b6602fc8e3
2 changed files with 12 additions and 16 deletions

View file

@ -1,15 +1,13 @@
<?php <?php
/** /**
* @name MemoLinux * @name MemoLinux
* @description Returns the 20 newest posts from MemoLinux (full text) * @homepage http://memo-linux.com/
*@maintainer qwertygc * @description Returns the 10 newest posts from MemoLinux (full text)
* @maintainer qwertygc
* @update 2014-07-07
*/ */
class MemoLinuxBridge extends BridgeAbstract{ class MemoLinuxBridge extends BridgeAbstract{
public function collectData(array $param){ public function collectData(array $param){
function StripCDATA($string) { function StripCDATA($string) {
@ -22,6 +20,7 @@ class MemoLinuxBridge extends BridgeAbstract{
$text = $html2->find('div.post-content', 0)->innertext; $text = $html2->find('div.post-content', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
$text = preg_replace('@<div[^>]*?>.*?</div>@si', '', $text); $text = preg_replace('@<div[^>]*?>.*?</div>@si', '', $text);
$text = preg_replace("/<h1.*/", '', $text);
return $text; return $text;
} }
$html = file_get_html('http://memo-linux.com/feed/') or $this->returnError('Could not request MemoLinux.', 404); $html = file_get_html('http://memo-linux.com/feed/') or $this->returnError('Could not request MemoLinux.', 404);
@ -50,7 +49,6 @@ class MemoLinuxBridge extends BridgeAbstract{
} }
public function getCacheDuration(){ public function getCacheDuration(){
// return 3600; // 1 hour return 3600*12; // 12 hours
return 0; // 1 hour
} }
} }

View file

@ -1,11 +1,10 @@
<?php <?php
/** /**
* RssBridgeSegfaultMint
* Returns the 10 newest posts from http://segfault.linuxmint.com (full text)
*
* @name SegfaultMint * @name SegfaultMint
* @description Returns the 20 newest posts from SegfaultMint (full text) * @homepage http://segfault.linuxmint.com/
*@maintainer qwertygc * @description Returns the 5 newest posts from SegfaultMint (full text)
* @maintainer qwertygc
* @update 2014-07-05
*/ */
class SegfaultMintBridge extends BridgeAbstract{ class SegfaultMintBridge extends BridgeAbstract{
@ -30,7 +29,7 @@ class SegfaultMintBridge extends BridgeAbstract{
$limit = 0; $limit = 0;
foreach($html->find('item') as $element) { foreach($html->find('item') as $element) {
if($limit < 10) { if($limit < 5) {
$item = new \Item(); $item = new \Item();
$item->title = StripCDATA($element->find('title', 0)->innertext); $item->title = StripCDATA($element->find('title', 0)->innertext);
$item->uri = StripCDATA($element->find('guid', 0)->plaintext); $item->uri = StripCDATA($element->find('guid', 0)->plaintext);
@ -52,7 +51,6 @@ class SegfaultMintBridge extends BridgeAbstract{
} }
public function getCacheDuration(){ public function getCacheDuration(){
// return 3600; // 1 hour return 3600*24; // 24 hours
return 0; // 1 hour
} }
} }