/** * Add extra <meta> headers for certain pages that geourl.org understands * * @param Action $action page being shown * * @return boolean event handler flag */ function onEndShowHeadElements(Action $action) { $name = $action->trimmed('action'); $location = null; if ($action instanceof ShowstreamAction) { $profile = $action->getTarget(); if (!empty($profile->lat) && !empty($profile->lon)) { $location = $profile->lat . ', ' . $profile->lon; } } elseif ($action instanceof ShownoticeAction) { // FIXME: getNotice in ShownoticeAction will do a new lookup, we should fix those classes // so they can reliably just get a pre-stored notice object which was fetched in Shownotice prepare()... $notice = $action->notice; if ($notice instanceof Notice && !empty($notice->lat) && !empty($notice->lon)) { $location = $notice->lat . ', ' . $notice->lon; } } if (!is_null($location)) { $action->element('meta', array('name' => 'ICBM', 'content' => $location)); $action->element('meta', array('name' => 'DC.title', 'content' => $action->title())); } return true; }
/** * We include a <meta> element linking to the webfinger resource page, * for OpenID client-side authentication. * * @param Action $action Action being shown * * @return void */ function onEndShowHeadElements(Action $action) { if ($action instanceof ShowstreamAction) { $action->element('link', array('rel' => 'openid2.provider', 'href' => common_local_url('openidserver'))); $action->element('link', array('rel' => 'openid2.local_id', 'href' => $action->getTarget()->getUrl())); $action->element('link', array('rel' => 'openid.server', 'href' => common_local_url('openidserver'))); $action->element('link', array('rel' => 'openid.delegate', 'href' => $action->getTarget()->getUrl())); } if ($action instanceof SitestreamAction) { $action->element('meta', array('http-equiv' => 'X-XRDS-Location', 'content' => common_local_url('publicxrds'))); } return true; }
function onEndShowSections(Action $action) { if (!$action instanceof ShowstreamAction) { // early return for actions we're not interested in return true; } $scoped = $action->getScoped(); if (!$scoped instanceof Profile || !$scoped->hasRight(self::VIEWMODLOG)) { // only continue if we are allowed to VIEWMODLOG return true; } $profile = $action->getTarget(); $ml = new ModLog(); $ml->profile_id = $profile->getID(); $ml->orderBy("created"); $cnt = $ml->find(); if ($cnt > 0) { $action->elementStart('div', array('id' => 'entity_mod_log', 'class' => 'section')); $action->element('h2', null, _('Moderation')); $action->elementStart('table'); while ($ml->fetch()) { $action->elementStart('tr'); $action->element('td', null, strftime('%y-%m-%d', strtotime($ml->created))); $action->element('td', null, sprintf($ml->is_grant ? _('+%s') : _('-%s'), $ml->role)); $action->elementStart('td'); if ($ml->moderator_id) { $mod = Profile::getByID($ml->moderator_id); if (empty($mod)) { $action->text(_('[unknown]')); } else { $action->element('a', array('href' => $mod->getUrl(), 'title' => $mod->getFullname()), $mod->getNickname()); } } else { $action->text(_('[unknown]')); } $action->elementEnd('td'); $action->elementEnd('tr'); } $action->elementEnd('table'); $action->elementEnd('div'); } }
function onEndShowHeadElements(Action $action) { if ($action instanceof ShownoticeAction) { $user_im_prefs = new User_im_prefs(); $user_im_prefs->user_id = $action->notice->getProfile()->getID(); $user_im_prefs->transport = $this->transport; } elseif ($action instanceof ShowstreamAction) { $user_im_prefs = new User_im_prefs(); $user_im_prefs->user_id = $action->getTarget()->getID(); $user_im_prefs->transport = $this->transport; } }