Skip to content

Commit 40af85b

Browse files
release: version 2.6.12
### Bug Fixes - **Compatibility with Elementor**: Fixes a compatibility issue with Elementor. - **Fixes Checkbox Styles**: Fixes a styling issue with Checkbox in the wizard that makes it almost invisible on screen.
2 parents 849949c + 82150ae commit 40af85b

11 files changed

Lines changed: 150 additions & 26 deletions

File tree

.github/workflows/test-php.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup PHP version
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.1'
18+
php-version: '7.2'
1919
extensions: simplexml
2020
tools: composer:v2.1
2121
- name: Checkout source code
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup PHP version
5252
uses: shivammathur/setup-php@v2
5353
with:
54-
php-version: '7.1'
54+
php-version: '7.2'
5555
extensions: simplexml, mysql
5656
tools: phpunit-polyfills
5757
- name: Checkout source code
@@ -73,5 +73,5 @@ jobs:
7373
- name: Install composer
7474
run: composer install --prefer-dist --no-progress --no-suggest --no-dev
7575
- name: Run phpunit
76-
run: phpunit
76+
run: composer run-script phpunit
7777

assets/css/style-admin.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,29 @@ input[type="button"].button.button-secondary.is-busy {
412412
height: 1em;
413413
}
414414

415+
.wpmm-notice {
416+
background-color: #fff;
417+
border-left: 4px solid #00a0d2;
418+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
419+
padding: 12px;
420+
display: flex;
421+
align-items: center;
422+
}
423+
424+
.wpmm-notice-content {
425+
flex-grow: 1;
426+
}
427+
428+
.wpmm-notice h3 {
429+
margin: 0.5em 0;
430+
font-size: 14px;
431+
}
432+
433+
.wpmm-notice p {
434+
margin: 0.5em 0;
435+
font-size: 13px;
436+
}
437+
415438
@keyframes spin {
416439
from {
417440
transform: rotate(0deg);

assets/css/style-wizard.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ h2.wpmm-title span img {
7979

8080
letter-spacing: .04em;
8181
line-height: 1;
82+
--checkbox-input-size: 20px;
83+
--checkmark-size: calc(var(--checkbox-input-size) + 4px);
8284
}
8385

8486
#wpmm-wizard-wrapper .slider-wrap {

assets/js/scripts-admin.js

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ jQuery( function( $ ) {
387387
$( this ).addClass( 'is-busy' );
388388
$( this ).trigger( 'blur' );
389389

390-
handleOptimole().then( function() {
390+
handlePlugins().then( function() {
391391
$.post( wpmmVars.ajaxURL, {
392392
action: 'wpmm_skip_wizard',
393393
_wpnonce: wpmmVars.wizardNonce,
@@ -519,7 +519,7 @@ jQuery( function( $ ) {
519519
*/
520520
function importTemplate( data, callback ) {
521521
handleOtter()
522-
.then( () => handleOptimole() )
522+
.then( () => handlePlugins() )
523523
.then( () => addToPage( data, callback ) )
524524
.catch( ( error ) => {
525525
// eslint-disable-next-line no-console
@@ -575,23 +575,43 @@ jQuery( function( $ ) {
575575
}
576576

577577
/**
578-
* Install and activate Optimole if the checkbox is checked.
578+
* Install and activate recommended plugins if the checkboxes is checked.
579579
*/
580-
function handleOptimole() {
580+
function handlePlugins() {
581581
const optimoleCheckbox = $( '#wizard-optimole-checkbox' );
582+
const hyveCheckbox = $( '#wizard-hyve-checkbox' );
583+
584+
let promiseChain = Promise.resolve();
582585

583586
if ( optimoleCheckbox.length && optimoleCheckbox.is( ':checked' ) ) {
584-
if ( ! wpmmVars.isOptimoleInstalled ) {
585-
return installPlugin( 'optimole-wp' )
586-
.then( () => {
587+
promiseChain = promiseChain
588+
.then(() => {
589+
if ( ! wpmmVars.isOptimoleInstalled ) {
590+
return installPlugin( 'optimole-wp' ).then( () => activatePlugin( 'optimole-wp' ) );
591+
}
592+
593+
if ( ! wpmmVars.isOptimoleActive ) {
587594
return activatePlugin( 'optimole-wp' );
588-
} );
589-
} else if ( ! wpmmVars.isOptimoleActive ) {
590-
return activatePlugin( 'optimole-wp' );
591-
}
595+
}
596+
});
592597
}
593598

594-
return Promise.resolve();
599+
if ( hyveCheckbox.length && hyveCheckbox.is( ':checked' ) ) {
600+
promiseChain = promiseChain
601+
.then(() => {
602+
if ( ! wpmmVars.isHyveInstalled ) {
603+
return installPlugin( 'hyve-lite' ).then( () => activatePlugin( 'hyve-lite' ) );
604+
}
605+
606+
if ( ! wpmmVars.isHyveActive ) {
607+
return activatePlugin( 'hyve-lite' );
608+
}
609+
});
610+
}
611+
612+
return promiseChain.catch( ( error ) => {
613+
console.error( 'Error in plugin installation or activation:', error );
614+
});
595615
}
596616

597617
/**
@@ -656,6 +676,8 @@ jQuery( function( $ ) {
656676
return $.get( wpmmVars.otterActivationLink );
657677
case 'optimole-wp':
658678
return $.get( wpmmVars.optimoleActivationLink );
679+
case 'hyve-lite':
680+
return $.get( wpmmVars.hyveActivationLink );
659681
default:
660682
break;
661683
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"format-fix-exit": "./vendor/bin/phpcbf-fix-exit-0 --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ",
5454
"phpcs": "phpcs --standard=phpcs.xml -s --runtime-set testVersion 7.0-",
5555
"lint": "composer run-script phpcs",
56-
"phpcs-i": "phpcs -i"
56+
"phpcs-i": "phpcs -i",
57+
"phpunit": "phpunit"
5758
}
5859
}

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ public function enqueue_admin_scripts() {
157157
'isOtterActive' => is_plugin_active( 'otter-blocks/otter-blocks.php' ),
158158
'isOptimoleInstalled' => file_exists( ABSPATH . 'wp-content/plugins/optimole-wp/optimole-wp.php' ),
159159
'isOptimoleActive' => is_plugin_active( 'optimole-wp/optimole-wp.php' ),
160+
'isHyveInstalled' => file_exists( ABSPATH . 'wp-content/plugins/hyve-lite/hyve-lite.php' ),
161+
'isHyveActive' => is_plugin_active( 'hyve-lite/hyve-lite.php' ),
160162
'errorString' => __( 'Something went wrong, please try again.', 'wp-maintenance-mode' ),
161163
'loadingString' => __( 'Doing some magic...', 'wp-maintenance-mode' ),
162164
'importingText' => __( 'Importing', 'wp-maintenance-mode' ),
@@ -187,6 +189,16 @@ public function enqueue_admin_scripts() {
187189
),
188190
esc_url( network_admin_url( 'plugins.php' ) )
189191
),
192+
'hyveActivationLink' => add_query_arg(
193+
array(
194+
'action' => 'activate',
195+
'plugin' => rawurlencode( 'hyve-lite/hyve-lite.php' ),
196+
'plugin_status' => 'all',
197+
'paged' => '1',
198+
'_wpnonce' => wp_create_nonce( 'activate-plugin_hyve-lite/hyve-lite.php' ),
199+
),
200+
esc_url( network_admin_url( 'plugins.php' ) )
201+
),
190202
'modalTexts' => array(
191203
'title' => __( 'The template has been imported!', 'wp-maintenance-mode' ),
192204
'description' => __( 'The template has been imported to a new draft page. You can take a look and enable it from plugin settings.', 'wp-maintenance-mode' ),
@@ -1169,7 +1181,7 @@ public function add_display_post_states( $post_states, $post ) {
11691181
* @return string
11701182
*/
11711183
public function add_wizard_classes( $classes ) {
1172-
if ( get_option( 'wpmm_fresh_install', false ) ) {
1184+
if ( ! get_option( 'wpmm_fresh_install', false ) ) {
11731185
$classes .= 'wpmm-wizard-fullscreen';
11741186
}
11751187

includes/classes/wp-maintenance-mode.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,21 @@ public function add_maintenance_template( $templates ) {
10671067
*/
10681068
public function use_maintenance_template( $template ) {
10691069
global $post;
1070+
1071+
// Return the default template for Elementor when:
1072+
if (
1073+
class_exists( '\Elementor\Plugin', false ) &&
1074+
(
1075+
// Edit Mode is on.
1076+
( isset( $_GET['action'] ) && 'elementor' === $_GET['action'] ) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1077+
// Preview Mode is on.
1078+
isset( $_GET['elementor-preview'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1079+
)
1080+
) {
1081+
return $template;
1082+
}
1083+
1084+
// Return the default template if the current post is empty.
10701085
if ( empty( $post ) ) {
10711086
return $template;
10721087
}

views/settings.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,19 @@
1212
$this->plugin_settings['design']['page_id'] = 0;
1313
}
1414

15-
$is_otter_active = is_plugin_active( 'otter-blocks/otter-blocks.php' ) || defined( 'OTTER_BLOCKS_VERSION' );
15+
$is_otter_active = is_plugin_active( 'otter-blocks/otter-blocks.php' ) || defined( 'OTTER_BLOCKS_VERSION' );
16+
$is_hyve_installed = file_exists( ABSPATH . 'wp-content/plugins/hyve-lite/hyve-lite.php' ) || defined( 'HYVE_LITE_VERSION' );
17+
18+
$hyve_url = add_query_arg(
19+
array(
20+
'tab' => 'plugin-information',
21+
'plugin' => 'hyve-lite',
22+
'TB_iframe' => true,
23+
'width' => 800,
24+
'height' => 800,
25+
),
26+
network_admin_url( 'plugin-install.php' )
27+
);
1628
?>
1729
<div class="wrap">
1830
<h2 class="wpmm-title"><?php echo esc_html( get_admin_page_title() ); ?>
@@ -818,6 +830,15 @@ class="button image_uploader_trigger"
818830
<tbody>
819831
<tr valign="top">
820832
<td colspan="2">
833+
<?php if ( ! $is_hyve_installed ) : ?>
834+
<div class="wpmm-notice">
835+
<div class="wpmm-notice-content">
836+
<h3><?php esc_html_e( 'Enhance Your WordPress Site with Hyve AI Chatbot', 'wp-maintenance-mode' ); ?></h3>
837+
<p><?php esc_html_e( 'Hyve is an AI chatbot plugin for WordPress, ideal for sites in maintenance mode. It enhances user experience by turning your content into interactive conversations, helping visitors access information while your site is under development.', 'wp-maintenance-mode' ); ?></p>
838+
</div>
839+
<a target="_black" href="<?php echo esc_url( $hyve_url ); ?>" class="button button-primary"><?php esc_html_e( 'Install Hyve', 'wp-maintenance-mode' ); ?></a>
840+
</div>
841+
<?php endif; ?>
821842
<h4><?php esc_html_e( 'Setup the conversation steps to capture more subscribers with this friendly way of asking email addresses.', 'wp-maintenance-mode' ); ?></h4>
822843
<p><?php esc_html_e( 'You may also want to use these wildcards: {bot_name} and {visitor_name} to make the conversation even more realistic.', 'wp-maintenance-mode' ); ?></p>
823844
<p><?php esc_html_e( 'It is also ok if you don\'t fill in all the conversation steps if you don\'t need to.', 'wp-maintenance-mode' ); ?></p>

views/wizard.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,32 @@
8585
?>
8686
</div>
8787
<?php } ?>
88+
89+
<?php if ( ! is_plugin_active( 'hyve-lite/hyve-lite.php' ) || ! defined( 'HYVE_LITE_VERSION' ) ) { ?>
90+
<div class="optimole-upsell">
91+
<div class="optimole-upsell-container">
92+
<span class="components-checkbox-control__input-container">
93+
<input id="wizard-hyve-checkbox" type="checkbox" class="components-checkbox-control__input" checked>
94+
<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>
95+
</span>
96+
<label for="wizard-hyve-checkbox">
97+
<?php esc_html_e( 'Interactive Chatbot', 'wp-maintenance-mode' ); ?>
98+
</label>
99+
</div>
100+
<p class="description">
101+
<?php
102+
printf(
103+
wp_kses(
104+
/* translators: Hyve Lite url */
105+
__( '<a href="%1$s" target="_blank">Hyve%2$s</a> is an AI chatbot plugin for WordPress, ideal for sites in maintenance mode. It enhances user experience by turning your content into interactive conversations, helping visitors access information while your site is under development.', 'wp-maintenance-mode' ),
106+
wpmm_translated_string_allowed_html()
107+
),
108+
esc_url( 'https://wordpress.org/plugins/hyve-lite/' ),
109+
$this->get_external_link_icon()
110+
);
111+
?>
112+
</div>
113+
<?php } ?>
88114
<div id="wizard-buttons" class="import-button">
89115
<input type="button" class="button button-big button-primary disabled button-import" value="<?php esc_html_e( 'Continue', 'wp-maintenance-mode' ); ?>"/>
90116
<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' ); ?>"/>

0 commit comments

Comments
 (0)