_x( 'One result is available, press enter to select it.', 'enhanced select', 'wp-user-frontend' ), 'i18n_matches_n' => _x( '%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'wp-user-frontend' ), 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'wp-user-frontend' ), 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'wp-user-frontend' ), 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'wp-user-frontend' ), 'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'wp-user-frontend' ), 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'wp-user-frontend' ), 'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'wp-user-frontend' ), 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'wp-user-frontend' ), 'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'wp-user-frontend' ), 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'wp-user-frontend' ), 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'wp-user-frontend' ), 'ajax_url' => admin_url( 'admin-ajax.php' ), ] ); wp_enqueue_style( 'wpuf_admin_styles', WPUF_ASSET_URI . '/css/admin/admin.css', [] ); wp_enqueue_style( 'wpuf-setup', WPUF_ASSET_URI . '/css/admin/wpuf-setup.css', [ 'dashicons', 'install' ] ); wp_register_script( 'wpuf-setup', WPUF_ASSET_URI . '/js/admin/wpuf-setup' . $suffix . '.js', [ 'jquery', 'wpuf-enhanced-select', 'jquery-blockui' ] ); wp_localize_script( 'wpuf-setup', 'wpuf_setup_params', [] ); } /** * Add admin menus/screens. */ public function admin_menus() { add_dashboard_page( 'WPUF Setup', 'WPUF Setup', 'manage_options', 'wpuf-setup', '' ); } /** * Add custom class to WPUF Setup menu link, it's needed to hide the link from the dashboard * * @since 3.1.6 */ public function add_custom_menu_class() { global $submenu; if ( !empty( $submenu ) ) { foreach ( $submenu as $key => $items ) { foreach ( $items as $index => $item ) { if ( 'wpuf-setup' == $item[2] ) { $submenu['index.php'][$index][4] = 'wpuf-setup-menu-link'; } } } } } /** * Redirect to the welcome page once the plugin is installed * * @return void */ public function redirect_to_page() { if ( !get_transient( 'wpuf_activation_redirect' ) || get_option( 'wpuf_setup_wizard' ) ) { return; } delete_transient( 'wpuf_activation_redirect' ); // Only do this for single site installs. if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } wp_safe_redirect( admin_url( 'index.php?page=wpuf-setup' ) ); exit; } /** * Show the setup wizard. */ public function setup_wizard() { $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; if ( empty( $page ) || 'wpuf-setup' !== $page ) { return; } $this->steps = [ 'introduction' => [ 'name' => __( 'Introduction', 'wp-user-frontend' ), 'view' => [ $this, 'wpuf_setup_introduction' ], 'handler' => '', ], 'basic' => [ 'name' => __( 'Settings', 'wp-user-frontend' ), 'view' => [ $this, 'wpuf_setup_basic' ], 'handler' => [ $this, 'wpuf_setup_basic_save' ], ], 'next_steps' => [ 'name' => __( 'Ready!', 'wp-user-frontend' ), 'view' => [ $this, 'wpuf_setup_ready' ], 'handler' => '', ], ]; $this->step = isset( $_GET['step'] ) ? sanitize_text_field( wp_unslash( $_GET['step'] ) ) : current( array_keys( $this->steps ) ); $this->enqueue_scripts(); if ( !empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { // WPCS: CSRF ok. call_user_func( $this->steps[ $this->step ]['handler'] ); } ob_start(); $this->setup_wizard_header(); $this->setup_wizard_steps(); $this->setup_wizard_content(); $this->setup_wizard_footer(); exit; } public function get_next_step_link() { $keys = array_keys( $this->steps ); return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] ); } /** * Setup Wizard Header. */ public function setup_wizard_header() { ?> > <?php esc_html_e( 'WPUF › Setup Wizard', 'wp-user-frontend' ); ?>

WPUF

step ) { ?> steps; array_shift( $ouput_steps ); ?>
    $step ) { ?>
' ); call_user_func( $this->steps[ $this->step ]['view'] ); echo wp_kses_post( '' ); } /** * Introduction step. */ public function wpuf_setup_introduction() { ?>

It’s completely optional and shouldn’t take longer than a minute.', 'wp-user-frontend' ) ); ?>

/>
/>
Want to help make WP User Frontend even more awesome? Allow WP User Frontend to collect non-sensitive diagnostic data and usage information What we collect '; ?>

tracker->insights->optin(); } else { wpuf()->tracker->insights->optout(); } if ( 'on' == $install_wpuf_pages ) { $installer = new WPUF_Admin_Installer(); $installer->init_pages(); } update_option( 'wpuf_setup_wizard', 1 ); wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * Final step. */ public function wpuf_setup_ready() { ?>