本文整理汇总了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;
}
示例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;
}
示例3: __construct
function __construct($q, $profile = -1)
{
if (is_int($profile) && $profile == -1) {
$profile = Profile::current();
}
parent::__construct(new RawSearchNoticeStream($q), $profile);
}
示例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);
}
示例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);
}
示例6: getPeopletags
function getPeopletags()
{
$limit = PEOPLETAGS_PER_SECTION + 1;
$offset = 0;
$ptags = $this->profile->getOtherTags(Profile::current(), $offset, $limit);
return $ptags;
}
示例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'));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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)));
}
示例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);
}
示例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);
}
示例15: __construct
function __construct($id, $profile = -1)
{
if (is_int($profile) && $profile == -1) {
$profile = Profile::current();
}
parent::__construct(new RawConversationNoticeStream($id), $profile);
}