From 16bdf6b204e74fb1a8b2594e767206f8294d9df6 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sat, 18 Feb 2017 13:41:45 +0100 Subject: [PATCH] links: Rename defaultImageSrcTo to defaultLinkTo This function not only fixes image sources, but also anchors --- bridges/AcrimedBridge.php | 2 +- bridges/WorldOfTanksBridge.php | 2 +- lib/html.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index 3ca8e80..8b40d1d 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -16,7 +16,7 @@ class AcrimedBridge extends FeedExpander { $articlePage = getSimpleHTMLDOM($newsItem->link); $article = sanitize($articlePage->find('article.article1', 0)->innertext); - $article = defaultImageSrcTo($article, static::URI); + $article = defaultLinkTo($article, static::URI); $item['content'] = $article; return $item; diff --git a/bridges/WorldOfTanksBridge.php b/bridges/WorldOfTanksBridge.php index 1cc41b7..a894f6e 100644 --- a/bridges/WorldOfTanksBridge.php +++ b/bridges/WorldOfTanksBridge.php @@ -63,7 +63,7 @@ class WorldOfTanksBridge extends BridgeAbstract { debugMessage('loading page ' . $item['uri']); $articlePage = getSimpleHTMLDOMCached($item['uri']); $content = $articlePage->find('.l-content', 0); - defaultImageSrcTo($content, self::URI); + defaultLinkTo($content, self::URI); $item['title'] = $content->find('h1', 0)->innertext; $item['content'] = $content->find('.b-content', 0)->innertext; $item['timestamp'] = $content->find('.b-statistic_time', 0)->getAttribute("data-timestamp"); diff --git a/lib/html.php b/lib/html.php index 8eb0deb..d5f6667 100644 --- a/lib/html.php +++ b/lib/html.php @@ -278,7 +278,7 @@ $keptText = array()){ return $htmlContent; } -function defaultImageSrcTo($content, $server){ +function defaultLinkTo($content, $server){ foreach($content->find('img') as $image){ if(strpos($image->src, 'http') === false && strpos($image->src, '//') === false