Skip to content

Commit d1c8025

Browse files
refactor: update description text
1 parent 60fbdc1 commit d1c8025

File tree

3 files changed

+53
-25
lines changed

3 files changed

+53
-25
lines changed

assets/js/scripts-admin.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,19 @@ jQuery( function( $ ) {
571571
*/
572572
function addToPage( data, callback ) {
573573
if ($('.wpmm-templates-radio').hasClass('disabled')) {
574-
data.category = '';
574+
$.post( wpmmVars.ajaxURL, {
575+
action: 'wpmm_skip_insert_template',
576+
_wpnonce: wpmmVars.wizardNonce,
577+
}, function( response ) {
578+
if ( ! response.success ) {
579+
addErrorMessage();
580+
return;
581+
}
582+
583+
skipWizard = true;
584+
moveToStep( 'import', 'subscribe' );
585+
} );
586+
return Promise.resolve();
575587
}
576588

577589
data.action = 'wpmm_insert_template';

includes/classes/wp-maintenance-mode-admin.php

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ private function __construct() {
5959
add_action( 'wp_ajax_wpmm_reset_settings', array( $this, 'reset_plugin_settings' ) );
6060
add_action( 'wp_ajax_wpmm_select_page', array( $this, 'select_page' ) );
6161
add_action( 'wp_ajax_wpmm_insert_template', array( $this, 'insert_template' ) );
62+
add_action( 'wp_ajax_wpmm_skip_insert_template', array( $this, 'skip_insert_template' ) );
6263
add_action( 'wp_ajax_wpmm_skip_wizard', array( $this, 'skip_wizard' ) );
6364
add_action( 'wp_ajax_wpmm_subscribe', array( $this, 'subscribe_newsletter' ) );
6465
add_action( 'wp_ajax_wpmm_change_template_category', array( $this, 'change_template_category' ) );
@@ -692,10 +693,6 @@ public function select_page() {
692693
* @return void
693694
*/
694695
public function insert_template() {
695-
// if ( ! is_plugin_active( 'otter-blocks/otter-blocks.php' ) ) {
696-
// wp_send_json_error( array( 'error' => 'Otter Blocks is not activated' ) );
697-
// }
698-
699696
// check nonce existence
700697
if ( empty( $_POST['_wpnonce'] ) ) {
701698
die( esc_html__( 'The nonce field must not be empty.', 'wp-maintenance-mode' ) );
@@ -712,14 +709,10 @@ public function insert_template() {
712709
}
713710

714711
$template_slug = $_POST['template_slug'];
715-
$blocks = '';
716-
$category = 'maintenance';
717-
if ( ! empty( $_POST['category'] ) ) {
718-
$category = $_POST['category'];
719-
$template = json_decode( file_get_contents( WPMM_TEMPLATES_PATH . $category . '/' . $template_slug . '/blocks-export.json' ) );
712+
$category = $_POST['category'];
713+
$template = json_decode( file_get_contents( WPMM_TEMPLATES_PATH . $category . '/' . $template_slug . '/blocks-export.json' ) );
720714

721-
$blocks = str_replace( '\n', '', $template->content );
722-
}
715+
$blocks = str_replace( '\n', '', $template->content );
723716

724717
$post_arr = array(
725718
'post_type' => 'page',
@@ -741,10 +734,8 @@ public function insert_template() {
741734
}
742735

743736
$this->plugin_settings['design']['page_id'] = $page_id;
737+
CSS_Handler::generate_css_file( $page_id );
744738

745-
if ( is_plugin_active( 'otter-blocks/otter-blocks.php' ) ) {
746-
CSS_Handler::generate_css_file( $page_id );
747-
}
748739

749740
if ( 'wizard' === $_POST['source'] ) {
750741
$this->plugin_settings['general']['status'] = 1;
@@ -756,6 +747,26 @@ public function insert_template() {
756747
wp_send_json_success( array( 'pageEditURL' => get_edit_post_link( $page_id ) ) );
757748
}
758749

750+
/**
751+
* Skip importing a template.
752+
*
753+
* @return void
754+
*/
755+
public function skip_insert_template() {
756+
// check nonce existence
757+
if ( empty( $_POST['_wpnonce'] ) ) {
758+
die( esc_html__( 'The nonce field must not be empty.', 'wp-maintenance-mode' ) );
759+
}
760+
761+
// check nonce validation
762+
if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'wizard' ) ) {
763+
die( esc_html__( 'Security check.', 'wp-maintenance-mode' ) );
764+
}
765+
766+
update_option( 'wpmm_fresh_install', false );
767+
wp_send_json_success();
768+
}
769+
759770
/**
760771
* Skip importing a template (and installing Otter) from the wizard
761772
*

views/wizard.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@
3737
__( 'Pick a template to get started.', 'wp-maintenance-mode' ),
3838
tsdk_utmify( 'https://themeisle.com/plugins/otter-blocks/', $this->plugin_slug, 'wizard' ),
3939
__( 'Otter Blocks', 'wp-maintenance-mode' ),
40-
__( 'It also unlocks tools like forms and popups - if you need them later.', 'wp-maintenance-mode' ),
40+
__( 'plugin will be installed and activated to support and customize your layout.' , 'wp-maintenance-mode' ),
4141
),
4242
wpmm_translated_string_allowed_html()
4343
);
4444
?>
45+
<br>
46+
<?php
47+
esc_html_e( 'It also unlocks tools like forms and popups - if you need them later.', 'wp-maintenance-mode' );
48+
?>
4549
</p>
4650
</div>
4751
<div class="wpmm-templates-radio">
@@ -81,22 +85,23 @@
8185
</div>
8286
<p class="description">
8387
<?php
84-
printf(
85-
wp_kses(
86-
/* translators: Optimole url */
87-
__( 'Templates would have pre-optimized images and all of your website\'s images would be delivered via Amazon Cloudfront CDN, resulting in an ≈ 80%% increase in speed, with <a href="%1$s" target="_blank">Optimole%2$s</a>.', 'wp-maintenance-mode' ),
88-
wpmm_translated_string_allowed_html()
89-
),
88+
echo wp_kses(
89+
sprintf(
90+
'%1$s <a href="%2$s" target="_blank">%3$s</a> %4$s',
91+
__( 'Templates would have pre-optimized images and all of your website’s images would be delivered via Amazon Cloudfront CDN, resulting in an ≈ 80% increase in speed.', 'wp-maintenance-mode' ),
9092
esc_url( 'https://wordpress.org/plugins/optimole-wp/' ),
91-
$this->get_external_link_icon()
92-
);
93+
'Optimole',
94+
__( 'plugin will be installed and activated.', 'wp-maintenance-mode' ),
95+
),
96+
wpmm_translated_string_allowed_html(),
97+
);
9398
?>
9499
</div>
95100
<?php } ?>
96101

97102
<div id="wizard-buttons" class="import-button">
98103
<input type="button" class="button button-big button-primary disabled button-import" value="<?php esc_html_e( 'Continue', 'wp-maintenance-mode' ); ?>"/>
99-
<input type="button" class="button button-big button-secondary button-skip" value="<?php esc_html_e( 'I don’t want to use a template', 'wp-maintenance-mode' ); ?>"/>
104+
<input type="button" class="button button-big button-secondary button-skip" value="<?php esc_html_e( 'Skip this step', 'wp-maintenance-mode' ); ?>"/>
100105
</div>
101106
</div>
102107
</div>

0 commit comments

Comments
 (0)