public static function ShareaholicUtilities::get_stats in Share Buttons, Related Posts, Content Analytics - Shareaholic 8
Same name and namespace in other branches
- 7.3 utilities.php \ShareaholicUtilities::get_stats()
Get the stats for this website Stats include: total number of pages by type, total comments, total users
Return value
array an associative array of stats => counts
1 call to ShareaholicUtilities::get_stats()
- ShareaholicUtilities::log_event in ./
utilities.php - This is a wrapper for the Event API
File
- ./
utilities.php, line 760
Class
Code
public static function get_stats() {
$stats = array();
// Query the database for content types and add to stats
$result = db_query("SELECT type, count(*) as count FROM {node} GROUP BY type");
foreach ($result as $record) {
$stats[$record->type . '_total'] = $record->count;
}
// Get the total comments
$stats['comments_total'] = self::total_comments();
return $stats;
}