当前位置: 首页>>代码示例>>PHP>>正文


PHP Action::getTarget方法代码示例

本文整理汇总了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;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:30,代码来源:GeoURLPlugin.php

示例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;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:21,代码来源:OpenIDPlugin.php

示例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');
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:42,代码来源:ModLogPlugin.php

示例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;
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:12,代码来源:implugin.php


注:本文中的Action::getTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。