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


PHP Action::arg方法代码示例

本文整理汇总了PHP中Action::arg方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::arg方法的具体用法?PHP Action::arg怎么用?PHP Action::arg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Action的用法示例。


在下文中一共展示了Action::arg方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: arg

 function arg($arg, $def = null)
 {
     // PHP converts '.'s in incoming var names to '_'s.
     // It also merges multiple values, which'll break hub.verify and hub.topic for publishing
     // @fixme handle multiple args
     $arg = str_replace('hub.', 'hub_', $arg);
     return parent::arg($arg, $def);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:8,代码来源:pushhub.php

示例2: onEndShowStatusNetScripts

 /**
  * Link in a JavaScript script for the whitelist invite form
  *
  * @param Action $action Action being shown
  *
  * @return boolean hook flag
  */
 function onEndShowStatusNetScripts($action)
 {
     $name = $action->arg('action');
     if ($name == 'invite') {
         $action->script($this->getPath() . '/js/whitelistinvite.js');
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:15,代码来源:DomainWhitelistPlugin.php

示例3: arg

 /**
  * Returns query argument or default value if not found. Certain
  * parameters used throughout the API are lightly scrubbed and
  * bounds checked.  This overrides Action::arg().
  *
  * @param string $key requested argument
  * @param string $def default value to return if $key is not provided
  *
  * @return var $var
  */
 function arg($key, $def = null)
 {
     // XXX: Do even more input validation/scrubbing?
     if (array_key_exists($key, $this->args)) {
         switch ($key) {
             case 'page':
                 $page = (int) $this->args['page'];
                 return $page < 1 ? 1 : $page;
             case 'count':
                 $count = (int) $this->args['count'];
                 if ($count < 1) {
                     return 20;
                 } elseif ($count > 200) {
                     return 200;
                 } else {
                     return $count;
                 }
             case 'since_id':
                 $since_id = (int) $this->args['since_id'];
                 return $since_id < 1 ? 0 : $since_id;
             case 'max_id':
                 $max_id = (int) $this->args['max_id'];
                 return $max_id < 1 ? 0 : $max_id;
             default:
                 return parent::arg($key, $def);
         }
     } else {
         return $def;
     }
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:40,代码来源:apiaction.php

示例4: onEndProfileFormData

 /**
  * Show a checkbox on the profile form to ask whether to follow everyone
  *
  * @param Action $action The action being executed
  *
  * @return boolean hook value
  */
 function onEndProfileFormData($action)
 {
     $user = common_current_user();
     $action->elementStart('li');
     // TRANS: Checkbox label in form for profile settings.
     $action->checkbox('followeveryone', _('Follow everyone'), $action->arg('followeveryone') ? $action->arg('followeveryone') : User_followeveryone_prefs::followEveryone($user->id));
     $action->elementEnd('li');
     return true;
 }
开发者ID:ronhuang,项目名称:statusnet,代码行数:16,代码来源:FollowEveryonePlugin.php

示例5: onEndShowSections

 function onEndShowSections(Action $action)
 {
     if ($action->arg('action') != 'showstream') {
         return true;
     }
     $cur = common_current_user();
     if (empty($cur) || !$cur->hasRight(self::VIEWMODLOG)) {
         return true;
     }
     $profile = $action->profile;
     $ml = new ModLog();
     $ml->profile_id = $profile->id;
     $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::getKV('id', $ml->moderator_id);
                 if (empty($mod)) {
                     $action->text(_('[unknown]'));
                 } else {
                     $action->element('a', array('href' => $mod->profileurl, 'title' => $mod->fullname), $mod->nickname);
                 }
             } else {
                 $action->text(_('[unknown]'));
             }
             $action->elementEnd('td');
             $action->elementEnd('tr');
         }
         $action->elementEnd('table');
         $action->elementEnd('div');
     }
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:40,代码来源:ModLogPlugin.php

示例6: onEndShowHeadElements

 public function onEndShowHeadElements(Action $action)
 {
     if ($action instanceof ShowNoticeAction) {
         // Showing a notice
         $notice = Notice::getKV('id', $action->arg('notice'));
         try {
             $flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE);
             $fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE);
         } catch (NoResultException $e) {
             return true;
         }
         $statusId = twitter_status_id($notice);
         if ($notice instanceof Notice && $notice->isLocal() && $statusId) {
             $tweetUrl = 'https://twitter.com/' . $fuser->nickname . '/status/' . $statusId;
             $action->element('link', array('rel' => 'syndication', 'href' => $tweetUrl));
         }
     }
     if (!$action instanceof AttachmentAction) {
         return true;
     }
     /* Twitter card support. See https://dev.twitter.com/docs/cards */
     /* @fixme: should we display twitter cards only for attachments posted
      *         by local users ? Seems mandatory to display twitter:creator
      *
      * Author: jbfavre
      */
     switch ($action->attachment->mimetype) {
         case 'image/pjpeg':
         case 'image/jpeg':
         case 'image/jpg':
         case 'image/png':
         case 'image/gif':
             $action->element('meta', array('name' => 'twitter:card', 'content' => 'photo'), null);
             $action->element('meta', array('name' => 'twitter:url', 'content' => common_local_url('attachment', array('attachment' => $action->attachment->id))), null);
             $action->element('meta', array('name' => 'twitter:image', 'content' => $action->attachment->url));
             $action->element('meta', array('name' => 'twitter:title', 'content' => $action->attachment->title));
             $ns = new AttachmentNoticeSection($action);
             $notices = $ns->getNotices();
             $noticeArray = $notices->fetchAll();
             // Should not have more than 1 notice for this attachment.
             if (count($noticeArray) != 1) {
                 break;
             }
             $post = $noticeArray[0];
             try {
                 $flink = Foreign_link::getByUserID($post->profile_id, TWITTER_SERVICE);
                 $fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE);
                 $action->element('meta', array('name' => 'twitter:creator', 'content' => '@' . $fuser->nickname));
             } catch (NoResultException $e) {
                 // no foreign link and/or user for Twitter on this profile ID
             }
             break;
         default:
             break;
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:57,代码来源:TwitterBridgePlugin.php


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