Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
with:
php-version: '7.2'
extensions: simplexml, mysql
tools: phpunit-polyfills
tools: phpunit:7.5.20, phpunit-polyfills
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Subversion
Expand All @@ -73,7 +73,6 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest --no-dev
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run phpunit
run: composer run-script phpunit

1 change: 1 addition & 0 deletions assets/css/style-wizard.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ h2.wpmm-title span img {
.step.import-step {
margin: min(10%, 65px) min(12%, 195px);
width: 1090px;
outline: 0;
}

.import-step .header {
Expand Down
19 changes: 18 additions & 1 deletion assets/js/scripts-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ jQuery( function( $ ) {
*/
function handlePlugins() {
const optimoleCheckbox = $( '#wizard-optimole-checkbox' );
const wpscCheckbox = $( '#wizard-wpsc-checkbox' );
const otterBlockCheckbox = $( '#wizard-otter-block-checkbox' );
let promiseChain = Promise.resolve();

Expand All @@ -617,6 +618,19 @@ jQuery( function( $ ) {
});
}

if ( wpscCheckbox.length && wpscCheckbox.is( ':checked' ) ) {
promiseChain = promiseChain
.then( () => {
if ( ! wpmmVars.isWPSCInstalled ) {
return installPlugin( 'wp-cloudflare-page-cache' ).then( () => activatePlugin( 'wp-cloudflare-page-cache' ) );
}

if ( ! wpmmVars.isWPSCActive ) {
return activatePlugin( wpmmVars.isWPSCProInstalled ? 'wp-super-page-cache-pro' : 'wp-cloudflare-page-cache' );
}
} );
}

if ( otterBlockCheckbox.length && otterBlockCheckbox.is( ':checked' ) ) {
promiseChain = promiseChain
.then(() => handleOtter());
Expand All @@ -637,7 +651,7 @@ jQuery( function( $ ) {
updateSDKOptions();
return activatePlugin( 'otter-blocks' );
} );
} else if ( ! wpmmVars.isOtterActivated ) {
} else if ( ! wpmmVars.isOtterActive ) {
return activatePlugin( 'otter-blocks' );
}

Expand Down Expand Up @@ -689,6 +703,9 @@ jQuery( function( $ ) {
return $.get( wpmmVars.otterActivationLink );
case 'optimole-wp':
return $.get( wpmmVars.optimoleActivationLink );
case 'wp-super-page-cache-pro':
case 'wp-cloudflare-page-cache':
return $.get( wpmmVars.wpscActivationLink );
default:
break;
}
Expand Down
13 changes: 13 additions & 0 deletions includes/classes/wp-maintenance-mode-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ public function enqueue_admin_scripts() {
'isOtterActive' => is_plugin_active( 'otter-blocks/otter-blocks.php' ),
'isOptimoleInstalled' => file_exists( ABSPATH . 'wp-content/plugins/optimole-wp/optimole-wp.php' ),
'isOptimoleActive' => is_plugin_active( 'optimole-wp/optimole-wp.php' ),
'isWPSCInstalled' => file_exists( ABSPATH . 'wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php' ) || file_exists( ABSPATH . 'wp-content/plugins/wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' ),
'isWPSCActive' => is_plugin_active( 'wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php' ) || is_plugin_active( 'wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' ),
'isWPSCProInstalled' => file_exists( ABSPATH . 'wp-content/plugins/wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' ),
'errorString' => __( 'Something went wrong, please try again.', 'wp-maintenance-mode' ),
'loadingString' => __( 'Doing some magic...', 'wp-maintenance-mode' ),
'importingText' => __( 'Importing', 'wp-maintenance-mode' ),
Expand Down Expand Up @@ -198,6 +201,16 @@ public function enqueue_admin_scripts() {
),
esc_url( network_admin_url( 'plugins.php' ) )
),
'wpscActivationLink' => add_query_arg(
array(
'action' => 'activate',
'plugin' => rawurlencode( file_exists( ABSPATH . 'wp-content/plugins/wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' ) ? 'wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' : 'wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php' ),
'plugin_status' => 'all',
'paged' => '1',
'_wpnonce' => wp_create_nonce( file_exists( ABSPATH . 'wp-content/plugins/wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' ) ? 'activate-plugin_wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' : 'activate-plugin_wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php' ),
),
esc_url( network_admin_url( 'plugins.php' ) )
),
'modalTexts' => array(
'title' => __( 'The template has been imported!', 'wp-maintenance-mode' ),
'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' ),
Expand Down
6 changes: 6 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

error_log( var_export ( $_tests_dir, true) );

$polyfills_path = dirname( dirname( __FILE__ ) ) . '/vendor/yoast/phpunit-polyfills';

if ( file_exists( $polyfills_path . '/phpunitpolyfills-autoload.php' ) && ! defined( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH' ) ) {
define( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH', $polyfills_path );
}

if ( ! $_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}
Expand Down
29 changes: 29 additions & 0 deletions views/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,35 @@
wpmm_translated_string_allowed_html(),
);
?>
</p>
</div>
<?php } ?>
<?php if ( ! is_plugin_active( 'wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php' ) && ! is_plugin_active( 'wp-super-page-cache-pro/wp-cloudflare-super-page-cache-pro.php' ) ) { ?>
<div class="optimole-upsell">
<div class="optimole-upsell-container">
<span class="components-checkbox-control__input-container">
<input id="wizard-wpsc-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-wpsc-checkbox">
<?php esc_html_e( 'Accelerate your website performance', 'wp-maintenance-mode' ); ?>
</label>
</div>
<p class="description">
<?php
echo wp_kses(
sprintf(
// translators: %1$s is a description, %2$s is the Super Page Cache URL, %3$s is the plugin name, %4$s is description text.
Comment thread
HardeepAsrani marked this conversation as resolved.
'%1$s <a href="%2$s" target="_blank">%3$s</a> %4$s',
__( 'Speed up your pages by 60-80% with intelligent caching. Achieve faster load times and better search rankings automatically, with', 'wp-maintenance-mode' ),
esc_url( 'https://wordpress.org/plugins/wp-cloudflare-page-cache/' ),
__( 'Super Page Cache', 'wp-maintenance-mode' ),
__( 'plugin installed and activated automatically.', 'wp-maintenance-mode' ),
),
wpmm_translated_string_allowed_html(),
);
?>
</p>
</div>
<?php } ?>

Expand Down
Loading