Version Description
- Add: Export settings via Command Line Interface (wp-cli).
- Add: Import settings via Command Line Interface(wp-cli).
Download this release
Release Info
Developer | adeelkhan |
Plugin | Breeze – WordPress Cache Plugin |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.2
- assets/css/style.css +41 -0
- assets/js/breeze-configuration.js +81 -0
- breeze.php +5 -2
- inc/cache/config-cache.php +27 -22
- inc/cache/execute-cache.php +15 -4
- inc/minification/breeze-minify-main.php +6 -1
- inc/wp-cli/class-breeze-cli-helpers.php +59 -0
- inc/wp-cli/class-breeze-settings-import-export.php +320 -0
- inc/wp-cli/class-breeze-wp-cli-core.php +249 -0
- readme.txt +15 -9
- views/breeze-setting-views.php +18 -17
- views/tabs/basic.php +9 -0
- views/tabs/import_export.php +37 -0
assets/css/style.css
CHANGED
@@ -328,4 +328,45 @@
|
|
328 |
|
329 |
.wp-core-ui .button-primary.focus, .wp-core-ui .button-primary.breeze-submit-btn:focus{
|
330 |
box-shadow:none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
}
|
328 |
|
329 |
.wp-core-ui .button-primary.focus, .wp-core-ui .button-primary.breeze-submit-btn:focus{
|
330 |
box-shadow:none;
|
331 |
+
}
|
332 |
+
|
333 |
+
#breeze_import_settings {
|
334 |
+
color: transparent;
|
335 |
+
width: 140px;
|
336 |
+
}
|
337 |
+
#breeze_import_settings::-webkit-file-upload-button {
|
338 |
+
visibility: hidden;
|
339 |
+
}
|
340 |
+
#breeze_import_settings::before {
|
341 |
+
content: 'Select JSON file';
|
342 |
+
color: black;
|
343 |
+
display: inline-block;
|
344 |
+
background: -webkit-linear-gradient(top, #f9f9f9, #e3e3e3);
|
345 |
+
border: 1px solid #999;
|
346 |
+
border-radius: 3px;
|
347 |
+
padding: 5px 8px;
|
348 |
+
outline: none;
|
349 |
+
white-space: nowrap;
|
350 |
+
-webkit-user-select: none;
|
351 |
+
cursor: pointer;
|
352 |
+
text-shadow: 1px 1px #fff;
|
353 |
+
font-weight: 700;
|
354 |
+
font-size: 10pt;
|
355 |
+
}
|
356 |
+
#breeze_import_settings:hover::before {
|
357 |
+
border-color: black;
|
358 |
+
}
|
359 |
+
#breeze_import_settings:active {
|
360 |
+
outline: 0;
|
361 |
+
}
|
362 |
+
#breeze_import_settings:active::before {
|
363 |
+
background: -webkit-linear-gradient(top, #e3e3e3, #f9f9f9);
|
364 |
+
}
|
365 |
+
|
366 |
+
.file_green{
|
367 |
+
color: darkgreen;
|
368 |
+
}
|
369 |
+
|
370 |
+
.file_red{
|
371 |
+
color:darkred;
|
372 |
}
|
assets/js/breeze-configuration.js
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
// database clean tabs
|
3 |
$('input[name="all_control"]').click(function () {
|
@@ -267,4 +268,84 @@ jQuery(document).ready(function ($) {
|
|
267 |
clean_url = remove_query_arg(clean_url, 'database-cleanup');
|
268 |
window.history.pushState(null, null, clean_url);
|
269 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
});
|
1 |
+
var $valid_json = false;
|
2 |
jQuery(document).ready(function ($) {
|
3 |
// database clean tabs
|
4 |
$('input[name="all_control"]').click(function () {
|
268 |
clean_url = remove_query_arg(clean_url, 'database-cleanup');
|
269 |
window.history.pushState(null, null, clean_url);
|
270 |
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Import/Export settings TAB.
|
274 |
+
*/
|
275 |
+
var $tab_import = $( '#settings-import-export' );
|
276 |
+
$tab_import.on( 'click tap', '#breeze_export_settings', function () {
|
277 |
+
$network = $( '#breeze-level' ).val();
|
278 |
+
window.location = ajaxurl + '?action=breeze_export_json&network_level=' + $network;
|
279 |
+
} );
|
280 |
+
|
281 |
+
$( '#breeze_import_btn' ).attr( 'disabled', 'disabled' );
|
282 |
+
|
283 |
+
$tab_import.on( 'change', '#breeze_import_settings', function () {
|
284 |
+
var the_file = this.files[ 0 ];
|
285 |
+
var filename_holder = $( '#file-selected' );
|
286 |
+
var filename_error = $( '#file-error' );
|
287 |
+
var breeze_import_btn = $( '#breeze_import_btn' );
|
288 |
+
|
289 |
+
filename_holder.html( the_file.name );
|
290 |
+
if ( 'application/json' !== the_file.type ) {
|
291 |
+
$valid_json = false;
|
292 |
+
filename_holder.removeClass( 'file_green file_red' ).addClass( 'file_red' );
|
293 |
+
filename_error.html( 'File must be JSON' );
|
294 |
+
breeze_import_btn.attr( 'disabled', 'disabled' );
|
295 |
+
} else {
|
296 |
+
$valid_json = true;
|
297 |
+
filename_holder.removeClass( 'file_green file_red' ).addClass( 'file_green' );
|
298 |
+
filename_error.html( '' );
|
299 |
+
breeze_import_btn.removeAttr( 'disabled' );
|
300 |
+
}
|
301 |
+
} );
|
302 |
+
|
303 |
+
$tab_import.on( 'click tap', '#breeze_import_btn', function () {
|
304 |
+
if ( true === $valid_json ) {
|
305 |
+
network = $( '#breeze-level' ).val();
|
306 |
+
var the_file = $( '#breeze_import_settings' ).get( 0 ).files[ 0 ];
|
307 |
+
|
308 |
+
var breeze_data = new FormData();
|
309 |
+
breeze_data.append( 'action', 'breeze_import_json' );
|
310 |
+
breeze_data.append( 'network_level', network );
|
311 |
+
breeze_data.append( 'breeze_import_file', the_file );
|
312 |
+
|
313 |
+
$.ajax( {
|
314 |
+
type: "POST",
|
315 |
+
url: ajaxurl,
|
316 |
+
data: breeze_data,
|
317 |
+
processData: false,
|
318 |
+
contentType: false,
|
319 |
+
enctype: 'multipart/form-data',
|
320 |
+
mimeType: 'multipart/form-data', // this too
|
321 |
+
cache: false,
|
322 |
+
dataType: 'json', // xml, html, script, json, jsonp, text
|
323 |
+
success: function ( json ) {
|
324 |
+
var filename_holder = $( '#file-selected' );
|
325 |
+
var filename_error = $( '#file-error' );
|
326 |
+
|
327 |
+
if(true == json.success){
|
328 |
+
filename_holder.removeClass( 'file_green file_red' ).addClass( 'file_green' );
|
329 |
+
filename_holder.html(json.data);
|
330 |
+
filename_error.html( '' );
|
331 |
+
alert(json.data);
|
332 |
+
window.location.reload(true);
|
333 |
+
}else{
|
334 |
+
filename_holder.removeClass( 'file_green file_red' );
|
335 |
+
filename_holder.html( '' );
|
336 |
+
filename_error.html( json.data[0].message );
|
337 |
+
}
|
338 |
+
},
|
339 |
+
error: function ( jqXHR, textStatus, errorThrown ) {
|
340 |
+
|
341 |
+
},
|
342 |
+
// called when the request finishes (after success and error callbacks are executed)
|
343 |
+
complete: function ( jqXHR, textStatus ) {
|
344 |
+
|
345 |
+
}
|
346 |
+
} );
|
347 |
+
|
348 |
+
|
349 |
+
}
|
350 |
+
} );
|
351 |
});
|
breeze.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Breeze
|
4 |
* Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
|
5 |
-
* Version: 1.2.
|
6 |
* Text Domain: breeze
|
7 |
* Domain Path: /languages
|
8 |
* Author: Cloudways
|
@@ -37,7 +37,7 @@ if ( ! defined( 'BREEZE_PLUGIN_DIR' ) ) {
|
|
37 |
define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
38 |
}
|
39 |
if ( ! defined( 'BREEZE_VERSION' ) ) {
|
40 |
-
define( 'BREEZE_VERSION', '1.2.
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
@@ -169,6 +169,9 @@ if ( ! class_exists( 'Breeze_CDN_Integration' ) ) {
|
|
169 |
|
170 |
// Refresh cache for ordered products.
|
171 |
require_once BREEZE_PLUGIN_DIR . 'inc/class-breeze-woocommerce-product-cache.php';
|
|
|
|
|
|
|
172 |
/**
|
173 |
* This function will update htaccess files after the plugin update is done.
|
174 |
*
|
2 |
/**
|
3 |
* Plugin Name: Breeze
|
4 |
* Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
|
5 |
+
* Version: 1.2.2
|
6 |
* Text Domain: breeze
|
7 |
* Domain Path: /languages
|
8 |
* Author: Cloudways
|
37 |
define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
38 |
}
|
39 |
if ( ! defined( 'BREEZE_VERSION' ) ) {
|
40 |
+
define( 'BREEZE_VERSION', '1.2.2' );
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
169 |
|
170 |
// Refresh cache for ordered products.
|
171 |
require_once BREEZE_PLUGIN_DIR . 'inc/class-breeze-woocommerce-product-cache.php';
|
172 |
+
// WP-CLI commands
|
173 |
+
require_once BREEZE_PLUGIN_DIR . 'inc/wp-cli/class-breeze-wp-cli-core.php';
|
174 |
+
|
175 |
/**
|
176 |
* This function will update htaccess files after the plugin update is done.
|
177 |
*
|
inc/cache/config-cache.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* Original development of this plugin by JoomUnited https://www.joomunited.com/
|
6 |
*
|
@@ -53,7 +53,7 @@ class Breeze_ConfigCache {
|
|
53 |
|
54 |
if ( '0' === $inherit_option ) {
|
55 |
// Site uses own (custom) configuration.
|
56 |
-
$cache_configs[
|
57 |
} else {
|
58 |
// Site uses global configuration.
|
59 |
$cache_configs['breeze-config'][] = preg_replace( '(^https?://)', '', site_url() );
|
@@ -72,33 +72,34 @@ class Breeze_ConfigCache {
|
|
72 |
if ( empty( $cache_configs ) || ( 1 === count( $cache_configs ) && empty( $cache_configs['breeze-config'] ) ) ) {
|
73 |
// No sites with caching enabled.
|
74 |
$this->clean_config();
|
|
|
75 |
return;
|
76 |
} else {
|
77 |
$file_string = '<?php ' .
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
}
|
83 |
|
84 |
if ( 1 === count( $cache_configs ) ) {
|
85 |
// Only 1 config file available.
|
86 |
-
$blog_file
|
87 |
$file_string .= "\n\$config = '$blog_file';";
|
88 |
} else {
|
89 |
// Multiple configuration files, load appropriate one by comparing URLs.
|
90 |
$file_string .= "\n\r" . '$domain = strtolower( stripslashes( $_SERVER[\'HTTP_HOST\'] ) );' .
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
if ( is_subdomain_install() ) {
|
97 |
$file_string .= "\n" . '$site_url = $domain;';
|
98 |
} else {
|
99 |
$file_string .= "\n" . 'list( $path ) = explode( \'?\', stripslashes( $_SERVER[\'REQUEST_URI\'] ) );' .
|
100 |
-
|
101 |
-
|
102 |
}
|
103 |
|
104 |
// Create conditional blocks for each site.
|
@@ -120,7 +121,7 @@ class Breeze_ConfigCache {
|
|
120 |
$file_string .= "\n\tcase '$site_url':";
|
121 |
}
|
122 |
$file_string .= "\n\t\t\$config = '$blog_file';" .
|
123 |
-
|
124 |
}
|
125 |
|
126 |
$file_string .= "\n\t}";
|
@@ -133,11 +134,11 @@ class Breeze_ConfigCache {
|
|
133 |
}
|
134 |
|
135 |
$file_string .= "\nif ( empty( \$config ) || ! @file_exists( \$config ) ) { return; }" .
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
return $wp_filesystem->put_contents( $file, $file_string );
|
143 |
}
|
@@ -341,7 +342,10 @@ class Breeze_ConfigCache {
|
|
341 |
if ( $wp_filesystem->exists( $config_file ) ) {
|
342 |
$wp_filesystem->delete( $config_file, true );
|
343 |
}
|
344 |
-
|
|
|
|
|
|
|
345 |
}
|
346 |
|
347 |
$wp_filesystem->mkdir( $config_dir );
|
@@ -371,7 +375,7 @@ class Breeze_ConfigCache {
|
|
371 |
$file = '/wp-config.php';
|
372 |
$config_path = false;
|
373 |
|
374 |
-
for ( $i = 1; $i <= 3; $i++ ) {
|
375 |
if ( $i > 1 ) {
|
376 |
$file = '/..' . $file;
|
377 |
}
|
@@ -470,6 +474,7 @@ class Breeze_ConfigCache {
|
|
470 |
global $wp_filesystem;
|
471 |
|
472 |
$folder = untrailingslashit( WP_CONTENT_DIR ) . '/breeze-config';
|
|
|
473 |
return $wp_filesystem->delete( $folder, true );
|
474 |
|
475 |
return true;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* @copyright 2017 Cloudways https://www.cloudways.com
|
4 |
*
|
5 |
* Original development of this plugin by JoomUnited https://www.joomunited.com/
|
6 |
*
|
53 |
|
54 |
if ( '0' === $inherit_option ) {
|
55 |
// Site uses own (custom) configuration.
|
56 |
+
$cache_configs["breeze-config-{$blog_id}"] = preg_replace( '(^https?://)', '', site_url() );
|
57 |
} else {
|
58 |
// Site uses global configuration.
|
59 |
$cache_configs['breeze-config'][] = preg_replace( '(^https?://)', '', site_url() );
|
72 |
if ( empty( $cache_configs ) || ( 1 === count( $cache_configs ) && empty( $cache_configs['breeze-config'] ) ) ) {
|
73 |
// No sites with caching enabled.
|
74 |
$this->clean_config();
|
75 |
+
|
76 |
return;
|
77 |
} else {
|
78 |
$file_string = '<?php ' .
|
79 |
+
"\n\r" . 'defined( \'ABSPATH\' ) || exit;' .
|
80 |
+
"\n\r" . 'define( \'BREEZE_ADVANCED_CACHE\', true );' .
|
81 |
+
"\n\r" . 'if ( is_admin() ) { return; }' .
|
82 |
+
"\n\r" . 'if ( ! @file_exists( \'' . BREEZE_PLUGIN_DIR . 'breeze.php\' ) ) { return; }';
|
83 |
}
|
84 |
|
85 |
if ( 1 === count( $cache_configs ) ) {
|
86 |
// Only 1 config file available.
|
87 |
+
$blog_file = trailingslashit( WP_CONTENT_DIR ) . 'breeze-config/breeze-config.php';
|
88 |
$file_string .= "\n\$config = '$blog_file';";
|
89 |
} else {
|
90 |
// Multiple configuration files, load appropriate one by comparing URLs.
|
91 |
$file_string .= "\n\r" . '$domain = strtolower( stripslashes( $_SERVER[\'HTTP_HOST\'] ) );' .
|
92 |
+
"\n" . 'if ( substr( $domain, -3 ) == \':80\' ) {' .
|
93 |
+
"\n" . ' $domain = substr( $domain, 0, -3 );' .
|
94 |
+
"\n" . '} elseif ( substr( $domain, -4 ) == \':443\' ) {' .
|
95 |
+
"\n" . ' $domain = substr( $domain, 0, -4 );' .
|
96 |
+
"\n" . '}';
|
97 |
if ( is_subdomain_install() ) {
|
98 |
$file_string .= "\n" . '$site_url = $domain;';
|
99 |
} else {
|
100 |
$file_string .= "\n" . 'list( $path ) = explode( \'?\', stripslashes( $_SERVER[\'REQUEST_URI\'] ) );' .
|
101 |
+
"\n" . '$path_parts = explode( \'/\', rtrim( $path, \'/\' ) );' .
|
102 |
+
"\n" . '$site_url = $domain . ( ! empty( $path_parts[1] ) ? \'/\' . $path_parts[1] : \'\' );';
|
103 |
}
|
104 |
|
105 |
// Create conditional blocks for each site.
|
121 |
$file_string .= "\n\tcase '$site_url':";
|
122 |
}
|
123 |
$file_string .= "\n\t\t\$config = '$blog_file';" .
|
124 |
+
"\n\t\tbreak;";
|
125 |
}
|
126 |
|
127 |
$file_string .= "\n\t}";
|
134 |
}
|
135 |
|
136 |
$file_string .= "\nif ( empty( \$config ) || ! @file_exists( \$config ) ) { return; }" .
|
137 |
+
"\n\$GLOBALS['breeze_config'] = include \$config;" .
|
138 |
+
"\n" . 'if ( empty( $GLOBALS[\'breeze_config\'] ) || empty( $GLOBALS[\'breeze_config\'][\'cache_options\'][\'breeze-active\'] ) ) { return; }' .
|
139 |
+
"\n" . 'if ( @file_exists( \'' . BREEZE_PLUGIN_DIR . 'inc/cache/execute-cache.php\' ) ) {' .
|
140 |
+
"\n" . ' include_once \'' . BREEZE_PLUGIN_DIR . 'inc/cache/execute-cache.php\';' .
|
141 |
+
"\n" . '}' . "\n";
|
142 |
|
143 |
return $wp_filesystem->put_contents( $file, $file_string );
|
144 |
}
|
342 |
if ( $wp_filesystem->exists( $config_file ) ) {
|
343 |
$wp_filesystem->delete( $config_file, true );
|
344 |
}
|
345 |
+
|
346 |
+
if ( false === $create_root_config ) {
|
347 |
+
return;
|
348 |
+
}
|
349 |
}
|
350 |
|
351 |
$wp_filesystem->mkdir( $config_dir );
|
375 |
$file = '/wp-config.php';
|
376 |
$config_path = false;
|
377 |
|
378 |
+
for ( $i = 1; $i <= 3; $i ++ ) {
|
379 |
if ( $i > 1 ) {
|
380 |
$file = '/..' . $file;
|
381 |
}
|
474 |
global $wp_filesystem;
|
475 |
|
476 |
$folder = untrailingslashit( WP_CONTENT_DIR ) . '/breeze-config';
|
477 |
+
|
478 |
return $wp_filesystem->delete( $folder, true );
|
479 |
|
480 |
return true;
|
inc/cache/execute-cache.php
CHANGED
@@ -218,11 +218,22 @@ function breeze_cache( $buffer, $flags ) {
|
|
218 |
|
219 |
// Lazy load implementation
|
220 |
if ( class_exists( 'Breeze_Lazy_Load' ) ) {
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
-
$lazy_load = new Breeze_Lazy_Load( $buffer, $is_lazy_load_enabled, $is_lazy_load_native );
|
225 |
-
$buffer = $lazy_load->apply_lazy_load_feature();
|
226 |
}
|
227 |
|
228 |
if ( isset( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'] ) && filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'], FILTER_VALIDATE_BOOLEAN ) ) {
|
218 |
|
219 |
// Lazy load implementation
|
220 |
if ( class_exists( 'Breeze_Lazy_Load' ) ) {
|
221 |
+
if ( isset( $GLOBALS['breeze_config'] ) ) {
|
222 |
+
if ( ! isset( $GLOBALS['breeze_config']['enabled-lazy-load'] ) ) {
|
223 |
+
$GLOBALS['breeze_config']['enabled-lazy-load'] = false;
|
224 |
+
}
|
225 |
+
|
226 |
+
if ( ! isset( $GLOBALS['breeze_config']['use-lazy-load-native'] ) ) {
|
227 |
+
$GLOBALS['breeze_config']['use-lazy-load-native'] = false;
|
228 |
+
}
|
229 |
+
|
230 |
+
$is_lazy_load_enabled = filter_var( $GLOBALS['breeze_config']['enabled-lazy-load'], FILTER_VALIDATE_BOOLEAN );
|
231 |
+
$is_lazy_load_native = filter_var( $GLOBALS['breeze_config']['use-lazy-load-native'], FILTER_VALIDATE_BOOLEAN );
|
232 |
+
|
233 |
+
$lazy_load = new Breeze_Lazy_Load( $buffer, $is_lazy_load_enabled, $is_lazy_load_native );
|
234 |
+
$buffer = $lazy_load->apply_lazy_load_feature();
|
235 |
+
}
|
236 |
|
|
|
|
|
237 |
}
|
238 |
|
239 |
if ( isset( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'] ) && filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'], FILTER_VALIDATE_BOOLEAN ) ) {
|
inc/minification/breeze-minify-main.php
CHANGED
@@ -24,7 +24,8 @@ class Breeze_Minify {
|
|
24 |
|
25 |
public function __construct() {
|
26 |
//check disable cache for page
|
27 |
-
$
|
|
|
28 |
$current_url = $domain . $_SERVER['REQUEST_URI'];
|
29 |
|
30 |
$check_url = $this->check_exclude_url( $current_url );
|
@@ -340,6 +341,10 @@ class Breeze_Minify {
|
|
340 |
$opts_config['breeze-exclude-urls'] = array_map( array( $this, 'rtrim_urls' ), $urls );
|
341 |
}
|
342 |
|
|
|
|
|
|
|
|
|
343 |
$is_exclude = breeze_check_for_exclude_values( $current_url, $opts_config['breeze-exclude-urls'] );
|
344 |
if ( ! empty( $is_exclude ) ) {
|
345 |
|
24 |
|
25 |
public function __construct() {
|
26 |
//check disable cache for page
|
27 |
+
$http_host_breeze = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
|
28 |
+
$domain = ( ( ( isset( $_SERVER['HTTPS'] ) && ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' ) . $http_host_breeze;
|
29 |
$current_url = $domain . $_SERVER['REQUEST_URI'];
|
30 |
|
31 |
$check_url = $this->check_exclude_url( $current_url );
|
341 |
$opts_config['breeze-exclude-urls'] = array_map( array( $this, 'rtrim_urls' ), $urls );
|
342 |
}
|
343 |
|
344 |
+
if ( ! isset( $opts_config['breeze-exclude-urls'] ) ) {
|
345 |
+
$opts_config['breeze-exclude-urls'] = array();
|
346 |
+
}
|
347 |
+
|
348 |
$is_exclude = breeze_check_for_exclude_values( $current_url, $opts_config['breeze-exclude-urls'] );
|
349 |
if ( ! empty( $is_exclude ) ) {
|
350 |
|
inc/wp-cli/class-breeze-cli-helpers.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Mihai Irodiu from WPRiders
|
5 |
+
* Date: 07.06.2021
|
6 |
+
* Time: 13:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Breeze_Cli_Helpers {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Fetch remote JSON.
|
13 |
+
*
|
14 |
+
* @param $url - remote JSON url
|
15 |
+
*
|
16 |
+
* @since 1.2.2
|
17 |
+
* @access public
|
18 |
+
* @static
|
19 |
+
*/
|
20 |
+
public static function fetch_remote_json( $url ) {
|
21 |
+
$rop_user_agent = 'breeze-import-settings-system';
|
22 |
+
|
23 |
+
$connection = curl_init( $url );
|
24 |
+
curl_setopt( $connection, CURLOPT_RETURNTRANSFER, true );
|
25 |
+
curl_setopt( $connection, CURLOPT_SSL_VERIFYHOST, false );
|
26 |
+
curl_setopt( $connection, CURLOPT_SSL_VERIFYPEER, false );
|
27 |
+
curl_setopt( $connection, CURLOPT_USERAGENT, $rop_user_agent );
|
28 |
+
curl_setopt( $connection, CURLOPT_REFERER, home_url() );
|
29 |
+
curl_setopt( $connection, CURLOPT_MAXREDIRS, 3 );
|
30 |
+
curl_setopt( $connection, CURLOPT_FOLLOWLOCATION, true );
|
31 |
+
|
32 |
+
$headers = array(
|
33 |
+
'Accept: application/json',
|
34 |
+
'Content-Type: application/json',
|
35 |
+
);
|
36 |
+
|
37 |
+
curl_setopt( $connection, CURLOPT_HTTPHEADER, $headers );
|
38 |
+
|
39 |
+
$fetch_response = curl_exec( $connection );
|
40 |
+
$http_code = curl_getinfo( $connection, CURLINFO_HTTP_CODE );
|
41 |
+
$curl_err_no = curl_errno( $connection );
|
42 |
+
if ( $curl_err_no ) {
|
43 |
+
$curl_err_msg = curl_error( $connection );
|
44 |
+
}
|
45 |
+
|
46 |
+
curl_close( $connection );
|
47 |
+
|
48 |
+
if ( 200 !== (int) $http_code ) {
|
49 |
+
return new WP_Error( 'url-err', __( 'Remote file could not be reached', 'breeze' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $curl_err_no ) {
|
53 |
+
return new WP_Error( 'remote-err', $curl_err_msg );
|
54 |
+
} else {
|
55 |
+
return $fetch_response;
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
}
|
inc/wp-cli/class-breeze-settings-import-export.php
ADDED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class that handles the export and import of Breeze options
|
5 |
+
*
|
6 |
+
* Class Breeze_Settings_Import_Export
|
7 |
+
*/
|
8 |
+
class Breeze_Settings_Import_Export {
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
|
12 |
+
// Logged in users only action.
|
13 |
+
add_action( 'wp_ajax_breeze_export_json', array( &$this, 'export_json_settings' ) );
|
14 |
+
add_action( 'wp_ajax_breeze_import_json', array( &$this, 'import_json_settings' ) );
|
15 |
+
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Import settings using interface in back-end.
|
21 |
+
* @since 1.2.2
|
22 |
+
* @access public
|
23 |
+
*/
|
24 |
+
public function import_json_settings() {
|
25 |
+
if ( ! current_user_can( 'administrator' ) ) {
|
26 |
+
wp_send_json_error( new WP_Error( 'authority_issue', __( 'Only administrator can import settings', 'breeze' ) ) );
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( isset( $_FILES['breeze_import_file'] ) ) {
|
31 |
+
$allowed_extension = array( 'json' );
|
32 |
+
$temp = explode( '.', $_FILES['breeze_import_file']['name'] );
|
33 |
+
$extension = strtolower( end( $temp ) );
|
34 |
+
|
35 |
+
if ( ! in_array( $extension, $allowed_extension, true ) ) {
|
36 |
+
wp_send_json_error( new WP_Error( 'ext_err', __( 'The provided file is not a JSON', 'breeze' ) ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( 'application/json' !== $_FILES['breeze_import_file']['type'] ) {
|
40 |
+
wp_send_json_error( new WP_Error( 'format_err', __( 'The provided file is not a JSON file.', 'breeze' ) ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
$get_file_content = file_get_contents( $_FILES['breeze_import_file']['tmp_name'] );
|
44 |
+
$json = json_decode( trim( $get_file_content ), true );
|
45 |
+
|
46 |
+
if ( json_last_error() === JSON_ERROR_NONE ) {
|
47 |
+
if (
|
48 |
+
isset( $json['breeze_basic_settings'] ) &&
|
49 |
+
isset( $json['breeze_advanced_settings'] ) &&
|
50 |
+
isset( $json['breeze_cdn_integration'] )
|
51 |
+
) {
|
52 |
+
$level = '';
|
53 |
+
if ( is_multisite() ) {
|
54 |
+
$level = ( isset( $_POST['network_level'] ) ) ? trim( $_POST['network_level'] ) : '';
|
55 |
+
}
|
56 |
+
$action = $this->replace_options( $json, $level );
|
57 |
+
if ( false === $action ) {
|
58 |
+
wp_send_json_error( new WP_Error( 'option_read', __( 'Could not read the options from the provided JSON file', 'breeze' ) ) );
|
59 |
+
} elseif ( true !== $action ) {
|
60 |
+
wp_send_json_error( new WP_Error( 'error_meta', $action ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
wp_send_json_success( __( "Settings imported successfully. \nPage will reload", 'breeze' ) );
|
65 |
+
}
|
66 |
+
wp_send_json_error( new WP_Error( 'incorrect_content', __( 'The JSON content is not valid', 'breeze' ) ) );
|
67 |
+
|
68 |
+
} else {
|
69 |
+
wp_send_json_error( new WP_Error( 'invalid_file', __( 'The JSON file is not valid', 'breeze' ) . ': ' . json_last_error_msg() ) );
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
} else {
|
75 |
+
wp_send_json_error( new WP_Error( 'file_not_set', __( 'The JSON file is missing', 'breeze' ) ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Export settings using interface in back-end.
|
83 |
+
*
|
84 |
+
* @since 1.2.2
|
85 |
+
* @access public
|
86 |
+
*/
|
87 |
+
public function export_json_settings() {
|
88 |
+
$level = '';
|
89 |
+
if ( is_multisite() ) {
|
90 |
+
$level = ( isset( $_GET['network_level'] ) ) ? $_GET['network_level'] : '';
|
91 |
+
}
|
92 |
+
$response = self::read_options( $level );
|
93 |
+
|
94 |
+
header( 'Content-disposition: attachment; filename=breeze-export-settings-' . date_i18n( 'd-m-Y' ) . '.json' );
|
95 |
+
header( 'Content-type: application/json' );
|
96 |
+
|
97 |
+
wp_send_json( $response );
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Reading all the options and return as array.
|
103 |
+
*
|
104 |
+
* @param string $level empty for single site, network for root multisite, numeric for subside ID.
|
105 |
+
*
|
106 |
+
* @return array
|
107 |
+
* @since 1.2.2
|
108 |
+
* @access public
|
109 |
+
* @static
|
110 |
+
*/
|
111 |
+
public static function read_options( $level = '' ) {
|
112 |
+
$export = array();
|
113 |
+
// For multisite
|
114 |
+
if ( is_multisite() ) {
|
115 |
+
// If this export is made from network admin
|
116 |
+
if ( 'network' === $level ) {
|
117 |
+
$breeze_basic_settings = get_site_option( 'breeze_basic_settings' );
|
118 |
+
$breeze_advanced_settings = get_site_option( 'breeze_advanced_settings' );
|
119 |
+
$breeze_cdn_integration = get_site_option( 'breeze_cdn_integration' );
|
120 |
+
$breeze_varnish_cache = get_site_option( 'breeze_varnish_cache' );
|
121 |
+
|
122 |
+
// Extra options
|
123 |
+
$breeze_first_install = get_site_option( 'breeze_first_install' );
|
124 |
+
$breeze_advanced_settings_120 = get_site_option( 'breeze_advanced_settings_120' );
|
125 |
+
} else { // if this export is made from sub-site.
|
126 |
+
$network_id = $level;
|
127 |
+
$breeze_basic_settings = get_blog_option( $network_id, 'breeze_basic_settings' );
|
128 |
+
$breeze_advanced_settings = get_blog_option( $network_id, 'breeze_advanced_settings' );
|
129 |
+
$breeze_cdn_integration = get_blog_option( $network_id, 'breeze_cdn_integration' );
|
130 |
+
$breeze_varnish_cache = get_blog_option( $network_id, 'breeze_varnish_cache' );
|
131 |
+
|
132 |
+
// Extra options
|
133 |
+
$breeze_first_install = get_blog_option( $network_id, 'breeze_first_install' );
|
134 |
+
$breeze_inherit_settings = get_blog_option( $network_id, 'breeze_inherit_settings' );
|
135 |
+
$breeze_ecommerce_detect = get_blog_option( $network_id, 'breeze_ecommerce_detect' );
|
136 |
+
$breeze_advanced_settings_120 = get_blog_option( $network_id, 'breeze_advanced_settings_120' );
|
137 |
+
}
|
138 |
+
} else { // If WP is single site.
|
139 |
+
$breeze_basic_settings = get_option( 'breeze_basic_settings' );
|
140 |
+
$breeze_advanced_settings = get_option( 'breeze_advanced_settings' );
|
141 |
+
$breeze_cdn_integration = get_option( 'breeze_cdn_integration' );
|
142 |
+
$breeze_varnish_cache = get_option( 'breeze_varnish_cache' );
|
143 |
+
|
144 |
+
// Extra options
|
145 |
+
$breeze_first_install = get_option( 'breeze_first_install' );
|
146 |
+
$breeze_inherit_settings = get_option( 'breeze_inherit_settings' );
|
147 |
+
$breeze_ecommerce_detect = get_option( 'breeze_ecommerce_detect' );
|
148 |
+
$breeze_advanced_settings_120 = get_option( 'breeze_advanced_settings_120' );
|
149 |
+
}
|
150 |
+
|
151 |
+
$export['breeze_basic_settings'] = $breeze_basic_settings;
|
152 |
+
$export['breeze_advanced_settings'] = $breeze_advanced_settings;
|
153 |
+
$export['breeze_cdn_integration'] = $breeze_cdn_integration;
|
154 |
+
$export['breeze_varnish_cache'] = $breeze_varnish_cache;
|
155 |
+
|
156 |
+
// Extra options
|
157 |
+
if ( isset( $breeze_first_install ) ) {
|
158 |
+
$export['breeze_first_install'] = $breeze_first_install;
|
159 |
+
}
|
160 |
+
if ( isset( $breeze_inherit_settings ) ) {
|
161 |
+
$export['breeze_inherit_settings'] = $breeze_inherit_settings;
|
162 |
+
}
|
163 |
+
if ( isset( $breeze_ecommerce_detect ) ) {
|
164 |
+
$export['breeze_ecommerce_detect'] = $breeze_ecommerce_detect;
|
165 |
+
}
|
166 |
+
if ( isset( $breeze_advanced_settings_120 ) ) {
|
167 |
+
$export['breeze_advanced_settings_120'] = $breeze_advanced_settings_120;
|
168 |
+
}
|
169 |
+
|
170 |
+
return $export;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Import settings using interface in back-end.
|
175 |
+
*
|
176 |
+
* @param array $options The array with options from import action.
|
177 |
+
* @param string $level empty for single site, network for root multisite, numeric for subside ID.
|
178 |
+
*
|
179 |
+
* @return bool|string
|
180 |
+
*
|
181 |
+
* @access public
|
182 |
+
* @since 1.2.2
|
183 |
+
*/
|
184 |
+
public function replace_options( $options = array(), $level = '' ) {
|
185 |
+
if ( empty( $options ) ) {
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
|
189 |
+
$message = '';
|
190 |
+
// For multisite
|
191 |
+
if ( is_multisite() ) {
|
192 |
+
// If this export is made from network admin
|
193 |
+
if ( 'network' === $level ) {
|
194 |
+
foreach ( $options as $meta_key => $meta_value ) {
|
195 |
+
if ( false !== strpos( $meta_key, 'breeze_' ) ) {
|
196 |
+
update_site_option( $meta_key, $meta_value );
|
197 |
+
} else {
|
198 |
+
// $meta_key was not imported
|
199 |
+
$message .= $meta_key . ' ' . __( 'was not imported', 'breeze' ) . '<br/>';
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
Breeze_ConfigCache::factory()->write_config_cache( true );
|
204 |
+
} else {
|
205 |
+
|
206 |
+
$blog_id = absint( $level );
|
207 |
+
foreach ( $options as $meta_key => $meta_value ) {
|
208 |
+
|
209 |
+
if ( false !== strpos( $meta_key, 'breeze_' ) ) {
|
210 |
+
update_blog_option( $blog_id, $meta_key, $meta_value );
|
211 |
+
} else {
|
212 |
+
// $meta_key was not imported
|
213 |
+
$message .= $meta_key . ' ' . __( 'was not imported', 'breeze' ) . '<br/>';
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
218 |
+
}
|
219 |
+
} else {
|
220 |
+
|
221 |
+
foreach ( $options as $meta_key => $meta_value ) {
|
222 |
+
if ( false !== strpos( $meta_key, 'breeze_' ) ) {
|
223 |
+
update_option( $meta_key, $meta_value );
|
224 |
+
} else {
|
225 |
+
// $meta_key was not imported
|
226 |
+
$message .= $meta_key . ' ' . __( 'was not imported', 'breeze' ) . '<br/>';
|
227 |
+
}
|
228 |
+
}
|
229 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
230 |
+
}
|
231 |
+
|
232 |
+
do_action( 'breeze_clear_all_cache' );
|
233 |
+
|
234 |
+
if ( ! empty( $message ) ) {
|
235 |
+
return $message;
|
236 |
+
}
|
237 |
+
|
238 |
+
return true;
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Import settings using WP-CLI in terminal.
|
243 |
+
*
|
244 |
+
* @param array $options The array with options from import action.
|
245 |
+
* @param string $level empty for single site, network for root multisite, numeric for subside ID.
|
246 |
+
*
|
247 |
+
* @return bool|string
|
248 |
+
* @static
|
249 |
+
* @since 1.2.2
|
250 |
+
*/
|
251 |
+
public static function replace_options_cli( $options = array(), $level = '' ) {
|
252 |
+
if ( empty( $options ) ) {
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
|
256 |
+
WP_CLI::line( 'The level is: ' . print_r( $level, true ) );// TODO remove after testing
|
257 |
+
// For multisite
|
258 |
+
if ( is_multisite() ) {
|
259 |
+
WP_CLI::line( 'The WordPress install is multisite!' );
|
260 |
+
// If this export is made from network admin
|
261 |
+
if ( 'network' === $level ) {
|
262 |
+
|
263 |
+
WP_CLI::line( WP_CLI::colorize( '%GUpdating%n %Mnetwork%n options' ) );
|
264 |
+
|
265 |
+
foreach ( $options as $meta_key => $meta_value ) {
|
266 |
+
|
267 |
+
if ( false !== strpos( $meta_key, 'breeze_' ) ) {
|
268 |
+
update_site_option( $meta_key, $meta_value );
|
269 |
+
WP_CLI::line( $meta_key . ' - ' . WP_CLI::colorize( '%Yimported%n' ) );
|
270 |
+
} else {
|
271 |
+
WP_CLI::line( $meta_key . ' - ' . WP_CLI::colorize( '%Rwas not imported%n' ) );
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
Breeze_ConfigCache::factory()->write_config_cache( true );
|
276 |
+
|
277 |
+
} else {
|
278 |
+
|
279 |
+
$is_blog = get_blog_details( $level );
|
280 |
+
$site_url = $is_blog->siteurl;
|
281 |
+
|
282 |
+
|
283 |
+
WP_CLI::line( WP_CLI::colorize( '%GUpdating%n %M' . $site_url . '%n options' ) );
|
284 |
+
$blog_id = $level;
|
285 |
+
|
286 |
+
switch_to_blog( $blog_id);
|
287 |
+
|
288 |
+
foreach ( $options as $meta_key => $meta_value ) {
|
289 |
+
if ( false !== strpos( $meta_key, 'breeze_' ) ) {
|
290 |
+
update_blog_option( $blog_id, $meta_key, $meta_value );
|
291 |
+
WP_CLI::line( $meta_key . ' - ' . WP_CLI::colorize( '%Yimported%n' ) );
|
292 |
+
} else {
|
293 |
+
WP_CLI::line( $meta_key . ' - ' . WP_CLI::colorize( '%Rwas not imported%n' ) );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
298 |
+
|
299 |
+
restore_current_blog();
|
300 |
+
}
|
301 |
+
} else {
|
302 |
+
WP_CLI::line( WP_CLI::colorize( '%GUpdating%n %MBreeze%n options' ) );
|
303 |
+
foreach ( $options as $meta_key => $meta_value ) {
|
304 |
+
if ( false !== strpos( $meta_key, 'breeze_' ) ) {
|
305 |
+
update_option( $meta_key, $meta_value );
|
306 |
+
WP_CLI::line( $meta_key . ' - ' . WP_CLI::colorize( '%Yimported%n' ) );
|
307 |
+
} else {
|
308 |
+
WP_CLI::line( $meta_key . ' - ' . WP_CLI::colorize( '%Rwas not imported%n' ) );
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
313 |
+
}
|
314 |
+
|
315 |
+
do_action( 'breeze_clear_all_cache' );
|
316 |
+
return true;
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
new Breeze_Settings_Import_Export();
|
inc/wp-cli/class-breeze-wp-cli-core.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include BREEZE_PLUGIN_DIR . 'inc/wp-cli/class-breeze-cli-helpers.php';
|
4 |
+
include BREEZE_PLUGIN_DIR . 'inc/wp-cli/class-breeze-settings-import-export.php';
|
5 |
+
|
6 |
+
// Do not proceed if it's not a WP-CLI command.
|
7 |
+
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
|
11 |
+
class Breeze_WP_Cli_Core extends \WP_CLI_Command {
|
12 |
+
|
13 |
+
function help( $args, $assoc_args ) {
|
14 |
+
|
15 |
+
WP_CLI::line( '---' );
|
16 |
+
WP_CLI::line( WP_CLI::colorize( 'Command to export settings %Ywp breeze export --file-path=/path/to/folder --level=<network|blogID>%n ' ) );
|
17 |
+
WP_CLI::line( WP_CLI::colorize( '%Y--file-path=%n%G/path/to/folder%n (%Moptional%n), default path is %C.../wp-content/uploads/breeze-export/%n' ) );
|
18 |
+
WP_CLI::line( WP_CLI::colorize( '%Y--level=%n%G<network|blogid>%n (%Mfor multisite only%n). %Cnetwork%n as value, will export Breeze network settings. %CblogID%n value must be numeric and will export the Breeze settings for the given blogID' ) );
|
19 |
+
WP_CLI::line( '---' );
|
20 |
+
|
21 |
+
WP_CLI::line( '---' );
|
22 |
+
WP_CLI::line( WP_CLI::colorize( 'Command to import settings %Ywp breeze import --file-path=/path/to/file.json --level=<network|blogID>%n ' ) );
|
23 |
+
WP_CLI::line( WP_CLI::colorize( '%Y--file-path=%n%G/path/to/file.json%n (%Rrequired%n). You need to specify the full path to the JSON file or you can provide an URL address (e.g. https://my-domain.com/my-file.json)' ) );
|
24 |
+
WP_CLI::line( WP_CLI::colorize( '%Y--level=%n%G<network|blogid>%n (%Mfor multisite only%n). %Cnetwork%n as value, will import to Breeze network settings. %CblogID%n value must be numeric and will import the Breeze settings for the given blogID' ) );
|
25 |
+
WP_CLI::line( '---' );
|
26 |
+
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Export settings to file using WP-CLI.
|
32 |
+
*
|
33 |
+
* @param $args
|
34 |
+
* @param $assoc_args
|
35 |
+
*
|
36 |
+
* @since 1.2.2
|
37 |
+
* @access public
|
38 |
+
*/
|
39 |
+
function export( $args, $assoc_args ) {
|
40 |
+
WP_CLI::line( WP_CLI::colorize( '%YExporting%n Breeze settings to JSON file...: ' ) );
|
41 |
+
$level = '';
|
42 |
+
|
43 |
+
// Default file name.
|
44 |
+
$breeze_file = 'breeze-export-settings-' . ( ( ! empty( $level ) ) ? $level . '-' : '' ) . date_i18n( 'd-m-Y' ) . '.json';
|
45 |
+
|
46 |
+
if ( ! empty( $assoc_args ) && isset( $assoc_args['level'] ) && ! empty( trim( $assoc_args['level'] ) ) ) {
|
47 |
+
|
48 |
+
if ( 'network' === trim( $assoc_args['level'] ) || is_numeric( $assoc_args['level'] ) ) {
|
49 |
+
|
50 |
+
if ( is_string( $assoc_args['level'] ) && ! is_numeric( $assoc_args['level'] ) ) {
|
51 |
+
$level = trim( $assoc_args['level'] );
|
52 |
+
$breeze_file = 'breeze-export-settings-network-' . date_i18n( 'd-m-Y' ) . '.json';
|
53 |
+
} elseif ( is_numeric( trim( $assoc_args['level'] ) ) ) {
|
54 |
+
$level = absint( trim( $assoc_args['level'] ) );
|
55 |
+
$is_blog = get_blog_details( $level );
|
56 |
+
|
57 |
+
if ( empty( $is_blog ) ) {
|
58 |
+
WP_CLI::error(
|
59 |
+
__( 'The blog ID is not valid, --level=<blog_id>', 'breeze' )
|
60 |
+
);
|
61 |
+
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$breeze_file = 'breeze-export-settings-' . $level . '-' . date_i18n( 'd-m-Y' ) . '.json';
|
66 |
+
}
|
67 |
+
} else {
|
68 |
+
WP_CLI::error(
|
69 |
+
__( 'Parameter --level=<network|blog_id> does not contain valid data', 'breeze' )
|
70 |
+
);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
$settings = wp_json_encode( Breeze_Settings_Import_Export::read_options( $level ) );
|
74 |
+
|
75 |
+
$uploads = wp_upload_dir();
|
76 |
+
$uploads_base_folder = $uploads['basedir'];
|
77 |
+
|
78 |
+
$breeze_export = $uploads_base_folder . '/breeze-export/';
|
79 |
+
|
80 |
+
if ( ! empty( $assoc_args ) && isset( $assoc_args['file-path'] ) ) {
|
81 |
+
$path = trim( $assoc_args['file-path'] );
|
82 |
+
if ( ! empty( $path ) ) {
|
83 |
+
$breeze_export = trailingslashit( $path );
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
$full_file_path = $breeze_export . $breeze_file;
|
88 |
+
$create = false;
|
89 |
+
if ( wp_mkdir_p( $breeze_export ) ) {
|
90 |
+
$create = true;
|
91 |
+
}
|
92 |
+
if ( $create ) {
|
93 |
+
$file_handle = @fopen( $full_file_path, 'wb' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
|
94 |
+
if ( $file_handle ) {
|
95 |
+
fwrite( $file_handle, $settings ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
|
96 |
+
fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
|
97 |
+
} else {
|
98 |
+
WP_CLI::error(
|
99 |
+
__( 'Could not write to file', 'breeze' )
|
100 |
+
);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
WP_CLI::success(
|
105 |
+
__( 'Breeze settings have been exported to file', 'breeze' )
|
106 |
+
);
|
107 |
+
|
108 |
+
WP_CLI::line(
|
109 |
+
sprintf(
|
110 |
+
/* translators: %s Export file location */
|
111 |
+
__( 'File location: %s', 'breeze' ),
|
112 |
+
$full_file_path
|
113 |
+
)
|
114 |
+
);
|
115 |
+
|
116 |
+
WP_CLI::line( WP_CLI::colorize( '%YDone%n.' ) );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Import settings using WP-CLI.
|
121 |
+
*
|
122 |
+
* @param $args
|
123 |
+
* @param $assoc_args
|
124 |
+
*
|
125 |
+
* @since 1.2.2
|
126 |
+
* @access public
|
127 |
+
*/
|
128 |
+
function import( $args, $assoc_args ) {
|
129 |
+
if ( empty( $assoc_args ) || ! isset( $assoc_args['file-path'] ) ) {
|
130 |
+
WP_CLI::error(
|
131 |
+
__( 'You need to specify the --file-path=<full_path_to_file> parameter', 'breeze' )
|
132 |
+
);
|
133 |
+
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
$file_path = trim( $assoc_args['file-path'] );
|
138 |
+
|
139 |
+
if ( empty( $file_path ) ) {
|
140 |
+
WP_CLI::error(
|
141 |
+
__( 'You need to specify the full path to breeze JSON file', 'breeze' )
|
142 |
+
);
|
143 |
+
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
if ( wp_http_validate_url( $file_path ) || filter_var( $file_path, FILTER_VALIDATE_URL ) ) {
|
147 |
+
$contents = Breeze_Cli_Helpers::fetch_remote_json( $file_path );
|
148 |
+
if ( is_wp_error( $contents ) ) {
|
149 |
+
WP_CLI::error(
|
150 |
+
__( 'Error importing remote JSON file', 'breeze' ) . ' : ' . $contents->get_error_message()
|
151 |
+
);
|
152 |
+
}
|
153 |
+
|
154 |
+
} else {
|
155 |
+
if ( ! file_exists( $file_path ) || ! is_readable( $file_path ) ) {
|
156 |
+
WP_CLI::error(
|
157 |
+
__( 'The given file path is not valid or the file is not readable', 'breeze' ) . ' : ' . $file_path
|
158 |
+
);
|
159 |
+
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
+
$handle = fopen( $file_path, 'r' );
|
164 |
+
$contents = fread( $handle, filesize( $file_path ) );
|
165 |
+
fclose( $handle );
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
+
$contents = trim( $contents );
|
170 |
+
|
171 |
+
$json = json_decode( $contents, true );
|
172 |
+
if ( json_last_error() !== JSON_ERROR_NONE ) {
|
173 |
+
WP_CLI::error(
|
174 |
+
sprintf(
|
175 |
+
/* translators: %s The JSON had an issue */
|
176 |
+
__( 'There was an error running the action scheduler: %s', 'breeze' ),
|
177 |
+
json_last_error_msg()
|
178 |
+
)
|
179 |
+
);
|
180 |
+
|
181 |
+
return;
|
182 |
+
}
|
183 |
+
|
184 |
+
if (
|
185 |
+
isset( $json['breeze_basic_settings'] ) &&
|
186 |
+
isset( $json['breeze_advanced_settings'] ) &&
|
187 |
+
isset( $json['breeze_cdn_integration'] )
|
188 |
+
) {
|
189 |
+
WP_CLI::success(
|
190 |
+
__( 'The provided JSON is valid...importing data', 'breeze' )
|
191 |
+
);
|
192 |
+
|
193 |
+
$level = '';
|
194 |
+
if ( ! empty( $assoc_args ) && isset( $assoc_args['level'] ) && ! empty( trim( $assoc_args['level'] ) ) ) {
|
195 |
+
if ( 'network' === trim( $assoc_args['level'] ) || is_numeric( $assoc_args['level'] ) ) {
|
196 |
+
|
197 |
+
if ( is_string( $assoc_args['level'] ) && ! is_numeric( $assoc_args['level'] ) ) {
|
198 |
+
$level = trim( $assoc_args['level'] );
|
199 |
+
|
200 |
+
} elseif ( is_numeric( trim( $assoc_args['level'] ) ) ) {
|
201 |
+
$level = absint( trim( $assoc_args['level'] ) );
|
202 |
+
$is_blog = get_blog_details( $level );
|
203 |
+
|
204 |
+
if ( empty( $is_blog ) ) {
|
205 |
+
WP_CLI::error(
|
206 |
+
__( 'The blog ID is not valid, --level=<blog_id>', 'breeze' )
|
207 |
+
);
|
208 |
+
|
209 |
+
return;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
} else {
|
213 |
+
WP_CLI::error(
|
214 |
+
__( 'Parameter --level=<network|blog_id> does not contain valid data', 'breeze' )
|
215 |
+
);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
$settings_action = Breeze_Settings_Import_Export::replace_options_cli( $json, $level );
|
220 |
+
|
221 |
+
if ( true === $settings_action ) {
|
222 |
+
WP_CLI::success(
|
223 |
+
__( 'Settings have been imported', 'breeze' )
|
224 |
+
);
|
225 |
+
} else {
|
226 |
+
WP_CLI::error(
|
227 |
+
__( 'Error improting the settings, check the JSON file', 'breeze' ) . ' : ' . $file_path
|
228 |
+
);
|
229 |
+
}
|
230 |
+
} else {
|
231 |
+
WP_CLI::error(
|
232 |
+
__( 'The JSON file does not contain valid data', 'breeze' ) . ' : ' . $file_path
|
233 |
+
);
|
234 |
+
}
|
235 |
+
|
236 |
+
WP_CLI::line( WP_CLI::colorize( '%YDone%n.' ) );
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
WP_CLI::add_command(
|
243 |
+
'breeze',
|
244 |
+
'Breeze_WP_Cli_Core',
|
245 |
+
array( 'file-path' => '' )
|
246 |
+
);
|
247 |
+
|
248 |
+
|
249 |
+
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Cloudways
|
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.7
|
6 |
-
Stable tag: 1.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -23,7 +23,7 @@ Breeze excels in the following areas:
|
|
23 |
|
24 |
What makes Breeze WordPress Cache Plugin awesome is that it comes with builtin support for Varnish. If Varnish is not installed on your servers, Breeze will utilize its internal cache mechanism to boost up your WordPress site performance.
|
25 |
|
26 |
-
**Support:** We love to provide support! Post your questions on the WordPress.org support forums, or if you are a Cloudways Customer you may ask questions on the <a href="https://community.cloudways.com/">Cloudways Community Forum</a>.
|
27 |
|
28 |
**Special Thanks:** We would like to give special mention to WP Speed Of Light for being an inspiration for Breeze.
|
29 |
|
@@ -61,11 +61,11 @@ Breeze, by default, supports Varnish. It has been tested to be fully compatible
|
|
61 |
|
62 |
= Does Breeze support WooCommerce? =
|
63 |
|
64 |
-
Breeze is fully compatible with WooCommerce, out of the box. It does not require any special configurations.
|
65 |
|
66 |
= Does Breeze support WordPress Multisite? =
|
67 |
|
68 |
-
Breeze is fully compatible with WordPress Multisite without the need for any extra configuration.
|
69 |
|
70 |
= How does Breeze handle WordPress multisite? =
|
71 |
|
@@ -73,7 +73,7 @@ Breeze handles all WordPress multisite instances globally. All the settings for
|
|
73 |
|
74 |
= Is Breeze compatible with other WordPress Cache plugins? =
|
75 |
|
76 |
-
We DO NOT recommend using two WordPress cache plugins at the same time on any WordPress website.
|
77 |
We strongly recommend that you use Breeze as the only cache plugin for your website. If there are any other cache plugins installed, please ensure that you have disabled them prior to proceeding with the Breeze installation.
|
78 |
|
79 |
|
@@ -87,13 +87,13 @@ Breeze has been tested with popular plugins available on WordPress.org. Please f
|
|
87 |
|
88 |
= Does Breeze support CDN? =
|
89 |
|
90 |
-
Breeze supports CDN integration. It allows all static assets (such as images, CSS and JS files) to be served via CDN.
|
91 |
|
92 |
= What does Breeze's Database Optimization feature do? =
|
93 |
|
94 |
-
WordPress databases are notorious for storing information like post revisions, spam comments and much more. Over time, databases l become bloated and it is a good practice to clear out unwanted information to reduce database size and improve optimization.
|
95 |
|
96 |
-
Breeze's database optimization cleans out unwanted information in a single click.
|
97 |
|
98 |
= Will comments and other dynamic parts of my blog appear immediately? =
|
99 |
|
@@ -101,7 +101,7 @@ Comments will appear upon moderation as per the comment system (or policy) set i
|
|
101 |
|
102 |
= Can I exclude URLs of individual files and pages from cache? =
|
103 |
|
104 |
-
You can exclude a file by mentioning its URL or file type (by mentioning file extension) in the exclude fields (available in the Breeze settings). Exclude will not let the cache impact that URL or file type.
|
105 |
|
106 |
If Varnish is active, you will need to exclude URLs and file type(s) in the Varnish configuration. If you are hosting WordPress websites on Cloudways servers, follow <a href="https://support.cloudways.com/how-to-exclude-url-from-varnish/">this KB to exclude URLs from the Varnish cache</a>.
|
107 |
|
@@ -145,6 +145,12 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
|
|
145 |
|
146 |
== Changelog ==
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 1.2.1 =
|
149 |
|
150 |
* Fix: improve the handling of warning undefine index of lazy load image while enable debug mode.
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.7
|
6 |
+
Stable tag: 1.2.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
23 |
|
24 |
What makes Breeze WordPress Cache Plugin awesome is that it comes with builtin support for Varnish. If Varnish is not installed on your servers, Breeze will utilize its internal cache mechanism to boost up your WordPress site performance.
|
25 |
|
26 |
+
**Support:** We love to provide support! Post your questions on the WordPress.org support forums, or if you are a Cloudways Customer you may ask questions on the <a href="https://community.cloudways.com/">Cloudways Community Forum</a>.
|
27 |
|
28 |
**Special Thanks:** We would like to give special mention to WP Speed Of Light for being an inspiration for Breeze.
|
29 |
|
61 |
|
62 |
= Does Breeze support WooCommerce? =
|
63 |
|
64 |
+
Breeze is fully compatible with WooCommerce, out of the box. It does not require any special configurations.
|
65 |
|
66 |
= Does Breeze support WordPress Multisite? =
|
67 |
|
68 |
+
Breeze is fully compatible with WordPress Multisite without the need for any extra configuration.
|
69 |
|
70 |
= How does Breeze handle WordPress multisite? =
|
71 |
|
73 |
|
74 |
= Is Breeze compatible with other WordPress Cache plugins? =
|
75 |
|
76 |
+
We DO NOT recommend using two WordPress cache plugins at the same time on any WordPress website.
|
77 |
We strongly recommend that you use Breeze as the only cache plugin for your website. If there are any other cache plugins installed, please ensure that you have disabled them prior to proceeding with the Breeze installation.
|
78 |
|
79 |
|
87 |
|
88 |
= Does Breeze support CDN? =
|
89 |
|
90 |
+
Breeze supports CDN integration. It allows all static assets (such as images, CSS and JS files) to be served via CDN.
|
91 |
|
92 |
= What does Breeze's Database Optimization feature do? =
|
93 |
|
94 |
+
WordPress databases are notorious for storing information like post revisions, spam comments and much more. Over time, databases l become bloated and it is a good practice to clear out unwanted information to reduce database size and improve optimization.
|
95 |
|
96 |
+
Breeze's database optimization cleans out unwanted information in a single click.
|
97 |
|
98 |
= Will comments and other dynamic parts of my blog appear immediately? =
|
99 |
|
101 |
|
102 |
= Can I exclude URLs of individual files and pages from cache? =
|
103 |
|
104 |
+
You can exclude a file by mentioning its URL or file type (by mentioning file extension) in the exclude fields (available in the Breeze settings). Exclude will not let the cache impact that URL or file type.
|
105 |
|
106 |
If Varnish is active, you will need to exclude URLs and file type(s) in the Varnish configuration. If you are hosting WordPress websites on Cloudways servers, follow <a href="https://support.cloudways.com/how-to-exclude-url-from-varnish/">this KB to exclude URLs from the Varnish cache</a>.
|
107 |
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
+
= 1.2.2 =
|
149 |
+
|
150 |
+
* Add: Export settings via Command Line Interface (wp-cli).
|
151 |
+
* Add: Import settings via Command Line Interface(wp-cli).
|
152 |
+
|
153 |
+
|
154 |
= 1.2.1 =
|
155 |
|
156 |
* Fix: improve the handling of warning undefine index of lazy load image while enable debug mode.
|
views/breeze-setting-views.php
CHANGED
@@ -8,6 +8,7 @@ $tabs = array(
|
|
8 |
'database' => __( 'DATABASE', 'breeze' ),
|
9 |
'cdn' => __( 'CDN', 'breeze' ),
|
10 |
'varnish' => __( 'VARNISH', 'breeze' ),
|
|
|
11 |
'faq' => __( 'FAQs', 'breeze' ),
|
12 |
);
|
13 |
|
@@ -24,11 +25,11 @@ $global_tabs = array(
|
|
24 |
<div id="message-save-settings" class="notice notice-success is-dismissible" style="margin: 10px 0px 10px 0;padding: 10px;"><strong><?php _e( 'Configuration settings saved', 'breeze' ); ?></strong></div>
|
25 |
<?php endif; ?>
|
26 |
<div class="wrap breeze-main">
|
27 |
-
<div class="breeze-header">
|
28 |
-
<a href="https://www.cloudways.com" target="_blank">
|
29 |
-
<div class="breeze-logo"></div>
|
30 |
-
</a>
|
31 |
-
</div>
|
32 |
|
33 |
<h1 style="clear: both"></h1>
|
34 |
|
@@ -111,25 +112,25 @@ $global_tabs = array(
|
|
111 |
}
|
112 |
?>
|
113 |
|
114 |
-
<!--Right-side content-->
|
115 |
-
<div id="breeze-and-cloudways" class="rs-block">
|
116 |
<h3 class="rs-title"><?php _e( 'Want to Experience Better Performance?', 'breeze' ); ?></h3>
|
117 |
-
<div class="rs-content">
|
118 |
<p><?php _e( 'Take advantage of powerful features by deploying WordPress and Breeze on Cloudways.', 'breeze' ); ?></p>
|
119 |
-
<ul>
|
120 |
<li><?php _e( 'Fully Compatible with Varnish', 'breeze' ); ?></li>
|
121 |
<li><?php _e( 'One-Click setup of CloudwaysCDN', 'breeze' ); ?></li>
|
122 |
<li><?php _e( '24/7 Expert Human Support', 'breeze' ); ?></li>
|
123 |
<li><?php _e( 'WooCommerce Compatible', 'breeze' ); ?></li>
|
124 |
-
</ul>
|
125 |
-
<button class="button button-primary">
|
126 |
<a href="https://www.cloudways.com/en/wordpress-cloud-hosting.php?utm_source=breeze-plugin&utm_medium=breeze&utm_campaign=breeze" target="_blank"><?php _e( 'Find Out More', 'breeze' ); ?></a>
|
127 |
-
</button>
|
128 |
-
</div>
|
129 |
-
<div class="rs-content">
|
130 |
<h4><?php _e( 'Rate Breeze', 'breeze' ); ?></h4>
|
131 |
<p><?php _e( 'If you are satisfied with Breeze\'s performance, <a href="https://wordpress.org/plugins/breeze#reviews" target="_blank">drop us a rating here.</a>', 'breeze' ); ?></p>
|
132 |
-
</div>
|
133 |
-
</div>
|
134 |
-
</div>
|
135 |
</div>
|
8 |
'database' => __( 'DATABASE', 'breeze' ),
|
9 |
'cdn' => __( 'CDN', 'breeze' ),
|
10 |
'varnish' => __( 'VARNISH', 'breeze' ),
|
11 |
+
'import_export' => __( 'Settings import/export', 'breeze' ),
|
12 |
'faq' => __( 'FAQs', 'breeze' ),
|
13 |
);
|
14 |
|
25 |
<div id="message-save-settings" class="notice notice-success is-dismissible" style="margin: 10px 0px 10px 0;padding: 10px;"><strong><?php _e( 'Configuration settings saved', 'breeze' ); ?></strong></div>
|
26 |
<?php endif; ?>
|
27 |
<div class="wrap breeze-main">
|
28 |
+
<div class="breeze-header">
|
29 |
+
<a href="https://www.cloudways.com" target="_blank">
|
30 |
+
<div class="breeze-logo"></div>
|
31 |
+
</a>
|
32 |
+
</div>
|
33 |
|
34 |
<h1 style="clear: both"></h1>
|
35 |
|
112 |
}
|
113 |
?>
|
114 |
|
115 |
+
<!--Right-side content-->
|
116 |
+
<div id="breeze-and-cloudways" class="rs-block">
|
117 |
<h3 class="rs-title"><?php _e( 'Want to Experience Better Performance?', 'breeze' ); ?></h3>
|
118 |
+
<div class="rs-content">
|
119 |
<p><?php _e( 'Take advantage of powerful features by deploying WordPress and Breeze on Cloudways.', 'breeze' ); ?></p>
|
120 |
+
<ul>
|
121 |
<li><?php _e( 'Fully Compatible with Varnish', 'breeze' ); ?></li>
|
122 |
<li><?php _e( 'One-Click setup of CloudwaysCDN', 'breeze' ); ?></li>
|
123 |
<li><?php _e( '24/7 Expert Human Support', 'breeze' ); ?></li>
|
124 |
<li><?php _e( 'WooCommerce Compatible', 'breeze' ); ?></li>
|
125 |
+
</ul>
|
126 |
+
<button class="button button-primary">
|
127 |
<a href="https://www.cloudways.com/en/wordpress-cloud-hosting.php?utm_source=breeze-plugin&utm_medium=breeze&utm_campaign=breeze" target="_blank"><?php _e( 'Find Out More', 'breeze' ); ?></a>
|
128 |
+
</button>
|
129 |
+
</div>
|
130 |
+
<div class="rs-content">
|
131 |
<h4><?php _e( 'Rate Breeze', 'breeze' ); ?></h4>
|
132 |
<p><?php _e( 'If you are satisfied with Breeze\'s performance, <a href="https://wordpress.org/plugins/breeze#reviews" target="_blank">drop us a rating here.</a>', 'breeze' ); ?></p>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
</div>
|
views/tabs/basic.php
CHANGED
@@ -144,6 +144,15 @@ $basic = breeze_get_option( 'basic_settings', true );
|
|
144 |
|
145 |
?>
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
<tr style="display: none;">
|
148 |
<td style="vertical-align: middle">
|
149 |
<label for="desktop-cache" class="breeze_tool_tip"> <?php _e( 'Desktop Cache', 'breeze' ); ?></label>
|
144 |
|
145 |
?>
|
146 |
|
147 |
+
<?php
|
148 |
+
if ( ! isset( $basic['breeze-desktop-cache'] ) ) {
|
149 |
+
$basic['breeze-desktop-cache'] = '1';
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( ! isset( $basic['breeze-mobile-cache'] ) ) {
|
153 |
+
$basic['breeze-mobile-cache'] = '1';
|
154 |
+
}
|
155 |
+
?>
|
156 |
<tr style="display: none;">
|
157 |
<td style="vertical-align: middle">
|
158 |
<label for="desktop-cache" class="breeze_tool_tip"> <?php _e( 'Desktop Cache', 'breeze' ); ?></label>
|
views/tabs/import_export.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Import / Export the settings view.
|
4 |
+
*/
|
5 |
+
|
6 |
+
$level = '';
|
7 |
+
if ( is_multisite() ) {
|
8 |
+
if ( is_network_admin() ) {
|
9 |
+
$level = 'network';
|
10 |
+
} else {
|
11 |
+
$level = get_current_blog_id();
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
?>
|
16 |
+
<table cellspacing="15" id="settings-import-export">
|
17 |
+
<tr>
|
18 |
+
<td>
|
19 |
+
<label for="breeze_export_settings" class="breeze_tool_tip"><?php _e( 'Export settings:', 'breeze' ); ?></label>
|
20 |
+
</td>
|
21 |
+
<td>
|
22 |
+
<input type="button" name="breeze_export_settings" id="breeze_export_settings" class="button-primary" value="<?php _e( 'Export JSON', 'breeze' ); ?>">
|
23 |
+
<input type="hidden" id="breeze-level" value="<?php echo esc_attr( $level ); ?>">
|
24 |
+
</td>
|
25 |
+
</tr>
|
26 |
+
<tr>
|
27 |
+
<td>
|
28 |
+
<label for="breeze_import_settings" class="breeze_tool_tip"><?php _e( 'Import settings:', 'breeze' ); ?></label>
|
29 |
+
</td>
|
30 |
+
<td>
|
31 |
+
<input type="file" name="breeze_import_settings" id="breeze_import_settings">
|
32 |
+
<input type="button" id="breeze_import_btn" value="<?php _e( 'Import file', 'breeze' ); ?>" class="button-primary"/>
|
33 |
+
<p id="file-selected"></p>
|
34 |
+
<p id="file-error" class="file_red" style="font-weight: bold"></p>
|
35 |
+
</td>
|
36 |
+
</tr>
|
37 |
+
</table>
|