From 6f8a773260ee2edd7e8d7a01f8d44eb393028d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sun, 28 Aug 2016 13:12:14 +0200 Subject: [PATCH] [CopieDoubleBridge] code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/CopieDoubleBridge.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bridges/CopieDoubleBridge.php b/bridges/CopieDoubleBridge.php index 7c06d95..6e787db 100644 --- a/bridges/CopieDoubleBridge.php +++ b/bridges/CopieDoubleBridge.php @@ -7,13 +7,13 @@ class CopieDoubleBridge extends BridgeAbstract{ public $description = "CopieDouble"; public function collectData(){ - $html = $this->getSimpleHTMLDOM('http://www.copie-double.com/') or $this->returnServerError('Could not request CopieDouble.'); + $html = $this->getSimpleHTMLDOM($this->uri) + or $this->returnServerError('Could not request CopieDouble.'); $table = $html->find('table table', 2); foreach($table->find('tr') as $element) { $td = $element->find('td', 0); - $cpt++; if($td->class == "couleur_1") { $item = array(); @@ -26,10 +26,10 @@ class CopieDoubleBridge extends BridgeAbstract{ elseif(strpos($element->innertext, "/images/suivant.gif") === false) { $a=$element->find("a", 0); - $item['uri'] = "http://www.copie-double.com" . $a->href; + $item['uri'] = $this->uri . $a->href; - $content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext); - $content = str_replace('href="/', 'href="http://www.copie-double.com/',$content); + $content = str_replace('src="/', 'src="/'.$this->uri,$element->find("td", 0)->innertext); + $content = str_replace('href="/', 'href="'.$this->uri,$content); $item['content'] = $content; $this->items[] = $item; }