From efb6ad9ff2a850a646f472deef980779995516c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sun, 28 Aug 2016 11:52:41 +0200 Subject: [PATCH] [AskfmBridge] code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/AskfmBridge.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index 6de8f54f..7a8b9e21 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -15,13 +15,12 @@ class AskfmBridge extends BridgeAbstract{ ); public function collectData(){ - $html = ''; $html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Requested username can\'t be found.'); foreach($html->find('div.streamItem-answer') as $element) { $item = array(); - $item['uri'] = 'http://ask.fm'.$element->find('a.streamItemsAge',0)->href; + $item['uri'] = $this->uri.$element->find('a.streamItemsAge',0)->href; $question = trim($element->find('h1.streamItemContent-question',0)->innertext); $item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES)); $answer = trim($element->find('p.streamItemContent-answer',0)->innertext); @@ -36,7 +35,7 @@ class AskfmBridge extends BridgeAbstract{ } $content = '

' . $question . '

' . $answer . '

' . $visual . '

'; // Fix relative links without breaking // scheme used by YouTube stuff - $content = preg_replace('#href="\/(?!\/)#', 'href="http://ask.fm/',$content); + $content = preg_replace('#href="\/(?!\/)#', 'href="'.$this->uri,$content); $item['content'] = $content; $this->items[] = $item; }