steps = array( 'welcome' => array( 'name' => esc_html__( 'Welcome', 'mainwp' ), 'view' => array( $this, 'mwp_setup_welcome' ), 'handler' => '', ), 'introduction' => array( 'name' => esc_html__( 'Introduction', 'mainwp' ), 'view' => array( $this, 'mwp_setup_introduction' ), 'handler' => array( $this, 'mwp_setup_introduction_save' ), ), 'system_check' => array( 'name' => esc_html__( 'System', 'mainwp' ), 'view' => array( $this, 'mwp_setup_system_requirements' ), 'handler' => array( $this, 'mwp_setup_system_requirements_save' ), ), 'connect_first_site' => array( 'name' => esc_html__( 'Connect', 'mainwp' ), 'view' => array( $this, 'mwp_setup_connect_first_site' ), 'handler' => array( $this, 'mwp_setup_connect_first_site_save' ), ), 'add_client' => array( 'name' => esc_html__( 'Add Client', 'mainwp' ), 'view' => array( $this, 'mwp_setup_add_client' ), 'handler' => '', ), 'monitoring' => array( 'name' => esc_html__( 'Monitoring', 'mainwp' ), 'view' => array( $this, 'mwp_setup_monitoring' ), 'handler' => array( $this, 'mwp_setup_monitoring_save' ), ), 'next_steps' => array( 'name' => esc_html__( 'Finish', 'mainwp' ), 'view' => array( $this, 'mwp_setup_ready' ), 'handler' => '', ), ); $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized wp_enqueue_script( 'fomantic-ui', MAINWP_PLUGIN_URL . 'assets/js/fomantic-ui/fomantic-ui.js', array( 'jquery' ), MAINWP_VERSION, false ); wp_localize_script( 'mainwp-setup', 'mainwpSetupLocalize', array( 'nonce' => wp_create_nonce( 'MainWPSetup' ) ) ); wp_enqueue_script( 'mainwp', MAINWP_PLUGIN_URL . 'assets/js/mainwp.js', array( 'jquery' ), MAINWP_VERSION, true ); wp_enqueue_script( 'mainwp-clients', MAINWP_PLUGIN_URL . 'assets/js/mainwp-clients.js', array(), MAINWP_VERSION, true ); wp_enqueue_script( 'mainwp-setup', MAINWP_PLUGIN_URL . 'assets/js/mainwp-setup.js', array( 'jquery', 'fomantic-ui' ), MAINWP_VERSION, true ); wp_enqueue_script( 'mainwp-import', MAINWP_PLUGIN_URL . 'assets/js/mainwp-managesites-import.js', array( 'jquery' ), MAINWP_VERSION, true ); wp_enqueue_script( 'mainwp-ui', MAINWP_PLUGIN_URL . 'assets/js/mainwp-ui.js', array(), MAINWP_VERSION, true ); wp_enqueue_style( 'mainwp', MAINWP_PLUGIN_URL . 'assets/css/mainwp.css', array(), MAINWP_VERSION ); wp_enqueue_style( 'mainwp-fonts', MAINWP_PLUGIN_URL . 'assets/css/mainwp-fonts.css', array(), MAINWP_VERSION ); wp_enqueue_style( 'fomantic', MAINWP_PLUGIN_URL . 'assets/js/fomantic-ui/fomantic-ui.css', array(), MAINWP_VERSION ); wp_enqueue_style( 'mainwp-fomantic', MAINWP_PLUGIN_URL . 'assets/css/mainwp-fomantic.css', array(), MAINWP_VERSION ); // load custom MainWP theme. $selected_theme = MainWP_Settings::get_instance()->get_selected_theme(); if ( ! empty( $selected_theme ) ) { if ( 'dark' === $selected_theme ) { wp_enqueue_style( 'mainwp-custom-dashboard-extension-dark-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-dark-theme.css', array(), MAINWP_VERSION ); } elseif ( 'wpadmin' === $selected_theme ) { wp_enqueue_style( 'mainwp-custom-dashboard-extension-wp-admin-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-wpadmin-theme.css', array(), MAINWP_VERSION ); } elseif ( 'minimalistic' === $selected_theme ) { wp_enqueue_style( 'mainwp-custom-dashboard-extension-minimalistic-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-minimalistic-theme.css', array(), MAINWP_VERSION ); } elseif ( 'default' === $selected_theme ) { wp_enqueue_style( 'mainwp-custom-dashboard-extension-default-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-default-theme.css', array(), MAINWP_VERSION ); } else { $dirs = MainWP_Settings::get_instance()->get_custom_theme_folder(); $custom_theme_url = $dirs[1]; wp_enqueue_style( 'mainwp-custom-dashboard-theme', $custom_theme_url . $selected_theme, array(), MAINWP_VERSION ); } } if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized call_user_func( $this->steps[ $this->step ]['handler'] ); } if ( MainWP_Utility::instance()->is_disabled_functions( 'error_log' ) || ! function_exists( '\error_log' ) ) { error_reporting(0); // phpcs:ignore -- try to disabled the error_log somewhere in WP. } ob_start(); $this->setup_wizard_header(); $this->setup_wizard_content(); $this->setup_wizard_footer(); ?> steps ) ) { return esc_url_raw( remove_query_arg( array( 'noregister', 'message' ), add_query_arg( 'step', $step ) ) ); } $keys = array_keys( $this->steps ); return esc_url_raw( remove_query_arg( array( 'noregister', 'message' ), add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] ) ) ); } /** * Method get_back_step_link() * * Get the link for the previouse step. * * @param string $step Previouse step link. * * @return string Link for previouse step. */ public function get_back_step_link( $step = '' ) { if ( ! empty( $step ) && isset( $step, $this->steps ) ) { return esc_url_raw( remove_query_arg( array( 'noregister', 'message' ), add_query_arg( 'step', $step ) ) ); } $keys = array_keys( $this->steps ); return esc_url_raw( remove_query_arg( array( 'noregister', 'message' ), add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) - 1 ] ) ) ); } /** * Method setup_wizard_header() * * Render Setup Wizard's header. */ public function setup_wizard_header() { $selected_theme = MainWP_Settings::get_instance()->get_selected_theme(); ?> class="mainwp-quick-setup"> <?php esc_html_e( 'MainWP › Setup Wizard', 'mainwp' ); ?>
<?php esc_attr_e( 'MainWP', 'mainwp' ); ?>
setup_wizard_steps(); ?>
steps; ?>
$step ) { ?>
'; call_user_func( $this->steps[ $this->step ]['view'] ); echo ''; echo ''; } /** * Method mwp_setup_welcome() * * Renders the Welcome screen of the Quick Start Wizard */ public function mwp_setup_welcome() { delete_option( 'mainwp_run_quick_setup' ); ?>


-
-
-
-
-

-

-

Settings > MainWP Tools page!', 'mainwp' ); ?>

', '' ); ?>

', ' ' ); ?>
get_next_step_link() ); exit; } /** * Method mwp_setup_connect_first_site_save() * * Installation Step after connect first site. */ public function mwp_setup_connect_first_site_save() { check_admin_referer( 'mwp-setup' ); if ( isset( $_POST['mainwp-qsw-confirm-add-new-client'] ) && ! empty( $_POST['mainwp-qsw-confirm-add-new-client'] ) ) { wp_safe_redirect( $this->get_next_step_link() ); } else { wp_safe_redirect( $this->get_next_step_link( 'monitoring' ) ); } exit; } /** * Method mwp_setup_system_requirements_save() * * Installation Step save to DB. * * @uses \MainWP\Dashboard\MainWP_Utility::update_option() */ public function mwp_setup_system_requirements_save() { check_admin_referer( 'mwp-setup' ); if ( isset( $_POST['mwp_setup_openssl_lib_location'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized MainWP_Utility::update_option( 'mainwp_opensslLibLocation', isset( $_POST['mwp_setup_openssl_lib_location'] ) ? sanitize_text_field( wp_unslash( $_POST['mwp_setup_openssl_lib_location'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized } wp_safe_redirect( $this->get_next_step_link() ); exit; } /** * Method mwp_setup_connect_first_site_already() * * Render Added first Child Site Step form. */ public function mwp_setup_connect_first_site_already() { $count_clients = MainWP_DB_Client::instance()->count_total_clients(); ?>


count_total_clients(); $sites = MainWP_DB::instance()->get_sites(); // Get site data. $total_sites = ! empty( $sites ) ? count( $sites ) : 5; // Set default. $item_class_active = 1 === $total_sites ? 'active' : ''; $tab_class_active = 1 < $total_sites ? 'active' : ''; if ( ! empty( $count_clients ) ) : ?>

render_add_client_content( false, true ); ?>
render_multi_add_client_content( $i, $website ); } ?>
get_website_by_id( $first_site_id ); ?>
$field ) { $db_field = isset( $field['db_field'] ) ? $field['db_field'] : ''; $val = $edit_client && '' !== $db_field && property_exists( $edit_client, $db_field ) ? $edit_client->{$db_field} : ''; $tip = isset( $field['tooltip'] ) ? $field['tooltip'] : ''; ?>
" />
get_add_contact_temp( false ); ?>
>
$field ) : ?>
$field ) { $val = ''; $contact_id = ''; ?>

/>
hide-element="uptime-monitoring">

/>
hide-element="health-monitoring">
get_next_step_link() ); exit; } /** * Method mwp_setup_ready() * * Render MainWP Dashboard ready message. */ public function mwp_setup_ready() { ?>

(function (w, d, s) { let a = d.getElementsByTagName('head')[0]; let r = d.createElement('script'); r.async = 1; r.src = s; r.setAttribute('id', 'usetifulScript'); r.dataset.token = '480fa17b0507a1c60abba94bfdadd0a7'; a.appendChild(r); })(window, document, 'https://www.usetiful.com/dist/usetiful.js'); "; } }