PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | pages/page-mainwp-setup-wizard.php +781 -340 5.1 → 6.2.1 View file →
@@ -8,8 +8,13 @@
8 8 */
9 9
10 10 namespace MainWP\Dashboard;
11 11
12 +// Exit if accessed directly.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit;
15 +}
16 +
12 17 /**
13 18 * Copyright
14 19 * Plugin: WooCommerce
15 20 * Plugin URI: http://www.woothemes.com/woocommerce/
@@ -70,9 +75,9 @@
70 75 * Medthod admin_init()
71 76 *
72 77 * Initiate Quick Setup Wizard page.
73 78 */
74 - public function admin_init() {
79 + public function admin_init() { // phpcs:ignore -- NOSONAR - complex method.
75 80 if ( empty( $_GET['page'] ) || 'mainwp-setup' !== $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
76 81 return;
77 82 }
78 83 $this->steps = array(
@@ -77,38 +82,45 @@
77 82 }
78 83 $this->steps = array(
79 84 'welcome' => array(
80 85 'name' => esc_html__( 'Welcome', 'mainwp' ),
86 + 'desc' => esc_html__( 'Welcome to MainWP!', 'mainwp' ),
81 87 'view' => array( $this, 'mwp_setup_welcome' ),
82 88 'handler' => '',
83 89 ),
84 90 'introduction' => array(
85 91 'name' => esc_html__( 'Introduction', 'mainwp' ),
92 + 'desc' => esc_html__( 'How MainWP works', 'mainwp' ),
86 93 'view' => array( $this, 'mwp_setup_introduction' ),
87 94 'handler' => array( $this, 'mwp_setup_introduction_save' ),
88 95 ),
89 96 'system_check' => array(
90 - 'name' => esc_html__( 'System', 'mainwp' ),
97 + 'name' => esc_html__( 'System Check', 'mainwp' ),
98 + 'desc' => esc_html__( 'Verify requirements', 'mainwp' ),
91 99 'view' => array( $this, 'mwp_setup_system_requirements' ),
92 100 'handler' => array( $this, 'mwp_setup_system_requirements_save' ),
93 101 ),
94 102 'connect_first_site' => array(
95 - 'name' => esc_html__( 'Connect', 'mainwp' ),
103 + 'name' => esc_html__( 'Add Site', 'mainwp' ),
104 + 'desc' => esc_html__( 'Add your first site', 'mainwp' ),
96 105 'view' => array( $this, 'mwp_setup_connect_first_site' ),
97 106 'handler' => array( $this, 'mwp_setup_connect_first_site_save' ),
98 107 ),
99 108 'add_client' => array(
100 109 'name' => esc_html__( 'Add Client', 'mainwp' ),
110 + 'desc' => esc_html__( 'Set up a client', 'mainwp' ),
101 111 'view' => array( $this, 'mwp_setup_add_client' ),
102 112 'handler' => '',
103 113 ),
104 114 'monitoring' => array(
105 115 'name' => esc_html__( 'Monitoring', 'mainwp' ),
116 + 'desc' => esc_html__( 'Configure monitoring', 'mainwp' ),
106 117 'view' => array( $this, 'mwp_setup_monitoring' ),
107 118 'handler' => array( $this, 'mwp_setup_monitoring_save' ),
108 119 ),
109 120 'next_steps' => array(
110 - 'name' => esc_html__( 'Finish', 'mainwp' ),
121 + 'name' => esc_html__( 'Setup Complete!', 'mainwp' ),
122 + 'desc' => esc_html__( 'You\'re all set!', 'mainwp' ),
111 123 'view' => array( $this, 'mwp_setup_ready' ),
112 124 'handler' => '',
113 125 ),
114 126 );
@@ -119,8 +131,9 @@
119 131 wp_localize_script( 'mainwp-setup', 'mainwpSetupLocalize', array( 'nonce' => wp_create_nonce( 'MainWPSetup' ) ) );
120 132 wp_enqueue_script( 'mainwp', MAINWP_PLUGIN_URL . 'assets/js/mainwp.js', array( 'jquery' ), MAINWP_VERSION, true );
121 133 wp_enqueue_script( 'mainwp-clients', MAINWP_PLUGIN_URL . 'assets/js/mainwp-clients.js', array(), MAINWP_VERSION, true );
122 134 wp_enqueue_script( 'mainwp-setup', MAINWP_PLUGIN_URL . 'assets/js/mainwp-setup.js', array( 'jquery', 'fomantic-ui' ), MAINWP_VERSION, true );
135 + wp_enqueue_script( 'mainwp-import', MAINWP_PLUGIN_URL . 'assets/js/mainwp-managesites-import.js', array( 'jquery' ), MAINWP_VERSION, true );
123 136 wp_enqueue_script( 'mainwp-ui', MAINWP_PLUGIN_URL . 'assets/js/mainwp-ui.js', array(), MAINWP_VERSION, true );
124 137 wp_enqueue_style( 'mainwp', MAINWP_PLUGIN_URL . 'assets/css/mainwp.css', array(), MAINWP_VERSION );
125 138 wp_enqueue_style( 'mainwp-fonts', MAINWP_PLUGIN_URL . 'assets/css/mainwp-fonts.css', array(), MAINWP_VERSION );
126 139 wp_enqueue_style( 'fomantic', MAINWP_PLUGIN_URL . 'assets/js/fomantic-ui/fomantic-ui.css', array(), MAINWP_VERSION );
@@ -136,8 +149,10 @@
136 149 } elseif ( 'minimalistic' === $selected_theme ) {
137 150 wp_enqueue_style( 'mainwp-custom-dashboard-extension-minimalistic-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-minimalistic-theme.css', array(), MAINWP_VERSION );
138 151 } elseif ( 'default' === $selected_theme ) {
139 152 wp_enqueue_style( 'mainwp-custom-dashboard-extension-default-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-default-theme.css', array(), MAINWP_VERSION );
153 + } elseif ( 'default-dark' === $selected_theme ) {
154 + wp_enqueue_style( 'mainwp-custom-dashboard-extension-default-theme', MAINWP_PLUGIN_URL . 'assets/css/themes/mainwp-default-dark-theme.css', array(), MAINWP_VERSION );
140 155 } else {
141 156 $dirs = MainWP_Settings::get_instance()->get_custom_theme_folder();
142 157 $custom_theme_url = $dirs[1];
143 158 wp_enqueue_style( 'mainwp-custom-dashboard-theme', $custom_theme_url . $selected_theme, array(), MAINWP_VERSION );
@@ -153,9 +168,9 @@
153 168 }
154 169
155 170 ob_start();
156 171 $this->setup_wizard_header();
157 - $this->setup_wizard_steps();
172 +
158 173 $this->setup_wizard_content();
159 174 $this->setup_wizard_footer();
160 175 ?>
161 176 <?php
@@ -217,8 +232,9 @@
217 232 <?php wp_print_scripts( 'mainwp-clients' ); ?>
218 233 <?php wp_print_scripts( 'mainwp-setup' ); ?>
219 234 <?php wp_print_scripts( 'fomantic' ); ?>
220 235 <?php wp_print_scripts( 'mainwp-ui' ); ?>
236 + <?php wp_print_scripts( 'mainwp-import' ); ?>
221 237 <?php
222 238 // to fix warning.
223 239 /**
224 240 * Remove the deprecated `print_emoji_styles` handler.
@@ -229,16 +245,64 @@
229 245 remove_action( 'admin_print_styles', 'print_emoji_styles' );
230 246 }
231 247 ?>
232 248 <?php do_action( 'admin_print_styles' ); ?>
249 + <style>
250 + @keyframes tadaaaa {
251 + 0% {
252 + transform: scale(1) rotate(0deg);
253 + }
254 + 10% {
255 + transform: scale(0.9) rotate(-3deg);
256 + }
257 + 20% {
258 + transform: scale(1.1) rotate(3deg);
259 + }
260 + 30% {
261 + transform: scale(0.95) rotate(-2deg);
262 + }
263 + 40% {
264 + transform: scale(1.05) rotate(2deg);
265 + }
266 + 50% {
267 + transform: scale(1) rotate(0deg);
268 + }
269 + 60% {
270 + transform: scale(1.02) rotate(-1deg);
271 + }
272 + 80% {
273 + transform: scale(0.98) rotate(1deg);
274 + }
275 + 100% {
276 + transform: scale(1) rotate(0deg);
277 + }
278 + }
279 +
280 + .tadaaaa {
281 + display: inline-block;
282 + animation: tadaaaa 0.6s ease-in-out 1 forwards;
283 + }
284 + </style>
233 285 <script type="text/javascript"> let ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>';</script>
234 286 <script type="text/javascript">let mainwp_ajax_nonce = "<?php echo esc_js( wp_create_nonce( 'mainwp_ajax' ) ); ?>", mainwp_js_nonce = "<?php echo esc_js( wp_create_nonce( 'mainwp_nonce' ) ); ?>";</script>
235 287 </head>
236 288 <body class="mainwp-ui <?php echo ! empty( $selected_theme ) ? 'mainwp-custom-theme' : ''; ?> mainwp-ui-setup">
237 - <div class="ui hidden divider"></div>
238 - <div class="ui hidden divider"></div>
239 - <div id="mainwp-quick-setup-wizard" class="ui padded container segment">
240 - <?php
289 + <div class="ui stackable padded grid">
290 + <div class="two wide left aligned middle aligned column">
291 + <img src="<?php echo esc_url( MAINWP_PLUGIN_URL . 'assets/images/mainwp-icon.svg' ); ?>" alt="<?php esc_attr_e( 'MainWP', 'mainwp' ); ?>" style="width:40px;height40px;" />
292 + </div>
293 + <div class="twelve wide column">
294 + <?php $this->setup_wizard_steps(); ?>
295 + </div>
296 + <div class="two wide right aligned middle aligned column">
297 +
298 + </div>
299 + </div>
300 +
301 + <div id="mainwp-quick-setup-wizard" class="ui grid">
302 + <div class="two wide column"></div>
303 + <div class="twelve wide column">
304 + <?php
241 305 }
242 306
243 307 /**
244 308 * Method setup_wizard_footer()
@@ -246,15 +310,13 @@
246 310 * Render Setup Wizard's footer.
247 311 */
248 312 public function setup_wizard_footer() {
249 313 ?>
314 + </div>
315 + <div class="two wide column"></div>
250 316 </div>
251 - <div class="ui grid">
252 - <div class="row">
253 - <div class="center aligned column">
254 - <a class="" href="<?php echo esc_url( admin_url( 'index.php' ) ); ?>"><?php esc_html_e( 'Quit MainWP Quick Setup Wizard and Go to WP Admin', 'mainwp' ); ?></a> | <a class="" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp_tab' ) ); ?>"><?php esc_html_e( 'Quit MainWP Quick Setup Wizard and Go to MainWP', 'mainwp' ); ?></a>
255 - </div>
256 - </div>
317 + <div id="mainwp-qsw-exit-links">
318 + <?php esc_html_e( 'Go to', 'mainwp' ); ?> <a class="" href="<?php echo esc_url( admin_url( 'index.php' ) ); ?>"><?php esc_html_e( 'WP Admin', 'mainwp' ); ?></a> <?php esc_html_e( 'or', 'mainwp' ); ?> <a class="" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp_tab' ) ); ?>"><?php esc_html_e( 'MainWP', 'mainwp' ); ?></a>
257 319 </div>
258 320 </body>
259 321 </html>
260 322 <?php
@@ -264,12 +326,12 @@
264 326 * Method setup_wizard_steps()
265 327 *
266 328 * Render Setup Wizards Steps.
267 329 */
268 - public function setup_wizard_steps() {
330 + public function setup_wizard_steps() { // phpcs:ignore -- NOSONAR - complex method.
269 331 $ouput_steps = $this->steps;
270 332 ?>
271 - <div id="mainwp-quick-setup-wizard-steps" class="ui ordered fluid steps" style="">
333 + <div id="mainwp-quick-setup-wizard-steps" class="ui circular ordered stackable fluid steps" style="">
272 334 <?php foreach ( $ouput_steps as $step_key => $step ) { ?>
273 335 <?php
274 336 if ( isset( $step['hidden'] ) && $step['hidden'] ) {
275 337 continue;
@@ -274,27 +336,61 @@
274 336 if ( isset( $step['hidden'] ) && $step['hidden'] ) {
275 337 continue;
276 338 }
277 339
278 - if ( 'welcome' === $step_key ) {
279 - continue;
280 - }
281 340 ?>
282 - <div class="step
341 + <div
283 342 <?php
284 343 if ( $step_key === $this->step ) {
285 - echo 'active';
344 + // Check if this is the last step.
345 + $step_keys = array_keys( $this->steps ); // NOSONAR -- ??.
346 + $last_step_key = end( $step_keys );
347 +
348 + if ( $step_key === $last_step_key ) {
349 + echo 'class="step completed" aria-label="Completed: ' . esc_attr( $step['name'] ) . '"';
350 + } else {
351 + echo 'class="step active tada transition" aria-current="step"';
352 + }
286 353 } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
287 - echo 'completed';
354 + echo 'class="step completed" aria-label="Completed: ' . esc_attr( $step['name'] ) . '"';
355 + } else {
356 + echo 'class="step"';
288 357 }
289 358 ?>
290 - ">
291 - <div class="content">
292 - <div class="title"><?php echo esc_html( $step['name'] ); ?></div>
293 - </div>
359 + >
360 + <?php if ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) : ?>
361 + <span data-tooltip="<?php esc_attr_e( 'Completed!', 'mainwp' ); ?>" data-inverted="" data-position="bottom center">
362 + <?php endif; ?>
363 + <div class="content">
364 + <div class="title"><?php echo esc_html( $step['name'] ); ?></div>
365 + <div class="description"><?php echo esc_html( $step['desc'] ); ?></div>
366 + </div>
367 + <?php if ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) : ?>
368 + </span>
369 + <?php endif; ?>
294 370 </div>
295 371 <?php } ?>
296 372 </div>
373 + <script type="text/javascript">
374 + jQuery( document ).ready( function( $ ) {
375 + // Function to handle circular steps responsive behavior.
376 + function handleCircularStepsResize() {
377 + var circularSteps = jQuery('.ui.stackable.circular.steps'),
378 + isMobile = window.innerWidth <= 768;
379 + if (isMobile) {
380 + circularSteps.addClass('vertical');
381 + } else {
382 + circularSteps.removeClass('vertical');
383 + }
384 + }
385 +
386 + // Run on page load.
387 + handleCircularStepsResize();
388 +
389 + // Run on window resize.
390 + jQuery(window).on('resize', handleCircularStepsResize);
391 + });
392 + </script>
297 393 <?php
298 394 }
299 395
300 396 /**
@@ -314,31 +410,75 @@
314 410 *
315 411 * Renders the Welcome screen of the Quick Start Wizard
316 412 */
317 413 public function mwp_setup_welcome() {
318 - $is_new = MainWP_Demo_Handle::get_instance()->is_new_instance();
319 - $enabled_demo = apply_filters( 'mainwp_demo_mode_enabled', false );
320 - $count_sites = MainWP_DB::instance()->get_websites_count();
414 + delete_option( 'mainwp_run_quick_setup' );
321 415 ?>
322 - <h1 class="ui header"><?php esc_html_e( 'Welcome to your MainWP Dashboard!', 'mainwp' ); ?></h1>
323 - <div class="ui message" id="mainwp-message-zone" style="display:none"></div>
324 - <div class="ui hidden divider"></div>
325 - <h3><?php esc_html_e( 'Are you ready to get started adding your sites?', 'mainwp' ); ?></h3>
326 - <a class="ui big green basic button" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp-setup&step=introduction' ) ); ?>"><?php esc_html_e( 'Start the MainWP Quick Setup Wizard', 'mainwp' ); ?></a>
327 - <?php if ( 0 === $count_sites ) : ?>
328 - <div class="ui hidden divider"></div>
329 - <h3><?php esc_html_e( 'Would you like to see Demo content first? ', 'mainwp' ); ?> - <?php printf( esc_html__( '%sWhat is this?%s', 'mainwp' ), '<a href="https://www.youtube.com/watch?v=fCHT47AKt7s" target="_blank">', '</a>' ); ?></h3>
330 - <p><?php esc_attr_e( 'Explore MainWP\'s capabilities using our pre-loaded demo content.', 'mainwp' ); ?></p>
331 - <p><?php esc_attr_e( 'It\'s the perfect way to experience the benefits and ease of use MainWP provides without connecting to any of your own sites.', 'mainwp' ); ?></p>
332 - <p><?php esc_html_e( 'The demo content serves as placeholder data to give you a feel for the MainWP Dashboard. Please note that because no real websites are connected in this demo, some functionality will be restricted. Features that require a connection to actual websites will be disabled for the duration of the demo.', 'mainwp' ); ?></p>
333 - <p><?php esc_attr_e( 'Click this button to import the Demo content to your MainWP Dashboard and enable the Demo mode.', 'mainwp' ); ?></p>
334 - <p><span><button class="ui big green button mainwp-import-demo-data-button" page-import="qsw-import" <?php echo ! $is_new || $enabled_demo ? 'disabled="disabled"' : ''; ?>><?php esc_html_e( 'Enable Demo Mode With Guided Tours', 'mainwp' ); ?></button></span></p>
335 - <div class="ui blue message">
336 - <?php printf( esc_html__( 'Guided tours feature is implemented using Javascript provided by Usetiful and is subject to the %1$sUsetiful Privacy Policy%2$s.', 'mainwp' ), '<a href="https://www.usetiful.com/privacy-policy" target="_blank">', '</a>' ); ?>
416 + <div class="ui vertical basic padded segments">
417 + <div class="ui padded segment">
418 + <h1 class="ui massive header"><?php esc_html_e( 'Get Your MainWP Dashboard Running in 5 Minutes!', 'mainwp' ); ?></h1>
419 + <p><?php esc_html_e( 'Remember WordPress\' famous 5-minute install? This is that, but for your management dashboard.', 'mainwp' ); ?>
337 420 </div>
338 - <?php endif; ?>
421 + <div class="ui padded segment">
422 + <h2 class="ui big header"><?php esc_html_e( 'We\'ll walk you through:', 'mainwp' ); ?></h2>
423 + <h3 class="ui header"><?php esc_html_e( 'What to Expect in the Setup Wizard', 'mainwp' ); ?></h3>
424 + <div class="ui bulleted list">
425 + <div class="item" style="text-align:left">
426 + <strong><?php esc_html_e( 'System Check', 'mainwp' ); ?></strong> - <?php esc_html_e( 'Confirm your server is ready for MainWP.', 'mainwp' ); ?>
427 + </div>
428 + <div class="item" style="text-align:left">
429 + <strong><?php esc_html_e( 'Adding Your First Site', 'mainwp' ); ?></strong> - <?php esc_html_e( 'Connect your first WordPress install.', 'mainwp' ); ?>
430 + </div>
431 + <div class="item" style="text-align:left">
432 + <strong><?php esc_html_e( 'Adding Your First Client', 'mainwp' ); ?></strong> - <?php esc_html_e( 'Set up a client profile.', 'mainwp' ); ?>
433 + </div>
434 + <div class="item" style="text-align:left">
435 + <strong><?php esc_html_e( 'Monitoring Configuration', 'mainwp' ); ?></strong> - <?php esc_html_e( 'Enable uptime & site health checks.', 'mainwp' ); ?>
436 + </div>
437 + </div>
438 + <em><?php esc_html_e( 'Takes about 5 minutes, maybe less if your server\'s already configured.', 'mainwp' ); ?></em>
439 + <p><?php esc_html_e( 'If you don\'t want to go through the setup wizard, you can skip and proceed to your MainWP Dashboard by clicking the "Skip the Setup Wizard" link. If you change your mind, you can come back later by starting the Setup Wizard from the MainWP > Settings > MainWP Tools page!', 'mainwp' ); ?></p>
440 + </div>
441 + <div class="ui padded segment">
442 + <a class="ui huge green basic button" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp-setup&step=introduction' ) ); ?>"><?php esc_html_e( 'Start the MainWP Quick Setup Wizard', 'mainwp' ); ?></a>
443 + <div class="ui hidden divider"></div>
444 + <div class="ui hidden divider"></div>
445 + <?php esc_html_e( '...or ', 'mainwp' ); ?> <a class="" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp_tab' ) ); ?>"><?php esc_html_e( 'Skip the Setup Wizard', 'mainwp' ); ?></a>
446 + <div class="ui hidden divider"></div>
447 + <div class="ui hidden divider"></div>
448 + <em><?php esc_html_e( 'Your Dashboard may seem limited until you add sites or clients. Completing the setup ensures you\'re ready to unlock the full potential of MainWP.', 'mainwp' ); ?></em>
449 + </div>
450 + <div class="ui padded segment">
451 + <h2 class="ui header"><?php esc_html_e( 'Quick concepts if you\'re new to MainWP:', 'mainwp' ); ?></h2>
452 + <div><strong><?php esc_html_e( 'MainWP Dashboard', 'mainwp' ); ?></strong> <?php esc_html_e( 'Where you manage everything. This is what you just installed.', 'mainwp' ); ?></div>
453 + <div><strong><?php esc_html_e( 'MainWP Child', 'mainwp' ); ?></strong> <?php esc_html_e( 'Plugin you install on each site you want to manage. It connects your sites to this dashboard.', 'mainwp' ); ?></div>
454 + </div>
455 + </div>
339 456 <?php
340 - MainWP_System_View::render_comfirm_modal();
457 + if ( empty( get_user_option( 'mainwp_selected_theme' ) ) ) {
458 + $sites = MainWP_DB::instance()->get_sites(); // Get site data.
459 + if ( empty( $sites ) ) {
460 + ?>
461 + <script>
462 + jQuery(function ($) {
463 + let detectedMode = '';
464 + if(window.matchMedia('(prefers-color-scheme: dark)').matches){
465 + detectedMode = 'dark';
466 + } else if(window.matchMedia('(prefers-color-scheme: light)').matches){
467 + detectedMode = 'light';
468 + }
469 + let data = mainwp_secure_data({
470 + action: 'mainwp_qsw_ui_mode_detected',
471 + ui_mode: detectedMode,
472 + });
473 + $.post(ajaxurl, data, function (response) {
474 + // nothing.
475 + }, 'json');
476 + });
477 + </script>
478 + <?php
479 + }
480 + }
341 481 }
342 482
343 483 /**
344 484 * Method mwp_setup_introduction()
@@ -347,41 +487,43 @@
347 487 */
348 488 public function mwp_setup_introduction() {
349 489 ?>
350 490 <div class="ui message" id="mainwp-message-zone" style="display:none"></div>
351 - <h1 class="ui header"><?php esc_html_e( 'MainWP Quick Setup Wizard', 'mainwp' ); ?></h1>
352 - <div><?php esc_html_e( 'Thank you for choosing MainWP for managing your WordPress sites. This quick setup wizard will help you configure the basic settings. It\'s completely optional and shouldn\'t take longer than five minutes.', 'mainwp' ); ?></div>
491 + <div class="ui vertical basic padded segments">
492 + <div class="ui padded segment">
493 + <h1 class="ui massive header"><?php esc_html_e( 'MainWP Quick Setup Wizard', 'mainwp' ); ?></h1>
494 + <p><?php esc_html_e( 'Thank you for choosing MainWP for managing your WordPress sites. This quick setup wizard will help you configure the basic settings.', 'mainwp' ); ?></p>
495 + </div>
496 + <div class="ui padded segment">
497 + <a href="https://docs.mainwp.com/getting-started/get-started-with-mainwp" target="_blank" class="ui big icon green button"><i class="youtube icon"></i> <?php esc_html_e( 'Walkthrough', 'mainwp' ); ?></a>
498 + </div>
499 + </div>
353 500 <div class="ui hidden divider"></div>
354 - <a href="https://kb.mainwp.com/docs/quick-setup-wizard-video/" target="_blank" class="ui big icon green button"><i class="youtube icon"></i> <?php esc_html_e( 'Walkthrough', 'mainwp' ); ?></a>
355 501 <div class="ui hidden divider"></div>
356 - <p><?php esc_html_e( 'If you don\'t want to go through the setup wizard, you can skip and proceed to your MainWP Dashboard by clicking the "Not right now" button. If you change your mind, you can come back later by starting the Setup Wizard from the MainWP > Settings > MainWP Tools page!', 'mainwp' ); ?></p>
357 - <div class="ui hidden divider"></div>
358 - <form method="post" class="ui form">
359 - <h1><?php esc_html_e( 'MainWP Guided Tours', 'mainwp' ); ?> <span class="ui blue mini label"><?php esc_html_e( 'BETA', 'mainwp' ); ?></span></h1>
360 - <?php esc_html_e( 'MainWP guided tours are designed to provide information about all essential features on each MainWP Dashboard page.', 'mainwp' ); ?>
361 - <div class="ui blue message">
362 - <?php printf( esc_html__( 'This feature is implemented using Javascript provided by Usetiful and is subject to the %1$sUsetiful Privacy Policy%2$s.', 'mainwp' ), '<a href="https://www.usetiful.com/privacy-policy" target="_blank">', '</a>' ); ?>
502 + <form method="post">
503 + <div class="ui vertical basic padded segments">
504 + <div class="ui padded segment">
505 + <h2 class="ui big header"><?php esc_html_e( 'MainWP Guided Tours', 'mainwp' ); ?> <span class="ui blue mini label"><?php esc_html_e( 'BETA', 'mainwp' ); ?></span></h2>
506 + <p><?php esc_html_e( 'MainWP guided tours are designed to provide information about all essential features on each MainWP Dashboard page.', 'mainwp' ); ?></p>
507 + <div class="ui blue message">
508 + <?php /* translators: 1: opening anchor tag, 2: closing anchor tag */ printf( esc_html__( 'This feature is implemented using Javascript provided by Usetiful and is subject to the %1$sUsetiful Privacy Policy%2$s.', 'mainwp' ), '<a href="https://www.usetiful.com/privacy-policy" target="_blank">', '</a>' ); ?>
509 + </div>
510 + <div class="ui form">
511 + <div class="field">
512 + <label><?php esc_html_e( 'Do you want to enable MainWP Guided Tours?', 'mainwp' ); ?></label>
513 + <div class="ui hidden divider"></div>
514 + <div class="ui toggle checkbox">
515 + <input type="checkbox" name="mainwp-guided-tours-option" id="mainwp-guided-tours-option" checked="true">
516 + <label for="mainwp-guided-tours-option"><?php esc_html_e( 'Select to enable the MainWP Guided Tours.', 'mainwp' ); ?><span class="ui left pointing green label"><?php esc_html_e( 'Highly recommended if new to MainWP!', 'mainwp' ); ?></span></label>
517 + </div>
518 + </div>
519 + </div>
363 520 </div>
364 - <div class="ui form">
365 - <div class="field">
366 - <div class="ui hidden divider"></div>
367 - <label><?php esc_html_e( 'Do you want to enable MainWP Guided Tours?', 'mainwp' ); ?></label>
368 - <div class="ui hidden divider"></div>
369 - <div class="ui toggle checkbox">
370 - <input type="checkbox" name="mainwp-guided-tours-option" id="mainwp-guided-tours-option" checked="true">
371 - <label for="mainwp-guided-tours-option"><?php esc_html_e( 'Select to enable the MainWP Guided Tours.', 'mainwp' ); ?><span class="ui left pointing green label"><?php esc_html_e( 'Highly recommended if new to MainWP!', 'mainwp' ); ?></span></label>
372 - </div>
521 + <div class="ui padded segment">
522 + <input type="submit" class="ui big green basic right floated button" value="<?php esc_html_e( 'Let\'s Go!', 'mainwp' ); ?>" name="save_step" />
523 + <?php wp_nonce_field( 'mwp-setup' ); ?>
373 524 </div>
374 525 </div>
375 - <div class="ui hidden divider"></div>
376 - <p><?php esc_html_e( 'To go back to the WordPress Admin section, click the "Back to WP Admin" button.', 'mainwp' ); ?></p>
377 - <div class="ui hidden divider"></div>
378 - <div class="ui hidden divider"></div>
379 - <div class="ui hidden divider"></div>
380 - <input type="submit" class="ui big green right floated button" value="<?php esc_html_e( 'Let\'s Go!', 'mainwp' ); ?>" name="save_step" />
381 - <a href="<?php echo esc_url( admin_url( 'index.php' ) ); ?>" class="ui big button"><?php esc_html_e( 'Back to WP Admin', 'mainwp' ); ?></a>
382 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=managesites&do=new' ) ); ?>" class="ui big button"><?php esc_html_e( 'Not Right Now', 'mainwp' ); ?></a>
383 - <?php wp_nonce_field( 'mwp-setup' ); ?>
384 526 </form>
385 527 <?php
386 528 MainWP_System_View::render_comfirm_modal();
387 529 }
@@ -395,48 +537,55 @@
395 537 * @uses \MainWP\Dashboard\MainWP_Server_Information::render_quick_setup_system_check()
396 538 */
397 539 public function mwp_setup_system_requirements() {
398 540 ?>
399 - <h1><?php esc_html_e( 'System Requirements Check', 'mainwp' ); ?></h1>
400 - <?php MainWP_System_View::mainwp_warning_notice(); ?>
401 - <form method="post" class="ui form">
402 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
403 - <?php
404 - $show_ssl = false;
405 - if ( MainWP_Server_Information_Handler::is_openssl_config_warning() ) {
406 - $openssl_loc = MainWP_System_Utility::get_openssl_conf();
407 - ?>
408 - <div class="ui secondary segment">
409 - <div class="grouped fields">
410 - <label><?php esc_html_e( 'What is the openssl.cnf file location on your computer?', 'mainwp' ); ?></label>
411 - <div class="field" id="mainwp-setup-installation-openssl-location">
412 - <div class="ui fluid input">
413 - <input type="text" name="mwp_setup_openssl_lib_location" value="<?php echo esc_attr( $openssl_loc ); ?>">
541 + <div class="ui vertical basic padded segments">
542 + <div class="ui padded segment">
543 + <h1 class="ui massive header"><?php esc_html_e( 'System Requirements Check', 'mainwp' ); ?></h1>
544 + <p>
545 + <?php
546 + /* translators: 1: opening anchor tag, 2: closing anchor tag */
547 + printf( esc_html__( 'These checks ensure MainWP can connect to your child sites. If any check fails, %1$slearn how to resolve the issue%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/advanced/miscellaneous/mainwp-system-requirements" target="_blank">', '</a>' );
548 + ?>
549 + </p>
550 + <?php MainWP_System_View::mainwp_warning_notice(); ?>
551 + </div>
552 + </div>
553 + <form method="post" class="ui form">
554 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
555 + <div class="ui vertical basic padded segments">
556 + <?php
557 + $show_ssl = false;
558 + if ( MainWP_Server_Information_Handler::is_openssl_config_warning() ) {
559 + $openssl_loc = MainWP_System_Utility::get_openssl_conf();
560 + ?>
561 + <div class="ui padded segment">
562 + <div class="grouped fields">
563 + <label><?php esc_html_e( 'What is the openssl.cnf file location on your computer?', 'mainwp' ); ?></label>
564 + <div class="field" id="mainwp-setup-installation-openssl-location">
565 + <div class="ui fluid input">
566 + <input type="text" name="mwp_setup_openssl_lib_location" value="<?php echo esc_attr( $openssl_loc ); ?>">
567 + </div>
568 + <div><em><?php esc_html_e( 'Due to bug with PHP on some servers, enter the openssl.cnf file location so MainWP Dashboard can connect to your child sites. If your openssl.cnf file is saved to a different path from what is entered above please enter your exact path. ', 'mainwp' ); ?><?php /* translators: 1: opening anchor tag, 2: closing anchor tag with icon */ printf( esc_html__( '%1$sClick here%2$s to see how to find the OpenSSL.cnf file.', 'mainwp' ), '<a href="https://docs.mainwp.com/troubleshooting/potential-issues#openssl-library-error-invalid-request" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></em></div>
569 + </div>
570 + </div>
414 571 </div>
415 - <div><em><?php esc_html_e( 'Due to bug with PHP on some servers, enter the openssl.cnf file location so MainWP Dashboard can connect to your child sites. If your openssl.cnf file is saved to a different path from what is entered above please enter your exact path. ', 'mainwp' ); ?><?php printf( esc_html__( '%1$sClick here%2$s to see how to find the OpenSSL.cnf file.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/how-to-find-the-openssl-cnf-file/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></em></div>
416 - </div>
572 + <?php
573 + $show_ssl = true;
574 + }
575 + ?>
576 + <div class="ui padded segment">
577 + <?php MainWP_Server_Information::render_quick_setup_system_check(); ?>
417 578 </div>
579 + <div class="ui padded segment">
580 + <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic button"><i class="arrow left icon"></i> <?php esc_html_e( 'Back to Introduction', 'mainwp' ); ?></a>
581 + <?php if ( $show_ssl ) : ?>
582 + <input type="submit" class="ui big basic green right floated button" value="<?php esc_attr_e( 'Next', 'mainwp' ); ?>" name="save_step" />
583 + <?php else : ?>
584 + <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="ui big basic green right floated button"><?php esc_html_e( 'Next to Add Site', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
585 + <?php endif; ?>
586 + </div>
418 587 </div>
419 - <?php
420 - $show_ssl = true;
421 - }
422 - ?>
423 - <div class="ui message warning"><?php esc_html_e( 'Any warning here may cause the MainWP Dashboard to malfunction. After you complete the Quick Start setup it is recommended to contact your host’s support and updating your server configuration for optimal performance.', 'mainwp' ); ?></div>
424 - <?php MainWP_Server_Information::render_quick_setup_system_check(); ?>
425 - <div class="ui hidden divider"></div>
426 - <div class="ui hidden divider"></div>
427 - <div class="ui hidden divider"></div>
428 - <?php
429 - if ( $show_ssl ) {
430 - ?>
431 - <input type="submit" class="ui big green right floated button" value="<?php esc_attr_e( 'Continue', 'mainwp' ); ?>" name="save_step" />
432 - <?php
433 - } else {
434 - ?>
435 - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="ui big green right floated button"><?php esc_html_e( 'Continue', 'mainwp' ); ?></a>
436 - <?php } ?>
437 - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="ui big button"><?php esc_html_e( 'Skip', 'mainwp' ); ?></a>
438 - <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic green button"><?php esc_html_e( 'Back', 'mainwp' ); ?></a>
439 588 <?php wp_nonce_field( 'mwp-setup' ); ?>
440 589 </form>
441 590 <?php
442 591 }
@@ -487,10 +636,242 @@
487 636 wp_safe_redirect( $this->get_next_step_link() );
488 637 exit;
489 638 }
490 639
640 + /**
641 + * Method mwp_setup_connect_first_site()
642 + *
643 + * Render Install first Child Site Step form.
644 + *
645 + * @uses MainWP_Manage_Sites_View::render_import_sites()
646 + * @uses MainWP_Manage_Sites::mainwp_managesites_form_import_sites()
647 + * @uses MainWP_Manage_Sites::mainwp_managesites_information_import_sites()
648 + * @uses MainWP_Manage_Sites::render_import_sites_modal()
649 + * @uses MainWP_Utility::show_mainwp_message()
650 + */
651 + public function mwp_setup_connect_first_site() {
652 + $has_file_upload = isset( $_FILES['mainwp_managesites_file_bulkupload'] ) && isset( $_FILES['mainwp_managesites_file_bulkupload']['error'] ) && UPLOAD_ERR_OK === $_FILES['mainwp_managesites_file_bulkupload']['error'];
653 + $has_import_data = ! empty( $_POST['mainwp_managesites_import'] );
654 + ?>
655 + <div class="ui vertical basic padded segments">
656 + <div class="ui padded segment">
657 + <h1 class="ui massive header"><?php esc_html_e( 'Connect Your First Child Site', 'mainwp' ); ?></h1>
658 + <p><?php esc_html_e( 'In the MainWP system, the sites you connect are referred to as "Child Sites."', 'mainwp' ); ?> <?php esc_html_e( 'These Child Sites will be managed centrally from your MainWP Dashboard.', 'mainwp' ); ?></p>
659 + </div>
491 660
661 + <div class="ui padded segment">
662 + <div class="ui form">
663 + <div class="field">
664 + <label><?php esc_html_e( 'How would you like to get started?', 'mainwp' ); ?></label>
665 + </div>
666 + <div class="grouped fields mainwp-field-tab-connect">
667 + <div class="field">
668 + <div class="ui compact invisible checkbox">
669 + <input type="radio" name="tab_connect" tabindex="0" class="hidden" value="single-site">
670 + <label for="tab_connect" class="ui icon message">
671 + <i class="plus icon"></i>
672 + <div class="content">
673 + <div class="header"><?php esc_html_e( 'Add One Site ', 'mainwp' ); ?></div>
674 + <p><?php esc_html_e( 'Add one site now, add more later.', 'mainwp' ); ?></p>
675 + </div>
676 + </label>
677 + </div>
678 + </div>
679 + <div class="field">
680 + <div class="ui compact invisible checkbox">
681 + <input type="radio" name="tab_connect" tabindex="0" class="hidden" value="multiple-site">
682 + <label for="tab_connect" class="ui icon message">
683 + <i class="file upload icon"></i>
684 + <div class="content">
685 + <div class="header"><?php esc_html_e( 'Add Multiple Sites', 'mainwp' ); ?></div>
686 + <p><?php esc_html_e( 'Connect several sites right away.', 'mainwp' ); ?></p>
687 + </div>
688 + </label>
689 + </div>
690 + </div>
691 + </div>
692 + </div>
693 + </div>
694 + </div>
695 + <?php if ( ( $has_file_upload || $has_import_data ) && check_admin_referer( 'mainwp-admin-nonce' ) ) : ?>
696 + <?php
697 + $url = 'admin.php?page=mainwp-setup';
698 + $url .= '&step=add_client';
699 + MainWP_Manage_Sites::render_import_sites_modal( $url, 'Import Sites' );
700 + ?>
701 + <?php
702 + else :
703 + $el_id_msg_zn_1 = 'submit';
704 + ?>
705 + <form method="post" action="" class="ui form" enctype="multipart/form-data" id="mainwp_connect_first_site_form">
706 + <div class="ui vertical basic padded segments">
707 + <div class="ui padded segment">
708 + <div id="mainwp-qsw-connect-site-form" style="display:none">
709 + <div class="ui message" id="<?php echo esc_attr( $el_id_msg_zn_1 ); ?>" style="display:none"></div>
710 + <div class="ui red message" id="mainwp-error-zone" style="display:none"></div>
711 + <div class="ui green message" id="mainwp-success-zone" style="display:none"></div>
712 + <div class="ui info message" id="mainwp-info-zone" style="display:none"></div>
492 713
714 + <div class="ui top attached equal width tabular massive menu menu-connect-first-site">
715 + <a class="item active" data-tab="single-site"><i class="plus grey icon"></i> <?php esc_html_e( 'Connect a Single Site', 'mainwp' ); ?></a>
716 + <a class="item" data-tab="multiple-site"><i class="file upload grey icon"></i> <?php esc_html_e( 'Connect Multiple Sites', 'mainwp' ); ?></a>
717 + </div>
718 +
719 + <div class="ui bottom attached tab segment active" data-tab="single-site">
720 + <div>
721 + <div class="ui hidden divider"></div>
722 + <div class="field">
723 + <label for="mainwp_managesites_add_wpurl_protocol"><?php esc_html_e( 'What is the site URL?', 'mainwp' ); ?> <span class="ui red small text"><?php esc_html_e( '(Required)', 'mainwp' ); ?></span></label>
724 + <div class="ui left action input">
725 + <select class="ui compact selection dropdown" id="mainwp_managesites_add_wpurl_protocol" name="mainwp_managesites_add_wpurl_protocol" style="width:120px;padding:0px;">
726 + <option value="https">https://</option>
727 + <option value="http">http://</option>
728 + </select>
729 + <input type="text" id="mainwp_managesites_add_wpurl" name="mainwp_managesites_add_wpurl" value="" placeholder="yoursite.com" />
730 + </div>
731 + </div>
732 + <div class="ui hidden divider"></div>
733 + <div class="field">
734 + <label for="mainwp_managesites_add_wpadmin"><?php esc_html_e( 'What is your administrator username on that site? ', 'mainwp' ); ?> <span class="ui red small text"><?php esc_html_e( '(Required)', 'mainwp' ); ?></label>
735 + <input type="text" id="mainwp_managesites_add_wpadmin" name="mainwp_managesites_add_wpadmin" value="" />
736 + </div>
737 + <div class="ui hidden divider"></div>
738 + <div class="field">
739 + <label for=""><?php esc_html_e( 'Choose your connection authentication method:', 'mainwp' ); ?></label>
740 + <div class="ui hidden fitted divider"></div>
741 + <div class="ui toggle checked checkbox not-auto-init" id="addsite-adminpwd" style="margin-right:2em;">
742 + <input type="checkbox" id="mainwp-administrator-password-checkbox-field" checked=""><label><?php esc_html_e( 'Administrator password', 'mainwp' ); ?></label>
743 + </div>
744 + <div class="ui toggle checkbox not-auto-init" id="addsite-uniqueid">
745 + <input type="checkbox" id="mainwp-unique-security-id-checkbox-field"><label><?php esc_html_e( 'Unique Security ID', 'mainwp' ); ?></label>
746 + </div>
747 + </div>
748 + <div class="ui hidden divider"></div>
749 + <div class="ui fluid segment accordion" id="mainwp-connection-authentication-accordion" style="margin-top:1em">
750 + <div class="title">
751 + <i class="dropdown icon"></i>
752 + <?php esc_html_e( 'Connection authentication methods explained', 'mainwp' ); ?>
753 + </div>
754 + <div class="content">
755 + <span class="ui text"><?php esc_html_e( 'Choose options based on your MainWP Child plugin setup on the WordPress site you want to connect.', 'mainwp' ); ?></span>
756 + <div class="ui bulleted small list">
757 + <div class="item"><?php esc_html_e( 'Default Setup: Use only the Password field if you haven\'t changed the default settings.', 'mainwp' ); ?></div>
758 + <div class="item"><?php esc_html_e( 'Advanced Setup: If you\'ve turned off all verification on the child site, switch off both fields.', 'mainwp' ); ?></div>
759 + </div>
760 + <span class="ui text"><?php esc_html_e( 'Use the sliders to control the fields shown:', 'mainwp' ); ?></span>
761 + <div class="ui bulleted small list">
762 + <div class="item"><?php esc_html_e( 'Password On: Displays the Password field.', 'mainwp' ); ?></div>
763 + <div class="item"><?php esc_html_e( 'Security Key On: Displays the Security Key field.', 'mainwp' ); ?></div>
764 + <div class="item"><?php esc_html_e( 'Both On: Displays both fields.', 'mainwp' ); ?></div>
765 + <div class="item"><?php esc_html_e( 'Both Off: Hides both fields.', 'mainwp' ); ?></div>
766 + </div>
767 + <span class="ui text"><strong><?php esc_html_e( 'This needs to match what is set on your child site. Default is Administrator password.', 'mainwp' ); ?></strong></span>
768 + </div>
769 + </div>
770 + <div class="field" id="mainwp-administrator-password-field">
771 + <label for="mainwp_managesites_add_admin_pwd"><?php esc_html_e( 'What is your administrator password on that site?', 'mainwp' ); ?> <span class="ui red small text"><?php esc_html_e( '(Required if enabled)', 'mainwp' ); ?></span></label>
772 + <input type="password" id="mainwp_managesites_add_admin_pwd" name="mainwp_managesites_add_admin_pwd" value="" />
773 + <div class="ui up pointing basic grey label" style="line-height:1.5em"><?php esc_html_e( 'Your password is never stored by your Dashboard and never sent to MainWP.com. Once this initial connection is complete, your MainWP Dashboard generates a secure Public and Private key pair (2048 bits) using OpenSSL, allowing future connections without needing your password again. For added security, you can even change this admin password once connected, just be sure not to delete the admin account, as this would disrupt the connection.', 'mainwp' ); ?></div>
774 + </div>
775 + <div class="ui hidden divider"></div>
776 + <div class="field" id="mainwp-unique-security-id-field" style="display:none" >
777 + <label for="mainwp_managesites_add_uniqueId"><?php esc_html_e( 'Did you generate unique security ID on the site? If yes, copy it here, if not, leave this field blank. ', 'mainwp' ); ?> <span class="ui red small text"><?php esc_html_e( '(Required if enabled)', 'mainwp' ); ?></span></label>
778 + <input type="text" id="mainwp_managesites_add_uniqueId" name="mainwp_managesites_add_uniqueId" value="" />
779 + </div>
780 + <div class="ui hidden divider"></div>
781 + <div class="field">
782 + <label for="mainwp_managesites_add_wpname"><?php esc_html_e( 'Add site title: ', 'mainwp' ); ?> <span class="ui grey small text"><?php esc_html_e( '(Optional)', 'mainwp' ); ?></label>
783 + <input type="text" id="mainwp_managesites_add_wpname" name="mainwp_managesites_add_wpname" value="" />
784 + <em><?php esc_html_e( 'This is how your site will appear in your MainWP Dashboard. If you skip this, we\'ll use the site\'s URL automatically.', 'mainwp' ); ?></em>
785 + </div>
786 + </div>
787 + </div>
788 +
789 + <div class="ui bottom attached tab segment" data-tab="multiple-site">
790 + <div class="mainwp-wish-to-csv mainwp-wish-to-migrate">
791 + <div class="ui fluid segment accordion" id="mainwp-add-sites-info-accordion">
792 + <div class="title">
793 + <i class="dropdown icon"></i>
794 + <?php esc_html_e( 'Click here to see instructions for adding multiple sites.', 'mainwp' ); ?>
795 + </div>
796 + <div class="content">
797 + <?php MainWP_Manage_Sites::mainwp_managesites_information_import_sites( true ); ?>
798 + </div>
799 + </div>
800 + <?php MainWP_Manage_Sites::mainwp_managesites_form_import_sites(); ?>
801 + <div class="ui hidden divider"></div>
802 + <span class="ui grey text"><?php esc_html_e( 'Your password is never stored by your Dashboard and never sent to MainWP.com. Once this initial connection is complete, your MainWP Dashboard generates a secure Public and Private key pair (2048 bits) using OpenSSL, allowing future connections without needing your password again. For added security, you can even change this admin password once connected, just be sure not to delete the admin account, as this would disrupt the connection.', 'mainwp' ); ?></span>
803 + <div class="ui hidden divider"></div>
804 + <div class="ui hidden divider"></div>
805 + <div class="ui hidden divider"></div>
806 + <div class="ui horizontal left aligned divider">
807 + <?php esc_attr_e( 'or upload csv file', 'mainwp' ); ?>
808 + </div>
809 + <div class="ui hidden divider"></div>
810 + <div class="ui hidden divider"></div>
811 + <div class="ui hidden divider"></div>
812 + <div class="ui hidden divider"></div>
813 + <div class="field">
814 + <label for="mainwp_managesites_file_bulkupload"><?php esc_html_e( 'Upload the CSV file', 'mainwp' ); ?> (<a href="<?php echo esc_url( MAINWP_PLUGIN_URL . 'assets/csv/sample.csv' ); ?>"><?php esc_html_e( 'Download sample CSV file', 'mainwp' ); ?></a>)</label>
815 + <div class="ui grid">
816 + <div class="eight wide middle aligned column">
817 + <div class="ui file grey input">
818 + <input type="file" name="mainwp_managesites_file_bulkupload" id="connect_first_site_file_bulkupload" accept="text/comma-separated-values" />
819 + </div>
820 + </div>
821 + <div class="eight wide middle aligned column">
822 + <div class="ui toggle checkbox ten wide middle aligned column">
823 + <input type="checkbox" name="mainwp_managesites_chk_header_first" checked="checked" id="managesites_chk_header_first" value="1" /> <label for="mainwp_managesites_chk_header_first"><?php esc_html_e( 'CSV file contains a header', 'mainwp' ); ?></label>
824 + </div>
825 + </div>
826 + </div>
827 + </div>
828 + <div class="ui hidden divider"></div>
829 + </div>
830 + </div>
831 + </div>
832 + </div>
833 + <div class="ui padded segment">
834 + <div class="ui toggle checkbox" id="mainwp-qsw-toggle-verify-mainwp-child-active" style="display:none">
835 + <input type="checkbox" name="mainwp-qsw-verify-mainwp-child-active" id="mainwp-qsw-verify-mainwp-child-active" >
836 + <label for="mainwp-qsw-verify-mainwp-child-active" ><?php esc_html_e( 'Confirm that the MainWP Child plugin is activated on the site(s) you wish to connect.', 'mainwp' ); ?></label>
837 + </div>
838 + </div>
839 + <div class="ui padded segment">
840 + <?php wp_nonce_field( 'mwp-setup' ); ?>
841 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
842 + <input type="hidden" name="qsw_nonce[mainwp_addwp]" value="<?php echo esc_attr( wp_create_nonce( 'mainwp_addwp' ) ); ?>">
843 + <input type="hidden" name="qsw_nonce[mainwp_checkwp]" value="<?php echo esc_attr( wp_create_nonce( 'mainwp_checkwp' ) ); ?>">
844 +
845 +
846 + <div class="ui two column grid">
847 + <div class="column">
848 + <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic button"><i class="arrow left icon"></i> <?php esc_html_e( 'Back to System Check', 'mainwp' ); ?></a>
849 + </div>
850 +
851 + <div class="column">
852 + <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" id="mainwp_addsite_continue_button" class="ui big basic green right floated button"><?php esc_html_e( 'Continue Without Adding Sites', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
853 + <a style="display:none" name="mainwp_managesites_add" id="mainwp_managesites_add" class="ui button green basic big right floated disabled"><?php esc_html_e( 'Connect Site and Proceed', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
854 + <a style="display:none" name="mainwp_managesites_add_import" id="mainwp_managesites_add_import" class="ui button basic green big right floated disabled"><?php esc_html_e( 'Connect Sites and Proceed', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
855 + </div>
856 + </div>
857 + </div>
858 + </div>
859 + </form>
860 + <?php endif; ?>
861 +
862 + <script>
863 + jQuery('.menu-connect-first-site .item').tab({
864 + 'onVisible': function() {
865 + mainwp_menu_connect_first_site_onvisible_callback(this);
866 + }
867 + });
868 + jQuery('#mainwp-add-sites-info-accordion').accordion();
869 + </script>
870 + <?php
871 + MainWP_Manage_Sites::render_add_site_scripts();
872 + }
873 +
493 874 /**
494 875 * Method mwp_setup_connect_first_site_already()
495 876 *
496 877 * Render Added first Child Site Step form.
@@ -507,14 +888,14 @@
507 888 <label><?php esc_html_e( 'Do you want to create a client for your first child site?', 'mainwp' ); ?></label>
508 889 <div><?php esc_html_e( 'By adding a new client, you streamline site management within MainWP. Assigning sites to clients allows you to group and manage websites according to the clients they belong to for better organization and accessibility.', 'mainwp' ); ?></div>
509 890 <div class="ui hidden divider"></div>
510 891 <div class="ui toggle checkbox">
511 - <input type="checkbox" name="mainwp-qsw-confirm-add-new-client" id="mainwp-qsw-confirm-add-new-client" checked="true"/>
892 + <input type="checkbox" name="mainwp-qsw-confirm-add-new-client" id="mainwp-qsw-confirm-add-new-client" checked="true"/>
512 893 <label><?php esc_html_e( 'Select to create a New Client', 'mainwp' ); ?></label>
894 + </div>
513 895 </div>
514 - </div>
515 896 <?php } ?>
516 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
897 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
517 898 <div class="ui clearing hidden divider"></div>
518 899 <div class="ui hidden divider"></div>
519 900 <div class="ui hidden divider"></div>
520 901 <input type="submit" class="ui big green right floated button" value="<?php esc_attr_e( 'Continue', 'mainwp' ); ?>" name="save_step" />
@@ -525,151 +906,95 @@
525 906 </div>
526 907 <?php
527 908 }
528 909
529 -
530 910 /**
531 - * Method mwp_setup_connect_first_site()
911 + * Method mwp_setup_add_client()
532 912 *
533 - * Render Install first Child Site Step form.
913 + * Render Add first Client Step form.
534 914 */
535 - public function mwp_setup_connect_first_site() {
536 - $count = MainWP_DB::instance()->get_websites_count( null, true );
537 - if ( 1 <= $count ) {
538 - $this->mwp_setup_connect_first_site_already();
539 - return;
540 - }
915 + public function mwp_setup_add_client() {
916 + $count_clients = MainWP_DB_Client::instance()->count_total_clients();
917 + $sites = MainWP_DB::instance()->get_sites(); // Get site data.
918 + $total_sites = ! empty( $sites ) ? count( $sites ) : 5; // Set default.
919 + $item_class_active = 1 === $total_sites ? 'active' : '';
920 + $tab_class_active = 1 < $total_sites ? 'active' : '';
921 + $first_site_id = get_transient( 'mainwp_transient_just_connected_site_id' );
541 922 ?>
542 - <h1><?php esc_html_e( 'Connect Your First Child Site', 'mainwp' ); ?></h1>
543 - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-qsw-add-site-message' ) ) { ?>
544 - <div class="ui info message">
545 - <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-qsw-add-site-message"></i>
546 - <?php esc_html_e( 'MainWP requires the MainWP Child plugin to be installed and activated on the WordPress site that you want to connect to your MainWP Dashboard. ', 'mainwp' ); ?>
547 - <?php esc_html_e( 'To install the MainWP Child plugin, please follow these steps:', 'mainwp' ); ?>
548 - <ol>
549 - <li><?php printf( esc_html__( 'Login to the WordPress site you want to connect %1$s(open it in a new browser tab)%2$s', 'mainwp' ), '<em>', '</em>' ); ?></li>
550 - <li><?php printf( esc_html__( 'Go to the %1$sWP > Plugins%2$s page', 'mainwp' ), '<strong>', '</strong>' ); ?></li>
551 - <li><?php printf( esc_html__( 'Click %1$sAdd New%2$s to install a new plugin', 'mainwp' ), '<strong>', '</strong>' ); ?></li>
552 - <li><?php printf( esc_html__( 'In the %1$sSearch Field%2$s, enter "MainWP Child" and once the plugin shows, click the Install button', 'mainwp' ), '<strong>', '</strong>' ); ?></li>
553 - <li><?php printf( esc_html__( '%1$sActivate%2$s the plugin', 'mainwp' ), '<strong>', '</strong>' ); ?></li>
554 - </ol>
923 + <div class="ui vertical basic padded segments">
924 + <div class="ui padded segment">
925 + <h1 class="ui massive header"><?php esc_html_e( 'Add Your First Client', 'mainwp' ); ?></h1>
926 + <p><?php esc_html_e( 'In the MainWP system, Clients help you organize and group your Child Sites.', 'mainwp' ); ?> <?php esc_html_e( 'You can assign one or more sites to each Client to keep your Dashboard organized and make management easier.', 'mainwp' ); ?></p>
927 + </div>
555 928 </div>
556 - <?php } ?>
557 - <div class="ui form">
558 - <div class="field">
559 - <div class="ui hidden divider"></div>
560 - <label><?php esc_html_e( 'Is MainWP Child plugin installed and activated on the WordPress site that you want to connect?', 'mainwp' ); ?></label>
561 - <div class="ui hidden divider"></div>
562 - <div class="ui toggle checkbox">
563 - <input type="checkbox" name="mainwp-qsw-verify-mainwp-child-active" id="mainwp-qsw-verify-mainwp-child-active">
564 - <label for="mainwp-qsw-verify-mainwp-child-active"><?php esc_html_e( 'Select to confirm that the MainWP Child plugin is active.', 'mainwp' ); ?></label>
929 + <form action="" method="post" enctype="multipart/form-data" name="createclient_form" id="createclient_form" class="add:clients: validate">
930 + <div class="ui vertical basic padded segments">
931 + <div class="ui padded segment">
932 + <div class="ui red message" id="mainwp-message-zone" style="display:none"></div>
933 + <div class="ui message" id="mainwp-message-zone-client" style="display:none;"></div>
934 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
935 + <div class="ui top attached equal width tabular massive menu mainwp-qsw-add-client">
936 + <a class="item <?php echo esc_attr( $item_class_active ); ?>" data-tab="single-client"><i class="user grey icon"></i> <?php esc_html_e( 'Add a Single Client', 'mainwp' ); ?></a>
937 + <a class="item <?php echo esc_attr( $tab_class_active ); ?>" data-tab="multiple-client"><i class="users grey icon"></i> <?php esc_html_e( 'Add Multiple Clients', 'mainwp' ); ?></a>
565 938 </div>
566 - </div>
567 - </div>
568 - <form method="post" class="ui form">
569 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
570 - <div id="mainwp-qsw-connect-site-form" style="display:none">
571 - <div class="ui hidden divider"></div>
572 - <div class="ui hidden divider"></div>
573 - <div class="ui message" id="mainwp-message-zone" style="display:none"></div>
574 - <div class="ui red message" id="mainwp-error-zone" style="display:none"></div>
575 - <div class="ui green message" id="mainwp-success-zone" style="display:none"></div>
576 - <div class="ui info message" id="mainwp-info-zone" style="display:none"></div>
577 - <div class="ui hidden divider"></div>
578 - <div class="ui secondary segment">
939 + <div class="ui bottom attached tab segment <?php echo esc_attr( $item_class_active ); ?>" data-tab="single-client">
579 940 <div class="ui hidden divider"></div>
580 - <div class="ui hidden divider"></div>
581 - <div class="ui horizontal divider"><?php esc_html_e( 'Required Fields', 'mainwp' ); ?></div>
582 - <div class="ui hidden divider"></div>
583 - <div class="ui hidden divider"></div>
584 - <div class="field">
585 - <label><?php esc_html_e( 'What is the site URL? ', 'mainwp' ); ?></label>
586 - <div class="ui left action input">
587 - <select class="ui compact selection dropdown" id="mainwp_managesites_add_wpurl_protocol" name="mainwp_managesites_add_wpurl_protocol" style="width:120px;padding:0px;">
588 - <option value="https">https://</option>
589 - <option value="http">http://</option>
590 - </select>
591 - <input type="text" id="mainwp_managesites_add_wpurl" name="mainwp_managesites_add_wpurl" value="" placeholder="yoursite.com" />
941 + <div id="mainwp-add-new-client-form" >
942 + <?php $this->render_add_client_content( false, true ); ?>
943 + </div>
944 + <input type="hidden" name="selected_first_site" value="<?php echo intval( $first_site_id ); ?>">
945 + </div>
946 + <div class="ui bottom attached tab segment <?php echo esc_attr( $tab_class_active ); ?>" data-tab="multiple-client">
947 + <div class="ui blue message">
948 + <div><?php esc_html_e( 'For each site you’ve imported, please enter the Client Name and Client Email.', 'mainwp' ); ?></div>
949 + <div><?php esc_html_e( 'If the same client name and email are used across multiple sites, those sites will be merged and assigned to a single client profile.', 'mainwp' ); ?></div>
950 + <div><strong><?php esc_html_e( 'You can always update or edit this information later from the Clients module in your MainWP Dashboard.', 'mainwp' ); ?></strong></div>
951 + </div>
952 + <div>
953 + <div class="ui middle aligned left aligned compact grid">
954 + <div class="ui row">
955 + <div class="five wide column" >
956 + <span class="ui text small"><strong><?php esc_html_e( 'Client Site URL', 'mainwp' ); ?></strong> <span class="ui grey small text"><?php esc_html_e( '(Auto applied)', 'mainwp' ); ?></span></span>
957 + </div>
958 + <div class="five wide column">
959 + <span class="ui text small"><strong><?php esc_html_e( 'Client Name', 'mainwp' ); ?></strong> <span class="ui red small text"><?php esc_html_e( '(Required)', 'mainwp' ); ?></span></span>
960 + </div>
961 + <div class="five wide column">
962 + <span class="ui text small"><strong><?php esc_html_e( 'Client Email', 'mainwp' ); ?></strong> <span class="ui red small text"><?php esc_html_e( '(Required)', 'mainwp' ); ?></span></span>
963 + </div>
964 + <div class="one wide column">
965 + <span></span>
966 + </div>
592 967 </div>
968 + <?php
969 + for ( $i = 0; $i < $total_sites; $i++ ) {
970 + $website = isset( $sites[ $i ] ) ? $sites[ $i ] : array();
971 + $this->render_multi_add_client_content( $i, $website );
972 + }
973 + ?>
593 974 </div>
594 - <div class="field">
595 - <label><?php esc_html_e( 'What is your administrator username on that site? ', 'mainwp' ); ?></label>
596 - <input type="text" id="mainwp_managesites_add_wpadmin" name="mainwp_managesites_add_wpadmin" value="" />
597 975 </div>
598 - <div class="field">
599 - <label><?php esc_html_e( 'Add site title. If left blank URL is used.', 'mainwp' ); ?></label>
600 - <input type="text" id="mainwp_managesites_add_wpname" name="mainwp_managesites_add_wpname" value="" />
601 - </div>
602 - <div class="ui hidden divider"></div>
603 - <a href="#" id="mainwp-toggle-optional-settings"><i class="ui eye icon"></i> <?php esc_html_e( 'Advanced options', 'mainwp' ); ?></a>
604 - <div class="ui hidden divider"></div>
605 - <div id="mainwp-qsw-optional-settings-form" style="display:none">
606 - <div class="ui hidden divider"></div>
607 - <div class="ui horizontal divider"><?php esc_html_e( 'Advanced Options (optional)', 'mainwp' ); ?></div>
608 - <div class="ui hidden divider"></div>
609 - <div class="ui hidden divider"></div>
610 - <div class="field">
611 - <label><?php esc_html_e( 'Did you generate unique security ID on the site? If yes, copy it here, if not, leave this field blank. ', 'mainwp' ); ?></label>
612 - <input type="text" id="mainwp_managesites_add_uniqueId" name="mainwp_managesites_add_uniqueId" value="" />
613 - </div>
614 - </div>
615 976 </div>
616 977 </div>
617 - <div class="ui clearing hidden divider"></div>
618 - <div class="ui hidden divider"></div>
619 - <div class="ui hidden divider"></div>
620 - <input type="button" style="display:none" name="mainwp_managesites_add" id="mainwp_managesites_add" class="ui button green big right floated" value="<?php esc_attr_e( 'Connect Site', 'mainwp' ); ?>" />
621 - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" id="mainwp_addsite_continue_button" class="ui big green right floated button"><?php esc_html_e( 'Continue', 'mainwp' ); ?></a>
622 - <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic green button"><?php esc_html_e( 'Back', 'mainwp' ); ?></a>
623 - <?php wp_nonce_field( 'mwp-setup' ); ?>
624 - <input type="hidden" id="nonce_secure_data" mainwp_addwp="<?php echo esc_js( wp_create_nonce( 'mainwp_addwp' ) ); ?>" mainwp_checkwp="<?php echo esc_attr( wp_create_nonce( 'mainwp_checkwp' ) ); ?>" />
978 + <div class="ui padded segment">
979 + <a style="display:none" current-page="qsw-add" id="bulk_add_createclient" class="ui big green basic right floated button"><?php echo esc_attr__( 'Add and Proceed to Monitoring', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
980 + <a style="display:none" current-page="qsw-add" id="bulk_add_multi_create_client" class="ui big green basic right floated button"><?php echo esc_attr__( 'Add and Proceed to Monitoring', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
981 + <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" id="mainwp_qsw_add_client_continue_button" class="ui big green basic right floated button"><?php esc_html_e( 'Continue Without Creating Clients', 'mainwp' ); ?> <i class="arrow right icon"></i></a>
982 + <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic button"><i class="arrow left icon"></i> <?php esc_html_e( 'Back to Add Sites', 'mainwp' ); ?></a>
983 + </div>
984 + </div>
625 985 </form>
986 + <script>
987 + jQuery('.mainwp-qsw-add-client .item').tab({
988 + 'onVisible': function() {
989 + mainwp_add_client_onvisible_callback(this);
990 + }
991 + });
992 + </script>
626 993 <?php
627 994 }
628 995
629 996 /**
630 - * Method mwp_setup_add_client()
631 - *
632 - * Render Add first Client Step form.
633 - */
634 - public function mwp_setup_add_client() {
635 - $count_clients = MainWP_DB_Client::instance()->count_total_clients();
636 - if ( ! empty( $count_clients ) ) {
637 - ?>
638 - <h1 class="ui header"><?php esc_html_e( 'Congratulations!', 'mainwp' ); ?></h1>
639 - <p><?php esc_html_e( 'You have successfully created your first Client.', 'mainwp' ); ?></p>
640 - <?php
641 - } else {
642 - $first_site_id = get_transient( 'mainwp_transient_just_connected_site_id' );
643 - ?>
644 - <h1><?php esc_html_e( 'Create a Client', 'mainwp' ); ?></h1>
645 - <div class="ui secondary segment">
646 - <form action="" method="post" enctype="multipart/form-data" name="createclient_form" id="createclient_form" class="add:clients: validate">
647 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
648 - <div class="">
649 - <div class="ui hidden divider"></div>
650 - <div class="ui message" id="mainwp-message-zone-client" style="display:none;"></div>
651 - <div id="mainwp-add-new-client-form" >
652 - <?php $this->render_add_client_content( false, true ); ?>
653 - </div>
654 - </div>
655 - <input type="hidden" name="selected_first_site" value="<?php echo intval( $first_site_id ); ?>">
656 - </form>
657 - <div class="ui clearing hidden divider"></div>
658 - </div>
659 - <?php
660 - }
661 - ?>
662 - <div class="ui hidden divider"></div>
663 - <div class="ui hidden divider"></div>
664 - <input type="button" style="display:none" name="createclient" current-page="qsw-add" id="bulk_add_createclient" class="ui big green right floated button" value="<?php echo esc_attr__( 'Add Client', 'mainwp' ); ?> "/>
665 - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" id="mainwp_qsw_add_client_continue_button" class="ui big green right floated button"><?php esc_html_e( 'Continue', 'mainwp' ); ?></a>
666 - <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic green button"><?php esc_html_e( 'Back', 'mainwp' ); ?></a>
667 - <?php
668 - }
669 -
670 -
671 - /**
672 997 * Method render_add_client_content().
673 998 *
674 999 * Renders add client content window.
675 1000 */
@@ -676,10 +1001,20 @@
676 1001 public function render_add_client_content() {
677 1002 $edit_client = false;
678 1003 $client_id = 0;
679 1004 $default_client_fields = MainWP_Client_Handler::get_mini_default_client_fields();
1005 + $first_site_id = get_transient( 'mainwp_transient_just_connected_site_id' );
1006 + $website = MainWP_DB::instance()->get_website_by_id( $first_site_id );
680 1007 ?>
681 1008 <div class="ui form">
1009 + <?php if ( $first_site_id ) : ?>
1010 + <div class="field">
1011 + <label><?php esc_html_e( 'Client Site URL', 'mainwp' ); ?></label>
1012 + <div class="ui disabled fluid input">
1013 + <input type="text" value="<?php echo esc_url( $website->url ); ?>" />
1014 + </div>
1015 + </div>
1016 + <?php endif; ?>
682 1017 <?php
683 1018 foreach ( $default_client_fields as $field_name => $field ) {
684 1019 $db_field = isset( $field['db_field'] ) ? $field['db_field'] : '';
685 1020 $val = $edit_client && '' !== $db_field && property_exists( $edit_client, $db_field ) ? $edit_client->{$db_field} : '';
@@ -685,37 +1020,91 @@
685 1020 $val = $edit_client && '' !== $db_field && property_exists( $edit_client, $db_field ) ? $edit_client->{$db_field} : '';
686 1021 $tip = isset( $field['tooltip'] ) ? $field['tooltip'] : '';
687 1022 ?>
688 1023 <div class="field">
689 - <label <?php echo '' !== $tip ? 'data-tooltip="' . esc_attr( $tip ) . '" data-inverted="" data-position="top left"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php echo esc_html( $field['title'] ); ?></label>
1024 + <label for="client_fields[default_field][<?php echo esc_attr( $field_name ); ?>]"><?php echo esc_html( $field['title'] ); ?> <?php echo isset( $field['required'] ) && $field['required'] ? '<span class="ui red small text">' . esc_html__( '(Required)', 'mainwp' ) . '</span>' : ''; ?></label>
690 1025 <input type="text" value="<?php echo esc_html( $val ); ?>" id="mainwp_qsw_client_name_field" class="regular-text" name="client_fields[default_field][<?php echo esc_attr( $field_name ); ?>]"/>
691 1026 </div>
692 - <?php
1027 + <?php
693 1028
694 - if ( 'client.email' === $field_name ) {
695 - ?>
696 - <div class="field">
697 - <label><?php esc_html_e( 'Client photo', 'mainwp' ); ?></label>
698 - <div data-tooltip="<?php esc_attr_e( 'Upload a client photo.', 'mainwp' ); ?>" data-inverted="" data-position="top left">
699 - <div class="ui file input">
700 - <input type="file" name="mainwp_client_image_uploader[client_field]" accept="image/*" data-inverted="" data-tooltip="<?php esc_attr_e( "Image must be 500KB maximum. It will be cropped to 310px wide and 70px tall. For best results us an image of this site. Allowed formats: jpeg, gif and png. Note that animated gifs aren't going to be preserved.", 'mainwp' ); ?>" />
701 - </div>
1029 + if ( 'client.email' === $field_name ) {
1030 + ?>
1031 + <div class="field">
1032 + <label><?php esc_html_e( 'Client photo', 'mainwp' ); ?></label>
1033 + <div class="ui file grey input">
1034 + <input type="file" name="mainwp_client_image_uploader[client_field]" accept="image/*" data-inverted="" data-tooltip="<?php esc_attr_e( "Image must be 500KB maximum. It will be cropped to 310px wide and 70px tall. For best results us an image of this site. Allowed formats: jpeg, gif and png. Note that animated gifs aren't going to be preserved.", 'mainwp' ); ?>" />
702 1035 </div>
703 - </div>
704 - <?php
705 - }
1036 + </div>
1037 + <?php
1038 + }
706 1039 }
707 1040 $temp = $this->get_add_contact_temp( false );
708 1041 ?>
709 1042 <div class="field">
710 - <a href="javascript:void(0);" class="mainwp-client-add-contact" add-contact-temp="<?php echo esc_attr( $temp ); ?>"><i class="ui eye icon"></i><?php esc_html_e( 'Add Additional Contact', 'mainwp' ); ?></a>
1043 + <a href="javascript:void(0);" class="mainwp-client-add-contact" add-contact-temp="<?php echo esc_attr( $temp ); ?>"><i class="plus icon"></i><?php esc_html_e( 'Additional Contact Information', 'mainwp' ); ?></a>
711 1044 </div>
712 - <div class="ui section hidden divider after-add-contact-field"></div>
1045 + <div class="ui section hidden divider after-add-contact-field"></div>
713 1046 </div>
714 1047 <input type="hidden" name="client_fields[client_id]" value="<?php echo intval( $client_id ); ?>">
715 1048 <?php
716 1049 }
717 1050
1051 + /**
1052 + * Method render_multi_add_client_content()
1053 + *
1054 + * Render form multi create client.
1055 + *
1056 + * @uses MainWP_Client_Handler::get_mini_default_contact_fields()
1057 + *
1058 + * @param int $index row index.
1059 + * @param array $website website data.
1060 + */
1061 + public function render_multi_add_client_content( $index, $website ) {
1062 + $contact_fields = MainWP_Client_Handler::get_mini_default_contact_fields();
1063 + ?>
1064 + <div class="row mainwp-qsw-add-client-rows" id="mainwp-qsw-add-client-row-<?php echo esc_attr( $index ); ?>">
1065 + <div class="five wide column">
1066 + <div class="ui mini fluid input">
1067 + <input type="text" name="mainwp_add_client[<?php echo esc_attr( $index ); ?>][site_url]" class="mainwp-qsw-add-client-site-url" value="<?php echo isset( $website['url'] ) ? esc_attr( $website['url'] ) : ''; ?>" data-row-index="<?php echo esc_attr( $index ); ?>" id="mainwp-qsw-add-client-site-url-<?php echo esc_attr( $index ); ?>" <?php echo isset( $website['id'] ) ? 'disabled' : ''; ?>>
1068 + <?php if ( isset( $website['id'] ) ) : ?>
1069 + <input type="hidden" name="mainwp_add_client[<?php echo esc_attr( $index ); ?>][website_id]" value="<?php echo intval( $website['id'] ); ?>" id="mainwp-qsw-add-client-website-id-<?php echo esc_attr( $index ); ?>" >
1070 + <?php endif ?>
1071 + </div>
1072 + </div>
1073 + <div class="five wide column">
1074 + <div class="ui mini fluid input">
1075 + <input type="text" name="mainwp_add_client[<?php echo esc_attr( $index ); ?>][client_name]" class="mainwp-qsw-add-client-client-name" value="" data-row-index="<?php echo esc_attr( $index ); ?>" id="mainwp-qsw-add-client-client-name-<?php echo esc_attr( $index ); ?>">
1076 + </div>
1077 + </div>
1078 + <div class="five wide column">
1079 + <div class="ui mini fluid input">
1080 + <input type="email" name="mainwp_add_client[<?php echo esc_attr( $index ); ?>][client_email]" class="mainwp-qsw-add-client-client-email" value="" data-row-index="<?php echo esc_attr( $index ); ?>" id="mainwp-qsw-add-client-client-email-<?php echo esc_attr( $index ); ?>">
1081 + </div>
1082 + </div>
1083 + <div class="one wide column">
1084 + <div class="ui mini fluid input">
1085 + <a class="mainwp-qsw-add-client-more-row" onclick="mainwp_qsw_add_client_more_row(<?php echo esc_attr( $index ); ?>)" style="margin-right: 10px !important;">
1086 + <i class="caret left icon" id="icon-visible-<?php echo esc_attr( $index ); ?>"></i>
1087 + <i class="caret down icon" id="icon-hidden-<?php echo esc_attr( $index ); ?>" style="display:none"></i>
1088 + </a>
1089 + <a class="mainwp-qsw-add-client-delete-row" href="javascript:void(0)" onclick="mainwp_qsw_add_client_delete_row(<?php echo esc_attr( $index ); ?>)">
1090 + <i class="trash alternate outline icon"></i>
1091 + </a>
1092 + </div>
1093 + </div>
1094 + <?php if ( ! empty( $contact_fields ) ) : ?>
1095 + <?php foreach ( $contact_fields as $field_name => $field ) : ?>
1096 + <div class="five wide column mainwp-qsw-add-client-column-more-<?php echo esc_attr( $index ); ?>" style="display:none">
1097 + <span class="ui small text"><?php echo esc_html( $field['title'] ); ?></span>
1098 + <div class="ui mini fluid input">
1099 + <input type="text" name="client_fields[<?php echo esc_attr( $index ); ?>][new_contacts_field][<?php echo esc_attr( $field_name ); ?>][]" class="mainwp-qsw-add-client-client-fields">
1100 + </div>
1101 + </div>
1102 + <?php endforeach; ?>
1103 + <?php endif; ?>
1104 + </div>
1105 + <?php
1106 + }
718 1107
719 1108 /**
720 1109 * Method get_add_contact_temp().
721 1110 *
@@ -729,9 +1118,9 @@
729 1118 $contact_id = 0;
730 1119 ob_start();
731 1120 ?>
732 1121 <div class="ui hidden divider top-contact-fields"></div> <?php // must have class: top-contact-fields. ?>
733 - <div class="ui horizontal divider"><?php esc_html_e( 'Add Contact', 'mainwp' ); ?></div>
1122 + <div class="ui left aligned horizontal divider"><?php esc_html_e( 'Additional Contact Information', 'mainwp' ); ?></div>
734 1123 <div class="ui hidden divider"></div>
735 1124 <div class="ui hidden divider"></div>
736 1125 <?php
737 1126 $contact_fields = MainWP_Client_Handler::get_mini_default_contact_fields();
@@ -739,9 +1128,9 @@
739 1128 $val = '';
740 1129 $contact_id = '';
741 1130 ?>
742 1131 <div class="field">
743 - <label><?php echo esc_html( $field['title'] ); ?></label>
1132 + <label><?php echo esc_html( $field['title'] ); ?> <?php echo isset( $field['required'] ) && $field['required'] ? '<span class="ui red small text">' . esc_html__( '(Required)', 'mainwp' ) . '</span>' : ''; ?></label>
744 1133 <input type="text" value="<?php echo esc_html( $val ); ?>" class="regular-text" name="client_fields[<?php echo esc_html( $input_name ); ?>][<?php echo esc_attr( $field_name ); ?>][]"/>
745 1134 </div>
746 1135 <?php
747 1136 }
@@ -746,9 +1135,9 @@
746 1135 <?php
747 1136 }
748 1137 ?>
749 1138 <div class="field remove-contact-field-parent">
750 - <a href="javascript:void(0);" contact-id="<?php echo intval( $contact_id ); ?>" class="mainwp-client-remove-contact"><i class="ui eye icon"></i><?php esc_html_e( 'Remove contact', 'mainwp' ); ?></a>
1139 + <a href="javascript:void(0);" contact-id="<?php echo intval( $contact_id ); ?>" class="mainwp-client-remove-contact"><i class="minus icon"></i><?php esc_html_e( 'Remove contact', 'mainwp' ); ?></a>
751 1140 </div>
752 1141 <div class="ui section hidden divider bottom-contact-fields"></div>
753 1142 <?php
754 1143 $html = ob_get_clean();
@@ -764,92 +1153,127 @@
764 1153 * Render Monitoring Step.
765 1154 */
766 1155 public function mwp_setup_monitoring() {
767 1156
768 - $disableSitesMonitoring = (int) get_option( 'mainwp_disableSitesChecking', 1 );
769 - $frequencySitesChecking = (int) get_option( 'mainwp_frequencySitesChecking', 60 );
770 -
771 1157 $disableSitesHealthMonitoring = get_option( 'mainwp_disableSitesHealthMonitoring', 1 );
772 1158 $sitehealthThreshold = get_option( 'mainwp_sitehealthThreshold', 80 ); // "Should be improved" threshold.
773 1159
1160 + $global_settings = MainWP_Uptime_Monitoring_Handle::get_global_monitoring_settings();
1161 +
1162 + $glo_active = 0;
1163 + if ( isset( $global_settings['active'] ) ) {
1164 + $glo_active = 1 === (int) $global_settings['active'] ? 1 : 0;
1165 + }
774 1166 ?>
775 - <h1 class="ui header">
776 - <?php esc_html_e( 'Basic Uptime Monitoring', 'mainwp' ); ?>
777 - </h1>
778 - <div><?php esc_html_e( 'The MainWP Basic Uptime Monitoring function periodically sends HTTP requests to your child sites, based on a chosen frequency from every 5 minutes to once daily, to check their operational status. It uses a direct cURL request to obtain an HTTP Header response, alerting you via email if a site fails to return a Status Code 200 (OK). This feature operates independently of third-party services, providing a straightforward and no-cost option for uptime monitoring across all your managed sites. However, it does not diagnose the specific nature of errors leading to site unavailability.', 'mainwp' ); ?></div>
779 - <div class="ui hidden divider"></div>
780 - <div class="ui hidden divider"></div>
781 1167 <form method="post" class="ui form">
782 - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
783 - <div class="ui grid field settings-field-indicator-wrapper" default-indi-value="1">
784 - <div class="ui info message"><?php printf( esc_html__( 'Excessive checking can cause server resource issues. For frequent checks or lots of sites, we recommend the %1$sMainWP Advanced Uptime Monitoring%2$s extension.', 'mainwp' ), '<a href="https://mainwp.com/extension/advanced-uptime-monitor" target="_blank">', '</a>' ); // NOSONAR - noopener - open safe. ?></div>
785 - <label class="six wide column middle aligned">
786 - <?php
787 - MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_disableSitesChecking', (int) $disableSitesMonitoring );
788 - esc_html_e( 'Enable basic uptime monitoring', 'mainwp' );
789 - ?>
790 - </label>
791 - <div class="ten wide column ui toggle checkbox mainwp-checkbox-showhide-elements" hide-parent="monitoring" style="max-width:100px !important;">
792 - <input type="checkbox" class="settings-field-value-change-handler" inverted-value="1" name="mainwp_setup_disableSitesChecking" id="mainwp_setup_disableSitesChecking" <?php echo 1 === $disableSitesMonitoring ? '' : 'checked="true"'; ?>/>
793 - <label class=""></label>
1168 + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
1169 + <div class="ui vertical basic padded segments">
1170 + <div class="ui padded segment">
1171 + <h1 class="ui massive header"><?php esc_html_e( 'Enable Monitoring for Your Sites', 'mainwp' ); ?></h1>
1172 + <p><?php esc_html_e( 'MainWP can automatically keep an eye on your Child Sites\' uptime and overall health.', 'mainwp' ); ?></p>
794 1173 </div>
795 1174 </div>
796 -
797 - <div class="ui grid field" <?php echo $disableSitesMonitoring ? 'style="display:none"' : ''; ?> hide-element="monitoring">
798 - <label class="six wide column middle aligned"><?php esc_html_e( 'Check interval', 'mainwp' ); ?></label>
799 - <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Select preferred checking interval.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
800 - <select name="mainwp_setup_frequency_sitesChecking" id="mainwp_setup_frequency_sitesChecking" class="ui dropdown">
801 - <option value="5" <?php echo 5 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Every 5 minutes', 'mainwp' ); ?></option>
802 - <option value="10" <?php echo 10 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Every 10 minutes', 'mainwp' ); ?></option>
803 - <option value="30" <?php echo 30 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Every 30 minutes', 'mainwp' ); ?></option>
804 - <option value="60" <?php echo 60 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Every hour', 'mainwp' ); ?></option>
805 - <option value="180" <?php echo 180 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Every 3 hours', 'mainwp' ); ?></option>
806 - <option value="360" <?php echo 360 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Every 6 hours', 'mainwp' ); ?></option>
807 - <option value="720" <?php echo 720 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Twice a day', 'mainwp' ); ?></option>
808 - <option value="1440" <?php echo 1440 === $frequencySitesChecking ? 'selected' : ''; ?>><?php esc_html_e( 'Once a day', 'mainwp' ); ?></option>
809 - </select>
1175 + <div class="ui vertical basic padded segments">
1176 + <div class="ui padded segment">
1177 + <h2 class="ui big header"><?php esc_html_e( 'Uptime Monitoring', 'mainwp' ); ?></h2>
1178 + <p><?php esc_html_e( 'MainWP checks your sites at regular intervals to ensure they\'re online and reachable. You\'ll get an email alert if any site goes down. No third-party service needed.', 'mainwp' ); ?></p>
1179 + <div class="ui hidden divider"></div>
1180 + <div class="field settings-field-indicator-wrapper settings-field-indicator-monitor-general" default-indi-value="0">
1181 + <label>
1182 + <?php
1183 + MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_setup_enableUptimeMonitoring', (int) $glo_active, true, 0 );
1184 + esc_html_e( 'Enable uptime monitoring', 'mainwp' );
1185 + ?>
1186 + </label>
1187 + <div class="ui hidden divider"></div>
1188 + <div class="ui toggle checkbox mainwp-checkbox-showhide-elements" hide-parent="uptime-monitoring">
1189 + <input type="checkbox" value="1" class="settings-field-value-change-handler" name="mainwp_setup_enableUptimeMonitoring" id="mainwp_setup_enableUptimeMonitoring" <?php echo 1 === (int) $glo_active ? 'checked="true"' : ''; ?>/>
1190 + </div>
1191 + </div>
1192 + <div class="ui hidden divider"></div>
1193 + <div class="field settings-field-indicator-wrapper settings-field-indicator-monitor-general" default-indi-value="60" <?php echo $glo_active ? '' : 'style="display:none"'; ?> hide-element="uptime-monitoring">
1194 + <label>
1195 + <?php
1196 + MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_setup_monitor_interval_hidden', (int) $global_settings['interval'], true, 60 );
1197 + esc_html_e( 'Monitor interval (minutes)', 'mainwp' );
1198 + ?>
1199 + </label>
1200 + <div class="ui hidden divider"></div>
1201 + <div class="ui labeled ticked slider settings-field-value-change-handler" id="mainwp_setup_monitor_interval_slider" style="max-width: 600px"></div>
1202 + <input type="hidden" name="mainwp_setup_monitor_interval_hidden" class="settings-field-value-change-handler" id="mainwp_setup_monitor_interval_hidden" value="<?php echo intval( $global_settings['interval'] ); ?>" />
1203 + </div>
810 1204 </div>
811 1205 </div>
812 - <h1 class="ui header">
813 - <?php esc_html_e( 'Site Health Monitoring', 'mainwp' ); ?>
814 - </h1>
815 - <div><?php esc_html_e( "The MainWP Site Health Monitoring feature integrates with WordPress 5.1's Site Health tool, providing centralized notifications regarding the health status of your child sites. It allows you to choose between being notified for any status changes or only when the health drops below the 'Good' threshold, ensuring you're informed about crucial security and performance metrics.", 'mainwp' ); ?></div>
816 - <div class="ui hidden divider"></div>
817 - <div class="ui hidden divider"></div>
818 - <div class="ui grid field settings-field-indicator-wrapper" default-indi-value="1">
819 - <label class="six wide column middle aligned">
820 - <?php
821 - MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_disableSitesHealthMonitoring', (int) $disableSitesHealthMonitoring );
822 - esc_html_e( 'Enable Site Health monitoring', 'mainwp' );
823 - ?>
824 - </label>
825 - <div class="ten wide column ui toggle checkbox mainwp-checkbox-showhide-elements" hide-parent="health-monitoring" style="max-width:100px !important;">
826 - <input type="checkbox" class="settings-field-value-change-handler" inverted-value="1" name="mainwp_setup_disable_sitesHealthMonitoring" id="mainwp_setup_disable_sitesHealthMonitoring" <?php echo 1 === (int) $disableSitesHealthMonitoring ? '' : 'checked="true"'; ?>/>
1206 + <div class="ui vertical basic padded segments">
1207 + <div class="ui padded segment">
1208 + <h2 class="ui big header"><?php esc_html_e( 'Site Health Monitoring', 'mainwp' ); ?></h2>
1209 + <p><?php esc_html_e( 'MainWP keeps an eye on each site\'s WordPress Site Health status and alerts you if any issues appear or a site\'s health drops below "Good".', 'mainwp' ); ?></p>
1210 + <div class="ui hidden divider"></div>
1211 + <div class="field settings-field-indicator-wrapper" default-indi-value="1">
1212 + <label>
1213 + <?php
1214 + MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_disableSitesHealthMonitoring', (int) $disableSitesHealthMonitoring );
1215 + esc_html_e( 'Enable site health monitoring', 'mainwp' );
1216 + ?>
1217 + </label>
1218 + <div class="ui hidden divider"></div>
1219 + <div class="ui toggle checkbox mainwp-checkbox-showhide-elements" hide-parent="health-monitoring">
1220 + <input type="checkbox" class="settings-field-value-change-handler" inverted-value="1" name="mainwp_setup_disable_sitesHealthMonitoring" id="mainwp_setup_disable_sitesHealthMonitoring" <?php echo 1 === (int) $disableSitesHealthMonitoring ? '' : 'checked="true"'; ?>/>
1221 + </div>
1222 + </div>
1223 + <div class="ui hidden divider"></div>
1224 + <div class="field settings-field-indicator-wrapper" default-indi-value="80" <?php echo $disableSitesHealthMonitoring ? 'style="display:none"' : ''; ?> hide-element="health-monitoring">
1225 + <label>
1226 + <?php
1227 + MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_sitehealthThreshold', (int) $sitehealthThreshold );
1228 + esc_html_e( 'Site health threshold', 'mainwp' );
1229 + ?>
1230 + </label>
1231 + <div class="ui hidden divider"></div>
1232 + <select name="mainwp_setup_site_healthThreshold" id="mainwp_setup_site_healthThreshold" class="ui compact dropdown settings-field-value-change-handler">
1233 + <option value="80" <?php echo 80 === $sitehealthThreshold || 0 === $sitehealthThreshold ? 'selected' : ''; ?>><?php esc_html_e( 'Should be improved', 'mainwp' ); ?></option>
1234 + <option value="100" <?php echo 100 === $sitehealthThreshold ? 'selected' : ''; ?>><?php esc_html_e( 'Good', 'mainwp' ); ?></option>
1235 + </select>
1236 + </div>
827 1237 </div>
828 - </div>
829 -
830 - <div class="ui grid field settings-field-indicator-wrapper" default-indi-value="80" <?php echo $disableSitesHealthMonitoring ? 'style="display:none"' : ''; ?> hide-element="health-monitoring">
831 - <label class="six wide column middle aligned">
832 - <?php
833 - MainWP_Settings_Indicator::render_not_default_indicator( 'mainwp_sitehealthThreshold', (int) $sitehealthThreshold );
834 - esc_html_e( 'Site health threshold', 'mainwp' );
835 - ?>
836 - </label>
837 - <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Set preferred site health threshold.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left">
838 - <select name="mainwp_setup_site_healthThreshold" id="mainwp_setup_site_healthThreshold" class="ui dropdown settings-field-value-change-handler">
839 - <option value="80" <?php echo 80 === $sitehealthThreshold || 0 === $sitehealthThreshold ? 'selected' : ''; ?>><?php esc_html_e( 'Should be improved', 'mainwp' ); ?></option>
840 - <option value="100" <?php echo 100 === $sitehealthThreshold ? 'selected' : ''; ?>><?php esc_html_e( 'Good', 'mainwp' ); ?></option>
841 - </select>
1238 + <div class="ui padded segment">
1239 + <input type="submit" class="ui big green basic right floated button" value="<?php esc_attr_e( 'Save and Finish!', 'mainwp' ); ?>" name="save_step" />
1240 + <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic button"><i class="arrow left icon"></i> <?php esc_html_e( 'Back to Add Client', 'mainwp' ); ?></a>
842 1241 </div>
843 1242 </div>
844 - <div class="ui hidden divider"></div>
845 - <div class="ui hidden divider"></div>
846 - <input type="submit" class="ui big green right floated button" value="<?php esc_attr_e( 'Continue', 'mainwp' ); ?>" name="save_step" />
847 - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="ui big button"><?php esc_html_e( 'Skip', 'mainwp' ); ?></a>
848 - <a href="<?php echo esc_url( $this->get_back_step_link() ); ?>" class="ui big basic green button"><?php esc_html_e( 'Back', 'mainwp' ); ?></a>
849 -
850 1243 <?php wp_nonce_field( 'mwp-setup' ); ?>
851 1244 </form>
1245 +
1246 + <script type="text/javascript">
1247 + <?php
1248 + $all_intervals = MainWP_Uptime_Monitoring_Edit::get_interval_values( false );
1249 + echo 'var interval_label = ' . wp_json_encode( array_values( $all_intervals ) ) . ";\n";
1250 + echo 'var interval_values = ' . wp_json_encode( array_keys( $all_intervals ) ) . ";\n";
1251 + ?>
1252 + jQuery('#mainwp_setup_monitor_interval_slider').slider({
1253 + interpretLabel: function(value) {
1254 + return interval_label[value];
1255 + },
1256 + autoAdjustLabels: false,
1257 + min: 0,
1258 + smooth: true,
1259 + restrictedLabels: [interval_label[0],interval_label[<?php echo count( $all_intervals ) - 1; ?>]],
1260 + showThumbTooltip: true,
1261 + tooltipConfig: {
1262 + position: 'bottom center',
1263 + variation: 'small visible black'
1264 + },
1265 + max: <?php echo count( $all_intervals ) - 1; ?>,
1266 + onChange: function(value) {
1267 + jQuery('#mainwp_setup_monitor_interval_hidden').val(interval_values[value]).change();
1268 + },
1269 + onMove: function(value) {
1270 + jQuery(this).find('.thumb').attr('data-tooltip', interval_label[value]);
1271 + }
1272 + });
1273 + jQuery('#mainwp_setup_monitor_interval_slider').slider('set value', interval_values.indexOf(<?php echo intval( $global_settings['interval'] ); ?>));
1274 + </script>
1275 +
852 1276 <?php
853 1277 }
854 1278
855 1279 /**
@@ -861,11 +1285,15 @@
861 1285 */
862 1286 public function mwp_setup_monitoring_save() {
863 1287 check_admin_referer( 'mwp-setup' );
864 1288 // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
865 - MainWP_Utility::update_option( 'mainwp_disableSitesChecking', ( ! isset( $_POST['mainwp_setup_disableSitesChecking'] ) ? 1 : 0 ) );
866 - $val = isset( $_POST['mainwp_setup_frequency_sitesChecking'] ) ? intval( $_POST['mainwp_setup_frequency_sitesChecking'] ) : 1440;
867 - MainWP_Utility::update_option( 'mainwp_frequencySitesChecking', $val );
1289 +
1290 + $global_settings = MainWP_Uptime_Monitoring_Handle::get_global_monitoring_settings();
1291 + $global_settings['active'] = ! empty( $_POST['mainwp_setup_enableUptimeMonitoring'] ) ? 1 : 0;
1292 + $global_settings['interval'] = isset( $_POST['mainwp_setup_monitor_interval_hidden'] ) ? intval( $_POST['mainwp_setup_monitor_interval_hidden'] ) : 60;
1293 +
1294 + MainWP_Uptime_Monitoring_Handle::update_uptime_global_settings( $global_settings );
1295 +
868 1296 MainWP_Utility::update_option( 'mainwp_disableSitesHealthMonitoring', ( ! isset( $_POST['mainwp_setup_disable_sitesHealthMonitoring'] ) ? 1 : 0 ) );
869 1297 $val = isset( $_POST['mainwp_setup_site_healthThreshold'] ) ? intval( $_POST['mainwp_setup_site_healthThreshold'] ) : 80;
870 1298 MainWP_Utility::update_option( 'mainwp_sitehealthThreshold', $val );
871 1299 // phpcs:enable
@@ -881,17 +1309,30 @@
881 1309 public function mwp_setup_ready() {
882 1310 ?>
883 1311 <div class="ui hidden divider"></div>
884 1312 <div class="ui hidden divider"></div>
885 - <h1 class="ui icon header" style="display:block">
886 - <i class="thumbs up outline icon"></i>
887 - <div class="content">
888 - <?php esc_html_e( 'Your MainWP Dashboard is Ready!', 'mainwp' ); ?>
889 - <div class="sub header"><?php esc_html_e( 'Congratulations! Now you are ready to start managing your WordPress sites.', 'mainwp' ); ?></div>
890 - <div class="ui hidden divider"></div>
891 - <a class="ui massive green button" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp_tab' ) ); ?>"><?php esc_html_e( 'Start Managing Your Sites', 'mainwp' ); ?></a>
1313 + <div class="ui basic segment">
1314 + <h1 class="ui icon huge header">
1315 + <em data-emoji=":tada:" class="big tadaaaa"></em>
1316 + </h1>
1317 + <h2 class="ui massive header"><?php esc_html_e( 'Setup Complete!', 'mainwp' ); ?></h2>
1318 + </div>
1319 + <div class="ui basic segment">
1320 + <div><?php esc_html_e( 'Your MainWP Dashboard is configured and connected. You can now:', 'mainwp' ); ?></div>
1321 + <div class="ui bulleted list">
1322 + <div class="item"><?php esc_html_e( 'Manage updates across all connected sites', 'mainwp' ); ?></div>
1323 + <div class="item"><?php esc_html_e( 'Monitor uptime and site performance', 'mainwp' ); ?></div>
1324 + <div class="item"><?php esc_html_e( 'Update plugins and themes in bulk', 'mainwp' ); ?></div>
1325 + <div class="item"><?php esc_html_e( 'Run backups and maintenance tasks', 'mainwp' ); ?></div>
1326 + <div class="item"><?php esc_html_e( 'And much more, all from YOUR MainWP Dashboard.', 'mainwp' ); ?></div>
892 1327 </div>
893 - </h1>
1328 + </div>
1329 + <div class="ui basic segment">
1330 + <a class="ui huge green fade in transition button" href="<?php echo esc_url( admin_url( 'admin.php?page=mainwp_tab' ) ); ?>"><?php esc_html_e( 'Go to Dashboard', 'mainwp' ); ?></a>
1331 + </div>
1332 + <div class="ui basic segment">
1333 + <span class="ui grey text"><?php esc_html_e( 'Your connected sites are ready to manage from your MainWP Dashboard.', 'mainwp' ); ?></span>
1334 + </div>
894 1335 <div class="ui hidden divider"></div>
895 1336 <div class="ui hidden divider"></div>
896 1337 <?php
897 1338 }