[WordPress] Fix content loading

This commit is contained in:
logmanoriginal 2016-08-04 21:06:12 +02:00
parent d944558a3d
commit 2c41ed550d

View file

@ -86,7 +86,7 @@ class WordPressBridge extends BridgeAbstract {
if($type === WORDPRESS_TYPE_RSS){ if($type === WORDPRESS_TYPE_RSS){
$item->uri = $article->find('url', 0)->innertext; // 'link' => 'url'! $item->uri = $article->find('url', 0)->innertext; // 'link' => 'url'!
$item->title = $article->find('title', 0)->plaintext; $item->title = $article->find('title', 0)->plaintext;
$item->author = trim($article->find('dc:creator', 0)->innertext); $item->author = trim($this->StripCDATA($article->find('dc:creator', 0)->innertext));
$item->timestamp = strtotime($article->find('pubDate', 0)->innertext); $item->timestamp = strtotime($article->find('pubDate', 0)->innertext);
} else { } else {
$item->uri = $article->find('url', 0)->getAttribute('href'); // 'link' => 'url'! $item->uri = $article->find('url', 0)->getAttribute('href'); // 'link' => 'url'!
@ -97,14 +97,30 @@ class WordPressBridge extends BridgeAbstract {
$article_html = $this->file_get_html($item->uri); $article_html = $this->file_get_html($item->uri);
// Attempt to find most common content div
if(empty($item->content)){
$article = $article_html->find('article', 0); $article = $article_html->find('article', 0);
if(!empty($article)){ if(!empty($article)){
$item->content = $this->ClearContent($article->innertext); $item->content = $this->ClearContent($article->innertext);
if(empty($item->content))
$item->content = $this->ClearContent($article_html->find('.single-content', 0)->innertext); // another common content div
if(empty($item->content))
$item->content = $this->ClearContent($article_html->find('.post', 0)->innertext); // for old WordPress themes without HTML5
} }
}
// another common content div
if(empty($item->content)){
$article = $article_html->find('.single-content', 0);
if(!empty($article)){
$item->content = $this->ClearContent($article->innertext);
}
}
// for old WordPress themes without HTML5
if(empty($item->content)){
$article = $article_html->find('.post', 0);
if(!empty($article)){
$item->content = $this->ClearContent($article->innertext);
}
}
$this->items[] = $item; $this->items[] = $item;
$i++; $i++;
} }