本文整理汇总了PHP中Action::getTarget方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::getTarget方法的具体用法?PHP Action::getTarget怎么用?PHP Action::getTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::getTarget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onEndShowHeadElements
/**
* 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;
}
示例2: onEndShowHeadElements
/**
* 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;
}
示例3: onEndShowSections
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');
}
}
示例4: onEndShowHeadElements
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;
}
}