false, 'message' => esc_html__( 'Access Denied.', 'wp-security-audit-log' ), ) ); die(); } $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : false; $token = isset( $_POST['token'] ) ? sanitize_text_field( wp_unslash( $_POST['token'] ) ) : false; if ( empty( $nonce ) || ! \wp_verify_nonce( $nonce, 'wsal-verify-wizard-page' ) ) { echo \wp_json_encode( array( 'success' => false, 'message' => esc_html__( 'Nonce verification failed.', 'wp-security-audit-log' ), ) ); die(); } if ( empty( $token ) ) { echo wp_json_encode( array( 'success' => false, 'message' => esc_html__( 'Invalid input.', 'wp-security-audit-log' ), ) ); die(); } echo \wp_json_encode( array( 'success' => true, 'token' => $token, 'tokenType' => esc_html( Plugin_Settings_Helper::get_token_type( $token ) ), ) ); die(); } /** * Add setup admin page. * * @since 5.0.0 */ public static function admin_menus() { // this is an empty title because we do not want it to display. add_dashboard_page( '', '', 'manage_options', 'wsal-setup', '' ); // hide it via CSS as well so screen readers pass over it. add_action( 'admin_head', function () { ?> array( // 'name' => __( 'Welcome', 'wp-security-audit-log' ), // 'content' => array( __CLASS__, 'wsal_step_welcome' ), // ), 'log_details' => array( 'name' => __( 'Log Details', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_log_details' ), 'save' => array( __CLASS__, 'wsal_step_log_details_save' ), ), 'login' => array( 'name' => __( 'Log In', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_login' ), 'save' => array( __CLASS__, 'wsal_step_login_save' ), ), 'register' => array( 'name' => __( 'User Registrations', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_register' ), 'save' => array( __CLASS__, 'wsal_step_register_save' ), ), 'log_retention' => array( 'name' => __( 'Log Retention', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_log_retention' ), 'save' => array( __CLASS__, 'wsal_step_log_retention_save' ), ), 'summary' => array( 'name' => __( 'Send summary', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_summary' ), 'save' => array( __CLASS__, 'wsal_step_summary_save' ), ), ); if ( 'free' !== \WpSecurityAuditLog::get_plugin_version() ) { $wizard_steps['notifications'] = array( 'name' => __( 'Where should the plugin send your activity log summary?', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_notifications' ), 'save' => array( __CLASS__, 'wsal_step_notifications_save' ), ); } $wizard_steps['finish'] = array( 'name' => __( 'Finish', 'wp-security-audit-log' ), 'content' => array( __CLASS__, 'wsal_step_finish' ), 'save' => array( __CLASS__, 'wsal_step_finish_save' ), ); /** * Filter: `Wizard Default Steps` * * WSAL filter to filter wizard steps before they are displayed. * * @param array $wizard_steps – Wizard Steps. */ self::$wizard_steps = apply_filters( 'wsal_wizard_default_steps', $wizard_steps ); // Set current step. $current_step = ( isset( $_GET['current-step'] ) ) ? \sanitize_text_field( \wp_unslash( $_GET['current-step'] ) ) : null; self::$current_step = ! empty( $current_step ) ? $current_step : current( array_keys( self::$wizard_steps ) ); // check if current step is a valid one. if ( ! array_key_exists( self::$current_step, self::$wizard_steps ) ) { self::$current_step = 'invalid-step'; } /** * Enqueue Styles. */ $wizard_css = View_Manager::get_asset_path( 'css/dist/', 'wsal-wizard', 'css', false ); wp_enqueue_style( 'wsal-wizard-css', WSAL_BASE_URL . $wizard_css, array( 'dashicons', 'install', 'forms' ), WSAL_VERSION ); /** * Enqueue Scripts. */ $wizard_js = View_Manager::get_asset_path( 'js/dist/', 'wsal-wizard', 'js', false ); wp_register_script( 'wsal-wizard-js', WSAL_BASE_URL . $wizard_js, array( 'jquery' ), WSAL_VERSION, false ); $common_js = '/js/common.js'; wp_register_script( 'wsal-common', WSAL_BASE_URL . $common_js, array( 'jquery' ), WSAL_VERSION, true ); // Data array. $data_array = array( 'ajaxURL' => admin_url( 'admin-ajax.php' ), 'nonce' => ( ( ! Settings_Helper::current_user_can( 'edit' ) ) && ! 'invalid-step' === self::$current_step ) ? wp_create_nonce( 'wsal-verify-wizard-page' ) : '', 'usersError' => esc_html__( 'Specified value in not a user.', 'wp-security-audit-log' ), 'rolesError' => esc_html__( 'Specified value in not a role.', 'wp-security-audit-log' ), 'ipError' => esc_html__( 'Specified value in not an IP address.', 'wp-security-audit-log' ), ); wp_localize_script( 'wsal-wizard-js', 'wsalData', $data_array ); $installer_script_data = array( 'ajaxURL' => admin_url( 'admin-ajax.php' ), 'installing' => esc_html__( 'Installing, please wait', 'wp-security-audit-log' ), 'already_installed' => esc_html__( 'Already installed', 'wp-security-audit-log' ), 'installed' => esc_html__( 'Extension installed', 'wp-security-audit-log' ), 'activated' => esc_html__( 'Extension activated', 'wp-security-audit-log' ), 'failed' => esc_html__( 'Install failed', 'wp-security-audit-log' ), 'reloading_page' => esc_html__( 'Reloading page', 'wp-security-audit-log' ), ); wp_localize_script( 'wsal-common', 'wsalCommonData', $installer_script_data ); /** * Save Wizard Settings. */ $save_step = ( isset( $_POST['save_step'] ) ) ? \sanitize_text_field( \wp_unslash( $_POST['save_step'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( ! empty( $save_step ) && ! empty( self::$wizard_steps[ self::$current_step ]['save'] ) ) { call_user_func( self::$wizard_steps[ self::$current_step ]['save'] ); } self::setup_page_header(); self::setup_page_steps(); self::setup_page_content(); self::setup_page_footer(); exit; } /** * Setup Page Header. * * @since 5.0.0 */ private static function setup_page_header() { ?> > <?php esc_html_e( 'WP Activity Log › Setup Wizard', 'wp-security-audit-log' ); ?>

WP Activity Log

'; printf( /* translators: 1 - an opening link tag, 2 - a closing link tag. */ esc_html__( 'You have reached an invaild step - %1$sreturn to the start of the wizard%2$s.', 'wp-security-audit-log' ), '', '' ); echo '

'; } /** * Step View: `Welcome` * * @since 5.0.0 */ private static function wsal_step_welcome() { // Dismiss the setup modal in case if not already done. if ( ! Settings_Helper::get_boolean_option_value( 'setup-modal-dismissed', false ) ) { Settings_Helper::set_boolean_option_value( 'setup-modal-dismissed', true, true ); } ?>







upgrading to Premium and using our database tools to store the activity log in an external database. You can also store the logs in third party services such as Loggly, AWS CloudWatch, Slack and other solutions', 'wp-security-audit-log' ); echo wp_kses( $step_help, Plugin_Settings_Helper::get_allowed_html_tags() ); ?>

Please provide the email address where you\'d like to receive these emails:

', 'wp-security-audit-log' ); echo wp_kses( $step_help, Plugin_Settings_Helper::get_allowed_html_tags() ); ?>

WP Activity Log Premium to customize your activity log summary. Include additional details and choose exactly what to track', 'wp-security-audit-log' ); echo wp_kses( $step_help, Plugin_Settings_Helper::get_allowed_html_tags() ); /* @free:end */ ?>

Please provide a default email address where these notifications should be sent. You can update this address at any time from the plugin’s Notifications settings, and you can also configure specific recipients for individual alerts, as well as set a default phone number (for SMS messages) and Slack channel.

Enter the email address where you\'d like to receive notifications:

', 'wp-security-audit-log' ); echo wp_kses( $step_help, Plugin_Settings_Helper::get_allowed_html_tags() ); ?>

WP Activity Log Premium to customize your activity log summary. Include additional details and choose exactly what to track', 'wp-security-audit-log' ); echo wp_kses( $step_help, Plugin_Settings_Helper::get_allowed_html_tags() ); */ /* @free:end */ ?>