Version Description
- Add: URLs containing query strings will not be cached by default.
- Add: Ignore specific query strings while serving the cache to improve performance.
- Add: Ability to cache URLs with specific query strings variables.
- Add: Cache handling of URLs having multiple parameters in one query string.
- Add: Exceptional Cache handling for case where permalink is set to PLAIN, which includes links for POST, PAGES, ATTACHMENTS, CATEGORIES, ARCHIVES.
Download this release
Release Info
Developer | adeelkhan |
Plugin | Breeze – WordPress Cache Plugin |
Version | 1.2.5 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.2.5
- breeze.php +3 -2
- inc/breeze-admin.php +1 -0
- inc/breeze-configuration.php +5 -0
- inc/cache/config-cache.php +36 -0
- inc/cache/execute-cache.php +60 -41
- inc/class-breeze-file-permissions.php +7 -1
- inc/class-breeze-query-strings-rules.php +375 -0
- inc/functions.php +3 -0
- inc/minification/breeze-js-deferred-loading.php +12 -8
- inc/minification/breeze-minify-main.php +4 -1
- readme.txt +11 -1
- views/tabs/advanced.php +24 -0
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() );
|
@@ -104,6 +104,7 @@ if ( is_admin() || 'cli' === php_sapi_name() ) {
|
|
104 |
'init',
|
105 |
function () {
|
106 |
new Breeze_Ecommerce_Cache();
|
|
|
107 |
},
|
108 |
0
|
109 |
);
|
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.5
|
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.5' );
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
104 |
'init',
|
105 |
function () {
|
106 |
new Breeze_Ecommerce_Cache();
|
107 |
+
Breeze_Query_Strings_Rules::when_woocommerce_settings_save();
|
108 |
},
|
109 |
0
|
110 |
);
|
inc/breeze-admin.php
CHANGED
@@ -368,6 +368,7 @@ class Breeze_Admin {
|
|
368 |
'breeze-move-to-footer-js' => array(),
|
369 |
'breeze-defer-js' => array(),
|
370 |
'breeze-enable-js-delay' => '0',
|
|
|
371 |
);
|
372 |
|
373 |
$is_advanced = get_option( 'breeze_advanced_settings_120' );
|
368 |
'breeze-move-to-footer-js' => array(),
|
369 |
'breeze-defer-js' => array(),
|
370 |
'breeze-enable-js-delay' => '0',
|
371 |
+
'cached-query-strings' => array(),
|
372 |
);
|
373 |
|
374 |
$is_advanced = get_option( 'breeze_advanced_settings_120' );
|
inc/breeze-configuration.php
CHANGED
@@ -105,6 +105,7 @@ class Breeze_Configuration {
|
|
105 |
$exclude_css = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-css'] ) );
|
106 |
$exclude_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-js'] ) );
|
107 |
$delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['delay-js-scripts'] ) );
|
|
|
108 |
$preload_fonts = $move_to_footer_js = $defer_js = array();
|
109 |
|
110 |
if ( ! empty( $exclude_js ) ) {
|
@@ -114,6 +115,9 @@ class Breeze_Configuration {
|
|
114 |
$delay_js = array_unique( $delay_js );
|
115 |
}
|
116 |
|
|
|
|
|
|
|
117 |
|
118 |
if ( ! empty( $exclude_css ) ) {
|
119 |
$exclude_css = array_unique( $exclude_css );
|
@@ -161,6 +165,7 @@ class Breeze_Configuration {
|
|
161 |
'breeze-move-to-footer-js' => $move_to_footer_js,
|
162 |
'breeze-defer-js' => $defer_js,
|
163 |
'breeze-delay-js-scripts' => $delay_js,
|
|
|
164 |
'breeze-preload-fonts' => $preload_fonts,
|
165 |
'breeze-enable-js-delay' => ( isset( $_POST['enable-js-delay'] ) ? '1' : '0' ),
|
166 |
);
|
105 |
$exclude_css = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-css'] ) );
|
106 |
$exclude_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-js'] ) );
|
107 |
$delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['delay-js-scripts'] ) );
|
108 |
+
$cache_query_str = $this->string_convert_arr( sanitize_textarea_field( $_POST['cache-query-str'] ) );
|
109 |
$preload_fonts = $move_to_footer_js = $defer_js = array();
|
110 |
|
111 |
if ( ! empty( $exclude_js ) ) {
|
115 |
$delay_js = array_unique( $delay_js );
|
116 |
}
|
117 |
|
118 |
+
if ( ! empty( $cache_query_str ) ) {
|
119 |
+
$cache_query_str = array_unique( $cache_query_str );
|
120 |
+
}
|
121 |
|
122 |
if ( ! empty( $exclude_css ) ) {
|
123 |
$exclude_css = array_unique( $exclude_css );
|
165 |
'breeze-move-to-footer-js' => $move_to_footer_js,
|
166 |
'breeze-defer-js' => $defer_js,
|
167 |
'breeze-delay-js-scripts' => $delay_js,
|
168 |
+
'cached-query-strings' => $cache_query_str,
|
169 |
'breeze-preload-fonts' => $preload_fonts,
|
170 |
'breeze-enable-js-delay' => ( isset( $_POST['enable-js-delay'] ) ? '1' : '0' ),
|
171 |
);
|
inc/cache/config-cache.php
CHANGED
@@ -198,6 +198,38 @@ class Breeze_ConfigCache {
|
|
198 |
$storage['use-lazy-load-native'] = ( isset( $config['breeze-lazy-load-native'] ) ? $config['breeze-lazy-load-native'] : 0 );
|
199 |
$storage['breeze-preload-links'] = ( isset( $config['breeze-preload-links'] ) ? $config['breeze-preload-links'] : 0 );
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
if ( class_exists( 'WooCommerce' ) ) {
|
202 |
$ecommerce_exclude_urls = Breeze_Ecommerce_Cache::factory()->ecommerce_exclude_pages();
|
203 |
}
|
@@ -298,6 +330,10 @@ class Breeze_ConfigCache {
|
|
298 |
$storage['disable_per_adminuser'] = $settings['breeze-disable-admin'];
|
299 |
}
|
300 |
|
|
|
|
|
|
|
|
|
301 |
$storage['exclude_url'] = array_merge(
|
302 |
$ecommerce_exclude_urls,
|
303 |
! empty( $config['breeze-exclude-urls'] ) ? $config['breeze-exclude-urls'] : array()
|
198 |
$storage['use-lazy-load-native'] = ( isset( $config['breeze-lazy-load-native'] ) ? $config['breeze-lazy-load-native'] : 0 );
|
199 |
$storage['breeze-preload-links'] = ( isset( $config['breeze-preload-links'] ) ? $config['breeze-preload-links'] : 0 );
|
200 |
|
201 |
+
|
202 |
+
if ( isset( $_POST['woocommerce_default_customer_address'] ) ) {
|
203 |
+
$storage['woocommerce_geolocation_ajax'] = ( 'geolocation_ajax' === $_POST['woocommerce_default_customer_address'] ) ? 1 : 0;
|
204 |
+
} else {
|
205 |
+
$storage['woocommerce_geolocation_ajax'] = ( 'geolocation_ajax' === get_option( 'woocommerce_default_customer_address', '' ) ) ? 1 : 0;
|
206 |
+
}
|
207 |
+
|
208 |
+
// permalink_structure
|
209 |
+
if ( is_multisite() ) {
|
210 |
+
if ( is_network_admin() ) {
|
211 |
+
// network oes not have this setting.
|
212 |
+
// we save for each sub-site.
|
213 |
+
$blogs = get_sites();
|
214 |
+
if ( ! empty( $blogs ) ) {
|
215 |
+
foreach ( $blogs as $blog_data ) {
|
216 |
+
$blog_id = $blog_data->blog_id;
|
217 |
+
switch_to_blog( $blog_id );
|
218 |
+
|
219 |
+
$storage['permalink_structure'][ 'blog_' . $blog_id ] = get_blog_option( $blog_id, 'permalink_structure', '' );
|
220 |
+
|
221 |
+
restore_current_blog();
|
222 |
+
}
|
223 |
+
}
|
224 |
+
} else {
|
225 |
+
$network_id = get_current_blog_id();
|
226 |
+
$storage['permalink_structure'] = get_blog_option( $network_id, 'permalink_structure', '' );
|
227 |
+
}
|
228 |
+
} else {
|
229 |
+
$storage['permalink_structure'] = get_option( 'permalink_structure', '' );
|
230 |
+
}
|
231 |
+
|
232 |
+
|
233 |
if ( class_exists( 'WooCommerce' ) ) {
|
234 |
$ecommerce_exclude_urls = Breeze_Ecommerce_Cache::factory()->ecommerce_exclude_pages();
|
235 |
}
|
330 |
$storage['disable_per_adminuser'] = $settings['breeze-disable-admin'];
|
331 |
}
|
332 |
|
333 |
+
if ( ! empty( $config['cached-query-strings'] ) ) {
|
334 |
+
$storage['cached-query-strings'] = $config['cached-query-strings'];
|
335 |
+
}
|
336 |
+
|
337 |
$storage['exclude_url'] = array_merge(
|
338 |
$ecommerce_exclude_urls,
|
339 |
! empty( $config['breeze-exclude-urls'] ) ? $config['breeze-exclude-urls'] : array()
|
inc/cache/execute-cache.php
CHANGED
@@ -112,6 +112,17 @@ $current_url = $domain . rawurldecode( $_SERVER['REQUEST_URI'] );
|
|
112 |
$opts_config = $GLOBALS['breeze_config'];
|
113 |
$check_exclude = check_exclude_page( $opts_config, $current_url );
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
//load cache
|
116 |
if ( ! $check_exclude ) {
|
117 |
$devices = $opts_config['cache_options'];
|
@@ -122,16 +133,16 @@ if ( ! $check_exclude ) {
|
|
122 |
// M for Mobile cache
|
123 |
// T for Tablet cache
|
124 |
if ( (int) $devices['breeze-mobile-cache'] == 1 ) {
|
125 |
-
$X1
|
126 |
$filename .= '_breeze_cache_desktop';
|
127 |
}
|
128 |
if ( (int) $devices['breeze-mobile-cache'] == 2 ) {
|
129 |
-
$X1
|
130 |
$filename .= '_breeze_cache_mobile';
|
131 |
}
|
132 |
} else {
|
133 |
if ( (int) $devices['breeze-desktop-cache'] == 1 ) {
|
134 |
-
$X1
|
135 |
$filename .= '_breeze_cache_desktop';
|
136 |
}
|
137 |
}
|
@@ -145,8 +156,8 @@ if ( ! $check_exclude ) {
|
|
145 |
/**
|
146 |
* Cache output before it goes to the browser
|
147 |
*
|
148 |
-
* @param
|
149 |
-
* @param
|
150 |
*
|
151 |
* @return string
|
152 |
* @since 1.0
|
@@ -238,13 +249,13 @@ function breeze_cache( $buffer, $flags ) {
|
|
238 |
// Lazy load implementation
|
239 |
if ( class_exists( 'Breeze_Lazy_Load' ) ) {
|
240 |
if ( isset( $GLOBALS['breeze_config'] ) ) {
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
|
249 |
$is_lazy_load_enabled = filter_var( $GLOBALS['breeze_config']['enabled-lazy-load'], FILTER_VALIDATE_BOOLEAN );
|
250 |
$is_lazy_load_native = filter_var( $GLOBALS['breeze_config']['use-lazy-load-native'], FILTER_VALIDATE_BOOLEAN );
|
@@ -272,30 +283,34 @@ function breeze_cache( $buffer, $flags ) {
|
|
272 |
false !== strpos( $html_a_tag, 'target' ) &&
|
273 |
false !== strpos( $html_a_tag, '_blank' )
|
274 |
) {
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
if (
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
292 |
}
|
293 |
-
$
|
294 |
-
$
|
295 |
}
|
296 |
-
|
297 |
-
$buffer = str_replace( $html_a_tag, $html_a_tag_rel, $buffer );
|
298 |
}
|
|
|
299 |
}
|
300 |
}
|
301 |
}
|
@@ -307,6 +322,7 @@ function breeze_cache( $buffer, $flags ) {
|
|
307 |
'headers' => $headers,
|
308 |
)
|
309 |
);
|
|
|
310 |
//cache per users
|
311 |
if ( is_user_logged_in() ) {
|
312 |
$current_user = wp_get_current_user();
|
@@ -327,16 +343,16 @@ function breeze_cache( $buffer, $flags ) {
|
|
327 |
// Detect devices
|
328 |
if ( $detect->isMobile() && ! $detect->isTablet() ) {
|
329 |
if ( $devices['breeze-mobile-cache'] == 1 ) {
|
330 |
-
$X1
|
331 |
$url_path .= '_breeze_cache_desktop';
|
332 |
}
|
333 |
if ( $devices['breeze-mobile-cache'] == 2 ) {
|
334 |
-
$X1
|
335 |
$url_path .= '_breeze_cache_mobile';
|
336 |
}
|
337 |
} else {
|
338 |
if ( $devices['breeze-desktop-cache'] == 1 ) {
|
339 |
-
$X1
|
340 |
$url_path .= '_breeze_cache_desktop';
|
341 |
}
|
342 |
}
|
@@ -387,7 +403,15 @@ function breeze_get_url_path() {
|
|
387 |
$host = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
|
388 |
$domain = ( ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' );
|
389 |
|
390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
}
|
392 |
|
393 |
/**
|
@@ -409,11 +433,6 @@ function breeze_serve_cache( $filename, $url_path, $X1, $opts ) {
|
|
409 |
$blog_id_requested = isset( $GLOBALS['breeze_config']['blog_id'] ) ? $GLOBALS['breeze_config']['blog_id'] : 0;
|
410 |
$path = breeze_get_cache_base_path( false, $blog_id_requested ) . md5( $url_path ) . '/' . $file_name;
|
411 |
|
412 |
-
$modified_time = 0;
|
413 |
-
if ( file_exists( $path ) ) {
|
414 |
-
$modified_time = (int) @filemtime( $path );
|
415 |
-
}
|
416 |
-
|
417 |
if ( @file_exists( $path ) ) {
|
418 |
|
419 |
$cacheFile = file_get_contents( $path );
|
112 |
$opts_config = $GLOBALS['breeze_config'];
|
113 |
$check_exclude = check_exclude_page( $opts_config, $current_url );
|
114 |
|
115 |
+
$query_instance = Breeze_Query_Strings_Rules::get_instance();
|
116 |
+
$breeze_query_vars_list = $query_instance->check_query_var_group( $current_url );
|
117 |
+
|
118 |
+
if ( false === $check_exclude && 0 !== (int) $breeze_query_vars_list['extra_query_no'] ) {
|
119 |
+
|
120 |
+
header( 'Cache-control: must-revalidate, max-age=0' );
|
121 |
+
|
122 |
+
return;
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
//load cache
|
127 |
if ( ! $check_exclude ) {
|
128 |
$devices = $opts_config['cache_options'];
|
133 |
// M for Mobile cache
|
134 |
// T for Tablet cache
|
135 |
if ( (int) $devices['breeze-mobile-cache'] == 1 ) {
|
136 |
+
$X1 = 'D';
|
137 |
$filename .= '_breeze_cache_desktop';
|
138 |
}
|
139 |
if ( (int) $devices['breeze-mobile-cache'] == 2 ) {
|
140 |
+
$X1 = 'M';
|
141 |
$filename .= '_breeze_cache_mobile';
|
142 |
}
|
143 |
} else {
|
144 |
if ( (int) $devices['breeze-desktop-cache'] == 1 ) {
|
145 |
+
$X1 = 'D';
|
146 |
$filename .= '_breeze_cache_desktop';
|
147 |
}
|
148 |
}
|
156 |
/**
|
157 |
* Cache output before it goes to the browser
|
158 |
*
|
159 |
+
* @param string $buffer
|
160 |
+
* @param int $flags
|
161 |
*
|
162 |
* @return string
|
163 |
* @since 1.0
|
249 |
// Lazy load implementation
|
250 |
if ( class_exists( 'Breeze_Lazy_Load' ) ) {
|
251 |
if ( isset( $GLOBALS['breeze_config'] ) ) {
|
252 |
+
if ( ! isset( $GLOBALS['breeze_config']['enabled-lazy-load'] ) ) {
|
253 |
+
$GLOBALS['breeze_config']['enabled-lazy-load'] = false;
|
254 |
+
}
|
255 |
|
256 |
+
if ( ! isset( $GLOBALS['breeze_config']['use-lazy-load-native'] ) ) {
|
257 |
+
$GLOBALS['breeze_config']['use-lazy-load-native'] = false;
|
258 |
+
}
|
259 |
|
260 |
$is_lazy_load_enabled = filter_var( $GLOBALS['breeze_config']['enabled-lazy-load'], FILTER_VALIDATE_BOOLEAN );
|
261 |
$is_lazy_load_native = filter_var( $GLOBALS['breeze_config']['use-lazy-load-native'], FILTER_VALIDATE_BOOLEAN );
|
283 |
false !== strpos( $html_a_tag, 'target' ) &&
|
284 |
false !== strpos( $html_a_tag, '_blank' )
|
285 |
) {
|
286 |
+
try {
|
287 |
+
$anchor_attributed = new SimpleXMLElement( $html_a_tag );
|
288 |
+
// Only apply on valid URLS.
|
289 |
+
if (
|
290 |
+
! empty( $anchor_attributed ) &&
|
291 |
+
isset( $anchor_attributed['href'] ) &&
|
292 |
+
filter_var( $anchor_attributed['href'], FILTER_VALIDATE_URL )
|
293 |
+
) {
|
294 |
+
// Apply noopener noreferrer on the A tag
|
295 |
+
$replacement_rel = 'noopener noreferrer';
|
296 |
+
$html_a_tag_replace = $html_a_tag;
|
297 |
+
if ( isset( $anchor_attributed['rel'] ) && ! empty( $anchor_attributed['rel'] ) ) {
|
298 |
+
if ( false === strpos( $anchor_attributed['rel'], 'noopener' ) && false === strpos( $anchor_attributed['rel'], 'noreferrer' ) ) {
|
299 |
+
$replacement_rel = 'noopener noreferrer';
|
300 |
+
} elseif ( false === strpos( $anchor_attributed['rel'], 'noopener' ) ) {
|
301 |
+
$replacement_rel = 'noopener';
|
302 |
+
} elseif ( false === strpos( $anchor_attributed['rel'], 'noreferrer' ) ) {
|
303 |
+
$replacement_rel = 'noreferrer';
|
304 |
+
}
|
305 |
+
$replacement_rel .= ' ' . $anchor_attributed['rel'];
|
306 |
+
$html_a_tag_replace = preg_replace( '/(<[^>]+) rel=".*?"/i', '$1', $html_a_tag );
|
307 |
}
|
308 |
+
$html_a_tag_rel = preg_replace( '/(<a\b[^><]*)>/i', '$1 rel="' . $replacement_rel . '">', $html_a_tag_replace );
|
309 |
+
$buffer = str_replace( $html_a_tag, $html_a_tag_rel, $buffer );
|
310 |
}
|
311 |
+
} catch ( exception $e ) {
|
|
|
312 |
}
|
313 |
+
|
314 |
}
|
315 |
}
|
316 |
}
|
322 |
'headers' => $headers,
|
323 |
)
|
324 |
);
|
325 |
+
|
326 |
//cache per users
|
327 |
if ( is_user_logged_in() ) {
|
328 |
$current_user = wp_get_current_user();
|
343 |
// Detect devices
|
344 |
if ( $detect->isMobile() && ! $detect->isTablet() ) {
|
345 |
if ( $devices['breeze-mobile-cache'] == 1 ) {
|
346 |
+
$X1 = 'D';
|
347 |
$url_path .= '_breeze_cache_desktop';
|
348 |
}
|
349 |
if ( $devices['breeze-mobile-cache'] == 2 ) {
|
350 |
+
$X1 = 'M';
|
351 |
$url_path .= '_breeze_cache_mobile';
|
352 |
}
|
353 |
} else {
|
354 |
if ( $devices['breeze-desktop-cache'] == 1 ) {
|
355 |
+
$X1 = 'D';
|
356 |
$url_path .= '_breeze_cache_desktop';
|
357 |
}
|
358 |
}
|
403 |
$host = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
|
404 |
$domain = ( ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' );
|
405 |
|
406 |
+
$the_url = $domain . rtrim( $host, '/' ) . $_SERVER['REQUEST_URI'];
|
407 |
+
|
408 |
+
$query_instance = Breeze_Query_Strings_Rules::get_instance();
|
409 |
+
$breeze_query_vars_list = $query_instance->check_query_var_group( $the_url );
|
410 |
+
if ( 0 !== (int) $breeze_query_vars_list['ignored_no'] ) {
|
411 |
+
$the_url = $query_instance->rebuild_url( $the_url, $breeze_query_vars_list );
|
412 |
+
}
|
413 |
+
|
414 |
+
return $the_url;
|
415 |
}
|
416 |
|
417 |
/**
|
433 |
$blog_id_requested = isset( $GLOBALS['breeze_config']['blog_id'] ) ? $GLOBALS['breeze_config']['blog_id'] : 0;
|
434 |
$path = breeze_get_cache_base_path( false, $blog_id_requested ) . md5( $url_path ) . '/' . $file_name;
|
435 |
|
|
|
|
|
|
|
|
|
|
|
436 |
if ( @file_exists( $path ) ) {
|
437 |
|
438 |
$cacheFile = file_get_contents( $path );
|
inc/class-breeze-file-permissions.php
CHANGED
@@ -182,7 +182,13 @@ class Breeze_File_Permissions {
|
|
182 |
foreach ( self::$errors as $message ) {
|
183 |
echo '<p>' . $message . '</p>';
|
184 |
}
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
echo '</div>';
|
187 |
}
|
188 |
}
|
182 |
foreach ( self::$errors as $message ) {
|
183 |
echo '<p>' . $message . '</p>';
|
184 |
}
|
185 |
+
echo '<p>';
|
186 |
+
printf(
|
187 |
+
'<a href="%s" target="_blank">%s</a>',
|
188 |
+
esc_url( 'https://support.cloudways.com/en/articles/5126387-how-can-i-reset-file-and-folder-permissions' ),
|
189 |
+
esc_html__( 'For reference please click on the KB', 'breeze' )
|
190 |
+
);
|
191 |
+
echo '</p>';
|
192 |
echo '</div>';
|
193 |
}
|
194 |
}
|
inc/class-breeze-query-strings-rules.php
ADDED
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Breeze_Query_Strings_Rules {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* List of permanently ignored query vars.
|
7 |
+
*
|
8 |
+
* @var string[]
|
9 |
+
*/
|
10 |
+
public $ignored_list = array(
|
11 |
+
'utm_source',
|
12 |
+
'utm_medium',
|
13 |
+
'utm_campaign',
|
14 |
+
'utm_expid',
|
15 |
+
'utm_term',
|
16 |
+
'utm_content',
|
17 |
+
'mtm_source',
|
18 |
+
'mtm_medium',
|
19 |
+
'mtm_campaign',
|
20 |
+
'mtm_keyword',
|
21 |
+
'mtm_cid',
|
22 |
+
'mtm_content',
|
23 |
+
'pk_source',
|
24 |
+
'pk_medium',
|
25 |
+
'pk_campaign',
|
26 |
+
'pk_keyword',
|
27 |
+
'pk_cid',
|
28 |
+
'pk_content',
|
29 |
+
'fb_action_ids',
|
30 |
+
'fb_action_types',
|
31 |
+
'fb_source',
|
32 |
+
'fbclid',
|
33 |
+
'campaignid',
|
34 |
+
'adgroupid',
|
35 |
+
'adid',
|
36 |
+
'gclid',
|
37 |
+
'age-verified',
|
38 |
+
'ao_noptimize',
|
39 |
+
'usqp',
|
40 |
+
'cn-reloaded',
|
41 |
+
'_ga',
|
42 |
+
'sscid',
|
43 |
+
'gclsrc',
|
44 |
+
'_gl',
|
45 |
+
'mc_cid',
|
46 |
+
'mc_eid',
|
47 |
+
'_bta_tid',
|
48 |
+
'_bta_c',
|
49 |
+
'trk_contact',
|
50 |
+
'trk_msg',
|
51 |
+
'trk_module',
|
52 |
+
'trk_sid',
|
53 |
+
'gdfms',
|
54 |
+
'gdftrk',
|
55 |
+
'gdffi',
|
56 |
+
'_ke',
|
57 |
+
'redirect_log_mongo_id',
|
58 |
+
'redirect_mongo_id',
|
59 |
+
'sb_referer_host',
|
60 |
+
'mkwid',
|
61 |
+
'pcrid',
|
62 |
+
'ef_id',
|
63 |
+
's_kwcid',
|
64 |
+
'msclkid',
|
65 |
+
'dm_i',
|
66 |
+
'epik',
|
67 |
+
'pp',
|
68 |
+
);
|
69 |
+
|
70 |
+
/**
|
71 |
+
* List of always cacheable query vars.
|
72 |
+
*
|
73 |
+
* @var string[]
|
74 |
+
*/
|
75 |
+
public $always_cache_query = array(
|
76 |
+
'lang',
|
77 |
+
'permalink_name',
|
78 |
+
'lp-variation-id',
|
79 |
+
);
|
80 |
+
|
81 |
+
// Hold the class instance.
|
82 |
+
private static $instance = null;
|
83 |
+
|
84 |
+
function __construct() {
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
public static function get_instance() {
|
89 |
+
if ( self::$instance == null ) {
|
90 |
+
self::$instance = new Breeze_Query_Strings_Rules();
|
91 |
+
}
|
92 |
+
|
93 |
+
return self::$instance;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function fetch_ignored_list() {
|
97 |
+
$this->ignored_list = apply_filters( 'breeze_ignored_query_strings_list', $this->ignored_list );
|
98 |
+
|
99 |
+
return $this->ignored_list;
|
100 |
+
}
|
101 |
+
|
102 |
+
public static function when_woocommerce_settings_save() {
|
103 |
+
if ( isset( $_POST['save'] ) && isset( $_POST['woocommerce_default_customer_address'] ) ) {
|
104 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
public function fetch_always_cache_list() {
|
109 |
+
$this->always_cache_query = apply_filters( 'breeze_always_cache_query_strings', $this->always_cache_query );
|
110 |
+
|
111 |
+
// woocommerce_geolocation_ajax
|
112 |
+
if ( isset( $GLOBALS['breeze_config']['woocommerce_geolocation_ajax'] ) && 1 === (int) $GLOBALS['breeze_config']['woocommerce_geolocation_ajax'] ) {
|
113 |
+
$this->always_cache_query[] = 'v';
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( isset( $GLOBALS['breeze_config'] ) && isset( $GLOBALS['breeze_config']['permalink_structure'] ) ) {
|
117 |
+
$get_permalink_structure = $GLOBALS['breeze_config']['permalink_structure'];
|
118 |
+
if ( is_array( $get_permalink_structure ) ) {
|
119 |
+
// since it's using the default breeze-config.
|
120 |
+
$this->always_cache_query[] = 'p';
|
121 |
+
$this->always_cache_query[] = 'page_id';
|
122 |
+
$this->always_cache_query[] = 'postname';
|
123 |
+
$this->always_cache_query[] = 'cat';
|
124 |
+
$this->always_cache_query[] = 'attachment_id';
|
125 |
+
$this->always_cache_query[] = 'author';
|
126 |
+
$this->always_cache_query[] = 'author_name';
|
127 |
+
$this->always_cache_query[] = 'calendar';
|
128 |
+
$this->always_cache_query[] = 'second';
|
129 |
+
$this->always_cache_query[] = 'minute';
|
130 |
+
$this->always_cache_query[] = 'hour';
|
131 |
+
$this->always_cache_query[] = 'day';
|
132 |
+
$this->always_cache_query[] = 'monthnum';
|
133 |
+
$this->always_cache_query[] = 'year';
|
134 |
+
$this->always_cache_query[] = 'page';
|
135 |
+
$this->always_cache_query[] = 'paged';
|
136 |
+
$this->always_cache_query[] = 'category';
|
137 |
+
$this->always_cache_query[] = 'taxonomy';
|
138 |
+
$this->always_cache_query[] = 'tag';
|
139 |
+
$this->always_cache_query[] = 'tag_id';
|
140 |
+
$this->always_cache_query[] = 'withcomments';
|
141 |
+
$this->always_cache_query[] = 'withoutcomments';
|
142 |
+
$this->always_cache_query[] = 'm';
|
143 |
+
} else {
|
144 |
+
if ( empty( trim( $get_permalink_structure ) ) ) {
|
145 |
+
$this->always_cache_query[] = 'p';
|
146 |
+
$this->always_cache_query[] = 'page_id';
|
147 |
+
$this->always_cache_query[] = 'postname';
|
148 |
+
$this->always_cache_query[] = 'cat';
|
149 |
+
$this->always_cache_query[] = 'attachment_id';
|
150 |
+
$this->always_cache_query[] = 'author';
|
151 |
+
$this->always_cache_query[] = 'author_name';
|
152 |
+
$this->always_cache_query[] = 'calendar';
|
153 |
+
$this->always_cache_query[] = 'second';
|
154 |
+
$this->always_cache_query[] = 'minute';
|
155 |
+
$this->always_cache_query[] = 'hour';
|
156 |
+
$this->always_cache_query[] = 'day';
|
157 |
+
$this->always_cache_query[] = 'monthnum';
|
158 |
+
$this->always_cache_query[] = 'year';
|
159 |
+
$this->always_cache_query[] = 'page';
|
160 |
+
$this->always_cache_query[] = 'paged';
|
161 |
+
$this->always_cache_query[] = 'category';
|
162 |
+
$this->always_cache_query[] = 'taxonomy';
|
163 |
+
$this->always_cache_query[] = 'tag';
|
164 |
+
$this->always_cache_query[] = 'tag_id';
|
165 |
+
$this->always_cache_query[] = 'withcomments';
|
166 |
+
$this->always_cache_query[] = 'withoutcomments';
|
167 |
+
$this->always_cache_query[] = 'm';
|
168 |
+
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
return $this->always_cache_query;
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Validates if a link containing query string(s) should be cached or not.
|
179 |
+
*
|
180 |
+
* @return bool
|
181 |
+
* @since 1.2.4
|
182 |
+
*/
|
183 |
+
function breeze_is_query_string_ignore() {
|
184 |
+
$always_cache_query = $this->fetch_always_cache_list();
|
185 |
+
|
186 |
+
$current_url_query = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
|
187 |
+
parse_str( $current_url_query, $breeze_query_output );
|
188 |
+
|
189 |
+
if ( 'GET' === $_SERVER['REQUEST_METHOD'] && ! empty( $current_url_query ) ) {
|
190 |
+
$cache_page = true;
|
191 |
+
// If the URL contains query string that needs caching.
|
192 |
+
foreach ( $always_cache_query as $query_string ) {
|
193 |
+
if ( array_key_exists( $query_string, $breeze_query_output ) ) {
|
194 |
+
$cache_page = false;
|
195 |
+
break;
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
199 |
+
if ( false === $cache_page ) {
|
200 |
+
return false;
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
// IF user defines query strings that can be cached.
|
205 |
+
if (
|
206 |
+
isset( $GLOBALS['breeze_config'], $GLOBALS['breeze_config']['cached-query-strings'] ) &&
|
207 |
+
! empty( $GLOBALS['breeze_config']['cached-query-strings'] ) &&
|
208 |
+
is_array( $GLOBALS['breeze_config']['cached-query-strings'] )
|
209 |
+
) {
|
210 |
+
foreach ( $GLOBALS['breeze_config']['cached-query-strings'] as $query_string ) {
|
211 |
+
if ( array_key_exists( $query_string, $breeze_query_output ) ) {
|
212 |
+
$cache_page = false;
|
213 |
+
break;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( false === $cache_page ) {
|
218 |
+
return false;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
return true;
|
223 |
+
}
|
224 |
+
|
225 |
+
return false;
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Checks if the current URL contains ignored query strings.
|
230 |
+
*
|
231 |
+
* @param string $url Current URL.
|
232 |
+
*
|
233 |
+
* @return bool
|
234 |
+
*/
|
235 |
+
public function breeze_ignored_query_strings( $url = '' ) {
|
236 |
+
if ( empty( trim( $url ) ) ) {
|
237 |
+
$url = $_SERVER['REQUEST_URI'];
|
238 |
+
}
|
239 |
+
|
240 |
+
if ( 'GET' !== $_SERVER['REQUEST_METHOD'] ) {
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
$ignored_list = $this->fetch_ignored_list();
|
245 |
+
|
246 |
+
$current_url_query = parse_url( $url, PHP_URL_QUERY );
|
247 |
+
parse_str( $current_url_query, $breeze_query_output );
|
248 |
+
|
249 |
+
$found_index = false;
|
250 |
+
foreach ( $breeze_query_output as $index => $value ) {
|
251 |
+
$index = mb_strtolower( trim( $index ) );
|
252 |
+
if ( in_array( $index, $ignored_list, true ) ) {
|
253 |
+
$found_index = true;
|
254 |
+
break;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
return $found_index;
|
259 |
+
}
|
260 |
+
|
261 |
+
public function extract_query_strings( $url = '' ) {
|
262 |
+
if ( empty( trim( $url ) ) ) {
|
263 |
+
$url = $_SERVER['REQUEST_URI'];
|
264 |
+
}
|
265 |
+
|
266 |
+
$current_url_query = parse_url( $url, PHP_URL_QUERY );
|
267 |
+
parse_str( $current_url_query, $breeze_query_output );
|
268 |
+
|
269 |
+
return $breeze_query_output;
|
270 |
+
}
|
271 |
+
|
272 |
+
public function check_query_var_group( $current_url = '' ) {
|
273 |
+
|
274 |
+
if ( empty( trim( $current_url ) ) ) {
|
275 |
+
$current_url = $_SERVER['REQUEST_URI'];
|
276 |
+
}
|
277 |
+
|
278 |
+
$found_items = array(
|
279 |
+
'ignored_no' => 0, // how many vars from ignore list are found.
|
280 |
+
'ignored_items' => array(), // which items were found in ignore list.
|
281 |
+
'cached_no' => 0, // query vars that need to be cached.
|
282 |
+
'cached_items' => array(), // which items were found in to cache list.
|
283 |
+
'user_cached_no' => 0, // query vars that need to be cached, these are defined by the user in back-end.
|
284 |
+
'user_cached_items' => array(), // which items were found in to cache list, these are defined by the user in back-end.
|
285 |
+
'extra_query_no' => 0, // number of query vars not found in any list.
|
286 |
+
'extra_query_vars' => array(), // list of query vars not found in any list.
|
287 |
+
);
|
288 |
+
|
289 |
+
// Only process links if the request is GET.
|
290 |
+
if ( 'GET' !== $_SERVER['REQUEST_METHOD'] || empty( $current_url ) ) {
|
291 |
+
return $found_items;
|
292 |
+
}
|
293 |
+
|
294 |
+
$ignored_query_vars = $this->fetch_ignored_list();
|
295 |
+
$to_cache_query_vars = $this->fetch_always_cache_list();
|
296 |
+
$user_defined_query_vars = array();
|
297 |
+
|
298 |
+
// Current URL query strings ( vars ).
|
299 |
+
$extracted_vars = $this->extract_query_strings( $current_url );
|
300 |
+
// Query strings that are not found anywhere.
|
301 |
+
$not_found_anywhere = $extracted_vars;
|
302 |
+
|
303 |
+
|
304 |
+
if (
|
305 |
+
isset( $GLOBALS['breeze_config'], $GLOBALS['breeze_config']['cached-query-strings'] ) &&
|
306 |
+
! empty( $GLOBALS['breeze_config']['cached-query-strings'] ) &&
|
307 |
+
is_array( $GLOBALS['breeze_config']['cached-query-strings'] )
|
308 |
+
) {
|
309 |
+
$user_defined_query_vars = $GLOBALS['breeze_config']['cached-query-strings'];
|
310 |
+
if ( is_array( $user_defined_query_vars ) ) {
|
311 |
+
foreach ( $user_defined_query_vars as $index => $value ) {
|
312 |
+
if ( 's' === $value ) {
|
313 |
+
unset( $user_defined_query_vars[ $index ] );
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
foreach ( $extracted_vars as $index => $value ) {
|
321 |
+
$index = mb_strtolower( trim( $index ) );
|
322 |
+
|
323 |
+
// Fetch all the query vars that are in the ignore list and found in current URL.
|
324 |
+
if ( in_array( $index, $ignored_query_vars, true ) ) {
|
325 |
+
$found_items['ignored_no'] ++;
|
326 |
+
$found_items['ignored_items'][ $index ] = $value;
|
327 |
+
unset( $not_found_anywhere[ $index ] );
|
328 |
+
}
|
329 |
+
|
330 |
+
// Fetch all the query vars that are in the must cache list and found in current URL.
|
331 |
+
if ( in_array( $index, $to_cache_query_vars, true ) ) {
|
332 |
+
$found_items['cached_no'] ++;
|
333 |
+
$found_items['cached_items'][ $index ] = $value;
|
334 |
+
unset( $not_found_anywhere[ $index ] );
|
335 |
+
}
|
336 |
+
|
337 |
+
// Fetch all the query vars that are in the must cache list and found in current URL, user defined.
|
338 |
+
if ( in_array( $index, $user_defined_query_vars, true ) ) {
|
339 |
+
$found_items['user_cached_no'] ++;
|
340 |
+
$found_items['user_cached_items'][ $index ] = $value;
|
341 |
+
unset( $not_found_anywhere[ $index ] );
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
$found_items['extra_query_no'] = count( $not_found_anywhere );
|
346 |
+
$found_items['extra_query_vars'] = $not_found_anywhere;
|
347 |
+
|
348 |
+
return $found_items;
|
349 |
+
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Rebuild the URL without the ignored query strings.
|
354 |
+
*/
|
355 |
+
public function rebuild_url( $url = '', $query_vars = array() ) {
|
356 |
+
|
357 |
+
// if there are any query vars not found in any lists, we send the same link back.
|
358 |
+
// This URL will not be cached.
|
359 |
+
if ( 0 !== (int) $query_vars['extra_query_no'] ) {
|
360 |
+
return $url;
|
361 |
+
}
|
362 |
+
|
363 |
+
if ( false !== strpos( $url, '?' ) ) {
|
364 |
+
$e = explode( '?', $url );
|
365 |
+
$result = array_merge( $query_vars['cached_items'], $query_vars['user_cached_items'] );
|
366 |
+
$url = rtrim( $e[0], '/\\' ) . '/' . ( ( ! empty( $result ) ) ? '?' . http_build_query( $result ) : '' );
|
367 |
+
}
|
368 |
+
|
369 |
+
return $url;
|
370 |
+
|
371 |
+
}
|
372 |
+
|
373 |
+
}
|
374 |
+
|
375 |
+
new Breeze_Query_Strings_Rules();
|
inc/functions.php
CHANGED
@@ -18,6 +18,9 @@
|
|
18 |
*/
|
19 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
20 |
|
|
|
|
|
|
|
21 |
/**
|
22 |
* Get base path for the page cache directory.
|
23 |
*
|
18 |
*/
|
19 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
20 |
|
21 |
+
define( 'BREEZE_PLUGIN_FULL_PATH', dirname( __DIR__ ) . '/' );
|
22 |
+
require_once BREEZE_PLUGIN_FULL_PATH . 'inc/class-breeze-query-strings-rules.php';
|
23 |
+
|
24 |
/**
|
25 |
* Get base path for the page cache directory.
|
26 |
*
|
inc/minification/breeze-js-deferred-loading.php
CHANGED
@@ -235,8 +235,8 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
235 |
if ( ! empty( $this->move_to_footer_js ) ) {
|
236 |
foreach ( $this->move_to_footer_js as $index => $key ) {
|
237 |
$cdn_array_move_to_footer[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
238 |
-
$index
|
239 |
-
$key
|
240 |
$cdn_array_move_to_footer[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
241 |
}
|
242 |
}
|
@@ -334,6 +334,8 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
334 |
$tag = '';
|
335 |
}
|
336 |
}
|
|
|
|
|
337 |
} else {
|
338 |
if ( breeze_validate_url_via_regexp( $url ) ) {
|
339 |
|
@@ -347,10 +349,12 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
347 |
} else {
|
348 |
$this->footer_scripts[ $url ] = $url;
|
349 |
}
|
|
|
|
|
|
|
350 |
}
|
351 |
}
|
352 |
-
|
353 |
-
$content = str_replace( $tag, '', $content );
|
354 |
} else {
|
355 |
|
356 |
$is_delayed = $this->is_inline_delay( $tag );
|
@@ -411,8 +415,8 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
411 |
if ( ! empty( $this->cdn_url ) ) {
|
412 |
foreach ( $this->defer_js as $index => $key ) {
|
413 |
$this->defer_js[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
414 |
-
$index
|
415 |
-
$key
|
416 |
$this->defer_js[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
417 |
}
|
418 |
} else {
|
@@ -492,7 +496,7 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
492 |
|
493 |
$js_head[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
494 |
}
|
495 |
-
$js_replacement
|
496 |
$js_replacement .= implode( '', $js_head );
|
497 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
498 |
}
|
@@ -522,7 +526,7 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
522 |
|
523 |
$js_footer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
524 |
}
|
525 |
-
$js_replacement
|
526 |
$js_replacement .= implode( '', $js_footer );
|
527 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
528 |
}
|
235 |
if ( ! empty( $this->move_to_footer_js ) ) {
|
236 |
foreach ( $this->move_to_footer_js as $index => $key ) {
|
237 |
$cdn_array_move_to_footer[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
238 |
+
$index = ltrim( $index, 'https:' );
|
239 |
+
$key = ltrim( $key, 'https:' );
|
240 |
$cdn_array_move_to_footer[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
241 |
}
|
242 |
}
|
334 |
$tag = '';
|
335 |
}
|
336 |
}
|
337 |
+
//Remove the original script tag
|
338 |
+
$content = str_replace( $tag, '', $content );
|
339 |
} else {
|
340 |
if ( breeze_validate_url_via_regexp( $url ) ) {
|
341 |
|
349 |
} else {
|
350 |
$this->footer_scripts[ $url ] = $url;
|
351 |
}
|
352 |
+
|
353 |
+
//Remove the original script tag
|
354 |
+
$content = str_replace( $tag, '', $content );
|
355 |
}
|
356 |
}
|
357 |
+
|
|
|
358 |
} else {
|
359 |
|
360 |
$is_delayed = $this->is_inline_delay( $tag );
|
415 |
if ( ! empty( $this->cdn_url ) ) {
|
416 |
foreach ( $this->defer_js as $index => $key ) {
|
417 |
$this->defer_js[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
418 |
+
$index = ltrim( $index, 'https:' );
|
419 |
+
$key = ltrim( $key, 'https:' );
|
420 |
$this->defer_js[ $this->url_replace_cdn( $index ) ] = $this->url_replace_cdn( $key );
|
421 |
}
|
422 |
} else {
|
496 |
|
497 |
$js_head[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
498 |
}
|
499 |
+
$js_replacement = '';
|
500 |
$js_replacement .= implode( '', $js_head );
|
501 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
502 |
}
|
526 |
|
527 |
$js_footer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
528 |
}
|
529 |
+
$js_replacement = '';
|
530 |
$js_replacement .= implode( '', $js_footer );
|
531 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
532 |
}
|
inc/minification/breeze-minify-main.php
CHANGED
@@ -86,7 +86,10 @@ class Breeze_Minify {
|
|
86 |
}
|
87 |
// filter you can use to block autoptimization on your own terms
|
88 |
$ao_noptimize = (bool) apply_filters( 'breeze_filter_noptimize', $ao_noptimize );
|
89 |
-
if
|
|
|
|
|
|
|
90 |
// Config element
|
91 |
$conf = breeze_get_option( 'basic_settings' );
|
92 |
$config_advanced = breeze_get_option( 'advanced_settings' );
|
86 |
}
|
87 |
// filter you can use to block autoptimization on your own terms
|
88 |
$ao_noptimize = (bool) apply_filters( 'breeze_filter_noptimize', $ao_noptimize );
|
89 |
+
// if the link contains query string, we must ignore it from cache.
|
90 |
+
$query_instance = Breeze_Query_Strings_Rules::get_instance();
|
91 |
+
$breeze_query_vars_list = $query_instance->check_query_var_group();
|
92 |
+
if ( ! is_feed() && ! $ao_noptimize && ! is_admin() && 0 === (int) $breeze_query_vars_list['extra_query_no'] ) {
|
93 |
// Config element
|
94 |
$conf = breeze_get_option( 'basic_settings' );
|
95 |
$config_advanced = breeze_get_option( 'advanced_settings' );
|
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.8
|
6 |
-
Stable tag: 1.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -145,6 +145,16 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
|
|
145 |
|
146 |
== Changelog ==
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 1.2.4 =
|
149 |
|
150 |
|
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.8
|
6 |
+
Stable tag: 1.2.5
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
+
= 1.2.5 =
|
149 |
+
|
150 |
+
|
151 |
+
* Add: URLs containing query strings will not be cached by default.
|
152 |
+
* Add: Ignore specific query strings while serving the cache to improve performance.
|
153 |
+
* Add: Ability to cache URLs with specific query strings variables.
|
154 |
+
* Add: Cache handling of URLs having multiple parameters in one query string.
|
155 |
+
* Add: Exceptional Cache handling for case where permalink is set to PLAIN, which includes links for POST, PAGES, ATTACHMENTS, CATEGORIES, ARCHIVES.
|
156 |
+
|
157 |
+
|
158 |
= 1.2.4 =
|
159 |
|
160 |
|
views/tabs/advanced.php
CHANGED
@@ -419,6 +419,30 @@ $js_inline_enable = filter_var( $advanced['breeze-enable-js-delay'], FILTER_VALI
|
|
419 |
</span>
|
420 |
</span>
|
421 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
</td>
|
423 |
</tr>
|
424 |
</table>
|
419 |
</span>
|
420 |
</span>
|
421 |
</div>
|
422 |
+
</td>
|
423 |
+
</tr>
|
424 |
+
<tr>
|
425 |
+
<td>
|
426 |
+
<label for="cache-query-str" class="breeze_tool_tip"><?php _e( 'Cache query strings', 'breeze' ); ?></label>
|
427 |
+
</td>
|
428 |
+
<td>
|
429 |
+
<?php
|
430 |
+
$cached_query_strings = '';
|
431 |
+
if ( isset( $advanced['cached-query-strings'] ) && ! empty( $advanced['cached-query-strings'] ) ) {
|
432 |
+
$output = implode( "\n", $advanced['cached-query-strings'] );
|
433 |
+
$cached_query_strings = esc_textarea( $output );
|
434 |
+
}
|
435 |
+
|
436 |
+
?>
|
437 |
+
<textarea cols="100" rows="7" id="cache-query-str" name="cache-query-str"><?php echo $cached_query_strings; ?></textarea>
|
438 |
+
<br/>
|
439 |
+
<span class="breeze_tool_tip">
|
440 |
+
<strong>Note: </strong> <br/>
|
441 |
+
<span>
|
442 |
+
<?php _e( 'Pages that contain the query strings added here, will be cached. Each entry must be added in a new line.', 'breeze' ); ?>
|
443 |
+
</span>
|
444 |
+
</span>
|
445 |
+
|
446 |
</td>
|
447 |
</tr>
|
448 |
</table>
|