示例#1
0
 /**
  * Constructor
  *
  * Initialise Mute Screamer and run PHPIDS
  *
  * @return object
  */
 public function __construct()
 {
     // Require 3.0.
     if (!function_exists('__return_false')) {
         return;
     }
     /*if ( is_multisite() ) {
     			add_action( 'network_admin_notices', 'HMWP_MS_Utils::ms_notice' );
     			return;
     		}*/
     if (is_multisite()) {
         $installed = get_blog_option(BLOG_ID_CURRENT_SITE, 'hmwp_ids_installed');
     } else {
         $installed = get_option('hmwp_ids_installed');
     }
     if (!$installed) {
         $this->activate();
     }
     // PHPIDS requires a writable folder
     if (!is_writable(HMWP_MS_Utils::upload_path())) {
         add_action('admin_notices', 'HMWP_MS_Utils::writable_notice');
         return;
     }
     // Display updates in admin bar, run after wp_admin_bar_updates_menu
     //add_action( 'admin_bar_menu', array( $this, 'action_admin_bar_menu' ), 100 );
     self::$instance = $this;
     $this->init();
     $this->run();
     // Process wp-login.php requests
     if (HMWP_MS_Utils::is_wp_login()) {
         do_action('hmwp_ms_wp_login');
     }
 }
 /**
  * Add admin menu items
  *
  * @return void
  */
 public function admin_menu()
 {
     $intrusion_count = (int) HMWP_MS_IDS::instance()->opt('new_intrusions_count');
     $intrusions_menu_title = sprintf(__('Intrusions %s', 'mute-screamer'), "<span class='update-plugins count-{$intrusion_count}' title='{$intrusion_count}'><span class='update-count'>" . number_format_i18n($intrusion_count) . '</span></span>');
     add_dashboard_page(__('HMWP Intrusions', 'mute-screamer'), $intrusions_menu_title, 'activate_plugins', 'hmwp_ms_intrusions', array($this, 'intrusions'));
     //hassan add_options_page( __( 'Mute Screamer Configuration', 'mute-screamer' ), __( 'Mute Screamer', 'mute-screamer' ), 'activate_plugins', 'hmwp_ms_options', array( $this, 'options' ) );
     // Modify the Dashboard menu updates count
     $this->set_update_badge();
 }
 function hmwp_ms_is_ban()
 {
     return HMWP_MS_IDS::instance()->is_ban;
 }