function zerospam_log_spam($key, $url = false)
{
    global $wpdb;
    $settings = zerospam_settings();
    $ip = zerospam_get_ip();
    $url = $url ? $url : zerospam_get_url();
    $table_name = $wpdb->prefix . 'zerospam_log';
    switch ($key) {
        case 'registration':
            $key = 1;
            break;
        case 'comment':
            $key = 2;
            break;
        case 'cf7':
            $key = 3;
            break;
        case 'gf':
            $key = 4;
            break;
        case 'buddypress-registration':
            $key = 5;
            break;
    }
    $wpdb->insert($table_name, array('type' => $key, 'ip' => $ip, 'page' => $url), array('%s', '%s', '%s'));
    if (!empty($settings['auto_block']) && $settings['auto_block']) {
        zerospam_block_ip(array('ip' => $ip, 'type' => 'permanent', 'reason' => __('Auto block triggered on ', 'zerospam') . date('r') . '.'));
    }
}
 public function load_settings()
 {
     // Retrieve the settings.
     $settings = zerospam_settings();
     foreach ($this->default_settings as $key => $val) {
         if (!isset($settings[$key])) {
             if (is_bool($val)) {
                 $settings[$key] = 0;
             } else {
                 $settings[$key] = $val;
             }
         }
     }
     $this->settings = $settings;
 }