$this->get_data()));
}
public function get_data () {
global $wpdb;
$table = $wpdb->prefix . 'comments_antispam_log';
$sql = "SELECT COUNT(`spam_ID`) as s_count, DATE(`spam_date`) AS s_date FROM {$table} GROUP BY s_date ORDER BY s_date ASC ;";
$res = $wpdb->get_results($sql, ARRAY_A);
if (empty($res)) return array(array('s_count' => 0, 's_date' => date('Y-m-d')));
return $res;
}
public function show_spam_count($wp_admin_bar)
{
$wp_admin_bar->add_node(array(
"id" => "antispam-plugin",
"title" => "Antispam ",
'href' => admin_url('tools.php?page=antispam-statistic'),
"parent" => "comments",
));
$wp_admin_bar->add_node(array(
"id" => "antispam-plugin-counter",
"title" => get_option('spams_detected', 0) . ' rejected',
"parent" => "antispam-plugin",
));
$wp_admin_bar->add_node(array(
'id' => 'antispam-github',
'href' => 'https://github.com/EugenBobrowski/antispam/issues',
"title" => 'Create Issue on GitHub',
"parent" => "antispam-plugin",
));
}
public function style()
{
?>