<?php
if(!class_exists('WP_List_Table')){
	require_once( get_home_path() . 'wp-admin/includes/class-wp-list-table.php' );
}
class spam_master_analytics_menu_table extends WP_List_Table {

function display(){
global $wpdb, $blog_id;

//Tables
$table_spam_master_keys = $wpdb->prefix."spam_master_keys";
$spam_master_threats = $wpdb->prefix."spam_master_threats";
//DB Checks
$spam_master_firewall_total_blocked = $wpdb->get_var( "SELECT COUNT(*) FROM $table_spam_master_keys WHERE spamkey = 'Firewall'" );
$spam_master_registrations_total_blocked = $wpdb->get_var( "SELECT COUNT(*) FROM $table_spam_master_keys WHERE spamkey = 'Registration' OR spamkey = 'Woocommerce'" );
$spam_master_comments_total_blocked = $wpdb->get_var( "SELECT COUNT(*) FROM $table_spam_master_keys WHERE spamkey = 'Comment' OR spamkey = 'Contact-Form'" );
$spam_master_system_total_blocked = $wpdb->get_var( "SELECT COUNT(*) FROM $table_spam_master_keys WHERE spamkey = 'System'" );
$spam_master_logs_total = $wpdb->get_var( "SELECT COUNT(*) FROM $table_spam_master_keys" );
//IF EMPTY DATA SET 0 for menu
if(empty($spam_master_block_count)){
	$spam_master_block_count = "0";
}
if(empty($spam_master_firewall_total_blocked)){
	$spam_master_firewall_total_blocked = "0";
}
if(empty($spam_master_registrations_total_blocked)){
	$spam_master_registrations_total_blocked = "0";
}
if(empty($spam_master_comments_total_blocked)){
	$spam_master_comments_total_blocked = "0";
}
if(empty($spam_master_system_total_blocked)){
	$spam_master_system_total_blocked = "0";
}
if(empty($spam_master_logs_total)){
	$spam_master_logs_total = "0";
}
?>
<table class="widefat" cellspacing="0">
	<thead>
		<tr>
			<th>
				<h2><img src="<?php echo plugins_url('../images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /><?php _e('&nbsp;Analytics Menu', 'spam_master'); ?></h2>
			</th>
		</tr>
	</thead>

	<tfoot>
		<tr>
			<th></th>
		</tr>
	</tfoot>

	<tbody>
		<tr class="alternate">
			<td><img src="<?php echo plugins_url('../images/arrow-right.png', dirname(__FILE__)); ?>" style="height:24px; vertical-align:middle;" /> | <a href="<?php echo admin_url(); ?>admin.php?page=spam-master-analytics&analytics=stat" >Statistics</a> | <a href="<?php echo admin_url(); ?>admin.php?page=spam-master-analytics&analytics=fire" >Firewall (<?php echo number_format($spam_master_firewall_total_blocked); ?>)</a> | <a href="<?php echo admin_url(); ?>admin.php?page=spam-master-analytics&analytics=regi" >Registrations (<?php echo number_format($spam_master_registrations_total_blocked); ?>)</a> | <a href="<?php echo admin_url(); ?>admin.php?page=spam-master-analytics&analytics=comm" >Comments (<?php echo number_format($spam_master_comments_total_blocked); ?>)</a> | <a href="<?php echo admin_url(); ?>admin.php?page=spam-master-analytics&analytics=syst" >System (<?php echo number_format($spam_master_system_total_blocked); ?>)</a> | <a href="<?php echo admin_url(); ?>admin.php?page=spam-master-analytics&analytics=logs" >All Logs (<?php echo number_format($spam_master_logs_total); ?>)</a> |</td>
		</tr>
	</tbody>
</table>

<br>

<?php
		}
}
?>
