[WordPress] Fix content loading
This commit is contained in:
parent
d944558a3d
commit
2c41ed550d
1 changed files with 24 additions and 8 deletions
|
@ -86,7 +86,7 @@ class WordPressBridge extends BridgeAbstract {
|
|||
if($type === WORDPRESS_TYPE_RSS){
|
||||
$item->uri = $article->find('url', 0)->innertext; // 'link' => 'url'!
|
||||
$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);
|
||||
} else {
|
||||
$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);
|
||||
|
||||
// Attempt to find most common content div
|
||||
if(empty($item->content)){
|
||||
$article = $article_html->find('article', 0);
|
||||
if(!empty($article)){
|
||||
$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;
|
||||
$i++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue