176 changes: 127 additions & 49 deletions assets/js/scripts-admin.js
Expand Up @@ -359,9 +359,6 @@ jQuery( function( $ ) {

wizardTemplateSelect.on( 'change', function() {
wizardImportButton.removeClass( 'disabled' );

const selected = $( 'input[name="wizard-template"]:checked' ).data( 'category' );
$( '#wizard-buttons .button-skip' ).attr( 'value', selected ? wpmmVars.skipImportStrings[ selected ] : wpmmVars.skipImportDefault );
} );

wizardButtons.on( 'click', '.button-import:not(.disabled)', function() {
Expand All @@ -377,7 +374,6 @@ jQuery( function( $ ) {
};

importInProgress( data.template_slug );
$( '#wpmm-wizard-wrapper .button-skip' ).addClass( 'disabled' );
importTemplate( data, function( response ) {
moveToStep( 'import', 'subscribe' );
pageEditURL = response.pageEditURL.replace( /&/g, '&' );
Expand All @@ -388,17 +384,25 @@ jQuery( function( $ ) {
} );

wizardButtons.on( 'click', '.button-skip', function() {
$.post( wpmmVars.ajaxURL, {
action: 'wpmm_skip_wizard',
_wpnonce: wpmmVars.wizardNonce,
}, function( response ) {
if ( ! response.success ) {
// eslint-disable-next-line no-console
console.error( response.data );
return;
}
skipWizard = true;
moveToStep( 'import', 'subscribe' );
$( this ).addClass( 'is-busy' );
$( this ).trigger( 'blur' );

handleOptimole().then( function() {
$.post( wpmmVars.ajaxURL, {
action: 'wpmm_skip_wizard',
_wpnonce: wpmmVars.wizardNonce,
}, function( response ) {
if ( ! response.success ) {
addErrorMessage();
return;
}

skipWizard = true;
moveToStep( 'import', 'subscribe' );
} );
} ).catch( function() {
addErrorMessage();
$( '.button-skip' ).removeClass( 'is-busy' );
} );
} );

Expand All @@ -414,7 +418,6 @@ jQuery( function( $ ) {

const emailInput = $( '#email-input-wrap input[type="text"]' );
const email = emailInput.val();
const subscribeButton = $( this );

if ( ! isEmailValid( email ) ) {
$( '#email-input-wrap' ).append( `<p class="subscribe-message email-error"><i>${ wpmmVars.invalidEmailString }</i></p>` );
Expand All @@ -427,6 +430,8 @@ jQuery( function( $ ) {
return;
}

const subscribeButton = $( this );

emailInput.removeClass( 'invalid' );
subscribeButton.addClass( 'is-busy' );

Expand Down Expand Up @@ -468,6 +473,15 @@ jQuery( function( $ ) {
window.location.reload();
} );

$( document ).on( 'change', 'input.wpmm_network_mode', function() {
var status = $( this ).parents( 'table' ).find( '.wpmm_status' );
if ( status.hasClass( 'wpmm_status_disable' ) ) {
status.removeClass( 'wpmm_status_disable' );
} else {
status.addClass( 'wpmm_status_disable' );
}
} );

/**
* Adds elements and CSS when importing from wizard
*
Expand All @@ -480,6 +494,7 @@ jQuery( function( $ ) {
template.append( '<span class="dashicons dashicons-update"></span><p><i>' + wpmmVars.loadingString + '</i></p>' );

$( '.button-import' ).attr( 'disabled', 'disabled' );
$( '#wpmm-wizard-wrapper .button-skip' ).addClass( 'disabled' );
$( '#wpmm-wizard-wrapper .wpmm-templates-radio label' ).css( 'pointer-events', 'none' );
}

Expand All @@ -497,17 +512,45 @@ jQuery( function( $ ) {
}

/**
* Installs or activates Otter and adds the template after
* Installs or activates Otter and Optimole and adds the template after
*
* @param {Object} data
* @param {Function} callback
*/
function importTemplate( data, callback ) {
if ( ! wpmmVars.isOtterInstalled ) {
installAndActivateOtter( () => addToPage( data, callback ) );
} else if ( ! wpmmVars.isOtterActivated ) {
activateOtter( () => addToPage( data, callback ) );
handleOtter()
.then( () => handleOptimole() )
.then( () => addToPage( data, callback ) )
.catch( ( error ) => {
// eslint-disable-next-line no-console
console.error( error );

const template = $( '.wpmm-template.loading' );

template.removeClass( 'loading' );
$( '.wpmm-template .dashicons.dashicons-update' ).remove();
$( '.wpmm-template p' ).remove();

$( '.button-import' ).removeAttr( 'disabled' );
$( '#wpmm-wizard-wrapper .button-skip' ).removeClass( 'disabled' );
$( '#wpmm-wizard-wrapper .wpmm-templates-radio label' ).removeAttr( 'style' );

addErrorMessage();
} );
}

/**
* Displays an error message
*/
function addErrorMessage() {
if ( $( '#import-step-error' ).length ) {
return;
}

$( '.import-step' ).append( `<p id="import-step-error">${ wpmmVars.errorString }</p>` );
setTimeout( function() {
$( '#import-step-error' ).remove();
}, 3000 );
}

/**
Expand All @@ -521,9 +564,9 @@ jQuery( function( $ ) {
data.action = 'wpmm_insert_template';
$.post( wpmmVars.ajaxURL, data, function( response ) {
if ( ! response.success ) {
alert( response.data );
alert( response.data.error );
$( '.dashicons-update' ).remove();
$( '<p class="error import-error">' + wpmmVars.errorString + '</p>' ).insertAfter( '#wizard-buttons' );
addErrorMessage();
return false;
}

Expand All @@ -532,39 +575,40 @@ jQuery( function( $ ) {
}

/**
* Installs Otter then calls the activation function with the callback
*
* @param {Function} callback
* Install and activate Optimole if the checkbox is checked.
*/
function installAndActivateOtter( callback ) {
$.post( wpmmVars.ajaxURL, {
action: 'wp_ajax_install_plugin',
_ajax_nonce: wpmmVars.pluginInstallNonce,
slug: 'otter-blocks',
}, function( response ) {
if ( ! response.success ) {
alert( response.data.errorMessage );
$( '.dashicons-update' ).remove();
$( '<p class="error import-error">' + wpmmVars.errorString + '</p>' ).insertAfter( '#wizard-buttons' );

window.location.reload();
return false;
function handleOptimole() {
const optimoleCheckbox = $( '#wizard-optimole-checkbox' );

if ( optimoleCheckbox.length && optimoleCheckbox.is( ':checked' ) ) {
if ( ! wpmmVars.isOptimoleInstalled ) {
return installPlugin( 'optimole-wp' )
.then( () => {
return activatePlugin( 'optimole-wp' );
} );
} else if ( ! wpmmVars.isOptimoleActive ) {
return activatePlugin( 'optimole-wp' );
}
}

updateSDKOptions();
activateOtter( callback );
} );
return Promise.resolve();
}

/**
* Activates Otter and calls a callback
*
* @param {Function} callback
* Install and activate Otter.
*/
function activateOtter( callback ) {
$.get( wpmmVars.otterActivationLink, function() {
callback();
} );
function handleOtter() {
if ( ! wpmmVars.isOtterInstalled ) {
return installPlugin( 'otter-blocks' )
.then( () => {
updateSDKOptions();
return activatePlugin( 'otter-blocks' );
} );
} else if ( ! wpmmVars.isOtterActivated ) {
return activatePlugin( 'otter-blocks' );
}

return Promise.resolve();
}

/**
Expand All @@ -582,4 +626,38 @@ jQuery( function( $ ) {
}
} );
}

/**
* Install a plugin.
*
* @param {string} slug
*/
function installPlugin( slug ) {
return $.post( wpmmVars.ajaxURL, {
action: 'wp_ajax_install_plugin',
_ajax_nonce: wpmmVars.pluginInstallNonce,
slug,
}, function( response ) {
if ( ! response.success ) {
addErrorMessage();
return false;
}
} );
}

/**
* Activate a plugin.
*
* @param {string} slug
*/
function activatePlugin( slug ) {
switch ( slug ) {
case 'otter-blocks':
return $.get( wpmmVars.otterActivationLink );
case 'optimole-wp':
return $.get( wpmmVars.optimoleActivationLink );
default:
break;
}
}
} );
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -2,7 +2,7 @@
"name": "codeinwp/wp-maintenance-mode",
"description": "Adds a splash page to your site that lets visitors know your site is down for maintenance. Full access to the back- & front-end is optional.",
"type": "wordpress-plugin",
"version": "2.6.3",
"version": "2.6.4",
"license": "GPL-2.0+",
"homepage": "https://themeisle.com",
"support": {
Expand Down
34 changes: 18 additions & 16 deletions composer.lock
146 changes: 113 additions & 33 deletions includes/classes/wp-maintenance-mode-admin.php

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions includes/classes/wp-maintenance-mode.php
Expand Up @@ -8,14 +8,20 @@

class WP_Maintenance_Mode {

const VERSION = '2.6.3';
const VERSION = '2.6.4';

const MAINTENANCE = 'maintenance';
const COMING_SOON = 'coming-soon';
const LANDING_PAGE = 'landing-page';

protected $plugin_slug = 'wp-maintenance-mode';
protected $plugin_settings;
protected $plugin_network_settings = array(
'general' => array(
'status' => 0,
'network_mode' => 0,
),
);
protected $plugin_basename;
protected static $instance = null;

Expand All @@ -42,6 +48,21 @@ private function __construct() {
$this->plugin_settings = wpmm_get_option( 'wpmm_settings', array() );
$this->plugin_basename = plugin_basename( WPMM_PATH . $this->plugin_slug . '.php' );

if ( is_multisite() ) {
$plugin_network_settings = get_network_option( get_current_network_id(), 'wpmm_settings_network', $this->plugin_network_settings );
$plugin_network_settings = array_filter( $plugin_network_settings );
$this->plugin_network_settings = wp_parse_args( $plugin_network_settings, $this->plugin_network_settings );
if ( ! isset( $this->plugin_network_settings['general']['network_mode'] ) ) {
$this->plugin_network_settings['general']['network_mode'] = 0;
}
if ( ! empty( $this->plugin_network_settings ) ) {
$this->plugin_settings['general']['network_mode'] = ! empty( $this->plugin_network_settings['general']['network_mode'] ) ? 1 : 0;
if ( $this->plugin_settings['general']['network_mode'] ) {
$this->plugin_settings['general']['status'] = ! empty( $this->plugin_network_settings['general']['status'] ) ? 1 : 0;
}
}
}

// Load plugin text domain
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );

Expand Down Expand Up @@ -169,15 +190,25 @@ public function get_plugin_settings() {
return $this->plugin_settings;
}

/**
* Return plugin network site settings
*
* @since 2.6.2
* @return array
*/
public function get_plugin_network_settings() {
return $this->plugin_network_settings;
}

/**
* Return the plugin's page categories
*
* @return array
*/
public static function get_page_categories() {
return array(
self::MAINTENANCE => __( 'Maintenance', 'wp-maintenance-mode' ),
self::COMING_SOON => __( 'Coming Soon', 'wp-maintenance-mode' ),
self::MAINTENANCE => __( 'Maintenance mode', 'wp-maintenance-mode' ),
self::LANDING_PAGE => __( 'Landing Page', 'wp-maintenance-mode' ),
);
}
Expand Down
11 changes: 11 additions & 0 deletions includes/functions/helpers.php
Expand Up @@ -512,3 +512,14 @@ function sanitize_hex_color( $color ) {
}
}
}

/**
* Get option page URL.
*/
function wpmm_option_page_url() {
$option_page = admin_url( 'options-general.php' );
if ( is_multisite() && is_network_admin() ) {
$option_page = network_admin_url( 'settings.php' );
}
return $option_page;
}
5 changes: 2 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "wp-maintenance-mode",
"version": "2.6.3",
"version": "2.6.4",
"author": "Themeisle",
"homepage": "https://themeisle.com/",
"license": "GPL-3.0+",
Expand All @@ -17,11 +17,10 @@
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"@wordpress/eslint-plugin": "^12.9.0",
"@wordpress/eslint-plugin": "^14.0.0",
"autoprefixer": "^9.8.6",
"conventional-changelog-simple-preset": "^1.0.14",
"cssnano": "^4.1.11",
"eslint": "^8.22.0",
"grunt": "^1.4.0",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-uglify-es": "^3.3.0",
Expand Down
10 changes: 9 additions & 1 deletion readme.txt
Expand Up @@ -7,7 +7,7 @@ Author URI: https://themeisle.com/
Tags: maintenance mode, admin, administration, unavailable, coming soon, multisite, landing page, under construction, contact form, subscribe, countdown
Requires at least: 3.5
Tested up to: 6.1
Stable tag: 2.6.3
Stable tag: 2.6.4
Requires PHP: 5.6
License: GPL-2.0+

Expand Down Expand Up @@ -92,6 +92,14 @@ Notice: `wp-cron.php` is excluded by default.

== Changelog ==

##### [Version 2.6.4](https://github.com/Codeinwp/wp-maintenance-mode/compare/v2.6.3...v2.6.4) (2023-02-24)

- Add the option to manage maintenance status on all sites from the network dashboard
- Update dependencies




##### [Version 2.6.3](https://github.com/Codeinwp/wp-maintenance-mode/compare/v2.6.2...v2.6.3) (2023-02-06)

* Update dependencies
Expand Down
47 changes: 47 additions & 0 deletions views/network-settings.php
@@ -0,0 +1,47 @@
<?php
/**
* Settings
*
* @version 2.1.6
*/

defined( 'ABSPATH' ) || exit;
?>
<div class="wrap">
<h2 class="wpmm-title"><?php echo esc_html( get_admin_page_title() ); ?>
<?php
if ( get_option( 'wpmm_fresh_install', false ) ) {
?>
<span id="wizard-exit"><img src="<?php echo esc_attr( WPMM_IMAGES_URL . 'external.svg' ); ?>" alt="exit"></span><?php } ?>
</h2>
<hr>
<div class="wpmm-wrapper">
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
<input type="hidden" name="options[is_network_site]" value="<?php echo (bool) is_multisite() && is_network_admin(); ?>">
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">
<label for="options[general][status]"><?php esc_html_e( 'Enable network mode', 'wp-maintenance-mode' ); ?></label>
</th>
<td>
<label><input type="checkbox" class="wpmm_network_mode" value="1" name="options[general][network_mode]"<?php checked( $this->plugin_network_settings['general']['network_mode'], 1 ); ?> /></label>
</td>
</tr>
<tr valign="top" class="wpmm_status <?php echo empty( $this->plugin_network_settings['general']['network_mode'] ) ? 'wpmm_status_disable' : ''; ?>">
<th scope="row">
<label for="options[general][status]"><?php esc_html_e( 'Status', 'wp-maintenance-mode' ); ?></label>
</th>
<td>
<label><input type="radio" value="1" name="options[general][status]"<?php checked( $this->plugin_network_settings['general']['status'], 1 ); ?> /> <?php esc_html_e( 'Activated on all sites', 'wp-maintenance-mode' ); ?></label> <br />
<label><input type="radio" value="0" name="options[general][status]"<?php checked( $this->plugin_network_settings['general']['status'], 0 ); ?> /> <?php esc_html_e( 'Deactivated for all sites', 'wp-maintenance-mode' ); ?></label>
</td>
</tr>
</tbody>
</table>
<?php wpmm_form_hidden_fields( 'general' ); ?>
<input type="submit" value="<?php esc_attr_e( 'Save settings', 'wp-maintenance-mode' ); ?>" class="button button-primary" name="submit" />
</form>
<?php require_once 'sidebar.php'; ?>
</div>
</div>
84 changes: 4 additions & 80 deletions views/settings.php
Expand Up @@ -19,91 +19,15 @@
<?php
if ( get_option( 'wpmm_fresh_install', false ) ) {
?>
<span id="wizard-exit"><img src="<?php echo esc_attr( WPMM_IMAGES_URL . 'external.svg' ); ?>" alt="exit"></span><?php } ?>
<span id="wizard-exit"><img src="<?php echo esc_attr( WPMM_IMAGES_URL . 'exit.svg' ); ?>" alt="exit"></span><?php } ?>
</h2>

<div class="wpmm-wrapper">
<?php
if ( get_option( 'wpmm_fresh_install', false ) ) {
$default_templates = array(
'maintenance' => array(
'slug' => 'maintenance-1',
'thumbnail' => WPMM_TEMPLATES_URL . 'maintenance/maintenance-1/screenshot.png',
),
'coming-soon' => array(
'slug' => 'coming-soon-1',
'thumbnail' => WPMM_TEMPLATES_URL . 'coming-soon/coming-soon-1/screenshot.png',
),
'landing-page' => array(
'slug' => 'landing-page-1',
'thumbnail' => WPMM_TEMPLATES_URL . 'landing-page/landing-page-1/screenshot.png',
),
);

include 'wizard.php';
} else {
?>
<div id="wpmm-wizard-wrapper">
<div class="slider-wrap">
<div class="step-wrap">
<div class="step import-step">
<h4 class="header"><?php esc_html_e( 'Get started with a free template.', 'wp-maintenance-mode' ); ?></h4>
<p class="description"><?php esc_html_e( 'Choose the type of template you want, powered by Otter Blocks. You can always customise your layout.', 'wp-maintenance-mode' ); ?></p>
<?php
if ( ! $is_otter_active ) {
echo $this->get_otter_notice( 'wizard' );
}
?>
<div class="wpmm-templates-radio">
<form>
<?php
$categories = WP_Maintenance_Mode::get_page_categories();
foreach ( $categories as $category => $label ) {
$slug = $default_templates[ $category ]['slug'];
$thumbnail_url = $default_templates[ $category ]['thumbnail'];
?>
<div class="templates-radio__item" >
<h6 class="tag"><?php echo $label; ?></h6>
<input id="<?php echo esc_attr( $slug ); ?>" type="radio" name="wizard-template" value="<?php echo esc_attr( $slug ); ?>" data-category="<?php echo esc_attr( $category ); ?>" <?php checked( $category, 'maintenance' ); ?>>
<label for="<?php echo esc_attr( $slug ); ?>" class="wpmm-template">
<img src="<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php echo esc_attr( $slug ); ?>"/>
</label>
</div>
<?php
}
?>
</form>
</div>
<div id="wizard-buttons" class="import-button">
<input type="button" class="button button-big button-primary disabled button-import" value="<?php esc_html_e( 'Continue', 'wp-maintenance-mode' ); ?>"/>
<input type="button" class="button button-big button-secondary button-skip" value="<?php esc_html_e( 'I don’t want to use a Maintenance Template', 'wp-maintenance-mode' ); ?>"/>
</div>
</div>
</div>
<div class="step-wrap">
<div class="step subscribe-step" aria-hidden="true" style="display: none">
<img width="250px" src="<?php echo WPMM_IMAGES_URL . 'subscribe.svg'; ?>" alt="subscribe"/>
<h4><?php esc_html_e( 'Stay in the loop!', 'wp-maintenance-mode' ); ?></h4>
<p><?php esc_html_e( 'Keep up with feature announcements, promotions, tutorials, and new template releases.', 'wp-maintenance-mode' ); ?></p>
<div id="email-input-wrap">
<input type="text" value="<?php echo esc_attr( get_bloginfo( 'admin_email' ) ); ?>" />
<input type="button" class="button button-primary button-big subscribe-button" value="<?php esc_attr_e( 'Sign me up', 'wp-maintenance-mode' ); ?>" />
</div>
<input id="skip-subscribe" type="button" class="button button-link skip-link" value="<?php esc_attr_e( 'I\'ll skip for now, thanks!', 'wp-maintenance-mode' ); ?>" />
</div>
</div>
<div class="step-wrap">
<div class="step finish-step" aria-hidden="true" style="display: none">
<img width="250px" src="<?php echo WPMM_IMAGES_URL . 'finish-setup.svg'; ?>" alt="finish-setup"/>
<h4 class="heading"><?php esc_html_e( 'Your page is ready!', 'wp-maintenance-mode' ); ?></h4>
<p><?php esc_html_e( 'Head over to the settings page to activate your Coming soon page', 'wp-maintenance-mode' ); ?></p>
<div class="buttons-wrap">
<input id="view-page-button" type="button" class="button-big button" value="<?php esc_attr_e( 'View page', 'wp-maintenance-mode' ); ?>"/>
<input id="refresh-button" type="button" class="button-big button button-primary" value="<?php esc_attr_e( 'Go to settings', 'wp-maintenance-mode' ); ?>"/>
</div>
</div>
</div>
</div>
</div>
<?php } else { ?>
<div id="content" class="wrapper-cell">
<div class="nav-tab-wrapper">
<a class="nav-tab nav-tab-active" href="#general">
Expand Down Expand Up @@ -148,7 +72,7 @@
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
<table class="form-table">
<tbody>
<tr valign="top">
<tr valign="top" class="<?php echo ! empty( $this->plugin_settings['general']['network_mode'] ) ? 'wpmm_status_disable' : ''; ?>">
<th scope="row">
<label for="options[general][status]"><?php esc_html_e( 'Status', 'wp-maintenance-mode' ); ?></label>
</th>
Expand Down
10 changes: 5 additions & 5 deletions views/sidebar.php
Expand Up @@ -13,16 +13,16 @@
<div class="inside">
<?php $plugin_data = wpmm_plugin_info( $this->plugin_slug ); ?>
<ul>
<li><?php esc_html_e( 'Name', 'wp-maintenance-mode' ); ?>:
<li><?php esc_html_e( 'Name', 'wp-maintenance-mode' ); ?>:
<?php
echo ! empty( $plugin_data['Name'] ) ? esc_html( $plugin_data['Name'] ) : '';
echo ! empty( $plugin_data['Version'] ) ? esc_html( ' v' . $plugin_data['Version'] ) : '';
?>
</li>
<li><?php esc_html_e( 'Author', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['AuthorName'] ) ? esc_html( $plugin_data['AuthorName'] ) : ''; ?></li>
<li><?php esc_html_e( 'Website', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['AuthorURI'] ) ? '<a href="' . esc_url( wpmm_get_utmized_url( $plugin_data['AuthorURI'], array( 'campaign' => 'plugininfo' ) ) ) . '" target="_blank">' . esc_html( $plugin_data['AuthorName'] ) . '</a>' : ''; ?></li>
<li><?php esc_html_e( 'Twitter', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['Twitter'] ) ? '<a href="' . esc_url( 'https://twitter.com/' . $plugin_data['Twitter'] ) . '" target="_blank">@' . esc_html( $plugin_data['Twitter'] ) . '</a>' : ''; ?></li>
<li><?php esc_html_e( 'GitHub', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['GitHub Plugin URI'] ) ? '<a href="' . esc_url( wpmm_get_utmized_url( $plugin_data['GitHub Plugin URI'], array( 'campaign' => 'plugininfo' ) ) ) . '" target="_blank">' . esc_html( basename( $plugin_data['GitHub Plugin URI'] ) ) . '</a>' : ''; ?></li>
<li><?php esc_html_e( 'Website', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['AuthorURI'] ) ? '<a href="' . esc_url( wpmm_get_utmized_url( $plugin_data['AuthorURI'], array( 'campaign' => 'plugininfo' ) ) ) . '" target="_blank">' . esc_html( $plugin_data['AuthorName'] ) . $this->get_external_link_icon() . '</a>' : ''; ?></li>
<li><?php esc_html_e( 'Twitter', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['Twitter'] ) ? '<a href="' . esc_url( 'https://twitter.com/' . $plugin_data['Twitter'] ) . '" target="_blank">@' . esc_html( $plugin_data['Twitter'] ) . $this->get_external_link_icon() . '</a>' : ''; ?></li>
<li><?php esc_html_e( 'GitHub', 'wp-maintenance-mode' ); ?>: <?php echo ! empty( $plugin_data['GitHub Plugin URI'] ) ? '<a href="' . esc_url( wpmm_get_utmized_url( $plugin_data['GitHub Plugin URI'], array( 'campaign' => 'plugininfo' ) ) ) . '" target="_blank">' . esc_html( basename( $plugin_data['GitHub Plugin URI'] ) ) . $this->get_external_link_icon() . '</a>' : ''; ?></li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -55,6 +55,6 @@
?>
</ul>
</div>
</div>
</div>
<?php } ?>
</div>
118 changes: 118 additions & 0 deletions views/wizard.php
@@ -0,0 +1,118 @@
<?php
$default_templates = array(
'coming-soon' => array(
'slug' => 'coming-soon-1',
'thumbnail' => WPMM_TEMPLATES_URL . 'coming-soon/coming-soon-1/screenshot.png',
),
'maintenance' => array(
'slug' => 'maintenance-1',
'thumbnail' => WPMM_TEMPLATES_URL . 'maintenance/maintenance-1/screenshot.png',
),
'landing-page' => array(
'slug' => 'landing-page-1',
'thumbnail' => WPMM_TEMPLATES_URL . 'landing-page/landing-page-1/screenshot.png',
),
);

?>
<div id="wpmm-wizard-wrapper">
<div class="slider-wrap">
<div class="step-wrap">
<div class="step import-step">
<h4 class="header"><?php esc_html_e( 'Select the type of page you want', 'wp-maintenance-mode' ); ?></h4>
<p class="templates-description">
<?php
printf(
wp_kses(
/* translators: Otter url */
__( 'Get started with custom templates, and build engaging pages using Contact forms, Popups and more, with <a href="%1$s" target="_blank">Otter%2$s</a>.', 'wp-maintenance-mode' ),
wpmm_translated_string_allowed_html()
),
tsdk_utmify( 'https://themeisle.com/plugins/otter-blocks/', $this->plugin_slug, 'wizard' ),
$this->get_external_link_icon()
);
?>
<br>
<?php
esc_html_e( 'Pick your template below, you can always customise it later.', 'wp-maintenance-mode' );
?>
</p>
<div class="wpmm-templates-radio">
<form>
<?php
$categories = WP_Maintenance_Mode::get_page_categories();
foreach ( $categories as $category => $label ) {
$slug = $default_templates[ $category ]['slug'];
$thumbnail_url = $default_templates[ $category ]['thumbnail'];
?>
<div class="templates-radio__item" >
<h6 class="tag"><?php echo $label; ?></h6>
<input id="<?php echo esc_attr( $slug ); ?>" type="radio" name="wizard-template" value="<?php echo esc_attr( $slug ); ?>" data-category="<?php echo esc_attr( $category ); ?>" <?php checked( $category, 'coming-soon' ); ?>>
<label for="<?php echo esc_attr( $slug ); ?>" class="wpmm-template">
<img src="<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php echo esc_attr( $slug ); ?>"/>
<span class="checked-icon">
<img src="<?php echo esc_url( WPMM_URL . 'assets/images/checked.svg' ); ?>" alt="<?php echo esc_attr( 'checked-icon' ); ?>"/>
</span>
</label>
</div>
<?php
}
?>
</form>
</div>
<?php if ( ! is_plugin_active( 'optimole-wp/optimole-wp.php' ) ) { ?>
<div class="optimole-upsell">
<div class="optimole-upsell-container">
<span class="components-checkbox-control__input-container">
<input id="wizard-optimole-checkbox" type="checkbox" class="components-checkbox-control__input" checked>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="presentation" class="components-checkbox-control__checked" aria-hidden="true" focusable="false"><path d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"></path></svg>
</span>
<label for="wizard-optimole-checkbox">
<?php esc_html_e( 'Image and speed optimisation', 'wp-maintenance-mode' ); ?>
</label>
</div>
<p class="description">
<?php
printf(
wp_kses(
/* translators: Optimole url */
__( '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' ),
wpmm_translated_string_allowed_html()
),
esc_url( 'https://wordpress.org/plugins/optimole-wp/' ),
$this->get_external_link_icon()
);
?>
</div>
<?php } ?>
<div id="wizard-buttons" class="import-button">
<input type="button" class="button button-big button-primary disabled button-import" value="<?php esc_html_e( 'Continue', 'wp-maintenance-mode' ); ?>"/>
<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' ); ?>"/>
</div>
</div>
</div>
<div class="step-wrap">
<div class="step subscribe-step" aria-hidden="true" style="display: none">
<img width="250px" src="<?php echo WPMM_IMAGES_URL . 'subscribe.svg'; ?>" alt="subscribe"/>
<h4><?php esc_html_e( 'Stay in the loop!', 'wp-maintenance-mode' ); ?></h4>
<p><?php esc_html_e( 'Keep up with feature announcements, promotions, tutorials, and new template releases.', 'wp-maintenance-mode' ); ?></p>
<div id="email-input-wrap">
<input type="text" value="<?php echo esc_attr( get_bloginfo( 'admin_email' ) ); ?>" />
<input type="button" class="button button-primary button-big subscribe-button" value="<?php esc_attr_e( 'Sign me up', 'wp-maintenance-mode' ); ?>" />
</div>
<input id="skip-subscribe" type="button" class="button button-link skip-link" value="<?php esc_attr_e( 'I\'ll skip for now, thanks!', 'wp-maintenance-mode' ); ?>" />
</div>
</div>
<div class="step-wrap">
<div class="step finish-step" aria-hidden="true" style="display: none">
<img width="250px" src="<?php echo WPMM_IMAGES_URL . 'finish-setup.svg'; ?>" alt="finish-setup"/>
<h4 class="heading"><?php esc_html_e( 'Your page is ready!', 'wp-maintenance-mode' ); ?></h4>
<p><?php esc_html_e( 'Head over to the settings page to activate your Coming soon page', 'wp-maintenance-mode' ); ?></p>
<div class="buttons-wrap">
<input id="view-page-button" type="button" class="button-big button" value="<?php esc_attr_e( 'View page', 'wp-maintenance-mode' ); ?>"/>
<input id="refresh-button" type="button" class="button-big button button-primary" value="<?php esc_attr_e( 'Go to settings', 'wp-maintenance-mode' ); ?>"/>
</div>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion wp-maintenance-mode.php
Expand Up @@ -4,7 +4,7 @@
*
* Plugin Name: LightStart - Maintenance Mode, Coming Soon and Landing Page Builder
* Description: Adds a splash page to your site that lets visitors know your site is down for maintenance. It's perfect for a coming soon or landing page.
* Version: 2.6.3
* Version: 2.6.4
* Author: Themeisle
* Author URI: https://themeisle.com/
* Twitter: themeisle
Expand Down
571 changes: 171 additions & 400 deletions yarn.lock

Large diffs are not rendered by default.