| 1 |
<?php |
|---|
| 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 |
if (!defined('WP_CONTENT_DIR')) { |
|---|
| 33 |
define( 'WP_CONTENT_DIR', ABSPATH.'wp-content'); |
|---|
| 34 |
} |
|---|
| 35 |
if (!defined('WP_CONTENT_URL')) { |
|---|
| 36 |
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content'); |
|---|
| 37 |
} |
|---|
| 38 |
if (!defined('WP_PLUGIN_DIR')) { |
|---|
| 39 |
define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins'); |
|---|
| 40 |
} |
|---|
| 41 |
if (!defined('WP_PLUGIN_URL')) { |
|---|
| 42 |
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins'); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
add_action('init', 'stats_textdomain'); |
|---|
| 48 |
function stats_textdomain() { |
|---|
| 49 |
if (!function_exists('wp_print_styles')) { |
|---|
| 50 |
load_plugin_textdomain('wp-stats', 'wp-content/plugins/wp-stats'); |
|---|
| 51 |
} else { |
|---|
| 52 |
load_plugin_textdomain('wp-stats', false, 'wp-stats'); |
|---|
| 53 |
} |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
add_action('admin_menu', 'stats_menu'); |
|---|
| 59 |
function stats_menu() { |
|---|
| 60 |
if (function_exists('add_submenu_page')) { |
|---|
| 61 |
add_submenu_page('index.php', __('WP-Stats', 'wp-stats'), __('WP-Stats', 'wp-stats'), 1, 'wp-stats/wp-stats.php', 'display_stats'); |
|---|
| 62 |
} |
|---|
| 63 |
if (function_exists('add_options_page')) { |
|---|
| 64 |
add_options_page(__('Stats', 'wp-stats'), __('Stats', 'wp-stats'), 'manage_options', 'wp-stats/stats-options.php'); |
|---|
| 65 |
} |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
add_action('wp_head', 'stats_css'); |
|---|
| 71 |
function stats_css() { |
|---|
| 72 |
if(!function_exists('pagenavi_css')) { |
|---|
| 73 |
echo "\n".'<!-- Start Of Script Generated By WP-Stats 2.31 -->'."\n"; |
|---|
| 74 |
if(@file_exists(TEMPLATEPATH.'/stats-css.css')) { |
|---|
| 75 |
echo '<link rel="stylesheet" href="'.get_stylesheet_directory_uri().'/stats-css.css" type="text/css" media="screen" />'."\n"; |
|---|
| 76 |
} else { |
|---|
| 77 |
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/wp-stats/stats-css.css" type="text/css" media="screen" />'."\n"; |
|---|
| 78 |
} |
|---|
| 79 |
echo '<!-- End Of Script Generated By WP-Stats 2.31 -->'."\n"; |
|---|
| 80 |
} |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
function display_stats() { |
|---|
| 86 |
$stats_page = stats_page(); |
|---|
| 87 |
echo "<div class=\"wrap\">\n$stats_page</div>\n"; |
|---|
| 88 |
} |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
function get_totalauthors($display = true) { |
|---|
| 93 |
global $wpdb; |
|---|
| 94 |
$totalauthors = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users LEFT JOIN $wpdb->usermeta ON $wpdb->usermeta.user_id = $wpdb->users.ID WHERE $wpdb->users.user_activation_key = '' AND $wpdb->usermeta.meta_key = '".$wpdb->prefix."user_level' AND (meta_value+0.00) > 1"); |
|---|
| 95 |
if($display) { |
|---|
| 96 |
echo number_format($totalauthors); |
|---|
| 97 |
} else { |
|---|
| 98 |
return number_format($totalauthors); |
|---|
| 99 |
} |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
function get_totalposts($display = true) { |
|---|
| 105 |
global $wpdb; |
|---|
| 106 |
$totalposts = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); |
|---|
| 107 |
if($display) { |
|---|
| 108 |
echo number_format($totalposts); |
|---|
| 109 |
} else { |
|---|
| 110 |
return number_format($totalposts); |
|---|
| 111 |
} |
|---|
| 112 |
} |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
function get_totalpages($display = true) { |
|---|
| 117 |
global $wpdb; |
|---|
| 118 |
$totalpages = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish'"); |
|---|
| 119 |
if($display) { |
|---|
| 120 |
echo number_format($totalpages); |
|---|
| 121 |
} else { |
|---|
| 122 |
return number_format($totalpages); |
|---|
| 123 |
} |
|---|
| 124 |
} |
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
function get_totalcomments($display = true) { |
|---|
| 129 |
global $wpdb; |
|---|
| 130 |
$totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = '1'"); |
|---|
| 131 |
if($display) { |
|---|
| 132 |
echo number_format($totalcomments); |
|---|
| 133 |
} else { |
|---|
| 134 |
return number_format($totalcomments); |
|---|
| 135 |
} |
|---|
| 136 |
} |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
function get_totalcommentposters($display = true) { |
|---|
| 141 |
global $wpdb; |
|---|
| 142 |
$totalcommentposters = $wpdb->get_var("SELECT COUNT(DISTINCT comment_author) FROM $wpdb->comments WHERE comment_approved = '1' AND comment_type = ''"); |
|---|
| 143 |
if($display) { |
|---|
| 144 |
echo number_format($totalcommentposters); |
|---|
| 145 |
} else { |
|---|
| 146 |
return number_format($totalcommentposters); |
|---|
| 147 |
} |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
function get_totallinks($display = true) { |
|---|
| 153 |
global $wpdb; |
|---|
| 154 |
$totallinks = $wpdb->get_var("SELECT COUNT(link_id) FROM $wpdb->links"); |
|---|
| 155 |
if($display) { |
|---|
| 156 |
echo number_format($totallinks); |
|---|
| 157 |
} else { |
|---|
| 158 |
return number_format($totallinks); |
|---|
| 159 |
} |
|---|
| 160 |
} |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
function get_recentposts($mode = '', $limit = 10, $display = true) { |
|---|
| 165 |
global $wpdb, $post; |
|---|
| 166 |
$where = ''; |
|---|
| 167 |
$temp = ''; |
|---|
| 168 |
if(!empty($mode) && $mode != 'both') { |
|---|
| 169 |
$where = "post_type = '$mode'"; |
|---|
| 170 |
} else { |
|---|
| 171 |
$where = '1=1'; |
|---|
| 172 |
} |
|---|
| 173 |
$recentposts = $wpdb->get_results("SELECT $wpdb->posts.*, $wpdb->users.* FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE user_activation_key = '' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER BY post_date DESC LIMIT $limit"); |
|---|
| 174 |
if($recentposts) { |
|---|
| 175 |
foreach ($recentposts as $post) { |
|---|
| 176 |
$post_title = get_the_title(); |
|---|
| 177 |
$post_date = get_the_time(get_option('date_format').' @ '.get_option('time_format')); |
|---|
| 178 |
$display_name = stripslashes($post->display_name); |
|---|
| 179 |
$temp .= "<li>$post_date - <a href=\"".get_permalink()."\" title=\"".sprintf(__('View post %s', 'wp-stats'), $post_title)."\">$post_title</a> ($display_name)</li>\n"; |
|---|
| 180 |
} |
|---|
| 181 |
} else { |
|---|
| 182 |
$temp = '<li>'.__('N/A', 'wp-stats').'</li>'; |
|---|
| 183 |
} |
|---|
| 184 |
if($display) { |
|---|
| 185 |
echo $temp; |
|---|
| 186 |
} else { |
|---|
| 187 |
return $temp; |
|---|
| 188 |
} |
|---|
| 189 |
} |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
function get_recentcomments($mode = '', $limit = 10, $display = true) { |
|---|
| 194 |
global $wpdb, $post; |
|---|
| 195 |
$where = ''; |
|---|
| 196 |
$temp = ''; |
|---|
| 197 |
if(!empty($mode) && $mode != 'both') { |
|---|
| 198 |
$where = "post_type = '$mode'"; |
|---|
| 199 |
} else { |
|---|
| 200 |
$where = '1=1'; |
|---|
| 201 |
} |
|---|
| 202 |
$recentcomments = $wpdb->get_results("SELECT * FROM $wpdb->posts INNER JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND comment_type = '' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER BY comment_date DESC LIMIT $limit"); |
|---|
| 203 |
if($recentcomments) { |
|---|
| 204 |
foreach ($recentcomments as $post) { |
|---|
| 205 |
$post_title = get_the_title(); |
|---|
| 206 |
$comment_author = htmlspecialchars(stripslashes($post->comment_author)); |
|---|
| 207 |
$comment_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), $post->comment_date); |
|---|
| 208 |
$temp .= "<li>$comment_date - $comment_author (<a href=\"".get_permalink()."#comment-".$post->comment_ID."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">$post_title</a>)</li>\n"; |
|---|
| 209 |
} |
|---|
| 210 |
} else { |
|---|
| 211 |
$temp = '<li>'.__('N/A', 'wp-stats').'</li>'; |
|---|
| 212 |
} |
|---|
| 213 |
if($display) { |
|---|
| 214 |
echo $temp; |
|---|
| 215 |
} else { |
|---|
| 216 |
return $temp; |
|---|
| 217 |
} |
|---|
| 218 |
} |
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
function get_mostcommented($mode = '', $limit = 10, $chars = 0, $display = true) { |
|---|
| 223 |
global $wpdb, $post; |
|---|
| 224 |
$where = ''; |
|---|
| 225 |
$temp = ''; |
|---|
| 226 |
if(!empty($mode) && $mode != 'both') { |
|---|
| 227 |
$where = "post_type = '$mode'"; |
|---|
| 228 |
} else { |
|---|
| 229 |
$where = '1=1'; |
|---|
| 230 |
} |
|---|
| 231 |
$mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.*, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit"); |
|---|
| 232 |
if($mostcommenteds) { |
|---|
| 233 |
if($chars > 0) { |
|---|
| 234 |
foreach ($mostcommenteds as $post) { |
|---|
| 235 |
$post_title = get_the_title(); |
|---|
| 236 |
$comment_total = number_format_i18n($post->comment_total); |
|---|
| 237 |
$temp .= "<li><a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">".snippet_text($post_title, $chars)."</a> - $comment_total ".__('comments', 'wp-stats')."</li>"; |
|---|
| 238 |
} |
|---|
| 239 |
} else { |
|---|
| 240 |
foreach ($mostcommenteds as $post) { |
|---|
| 241 |
$post_title = get_the_title(); |
|---|
| 242 |
$comment_total = number_format_i18n($post->comment_total); |
|---|
| 243 |
$temp .= "<li><a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">$post_title</a> - $comment_total ".__('comments', 'wp-stats')."</li>"; |
|---|
| 244 |
} |
|---|
| 245 |
} |
|---|
| 246 |
} else { |
|---|
| 247 |
$temp = '<li>'.__('N/A', 'wp-stats').'</li>'; |
|---|
| 248 |
} |
|---|
| 249 |
if($display) { |
|---|
| 250 |
echo $temp; |
|---|
| 251 |
} else { |
|---|
| 252 |
return $temp; |
|---|
| 253 |
} |
|---|
| 254 |
} |
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
function get_authorsstats($mode = '', $display = true) { |
|---|
| 259 |
global $wpdb, $wp_rewrite; |
|---|
| 260 |
$where = ''; |
|---|
| 261 |
$temp = ''; |
|---|
| 262 |
if(!empty($mode) && $mode != 'both') { |
|---|
| 263 |
$where = "post_type = '$mode'"; |
|---|
| 264 |
} else { |
|---|
| 265 |
$where = '1=1'; |
|---|
| 266 |
} |
|---|
| 267 |
$posts = $wpdb->get_results("SELECT COUNT($wpdb->posts.ID) AS 'posts_total', $wpdb->users.display_name, $wpdb->users.user_nicename FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE user_activation_key = '' AND $where AND post_status = 'publish' GROUP BY $wpdb->posts.post_author"); |
|---|
| 268 |
if($posts) { |
|---|
| 269 |
$using_permalink = get_option('permalink_structure'); |
|---|
| 270 |
$permalink = $wp_rewrite->get_author_permastruct(); |
|---|
| 271 |
foreach ($posts as $post) { |
|---|
| 272 |
$post_author = strip_tags(stripslashes($post->user_nicename)); |
|---|
| 273 |
$author_link = str_replace('%author%', $post_author, $permalink); |
|---|
| 274 |
$display_name = strip_tags(stripslashes($post->display_name)); |
|---|
| 275 |
$posts_total = number_format_i18n($post->posts_total); |
|---|
| 276 |
if($using_permalink) { |
|---|
| 277 |
$temp .= "<li><a href=\"".get_option('home').$author_link."\" title=\"".sprintf(__('View posts posted by %s', 'wp-stats'), $display_name)."\">$display_name</a> ($posts_total)</li>\n"; |
|---|
| 278 |
} else { |
|---|
| 279 |
$temp .= "<li><a href=\"".get_option('siteurl')."/?author_name=$post_author\" title=\"".sprintf(__('View posts posted by %s', 'wp-stats'), $display_name)."\">$display_name</a> ($posts_total)</li>\n"; |
|---|
| 280 |
} |
|---|
| 281 |
} |
|---|
| 282 |
} else { |
|---|
| 283 |
$temp = '<li>'.__('N/A', 'wp-stats').'</li>'; |
|---|
| 284 |
} |
|---|
| 285 |
if($display) { |
|---|
| 286 |
echo $temp; |
|---|
| 287 |
} else { |
|---|
| 288 |
return $temp; |
|---|
| 289 |
} |
|---|
| 290 |
} |
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 |
|
|---|
| 296 |
function get_commentmembersstats($threshhold = -1, $limit = 0, $display = true) { |
|---|
| 297 |
global $wpdb; |
|---|
| 298 |
$temp = ''; |
|---|
| 299 |
$limit_sql = ''; |
|---|
| 300 |
if($limit > 0) { |
|---|
| 301 |
$limit_sql = "LIMIT $limit"; |
|---|
| 302 |
} |
|---|
| 303 |
$comments = $wpdb->get_results("SELECT comment_author, COUNT(comment_ID) AS 'comment_total' FROM $wpdb->comments INNER JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_approved = '1' AND comment_type = '' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' GROUP BY comment_author ORDER BY comment_total DESC $limit_sql"); |
|---|
| 304 |
if($comments) { |
|---|
| 305 |
foreach ($comments as $comment) { |
|---|
| 306 |
$comment_total = intval($comment->comment_total); |
|---|
| 307 |
|
|---|
| 308 |
if($comment_total >= $threshhold) { |
|---|
| 309 |
$comment_author = strip_tags(stripslashes($comment->comment_author)); |
|---|
| 310 |
$comment_author_link = urlencode($comment_author); |
|---|
| 311 |
$temp .= "<li><a href=\"".stats_page_link($comment_author_link)."\" title=\"".sprintf(__('View all comments posted by %s', 'wp-stats'), $comment_author)."\">$comment_author</a> (".number_format_i18n($comment_total).")</li>\n"; |
|---|
| 312 |
} |
|---|
| 313 |
} |
|---|
| 314 |
} else { |
|---|
| 315 |
$temp = '<li>'.__('N/A', 'wp-stats').'</li>'; |
|---|
| 316 |
} |
|---|
| 317 |
if($display) { |
|---|
| 318 |
echo $temp; |
|---|
| 319 |
} else { |
|---|
| 320 |
return $temp; |
|---|
| 321 |
} |
|---|
| 322 |
} |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
function get_postcats($display = true) { |
|---|
| 327 |
global $wpdb; |
|---|
| 328 |
$temp = ''; |
|---|
| 329 |
$defaults = array('type' => 'post', 'style' => 'list', 'show_count' => 1); |
|---|
| 330 |
$categories = get_categories($defaults); |
|---|
| 331 |
if (empty($categories)){ |
|---|
| 332 |
$temp .= '<li>'.__('No categories', 'wp-stats').'</li>'; |
|---|
| 333 |
} else { |
|---|
| 334 |
$temp .= walk_category_tree($categories, 0, $defaults); |
|---|
| 335 |
} |
|---|
| 336 |
if($display) { |
|---|
| 337 |
echo $temp; |
|---|
| 338 |
} else { |
|---|
| 339 |
return $temp; |
|---|
| 340 |
} |
|---|
| 341 |
} |
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
function get_linkcats($display = true) { |
|---|
| 346 |
global $wpdb; |
|---|
| 347 |
$temp = ''; |
|---|
| 348 |
$cats = get_categories('type=link'); |
|---|
| 349 |
if ($cats) { |
|---|
| 350 |
foreach ($cats as $cat) { |
|---|
| 351 |
$temp .= '<li>'.$cat->cat_name.' ('.number_format_i18n($cat->count).")</li>\n"; |
|---|
| 352 |
} |
|---|
| 353 |
} |
|---|
| 354 |
if($display) { |
|---|
| 355 |
echo $temp; |
|---|
| 356 |
} else { |
|---|
| 357 |
return $temp; |
|---|
| 358 |
} |
|---|
| 359 |
} |
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
function get_tags_list($display = true) { |
|---|
| 364 |
global $wpdb; |
|---|
| 365 |
$temp = ''; |
|---|
| 366 |
$tags = get_tags('orderby=count&order=DESC'); |
|---|
| 367 |
if ($tags) { |
|---|
| 368 |
foreach ($tags as $tag) { |
|---|
| 369 |
$temp .= '<li><a href="'.clean_url(get_tag_link($tag->term_id)).'" title="'.sprintf(__('%s topics', 'wp-stats'), number_format_i18n($tag->count)).'">'.$tag->name.'</a> ('.number_format_i18n($tag->count).")</li>\n"; |
|---|
| 370 |
} |
|---|
| 371 |
} |
|---|
| 372 |
if($display) { |
|---|
| 373 |
echo $temp; |
|---|
| 374 |
} else { |
|---|
| 375 |
return $temp; |
|---|
| 376 |
} |
|---|
| 377 |
} |
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
if(!function_exists('snippet_text')) { |
|---|
| 382 |
function snippet_text($text, $length = 0) { |
|---|
| 383 |
$text = html_entity_decode($text, ENT_QUOTES, get_option('blog_charset')); |
|---|
| 384 |
if (strlen($text) > $length) { |
|---|
| 385 |
return htmlentities(substr($text,0,$length), ENT_COMPAT, get_option('blog_charset')).'...'; |
|---|
| 386 |
} else { |
|---|
| 387 |
return htmlentities($text, ENT_COMPAT, get_option('blog_charset')); |
|---|
| 388 |
} |
|---|
| 389 |
} |
|---|
| 390 |
} |
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
add_shortcode('page_stats', 'stats_page_shortcode'); |
|---|
| 395 |
function stats_page_shortcode($atts) { |
|---|
| 396 |
return stats_page(); |
|---|
| 397 |
} |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
function stats_page_link($author, $page = 0) { |
|---|
| 402 |
$stats_url = get_option('stats_url'); |
|---|
| 403 |
if($page > 1) { |
|---|
| 404 |
$page = "&stats_page=$page"; |
|---|
| 405 |
} else { |
|---|
| 406 |
$page = ''; |
|---|
| 407 |
} |
|---|
| 408 |
if(strpos($stats_url, '?') !== false) { |
|---|
| 409 |
$stats_url = "$stats_url&stats_author=$author$page"; |
|---|
| 410 |
} else { |
|---|
| 411 |
$stats_url = "$stats_url?stats_author=$author$page"; |
|---|
| 412 |
} |
|---|
| 413 |
return $stats_url; |
|---|
| 414 |
} |
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
function stats_page() { |
|---|
| 419 |
global $wpdb, $post; |
|---|
| 420 |
|
|---|
| 421 |
$comment_author = urldecode(strip_tags(stripslashes(trim($_GET['stats_author'])))); |
|---|
| 422 |
$page = intval($_GET['stats_page']); |
|---|
| 423 |
$temp_stats = ''; |
|---|
| 424 |
$temp_post = $post; |
|---|
| 425 |
$stats_mostlimit = intval(get_option('stats_mostlimit')); |
|---|
| 426 |
$stats_display = get_option('stats_display'); |
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
if(empty($comment_author)) { |
|---|
| 430 |
|
|---|
| 431 |
if($stats_display['total_stats'] == 1) { |
|---|
| 432 |
$temp_stats .= '<h2 id="GeneralStats">'.__('General Stats', 'wp-stats').'</h2>'."\n"; |
|---|
| 433 |
$temp_stats .= '<p><strong>'.__('Total Stats', 'wp-stats').'</strong></p>'."\n"; |
|---|
| 434 |
$temp_stats .= '<ul>'."\n"; |
|---|
| 435 |
$temp_stats .= '<li><strong>'.get_totalauthors(false).'</strong> '.__('authors to this blog.', 'wp-stats').'</li>'."\n"; |
|---|
| 436 |
$temp_stats .= '<li><strong>'.get_totalposts(false).'</strong> '.__('posts were posted.', 'wp-stats').'</li>'."\n"; |
|---|
| 437 |
$temp_stats .= '<li><strong>'.get_totalpages(false).'</strong> '.__('pages were created.', 'wp-stats').'</li>'."\n"; |
|---|
| 438 |
$temp_stats .= '<li><strong>'.wp_count_terms('post_tag').'</strong> '.__('tags were created.', 'wp-stats').'</li>'."\n"; |
|---|
| 439 |
$temp_stats .= '<li><strong>'.get_totalcomments(false).'</strong> '.__('comments were posted.', 'wp-stats').'</li>'."\n"; |
|---|
| 440 |
$temp_stats .= '<li><strong>'.get_totalcommentposters(false).'</strong> '.__('different nicknames were represented in the comments.', 'wp-stats').'</li>'."\n"; |
|---|
| 441 |
$temp_stats .= '<li><strong>'.get_totallinks(false).'</strong> '.__('links were added.', 'wp-stats').'</li>'."\n"; |
|---|
| 442 |
$temp_stats .= '<li><strong>'.wp_count_terms('category').'</strong> '.__('post categories were needed.', 'wp-stats').'</li>'."\n"; |
|---|
| 443 |
$temp_stats .= '<li><strong>'.wp_count_terms('link_category').'</strong> '.__('link categories were needed.', 'wp-stats').'</li>'."\n"; |
|---|
| 444 |
if(function_exists('akismet_spam_count')) { |
|---|
| 445 |
$temp_stats .= '<li><strong>'.number_format(get_option('akismet_spam_count')).'</strong> '.__('spam blocked.', 'wp-stats').'</li>'."\n"; |
|---|
| 446 |
} |
|---|
| 447 |
|
|---|
| 448 |
$temp_stats = apply_filters('wp_stats_page_general', $temp_stats); |
|---|
| 449 |
$temp_stats .= '</ul>'."\n"; |
|---|
| 450 |
} |
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
$temp_stats .= '<h2 id="PluginsStats">'.__('Plugins Stats', 'wp-stats').'</h2>'."\n"; |
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
$temp_stats = apply_filters('wp_stats_page_plugins', $temp_stats); |
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
$temp_stats .= '<h2 id="TopRecentStats">'.sprintf(__('Top %s Recent Stats', 'wp-stats'), $stats_mostlimit).'</h2>'."\n"; |
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
if($stats_display['recent_posts'] == 1) { |
|---|
| 463 |
$temp_stats .= '<p><strong>'.$stats_mostlimit.' '.__('Recent Posts', 'wp-stats').'</strong></p>'."\n"; |
|---|
| 464 |
$temp_stats .= '<ul>'."\n"; |
|---|
| 465 |
$temp_stats .= |
|---|