forked from blallo/rss-bridge
links: Rename defaultImageSrcTo to defaultLinkTo
This function not only fixes image sources, but also anchors
This commit is contained in:
parent
cf7da1d41c
commit
16bdf6b204
3 changed files with 3 additions and 3 deletions
|
@ -16,7 +16,7 @@ class AcrimedBridge extends FeedExpander {
|
||||||
|
|
||||||
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
||||||
$article = sanitize($articlePage->find('article.article1', 0)->innertext);
|
$article = sanitize($articlePage->find('article.article1', 0)->innertext);
|
||||||
$article = defaultImageSrcTo($article, static::URI);
|
$article = defaultLinkTo($article, static::URI);
|
||||||
$item['content'] = $article;
|
$item['content'] = $article;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
|
|
|
@ -63,7 +63,7 @@ class WorldOfTanksBridge extends BridgeAbstract {
|
||||||
debugMessage('loading page ' . $item['uri']);
|
debugMessage('loading page ' . $item['uri']);
|
||||||
$articlePage = getSimpleHTMLDOMCached($item['uri']);
|
$articlePage = getSimpleHTMLDOMCached($item['uri']);
|
||||||
$content = $articlePage->find('.l-content', 0);
|
$content = $articlePage->find('.l-content', 0);
|
||||||
defaultImageSrcTo($content, self::URI);
|
defaultLinkTo($content, self::URI);
|
||||||
$item['title'] = $content->find('h1', 0)->innertext;
|
$item['title'] = $content->find('h1', 0)->innertext;
|
||||||
$item['content'] = $content->find('.b-content', 0)->innertext;
|
$item['content'] = $content->find('.b-content', 0)->innertext;
|
||||||
$item['timestamp'] = $content->find('.b-statistic_time', 0)->getAttribute("data-timestamp");
|
$item['timestamp'] = $content->find('.b-statistic_time', 0)->getAttribute("data-timestamp");
|
||||||
|
|
|
@ -278,7 +278,7 @@ $keptText = array()){
|
||||||
return $htmlContent;
|
return $htmlContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
function defaultImageSrcTo($content, $server){
|
function defaultLinkTo($content, $server){
|
||||||
foreach($content->find('img') as $image){
|
foreach($content->find('img') as $image){
|
||||||
if(strpos($image->src, 'http') === false
|
if(strpos($image->src, 'http') === false
|
||||||
&& strpos($image->src, '//') === false
|
&& strpos($image->src, '//') === false
|
||||||
|
|
Loading…
Reference in a new issue