本文整理汇总了PHP中Subscription::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::count方法的具体用法?PHP Subscription::count怎么用?PHP Subscription::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($channel)
{
$subs = new Subscription();
$subs->subscriber = $this->user->id;
$subs_count = (int) $subs->count() - 1;
$subbed = new Subscription();
$subbed->subscribed = $this->user->id;
$subbed_count = (int) $subbed->count() - 1;
$notices = new Notice();
$notices->profile_id = $this->user->id;
$notice_count = (int) $notices->count();
$channel->output($this->user, sprintf(_("Subscriptions: %1\$s\n" . "Subscribers: %2\$s\n" . "Notices: %3\$s"), $subs_count, $subbed_count, $notice_count));
}
示例2: showStatistics
function showStatistics()
{
// XXX: WORM cache this
$subs = new Subscription();
$subs->subscriber = $this->profile->id;
$subs_count = (int) $subs->count() - 1;
$subbed = new Subscription();
$subbed->subscribed = $this->profile->id;
$subbed_count = (int) $subbed->count() - 1;
$notices = new Notice();
$notices->profile_id = $this->profile->id;
$notice_count = (int) $notices->count();
$this->elementStart('div', array('id' => 'entity_statistics', 'class' => 'section'));
$this->element('h2', null, _('Statistics'));
// Other stats...?
$this->elementStart('dl', 'entity_member-since');
$this->element('dt', null, _('Member since'));
$this->element('dd', null, date('j M Y', strtotime($this->profile->created)));
$this->elementEnd('dl');
$this->elementStart('dl', 'entity_subscriptions');
$this->elementStart('dt');
$this->element('a', array('href' => common_local_url('subscriptions', array('nickname' => $this->profile->nickname))), _('Subscriptions'));
$this->elementEnd('dt');
$this->element('dd', null, is_int($subs_count) ? $subs_count : '0');
$this->elementEnd('dl');
$this->elementStart('dl', 'entity_subscribers');
$this->elementStart('dt');
$this->element('a', array('href' => common_local_url('subscribers', array('nickname' => $this->profile->nickname))), _('Subscribers'));
$this->elementEnd('dt');
$this->element('dd', 'subscribers', is_int($subbed_count) ? $subbed_count : '0');
$this->elementEnd('dl');
$this->elementStart('dl', 'entity_notices');
$this->element('dt', null, _('Notices'));
$this->element('dd', null, is_int($notice_count) ? $notice_count : '0');
$this->elementEnd('dl');
$this->elementEnd('div');
}
示例3: subscriberCount
function subscriberCount()
{
$c = common_memcache();
if (!empty($c)) {
$cnt = $c->get(common_cache_key('profile:subscriber_count:' . $this->id));
if (is_integer($cnt)) {
return (int) $cnt;
}
}
$sub = new Subscription();
$sub->subscribed = $this->id;
$sub->whereAdd('subscriber != subscribed');
$cnt = (int) $sub->count('distinct subscriber');
if (!empty($c)) {
$c->set(common_cache_key('profile:subscriber_count:' . $this->id), $cnt);
}
return $cnt;
}