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 = "
{$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} {$items->ip}";
echo "
";
echo __('Online for ', 'wp_statistics');
$timediff = ($items->timestamp - $items->created);
if( $timediff > 3600 ) {
echo date( "H:i:s", ($items->timestamp - $items->created) );
}
else if( $timediff > 60 ) {
echo "00:" . date( "i:s", ($items->timestamp - $items->created) );
}
else {
echo "00:00:" . date( "s", ($items->timestamp - $items->created) );
}
echo " (HH:MM:SS)";
echo "
";
echo "
";
}
if( $count == $start + 10 ) { break; }
}
echo "
";
} else {
echo "
".__('Currently there are no users online in the site.', 'wp_statistics')."
";
}
?>