public function counterize_get_hits() { $sincetoday = time() - strtotime('today'); ?> <table id="counterizehitcountertable" width="100%" cellpadding="3" cellspacing="3" summary="<?php _e('Traffic statistics', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "> <tr> <td scope="col" style="width: 17%" align="center"> </td> <td scope="col" style="width: 16%" align="center"> <strong><?php _e('Today', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong> </td> <td scope="col" style="width: 17%" align="center"> <strong><?php _e('Last 24 hours', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong> </td> <td scope="col" style="width: 17%" align="center"> <strong><?php _e('Last 7 days', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong> </td> <td scope="col" style="width: 17%" align="center"> <strong><?php _e('Last 30 days', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong> </td> <td scope="col" style="width: 16%" align="center"> <strong><?php _e('Total', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong> </td> </tr> <tr class="alternate"> <td align="center" class="counterize_caption_help"><strong title="<?php _e('A hit is counted each time a ressource is fetched. The resource is not necessarily an existing page or post.', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Hits', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php echo counterize_getamount(false, $sincetoday); ?> </td> <td align="center"><?php echo counterize_getamount(false, 86400); ?> </td> <td align="center"><?php echo counterize_getamount(false, 604800); ?> </td> <td align="center"><?php echo counterize_getamount(false, 2592000); ?> </td> <td align="center"><?php echo counterize_getamount(); ?> </td> </tr> <tr> <td align="center" class="counterize_caption_help"><strong title="<?php _e('A page view is counted each time a hit concerns a valid page or post', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Pages views', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php echo counterize_getpagesamount($sincetoday); ?> </td> <td align="center"><?php echo counterize_getpagesamount(86400); ?> </td> <td align="center"><?php echo counterize_getpagesamount(604800); ?> </td> <td align="center"><?php echo counterize_getpagesamount(2592000); ?> </td> <td align="center"><?php echo counterize_getpagesamount(); ?> </td> </tr> <tr class="alternate"> <td align="center" class="counterize_caption_help"><strong title="<?php _e('A unique visitor is counted only the first time its IP is recorded.', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Unique visitors', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php echo counterize_getuniqueamount($sincetoday); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(86400); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(604800); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(2592000); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(); ?> </td> </tr> <tr> <td align="center" class="counterize_caption_help"><strong title="<?php _e('A visit will be counted again each time two or more hits from the same visitor are separated of more than 1 hour.', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Unique visitors ‪(1h interval)‬', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php echo counterize_getuniqueamount($sincetoday, 3600); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(86400, 3600); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(604800, 3600); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(2592000, 3600); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(0, 3600); ?> </td> </tr> <tr class="alternate"> <td align="center" class="counterize_caption_help"><strong title="<?php _e('A visit will be counted again each time two or more hits from the same visitor are separated of more than 30 minutes.', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Unique visitors ‪(30 min interval)‬', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php echo counterize_getuniqueamount($sincetoday, 1800); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(86400, 1800); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(604800, 1800); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(2592000, 1800); ?> </td> <td align="center"><?php echo counterize_getuniqueamount(0, 1800); ?> </td> </tr> <tr> <td align="center" class="counterize_caption_help"><strong title="<?php _e('The number of hits per unique visitor.', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Hits per unique visitor', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php $res = counterize_getuniqueamount($sincetoday); echo $res > 0 ? round(counterize_getamount(false, $sincetoday) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(86400); echo $res > 0 ? round(counterize_getamount(false, 86400) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(604800); echo $res > 0 ? round(counterize_getamount(false, 604800) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(2592000); echo $res > 0 ? round(counterize_getamount(false, 2592000) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(); echo $res > 0 ? round(counterize_getamount() / $res, 2) : 0; ?> </td> </tr> <tr class="alternate"> <td align="center" class="counterize_caption_help"><strong title="<?php _e('The number of pages/posts visited per unique visitor.', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> "><?php _e('Pages per unique visitor', COUNTERIZE_PLUGIN_TRAFFIC_TD); ?> </strong></td> <td align="center"><?php $res = counterize_getuniqueamount($sincetoday); echo $res > 0 ? round(counterize_getpagesamount($sincetoday) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(86400); echo $res > 0 ? round(counterize_getpagesamount(86400) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(604800); echo $res > 0 ? round(counterize_getpagesamount(604800) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(2592000); echo $res > 0 ? round(counterize_getpagesamount(2592000) / $res, 2) : 0; ?> </td> <td align="center"><?php $res = counterize_getuniqueamount(); echo $res > 0 ? round(counterize_getpagesamount() / $res, 2) : 0; ?> </td> </tr> </table> <?php }
function counterize_dashboard_callback() { //what was the two following lines supposed to do?... //$admin = dirname( $_SERVER['SCRIPT_FILENAME'] ); //$admin = substr( $admin, strrpos( $admin, '/' ) + 1 ); $count = counterize_getamount(); $unique = counterize_getuniqueamount(); $todaycount = counterize_gethitstoday(); $online = counterize_get_online_users(); $todayunique = counterize_getuniquehitstoday(); ?> <p> <?php _e('Total: ', COUNTERIZE_TD); ?> <strong><?php echo $count; ?> </strong> <?php _e('hits and', COUNTERIZE_TD); ?> <strong><?php echo $unique; ?> </strong> <?php _e('unique.'); ?> </p> <p> <?php _e('Today: ', COUNTERIZE_TD); ?> <strong><?php echo $todaycount; ?> </strong> <?php _e('hits and', COUNTERIZE_TD); ?> <strong><?php echo $todayunique; ?> </strong> <?php _e('unique.'); ?> </p> <p> <?php _e('Currently: ', COUNTERIZE_TD); ?> <strong><?php echo $online; ?> </strong> <?php _e('users online.', COUNTERIZE_TD); ?> </p> <a href="admin.php?page=counterize_dashboard"><?php _e('Detailed view', COUNTERIZE_TD); ?> »</a> <?php }