Exemple #1
0
 function page_general_stats($content)
 {
     $stats_display = get_option('stats_display');
     $str = _n('<strong>%s</strong> user online now.', '<strong>%s</strong> users online now.', get_users_online_count(), 'wp-useronline');
     if ($stats_display['useronline'] == 1) {
         $content .= html('p', html('strong', __('WP-UserOnline', 'wp-useronline'))) . html('ul', html('li', sprintf($str, number_format_i18n(get_users_online_count()))) . html('li', UserOnline_Template::format_most_users()));
     }
     return $content;
 }
Exemple #2
0
 function rightnow()
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     $total_users = get_users_online_count();
     $str = _n("There is <strong><a href='%s'>%s user</a></strong> online now.", "There are a total of <strong><a href='%s'>%s users</a></strong> online now.", $total_users, 'wp-useronline');
     $out = sprintf($str, add_query_arg('page', $this->args['page_slug'], admin_url('index.php')), number_format_i18n($total_users));
     $out .= '<br>';
     if ($tmp = get_users_browsing_site()) {
         $out .= $tmp . '<br>';
     }
     $out .= UserOnline_Template::format_most_users();
     echo html('p', $out);
 }
function users_online_page()
{
    global $wpdb;
    $usersonline = $wpdb->get_results("SELECT * FROM {$wpdb->useronline} ORDER BY timestamp DESC");
    $user_buckets = array();
    foreach ($usersonline as $useronline) {
        $user_buckets[$useronline->user_type][] = $useronline;
    }
    $user_buckets = apply_filters('useronline_buckets', $user_buckets);
    $counts = UserOnline_Template::get_counts($user_buckets);
    $nicetexts = array();
    foreach (array('user', 'member', 'guest', 'bot') as $user_type) {
        $nicetexts[$user_type] = UserOnline_Template::format_count($counts[$user_type], $user_type);
    }
    $text = _n('There is <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>.', 'There are a total of <strong>%s</strong> online now: <strong>%s</strong>, <strong>%s</strong> and <strong>%s</strong>.', $counts['user'], 'wp-useronline');
    $output = html('div id="useronline-details"', html('p', vsprintf($text, $nicetexts)) . html('p', UserOnline_Template::format_most_users()) . UserOnline_Template::detailed_list($counts, $user_buckets, $nicetexts));
    return apply_filters('useronline_page', $output);
}