get_country_codes();
$result = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}statistics_useronline;" );
$total = count( $result );
if ( $total > 0 ) {
// Instantiate pagination object with appropriate arguments
$pagesPerSection = 10;
$options = 10;
$stylePageOff = "pageOff";
$stylePageOn = "pageOn";
$styleErrors = "paginationErrors";
$styleSelect = "paginationSelect";
$Pagination = new WP_Statistics_Pagination(
$total,
$pagesPerSection,
$options,
false,
$stylePageOff,
$stylePageOn,
$styleErrors,
$styleSelect
);
$start = $Pagination->getEntryStart();
$end = $Pagination->getEntryEnd();
echo "
";
$count = 0;
$dash_icon = wp_statistics_icons( 'dashicons-visibility', 'visibility' );
foreach ( $result as $items ) {
$count ++;
if ( $count >= $start ) {
if ( substr( $items->ip, 0, 6 ) == '#hash#' ) {
$ip_string = __( '#hash#', 'wp-statistics' );
$map_string = "";
} else {
$ip_string = "
ip}'>{$dash_icon}{$items->ip}";
$map_string
= "
" .
wp_statistics_icons( 'dashicons-location-alt', 'map' ) .
"";
}
echo "
";
echo "
";
echo $map_string;
if ( $WP_Statistics->get_option( 'geoip' ) ) {
echo "

location . '.png'
) .
"' title='{$ISOCountryCode[$items->location]}' class='log-tools'/>";
}
if ( array_search(
strtolower( $items->agent ),
array(
"chrome",
"firefox",
"msie",
"opera",
"safari",
)
) !== false
) {
$agent = "

agent .
".png' class='log-tools' title='{$items->agent}'/>";
} else {
$agent = wp_statistics_icons( 'dashicons-editor-help', 'unknown' );
}
echo "
agent}'>{$agent} {$items->ip}";
echo "
";
$timediff = ( $items->timestamp - $items->created );
if ( $timediff > 3600 ) {
$onlinefor = date( "H:i:s", ( $items->timestamp - $items->created ) );
} else if ( $timediff > 60 ) {
$onlinefor = "00:" . date( "i:s", ( $items->timestamp - $items->created ) );
} else {
$onlinefor = "00:00:" . date( "s", ( $items->timestamp - $items->created ) );
}
echo sprintf( __( 'Online for %s (HH:MM:SS)', 'wp-statistics' ), $onlinefor );
echo "
";
echo "
";
}
if ( $count == $start + 10 ) {
break;
}
}
echo "
";
} else {
echo "
" .
__( 'Currently there are no users online in the site.', 'wp-statistics' ) .
"
";
}
?>