forked from blallo/rss-bridge
Make ExtractContent a member function
This fixes error "Using $this when not in object context" Nested functions are not part of the object and therefore don't have access to the object instance $this!
This commit is contained in:
parent
0052f25d2a
commit
0631e9d835
1 changed files with 5 additions and 6 deletions
|
@ -7,7 +7,7 @@ class DauphineLibereBridge extends BridgeAbstract{
|
||||||
$this->name = "DauphineLibereBridge Bridge";
|
$this->name = "DauphineLibereBridge Bridge";
|
||||||
$this->uri = "http://www.ledauphine.com/";
|
$this->uri = "http://www.ledauphine.com/";
|
||||||
$this->description = "Returns the newest articles.";
|
$this->description = "Returns the newest articles.";
|
||||||
$this->update = "05/11/2015";
|
$this->update = "2016-08-02";
|
||||||
|
|
||||||
|
|
||||||
$this->parameters[] =
|
$this->parameters[] =
|
||||||
|
@ -82,16 +82,15 @@ class DauphineLibereBridge extends BridgeAbstract{
|
||||||
]';
|
]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function collectData(array $param){
|
|
||||||
|
|
||||||
|
|
||||||
function ExtractContent($url) {
|
function ExtractContent($url) {
|
||||||
$html2 = $this->file_get_html($url);
|
$html2 = $this->file_get_html($url);
|
||||||
$text = $html2->find('div.column', 0)->innertext;
|
$text = $html2->find('div.column', 0)->innertext;
|
||||||
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
|
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function collectData(array $param){
|
||||||
|
|
||||||
if (isset($param['u'])) { /* user timeline mode */
|
if (isset($param['u'])) { /* user timeline mode */
|
||||||
$this->request = $param['u'];
|
$this->request = $param['u'];
|
||||||
$html = $this->file_get_html('http://www.ledauphine.com/'.$this->request.'/rss') or $this->returnError('Could not request DauphineLibere.', 404);
|
$html = $this->file_get_html('http://www.ledauphine.com/'.$this->request.'/rss') or $this->returnError('Could not request DauphineLibere.', 404);
|
||||||
|
@ -107,7 +106,7 @@ class DauphineLibereBridge extends BridgeAbstract{
|
||||||
$item->title = $element->find('title', 0)->innertext;
|
$item->title = $element->find('title', 0)->innertext;
|
||||||
$item->uri = $element->find('guid', 0)->plaintext;
|
$item->uri = $element->find('guid', 0)->plaintext;
|
||||||
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
|
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
|
||||||
$item->content = ExtractContent($item->uri);
|
$item->content = $this->ExtractContent($item->uri);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue