function SocialTwitterFormatter::renderComments in Open Social 7
Parse twitter comments.
1 call to SocialTwitterFormatter::renderComments()
File
- includes/
social_comments.twitter.inc, line 84 - Twitter class
Class
- SocialTwitterFormatter
- @file Twitter class
Code
function renderComments($items) {
$comments = array();
if (is_array($items)) {
if (!empty($this->max_items)) {
$items = array_slice($items, 0, $this->max_items);
}
foreach ($items as $item) {
$data = array();
// Get user data.
$data['id'] = check_plain($item['id']);
$data['username'] = !empty($item['name']) ? check_plain($item['name']) : NULL;
$data['user_url'] = !empty($item['username']) ? url('https://twitter.com/' . $item['username']) : NULL;
$data['userphoto'] = !empty($item['images']['thumbnail']) ? filter_xss($item['images']['thumbnail']) : NULL;
$data['text'] = filter_xss($item['content']);
$data['timestamp'] = strtotime($item['date']);
$comments[] = $data;
}
}
return $comments;
}