diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index cb13ca35..7cc4af60 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -24,6 +24,16 @@ class KununuBridge extends BridgeAbstract { 'type' => 'checkbox', 'exampleValue' => 'checked', 'title' => 'Activate to load full article' + ), + 'include_ratings' => array( + 'name' => 'Include ratings', + 'type' => 'checkbox', + 'title' => 'Activate to include ratings in the feed' + ), + 'include_benefits' => array( + 'name' => 'Include benefits', + 'type' => 'checkbox', + 'title' => 'Activate to include benefits in the feed' ) ), array( @@ -116,7 +126,7 @@ class KununuBridge extends BridgeAbstract { $item = array(); $item['author'] = $this->extractArticleAuthorPosition($article); - $item['timestamp'] = strtotime($date); + $item['timestamp'] = strtotime($date->content); $item['title'] = $rating->getAttribute('aria-label') . ' : ' . strip_tags($summary->innertext); @@ -175,7 +185,32 @@ class KununuBridge extends BridgeAbstract { $description = $article->find('[itemprop=reviewBody]', 0) or returnServerError('Cannot find article description!'); - return $description->innertext; + $retVal = $description->innertext; + + if($this->getInput('include_ratings') + && ($ratings = $article->find('.review-ratings .rating-group'))) { + $retVal .= (empty($retVal) ? '' : '
') . ''; + foreach($ratings as $rating) { + $retVal .= << + +EOD; + } + $retVal .= '
{$rating->find('.rating-title', 0)->plaintext} + {$rating->find('.rating-badge', 0)->plaintext} +
'; + } + + if($this->getInput('include_benefits') + && ($benefits = $article->find('benefit'))) { + $retVal .= (empty($retVal) ? '' : '
') . ''; + } + + return $retVal; } /**