function op_api_notification($notification) { if ($notification['icon_url']) { $iconUrl = $notification['icon_url']; } else { if ('link' === $notification['category']) { $fromMember = Doctrine::getTable('Member')->find($notification['member_id_from']); $fromMemberImageFileName = $fromMember ? $fromMember->getImageFileName() : null; if ($fromMemberImageFileName) { $iconUrl = sf_image_path($fromMemberImageFileName, array('size' => '48x48'), true); } } } if (!$iconUrl) { $iconUrl = op_image_path('no_image.gif', true); } elseif (false !== strpos('http://', $iconUrl)) { $iconUrl = sf_image_path($iconUrl, array('size' => '48x48'), true); } return array('id' => $notification['id'], 'body' => sfContext::getInstance()->getI18N()->__($notification['body']), 'category' => $notification['category'], 'unread' => $notification['unread'], 'created_at' => date('r', strtotime($notification['created_at'])), 'icon_url' => $iconUrl, 'url' => $notification['url'] ? url_for($notification['url'], array('abstract' => true)) : null, 'member_id_from' => $notification['member_id_from']); }
/** * Returns a image tag * * @param string $source * @param array $options * * @return string An image tag. * @see image_tag */ function op_image_tag($source, $options = array()) { if (!isset($options['raw_name'])) { $absolute = false; if (isset($options['absolute'])) { unset($options['absolute']); $absolute = true; } $options['raw_name'] = true; $source = op_image_path($source, $absolute); } return image_tag($source, $options); }
public static function getNotImageUrl() { return op_image_path('no_image.gif', true); }