Update EvercadeBridge.php
This commit is contained in:
@ -18,29 +18,41 @@ class EvercadeBridge extends BridgeAbstract {
|
||||
or returnServerError('Could not request webpage: ' . $pageUrl);
|
||||
|
||||
// Process articles
|
||||
foreach($html->find('div.an-article') as $element) {
|
||||
foreach($html->find('a.single-post-archive') as $element) {
|
||||
|
||||
if(count($this->items) >= 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
$article_title = trim(strip_tags($element->find('h2', 0)->innertext));
|
||||
$article_uri = substr($element->find('a', 0)->href, 0);
|
||||
//$article_thumbnail = self::URI . substr($element->find('img', 0)->src, 3);
|
||||
//$article_content = '<img src="'. $article_thumbnail .'"></a>';
|
||||
$article_content = trim(strip_tags($element->find('p.excerpt', 0)->innertext));
|
||||
//$article_timestamp = strtotime($element->find('time', 0)->attr['datetime']);
|
||||
$article_uid = trim(strip_tags($element->find('h2', 0)->innertext));
|
||||
$article_title = trim(strip_tags($element->find('div.post-name span', 0)->innertext));
|
||||
$article_uri = $element->href;
|
||||
$article_content = '';
|
||||
if ($element->find('div.excerpt', 0)) {
|
||||
$article_content = trim(strip_tags($element->find('div.excerpt', 0)->innertext));
|
||||
}
|
||||
$article_date = '';
|
||||
if ($element->find('span.post-date', 0)) {
|
||||
$article_date = $element->find('span.post-date', 0)->innertext;
|
||||
}
|
||||
$article_author = '';
|
||||
if ($element->find('span.author-name', 0)) {
|
||||
$article_author = $element->find('span.author-name', 0)->innertext;
|
||||
}
|
||||
$article_uid = $article_title;
|
||||
|
||||
// Store article in items array
|
||||
if (!empty($article_title)) {
|
||||
$item = array();
|
||||
$item['uri'] = $article_uri;
|
||||
$item['title'] = $article_title;
|
||||
//$item['enclosures'] = array($article_thumbnail);
|
||||
$item['content'] = $article_content;
|
||||
//$item['timestamp'] = $article_timestamp;
|
||||
$item['uid'] = $article_uid;
|
||||
if (!empty($article_date)) {
|
||||
$item['timestamp'] = strtotime($article_date);
|
||||
}
|
||||
if (!empty($article_author)) {
|
||||
$item['author'] = $article_author;
|
||||
}
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user