forked from cynial/STBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStats.php
More file actions
112 lines (102 loc) · 2.5 KB
/
Stats.php
File metadata and controls
112 lines (102 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php if (!defined('BASEPATH')) exit('No direct access allowed.');
/**
* STBlog Blogging System
*
* 基于Codeigniter的单用户多权限开源博客系统
*
* STBlog is an open source multi-privilege blogging System built on the
* well-known PHP framework Codeigniter.
*
* @package STBLOG
* @author Saturn <[email protected]>
* @copyright Copyright (c) 2009 - 2010, cnsaturn.com.
* @license GNU General Public License 2.0
* @link http://code.google.com/p/stblog/
* @version 0.1.0
*/
// ------------------------------------------------------------------------
/**
* Stats Library Class
*
* 常用数据统计类
*
*
* @package STBLOG
* @subpackage Libraries
* @category Libraries
* @author Saturn <[email protected]>
* @link http://code.google.com/p/stblog/
*/
class Stats
{
/**
* CI句柄
*
* @access private
* @var object
*/
private $_CI;
/**
* 构造函数
*
* @access public
* @return void
*/
public function __construct()
{
/** 获取CI句柄 */
$this->_CI = & get_instance();
log_message('debug', "STBLOG: Statistics library Class Initialized");
}
/**
* 分类数目
*
* @access public
* @return integer
*/
public function count_categories()
{
return $this->_CI->metas_mdl->count_metas();
}
/**
* 根据作者计算评论个数
*
* @access public
* @param string $type 类型
* @param string $status 状态
* @param integer $uid 作者ID
* @return integer
*/
public function count_cmts_by_owner($type = 'comment', $status = 'approved', $uid = NULL)
{
return $this->_CI->comments_mdl->get_cmts_by_owner($type, $status, $uid, 10000, 0)->num_rows();
}
/**
* 计算评论个数
*
* @access public
* @param string $pid 文章ID
* @param string $type 类型
* @param string $status 状态
* @return integer
*/
public function count_cmts($pid, $type = 'comment', $status = 'approved')
{
return $this->_CI->comments_mdl->get_cmts($pid, $type, $status, 10000, 0)->num_rows();
}
/**
* 计算文章个数
*
* @access public
* @param string $type 类型
* @param string $status 状态
* @param integer $uid 作者ID
* @return integer
*/
public function count_posts($type = 'post', $status = 'publish', $uid = NULL)
{
return $this->_CI->posts_mdl->get_posts($type, $status, $uid, 10000,0)->num_rows();
}
}
/* End of file Stats.php */
/* Location: ./application/libraries/Stats.php */