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 = ''; } // If we dont have array, then continue with the as normal. else { $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. */ function install_notice() { $plugin_installer = new PluginInstaller(); $screen = get_current_screen(); $freeInstalled = false; $premiumInstalled = false; $freeActivated = false; $premiumActivated = false; /* Starting checks */ /* Is there free version installed */ if ( $plugin_installer->is_plugin_installed( 'wp-security-audit-log/wp-security-audit-log.php' )) { $freeInstalled = true; } /* Is there premium version installed */ if ( $plugin_installer->is_plugin_installed( 'wp-security-audit-log-premium/wp-security-audit-log.php' )) { $premiumInstalled = true; } /* End checks */ if ( $freeInstalled || $premiumInstalled ) { /* We have plugin installed */ /* Is free version activated */ if (is_plugin_active( 'wp-security-audit-log/wp-security-audit-log.php' )) { $freeActivated = true; } /* Is premium version activated */ if (is_plugin_active( 'wp-security-audit-log-premium/wp-security-audit-log.php' )) { $premiumActivated = true; } if ( $freeActivated || $premiumActivated ) { /* There is installed and activated plugin - bounce */ return; } else { if ( ! self::$adminNoticeAlreadyShown ) { /* Notify the user that the activity log is not active */ ?>