/**
  * Construct the Google Analytics block listener
  *
  * @param $referral_url
  */
 public function __construct($referral_url)
 {
     $data = \SpamLyticsHelper::get_ga_url($referral_url);
     if (is_object($data) && $data->post_title == $referral_url) {
         $this->block_request('GA_REFERRAL', $referral_url);
     }
 }
 /**
  * Construct the Google Analytics block listener
  *
  * @param $ip_address
  */
 public function __construct($ip_address)
 {
     $data = \SpamLyticsHelper::is_ip_blocked($ip_address);
     if ($data === true) {
         $this->block_request('IP', $ip_address);
     }
 }
 /**
  *
  */
 public function spamlytics_new_daily_data()
 {
     $settings = \SpamLyticsHelper::get_settings();
     if ($settings['api_key'] !== '') {
         $fetcher = new Fetcher($settings['api_key']);
         $fetcher->check_for_updates();
     }
 }
 /**
  * Listen for referral urls
  */
 public function __construct()
 {
     $this->settings = \SpamLyticsHelper::get_settings();
     $referrer = $this->filter_url($_SERVER['HTTP_REFERER']);
     new Ga($referrer);
     new Ip($_SERVER['REMOTE_ADDR']);
     new Referral($_SERVER['HTTP_REFERER']);
     new Comments($this->settings);
 }
 /**
  * Callback: show the metabox content
  *
  * @param $post
  */
 public function spam_metabox_type($post)
 {
     wp_nonce_field('spam_metabox_nonce', 'spam_metabox_nonce');
     echo '<p><strong>' . __('Step 1', 'spam') . ':</strong> ' . __('Enter the value (a full referral URL or IP to block) for this spam record in the title field above.', 'spam') . '</p>';
     echo '<p><strong>' . __('Step 2', 'spam') . ':</strong> ' . __('Select the type of this spam record below:', 'spam') . '</p>';
     foreach (\SpamLyticsHelper::get_spam_types() as $key => $type) {
         $value = get_post_meta($post->ID, 'spamlytics_type', true);
         $checked = checked($value, $key, false);
         if (empty($value)) {
             $checked = checked('ga', $key, false);
         }
         echo '<label><input type="radio" name="spamlytics" value="' . esc_attr($key) . '"' . $checked . '> ' . esc_attr($type) . '</label><br />';
     }
     echo '<p><strong>' . __('Step 3', 'spam') . ':</strong> ' . __('Hit publish (or update) and your spam record is active!', 'spam') . '</p>';
 }
 /**
  * Admin initiated, hook the things we need for SpamLytics
  */
 public function __construct()
 {
     $this->settings_class = new Settings();
     $this->settings = \SpamLyticsHelper::get_settings();
     // add_actions
     add_action('admin_menu', array($this, 'hook_submenu_items'));
     add_filter('plugin_action_links_' . plugin_basename(SPAMLYTICS_ROOT_PATH), array($this, 'plugin_actions'));
     add_action('init', array($this, 'init_admin'));
     add_action('admin_enqueue_scripts', array($this, 'hook_admin_style'));
     add_action('admin_notices', array($this, 'post_type_info'));
     // If the user has enabled diagnostic data, we'll need to hook in the comments for spam.
     if ((bool) $this->settings['sent_data'] === true) {
         add_action('transition_comment_status', array($this, 'report_spam_hook'), 10, 3);
     }
     new Comments();
     $this->check_admin_message();
 }
 /**
  * Get the SpamLytics settings
  *
  * @return mixed
  */
 public static function get_settings()
 {
     return array_merge(SpamLyticsHelper::default_settings(), get_option('spamlytics', array()));
 }
 /**
  * Construct the settings page
  */
 public function __construct()
 {
     $this->settings = \SpamLyticsHelper::get_settings();
     $this->comment_stats = get_transient('spamlytics_comment_stats');
 }
 /**
  * Verify a comment from the admin interface and update the comment status if needed
  *
  * @param $id
  */
 private function verify_comment($id)
 {
     $frontend_class = new \SpamLytics\Frontend\Comments(\SpamLyticsHelper::get_settings());
     $frontend_class->check_for_spam($id, get_comment($id));
 }