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


PHP Profile::current方法代码示例

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


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

示例1: prepare

 function prepare($args)
 {
     Action::prepare($args);
     // skip the ProfileAction code and replace it...
     $id = $this->arg('id');
     $this->user = false;
     $this->profile = Profile::staticGet('id', $id);
     if (!$this->profile) {
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->serverError(_m('User has no profile.'));
         return false;
     }
     $user = User::staticGet('id', $this->profile->id);
     if ($user) {
         // This is a local user -- send to their regular profile.
         $url = common_local_url('showstream', array('nickname' => $user->nickname));
         common_redirect($url);
         return false;
     }
     $this->tag = $this->trimmed('tag');
     $this->page = $this->arg('page') ? $this->arg('page') + 0 : 1;
     common_set_returnto($this->selfUrl());
     $p = Profile::current();
     if (empty($this->tag)) {
         $stream = new ProfileNoticeStream($this->profile, $p);
     } else {
         $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p);
     }
     $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:31,代码来源:remoteprofileaction.php

示例2: prepare

 /**
  * Prepare the object
  *
  * Check the input values and initialize the object.
  * Shows an error page on bad input.
  *
  * @param array $args $_REQUEST data
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $nickname = common_canonical_nickname($this->arg('nickname'));
     $this->user = User::staticGet('nickname', $nickname);
     if (!$this->user) {
         // TRANS: Client error displayed when trying to reply to a non-exsting user.
         $this->clientError(_('No such user.'));
         return false;
     }
     $profile = $this->user->getProfile();
     if (!$profile) {
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->serverError(_('User has no profile.'));
         return false;
     }
     $this->page = $this->arg('page') ? $this->arg('page') + 0 : 1;
     common_set_returnto($this->selfUrl());
     $stream = new ReplyNoticeStream($this->user->id, Profile::current());
     $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
     if ($this->page > 1 && $this->notice->N == 0) {
         // TRANS: Server error when page not found (404)
         $this->serverError(_('No such page.'), $code = 404);
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:36,代码来源:replies.php

示例3: __construct

 function __construct($q, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new RawSearchNoticeStream($q), $profile);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:searchnoticestream.php

示例4: __construct

 function __construct($plist, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawPeopletagNoticeStream($plist), 'profile_list:notice_ids:' . $plist->id), $profile);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:peopletagnoticestream.php

示例5: __construct

 function __construct($profile, $tag, $userProfile = -1)
 {
     if (is_int($userProfile) && $userProfile == -1) {
         $userProfile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawTaggedProfileNoticeStream($profile, $tag), 'profile:notice_ids_tagged:' . $profile->id . ':' . Cache::keyize($tag)), $userProfile);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:taggedprofilenoticestream.php

示例6: getPeopletags

 function getPeopletags()
 {
     $limit = PEOPLETAGS_PER_SECTION + 1;
     $offset = 0;
     $ptags = $this->profile->getOtherTags(Profile::current(), $offset, $limit);
     return $ptags;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:peopletagsforusersection.php

示例7: __construct

 function __construct($tag, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawSpamNoticeStream(), 'spam_score:notice_ids'));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:spamnoticestream.php

示例8: __construct

 function __construct($profile, $userProfile = -1)
 {
     if (is_int($userProfile) && $userProfile == -1) {
         $userProfile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($profile), 'profile:notice_ids:' . $profile->id), $userProfile);
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:7,代码来源:profilenoticestream.php

示例9: __construct

 function __construct($userId, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawReplyNoticeStream($userId), 'reply:stream:' . $userId), $profile);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:replynoticestream.php

示例10: getTags

 function getTags()
 {
     $profile = Profile::current();
     $keypart = sprintf('Inbox:notice_tag:%d:%d', $this->user->id, $profile->id);
     $tag = Memcached_DataObject::cacheGet($keypart);
     if ($tag === false) {
         $stream = new InboxNoticeStream($this->user, $profile);
         $ids = $stream->getNoticeIds(0, Inbox::MAX_NOTICES, null, null);
         if (empty($ids)) {
             $tag = array();
         } else {
             $weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
             // @fixme should we use the cutoff too? Doesn't help with indexing per-user.
             $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' as weight ' . 'FROM notice_tag JOIN notice ' . 'ON notice_tag.notice_id = notice.id ' . 'WHERE notice.id in (' . implode(',', $ids) . ')' . 'GROUP BY notice_tag.tag ' . 'ORDER BY weight DESC ';
             $limit = TAGS_PER_SECTION;
             $offset = 0;
             if (common_config('db', 'type') == 'pgsql') {
                 $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
             } else {
                 $qry .= ' LIMIT ' . $offset . ', ' . $limit;
             }
             $t = new Notice_tag();
             $t->query($qry);
             $tag = array();
             while ($t->fetch()) {
                 $tag[] = clone $t;
             }
         }
         Memcached_DataObject::cacheSet($keypart, $tag, 3600);
     }
     return new ArrayWrapper($tag);
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:32,代码来源:inboxtagcloudsection.php

示例11: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $convId = $this->trimmed('id');
     if (empty($convId)) {
         // TRANS: Client exception thrown when no conversation ID is given.
         throw new ClientException(_('No conversation ID.'));
     }
     $this->conversation = Conversation::staticGet('id', $convId);
     if (empty($this->conversation)) {
         // TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
         $this->clientError(_('No conversation ID found'), 404);
         return false;
     }
     $profile = Profile::current();
     $stream = new ConversationNoticeStream($convId, $profile);
     $notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
     $this->notices = $notice->fetchAll();
     $originalConversation = new Notice();
     $originalConversation->whereAdd('conversation=' . $convId);
     $originalConversation->limit(1);
     $originalConversation->orderBy('created');
     $originalConversation->find();
     if ($originalConversation->fetch()) {
         $this->originalNotice = $originalConversation;
     }
     return true;
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:35,代码来源:apiconversation.php

示例12: __construct

 function __construct($tag, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawTagNoticeStream($tag), 'notice_tag:notice_ids:' . Cache::keyize($tag)));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:tagnoticestream.php

示例13: __construct

 function __construct($user, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawRepeatsOfMeNoticeStream($user), 'user:repeats_of_me:' . $user->id), $profile);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:repeatsofmenoticestream.php

示例14: __construct

 function __construct($file, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new CachingNoticeStream(new RawFileNoticeStream($file), 'file:notice-ids:' . $this->url), $profile);
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:7,代码来源:filenoticestream.php

示例15: __construct

 function __construct($id, $profile = -1)
 {
     if (is_int($profile) && $profile == -1) {
         $profile = Profile::current();
     }
     parent::__construct(new RawConversationNoticeStream($id), $profile);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:conversationnoticestream.php


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