extension_text_domain = ( isset( $extension_main_file_path['text_domain'] ) ) ? $extension_main_file_path['text_domain'] : ''; $this->custom_alert_path = ( isset( $extension_main_file_path['custom_alert_path'] ) ) ? $extension_main_file_path['custom_alert_path'] : ''; $this->custom_sensor_path = ( isset( $extension_main_file_path['custom_sensor_path'] ) ) ? $extension_main_file_path['custom_sensor_path'] : ''; $this->extension_plugin_name = ''; } else { // If we don't have an array, then continue with the as normal. $this->extension_text_domain = $text_domain; $this->custom_alert_path = trailingslashit( dirname( $extension_main_file_path ) ) . 'wp-security-audit-log'; $this->custom_sensor_path = trailingslashit( trailingslashit( dirname( $extension_main_file_path ) ) . 'wp-security-audit-log' . DIRECTORY_SEPARATOR . 'custom-sensors' ); } $this->extension_main_file_path = $extension_main_file_path; $this->add_actions(); } /** * Add actions. */ public function add_actions() { add_action( 'admin_init', array( $this, 'init_install_notice' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'wp_ajax_dismiss_notice', array( $this, 'dismiss_notice' ) ); add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) ); add_filter( 'wsal_custom_alerts_dirs', array( $this, 'add_custom_events_path' ) ); add_filter( 'wsal_custom_sensors_classes_dirs', array( $this, 'add_custom_sensors_path' ) ); } /** * Load plugin text domain. */ public function load_plugin_textdomain() { $language_path = basename( dirname( dirname( __FILE__ ) ) ); $core_language_path = basename( dirname( __FILE__ ) ); $core_language_path = $language_path . '/' . $core_language_path . '/languages'; load_plugin_textdomain( 'wsal-extension-core', false, $core_language_path ); if ( isset( $this->extension_text_domain ) && ! empty( $this->extension_text_domain ) ) { load_plugin_textdomain( $this->extension_text_domain, false, $language_path . '/languages' ); } } /** * Display admin notice if WSAL is not installed. */ public function install_notice() { $plugin_installer = new PluginInstaller(); $screen = get_current_screen(); $free_installed = false; $premium_installed = false; $free_activated = false; $premium_activated = false; // Starting checks. // Is there free version installed? if ( $plugin_installer->is_plugin_installed( 'wp-security-audit-log/wp-security-audit-log.php' ) ) { $free_installed = true; } // Is there premium version installed? if ( $plugin_installer->is_plugin_installed( 'wp-security-audit-log-premium/wp-security-audit-log.php' ) ) { $premium_installed = true; } // End checks. if ( $free_installed || $premium_installed ) { // We have plugin installed. // Is free version active? if ( is_plugin_active( 'wp-security-audit-log/wp-security-audit-log.php' ) ) { $free_activated = true; } // Is premium version active? if ( is_plugin_active( 'wp-security-audit-log-premium/wp-security-audit-log.php' ) ) { $premium_activated = true; } if ( $free_activated || $premium_activated ) { // There is installed and activated plugin - bounce. return; } else { if ( ! self::$admin_notice_already_shown ) { // Notify the user that the WP Activity Log plugin is not active. ?>