function handleAvatar(&$eventData, &$addData) { $this->log("avatar_hook. " . print_r($eventData, true) . "\n" . print_r($addData, true)); // We support twitter only if (!is_array($addData) || !$addData['type'] == 'twitter') { return; } // Check for valid input if (!is_array($eventData) || !$eventData['cid']) { return; } // Add twitter infos to metadata. Twitter is detected by URL, so produce an URL $spice = DbSpice::loadCommentSpice($eventData['cid']); if (!is_array($spice)) { return; } if (!empty($spice['twittername'])) { $eventData['url'] = 'http://twitter.com/' . $spice['twittername']; $this->log("avatar_hook filled. " . print_r($eventData, true) . "\n" . print_r($addData, true)); } }
static function loadCommentSpiceByEntry($entryId) { if (empty($entryId)) { return FALSE; } $comments = serendipity_fetchComments($entryId); $result = array(); foreach ($comments as $comment) { $result[] = DbSpice::loadCommentSpice($comment['id']); } return $result; }