Exemplo n.º 1
0
 /**
  * Ausführung des Lösch-/Markier-Vorgangs
  *
  * @since   0.1
  * @change  2.6.0
  *
  * @param   array    $comment  Unbehandelte Kommentardaten
  * @param   string   $reason   Verdachtsgrund
  * @param   boolean  $is_ping  Ping (ja oder nein) [optional]
  * @return  array    $comment  Behandelte Kommentardaten
  */
 private static function _handle_spam_request($comment, $reason, $is_ping = false)
 {
     /* Optionen */
     $options = self::get_options();
     /* Einstellungen */
     $spam_remove = !$options['flag_spam'];
     $spam_notice = !$options['no_notice'];
     /* Filter-Einstellungen */
     $ignore_filter = $options['ignore_filter'];
     $ignore_type = $options['ignore_type'];
     $ignore_reason = in_array($reason, (array) $options['ignore_reasons']);
     /* Spam merken */
     self::_update_spam_log($comment);
     self::_update_spam_count();
     self::_update_daily_stats();
     /* Spam löschen */
     if ($spam_remove) {
         self::_go_in_peace();
     }
     /* Typen behandeln */
     if ($ignore_filter && ($ignore_type == 1 && $is_ping or $ignore_type == 2 && !$is_ping)) {
         self::_go_in_peace();
     }
     /* Spamgrund */
     if ($ignore_reason) {
         self::_go_in_peace();
     }
     /* Spam-Grund */
     self::$_reason = $reason;
     /* Spam markieren */
     add_filter('pre_comment_approved', create_function('', 'return "spam";'));
     /* E-Mail senden */
     add_filter('trackback_post', array(__CLASS__, 'send_mail_notification'));
     add_filter('comment_post', array(__CLASS__, 'send_mail_notification'));
     /* Spam reason as comment meta */
     if ($spam_notice) {
         add_filter('comment_post', array(__CLASS__, 'add_spam_reason_to_comment'));
     }
     return $comment;
 }
 /**
  * Get the default dashboard widgets.
  *
  * @return array Sidebar widgets.
  */
 protected function get_default_dashboard_widgets()
 {
     global $wp_meta_boxes;
     if (!is_array($wp_meta_boxes['dashboard'])) {
         require_once ABSPATH . '/wp-admin/includes/dashboard.php';
         $current_screen = get_current_screen();
         set_current_screen('dashboard');
         remove_action('wp_dashboard_setup', array($this, 'disable_dashboard_widgets'), 100);
         wp_dashboard_setup();
         if (is_callable(array('Antispam_Bee', 'add_dashboard_chart'))) {
             Antispam_Bee::add_dashboard_chart();
         }
         add_action('wp_dashboard_setup', array($this, 'disable_dashboard_widgets'), 100);
         set_current_screen($current_screen);
     }
     if (isset($wp_meta_boxes['dashboard'][0])) {
         unset($wp_meta_boxes['dashboard'][0]);
     }
     $widgets = array();
     if (isset($wp_meta_boxes['dashboard'])) {
         $widgets = $wp_meta_boxes['dashboard'];
     }
     /**
      * Filters the available dashboard widgets.
      *
      * @param array $widgets The globally available dashboard widgets.
      */
     return apply_filters('wp_widget_disable_default_dashboard_widgets', $widgets);
 }