activity_log = $activity_log; add_action( 'admin_menu', array( $this, 'admin_menus' ), 10 ); add_action( 'admin_init', array( $this, 'setup_page' ), 10 ); } /** * Add setup admin page. */ public function admin_menus() { add_dashboard_page( '', '', 'manage_options', 'activity-log-mainwp-setup', '' ); } /** * Setup Page Start. */ public function setup_page() { // Get page argument from $_GET array. $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ); if ( empty( $page ) || 'activity-log-mainwp-setup' !== $page ) { return; } /** * Wizard Steps. */ $wizard_steps = array( 'welcome' => array( 'name' => __( 'Welcome', 'mwp-al-ext' ), 'content' => array( $this, 'step_welcome' ), ), 'wsal_sites' => array( 'name' => __( 'Child Sites', 'mwp-al-ext' ), 'content' => array( $this, 'step_wsal_sites' ), 'save' => array( $this, 'step_wsal_sites_save' ), ), ); /** * Filter: `Wizard Default Steps` * * Extension filter hook to filter wizard steps before they are displayed. * * @param array $wizard_steps – Wizard Steps. */ $this->wizard_steps = apply_filters( 'mwpal_wizard_default_steps', $wizard_steps ); // Set current step. $current_step = filter_input( INPUT_GET, 'current-step', FILTER_SANITIZE_STRING ); $this->current_step = ! empty( $current_step ) ? $current_step : current( array_keys( $this->wizard_steps ) ); /** * Enqueue Styles. */ wp_enqueue_style( 'mwpal-wizard-css', trailingslashit( MWPAL_BASE_URL ) . 'assets/css/dist/mwpal-setup-wizard.build.css', array( 'dashicons', 'install', 'forms' ), filemtime( trailingslashit( MWPAL_BASE_DIR ) . 'assets/css/dist/mwpal-setup-wizard.build.css' ) ); /** * Save Wizard Settings. */ $save_step = filter_input( INPUT_POST, 'save_step', FILTER_SANITIZE_STRING ); if ( ! empty( $save_step ) && ! empty( $this->wizard_steps[ $this->current_step ]['save'] ) ) { call_user_func( $this->wizard_steps[ $this->current_step ]['save'] ); } ob_start(); $this->setup_page_header(); $this->setup_page_steps(); $this->setup_page_content(); $this->setup_page_footer(); exit; } /** * Setup Page Header. */ private function setup_page_header() { ?> > <?php esc_html_e( 'Activity Log MainWP › Setup Wizard', 'mwp-al-ext' ); ?>

WP Security Audit Log

current_step; // Array of step keys. $keys = array_keys( $this->wizard_steps ); if ( end( $keys ) === $current_step ) { // If last step is active then return WP Admin URL. return admin_url(); } // Search for step index in step keys. $step_index = array_search( $current_step, $keys, true ); if ( false === $step_index ) { // If index is not found then return empty string. return ''; } // Return next step. return add_query_arg( 'current-step', $keys[ $step_index + 1 ] ); } /** * Setup Page Content. */ private function setup_page_content() { ?>
wizard_steps[ $this->current_step ]['content'] ) ) { call_user_func( $this->wizard_steps[ $this->current_step ]['content'] ); } ?>

activity_log->settings->get_mwp_child_sites(); $wsal_sites = $this->activity_log->settings->get_wsal_child_sites(); if ( ! empty( $wsal_sites ) ) : ?>

$site ) : // Search for the site data. $key = array_search( $site_id, array_column( $mwp_sites, 'id' ), false ); if ( false !== $key && isset( $mwp_sites[ $key ] ) ) : $selected_site = $mwp_sites[ $key ]; ?>

' . esc_html__( 'Note:', 'mwp-al-ext' ) . '' ); ?>

' . esc_html__( 'Getting Started Guide', 'mwp-al-ext' ) . '' ); ?>

activity_log->settings->set_wsal_child_sites( ! empty( $selected_sites ) ? $selected_sites : false ); $this->activity_log->settings->update_option( 'setup-complete', true ); wp_safe_redirect( esc_url_raw( $this->get_next_step() ) ); exit(); } }