Browse Source

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!
logmanoriginal 7 years ago
parent
commit
0631e9d835
1 changed files with 5 additions and 6 deletions
  1. 5 6
      bridges/DauphineLibereBridge.php

+ 5 - 6
bridges/DauphineLibereBridge.php

@@ -7,7 +7,7 @@ class DauphineLibereBridge extends BridgeAbstract{
 			$this->name = "DauphineLibereBridge Bridge";
 			$this->uri = "http://www.ledauphine.com/";
 			$this->description = "Returns the newest articles.";
-			$this->update = "05/11/2015";
+			$this->update = "2016-08-02";
 
 
 			$this->parameters[] =
@@ -82,16 +82,15 @@ class DauphineLibereBridge extends BridgeAbstract{
 			]';
 		}
 
-
-        public function collectData(array $param){
-
-			
 		function ExtractContent($url) {
 		$html2 = $this->file_get_html($url);
 		$text = $html2->find('div.column', 0)->innertext;
 		$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
 		return $text;
 		}
+
+        public function collectData(array $param){
+
 		if (isset($param['u'])) { /* user timeline mode */
 			$this->request = $param['u'];
 			$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->uri = $element->find('guid', 0)->plaintext;
 		 $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
-		 $item->content = ExtractContent($item->uri);
+		 $item->content = $this->ExtractContent($item->uri);
 		 $this->items[] = $item;
 		 $limit++;
 		 }