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


PHP Subscription::count方法代码示例

本文整理汇总了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));
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:13,代码来源:command.php

示例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');
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:37,代码来源:showstream.php

示例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;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:18,代码来源:Profile.php


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