Version Description
Update Breeze through WordPress Admin > Dashboard >Updates. The settings will remain intact after the update.
Download this release
Release Info
Developer | adeelkhan |
Plugin | Breeze – WordPress Cache Plugin |
Version | 2.0.10 |
Comparing to | |
See all releases |
Code changes from version 2.0.9 to 2.0.10
- assets/css/breeze-admin.css +72 -1
- assets/images/comments_duplicate_meta.png +0 -0
- assets/images/comments_orphan_meta.png +0 -0
- assets/images/comments_unapproved.png +0 -0
- assets/images/dbsummary-active.png +0 -0
- assets/images/dbsummary.png +0 -0
- assets/images/duplicated_post_meta.png +0 -0
- assets/images/duplicated_term_meta.png +0 -0
- assets/images/duplicated_user_meta.png +0 -0
- assets/images/oembed_cache.png +0 -0
- assets/images/optimize_database.png +0 -0
- assets/images/orphan_post_meta.png +0 -0
- assets/images/orphan_term_meta.png +0 -0
- assets/images/orphan_user_meta.png +0 -0
- assets/js/breeze-main.js +73 -33
- assets/js/breeze-main.min.js +2 -3
- assets/js/js-front-end/breeze-lazy-load.min.js +2 -3
- assets/js/js-front-end/breeze-prefetch-links.min.js +2 -3
- breeze.php +27 -2
- composer.lock +0 -150
- inc/breeze-admin.php +194 -0
- inc/breeze-configuration.php +590 -20
- inc/cache/execute-cache.php +54 -38
- inc/cache/purge-cache.php +5 -1
- inc/helpers/class-breeze-db-summary-table.php +115 -0
- inc/minification/breeze-minification-scripts.php +8 -0
- inc/minification/breeze-minification-styles.php +39 -0
- inc/wp-cli/class-breeze-wp-cli-core.php +37 -0
- readme.txt +8 -1
- views/breeze-setting-views.php +3 -0
- views/option-tabs/database-tab.php +223 -40
- views/option-tabs/dbsummary-tab.php +48 -0
- views/option-tabs/file-tab.php +29 -29
- views/option-tabs/tools-tab.php +1 -0
assets/css/breeze-admin.css
CHANGED
@@ -1115,7 +1115,7 @@ body {
|
|
1115 |
.breeze-box .br-db-boxes {
|
1116 |
display: grid;
|
1117 |
margin-top: 40px;
|
1118 |
-
margin-bottom:
|
1119 |
grid-template-columns: repeat(auto-fill, minmax(33%, 1fr));
|
1120 |
}
|
1121 |
@media only screen and (max-width: 1164px) {
|
@@ -1304,4 +1304,75 @@ span.br-important {
|
|
1304 |
margin: auto;
|
1305 |
background-color: #fcfcfdb8;
|
1306 |
position: absolute;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1307 |
}
|
1115 |
.breeze-box .br-db-boxes {
|
1116 |
display: grid;
|
1117 |
margin-top: 40px;
|
1118 |
+
margin-bottom: 50px;
|
1119 |
grid-template-columns: repeat(auto-fill, minmax(33%, 1fr));
|
1120 |
}
|
1121 |
@media only screen and (max-width: 1164px) {
|
1304 |
margin: auto;
|
1305 |
background-color: #fcfcfdb8;
|
1306 |
position: absolute;
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
/* Database Summary Table */
|
1310 |
+
#dbsummary-content .db-summary-count,
|
1311 |
+
#dbsummary-content .db-summary-size {
|
1312 |
+
margin: 0;
|
1313 |
+
}
|
1314 |
+
#dbsummary-content .db-summary-count.critical,
|
1315 |
+
#dbsummary-content .db-summary-size.critical {
|
1316 |
+
color: #ff2222;
|
1317 |
+
}
|
1318 |
+
@media only screen and (max-width: 782px) {
|
1319 |
+
#dbsummary-content .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary::before {
|
1320 |
+
position: absolute;
|
1321 |
+
left: 10px;
|
1322 |
+
display: block;
|
1323 |
+
overflow: hidden;
|
1324 |
+
width: 32%;
|
1325 |
+
content: attr(data-colname);
|
1326 |
+
white-space: nowrap;
|
1327 |
+
text-overflow: ellipsis;
|
1328 |
+
}
|
1329 |
+
}
|
1330 |
+
@media only screen and (max-width: 782px) {
|
1331 |
+
#dbsummary-content .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary {
|
1332 |
+
padding: 3px 8px 3px 35%;
|
1333 |
+
}
|
1334 |
+
}
|
1335 |
+
@media only screen and (max-width: 500px) {
|
1336 |
+
#dbsummary-content .wp-list-table thead th.column-primary {
|
1337 |
+
display: none;
|
1338 |
+
}
|
1339 |
+
}
|
1340 |
+
#dbsummary-content thead tr th#number {
|
1341 |
+
position: relative;
|
1342 |
+
}
|
1343 |
+
@media only screen and (max-width: 500px) {
|
1344 |
+
#dbsummary-content thead tr th#number:before {
|
1345 |
+
position: absolute;
|
1346 |
+
left: 20px;
|
1347 |
+
display: block;
|
1348 |
+
overflow: hidden;
|
1349 |
+
width: 32%;
|
1350 |
+
content: "Summary";
|
1351 |
+
white-space: nowrap;
|
1352 |
+
text-overflow: ellipsis;
|
1353 |
+
}
|
1354 |
+
}
|
1355 |
+
#dbsummary-content .wp-list-table {
|
1356 |
+
width: 30%;
|
1357 |
+
min-width: 350px;
|
1358 |
+
}
|
1359 |
+
@media only screen and (max-width: 500px) {
|
1360 |
+
#dbsummary-content .wp-list-table {
|
1361 |
+
width: 100%;
|
1362 |
+
min-width: 100%;
|
1363 |
+
}
|
1364 |
+
}
|
1365 |
+
#dbsummary-content .wp-list-table #table_size {
|
1366 |
+
width: 80px;
|
1367 |
+
}
|
1368 |
+
#dbsummary-content .wp-list-table #number,
|
1369 |
+
#dbsummary-content .wp-list-table td.number {
|
1370 |
+
width: 16px;
|
1371 |
+
text-align: center;
|
1372 |
+
}
|
1373 |
+
@media only screen and (max-width: 782px) {
|
1374 |
+
#dbsummary-content .wp-list-table #number,
|
1375 |
+
#dbsummary-content .wp-list-table td.number {
|
1376 |
+
text-align: left;
|
1377 |
+
}
|
1378 |
}
|
assets/images/comments_duplicate_meta.png
ADDED
Binary file
|
assets/images/comments_orphan_meta.png
ADDED
Binary file
|
assets/images/comments_unapproved.png
ADDED
Binary file
|
assets/images/dbsummary-active.png
ADDED
Binary file
|
assets/images/dbsummary.png
ADDED
Binary file
|
assets/images/duplicated_post_meta.png
ADDED
Binary file
|
assets/images/duplicated_term_meta.png
ADDED
Binary file
|
assets/images/duplicated_user_meta.png
ADDED
Binary file
|
assets/images/oembed_cache.png
ADDED
Binary file
|
assets/images/optimize_database.png
ADDED
Binary file
|
assets/images/orphan_post_meta.png
ADDED
Binary file
|
assets/images/orphan_term_meta.png
ADDED
Binary file
|
assets/images/orphan_user_meta.png
ADDED
Binary file
|
assets/js/breeze-main.js
CHANGED
@@ -59,6 +59,21 @@ jQuery( document ).ready(
|
|
59 |
}
|
60 |
);
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
var purge_action = true;
|
63 |
// Varnish clear button
|
64 |
$( '.breeze-box' ).on(
|
@@ -104,7 +119,7 @@ jQuery( document ).ready(
|
|
104 |
|
105 |
} else {
|
106 |
window.location.href = current + "breeze-msg=purge-fail";
|
107 |
-
purge_action
|
108 |
location.reload();
|
109 |
}
|
110 |
}
|
@@ -112,6 +127,31 @@ jQuery( document ).ready(
|
|
112 |
);
|
113 |
}
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
//clear cache by button
|
116 |
function breeze_purgeVarnish_callAjax() {
|
117 |
$.ajax(
|
@@ -140,7 +180,7 @@ jQuery( document ).ready(
|
|
140 |
|
141 |
} else {
|
142 |
window.location.href = current + "breeze-msg=purge-fail";
|
143 |
-
purge_action
|
144 |
location.reload();
|
145 |
}
|
146 |
}
|
@@ -159,9 +199,9 @@ jQuery( document ).ready(
|
|
159 |
security: breeze_token_name.breeze_purge_cache
|
160 |
},
|
161 |
success: function ( res ) {
|
162 |
-
current
|
163 |
-
res
|
164 |
-
var fileClean
|
165 |
window.location.href = current + "#breeze-msg=success-cleancache&file=" + res;
|
166 |
//location.reload();
|
167 |
if ( fileClean > 0 ) {
|
@@ -178,22 +218,22 @@ jQuery( document ).ready(
|
|
178 |
}
|
179 |
|
180 |
function getParameterByName( name, url ) {
|
181 |
-
if ( !
|
182 |
url = window.location.href;
|
183 |
}
|
184 |
-
name
|
185 |
-
var regex
|
186 |
results = regex.exec( url );
|
187 |
-
if ( !
|
188 |
return null;
|
189 |
}
|
190 |
-
if ( !
|
191 |
return '';
|
192 |
}
|
193 |
return decodeURIComponent( results[ 2 ].replace( /\+/g, " " ) );
|
194 |
}
|
195 |
|
196 |
-
var url
|
197 |
var fileClean = parseFloat( getParameterByName( 'file', url ) );
|
198 |
|
199 |
$( window ).on(
|
@@ -203,7 +243,7 @@ jQuery( document ).ready(
|
|
203 |
if ( patt.test( url ) ) {
|
204 |
//backend
|
205 |
var div = '';
|
206 |
-
if ( url.indexOf( "msg=success-cleancache" ) > 0 && !
|
207 |
if ( fileClean > 0 ) {
|
208 |
div = '<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: ' + fileClean + 'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>';
|
209 |
} else {
|
@@ -252,7 +292,7 @@ jQuery( document ).ready(
|
|
252 |
'#bz-lazy-load',
|
253 |
function () {
|
254 |
|
255 |
-
var native_lazy
|
256 |
var native_lazy_iframes = $( '#native-lazy-option-iframe' );
|
257 |
if ( true === $( this ).is( ':checked' ) ) {
|
258 |
native_lazy.show();
|
@@ -283,20 +323,20 @@ jQuery( document ).ready(
|
|
283 |
'#minification-css',
|
284 |
function () {
|
285 |
var font_display_swap = $( '#font-display-swap' );
|
286 |
-
var font_display
|
287 |
|
288 |
var include_inline_css = $( '#include-inline-css' );
|
289 |
-
var group_css
|
290 |
-
var minification_css
|
291 |
|
292 |
if ( $( this ).is( ':checked' ) ) {
|
293 |
font_display_swap.show();
|
294 |
//include_inline_css.removeAttr( 'disabled' );
|
295 |
//group_css.removeAttr( 'disabled' );
|
296 |
|
297 |
-
minification_css.closest('div.br-option-item').removeClass('br-apply-disable');
|
298 |
-
group_css.closest('div.br-option-item').removeClass('br-apply-disable');
|
299 |
-
include_inline_css.closest('div.br-option-item').removeClass('br-apply-disable');
|
300 |
} else {
|
301 |
font_display_swap.hide();
|
302 |
font_display.removeAttr( 'checked' );
|
@@ -305,9 +345,9 @@ jQuery( document ).ready(
|
|
305 |
include_inline_css.prop( 'checked', false );
|
306 |
group_css.prop( 'checked', false );
|
307 |
|
308 |
-
minification_css.closest('div.br-option-item').addClass('br-apply-disable');
|
309 |
-
group_css.closest('div.br-option-item').addClass('br-apply-disable');
|
310 |
-
include_inline_css.closest('div.br-option-item').addClass('br-apply-disable');
|
311 |
}
|
312 |
}
|
313 |
);
|
@@ -318,16 +358,16 @@ jQuery( document ).ready(
|
|
318 |
function () {
|
319 |
|
320 |
var include_inline_js = $( '#include-inline-js' );
|
321 |
-
var group_js
|
322 |
-
var exclude_js
|
323 |
|
324 |
if ( $( this ).is( ':checked' ) ) {
|
325 |
//include_inline_js.removeAttr( 'disabled' );
|
326 |
//group_js.removeAttr( 'disabled' );
|
327 |
|
328 |
-
exclude_js.closest('div.br-option-item').removeClass('br-apply-disable');
|
329 |
-
group_js.closest('div.br-option-item').removeClass('br-apply-disable');
|
330 |
-
include_inline_js.closest('div.br-option-item').removeClass('br-apply-disable');
|
331 |
} else {
|
332 |
//include_inline_js.removeAttr( 'checked' ).attr( 'disabled', 'disabled' );
|
333 |
//group_js.removeAttr( 'checked' ).attr( 'disabled', 'disabled' );
|
@@ -335,9 +375,9 @@ jQuery( document ).ready(
|
|
335 |
group_js.prop( 'checked', false );
|
336 |
|
337 |
|
338 |
-
exclude_js.closest('div.br-option-item').addClass('br-apply-disable');
|
339 |
-
group_js.closest('div.br-option-item').addClass('br-apply-disable');
|
340 |
-
include_inline_js.closest('div.br-option-item').addClass('br-apply-disable');
|
341 |
}
|
342 |
}
|
343 |
);
|
@@ -354,7 +394,7 @@ jQuery( document ).ready(
|
|
354 |
$( 'input[name="enable-js-delay"]' ).prop( 'checked', false );
|
355 |
$( '#breeze-delay-js-scripts-div' ).hide();
|
356 |
$enable_inline_delay.attr( 'disabled', 'disabled' );
|
357 |
-
} else {
|
358 |
$delay_js_div_all.hide();
|
359 |
$enable_inline_delay.removeAttr( 'disabled' );
|
360 |
}
|
@@ -366,7 +406,7 @@ jQuery( document ).ready(
|
|
366 |
'#enable-js-delay',
|
367 |
function () {
|
368 |
var $delay_js_div = $( '#breeze-delay-js-scripts-div' );
|
369 |
-
var $delay_all_js = $('#breeze-delay-all-js');
|
370 |
|
371 |
if ( $( this ).is( ':checked' ) ) {
|
372 |
$delay_js_div.show();
|
@@ -797,7 +837,7 @@ jQuery( document ).ready(
|
|
797 |
breeze_data.append( 'network_level', network );
|
798 |
breeze_data.append( 'breeze_import_file', the_file );
|
799 |
breeze_data.append( 'security', breeze_token_name.breeze_import_settings );
|
800 |
-
|
801 |
var filename_holder = $( '#file-selected' );
|
802 |
var filename_error = $( '#file-error' );
|
803 |
var import_settings = '<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>';
|
59 |
}
|
60 |
);
|
61 |
|
62 |
+
// Reset Default
|
63 |
+
$( document ).on(
|
64 |
+
'click',
|
65 |
+
'#breeze_reset_default',
|
66 |
+
function ( e ) {
|
67 |
+
e.preventDefault();
|
68 |
+
|
69 |
+
reset_confirm = confirm("Want to reset breeze settings?");
|
70 |
+
|
71 |
+
if ( reset_confirm ) {
|
72 |
+
breeze_reset_default();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
);
|
76 |
+
|
77 |
var purge_action = true;
|
78 |
// Varnish clear button
|
79 |
$( '.breeze-box' ).on(
|
119 |
|
120 |
} else {
|
121 |
window.location.href = current + "breeze-msg=purge-fail";
|
122 |
+
purge_action = true;
|
123 |
location.reload();
|
124 |
}
|
125 |
}
|
127 |
);
|
128 |
}
|
129 |
|
130 |
+
//reset to default
|
131 |
+
function breeze_reset_default() {
|
132 |
+
$.ajax(
|
133 |
+
{
|
134 |
+
url: ajaxurl,
|
135 |
+
dataType: 'json',
|
136 |
+
method: 'POST',
|
137 |
+
data: {
|
138 |
+
action: 'breeze_reset_default',
|
139 |
+
is_network: $('body').hasClass('network-admin'),
|
140 |
+
security: breeze_token_name.breeze_reset_default
|
141 |
+
},
|
142 |
+
success: function (res) {
|
143 |
+
if ( res === true ) {
|
144 |
+
alert('Settings reset to default');
|
145 |
+
purge_action = true;
|
146 |
+
} else {
|
147 |
+
alert('Something went wrong - please try again');
|
148 |
+
}
|
149 |
+
location.reload();
|
150 |
+
}
|
151 |
+
}
|
152 |
+
);
|
153 |
+
}
|
154 |
+
|
155 |
//clear cache by button
|
156 |
function breeze_purgeVarnish_callAjax() {
|
157 |
$.ajax(
|
180 |
|
181 |
} else {
|
182 |
window.location.href = current + "breeze-msg=purge-fail";
|
183 |
+
purge_action = true;
|
184 |
location.reload();
|
185 |
}
|
186 |
}
|
199 |
security: breeze_token_name.breeze_purge_cache
|
200 |
},
|
201 |
success: function ( res ) {
|
202 |
+
current = location.href;
|
203 |
+
res = parseFloat( res );
|
204 |
+
var fileClean = res;
|
205 |
window.location.href = current + "#breeze-msg=success-cleancache&file=" + res;
|
206 |
//location.reload();
|
207 |
if ( fileClean > 0 ) {
|
218 |
}
|
219 |
|
220 |
function getParameterByName( name, url ) {
|
221 |
+
if ( !url ) {
|
222 |
url = window.location.href;
|
223 |
}
|
224 |
+
name = name.replace( /[\[\]]/g, "\\$&" );
|
225 |
+
var regex = new RegExp( "[?&]" + name + "(=([^&#]*)|&|#|$)" ),
|
226 |
results = regex.exec( url );
|
227 |
+
if ( !results ) {
|
228 |
return null;
|
229 |
}
|
230 |
+
if ( !results[ 2 ] ) {
|
231 |
return '';
|
232 |
}
|
233 |
return decodeURIComponent( results[ 2 ].replace( /\+/g, " " ) );
|
234 |
}
|
235 |
|
236 |
+
var url = location.href;
|
237 |
var fileClean = parseFloat( getParameterByName( 'file', url ) );
|
238 |
|
239 |
$( window ).on(
|
243 |
if ( patt.test( url ) ) {
|
244 |
//backend
|
245 |
var div = '';
|
246 |
+
if ( url.indexOf( "msg=success-cleancache" ) > 0 && !isNaN( fileClean ) ) {
|
247 |
if ( fileClean > 0 ) {
|
248 |
div = '<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: ' + fileClean + 'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>';
|
249 |
} else {
|
292 |
'#bz-lazy-load',
|
293 |
function () {
|
294 |
|
295 |
+
var native_lazy = $( '#native-lazy-option' );
|
296 |
var native_lazy_iframes = $( '#native-lazy-option-iframe' );
|
297 |
if ( true === $( this ).is( ':checked' ) ) {
|
298 |
native_lazy.show();
|
323 |
'#minification-css',
|
324 |
function () {
|
325 |
var font_display_swap = $( '#font-display-swap' );
|
326 |
+
var font_display = $( '#font-display' );
|
327 |
|
328 |
var include_inline_css = $( '#include-inline-css' );
|
329 |
+
var group_css = $( '#group-css' );
|
330 |
+
var minification_css = $( '#exclude-css' );
|
331 |
|
332 |
if ( $( this ).is( ':checked' ) ) {
|
333 |
font_display_swap.show();
|
334 |
//include_inline_css.removeAttr( 'disabled' );
|
335 |
//group_css.removeAttr( 'disabled' );
|
336 |
|
337 |
+
minification_css.closest( 'div.br-option-item' ).removeClass( 'br-apply-disable' );
|
338 |
+
group_css.closest( 'div.br-option-item' ).removeClass( 'br-apply-disable' );
|
339 |
+
include_inline_css.closest( 'div.br-option-item' ).removeClass( 'br-apply-disable' );
|
340 |
} else {
|
341 |
font_display_swap.hide();
|
342 |
font_display.removeAttr( 'checked' );
|
345 |
include_inline_css.prop( 'checked', false );
|
346 |
group_css.prop( 'checked', false );
|
347 |
|
348 |
+
minification_css.closest( 'div.br-option-item' ).addClass( 'br-apply-disable' );
|
349 |
+
group_css.closest( 'div.br-option-item' ).addClass( 'br-apply-disable' );
|
350 |
+
include_inline_css.closest( 'div.br-option-item' ).addClass( 'br-apply-disable' );
|
351 |
}
|
352 |
}
|
353 |
);
|
358 |
function () {
|
359 |
|
360 |
var include_inline_js = $( '#include-inline-js' );
|
361 |
+
var group_js = $( '#group-js' );
|
362 |
+
var exclude_js = $( '#exclude-js' );
|
363 |
|
364 |
if ( $( this ).is( ':checked' ) ) {
|
365 |
//include_inline_js.removeAttr( 'disabled' );
|
366 |
//group_js.removeAttr( 'disabled' );
|
367 |
|
368 |
+
exclude_js.closest( 'div.br-option-item' ).removeClass( 'br-apply-disable' );
|
369 |
+
group_js.closest( 'div.br-option-item' ).removeClass( 'br-apply-disable' );
|
370 |
+
include_inline_js.closest( 'div.br-option-item' ).removeClass( 'br-apply-disable' );
|
371 |
} else {
|
372 |
//include_inline_js.removeAttr( 'checked' ).attr( 'disabled', 'disabled' );
|
373 |
//group_js.removeAttr( 'checked' ).attr( 'disabled', 'disabled' );
|
375 |
group_js.prop( 'checked', false );
|
376 |
|
377 |
|
378 |
+
exclude_js.closest( 'div.br-option-item' ).addClass( 'br-apply-disable' );
|
379 |
+
group_js.closest( 'div.br-option-item' ).addClass( 'br-apply-disable' );
|
380 |
+
include_inline_js.closest( 'div.br-option-item' ).addClass( 'br-apply-disable' );
|
381 |
}
|
382 |
}
|
383 |
);
|
394 |
$( 'input[name="enable-js-delay"]' ).prop( 'checked', false );
|
395 |
$( '#breeze-delay-js-scripts-div' ).hide();
|
396 |
$enable_inline_delay.attr( 'disabled', 'disabled' );
|
397 |
+
} else {
|
398 |
$delay_js_div_all.hide();
|
399 |
$enable_inline_delay.removeAttr( 'disabled' );
|
400 |
}
|
406 |
'#enable-js-delay',
|
407 |
function () {
|
408 |
var $delay_js_div = $( '#breeze-delay-js-scripts-div' );
|
409 |
+
var $delay_all_js = $( '#breeze-delay-all-js' );
|
410 |
|
411 |
if ( $( this ).is( ':checked' ) ) {
|
412 |
$delay_js_div.show();
|
837 |
breeze_data.append( 'network_level', network );
|
838 |
breeze_data.append( 'breeze_import_file', the_file );
|
839 |
breeze_data.append( 'security', breeze_token_name.breeze_import_settings );
|
840 |
+
|
841 |
var filename_holder = $( '#file-selected' );
|
842 |
var filename_error = $( '#file-error' );
|
843 |
var import_settings = '<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>';
|
assets/js/breeze-main.min.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
-
|
4 |
-
jQuery(document).ready(function(n){var e=n(".breeze-box");n("#breeze-plugins-notice").length&&n(document).on("click tap",".notice-dismiss",function(){n.ajax({type:"POST",url:ajaxurl,data:{action:"compatibility_warning_close",breeze_close_warning:"1"},dataType:"json",success:function(e){},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("click","#wp-admin-bar-breeze-purge-varnish-group",function(e){e.preventDefault(),a()}),n(document).on("click","#wp-admin-bar-breeze-purge-object-cache-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_opcache",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_opcache},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Object Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}),n(document).on("click","#wp-admin-bar-breeze-purge-file-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_file",security:breeze_token_name.breeze_purge_cache},success:function(e){current=location.href;var t=e=parseFloat(e);window.location.href=current+"#breeze-msg=success-cleancache&file="+e,div=0<t?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged: '+t+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody #wpbody-content").prepend(div)}})});var t=!0;function a(){n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_varnish",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_varnish},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Varnish Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}n(".breeze-box").on("click","#purge-varnish-button",function(e){e.preventDefault(),!0===t&&(t=!1,n(this).addClass("br-is-disabled"),a())});var i,s,r,o=location.href,c=parseFloat((i="file",s=(s=o)||window.location.href,i=i.replace(/[\[\]]/g,"\\$&"),(s=new RegExp("[?&]"+i+"(=([^&#]*)|&|#|$)").exec(s))?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null));n(window).on("load",function(){var e,t;/wp-admin/i.test(o)&&(e="",0<o.indexOf("msg=success-cleancache")&&!isNaN(c)&&(e=0<c?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: '+c+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody .wrap h1").after(e),t=o.split("breeze-msg"),setTimeout(function(){window.location=t[0]},2e3)))}),n("#breeze-hide-install-msg").unbind("click").click(function(){n(this).closest("div.notice").fadeOut()}),-1!==(r=location.search).indexOf("breeze_purge=1")&&-1!==r.indexOf("_wpnonce")&&((r=new URLSearchParams(location.search)).delete("breeze_purge"),r.delete("_wpnonce"),history.replaceState(null,"","?"+r+location.hash)),e.on("change","#bz-lazy-load",function(){var e=n("#native-lazy-option"),t=n("#native-lazy-option-iframe");!0===n(this).is(":checked")?(e.show(),t.show()):(e.hide(),t.hide(),n("#bz-lazy-load-nat").attr("checked",!1),n("#bz-lazy-load-iframe").attr("checked",!1))}),e.on("change","#minification-css",function(){var e=n("#font-display-swap"),t=n("#font-display"),a=n("#include-inline-css"),i=n("#group-css"),s=n("#exclude-css");n(this).is(":checked")?(e.show(),s.closest("div.br-option-item").removeClass("br-apply-disable"),i.closest("div.br-option-item").removeClass("br-apply-disable"),a.closest("div.br-option-item").removeClass("br-apply-disable")):(e.hide(),t.removeAttr("checked"),a.prop("checked",!1),i.prop("checked",!1),s.closest("div.br-option-item").addClass("br-apply-disable"),i.closest("div.br-option-item").addClass("br-apply-disable"),a.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js"),a=n("#exclude-js");n(this).is(":checked")?(a.closest("div.br-option-item").removeClass("br-apply-disable"),t.closest("div.br-option-item").removeClass("br-apply-disable"),e.closest("div.br-option-item").removeClass("br-apply-disable")):(e.prop("checked",!1),t.prop("checked",!1),a.closest("div.br-option-item").addClass("br-apply-disable"),t.closest("div.br-option-item").addClass("br-apply-disable"),e.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#breeze-delay-all-js",function(){var e=n("#breeze-delay-js-scripts-div-all"),t=n("#enable-js-delay");n(this).is(":checked")?(e.show(),n('input[name="enable-js-delay"]').prop("checked",!1),n("#breeze-delay-js-scripts-div").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))}),e.on("change","#enable-js-delay",function(){var e=n("#breeze-delay-js-scripts-div"),t=n("#breeze-delay-all-js");n(this).is(":checked")?(e.show(),n('input[name="breeze-delay-all-js"]').prop("checked",!1),n("#breeze-delay-js-scripts-div-all").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))})});var $valid_json=!1;jQuery(document).ready(function(r){var e,t=r(".breeze-box");function o(){t.on("click","span.item-remove",function(){var e=r(this).closest(".breeze-input-group");e.fadeOut(300,function(){e.remove(),d()})})}function c(){r(".breeze-list-url").length&&r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:d})}function l(){r(".sort-handle span").unbind("click").click(function(e){var t=r(this).parents(".breeze-input-group");r(this).hasClass("moveUp")?t.insertBefore(t.prev()):t.insertAfter(t.next()),d()})}function d(){var e=r(".breeze-list-url");e.find(".breeze-input-group").find(".sort-handle").find("span").removeClass("blur"),e.find(".breeze-input-group:first-child").find(".moveUp").addClass("blur"),e.find(".breeze-input-group:last-child").find(".moveDown").addClass("blur")}r('input[name="all_control"]').click(function(){1==r(this).is(":checked")?r(".clean-data").prop("checked",!0):r(".clean-data").prop("checked",!1)}),r(".clean-data").click(function(){0==r(this).is(":checked")&&r('input[name="all_control"]').prop("checked",!1)}),o(),c(),l(),d(),t.on("keyup change blur",".breeze-input-url",function(){var e=r(this).val();""!==e&&(!0==!!/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/.test(e)?r(this).removeClass("is-invalid-url"):r(this).addClass("is-invalid-url"))}),t.on("click","button.add-url",function(){var e=-1<r(this).attr("id").indexOf("defer"),t=-1<r(this).attr("id").indexOf("preload-fonts"),a=r(this).closest("div.br-option").find(".breeze-list-url"),i="",s=a.find(".breeze-input-group"),n=!1;if(s.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(n=!0)}),n)return!1;i+='<div class="breeze-input-group">',i+=' <input type="text" size="98"',i+='class="breeze-input-url"',i+=t?'name="breeze-preload-font[]"':e?'name="defer-js[]"':'name="move-to-footer-js[]"',i+='placeholder="Enter URL..."',i+='value="" />',i+=' <span class="sort-handle">',i+=' <span class="dashicons dashicons-arrow-up moveUp"></span>',i+=' <span class="dashicons dashicons-arrow-down moveDown"></span>',i+=" </span>",i+=' <span class="dashicons dashicons-no item-remove" title="Remove"></span>',a.append(i+="</div>"),o(),c(),l(),d()}),r("#breeze-tabs .nav-tab").click(function(e){e.preventDefault(),r("#breeze-tabs .nav-tab").removeClass("active"),r(e.target).addClass("active"),id_tab=r(this).data("tab-id"),r("#tab-"+id_tab).addClass("active"),r("#breeze-tabs-content .tab-pane").removeClass("active"),r("#tab-content-"+id_tab).addClass("active"),document.cookie="breeze_active_tab="+id_tab,"faq"===id_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),e=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}("breeze_active_tab"),0===r("#tab-"+(e="import_export"===(e=e||"basic")?"basic":e)).length?(firstTab=r("#breeze-tabs").find("a:first-child"),firstTab.length&&(tabType=firstTab.attr("id").replace("tab-",""),firstTab.addClass("active"),r("#tab-content-"+tabType).addClass("active"))):(r("#tab-"+e).addClass("active"),r("#tab-content-"+e).addClass("active")),"faq"===e?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var a,i=["faq"],s=!0,n=!1,b=r("#breeze-inherit-settings-toggle");function p(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",s=a[1].split(/[&;]/g),n=s.length;0<n--;)-1!==s[n].lastIndexOf(i,0)&&s.splice(n,1);return a[0]+(0<s.length?"?"+s.join("&"):"")}return e}b.length&&(r("input",b).on("change",function(){var t="1"==r(this).val();r("#breeze-tabs").toggleClass("tabs-hidden",t),r("#breeze-tabs-content").toggleClass("tabs-hidden",t),r("#breeze-tabs .nav-tab").each(function(){var e=r(this).data("tab-id");-1===r.inArray(e,i)&&(r(this).toggleClass("inactive",t),r("#breeze-tabs-content #tab-content-"+e).toggleClass("inactive",t))}),n=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);s&&n&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:b.serializeArray(),beforeSend:function(){b.addClass("loading")},complete:function(){b.removeClass("loading"),n=!1,t.submit()},success:function(){r("input:checked",b).parents(".radio-field").addClass("active").siblings().removeClass("active")}}))})),r("#breeze-database-optimize").on("click",function(e){s=!1}),r("#tab-content-database .submit input").on("click",function(e){r("#tab-content-database input[type=checkbox]").attr("checked",!1)}),window.history&&"function"==typeof window.history.pushState&&(a=p(window.location.href,"save-settings"),a=p(a,"database-cleanup"),window.history.pushState(null,null,a)),t.on("click tap","#breeze_export_settings",function(){$network=r("#breeze-level").val(),window.location=ajaxurl+"?action=breeze_export_json&network_level="+$network}),r("#breeze_import_btn").attr("disabled","disabled"),t.on("change","#breeze_import_settings",function(){var e=this.files[0],t=r("#file-selected"),a=r("#file-error"),i=r("#breeze_import_btn");t.html(e.name),"application/json"!==e.type?($valid_json=!1,t.removeClass("file_green file_red").addClass("file_red"),a.html("File must be JSON"),i.attr("disabled","disabled")):($valid_json=!0,t.removeClass("file_green file_red").addClass("file_green"),a.html(""),i.removeAttr("disabled")),r(".br-file-text").remove()}),t.on("click tap","#breeze_import_btn",function(){var e,t,a,i,s;!0===$valid_json&&(e=r("#breeze-level").val(),t=r("#breeze_import_settings").get(0).files[0],(a=new FormData).append("action","breeze_import_json"),a.append("network_level",e),a.append("breeze_import_file",t),a.append("security",breeze_token_name.breeze_import_settings),i=r("#file-selected"),s=r("#file-error"),i.removeClass("file_green file_red").addClass("file_green"),i.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:a,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(i.removeClass("file_green file_red").addClass("file_green"),i.html(e.data),s.html(""),alert(e.data),window.location.reload(!0)):(i.removeClass("file_green file_red"),i.html(""),s.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(n){var s=[];setTimeout(function(){var e=n("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),n(window).on("resize",function(){632<=n(this).height()&&n(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}n(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var a=this.dataset.tabId,t=n(".br-options");o=(o=r("breeze_active_tab"))||"basic",n(".br-link").removeClass("br-active"),n(".br-link").each(function(e,t){var a=t.dataset.breezeLink,i=n(this).find("img"),t=i.get(0).dataset.path;i.attr("src",t+a+".png")});var i=n(this).closest(".br-link");i.addClass("br-active");e=i.find("img"),i=e.get(0).dataset.path;e.attr("src",i+a+"-active.png"),t.html('<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>'),!0===n(".br-mobile-menu").is(":visible")&&n(".br-link").fadeOut(),n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:a,"is-network":n("body").hasClass("network-admin")},contentType:"text/html; charset=UTF-8",dataType:"html",success:function(e){t.html(e)},error:function(e,t,a){},complete:function(e,t){!function(){var t=n(".breeze-per");t.length&&(t.empty(),t.append("<p>Re-checking permissions, please wait...</p>"));n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":n("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e?t.remove():t.length?(n(e).insertBefore(t),t.remove()):n("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}})}(),document.cookie="breeze_active_tab="+a,"faq"===a&&n("#faq-content").length&&n("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),s=[]}})});var e,o=r("breeze_active_tab");n("#tab-basic").closest("div.br-link").hasClass("br-hide")?n("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=n("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(t=n("#tab-basic")).length&&t.trigger("click");var t=n(".breeze-box");t.on("click",".br-db-item",function(){var e=this.dataset.section;if(n(this).hasClass("br-db-selected")){if(n(this).removeClass("br-db-selected"),s.length){for(var t=[],a=0;a<s.length;a++)e!==s[a]&&t.push(s[a]);s=t}}else n(this).addClass("br-db-selected"),s.push(e);var i=n("#optimize-selected-services");s.length?i.show():i.hide()}),t.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=s.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},s)),security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==n.inArray(a,s)&&(n(t).find("h3").find("span").removeClass("br-has").html("0"),n(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),n("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){s=[]}})}),t.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=n(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(n(this).addClass("opac"),n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){t.find("h3").find("span").removeClass("br-has").html("0"),alert("Data for "+a+" has been cleaned")},error:function(e,t,a){},complete:function(e,t){}}))}),t.on("change","#br-clean-all",function(e){var t=n(this).is(":checked"),a=n("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),t.on("click","#br-clean-all-cta",function(e){!1===n(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),n("div.br-db-item").each(function(e,t){n(t).find("h3").find("span").removeClass("br-has").html("0")});var t=n("#br-clean-all");t.is(":checked")&&t.trigger("click"),alert("Clean all process finished")},error:function(e,t,a){},complete:function(e,t){}})}),t.on("click",".br-mobile-menu",function(){n(".br-link").fadeToggle()}),t.on("click",".br-submit-save",function(e){e.preventDefault();var e=n(this).closest("form"),t=e.get(0).dataset.section,e={action:"save_settings_tab_"+t,security:breeze_token_name.breeze_save_options,"form-data":e.serialize(),"is-network":n("body").hasClass("network-admin")};n(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){n("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("change",'input:radio[name="inherit-settings"]',function(){var a=n('input:radio[name="inherit-settings"]:checked').val(),i=".br-is-network",s=".br-is-custom",e=n(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val();n(".br-overlay-disable").addClass("br-hide");e={action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":n("body").hasClass("network-admin")};n("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(n("#wpcontent")),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){n("#wpcontent").find("div.br-inherit-wait").remove(),"0"===a||!0===a?(n(i).removeClass("br-show").addClass("br-hide"),n(s).removeClass("br-hide").addClass("br-show"),n(".br-link").removeClass("br-hide"),n("#tab-basic").trigger("click")):(n(s).removeClass("br-show").addClass("br-hide"),n(i).removeClass("br-hide").addClass("br-show"),n(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&n(t).addClass("br-hide")}),n("#tab-faq").trigger("click"))}})}),n(document).on("click",".notice-dismiss",function(){var e=n(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
1 |
/*! Created by Cloudways
|
2 |
+
On 29-09-2022 */
|
3 |
+
jQuery(document).ready(function(n){var e=n(".breeze-box"),t=(n("#breeze-plugins-notice").length&&n(document).on("click tap",".notice-dismiss",function(){n.ajax({type:"POST",url:ajaxurl,data:{action:"compatibility_warning_close",breeze_close_warning:"1"},dataType:"json",success:function(e){},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("click","#wp-admin-bar-breeze-purge-varnish-group",function(e){e.preventDefault(),a()}),n(document).on("click","#wp-admin-bar-breeze-purge-object-cache-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_opcache",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_opcache},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Object Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}),n(document).on("click","#wp-admin-bar-breeze-purge-file-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_file",security:breeze_token_name.breeze_purge_cache},success:function(e){current=location.href;var t=e=parseFloat(e);window.location.href=current+"#breeze-msg=success-cleancache&file="+e,div=0<t?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged: '+t+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody #wpbody-content").prepend(div)}})}),n(document).on("click","#breeze_reset_default",function(e){e.preventDefault(),(reset_confirm=confirm("Want to reset breeze settings?"))&&n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_reset_default",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_reset_default},success:function(e){!0===e?(alert("Settings reset to default"),t=!0):alert("Something went wrong - please try again"),location.reload()}})}),!0);function a(){n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_varnish",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_varnish},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Varnish Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}n(".breeze-box").on("click","#purge-varnish-button",function(e){e.preventDefault(),!0===t&&(t=!1,n(this).addClass("br-is-disabled"),a())});var i,s,r=location.href,o=parseFloat((i="file",s=(s=r)||window.location.href,i=i.replace(/[\[\]]/g,"\\$&"),(i=new RegExp("[?&]"+i+"(=([^&#]*)|&|#|$)").exec(s))?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null));n(window).on("load",function(){var e,t;/wp-admin/i.test(r)&&(e="",0<r.indexOf("msg=success-cleancache")&&!isNaN(o)&&(e=0<o?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: '+o+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody .wrap h1").after(e),t=r.split("breeze-msg"),setTimeout(function(){window.location=t[0]},2e3)))}),n("#breeze-hide-install-msg").unbind("click").click(function(){n(this).closest("div.notice").fadeOut()}),-1!==(s=location.search).indexOf("breeze_purge=1")&&-1!==s.indexOf("_wpnonce")&&((s=new URLSearchParams(location.search)).delete("breeze_purge"),s.delete("_wpnonce"),history.replaceState(null,"","?"+s+location.hash)),e.on("change","#bz-lazy-load",function(){var e=n("#native-lazy-option"),t=n("#native-lazy-option-iframe");!0===n(this).is(":checked")?(e.show(),t.show()):(e.hide(),t.hide(),n("#bz-lazy-load-nat").attr("checked",!1),n("#bz-lazy-load-iframe").attr("checked",!1))}),e.on("change","#minification-css",function(){var e=n("#font-display-swap"),t=n("#font-display"),a=n("#include-inline-css"),i=n("#group-css"),s=n("#exclude-css");n(this).is(":checked")?(e.show(),s.closest("div.br-option-item").removeClass("br-apply-disable"),i.closest("div.br-option-item").removeClass("br-apply-disable"),a.closest("div.br-option-item").removeClass("br-apply-disable")):(e.hide(),t.removeAttr("checked"),a.prop("checked",!1),i.prop("checked",!1),s.closest("div.br-option-item").addClass("br-apply-disable"),i.closest("div.br-option-item").addClass("br-apply-disable"),a.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js"),a=n("#exclude-js");n(this).is(":checked")?(a.closest("div.br-option-item").removeClass("br-apply-disable"),t.closest("div.br-option-item").removeClass("br-apply-disable"),e.closest("div.br-option-item").removeClass("br-apply-disable")):(e.prop("checked",!1),t.prop("checked",!1),a.closest("div.br-option-item").addClass("br-apply-disable"),t.closest("div.br-option-item").addClass("br-apply-disable"),e.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#breeze-delay-all-js",function(){var e=n("#breeze-delay-js-scripts-div-all"),t=n("#enable-js-delay");n(this).is(":checked")?(e.show(),n('input[name="enable-js-delay"]').prop("checked",!1),n("#breeze-delay-js-scripts-div").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))}),e.on("change","#enable-js-delay",function(){var e=n("#breeze-delay-js-scripts-div"),t=n("#breeze-delay-all-js");n(this).is(":checked")?(e.show(),n('input[name="breeze-delay-all-js"]').prop("checked",!1),n("#breeze-delay-js-scripts-div-all").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))})});var $valid_json=!1;jQuery(document).ready(function(r){var e=r(".breeze-box");function o(){e.on("click","span.item-remove",function(){var e=r(this).closest(".breeze-input-group");e.fadeOut(300,function(){e.remove(),d()})})}function c(){r(".breeze-list-url").length&&r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:d})}function l(){r(".sort-handle span").unbind("click").click(function(e){var t=r(this).parents(".breeze-input-group");r(this).hasClass("moveUp")?t.insertBefore(t.prev()):t.insertAfter(t.next()),d()})}function d(){var e=r(".breeze-list-url");e.find(".breeze-input-group").find(".sort-handle").find("span").removeClass("blur"),e.find(".breeze-input-group:first-child").find(".moveUp").addClass("blur"),e.find(".breeze-input-group:last-child").find(".moveDown").addClass("blur")}r('input[name="all_control"]').click(function(){1==r(this).is(":checked")?r(".clean-data").prop("checked",!0):r(".clean-data").prop("checked",!1)}),r(".clean-data").click(function(){0==r(this).is(":checked")&&r('input[name="all_control"]').prop("checked",!1)}),o(),c(),l(),d(),e.on("keyup change blur",".breeze-input-url",function(){var e=r(this).val();""!==e&&(!0==!!/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/.test(e)?r(this).removeClass("is-invalid-url"):r(this).addClass("is-invalid-url"))}),e.on("click","button.add-url",function(){var e=-1<r(this).attr("id").indexOf("defer"),t=-1<r(this).attr("id").indexOf("preload-fonts"),a=r(this).closest("div.br-option").find(".breeze-list-url"),i="",s=a.find(".breeze-input-group"),n=!1;if(s.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(n=!0)}),n)return!1;a.append(i=(i=(i=(i=(i=(i=i+'<div class="breeze-input-group">'+' <input type="text" size="98"')+'class="breeze-input-url"'+(t?'name="breeze-preload-font[]"':e?'name="defer-js[]"':'name="move-to-footer-js[]"'))+'placeholder="Enter URL..."'+'value="" />')+' <span class="sort-handle">'+' <span class="dashicons dashicons-arrow-up moveUp"></span>')+' <span class="dashicons dashicons-arrow-down moveDown"></span>'+" </span>")+' <span class="dashicons dashicons-no item-remove" title="Remove"></span>'+"</div>"),o(),c(),l(),d()}),r("#breeze-tabs .nav-tab").click(function(e){e.preventDefault(),r("#breeze-tabs .nav-tab").removeClass("active"),r(e.target).addClass("active"),id_tab=r(this).data("tab-id"),r("#tab-"+id_tab).addClass("active"),r("#breeze-tabs-content .tab-pane").removeClass("active"),r("#tab-content-"+id_tab).addClass("active"),document.cookie="breeze_active_tab="+id_tab,"faq"===id_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),t=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}("breeze_active_tab"),0===r("#tab-"+(t="import_export"===(t=t||"basic")?"basic":t)).length?(firstTab=r("#breeze-tabs").find("a:first-child")).length&&(tabType=firstTab.attr("id").replace("tab-",""),firstTab.addClass("active"),r("#tab-content-"+tabType).addClass("active")):(r("#tab-"+t).addClass("active"),r("#tab-content-"+t).addClass("active")),"faq"===t?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var t,a=["faq"],i=!0,s=!1,n=r("#breeze-inherit-settings-toggle");function b(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",s=a[1].split(/[&;]/g),n=s.length;0<n--;)-1!==s[n].lastIndexOf(i,0)&&s.splice(n,1);return a[0]+(0<s.length?"?"+s.join("&"):"")}return e}n.length&&(r("input",n).on("change",function(){var t="1"==r(this).val();r("#breeze-tabs").toggleClass("tabs-hidden",t),r("#breeze-tabs-content").toggleClass("tabs-hidden",t),r("#breeze-tabs .nav-tab").each(function(){var e=r(this).data("tab-id");-1===r.inArray(e,a)&&(r(this).toggleClass("inactive",t),r("#breeze-tabs-content #tab-content-"+e).toggleClass("inactive",t))}),s=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);i&&s&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:n.serializeArray(),beforeSend:function(){n.addClass("loading")},complete:function(){n.removeClass("loading"),s=!1,t.submit()},success:function(){r("input:checked",n).parents(".radio-field").addClass("active").siblings().removeClass("active")}}))})),r("#breeze-database-optimize").on("click",function(e){i=!1}),r("#tab-content-database .submit input").on("click",function(e){r("#tab-content-database input[type=checkbox]").attr("checked",!1)}),window.history&&"function"==typeof window.history.pushState&&(t=b(window.location.href,"save-settings"),t=b(t,"database-cleanup"),window.history.pushState(null,null,t)),e.on("click tap","#breeze_export_settings",function(){$network=r("#breeze-level").val(),window.location=ajaxurl+"?action=breeze_export_json&network_level="+$network}),r("#breeze_import_btn").attr("disabled","disabled"),e.on("change","#breeze_import_settings",function(){var e=this.files[0],t=r("#file-selected"),a=r("#file-error"),i=r("#breeze_import_btn");t.html(e.name),"application/json"!==e.type?($valid_json=!1,t.removeClass("file_green file_red").addClass("file_red"),a.html("File must be JSON"),i.attr("disabled","disabled")):($valid_json=!0,t.removeClass("file_green file_red").addClass("file_green"),a.html(""),i.removeAttr("disabled")),r(".br-file-text").remove()}),e.on("click tap","#breeze_import_btn",function(){var e,t,a,i,s;!0===$valid_json&&(e=r("#breeze-level").val(),t=r("#breeze_import_settings").get(0).files[0],(a=new FormData).append("action","breeze_import_json"),a.append("network_level",e),a.append("breeze_import_file",t),a.append("security",breeze_token_name.breeze_import_settings),i=r("#file-selected"),s=r("#file-error"),i.removeClass("file_green file_red").addClass("file_green"),i.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:a,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(i.removeClass("file_green file_red").addClass("file_green"),i.html(e.data),s.html(""),alert(e.data),window.location.reload(!0)):(i.removeClass("file_green file_red"),i.html(""),s.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(n){var s=[];setTimeout(function(){var e=n("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),n(window).on("resize",function(){632<=n(this).height()&&n(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}n(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var i=this.dataset.tabId,t=n(".br-options"),e=(o=(o=r("breeze_active_tab"))||"basic",n(".br-link").removeClass("br-active"),n(".br-link").each(function(e,t){var t=t.dataset.breezeLink,a=n(this).find("img"),i=a.get(0).dataset.path;a.attr("src",i+t+".png")}),n(this).closest(".br-link")),e=(e.addClass("br-active"),e.find("img")),a=e.get(0).dataset.path;e.attr("src",a+i+"-active.png"),t.html('<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>'),!0===n(".br-mobile-menu").is(":visible")&&n(".br-link").fadeOut(),n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:i,"is-network":n("body").hasClass("network-admin")},contentType:"text/html; charset=UTF-8",dataType:"html",success:function(e){t.html(e)},error:function(e,t,a){},complete:function(e,t){var a=n(".breeze-per");a.length&&(a.empty(),a.append("<p>Re-checking permissions, please wait...</p>")),n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":n("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e?a.remove():a.length?(n(e).insertBefore(a),a.remove()):n("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}}),document.cookie="breeze_active_tab="+i,"faq"===i&&n("#faq-content").length&&n("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),s=[]}})});var o=r("breeze_active_tab"),e=(n("#tab-basic").closest("div.br-link").hasClass("br-hide")?n("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=n("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(e=n("#tab-basic")).length&&e.trigger("click"),n(".breeze-box"));e.on("click",".br-db-item",function(){var e=this.dataset.section;if(n(this).hasClass("br-db-selected")){if(n(this).removeClass("br-db-selected"),s.length){for(var t=[],a=0;a<s.length;a++)e!==s[a]&&t.push(s[a]);s=t}}else n(this).addClass("br-db-selected"),s.push(e);var i=n("#optimize-selected-services");s.length?i.show():i.hide()}),e.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=s.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},s)),security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==n.inArray(a,s)&&(n(t).find("h3").find("span").removeClass("br-has").html("0"),n(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),n("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){s=[]}})}),e.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=n(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(n(this).addClass("opac"),n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){t.find("h3").find("span").removeClass("br-has").html("0"),alert("Data for "+a+" has been cleaned")},error:function(e,t,a){},complete:function(e,t){}}))}),e.on("change","#br-clean-all",function(e){var t=n(this).is(":checked"),a=n("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),e.on("click","#br-clean-all-cta",function(e){!1===n(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),n("div.br-db-item").each(function(e,t){n(t).find("h3").find("span").removeClass("br-has").html("0")});var t=n("#br-clean-all");t.is(":checked")&&t.trigger("click"),alert("Clean all process finished")},error:function(e,t,a){},complete:function(e,t){}})}),e.on("click",".br-mobile-menu",function(){n(".br-link").fadeToggle()}),e.on("click",".br-submit-save",function(e){e.preventDefault();var e=n(this).closest("form"),t=e.get(0).dataset.section,e={action:"save_settings_tab_"+t,security:breeze_token_name.breeze_save_options,"form-data":e.serialize(),"is-network":n("body").hasClass("network-admin")};n(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){n("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("change",'input:radio[name="inherit-settings"]',function(){var a=n('input:radio[name="inherit-settings"]:checked').val(),i=".br-is-network",s=".br-is-custom",e=n(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val(),e=(n(".br-overlay-disable").addClass("br-hide"),{action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":n("body").hasClass("network-admin")});n("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(n("#wpcontent")),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){n("#wpcontent").find("div.br-inherit-wait").remove(),("0"===a||!0===a?(n(i).removeClass("br-show").addClass("br-hide"),n(s).removeClass("br-hide").addClass("br-show"),n(".br-link").removeClass("br-hide"),n("#tab-basic")):(n(s).removeClass("br-show").addClass("br-hide"),n(i).removeClass("br-hide").addClass("br-show"),n(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&n(t).addClass("br-hide")}),n("#tab-faq"))).trigger("click")}})}),n(document).on("click",".notice-dismiss",function(){var e=n(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
|
assets/js/js-front-end/breeze-lazy-load.min.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
-
|
4 |
-
!function(e,t){t=t(e,e.document,Date);"object"==typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd?define(t):e.lazySizes=t}(window,function(n,f,s){"use strict";var m,h;if(!function(){var e,t={lazyClass:"br-lazy",loadedClass:"br-loaded",loadingClass:"br-loading",preloadClass:"br-preload",errorClass:"br-error",autosizesClass:"br-autosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-breeze",srcsetAttr:"data-brsrcset",sizesAttr:"data-brsizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=n.lazySizesConfig||n.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!f||!f.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};function c(e,t){M(e,t)||e.setAttribute("class",(e[g]("class")||"").trim()+" "+t)}function u(e,t){(t=M(e,t))&&e.setAttribute("class",(e[g]("class")||"").replace(t," "))}function z(e,t){var a;!l&&(a=n.picturefill||h.pf)?(t&&t.src&&!e[g]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)}var a,i,t,o,r,y=f.documentElement,l=n.HTMLPictureElement,d="addEventListener",g="getAttribute",e=n[d].bind(n),v=n.setTimeout,p=n.requestAnimationFrame||v,b=n.requestIdleCallback,C=/^picture$/i,A=["load","error","lazyincluded","_lazyloaded"],E={},_=Array.prototype.forEach,M=function(e,t){return E[t]||(E[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),E[t].test(e[g]("class")||"")&&E[t]},N=function(t,a,e){var n=e?d:"removeEventListener";e&&N(t,a),A.forEach(function(e){t[n](e,a)})},w=function(e,t,a,n,i){var s=f.createEvent("Event");return(a=a||{}).instance=m,s.initEvent(t,!n,!i),s.detail=a,e.dispatchEvent(s),s},L=function(e,t){return(getComputedStyle(e,null)||{})[t]},x=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},W=(o=[],r=t=[],B._lsFlush=S,B);function S(){var e=r;for(r=t.length?o:t,i=!(a=!0);e.length;)e.shift()();a=!1}function B(e,t){a&&!t?e.apply(this,arguments):(r.push(e),i||(i=!0,(f.hidden?v:p)(S)))}function T(a,e){return e?function(){W(a)}:function(){var e=this,t=arguments;W(function(){a.apply(e,t)})}}function F(e){function t(){var e=s.now()-n;e<99?v(t,99-e):(b||i)(i)}var a,n,i=function(){a=null,e()};return function(){n=s.now(),a=a||v(t,99)}}var R,D,k,H,O,P,$,q,I,U,j,G,J,K,Q,V,X,Y,Z,ee,te,ae,ne,ie,se,oe,re,le,de,ce,ue,fe=(Z=/^img$/i,ee=/^iframe$/i,te="onscroll"in n&&!/(gle|ing)bot/.test(navigator.userAgent),ie=-1,se=function(e){return(G=null==G?"hidden"==L(f.body,"visibility"):G)||!("hidden"==L(e.parentNode,"visibility")&&"hidden"==L(e,"visibility"))},J=he,Q=ne=ae=0,V=h.throttleDelay,X=h.ricTimeout,Y=b&&49<X?function(){b(ze,{timeout:X}),X!==h.ricTimeout&&(X=h.ricTimeout)}:T(function(){v(ze)},!0),re=T(ye),le=function(e){re({target:e.target})},de=T(function(t,e,a,n,i){var s,o,r,l,d;(r=w(t,"lazybeforeunveil",e)).defaultPrevented||(n&&(a?c(t,h.autosizesClass):t.setAttribute("sizes",n)),s=t[g](h.srcsetAttr),a=t[g](h.srcAttr),i&&(o=(d=t.parentNode)&&C.test(d.nodeName||"")),l=e.firesLoad||"src"in t&&(s||a||o),r={target:t},c(t,h.loadingClass),l&&(clearTimeout(k),k=v(me,2500),N(t,le,!0)),o&&_.call(d.getElementsByTagName("source"),ge),s?t.setAttribute("srcset",s):a&&!o&&(ee.test(t.nodeName)?(n=a,0==(d=(e=t).getAttribute("data-load-mode")||h.iframeLoadMode)?e.contentWindow.location.replace(n):1==d&&(e.src=n)):t.src=a),i&&(s||o)&&z(t,{src:a})),t._lazyRace&&delete t._lazyRace,u(t,h.lazyClass),W(function(){var e=t.complete&&1<t.naturalWidth;l&&!e||(e&&c(t,h.fastLoadedClass),ye(r),t._lazyCache=!0,v(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&ne--},!0)}),ue=F(function(){h.loadMode=3,oe()}),{_:function(){O=s.now(),m.elements=f.getElementsByClassName(h.lazyClass),R=f.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",oe,!0),e("resize",oe,!0),e("pageshow",function(e){var t;!e.persisted||(t=f.querySelectorAll("."+h.loadingClass)).length&&t.forEach&&p(function(){t.forEach(function(e){e.complete&&ce(e)})})}),n.MutationObserver?new MutationObserver(oe).observe(y,{childList:!0,subtree:!0,attributes:!0}):(y[d]("DOMNodeInserted",oe,!0),y[d]("DOMAttrModified",oe,!0),setInterval(oe,999)),e("hashchange",oe,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[d](e,oe,!0)}),/d$|^c/.test(f.readyState)?pe():(e("load",pe),f[d]("DOMContentLoaded",oe),v(pe,2e4)),m.elements.length?(he(),W._lsFlush()):oe()},checkElems:oe=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(s.now()-Q))<0&&(t=0),e||t<9?Y():v(Y,t))},unveil:ce=function(e){var t,a,n,i;e._lazyRace||(!(i="auto"==(n=(a=Z.test(e.nodeName))&&(e[g](h.sizesAttr)||e[g]("sizes"))))&&D||!a||!e[g]("src")&&!e.srcset||e.complete||M(e,h.errorClass)||!M(e,h.lazyClass))&&(t=w(e,"lazyunveilread").detail,i&&Ee.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,ne++,de(e,t,i,n,a))},_aLSL:ve});function me(e){ne--,e&&!(ne<0)&&e.target||(ne=0)}function he(){var e,t,a,n,i,s,o,r,l,d,c,u=m.elements;if((H=h.loadMode)&&ne<8&&(e=u.length)){for(t=0,ie++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!te||m.prematureUnveil&&m.prematureUnveil(u[t]))ce(u[t]);else if((o=u[t][g]("data-expand"))&&(i=+o)||(i=ae),l||(l=!h.expand||h.expand<1?500<y.clientHeight&&500<y.clientWidth?500:370:h.expand,d=(m._defEx=l)*h.expFactor,c=h.hFac,G=null,ae<d&&ne<1&&2<ie&&2<H&&!f.hidden?(ae=d,ie=0):ae=1<H&&1<ie&&ne<6?l:0),r!==i&&(P=innerWidth+i*c,$=innerHeight+i,s=-1*i,r=i),d=u[t].getBoundingClientRect(),(j=d.bottom)>=s&&(q=d.top)<=$&&(U=d.right)>=s*c&&(I=d.left)<=P&&(j||U||I||q)&&(h.loadHidden||se(u[t]))&&(D&&ne<3&&!o&&(H<3||ie<4)||function(e,t){var a,n=e,i=se(e);for(q-=t,j+=t,I-=t,U+=t;i&&(n=n.offsetParent)&&n!=f.body&&n!=y;)(i=0<(L(n,"opacity")||1))&&"visible"!=L(n,"overflow")&&(a=n.getBoundingClientRect(),i=U>a.left&&I<a.right&&j>a.top-1&&q<a.bottom+1);return i}(u[t],i))){if(ce(u[t]),n=!0,9<ne)break}else!n&&D&&!a&&ne<4&&ie<4&&2<H&&(R[0]||h.preloadAfterLoad)&&(R[0]||!o&&(j||U||I||q||"auto"!=u[t][g](h.sizesAttr)))&&(a=R[0]||u[t]);a&&!n&&ce(a)}}function ze(){K=!1,Q=s.now(),J()}function ye(e){var t=e.target;t._lazyCache?delete t._lazyCache:(me(e),c(t,h.loadedClass),u(t,h.loadingClass),N(t,le),w(t,"lazyloaded"))}function ge(e){var t,a=e[g](h.srcsetAttr);(t=h.customMedia[e[g]("data-media")||e[g]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function ve(){3==h.loadMode&&(h.loadMode=2),ue()}function pe(){D||(s.now()-O<999?v(pe,999):(D=!0,h.loadMode=3,oe(),e("scroll",ve,!0)))}var be,Ce,Ae,Ee=(Ce=T(function(e,t,a,n){var i,s,o;if(e._lazysizesWidth=n,e.setAttribute("sizes",n+="px"),C.test(t.nodeName||""))for(s=0,o=(i=t.getElementsByTagName("source")).length;s<o;s++)i[s].setAttribute("sizes",n);a.detail.dataAttr||z(e,a.detail)}),{_:function(){be=f.getElementsByClassName(h.autosizesClass),e("resize",Ae)},checkElems:Ae=F(function(){var e,t=be.length;if(t)for(e=0;e<t;e++)_e(be[e])}),updateElem:_e});function _e(e,t,a){var n=e.parentNode;n&&(a=x(e,n,a),(t=w(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&Ce(e,n,t,a))}function Me(){!Me.i&&f.getElementsByClassName&&(Me.i=!0,Ee._(),fe._())}return v(function(){h.init&&Me()}),m={cfg:h,autoSizer:Ee,loader:fe,init:Me,uP:z,aC:c,rC:u,hC:M,fire:w,gW:x,rAF:W}});
|
1 |
/*! Created by Cloudways
|
2 |
+
On 29-09-2022 */
|
3 |
+
!function(e,t){t=t(e,e.document,Date);"object"==typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd?define(t):e.lazySizes=t}(window,function(n,f,s){"use strict";var m,h,e,z,D,i,y,t,c,k,o,H,O,a,P,r,u,g,p,v,b,C,$,A,q,I,U,j,l,d,G,J,K,E,Q,_,V,X,Y,M,N,w,L,Z,ee,te,ae,ne,x,ie,se,oe,re,W,S,B,le,T,de,ce,ue,F,fe,me,he,ze,ye,R,ge={lazyClass:"br-lazy",loadedClass:"br-loaded",loadingClass:"br-loading",preloadClass:"br-preload",errorClass:"br-error",autosizesClass:"br-autosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-breeze",srcsetAttr:"data-brsrcset",sizesAttr:"data-brsizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=n.lazySizesConfig||n.lazysizesConfig||{},ge)e in h||(h[e]=ge[e]);return f&&f.getElementsByClassName?(z=f.documentElement,D=n.HTMLPictureElement,y="getAttribute",t=n[i="addEventListener"].bind(n),c=n.setTimeout,k=n.requestAnimationFrame||c,o=n.requestIdleCallback,H=/^picture$/i,O=["load","error","lazyincluded","_lazyloaded"],a={},P=Array.prototype.forEach,r=function(e,t){return a[t]||(a[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),a[t].test(e[y]("class")||"")&&a[t]},u=function(e,t){r(e,t)||e.setAttribute("class",(e[y]("class")||"").trim()+" "+t)},g=function(e,t){(t=r(e,t))&&e.setAttribute("class",(e[y]("class")||"").replace(t," "))},p=function(t,a,e){var n=e?i:"removeEventListener";e&&p(t,a),O.forEach(function(e){t[n](e,a)})},v=function(e,t,a,n,i){var s=f.createEvent("Event");return(a=a||{}).instance=m,s.initEvent(t,!n,!i),s.detail=a,e.dispatchEvent(s),s},b=function(e,t){var a;!D&&(a=n.picturefill||h.pf)?(t&&t.src&&!e[y]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)},C=function(e,t){return(getComputedStyle(e,null)||{})[t]},$=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},j=[],l=U=[],ve._lsFlush=pe,A=ve,d=function(a,e){return e?function(){A(a)}:function(){var e=this,t=arguments;A(function(){a.apply(e,t)})}},G=function(e){function t(){var e=s.now()-n;e<99?c(t,99-e):(o||i)(i)}var a,n,i=function(){a=null,e()};return function(){n=s.now(),a=a||c(t,99)}},se=/^img$/i,oe=/^iframe$/i,re="onscroll"in n&&!/(gle|ing)bot/.test(navigator.userAgent),B=-1,le=function(e){return(Z=null==Z?"hidden"==C(f.body,"visibility"):Z)||!("hidden"==C(e.parentNode,"visibility")&&"hidden"==C(e,"visibility"))},ee=Ce,ae=S=W=0,ne=h.throttleDelay,x=h.ricTimeout,ie=o&&49<x?function(){o(Ae,{timeout:x}),x!==h.ricTimeout&&(x=h.ricTimeout)}:d(function(){c(Ae)},!0),de=d(Ee),ce=function(e){de({target:e.target})},ue=d(function(t,e,a,n,i){var s,o,r,l,d;(o=v(t,"lazybeforeunveil",e)).defaultPrevented||(n&&(a?u(t,h.autosizesClass):t.setAttribute("sizes",n)),a=t[y](h.srcsetAttr),n=t[y](h.srcAttr),i&&(s=(l=t.parentNode)&&H.test(l.nodeName||"")),r=e.firesLoad||"src"in t&&(a||n||s),o={target:t},u(t,h.loadingClass),r&&(clearTimeout(Q),Q=c(be,2500),p(t,ce,!0)),s&&P.call(l.getElementsByTagName("source"),_e),a?t.setAttribute("srcset",a):n&&!s&&(oe.test(t.nodeName)?(e=n,0==(d=(l=t).getAttribute("data-load-mode")||h.iframeLoadMode)?l.contentWindow.location.replace(e):1==d&&(l.src=e)):t.src=n),i&&(a||s)&&b(t,{src:n})),t._lazyRace&&delete t._lazyRace,g(t,h.lazyClass),A(function(){var e=t.complete&&1<t.naturalWidth;r&&!e||(e&&u(t,h.fastLoadedClass),Ee(o),t._lazyCache=!0,c(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&S--},!0)}),fe=G(function(){h.loadMode=3,T()}),J={_:function(){V=s.now(),m.elements=f.getElementsByClassName(h.lazyClass),K=f.getElementsByClassName(h.lazyClass+" "+h.preloadClass),t("scroll",T,!0),t("resize",T,!0),t("pageshow",function(e){var t;e.persisted&&(t=f.querySelectorAll("."+h.loadingClass)).length&&t.forEach&&k(function(){t.forEach(function(e){e.complete&&F(e)})})}),n.MutationObserver?new MutationObserver(T).observe(z,{childList:!0,subtree:!0,attributes:!0}):(z[i]("DOMNodeInserted",T,!0),z[i]("DOMAttrModified",T,!0),setInterval(T,999)),t("hashchange",T,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[i](e,T,!0)}),/d$|^c/.test(f.readyState)?Ne():(t("load",Ne),f[i]("DOMContentLoaded",T),c(Ne,2e4)),m.elements.length?(Ce(),A._lsFlush()):T()},checkElems:T=function(e){var t;(e=!0===e)&&(x=33),te||(te=!0,(t=ne-(s.now()-ae))<0&&(t=0),e||t<9?ie():c(ie,t))},unveil:F=function(e){var t,a,n,i;e._lazyRace||(!(i="auto"==(n=(a=se.test(e.nodeName))&&(e[y](h.sizesAttr)||e[y]("sizes"))))&&E||!a||!e[y]("src")&&!e.srcset||e.complete||r(e,h.errorClass)||!r(e,h.lazyClass))&&(t=v(e,"lazyunveilread").detail,i&&me.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,S++,ue(e,t,i,n,a))},_aLSL:Me},ze=d(function(e,t,a,n){var i,s,o;if(e._lazysizesWidth=n,e.setAttribute("sizes",n+="px"),H.test(t.nodeName||""))for(s=0,o=(i=t.getElementsByTagName("source")).length;s<o;s++)i[s].setAttribute("sizes",n);a.detail.dataAttr||b(e,a.detail)}),me={_:function(){he=f.getElementsByClassName(h.autosizesClass),t("resize",ye)},checkElems:ye=G(function(){var e,t=he.length;if(t)for(e=0;e<t;e++)we(he[e])}),updateElem:we},R=function(){!R.i&&f.getElementsByClassName&&(R.i=!0,me._(),J._())},c(function(){h.init&&R()}),m={cfg:h,autoSizer:me,loader:J,init:R,uP:b,aC:u,rC:g,hC:r,fire:v,gW:$,rAF:A}):{init:function(){},cfg:h,noSupport:!0};function pe(){var e=l;for(l=U.length?j:U,I=!(q=!0);e.length;)e.shift()();q=!1}function ve(e,t){q&&!t?e.apply(this,arguments):(l.push(e),I||(I=!0,(f.hidden?c:k)(pe)))}function be(e){S--,e&&!(S<0)&&e.target||(S=0)}function Ce(){var e,t,a,n,i,s,o,r,l,d,c,u=m.elements;if((_=h.loadMode)&&S<8&&(e=u.length)){for(t=0,B++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!re||m.prematureUnveil&&m.prematureUnveil(u[t]))F(u[t]);else if((o=u[t][y]("data-expand"))&&(i=+o)||(i=W),l||(l=!h.expand||h.expand<1?500<z.clientHeight&&500<z.clientWidth?500:370:h.expand,d=(m._defEx=l)*h.expFactor,c=h.hFac,Z=null,W<d&&S<1&&2<B&&2<_&&!f.hidden?(W=d,B=0):W=1<_&&1<B&&S<6?l:0),r!==i&&(X=innerWidth+i*c,Y=innerHeight+i,s=-1*i,r=i),d=u[t].getBoundingClientRect(),(L=d.bottom)>=s&&(M=d.top)<=Y&&(w=d.right)>=s*c&&(N=d.left)<=X&&(L||w||N||M)&&(h.loadHidden||le(u[t]))&&(E&&S<3&&!o&&(_<3||B<4)||function(e,t){var a,n=e,i=le(e);for(M-=t,L+=t,N-=t,w+=t;i&&(n=n.offsetParent)&&n!=f.body&&n!=z;)(i=0<(C(n,"opacity")||1))&&"visible"!=C(n,"overflow")&&(a=n.getBoundingClientRect(),i=w>a.left&&N<a.right&&L>a.top-1&&M<a.bottom+1);return i}(u[t],i))){if(F(u[t]),n=!0,9<S)break}else!n&&E&&!a&&S<4&&B<4&&2<_&&(K[0]||h.preloadAfterLoad)&&(K[0]||!o&&(L||w||N||M||"auto"!=u[t][y](h.sizesAttr)))&&(a=K[0]||u[t]);a&&!n&&F(a)}}function Ae(){te=!1,ae=s.now(),ee()}function Ee(e){var t=e.target;t._lazyCache?delete t._lazyCache:(be(e),u(t,h.loadedClass),g(t,h.loadingClass),p(t,ce),v(t,"lazyloaded"))}function _e(e){var t,a=e[y](h.srcsetAttr);(t=h.customMedia[e[y]("data-media")||e[y]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function Me(){3==h.loadMode&&(h.loadMode=2),fe()}function Ne(){E||(s.now()-V<999?c(Ne,999):(E=!0,h.loadMode=3,T(),t("scroll",Me,!0)))}function we(e,t,a){var n=e.parentNode;n&&(a=$(e,n,a),(t=v(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&ze(e,n,t,a))}});
|
|
assets/js/js-front-end/breeze-prefetch-links.min.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
-
|
4 |
-
var timer,ready=e=>{"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)};function search_for_banned_links(e,t){var r=!1;if(e.length)for(i=0;i<e.length;i++)-1===t.indexOf(e[i])&&-1===e[i].indexOf(t)||(r=!0);return r}ready(()=>{var i=[];addEventListener("mouseover",function(e){var n;e.target instanceof HTMLAnchorElement&&(n=e.target.attributes.href.value,timer=setTimeout(function(){var e,t,r;"#"!==n&&(r=n.replace(breeze_prefetch.local_url,""),e=new URL(breeze_prefetch.local_url).host,t=new URL(n).host,""!==n.trim()&&!1===i.includes(n)&&e===t&&!1===search_for_banned_links(breeze_prefetch.ignore_list,r)&&(i.push(n.trim()),(r=document.createElement("link")).href=n,r.rel="prefetch",document.head.appendChild(r)))},150))}),addEventListener("mouseout",function(e){clearTimeout(timer)})});
|
1 |
/*! Created by Cloudways
|
2 |
+
On 29-09-2022 */
|
3 |
+
var timer,ready=e=>{"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)};function search_for_banned_links(e,t){var r=!1;if(e.length)for(i=0;i<e.length;i++)-1===t.indexOf(e[i])&&-1===e[i].indexOf(t)||(r=!0);return r}ready(()=>{var i=[];addEventListener("mouseover",function(e){var n;e.target instanceof HTMLAnchorElement&&(n=e.target.attributes.href.value,timer=setTimeout(function(){var e,t,r;"#"!==n&&(e=n.replace(breeze_prefetch.local_url,""),r=new URL(breeze_prefetch.local_url).host,t=new URL(n).host,""!==n.trim()&&!1===i.includes(n)&&r===t&&!1===search_for_banned_links(breeze_prefetch.ignore_list,e)&&(i.push(n.trim()),(r=document.createElement("link")).href=n,r.rel="prefetch",document.head.appendChild(r)))},150))}),addEventListener("mouseout",function(e){clearTimeout(timer)})});
|
|
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: 2.0.
|
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', '2.0.
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
@@ -185,6 +185,31 @@ require_once BREEZE_PLUGIN_DIR . 'inc/class-breeze-woocommerce-product-cache.php
|
|
185 |
// WP-CLI commands
|
186 |
require_once BREEZE_PLUGIN_DIR . 'inc/wp-cli/class-breeze-wp-cli-core.php';
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
/**
|
189 |
* This function will update htaccess files after the plugin update is done.
|
190 |
*
|
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: 2.0.10
|
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', '2.0.10' );
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
185 |
// WP-CLI commands
|
186 |
require_once BREEZE_PLUGIN_DIR . 'inc/wp-cli/class-breeze-wp-cli-core.php';
|
187 |
|
188 |
+
|
189 |
+
|
190 |
+
// Reset to default
|
191 |
+
add_action( 'breeze_reset_default', array( 'Breeze_Admin', 'plugin_deactive_hook' ), 80 );
|
192 |
+
|
193 |
+
add_action('init', function () {
|
194 |
+
|
195 |
+
if ( ! isset( $_GET['reset'] ) || $_GET['reset'] != 'default' ) {
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
|
199 |
+
$admin = new Breeze_Admin();
|
200 |
+
|
201 |
+
if ( $admin->reset_to_default() ) {
|
202 |
+
$route = $widget_id = str_replace('&reset=default', '',$_SERVER['REQUEST_URI']);;
|
203 |
+
|
204 |
+
$redirect_page = $route;
|
205 |
+
|
206 |
+
header('Location: ' . $redirect_page);
|
207 |
+
die();
|
208 |
+
}
|
209 |
+
|
210 |
+
});
|
211 |
+
|
212 |
+
|
213 |
/**
|
214 |
* This function will update htaccess files after the plugin update is done.
|
215 |
*
|
composer.lock
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_readme": [
|
3 |
-
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
-
"This file is @generated automatically"
|
6 |
-
],
|
7 |
-
"content-hash": "e7806260d775937d439159cde5165225",
|
8 |
-
"packages": [
|
9 |
-
{
|
10 |
-
"name": "matthiasmullie/minify",
|
11 |
-
"version": "1.3.66",
|
12 |
-
"source": {
|
13 |
-
"type": "git",
|
14 |
-
"url": "https://github.com/matthiasmullie/minify.git",
|
15 |
-
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6"
|
16 |
-
},
|
17 |
-
"dist": {
|
18 |
-
"type": "zip",
|
19 |
-
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
|
20 |
-
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
|
21 |
-
"shasum": ""
|
22 |
-
},
|
23 |
-
"require": {
|
24 |
-
"ext-pcre": "*",
|
25 |
-
"matthiasmullie/path-converter": "~1.1",
|
26 |
-
"php": ">=5.3.0"
|
27 |
-
},
|
28 |
-
"require-dev": {
|
29 |
-
"friendsofphp/php-cs-fixer": "~2.0",
|
30 |
-
"matthiasmullie/scrapbook": "dev-master",
|
31 |
-
"phpunit/phpunit": ">=4.8"
|
32 |
-
},
|
33 |
-
"suggest": {
|
34 |
-
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
35 |
-
},
|
36 |
-
"bin": [
|
37 |
-
"bin/minifycss",
|
38 |
-
"bin/minifyjs"
|
39 |
-
],
|
40 |
-
"type": "library",
|
41 |
-
"autoload": {
|
42 |
-
"psr-4": {
|
43 |
-
"MatthiasMullie\\Minify\\": "src/"
|
44 |
-
}
|
45 |
-
},
|
46 |
-
"notification-url": "https://packagist.org/downloads/",
|
47 |
-
"license": [
|
48 |
-
"MIT"
|
49 |
-
],
|
50 |
-
"authors": [
|
51 |
-
{
|
52 |
-
"name": "Matthias Mullie",
|
53 |
-
"email": "minify@mullie.eu",
|
54 |
-
"homepage": "http://www.mullie.eu",
|
55 |
-
"role": "Developer"
|
56 |
-
}
|
57 |
-
],
|
58 |
-
"description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.",
|
59 |
-
"homepage": "http://www.minifier.org",
|
60 |
-
"keywords": [
|
61 |
-
"JS",
|
62 |
-
"css",
|
63 |
-
"javascript",
|
64 |
-
"minifier",
|
65 |
-
"minify"
|
66 |
-
],
|
67 |
-
"support": {
|
68 |
-
"issues": "https://github.com/matthiasmullie/minify/issues",
|
69 |
-
"source": "https://github.com/matthiasmullie/minify/tree/1.3.66"
|
70 |
-
},
|
71 |
-
"funding": [
|
72 |
-
{
|
73 |
-
"url": "https://github.com/[user1",
|
74 |
-
"type": "github"
|
75 |
-
},
|
76 |
-
{
|
77 |
-
"url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.",
|
78 |
-
"type": "github"
|
79 |
-
},
|
80 |
-
{
|
81 |
-
"url": "https://github.com/user2",
|
82 |
-
"type": "github"
|
83 |
-
}
|
84 |
-
],
|
85 |
-
"time": "2021-01-06T15:18:10+00:00"
|
86 |
-
},
|
87 |
-
{
|
88 |
-
"name": "matthiasmullie/path-converter",
|
89 |
-
"version": "1.1.3",
|
90 |
-
"source": {
|
91 |
-
"type": "git",
|
92 |
-
"url": "https://github.com/matthiasmullie/path-converter.git",
|
93 |
-
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9"
|
94 |
-
},
|
95 |
-
"dist": {
|
96 |
-
"type": "zip",
|
97 |
-
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/e7d13b2c7e2f2268e1424aaed02085518afa02d9",
|
98 |
-
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9",
|
99 |
-
"shasum": ""
|
100 |
-
},
|
101 |
-
"require": {
|
102 |
-
"ext-pcre": "*",
|
103 |
-
"php": ">=5.3.0"
|
104 |
-
},
|
105 |
-
"require-dev": {
|
106 |
-
"phpunit/phpunit": "~4.8"
|
107 |
-
},
|
108 |
-
"type": "library",
|
109 |
-
"autoload": {
|
110 |
-
"psr-4": {
|
111 |
-
"MatthiasMullie\\PathConverter\\": "src/"
|
112 |
-
}
|
113 |
-
},
|
114 |
-
"notification-url": "https://packagist.org/downloads/",
|
115 |
-
"license": [
|
116 |
-
"MIT"
|
117 |
-
],
|
118 |
-
"authors": [
|
119 |
-
{
|
120 |
-
"name": "Matthias Mullie",
|
121 |
-
"email": "pathconverter@mullie.eu",
|
122 |
-
"homepage": "http://www.mullie.eu",
|
123 |
-
"role": "Developer"
|
124 |
-
}
|
125 |
-
],
|
126 |
-
"description": "Relative path converter",
|
127 |
-
"homepage": "http://github.com/matthiasmullie/path-converter",
|
128 |
-
"keywords": [
|
129 |
-
"converter",
|
130 |
-
"path",
|
131 |
-
"paths",
|
132 |
-
"relative"
|
133 |
-
],
|
134 |
-
"support": {
|
135 |
-
"issues": "https://github.com/matthiasmullie/path-converter/issues",
|
136 |
-
"source": "https://github.com/matthiasmullie/path-converter/tree/1.1.3"
|
137 |
-
},
|
138 |
-
"time": "2019-02-05T23:41:09+00:00"
|
139 |
-
}
|
140 |
-
],
|
141 |
-
"packages-dev": [],
|
142 |
-
"aliases": [],
|
143 |
-
"minimum-stability": "stable",
|
144 |
-
"stability-flags": [],
|
145 |
-
"prefer-stable": false,
|
146 |
-
"prefer-lowest": false,
|
147 |
-
"platform": [],
|
148 |
-
"platform-dev": [],
|
149 |
-
"plugin-api-version": "2.0.0"
|
150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/breeze-admin.php
CHANGED
@@ -189,6 +189,7 @@ class Breeze_Admin {
|
|
189 |
'breeze_save_options' => '',
|
190 |
'breeze_purge_opcache' => '',
|
191 |
'breeze_import_settings' => '',
|
|
|
192 |
);
|
193 |
|
194 |
// Only create the security nonce if the user has manage_options ( administrator capabilities ).
|
@@ -200,6 +201,7 @@ class Breeze_Admin {
|
|
200 |
'breeze_save_options' => wp_create_nonce( '_breeze_save_options' ),
|
201 |
'breeze_purge_opcache' => wp_create_nonce( '_breeze_purge_opcache' ),
|
202 |
'breeze_import_settings' => wp_create_nonce( '_breeze_import_settings' ),
|
|
|
203 |
);
|
204 |
}
|
205 |
|
@@ -356,6 +358,7 @@ class Breeze_Admin {
|
|
356 |
add_action( 'wp_ajax_breeze_purge_file', array( 'Breeze_Configuration', 'breeze_ajax_clean_cache' ) );
|
357 |
add_action( 'wp_ajax_breeze_purge_database', array( 'Breeze_Configuration', 'breeze_ajax_purge_database' ) );
|
358 |
add_action( 'wp_ajax_breeze_purge_opcache', array( 'Breeze_Configuration', 'breeze_ajax_purge_opcache' ) );
|
|
|
359 |
}
|
360 |
|
361 |
/*
|
@@ -695,6 +698,197 @@ class Breeze_Admin {
|
|
695 |
}
|
696 |
}
|
697 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
/*
|
699 |
* Register deactivate plugin hook.
|
700 |
*/
|
189 |
'breeze_save_options' => '',
|
190 |
'breeze_purge_opcache' => '',
|
191 |
'breeze_import_settings' => '',
|
192 |
+
'breeze_reset_default' => '',
|
193 |
);
|
194 |
|
195 |
// Only create the security nonce if the user has manage_options ( administrator capabilities ).
|
201 |
'breeze_save_options' => wp_create_nonce( '_breeze_save_options' ),
|
202 |
'breeze_purge_opcache' => wp_create_nonce( '_breeze_purge_opcache' ),
|
203 |
'breeze_import_settings' => wp_create_nonce( '_breeze_import_settings' ),
|
204 |
+
'breeze_reset_default' => wp_create_nonce( '_breeze_reset_default' ),
|
205 |
);
|
206 |
}
|
207 |
|
358 |
add_action( 'wp_ajax_breeze_purge_file', array( 'Breeze_Configuration', 'breeze_ajax_clean_cache' ) );
|
359 |
add_action( 'wp_ajax_breeze_purge_database', array( 'Breeze_Configuration', 'breeze_ajax_purge_database' ) );
|
360 |
add_action( 'wp_ajax_breeze_purge_opcache', array( 'Breeze_Configuration', 'breeze_ajax_purge_opcache' ) );
|
361 |
+
add_action( 'wp_ajax_breeze_reset_default', array( 'Breeze_Configuration', 'reset_to_default_ajax' ) );
|
362 |
}
|
363 |
|
364 |
/*
|
698 |
}
|
699 |
}
|
700 |
|
701 |
+
/**
|
702 |
+
* Reset all options to default
|
703 |
+
*
|
704 |
+
* @return bool
|
705 |
+
*/
|
706 |
+
public static function reset_to_default() {
|
707 |
+
|
708 |
+
if ( ! isset( $_GET['reset'] ) || $_GET['reset'] != 'default' ) {
|
709 |
+
return false;
|
710 |
+
}
|
711 |
+
// Default basic
|
712 |
+
$all_user_roles = breeze_all_wp_user_roles();
|
713 |
+
$active_cache_users = array();
|
714 |
+
foreach ( $all_user_roles as $usr_role ) {
|
715 |
+
$active_cache_users[ $usr_role ] = 0;
|
716 |
+
|
717 |
+
}
|
718 |
+
|
719 |
+
$default_basic = array(
|
720 |
+
'breeze-active' => '1',
|
721 |
+
'breeze-cross-origin' => '0',
|
722 |
+
'breeze-disable-admin' => $active_cache_users,
|
723 |
+
'breeze-gzip-compression' => '1',
|
724 |
+
'breeze-desktop-cache' => '1',
|
725 |
+
'breeze-mobile-cache' => '1',
|
726 |
+
'breeze-browser-cache' => '1',
|
727 |
+
'breeze-lazy-load' => '0',
|
728 |
+
'breeze-lazy-load-native' => '0',
|
729 |
+
'breeze-lazy-load-iframes' => '0',
|
730 |
+
'breeze-display-clean' => '1',
|
731 |
+
|
732 |
+
);
|
733 |
+
$basic = $default_basic;
|
734 |
+
|
735 |
+
// Default File
|
736 |
+
$default_file = array(
|
737 |
+
'breeze-minify-html' => '0',
|
738 |
+
// --
|
739 |
+
'breeze-minify-css' => '0',
|
740 |
+
'breeze-font-display-swap' => '0',
|
741 |
+
'breeze-group-css' => '0',
|
742 |
+
'breeze-exclude-css' => array(),
|
743 |
+
// --
|
744 |
+
'breeze-minify-js' => '0',
|
745 |
+
'breeze-group-js' => '0',
|
746 |
+
'breeze-include-inline-js' => '0',
|
747 |
+
'breeze-exclude-js' => array(),
|
748 |
+
'breeze-move-to-footer-js' => array(),
|
749 |
+
'breeze-defer-js' => array(),
|
750 |
+
'breeze-enable-js-delay' => '0',
|
751 |
+
'no-breeze-no-delay-js' => array(),
|
752 |
+
'breeze-delay-all-js' => '0',
|
753 |
+
);
|
754 |
+
|
755 |
+
$file = $default_file;
|
756 |
+
|
757 |
+
// Default Advanced
|
758 |
+
$default_advanced = array(
|
759 |
+
'breeze-exclude-urls' => array(),
|
760 |
+
'cached-query-strings' => array(),
|
761 |
+
'breeze-wp-emoji' => '0',
|
762 |
+
);
|
763 |
+
$default_heartbeat = array(
|
764 |
+
'breeze-control-heartbeat' => '0',
|
765 |
+
'breeze-heartbeat-front' => '',
|
766 |
+
'breeze-heartbeat-postedit' => '',
|
767 |
+
'breeze-heartbeat-backend' => '',
|
768 |
+
);
|
769 |
+
$heartbeat = $default_heartbeat;
|
770 |
+
|
771 |
+
$breeze_delay_js_scripts = array(
|
772 |
+
'gtag',
|
773 |
+
'document.write',
|
774 |
+
'html5.js',
|
775 |
+
'show_ads.js',
|
776 |
+
'google_ad',
|
777 |
+
'blogcatalog.com/w',
|
778 |
+
'tweetmeme.com/i',
|
779 |
+
'mybloglog.com/',
|
780 |
+
'histats.com/js',
|
781 |
+
'ads.smowtion.com/ad.js',
|
782 |
+
'statcounter.com/counter/counter.js',
|
783 |
+
'widgets.amung.us',
|
784 |
+
'ws.amazon.com/widgets',
|
785 |
+
'media.fastclick.net',
|
786 |
+
'/ads/',
|
787 |
+
'comment-form-quicktags/quicktags.php',
|
788 |
+
'edToolbar',
|
789 |
+
'intensedebate.com',
|
790 |
+
'scripts.chitika.net/',
|
791 |
+
'_gaq.push',
|
792 |
+
'jotform.com/',
|
793 |
+
'admin-bar.min.js',
|
794 |
+
'GoogleAnalyticsObject',
|
795 |
+
'plupload.full.min.js',
|
796 |
+
'syntaxhighlighter',
|
797 |
+
'adsbygoogle',
|
798 |
+
'gist.github.com',
|
799 |
+
'_stq',
|
800 |
+
'nonce',
|
801 |
+
'post_id',
|
802 |
+
'data-noptimize',
|
803 |
+
'googletagmanager',
|
804 |
+
);
|
805 |
+
breeze_update_option( 'advanced_settings_120', 'yes', true );
|
806 |
+
|
807 |
+
$advanced = $default_advanced;
|
808 |
+
|
809 |
+
//CDN default
|
810 |
+
$wp_content = substr( WP_CONTENT_DIR, strlen( ABSPATH ) );
|
811 |
+
$default_cdn = array(
|
812 |
+
'cdn-active' => '0',
|
813 |
+
'cdn-url' => '',
|
814 |
+
'cdn-content' => array( 'wp-includes', $wp_content ),
|
815 |
+
'cdn-exclude-content' => array( '.php' ),
|
816 |
+
'cdn-relative-path' => '1',
|
817 |
+
);
|
818 |
+
$cdn = $default_cdn;
|
819 |
+
|
820 |
+
|
821 |
+
// Preload default
|
822 |
+
$default_preload = array(
|
823 |
+
'breeze-preload-fonts' => array(),
|
824 |
+
'breeze-preload-links' => '0',
|
825 |
+
'breeze-prefetch-urls' => array(),
|
826 |
+
);
|
827 |
+
$preload = $default_preload;
|
828 |
+
|
829 |
+
// Varnish default
|
830 |
+
$default_varnish = array(
|
831 |
+
'auto-purge-varnish' => '1',
|
832 |
+
'breeze-varnish-server-ip' => '127.0.0.1',
|
833 |
+
'breeze-ttl' => 1440,
|
834 |
+
);
|
835 |
+
$varnish = $default_varnish;
|
836 |
+
|
837 |
+
if ( is_multisite() ) {
|
838 |
+
$network_wide = is_network_admin();
|
839 |
+
|
840 |
+
$blog_id = get_current_blog_id();
|
841 |
+
|
842 |
+
update_blog_option( $blog_id, 'breeze_basic_settings', $basic );
|
843 |
+
update_blog_option( $blog_id, 'breeze_advanced_settings', $advanced );
|
844 |
+
update_blog_option( $blog_id, 'breeze_heartbeat_settings', $heartbeat );
|
845 |
+
update_blog_option( $blog_id, 'breeze_preload_settings', $preload );
|
846 |
+
|
847 |
+
$blog_file = get_blog_option( $blog_id, 'breeze_file_settings', '' );
|
848 |
+
if ( isset( $breeze_delay_js_scripts ) ) {
|
849 |
+
if ( empty( $blog_file ) ) {
|
850 |
+
$save_file['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
|
851 |
+
} else {
|
852 |
+
$save_file = $blog_file;
|
853 |
+
$save_file['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
|
854 |
+
}
|
855 |
+
}
|
856 |
+
|
857 |
+
|
858 |
+
update_blog_option( $blog_id, 'breeze_file_settings', $save_file );
|
859 |
+
update_blog_option( $blog_id, 'breeze_cdn_integration', $cdn );
|
860 |
+
update_blog_option( $blog_id, 'breeze_varnish_cache', $varnish );
|
861 |
+
|
862 |
+
}
|
863 |
+
|
864 |
+
breeze_update_option( 'basic_settings', $basic );
|
865 |
+
breeze_update_option( 'advanced_settings', $advanced );
|
866 |
+
breeze_update_option( 'heartbeat_settings', $heartbeat );
|
867 |
+
breeze_update_option( 'preload_settings', $preload );
|
868 |
+
$save_advanced['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
|
869 |
+
breeze_update_option( 'file_settings', $save_advanced, true );
|
870 |
+
breeze_update_option( 'cdn_integration', $cdn );
|
871 |
+
breeze_update_option( 'varnish_cache', $varnish );
|
872 |
+
if ( $network_wide ) {
|
873 |
+
|
874 |
+
|
875 |
+
Breeze_ConfigCache::factory()->write_config_cache( true );
|
876 |
+
}
|
877 |
+
|
878 |
+
//add header to htaccess if setting is enabled or by default if first installed
|
879 |
+
Breeze_Configuration::update_htaccess();
|
880 |
+
|
881 |
+
//automatic config start cache
|
882 |
+
Breeze_ConfigCache::factory()->write();
|
883 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
884 |
+
|
885 |
+
if ( ! empty( $basic ) && ! empty( $basic['breeze-active'] ) ) {
|
886 |
+
Breeze_ConfigCache::factory()->toggle_caching( true );
|
887 |
+
}
|
888 |
+
|
889 |
+
return true;
|
890 |
+
}
|
891 |
+
|
892 |
/*
|
893 |
* Register deactivate plugin hook.
|
894 |
*/
|
inc/breeze-configuration.php
CHANGED
@@ -88,7 +88,6 @@ class Breeze_Configuration {
|
|
88 |
WP_Filesystem();
|
89 |
}
|
90 |
|
91 |
-
|
92 |
$response = array();
|
93 |
parse_str( $_POST['form-data'], $_POST );
|
94 |
|
@@ -259,7 +258,6 @@ class Breeze_Configuration {
|
|
259 |
check_ajax_referer( '_breeze_save_options', 'security' );
|
260 |
set_as_network_screen();
|
261 |
|
262 |
-
|
263 |
global $wp_filesystem;
|
264 |
|
265 |
if ( empty( $wp_filesystem ) ) {
|
@@ -271,7 +269,6 @@ class Breeze_Configuration {
|
|
271 |
$preload_fonts = array();
|
272 |
parse_str( $_POST['form-data'], $_POST );
|
273 |
|
274 |
-
|
275 |
if ( isset( $_POST['breeze-preload-font'] ) && ! empty( $_POST['breeze-preload-font'] ) ) {
|
276 |
foreach ( $_POST['breeze-preload-font'] as $font_url ) {
|
277 |
if ( '' === trim( $font_url ) ) {
|
@@ -1016,24 +1013,256 @@ class Breeze_Configuration {
|
|
1016 |
*/
|
1017 |
$all_transients = $wpdb->get_col(
|
1018 |
/* translators: comment type, comment type */
|
1019 |
-
$wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE
|
1020 |
-
$wpdb->esc_like( '
|
1021 |
-
$wpdb->esc_like( '_site_transient_' ) . '%'
|
1022 |
-
$wpdb->esc_like( '_transient_timeout' ) . '%'
|
1023 |
)
|
1024 |
);
|
1025 |
if ( ! empty( $all_transients ) ) {
|
1026 |
foreach ( $all_transients as $transient ) {
|
1027 |
if ( strpos( $transient, '_site_transient_' ) !== false ) {
|
1028 |
$transient_name = str_replace( '_site_transient_', '', $transient );
|
1029 |
-
delete_site_transient( $transient_name );
|
1030 |
} else {
|
1031 |
$transient_name = str_replace( '_transient_', '', $transient );
|
1032 |
-
delete_transient( $transient_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
}
|
1034 |
}
|
1035 |
}
|
1036 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1037 |
}
|
1038 |
|
1039 |
return true;
|
@@ -1092,12 +1321,97 @@ class Breeze_Configuration {
|
|
1092 |
case 'transient':
|
1093 |
$return = $wpdb->get_var(
|
1094 |
/* translators: comment type, comment type */
|
1095 |
-
$wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options WHERE
|
1096 |
$wpdb->esc_like( '_transient' ) . '%',
|
1097 |
-
$wpdb->esc_like( '_site_transient_' ) . '%'
|
1098 |
-
$wpdb->esc_like( '_transient_timeout' ) . '%'
|
1099 |
)
|
1100 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1101 |
break;
|
1102 |
}
|
1103 |
|
@@ -1204,14 +1518,52 @@ class Breeze_Configuration {
|
|
1204 |
set_as_network_screen();
|
1205 |
|
1206 |
$items = array(
|
1207 |
-
'post_revisions'
|
1208 |
-
'auto_drafts'
|
1209 |
-
'trashed_posts'
|
1210 |
-
'trashed_comments'
|
1211 |
-
'spam_comments'
|
1212 |
-
'trackbacks_pingbacks'
|
1213 |
-
'all_transients'
|
1214 |
-
'all'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
);
|
1216 |
|
1217 |
if ( isset( $_POST['action_type'] ) ) {
|
@@ -1290,6 +1642,224 @@ class Breeze_Configuration {
|
|
1290 |
}
|
1291 |
}
|
1292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1293 |
}
|
1294 |
|
1295 |
//init configuration object
|
88 |
WP_Filesystem();
|
89 |
}
|
90 |
|
|
|
91 |
$response = array();
|
92 |
parse_str( $_POST['form-data'], $_POST );
|
93 |
|
258 |
check_ajax_referer( '_breeze_save_options', 'security' );
|
259 |
set_as_network_screen();
|
260 |
|
|
|
261 |
global $wp_filesystem;
|
262 |
|
263 |
if ( empty( $wp_filesystem ) ) {
|
269 |
$preload_fonts = array();
|
270 |
parse_str( $_POST['form-data'], $_POST );
|
271 |
|
|
|
272 |
if ( isset( $_POST['breeze-preload-font'] ) && ! empty( $_POST['breeze-preload-font'] ) ) {
|
273 |
foreach ( $_POST['breeze-preload-font'] as $font_url ) {
|
274 |
if ( '' === trim( $font_url ) ) {
|
1013 |
*/
|
1014 |
$all_transients = $wpdb->get_col(
|
1015 |
/* translators: comment type, comment type */
|
1016 |
+
$wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s",
|
1017 |
+
$wpdb->esc_like( '_transient_' ) . '%',
|
1018 |
+
$wpdb->esc_like( '_site_transient_' ) . '%'
|
|
|
1019 |
)
|
1020 |
);
|
1021 |
if ( ! empty( $all_transients ) ) {
|
1022 |
foreach ( $all_transients as $transient ) {
|
1023 |
if ( strpos( $transient, '_site_transient_' ) !== false ) {
|
1024 |
$transient_name = str_replace( '_site_transient_', '', $transient );
|
1025 |
+
$is_deleted = delete_site_transient( $transient_name );
|
1026 |
} else {
|
1027 |
$transient_name = str_replace( '_transient_', '', $transient );
|
1028 |
+
$is_deleted = delete_transient( $transient_name );
|
1029 |
+
}
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
$data_sql = $wpdb->query(
|
1033 |
+
$wpdb->prepare( "DELETE FROM `$wpdb->options` WHERE `option_name` LIKE %s OR `option_name` LIKE %s",
|
1034 |
+
$wpdb->esc_like( '_transient_' ) . '%',
|
1035 |
+
$wpdb->esc_like( '_site_transient_' ) . '%' )
|
1036 |
+
);
|
1037 |
+
|
1038 |
+
}
|
1039 |
+
break;
|
1040 |
+
case 'orphan_post_meta':
|
1041 |
+
$the_query = $wpdb->get_results( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)" );
|
1042 |
+
if ( $the_query ) {
|
1043 |
+
foreach ( $the_query as $orphan_data ) {
|
1044 |
+
$post_id = (int) $orphan_data->post_id;
|
1045 |
+
// if $post_id is equal to zero then the entry was bugged/bad code, we delete the entry only
|
1046 |
+
if ( 0 === $post_id ) {
|
1047 |
+
$wpdb->query(
|
1048 |
+
$wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $orphan_data->meta_key )
|
1049 |
+
);
|
1050 |
+
} else {
|
1051 |
+
// If post ID exists, we can use WordPress function to delete the meta.
|
1052 |
+
delete_post_meta( $post_id, $orphan_data->meta_key );
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
break;
|
1058 |
+
case 'oembed_cache':
|
1059 |
+
$the_query = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE meta_key LIKE(%s)", '%_oembed_%' ) );
|
1060 |
+
if ( $the_query ) {
|
1061 |
+
foreach ( $the_query as $post_meta_data ) {
|
1062 |
+
$post_id = (int) $post_meta_data->post_id;
|
1063 |
+
// if $post_id is equal to zero then the entry was bugged/bad code, we delete the entry only.
|
1064 |
+
// Entries with zero value as $post_id are basically orphaned entries by default.
|
1065 |
+
if ( 0 === $post_id ) {
|
1066 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $post_meta_data->meta_key ) );
|
1067 |
+
} else {
|
1068 |
+
// If $post_id ID exists, we can use WordPress function to delete the meta.
|
1069 |
+
delete_post_meta( $post_id, $post_meta_data->meta_key );
|
1070 |
}
|
1071 |
}
|
1072 |
}
|
1073 |
break;
|
1074 |
+
case 'duplicated_post_meta':
|
1075 |
+
$the_query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS meta_ids, post_id, COUNT(*) AS count FROM $wpdb->postmeta GROUP BY post_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
1076 |
+
if ( $the_query ) {
|
1077 |
+
foreach ( $the_query as $post_meta ) {
|
1078 |
+
$post_meta_id_list = array_map( 'absint', explode( ',', $post_meta->meta_ids ) );
|
1079 |
+
// We need to make sure that at least one entry is remaining.
|
1080 |
+
array_pop( $post_meta_id_list );
|
1081 |
+
$implode_id_list = implode( ',', $post_meta_id_list );
|
1082 |
+
$wpdb->query(
|
1083 |
+
$wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_id IN ({$implode_id_list}) AND post_id = %d", $post_meta->post_id ) // phpcs:ignore
|
1084 |
+
);
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
break;
|
1088 |
+
case 'comments_unapproved':
|
1089 |
+
$the_query = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s", '0' ) );
|
1090 |
+
if ( $the_query ) {
|
1091 |
+
foreach ( $the_query as $comment_id ) {
|
1092 |
+
// it's best to use WP delete function.
|
1093 |
+
wp_delete_comment( (int) $comment_id, true );
|
1094 |
+
}
|
1095 |
+
}
|
1096 |
+
break;
|
1097 |
+
case 'comments_orphan_meta':
|
1098 |
+
$the_query = $wpdb->get_results( "SELECT comment_id, meta_key FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM $wpdb->comments)" );
|
1099 |
+
if ( $the_query ) {
|
1100 |
+
foreach ( $the_query as $orphan_data ) {
|
1101 |
+
$comment_id = (int) $orphan_data->comment_id;
|
1102 |
+
// if $comment_id is equal to zero then the entry was bugged/bad code, we delete the entry only.
|
1103 |
+
if ( 0 === $comment_id ) {
|
1104 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->commentmeta WHERE comment_id = %d AND meta_key = %s", $comment_id, $orphan_data->meta_key ) );
|
1105 |
+
} else {
|
1106 |
+
// If $comment_id ID exists, we can use WordPress function to delete the meta.
|
1107 |
+
delete_comment_meta( $comment_id, $orphan_data->meta_key );
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
+
}
|
1111 |
+
break;
|
1112 |
+
case 'comments_duplicate_meta':
|
1113 |
+
$the_query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS comment_ids, comment_id, COUNT(*) AS count FROM $wpdb->commentmeta GROUP BY comment_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
1114 |
+
if ( $the_query ) {
|
1115 |
+
foreach ( $the_query as $comment_meta ) {
|
1116 |
+
$comment_meta_id_list = array_map( 'absint', explode( ',', $comment_meta->comment_ids ) );
|
1117 |
+
// We need to make sure that at least one entry is remaining.
|
1118 |
+
array_pop( $comment_meta_id_list );
|
1119 |
+
$implode_id_list = implode( ',', $comment_meta_id_list );
|
1120 |
+
$wpdb->query(
|
1121 |
+
$wpdb->prepare( "DELETE FROM $wpdb->commentmeta WHERE meta_id IN ({$implode_id_list}) AND comment_id = %d", $comment_meta->comment_id ) // phpcs:ignore
|
1122 |
+
);
|
1123 |
+
}
|
1124 |
+
}
|
1125 |
+
break;
|
1126 |
+
case 'expired_transients':
|
1127 |
+
// get current PHP time, offset by a minute to avoid clashes with other tasks
|
1128 |
+
//$threshold = current_time( 'timestamp' ) - MINUTE_IN_SECONDS; // phpcs:ignore
|
1129 |
+
$threshold = time() - MINUTE_IN_SECONDS; // phpcs:ignore
|
1130 |
+
// Delete expired transients, using the paired timeout record to find them
|
1131 |
+
|
1132 |
+
/**
|
1133 |
+
* Function was added in WP 4.9.0
|
1134 |
+
*/
|
1135 |
+
if ( function_exists( 'delete_expired_transients' ) ) {
|
1136 |
+
delete_expired_transients( true );
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
|
1140 |
+
|
1141 |
+
$select_expired = $wpdb->get_results(
|
1142 |
+
$wpdb->prepare(
|
1143 |
+
"
|
1144 |
+
SELECT option_name
|
1145 |
+
FROM $wpdb->options
|
1146 |
+
WHERE (option_name LIKE %s OR option_name LIKE %s) AND CAST(option_value AS SIGNED) < %d
|
1147 |
+
",
|
1148 |
+
'\_transient\_timeout\_%',
|
1149 |
+
'\_site\_transient\_timeout\_%',
|
1150 |
+
$threshold
|
1151 |
+
)
|
1152 |
+
);
|
1153 |
+
|
1154 |
+
foreach ( $select_expired as $expired_transient ) {
|
1155 |
+
$the_timer = $expired_transient->option_name;
|
1156 |
+
|
1157 |
+
if ( strpos( $the_timer, '_site_transient_' ) !== false ) {
|
1158 |
+
$the_transient = str_replace( '_site_transient_timeout_', '_site_transient_', $the_timer );
|
1159 |
+
} else {
|
1160 |
+
$the_transient = str_replace( '_transient_timeout_', '_transient_', $the_timer );
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
$wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = %s", $the_transient ) );
|
1164 |
+
$wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = %s", $the_timer ) );
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
$is_network = false;
|
1168 |
+
|
1169 |
+
if ( isset( $_GET['is-network'] ) ) {
|
1170 |
+
$is_network = filter_var( $_GET['is-network'], FILTER_VALIDATE_BOOLEAN );
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
if ( isset( $_POST['is-network'] ) ) {
|
1174 |
+
$is_network = filter_var( $_POST['is-network'], FILTER_VALIDATE_BOOLEAN );
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
if ( is_multisite() && true === $is_network ) {
|
1178 |
+
$select_expired = $wpdb->get_results(
|
1179 |
+
$wpdb->prepare( "SELECT meta_key FROM $wpdb->sitemeta WHERE ( meta_key LIKE %s OR meta_key LIKE %s ) AND UNIX_TIMESTAMP(meta_value) < UNIX_TIMESTAMP(NOW())",
|
1180 |
+
'\_transient\_timeout\_%',
|
1181 |
+
'\_site\_transient\_timeout\_%'
|
1182 |
+
)
|
1183 |
+
);
|
1184 |
+
|
1185 |
+
foreach ( $select_expired as $expired_transient ) {
|
1186 |
+
$the_timer = $expired_transient->option_name;
|
1187 |
+
|
1188 |
+
if ( strpos( $the_timer, '_site_transient_' ) !== false ) {
|
1189 |
+
$the_transient = str_replace( '_site_transient_timeout_', '_site_transient_', $the_timer );
|
1190 |
+
} else {
|
1191 |
+
$the_transient = str_replace( '_transient_timeout_', '_transient_', $the_timer );
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
|
1195 |
+
$wpdb->prepare( "DELETE FROM $wpdb->sitemeta WHERE meta_key = %s", $the_transient );
|
1196 |
+
$wpdb->prepare( "DELETE FROM $wpdb->sitemeta WHERE meta_key = %s", $the_timer );
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
break;
|
1201 |
+
case 'orphan_user_meta':
|
1202 |
+
$the_query = $wpdb->get_results( "SELECT user_id, meta_key FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)" );
|
1203 |
+
if ( $the_query ) {
|
1204 |
+
foreach ( $the_query as $orphan_data ) {
|
1205 |
+
$user_id = (int) $orphan_data->user_id;
|
1206 |
+
// if $user_id is equal to zero then the entry was bugged/bad code, we delete the entry only.
|
1207 |
+
if ( 0 === $user_id ) {
|
1208 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $orphan_data->meta_key ) );
|
1209 |
+
} else {
|
1210 |
+
// If $user_id ID exists, we can use WordPress function to delete the meta.
|
1211 |
+
delete_user_meta( $user_id, $orphan_data->meta_key );
|
1212 |
+
}
|
1213 |
+
}
|
1214 |
+
}
|
1215 |
+
break;
|
1216 |
+
case 'duplicated_user_meta':
|
1217 |
+
$the_query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(umeta_id ORDER BY umeta_id DESC) AS user_meta_ids, user_id, COUNT(*) AS count FROM $wpdb->usermeta GROUP BY user_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
1218 |
+
if ( $the_query ) {
|
1219 |
+
foreach ( $the_query as $user_meta ) {
|
1220 |
+
$user_meta_id_list = array_map( 'absint', explode( ',', $user_meta->user_meta_ids ) );
|
1221 |
+
// We need to make sure that at least one entry is remaining.
|
1222 |
+
array_pop( $user_meta_id_list );
|
1223 |
+
$implode_id_list = implode( ',', $user_meta_id_list );
|
1224 |
+
$wpdb->query(
|
1225 |
+
$wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE umeta_id IN ({$implode_id_list}) AND user_id = %d", $user_meta->user_id ) // phpcs:ignore
|
1226 |
+
);
|
1227 |
+
}
|
1228 |
+
}
|
1229 |
+
break;
|
1230 |
+
case 'orphan_term_meta':
|
1231 |
+
$the_query = $wpdb->get_results( "SELECT term_id, meta_key FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)" );
|
1232 |
+
if ( $the_query ) {
|
1233 |
+
foreach ( $the_query as $orphan_data ) {
|
1234 |
+
$term_id = (int) $orphan_data->term_id;
|
1235 |
+
// if $term_id is equal to zero then the entry was bugged/bad code, we delete the entry only.
|
1236 |
+
if ( 0 === $term_id ) {
|
1237 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->termmeta WHERE term_id = %d AND meta_key = %s", $term_id, $orphan_data->meta_key ) );
|
1238 |
+
} else {
|
1239 |
+
// If $term_id ID exists, we can use WordPress function to delete the meta.
|
1240 |
+
delete_term_meta( $term_id, $orphan_data->meta_key );
|
1241 |
+
}
|
1242 |
+
}
|
1243 |
+
}
|
1244 |
+
break;
|
1245 |
+
case 'duplicated_term_meta':
|
1246 |
+
$the_query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS term_meta_ids, term_id, COUNT(*) AS count FROM $wpdb->termmeta GROUP BY term_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
1247 |
+
if ( $the_query ) {
|
1248 |
+
foreach ( $the_query as $term_meta ) {
|
1249 |
+
$term_meta_id_list = array_map( 'absint', explode( ',', $term_meta->term_meta_ids ) );
|
1250 |
+
// We need to make sure that at least one entry is remaining.
|
1251 |
+
array_pop( $term_meta_id_list );
|
1252 |
+
$implode_id_list = implode( ',', $term_meta_id_list );
|
1253 |
+
$wpdb->query(
|
1254 |
+
$wpdb->prepare( "DELETE FROM $wpdb->termmeta WHERE meta_id IN ({$implode_id_list}) AND term_id = %d", $term_meta->term_id ) // phpcs:ignore
|
1255 |
+
);
|
1256 |
+
}
|
1257 |
+
}
|
1258 |
+
break;
|
1259 |
+
case 'optimize_database':
|
1260 |
+
$all_db_tables = $wpdb->get_col( 'SHOW TABLES' );
|
1261 |
+
if ( $all_db_tables ) {
|
1262 |
+
$tables = implode( ',', $all_db_tables );
|
1263 |
+
$wpdb->query( "OPTIMIZE TABLE $tables" ); //phpcs:ignore
|
1264 |
+
}
|
1265 |
+
break;
|
1266 |
}
|
1267 |
|
1268 |
return true;
|
1321 |
case 'transient':
|
1322 |
$return = $wpdb->get_var(
|
1323 |
/* translators: comment type, comment type */
|
1324 |
+
$wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s",
|
1325 |
$wpdb->esc_like( '_transient' ) . '%',
|
1326 |
+
$wpdb->esc_like( '_site_transient_' ) . '%'
|
|
|
1327 |
)
|
1328 |
);
|
1329 |
+
|
1330 |
+
break;
|
1331 |
+
// Added after 2.0.7
|
1332 |
+
case 'comments_unapproved':
|
1333 |
+
// unapproved or Pending comments.
|
1334 |
+
$return = $wpdb->get_var(
|
1335 |
+
$wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = %s", '0' )
|
1336 |
+
);
|
1337 |
+
break;
|
1338 |
+
case 'comments_orphan_meta':
|
1339 |
+
// Check for meta with no existing comment as parent.
|
1340 |
+
$return = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM $wpdb->comments)" );
|
1341 |
+
break;
|
1342 |
+
case 'comments_duplicate_meta':
|
1343 |
+
$return = $wpdb->get_var(
|
1344 |
+
$wpdb->prepare( "SELECT COUNT(meta_id) AS COUNT FROM $wpdb->commentmeta GROUP BY comment_id, meta_key, meta_value HAVING count > %d", 1 )
|
1345 |
+
);
|
1346 |
+
break;
|
1347 |
+
case 'orphan_post_meta':
|
1348 |
+
$return = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)" );
|
1349 |
+
break;
|
1350 |
+
case 'duplicated_post_meta':
|
1351 |
+
$query = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT(meta_id) AS COUNT FROM $wpdb->postmeta GROUP BY post_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
1352 |
+
if ( is_array( $query ) ) {
|
1353 |
+
$return = array_sum( array_map( 'absint', $query ) );
|
1354 |
+
} else {
|
1355 |
+
$return = absint( $query );
|
1356 |
+
}
|
1357 |
+
break;
|
1358 |
+
case 'oembed_cache':
|
1359 |
+
$return = $wpdb->get_var(
|
1360 |
+
$wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE(%s)", '%_oembed_%' )
|
1361 |
+
);
|
1362 |
+
break;
|
1363 |
+
case 'expired_transients':
|
1364 |
+
// get current PHP time, offset by a minute to avoid clashes with other tasks
|
1365 |
+
$threshold = time() - MINUTE_IN_SECONDS; // phpcs:ignore
|
1366 |
+
|
1367 |
+
// count transient expiration records, expired
|
1368 |
+
$return = $wpdb->get_var(
|
1369 |
+
$wpdb->prepare(
|
1370 |
+
"
|
1371 |
+
SELECT COUNT(*)
|
1372 |
+
FROM $wpdb->options
|
1373 |
+
WHERE (option_name LIKE %s OR option_name LIKE %s) AND CAST(option_value AS SIGNED) < %d
|
1374 |
+
",
|
1375 |
+
'\_transient\_timeout\_%',
|
1376 |
+
'\_site\_transient\_timeout\_%',
|
1377 |
+
$threshold
|
1378 |
+
)
|
1379 |
+
);
|
1380 |
+
|
1381 |
+
break;
|
1382 |
+
case 'orphan_user_meta':
|
1383 |
+
$return = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)" );
|
1384 |
+
break;
|
1385 |
+
case 'duplicated_user_meta':
|
1386 |
+
$query = $wpdb->get_col(
|
1387 |
+
$wpdb->prepare( "SELECT COUNT(umeta_id) AS count FROM $wpdb->usermeta GROUP BY user_id, meta_key, meta_value HAVING count > %d", 1 )
|
1388 |
+
);
|
1389 |
+
if ( is_array( $query ) ) {
|
1390 |
+
$return = array_sum( array_map( 'absint', $query ) );
|
1391 |
+
} else {
|
1392 |
+
$return = absint( $query );
|
1393 |
+
}
|
1394 |
+
break;
|
1395 |
+
case 'orphan_term_meta':
|
1396 |
+
$return = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)" );
|
1397 |
+
break;
|
1398 |
+
case 'duplicated_term_meta':
|
1399 |
+
$query = $wpdb->get_var(
|
1400 |
+
$wpdb->prepare( "SELECT COUNT(meta_id) AS count FROM $wpdb->termmeta GROUP BY term_id, meta_key, meta_value HAVING count > %d", 1 )
|
1401 |
+
);
|
1402 |
+
|
1403 |
+
if ( is_array( $query ) ) {
|
1404 |
+
$return = array_sum( array_map( 'absint', $query ) );
|
1405 |
+
} else {
|
1406 |
+
$return = absint( $query );
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
break;
|
1410 |
+
case 'optimize_database':
|
1411 |
+
$return = $wpdb->get_var(
|
1412 |
+
$wpdb->prepare( 'SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE `TABLE_SCHEMA`=%s AND (`ENGINE`=%s OR `ENGINE`=%s OR `ENGINE`=%s)', DB_NAME, 'InnoDB', 'MyISAM', 'ARCHIVE' )
|
1413 |
+
);
|
1414 |
+
#$return = count( $wpdb->get_col( 'SHOW TABLES' ) );
|
1415 |
break;
|
1416 |
}
|
1417 |
|
1518 |
set_as_network_screen();
|
1519 |
|
1520 |
$items = array(
|
1521 |
+
'post_revisions' => array( 'revisions' ),
|
1522 |
+
'auto_drafts' => array( 'drafted' ),
|
1523 |
+
'trashed_posts' => array( 'trash' ),
|
1524 |
+
'trashed_comments' => array( 'comments_trash' ),
|
1525 |
+
'spam_comments' => array( 'comments_spam' ),
|
1526 |
+
'trackbacks_pingbacks' => array( 'trackbacks' ),
|
1527 |
+
'all_transients' => array( 'transient' ),
|
1528 |
+
'all' => array(
|
1529 |
+
'revisions',
|
1530 |
+
'drafted',
|
1531 |
+
'trash',
|
1532 |
+
'comments_trash',
|
1533 |
+
'comments_spam',
|
1534 |
+
'trackbacks',
|
1535 |
+
'transient',
|
1536 |
+
/**
|
1537 |
+
* @since 2.0.7
|
1538 |
+
*/
|
1539 |
+
'orphan_post_meta',
|
1540 |
+
'oembed_cache',
|
1541 |
+
'duplicated_post_meta',
|
1542 |
+
'comments_unapproved',
|
1543 |
+
'comments_orphan_meta',
|
1544 |
+
'comments_duplicate_meta',
|
1545 |
+
'expired_transients',
|
1546 |
+
'orphan_user_meta',
|
1547 |
+
'duplicated_user_meta',
|
1548 |
+
'orphan_term_meta',
|
1549 |
+
'duplicated_term_meta',
|
1550 |
+
'optimize_database',
|
1551 |
+
),
|
1552 |
+
/**
|
1553 |
+
* @since 2.0.7
|
1554 |
+
*/
|
1555 |
+
'orphan_post_meta' => array( 'orphan_post_meta' ),
|
1556 |
+
'oembed_cache' => array( 'oembed_cache' ),
|
1557 |
+
'duplicated_post_meta' => array( 'duplicated_post_meta' ),
|
1558 |
+
'comments_unapproved' => array( 'comments_unapproved' ),
|
1559 |
+
'comments_orphan_meta' => array( 'comments_orphan_meta' ),
|
1560 |
+
'comments_duplicate_meta' => array( 'comments_duplicate_meta' ),
|
1561 |
+
'expired_transients' => array( 'expired_transients' ),
|
1562 |
+
'orphan_user_meta' => array( 'orphan_user_meta' ),
|
1563 |
+
'duplicated_user_meta' => array( 'duplicated_user_meta' ),
|
1564 |
+
'orphan_term_meta' => array( 'orphan_term_meta' ),
|
1565 |
+
'duplicated_term_meta' => array( 'duplicated_term_meta' ),
|
1566 |
+
'optimize_database' => array( 'optimize_database' ),
|
1567 |
);
|
1568 |
|
1569 |
if ( isset( $_POST['action_type'] ) ) {
|
1642 |
}
|
1643 |
}
|
1644 |
|
1645 |
+
|
1646 |
+
/**
|
1647 |
+
* Function to reach by ajax to reset all options to default
|
1648 |
+
*
|
1649 |
+
* @return void
|
1650 |
+
*/
|
1651 |
+
public static function reset_to_default_ajax() {
|
1652 |
+
breeze_is_restricted_access();
|
1653 |
+
check_ajax_referer( '_breeze_reset_default', 'security' );
|
1654 |
+
set_as_network_screen();
|
1655 |
+
|
1656 |
+
$response = self::reset_to_default();
|
1657 |
+
wp_send_json( array( 'success' => $response ) );
|
1658 |
+
}
|
1659 |
+
|
1660 |
+
/**
|
1661 |
+
* Reset all options to default
|
1662 |
+
*
|
1663 |
+
* @return bool
|
1664 |
+
*/
|
1665 |
+
public static function reset_to_default( $blog_id = null ) {
|
1666 |
+
|
1667 |
+
// Default basic
|
1668 |
+
$all_user_roles = breeze_all_wp_user_roles();
|
1669 |
+
$active_cache_users = array();
|
1670 |
+
foreach ( $all_user_roles as $usr_role ) {
|
1671 |
+
$active_cache_users[ $usr_role ] = 0;
|
1672 |
+
|
1673 |
+
}
|
1674 |
+
|
1675 |
+
$default_basic = array(
|
1676 |
+
'breeze-active' => '1',
|
1677 |
+
'breeze-cross-origin' => '0',
|
1678 |
+
'breeze-disable-admin' => $active_cache_users,
|
1679 |
+
'breeze-gzip-compression' => '1',
|
1680 |
+
'breeze-desktop-cache' => '1',
|
1681 |
+
'breeze-mobile-cache' => '1',
|
1682 |
+
'breeze-browser-cache' => '1',
|
1683 |
+
'breeze-lazy-load' => '0',
|
1684 |
+
'breeze-lazy-load-native' => '0',
|
1685 |
+
'breeze-lazy-load-iframes' => '0',
|
1686 |
+
'breeze-display-clean' => '1',
|
1687 |
+
|
1688 |
+
);
|
1689 |
+
$basic = $default_basic;
|
1690 |
+
|
1691 |
+
// Default File
|
1692 |
+
$default_file = array(
|
1693 |
+
'breeze-minify-html' => '0',
|
1694 |
+
// --
|
1695 |
+
'breeze-minify-css' => '0',
|
1696 |
+
'breeze-font-display-swap' => '0',
|
1697 |
+
'breeze-group-css' => '0',
|
1698 |
+
'breeze-exclude-css' => array(),
|
1699 |
+
// --
|
1700 |
+
'breeze-minify-js' => '0',
|
1701 |
+
'breeze-group-js' => '0',
|
1702 |
+
'breeze-include-inline-js' => '0',
|
1703 |
+
'breeze-exclude-js' => array(),
|
1704 |
+
'breeze-move-to-footer-js' => array(),
|
1705 |
+
'breeze-defer-js' => array(),
|
1706 |
+
'breeze-enable-js-delay' => '0',
|
1707 |
+
'no-breeze-no-delay-js' => array(),
|
1708 |
+
'breeze-delay-all-js' => '0',
|
1709 |
+
);
|
1710 |
+
|
1711 |
+
$file = $default_file;
|
1712 |
+
|
1713 |
+
// Default Advanced
|
1714 |
+
$default_advanced = array(
|
1715 |
+
'breeze-exclude-urls' => array(),
|
1716 |
+
'cached-query-strings' => array(),
|
1717 |
+
'breeze-wp-emoji' => '0',
|
1718 |
+
);
|
1719 |
+
$default_heartbeat = array(
|
1720 |
+
'breeze-control-heartbeat' => '0',
|
1721 |
+
'breeze-heartbeat-front' => '',
|
1722 |
+
'breeze-heartbeat-postedit' => '',
|
1723 |
+
'breeze-heartbeat-backend' => '',
|
1724 |
+
);
|
1725 |
+
$heartbeat = $default_heartbeat;
|
1726 |
+
|
1727 |
+
$breeze_delay_js_scripts = array(
|
1728 |
+
'gtag',
|
1729 |
+
'document.write',
|
1730 |
+
'html5.js',
|
1731 |
+
'show_ads.js',
|
1732 |
+
'google_ad',
|
1733 |
+
'blogcatalog.com/w',
|
1734 |
+
'tweetmeme.com/i',
|
1735 |
+
'mybloglog.com/',
|
1736 |
+
'histats.com/js',
|
1737 |
+
'ads.smowtion.com/ad.js',
|
1738 |
+
'statcounter.com/counter/counter.js',
|
1739 |
+
'widgets.amung.us',
|
1740 |
+
'ws.amazon.com/widgets',
|
1741 |
+
'media.fastclick.net',
|
1742 |
+
'/ads/',
|
1743 |
+
'comment-form-quicktags/quicktags.php',
|
1744 |
+
'edToolbar',
|
1745 |
+
'intensedebate.com',
|
1746 |
+
'scripts.chitika.net/',
|
1747 |
+
'_gaq.push',
|
1748 |
+
'jotform.com/',
|
1749 |
+
'admin-bar.min.js',
|
1750 |
+
'GoogleAnalyticsObject',
|
1751 |
+
'plupload.full.min.js',
|
1752 |
+
'syntaxhighlighter',
|
1753 |
+
'adsbygoogle',
|
1754 |
+
'gist.github.com',
|
1755 |
+
'_stq',
|
1756 |
+
'nonce',
|
1757 |
+
'post_id',
|
1758 |
+
'data-noptimize',
|
1759 |
+
'googletagmanager',
|
1760 |
+
);
|
1761 |
+
breeze_update_option( 'advanced_settings_120', 'yes', true );
|
1762 |
+
|
1763 |
+
$advanced = $default_advanced;
|
1764 |
+
|
1765 |
+
//CDN default
|
1766 |
+
$wp_content = substr( WP_CONTENT_DIR, strlen( ABSPATH ) );
|
1767 |
+
$default_cdn = array(
|
1768 |
+
'cdn-active' => '0',
|
1769 |
+
'cdn-url' => '',
|
1770 |
+
'cdn-content' => array( 'wp-includes', $wp_content ),
|
1771 |
+
'cdn-exclude-content' => array( '.php' ),
|
1772 |
+
'cdn-relative-path' => '1',
|
1773 |
+
);
|
1774 |
+
$cdn = $default_cdn;
|
1775 |
+
|
1776 |
+
// Preload default
|
1777 |
+
$default_preload = array(
|
1778 |
+
'breeze-preload-fonts' => array(),
|
1779 |
+
'breeze-preload-links' => '0',
|
1780 |
+
'breeze-prefetch-urls' => array(),
|
1781 |
+
);
|
1782 |
+
$preload = $default_preload;
|
1783 |
+
|
1784 |
+
// Varnish default
|
1785 |
+
$default_varnish = array(
|
1786 |
+
'auto-purge-varnish' => '1',
|
1787 |
+
'breeze-varnish-server-ip' => '127.0.0.1',
|
1788 |
+
'breeze-ttl' => 1440,
|
1789 |
+
);
|
1790 |
+
$varnish = $default_varnish;
|
1791 |
+
|
1792 |
+
if ( is_multisite() ) {
|
1793 |
+
|
1794 |
+
if ( $blog_id == 'network' ) {
|
1795 |
+
breeze_update_option( 'basic_settings', $basic );
|
1796 |
+
|
1797 |
+
breeze_update_option( 'advanced_settings', $advanced );
|
1798 |
+
|
1799 |
+
breeze_update_option( 'heartbeat_settings', $heartbeat );
|
1800 |
+
|
1801 |
+
breeze_update_option( 'preload_settings', $preload );
|
1802 |
+
|
1803 |
+
$save_advanced = $file;
|
1804 |
+
|
1805 |
+
$save_advanced['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
|
1806 |
+
|
1807 |
+
breeze_update_option( 'file_settings', $save_advanced, true );
|
1808 |
+
|
1809 |
+
breeze_update_option( 'cdn_integration', $cdn );
|
1810 |
+
breeze_update_option( 'varnish_cache', $varnish );
|
1811 |
+
} else {
|
1812 |
+
if ( ! $blog_id ) {
|
1813 |
+
$blog_id = get_current_blog_id();
|
1814 |
+
}
|
1815 |
+
|
1816 |
+
update_blog_option( $blog_id, 'breeze_basic_settings', $basic );
|
1817 |
+
update_blog_option( $blog_id, 'breeze_advanced_settings', $advanced );
|
1818 |
+
update_blog_option( $blog_id, 'breeze_heartbeat_settings', $heartbeat );
|
1819 |
+
update_blog_option( $blog_id, 'breeze_preload_settings', $preload );
|
1820 |
+
|
1821 |
+
$save_file = $file;
|
1822 |
+
$save_file['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
|
1823 |
+
|
1824 |
+
update_blog_option( $blog_id, 'breeze_file_settings', $save_file );
|
1825 |
+
}
|
1826 |
+
|
1827 |
+
|
1828 |
+
Breeze_ConfigCache::factory()->write_config_cache( true );
|
1829 |
+
} else {
|
1830 |
+
breeze_update_option( 'basic_settings', $basic );
|
1831 |
+
breeze_update_option( 'advanced_settings', $advanced );
|
1832 |
+
breeze_update_option( 'heartbeat_settings', $heartbeat );
|
1833 |
+
breeze_update_option( 'preload_settings', $preload );
|
1834 |
+
|
1835 |
+
$save_advanced = $file;
|
1836 |
+
|
1837 |
+
$save_advanced['breeze-delay-js-scripts'] = $breeze_delay_js_scripts;
|
1838 |
+
|
1839 |
+
breeze_update_option( 'file_settings', $save_advanced, true );
|
1840 |
+
|
1841 |
+
breeze_update_option( 'cdn_integration', $cdn );
|
1842 |
+
|
1843 |
+
breeze_update_option( 'varnish_cache', $varnish );
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
//add header to htaccess if setting is enabled or by default if first installed
|
1847 |
+
Breeze_Configuration::update_htaccess();
|
1848 |
+
|
1849 |
+
//automatic config start cache
|
1850 |
+
Breeze_ConfigCache::factory()->write();
|
1851 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
1852 |
+
|
1853 |
+
if ( ! empty( $basic ) && ! empty( $basic['breeze-active'] ) ) {
|
1854 |
+
Breeze_ConfigCache::factory()->toggle_caching( true );
|
1855 |
+
}
|
1856 |
+
|
1857 |
+
//delete cache after settings
|
1858 |
+
do_action( 'breeze_clear_all_cache' );
|
1859 |
+
|
1860 |
+
return true;
|
1861 |
+
}
|
1862 |
+
|
1863 |
}
|
1864 |
|
1865 |
//init configuration object
|
inc/cache/execute-cache.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
/*
|
3 |
* Based on some work of https://github.com/tlovett1/simple-cache/blob/master/inc/dropins/file-based-page-cache.php
|
4 |
*/
|
|
|
5 |
namespace Breeze_Cache_Init;
|
6 |
|
7 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -285,53 +286,68 @@ function breeze_cache( $buffer, $flags ) {
|
|
285 |
}
|
286 |
|
287 |
if ( isset( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'] ) && filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'], FILTER_VALIDATE_BOOLEAN ) ) {
|
288 |
-
|
289 |
-
|
|
|
290 |
|
291 |
$home_url = $GLOBALS['breeze_config']['homepage'];
|
292 |
$home_url = ltrim( $home_url, 'https:' );
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
if (
|
300 |
-
|
301 |
-
|
302 |
-
false
|
|
|
303 |
) {
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
$replacement_rel
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
} elseif ( false === strpos( $anchor_attributed['rel'], 'noopener' ) ) {
|
319 |
-
$replacement_rel = 'noopener';
|
320 |
-
} elseif ( false === strpos( $anchor_attributed['rel'], 'noreferrer' ) ) {
|
321 |
-
$replacement_rel = 'noreferrer';
|
322 |
-
}
|
323 |
-
$replacement_rel .= ' ' . $anchor_attributed['rel'];
|
324 |
-
$html_a_tag_replace = preg_replace( '/(<[^>]+) rel=".*?"/i', '$1', $html_a_tag );
|
325 |
-
}
|
326 |
-
$html_a_tag_rel = preg_replace( '/(<a\b[^><]*)>/i', '$1 rel="' . $replacement_rel . '">', $html_a_tag_replace );
|
327 |
-
$buffer = str_replace( $html_a_tag, $html_a_tag_rel, $buffer );
|
328 |
}
|
329 |
-
|
330 |
-
|
331 |
|
|
|
332 |
}
|
333 |
}
|
334 |
}
|
|
|
|
|
|
|
335 |
}
|
336 |
|
337 |
$data = serialize(
|
@@ -403,9 +419,9 @@ function breeze_cache( $buffer, $flags ) {
|
|
403 |
if ( in_array( $ini_output_compression, $array_values ) ) {
|
404 |
return $buffer;
|
405 |
} else {
|
406 |
-
if(defined('RedisCachePro\Version')){
|
407 |
return $buffer;
|
408 |
-
}else{
|
409 |
return ob_gzhandler( $buffer, $flags );
|
410 |
}
|
411 |
}
|
2 |
/*
|
3 |
* Based on some work of https://github.com/tlovett1/simple-cache/blob/master/inc/dropins/file-based-page-cache.php
|
4 |
*/
|
5 |
+
|
6 |
namespace Breeze_Cache_Init;
|
7 |
|
8 |
if ( ! defined( 'ABSPATH' ) ) {
|
286 |
}
|
287 |
|
288 |
if ( isset( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'] ) && filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'], FILTER_VALIDATE_BOOLEAN ) ) {
|
289 |
+
|
290 |
+
|
291 |
+
// ------------------------------------------------------------------------------------------
|
292 |
|
293 |
$home_url = $GLOBALS['breeze_config']['homepage'];
|
294 |
$home_url = ltrim( $home_url, 'https:' );
|
295 |
|
296 |
+
$html_dom = new \DOMDocument();
|
297 |
+
$html_dom->preserveWhiteSpace = false;// phpcs:ignore
|
298 |
+
$html_dom->formatOutput = false;// phpcs:ignore
|
299 |
+
|
300 |
+
libxml_use_internal_errors( true );
|
301 |
+
$html_dom->loadHTML( $buffer, LIBXML_NOERROR ); // | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD
|
302 |
+
|
303 |
+
$dom_last_error = libxml_get_last_error();
|
304 |
+
$dom_all_error = libxml_get_errors();
|
305 |
+
|
306 |
+
$dom_xpath = new \DOMXPath( $html_dom );
|
307 |
+
$replacement_rel = 'noopener noreferrer';
|
308 |
+
$noopener_rel = 'noopener';
|
309 |
+
$noreferrer_rel = 'noreferrer';
|
310 |
+
/**
|
311 |
+
* Fetch all images
|
312 |
+
*/
|
313 |
+
$dom_href_item = $dom_xpath->query( '//a' );
|
314 |
+
if ( ! is_null( $dom_href_item ) ) {
|
315 |
+
foreach ( $dom_href_item as $href_element ) {
|
316 |
+
|
317 |
+
$the_item_url = $href_element->getAttribute( 'href' );
|
318 |
+
$the_href_blank = $href_element->getAttribute( 'target' );
|
319 |
+
$the_rel_target = $href_element->getAttribute( 'rel' );
|
320 |
if (
|
321 |
+
! empty( $the_item_url ) &&
|
322 |
+
filter_var( $the_item_url, FILTER_VALIDATE_URL ) &&
|
323 |
+
false === strpos( $the_item_url, $home_url ) &&
|
324 |
+
false !== strpos( $the_href_blank, '_blank' )
|
325 |
) {
|
326 |
+
|
327 |
+
if ( is_null( $the_rel_target ) ) {
|
328 |
+
$href_element->removeAttribute( 'rel' );
|
329 |
+
$href_element->setAttribute( 'rel', $replacement_rel );
|
330 |
+
} else {
|
331 |
+
$href_element->removeAttribute( 'rel' );
|
332 |
+
if ( false === strpos( $the_rel_target, 'noopener' ) && false === strpos( $the_rel_target, 'noreferrer' ) ) {
|
333 |
+
$replacement_rel = 'noopener noreferrer';
|
334 |
+
} elseif ( false === strpos( $the_rel_target, 'noreferrer' ) && false !== strpos( $the_rel_target, 'noopener' ) ) {
|
335 |
+
$replacement_rel = $noopener_rel;
|
336 |
+
} elseif ( false === strpos( $the_rel_target, 'noopener' ) && false !== strpos( $the_rel_target, 'noreferrer' ) ) {
|
337 |
+
$replacement_rel = $noreferrer_rel;
|
338 |
+
} else {
|
339 |
+
$replacement_rel = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
+
$the_rel_target .= ' ' . $replacement_rel;
|
342 |
+
$href_element->setAttribute( 'rel', $the_rel_target );
|
343 |
|
344 |
+
}
|
345 |
}
|
346 |
}
|
347 |
}
|
348 |
+
$buffer = $html_dom->saveHTML();
|
349 |
+
// ------------------------------------------------------------------------------------------
|
350 |
+
|
351 |
}
|
352 |
|
353 |
$data = serialize(
|
419 |
if ( in_array( $ini_output_compression, $array_values ) ) {
|
420 |
return $buffer;
|
421 |
} else {
|
422 |
+
if ( defined( 'RedisCachePro\Version' ) ) {
|
423 |
return $buffer;
|
424 |
+
} else {
|
425 |
return ob_gzhandler( $buffer, $flags );
|
426 |
}
|
427 |
}
|
inc/cache/purge-cache.php
CHANGED
@@ -130,7 +130,11 @@ class Breeze_PurgeCache {
|
|
130 |
$post_type = get_post_type( $post->ID );
|
131 |
|
132 |
$flush_cache = true;
|
133 |
-
|
|
|
|
|
|
|
|
|
134 |
$flush_cache = false;
|
135 |
}
|
136 |
}
|
130 |
$post_type = get_post_type( $post->ID );
|
131 |
|
132 |
$flush_cache = true;
|
133 |
+
$ignore_object_cache = array(
|
134 |
+
'tribe_events',
|
135 |
+
'shop_order',
|
136 |
+
);
|
137 |
+
if ( in_array( $post_type, $ignore_object_cache ) ) {
|
138 |
$flush_cache = false;
|
139 |
}
|
140 |
}
|
inc/helpers/class-breeze-db-summary-table.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
global $hook_suffix;
|
4 |
+
$hook_suffix = 'breeze_display_db_summary';
|
5 |
+
|
6 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
7 |
+
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
8 |
+
}
|
9 |
+
|
10 |
+
class Breeze_Db_Summary_List_Table extends WP_List_Table {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Table header slugs and header titles
|
14 |
+
*
|
15 |
+
* @var string[]
|
16 |
+
*/
|
17 |
+
var $table_columns = array(
|
18 |
+
'number' => '#',
|
19 |
+
'table_name' => 'Name',
|
20 |
+
'table_size' => 'Size',
|
21 |
+
);
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get table columns
|
25 |
+
*
|
26 |
+
* @return array|string[]
|
27 |
+
*/
|
28 |
+
public function get_columns() {
|
29 |
+
return $this->table_columns;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Prepare items before displaying
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
public function prepare_items() {
|
38 |
+
$data = $this->get_data();
|
39 |
+
|
40 |
+
$columns = $this->get_columns();
|
41 |
+
$hidden = array();
|
42 |
+
$sortable = array();
|
43 |
+
$this->_column_headers = array( $columns, $hidden, $sortable );
|
44 |
+
$this->items = $data;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get database schema data
|
49 |
+
*
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
public function get_data() {
|
53 |
+
global $wpdb;
|
54 |
+
|
55 |
+
$summary = $wpdb->get_results( "SELECT option_name, char_length(option_value) AS option_value_length FROM `$wpdb->options` WHERE autoload='yes' ORDER BY option_value_length DESC LIMIT 30", ARRAY_A );
|
56 |
+
|
57 |
+
$table_formatted = [];
|
58 |
+
$n = 0;
|
59 |
+
foreach ( $summary as $key => $table ) {
|
60 |
+
if ( $table['option_value_length'] == '0' ) {
|
61 |
+
continue;
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
$table_formatted[ $key ]['number'] = $n ++;
|
66 |
+
$table_formatted[ $key ]['table_name'] = $table['option_name'];
|
67 |
+
$table_formatted[ $key ]['table_size'] = round( $table['option_value_length'] / 1024, 2 );
|
68 |
+
}
|
69 |
+
|
70 |
+
return $table_formatted;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Output the overall statistics of the database
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
public function get_statistics() {
|
79 |
+
global $wpdb;
|
80 |
+
$summary_size = floatval( $wpdb->get_var( "SELECT ( sum(char_length(option_value) ) / 1024 ) FROM `$wpdb->options` WHERE autoload='yes'" ) );
|
81 |
+
$summary_count = floatval( $wpdb->get_var( "SELECT count(*) FROM `$wpdb->options` WHERE autoload='yes'" ) );
|
82 |
+
|
83 |
+
$class = 'normal';
|
84 |
+
|
85 |
+
if ( $summary_size > 900 ) {
|
86 |
+
$class = 'critical';
|
87 |
+
}
|
88 |
+
|
89 |
+
$markup_output = '<h4 class="' . $class . ' db-summary-size" >' . __( 'Autoload Total Size: ', 'breeze' ) . round( $summary_size, 2 ) . ' KB</h4>';
|
90 |
+
$markup_output .= '<h5 class="db-summary-count">' . __( 'Autoload Count: ', 'breeze' ) . $summary_count . '</h5>';
|
91 |
+
|
92 |
+
return $markup_output;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Default column display
|
97 |
+
*
|
98 |
+
* @param $item
|
99 |
+
* @param $column_name
|
100 |
+
*
|
101 |
+
* @return bool|mixed|string|void
|
102 |
+
*/
|
103 |
+
public function column_default( $item, $column_name ) {
|
104 |
+
switch ( $column_name ) {
|
105 |
+
case 'number':
|
106 |
+
case 'table_name':
|
107 |
+
return $item[ $column_name ];
|
108 |
+
case 'table_size':
|
109 |
+
return $item[ $column_name ] . ' KB';
|
110 |
+
default:
|
111 |
+
return print_r( $item, true ); //Show the whole array for troubleshooting purposes
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
inc/minification/breeze-minification-scripts.php
CHANGED
@@ -152,6 +152,14 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
152 |
return false;
|
153 |
}
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
$this->delay_javascript = $options['delay_javascript'];
|
156 |
$this->is_inline_delay_on = $options['is_inline_delay_on'];
|
157 |
// only optimize known good JS?
|
152 |
return false;
|
153 |
}
|
154 |
|
155 |
+
|
156 |
+
if(false === $this->group_js && false === $this->include_inline){
|
157 |
+
$this->donotmove_exception[] = '/wp-includes/js/dist/i18n.js';
|
158 |
+
$this->donotmove_exception[] = '/wp-includes/js/dist/i18n.min.js';
|
159 |
+
$this->dontmove[] = '/wp-includes/js/dist/i18n.js';
|
160 |
+
$this->dontmove[] = '/wp-includes/js/dist/i18n.min.js';
|
161 |
+
}
|
162 |
+
|
163 |
$this->delay_javascript = $options['delay_javascript'];
|
164 |
$this->is_inline_delay_on = $options['is_inline_delay_on'];
|
165 |
// only optimize known good JS?
|
inc/minification/breeze-minification-styles.php
CHANGED
@@ -56,6 +56,11 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
|
|
56 |
if ( ! empty( $whitelistCSS ) ) {
|
57 |
$this->whitelist = array_filter( array_map( 'trim', explode( ',', $whitelistCSS ) ) );
|
58 |
}
|
|
|
|
|
|
|
|
|
|
|
59 |
if ( $options['nogooglefont'] == true ) {
|
60 |
$removableCSS = 'fonts.googleapis.com';
|
61 |
} else {
|
@@ -200,11 +205,25 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
|
|
200 |
}
|
201 |
}
|
202 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
$this->css[] = array( $media, 'INLINE;' . $code );
|
204 |
} else {
|
205 |
$tag = '';
|
206 |
}
|
207 |
}
|
|
|
|
|
|
|
|
|
|
|
208 |
// Remove the original style tag
|
209 |
$this->content = str_replace( $tag, '', $this->content );
|
210 |
}
|
@@ -241,6 +260,13 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
|
|
241 |
$cssPath = $css;
|
242 |
$css = $this->fixurls( $cssPath, file_get_contents( $cssPath ) );
|
243 |
$css = preg_replace( '/\x{EF}\x{BB}\x{BF}/', '', $css );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
$tmpstyle = apply_filters( 'breeze_css_individual_style', $css, $cssPath );
|
245 |
if ( has_filter( 'breeze_css_individual_style' ) && ! empty( $tmpstyle ) ) {
|
246 |
$css = $tmpstyle;
|
@@ -253,13 +279,26 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
|
|
253 |
$css = '';
|
254 |
}
|
255 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
if ( $this->group_css == true ) {
|
257 |
foreach ( $media as $elem ) {
|
258 |
if ( ! isset( $this->csscode[ $elem ] ) ) {
|
259 |
$this->csscode[ $elem ] = '';
|
260 |
}
|
|
|
|
|
|
|
|
|
|
|
261 |
$this->csscode[ $elem ] .= "\n/*FILESTART*/" . $css;
|
262 |
}
|
|
|
|
|
263 |
} else {
|
264 |
foreach ( $media as $elem ) {
|
265 |
$this->css_group_val[] = $elem . '_breezecssgroup_' . $css;
|
56 |
if ( ! empty( $whitelistCSS ) ) {
|
57 |
$this->whitelist = array_filter( array_map( 'trim', explode( ',', $whitelistCSS ) ) );
|
58 |
}
|
59 |
+
|
60 |
+
if ( ! is_array( $this->whitelist ) ) {
|
61 |
+
$this->whitelist = array();
|
62 |
+
}
|
63 |
+
|
64 |
if ( $options['nogooglefont'] == true ) {
|
65 |
$removableCSS = 'fonts.googleapis.com';
|
66 |
} else {
|
205 |
}
|
206 |
}
|
207 |
}
|
208 |
+
$is_elementor_exception = false;
|
209 |
+
if ( defined( 'ELEMENTOR_VERSION' ) || defined( 'ELEMENTOR_PRO_VERSION' ) ) {
|
210 |
+
$is_elementor_exception = true;
|
211 |
+
}
|
212 |
+
|
213 |
+
if(false === $is_elementor_exception){
|
214 |
+
$this->css[] = array( $media, 'INLINE;' . $code );
|
215 |
+
}else{
|
216 |
+
if ( false === strpos( $code, '.elementor-' ) ) {
|
217 |
$this->css[] = array( $media, 'INLINE;' . $code );
|
218 |
} else {
|
219 |
$tag = '';
|
220 |
}
|
221 |
}
|
222 |
+
|
223 |
+
} else {
|
224 |
+
$tag = '';
|
225 |
+
}
|
226 |
+
}
|
227 |
// Remove the original style tag
|
228 |
$this->content = str_replace( $tag, '', $this->content );
|
229 |
}
|
260 |
$cssPath = $css;
|
261 |
$css = $this->fixurls( $cssPath, file_get_contents( $cssPath ) );
|
262 |
$css = preg_replace( '/\x{EF}\x{BB}\x{BF}/', '', $css );
|
263 |
+
if (
|
264 |
+
false !== strpos( $css, '.elementor-products-grid ul.products.elementor-grid li.product' ) ||
|
265 |
+
false !== strpos( $css, 'li.product,.woocommerce-page ul.products[class*=columns-] li.product' )
|
266 |
+
) {
|
267 |
+
|
268 |
+
}
|
269 |
+
|
270 |
$tmpstyle = apply_filters( 'breeze_css_individual_style', $css, $cssPath );
|
271 |
if ( has_filter( 'breeze_css_individual_style' ) && ! empty( $tmpstyle ) ) {
|
272 |
$css = $tmpstyle;
|
279 |
$css = '';
|
280 |
}
|
281 |
}
|
282 |
+
|
283 |
+
$is_elementor_exception = false;
|
284 |
+
if ( class_exists( 'WooCommerce' ) && ( defined( 'ELEMENTOR_VERSION' ) || defined( 'ELEMENTOR_PRO_VERSION' ) ) ) {
|
285 |
+
$is_elementor_exception = true;
|
286 |
+
}
|
287 |
+
|
288 |
if ( $this->group_css == true ) {
|
289 |
foreach ( $media as $elem ) {
|
290 |
if ( ! isset( $this->csscode[ $elem ] ) ) {
|
291 |
$this->csscode[ $elem ] = '';
|
292 |
}
|
293 |
+
|
294 |
+
if ( $is_elementor_exception && false !== strpos( $css, 'li.product,.woocommerce-page ul.products[class*=columns-] li.product' ) ) {
|
295 |
+
$this->csscode['all'] .= "\n/*FILESTART*/" . "@media {$elem}{" . $css . '}'; // TODO aici se strica
|
296 |
+
|
297 |
+
} else {
|
298 |
$this->csscode[ $elem ] .= "\n/*FILESTART*/" . $css;
|
299 |
}
|
300 |
+
|
301 |
+
}
|
302 |
} else {
|
303 |
foreach ( $media as $elem ) {
|
304 |
$this->css_group_val[] = $elem . '_breezecssgroup_' . $css;
|
inc/wp-cli/class-breeze-wp-cli-core.php
CHANGED
@@ -383,6 +383,43 @@ class Breeze_WP_Cli_Core extends \WP_CLI_Command {
|
|
383 |
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
}
|
387 |
|
388 |
WP_CLI::add_command(
|
383 |
|
384 |
}
|
385 |
|
386 |
+
/**
|
387 |
+
* Reset breeze to default setting using WP-CLI
|
388 |
+
*
|
389 |
+
* @param $args
|
390 |
+
* @param $assoc_args
|
391 |
+
* @return void
|
392 |
+
*
|
393 |
+
* @since 2.0.9
|
394 |
+
* @access public
|
395 |
+
*/
|
396 |
+
function reset( $args, $assoc_args ) {
|
397 |
+
|
398 |
+
$site_id = 0;
|
399 |
+
|
400 |
+
if ( is_multisite() && isset( $assoc_args['level'] ) ) {
|
401 |
+
$site_id = $assoc_args['level'];
|
402 |
+
}
|
403 |
+
|
404 |
+
WP_CLI::line( WP_CLI::colorize( '%YReseting to default%n' ) );
|
405 |
+
|
406 |
+
if ( is_multisite() && ! $site_id ) {
|
407 |
+
WP_CLI::line( PHP_EOL );
|
408 |
+
WP_CLI::line( WP_CLI::colorize( '%ROn a multisite instance if you don\'t specify the site id by --level=$id|network all breeze settins will reset (default network).%n' ) );
|
409 |
+
WP_CLI::confirm( 'Are you sure you want to continue?' );
|
410 |
+
}
|
411 |
+
|
412 |
+
$reset_default = Breeze_Configuration::reset_to_default( $site_id );
|
413 |
+
|
414 |
+
if ( $reset_default ) {
|
415 |
+
WP_CLI::line( WP_CLI::colorize( '%GDone%n.' ) );
|
416 |
+
} else {
|
417 |
+
WP_CLI::error(
|
418 |
+
__( 'Something went wrong', 'breeze' )
|
419 |
+
);
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
}
|
424 |
|
425 |
WP_CLI::add_command(
|
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: 5.9
|
5 |
Tested up to: 6.0
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -144,6 +144,13 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
|
|
144 |
|
145 |
== Changelog ==
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
= 2.0.9=
|
148 |
|
149 |
* Fix: Added nonce check to import settings ajax request, in order to improve security and prevent cross-site requests.
|
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: 5.9
|
5 |
Tested up to: 6.0
|
6 |
+
Stable tag: 2.0.10
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
144 |
|
145 |
== Changelog ==
|
146 |
|
147 |
+
= 2.0.10=
|
148 |
+
|
149 |
+
* Add: More options added in the Database option tab.
|
150 |
+
* Add: Display Autoload summary with Autoload total size as well as Autoload count.
|
151 |
+
* Fix: Enhance the functionality of the options Combine CSS and Inline CSS while CSS is generated by Elementor.
|
152 |
+
* Fix: Overwrite the TimeZone To UTC being sent out in ticket/order confirmations of The Events Calendar plugin.
|
153 |
+
|
154 |
= 2.0.9=
|
155 |
|
156 |
* Fix: Added nonce check to import settings ajax request, in order to improve security and prevent cross-site requests.
|
views/breeze-setting-views.php
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
|
3 |
defined( 'ABSPATH' ) or die;
|
4 |
|
|
|
|
|
|
|
5 |
$global_tabs = array(
|
6 |
'faq',
|
7 |
);
|
2 |
|
3 |
defined( 'ABSPATH' ) or die;
|
4 |
|
5 |
+
// Thickbox for popups
|
6 |
+
add_thickbox();
|
7 |
+
|
8 |
$global_tabs = array(
|
9 |
'faq',
|
10 |
);
|
views/option-tabs/database-tab.php
CHANGED
@@ -10,15 +10,30 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
10 |
|
11 |
set_as_network_screen();
|
12 |
|
13 |
-
$icon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
$post_revisions = 0;
|
16 |
-
$drafted = 0;
|
17 |
-
$trashed = 0;
|
18 |
-
$comments_trash = 0;
|
19 |
-
$comments_spam = 0;
|
20 |
-
$trackbacks = 0;
|
21 |
-
$transients = 0;
|
22 |
|
23 |
$total_no = 0;
|
24 |
|
@@ -39,6 +54,21 @@ if ( is_multisite() && is_network_admin() ) {
|
|
39 |
$comments_spam += Breeze_Configuration::get_element_to_clean( 'comments_spam' );
|
40 |
$trackbacks += Breeze_Configuration::get_element_to_clean( 'trackbacks' );
|
41 |
$transients += Breeze_Configuration::get_element_to_clean( 'transient' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
restore_current_blog();
|
43 |
}
|
44 |
} else {
|
@@ -50,53 +80,143 @@ if ( is_multisite() && is_network_admin() ) {
|
|
50 |
$comments_spam = Breeze_Configuration::get_element_to_clean( 'comments_spam' );
|
51 |
$trackbacks = Breeze_Configuration::get_element_to_clean( 'trackbacks' );
|
52 |
$transients = Breeze_Configuration::get_element_to_clean( 'transient' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
-
$total_no = $post_revisions +
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
$is_optimize_disabled = is_multisite() && ! is_network_admin() && '0' !== get_option( 'breeze_inherit_settings' );
|
58 |
|
59 |
$sections_actions = array(
|
60 |
-
'
|
61 |
-
'title' => __( 'Post Revisions', 'breeze' ),
|
62 |
-
'describe' => __( 'Remove all post/pages revisions from DB', 'breeze' ),
|
63 |
-
'no' => $post_revisions,
|
64 |
-
),
|
65 |
-
'auto_drafts' => array(
|
66 |
'title' => __( 'Auto Drafts', 'breeze' ),
|
67 |
'describe' => __( 'Remove all post/pages auto drafts from DB', 'breeze' ),
|
68 |
'no' => $drafted,
|
69 |
),
|
70 |
-
'
|
71 |
-
'title' => __( '
|
72 |
-
'describe' => __( '
|
73 |
-
'no' => $
|
74 |
),
|
75 |
-
'
|
76 |
-
'title' => __( '
|
77 |
-
'describe' => __( 'Remove all
|
78 |
-
'no' => $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
),
|
80 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
'title' => __( 'Spam Comments', 'breeze' ),
|
82 |
'describe' => __( 'Remove all the comments that are considered spam from DB', 'breeze' ),
|
83 |
'no' => $comments_spam,
|
84 |
),
|
85 |
-
'
|
86 |
-
'title' => __( '
|
87 |
-
'describe' => __( '
|
88 |
-
'no' => $
|
|
|
|
|
|
|
|
|
|
|
89 |
),
|
90 |
-
'trackbacks_pingbacks'
|
91 |
'title' => __( 'Trackbacks/Pingbacks', 'breeze' ),
|
92 |
'describe' => __( 'Remove all trackbacks/pingbakcs data from DB', 'breeze' ),
|
93 |
'no' => $trackbacks,
|
94 |
),
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
// 'clean_optimizer' => array(
|
101 |
// 'title' => __( 'Clean CSS/JS Optimizer (0)', 'breeze' ),
|
102 |
// 'describe' => __( 'Optimise CSS/JS', 'breeze' ),
|
@@ -109,6 +229,15 @@ $sections_actions = array(
|
|
109 |
// ),
|
110 |
);
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
?>
|
113 |
<section>
|
114 |
<div class="br-section-title">
|
@@ -125,10 +254,11 @@ $sections_actions = array(
|
|
125 |
</div>
|
126 |
</label><br>
|
127 |
</div>
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
132 |
<p class="br-important">
|
133 |
<?php
|
134 |
echo '<strong>';
|
@@ -138,8 +268,11 @@ $sections_actions = array(
|
|
138 |
?>
|
139 |
</p>
|
140 |
|
141 |
-
|
|
|
142 |
</div>
|
|
|
|
|
143 |
<div class="br-db-boxes">
|
144 |
<?php
|
145 |
if ( ! empty( $sections_actions ) ) {
|
@@ -156,7 +289,8 @@ $sections_actions = array(
|
|
156 |
}
|
157 |
}
|
158 |
?>
|
159 |
-
<div class="br-db-item" data-section-title="<?php echo esc_attr( $section_data['title'] ); ?>"
|
|
|
160 |
<img src="<?php echo BREEZE_PLUGIN_URL . 'assets/images/' . esc_attr( $section_slug ) . '.png'; ?>">
|
161 |
<h3>
|
162 |
<?php
|
@@ -175,8 +309,57 @@ $sections_actions = array(
|
|
175 |
}
|
176 |
?>
|
177 |
</div>
|
|
|
|
|
178 |
<div class="cta-cleanall">
|
179 |
<input type="button" class="simple-btn" id="optimize-selected-services" value="<?php _e( 'Optimize', 'breeze' ); ?>">
|
180 |
<br/><br/>
|
181 |
</div>
|
|
|
182 |
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
set_as_network_screen();
|
12 |
|
13 |
+
$icon = BREEZE_PLUGIN_URL . 'assets/images/database-active.png';
|
14 |
+
$summary_icon = BREEZE_PLUGIN_URL . 'assets/images/dbsummary-active.png';
|
15 |
+
|
16 |
+
$post_revisions = 0;
|
17 |
+
$drafted = 0;
|
18 |
+
$trashed = 0;
|
19 |
+
$comments_trash = 0;
|
20 |
+
$comments_spam = 0;
|
21 |
+
$trackbacks = 0;
|
22 |
+
$transients = 0;
|
23 |
+
$comments_unapproved = 0;
|
24 |
+
$comments_orphan_meta = 0;
|
25 |
+
$comments_duplicate_meta = 0;
|
26 |
+
|
27 |
+
$expired_transients = 0;
|
28 |
+
$orphan_post_meta = 0;
|
29 |
+
$duplicated_post_meta = 0;
|
30 |
+
$oembed_post = 0;
|
31 |
+
$orphan_user_meta = 0;
|
32 |
+
$duplicate_user_meta = 0;
|
33 |
+
$orphan_term_meta = 0;
|
34 |
+
$duplicate_term_meta = 0;
|
35 |
+
$tables_to_optimize = 0;
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
$total_no = 0;
|
39 |
|
54 |
$comments_spam += Breeze_Configuration::get_element_to_clean( 'comments_spam' );
|
55 |
$trackbacks += Breeze_Configuration::get_element_to_clean( 'trackbacks' );
|
56 |
$transients += Breeze_Configuration::get_element_to_clean( 'transient' );
|
57 |
+
/**
|
58 |
+
* @since 2.0.7
|
59 |
+
*/
|
60 |
+
$comments_unapproved += Breeze_Configuration::get_element_to_clean( 'comments_unapproved' );
|
61 |
+
$comments_orphan_meta += Breeze_Configuration::get_element_to_clean( 'comments_orphan_meta' );
|
62 |
+
$comments_duplicate_meta += Breeze_Configuration::get_element_to_clean( 'comments_duplicate_meta' );
|
63 |
+
$orphan_post_meta += Breeze_Configuration::get_element_to_clean( 'orphan_post_meta' );
|
64 |
+
$oembed_post += Breeze_Configuration::get_element_to_clean( 'oembed_cache' );
|
65 |
+
$duplicated_post_meta += Breeze_Configuration::get_element_to_clean( 'duplicated_post_meta' );
|
66 |
+
$expired_transients += Breeze_Configuration::get_element_to_clean( 'expired_transients' );
|
67 |
+
$orphan_user_meta += Breeze_Configuration::get_element_to_clean( 'orphan_user_meta' );
|
68 |
+
$duplicate_user_meta += Breeze_Configuration::get_element_to_clean( 'duplicated_user_meta' );
|
69 |
+
$orphan_term_meta += Breeze_Configuration::get_element_to_clean( 'orphan_term_meta' );
|
70 |
+
$duplicate_term_meta += Breeze_Configuration::get_element_to_clean( 'duplicated_term_meta' );
|
71 |
+
$tables_to_optimize += Breeze_Configuration::get_element_to_clean( 'optimize_database' );
|
72 |
restore_current_blog();
|
73 |
}
|
74 |
} else {
|
80 |
$comments_spam = Breeze_Configuration::get_element_to_clean( 'comments_spam' );
|
81 |
$trackbacks = Breeze_Configuration::get_element_to_clean( 'trackbacks' );
|
82 |
$transients = Breeze_Configuration::get_element_to_clean( 'transient' );
|
83 |
+
/**
|
84 |
+
* @since 2.0.7
|
85 |
+
*/
|
86 |
+
$comments_unapproved = Breeze_Configuration::get_element_to_clean( 'comments_unapproved' );
|
87 |
+
$comments_orphan_meta = Breeze_Configuration::get_element_to_clean( 'comments_orphan_meta' );
|
88 |
+
$comments_duplicate_meta = Breeze_Configuration::get_element_to_clean( 'comments_duplicate_meta' );
|
89 |
+
$orphan_post_meta = Breeze_Configuration::get_element_to_clean( 'orphan_post_meta' );
|
90 |
+
$oembed_post = Breeze_Configuration::get_element_to_clean( 'oembed_cache' );
|
91 |
+
$duplicated_post_meta = Breeze_Configuration::get_element_to_clean( 'duplicated_post_meta' );
|
92 |
+
$expired_transients = Breeze_Configuration::get_element_to_clean( 'expired_transients' );
|
93 |
+
$orphan_user_meta = Breeze_Configuration::get_element_to_clean( 'orphan_user_meta' );
|
94 |
+
$duplicate_user_meta = Breeze_Configuration::get_element_to_clean( 'duplicated_user_meta' );
|
95 |
+
$orphan_term_meta = Breeze_Configuration::get_element_to_clean( 'orphan_term_meta' );
|
96 |
+
$duplicate_term_meta = Breeze_Configuration::get_element_to_clean( 'duplicated_term_meta' );
|
97 |
+
$tables_to_optimize = Breeze_Configuration::get_element_to_clean( 'optimize_database' );
|
98 |
}
|
99 |
|
100 |
+
$total_no = $post_revisions +
|
101 |
+
$drafted +
|
102 |
+
$trashed +
|
103 |
+
$comments_trash +
|
104 |
+
$comments_spam +
|
105 |
+
$trackbacks +
|
106 |
+
$transients +
|
107 |
+
$comments_unapproved +
|
108 |
+
$comments_orphan_meta +
|
109 |
+
$comments_duplicate_meta +
|
110 |
+
$orphan_post_meta +
|
111 |
+
$orphan_post_meta +
|
112 |
+
$oembed_post +
|
113 |
+
$duplicated_post_meta +
|
114 |
+
$expired_transients +
|
115 |
+
$orphan_user_meta +
|
116 |
+
$duplicate_user_meta +
|
117 |
+
$orphan_term_meta +
|
118 |
+
$duplicate_term_meta +
|
119 |
+
$tables_to_optimize;
|
120 |
|
121 |
$is_optimize_disabled = is_multisite() && ! is_network_admin() && '0' !== get_option( 'breeze_inherit_settings' );
|
122 |
|
123 |
$sections_actions = array(
|
124 |
+
'auto_drafts' => array(
|
|
|
|
|
|
|
|
|
|
|
125 |
'title' => __( 'Auto Drafts', 'breeze' ),
|
126 |
'describe' => __( 'Remove all post/pages auto drafts from DB', 'breeze' ),
|
127 |
'no' => $drafted,
|
128 |
),
|
129 |
+
'all_transients' => array(
|
130 |
+
'title' => __( 'All Transients', 'breeze' ),
|
131 |
+
'describe' => __( 'Delete expired and active transients from the WordPress database.', 'breeze' ),
|
132 |
+
'no' => $transients,
|
133 |
),
|
134 |
+
'duplicated_post_meta' => array( // @since 2.0.7
|
135 |
+
'title' => __( 'Duplicated Posts metadata', 'breeze' ),
|
136 |
+
'describe' => __( 'Remove all duplicated posts metadata from DB', 'breeze' ),
|
137 |
+
'no' => $duplicated_post_meta,
|
138 |
+
),
|
139 |
+
'comments_duplicate_meta' => array( // @since 2.0.7
|
140 |
+
'title' => __( 'Duplicated Comments metadata', 'breeze' ),
|
141 |
+
'describe' => __( 'Remove all the comments metadata which are duplicated from DB', 'breeze' ),
|
142 |
+
'no' => $comments_duplicate_meta,
|
143 |
+
),
|
144 |
+
'duplicated_user_meta' => array( // @since 2.0.7
|
145 |
+
'title' => __( 'Duplicated User metadata', 'breeze' ),
|
146 |
+
'describe' => __( 'Remove duplicated user metadata.', 'breeze' ),
|
147 |
+
'no' => $duplicate_user_meta,
|
148 |
+
),
|
149 |
+
'duplicated_term_meta' => array( // @since 2.0.7
|
150 |
+
'title' => __( 'Duplicated Term metadata', 'breeze' ),
|
151 |
+
'describe' => __( 'Remove duplicated term(taxonomies) metadata.', 'breeze' ),
|
152 |
+
'no' => $duplicate_term_meta,
|
153 |
),
|
154 |
+
'expired_transients' => array( // @since 2.0.7
|
155 |
+
'title' => __( 'Expired Transients', 'breeze' ),
|
156 |
+
'describe' => __( 'Delete expired transients from the WordPress database.', 'breeze' ),
|
157 |
+
'no' => $expired_transients,
|
158 |
+
),
|
159 |
+
'oembed_cache' => array( // @since 2.0.7
|
160 |
+
'title' => __( 'oEmbed in Posts metadata', 'breeze' ),
|
161 |
+
'describe' => __( 'Remove oEmbed cache in posts metadata from DB', 'breeze' ),
|
162 |
+
'no' => $oembed_post,
|
163 |
+
),
|
164 |
+
'orphan_post_meta' => array( // @since 2.0.7
|
165 |
+
'title' => __( 'Orphaned Posts metadata', 'breeze' ),
|
166 |
+
'describe' => __( 'Remove all orphaned posts metadata from DB', 'breeze' ),
|
167 |
+
'no' => $orphan_post_meta,
|
168 |
+
),
|
169 |
+
'orphan_user_meta' => array( // @since 2.0.7
|
170 |
+
'title' => __( 'Orphan User metadata', 'breeze' ),
|
171 |
+
'describe' => __( 'Remove orphan user metadata.', 'breeze' ),
|
172 |
+
'no' => $orphan_user_meta,
|
173 |
+
),
|
174 |
+
|
175 |
+
'orphan_term_meta' => array( // @since 2.0.7
|
176 |
+
'title' => __( 'Orphan Term metadata', 'breeze' ),
|
177 |
+
'describe' => __( 'Remove orphan term(taxonomies) metadata.', 'breeze' ),
|
178 |
+
'no' => $orphan_term_meta,
|
179 |
+
),
|
180 |
+
'comments_orphan_meta' => array( // @since 2.0.7
|
181 |
+
'title' => __( 'Orphaned Comments metadata', 'breeze' ),
|
182 |
+
'describe' => __( 'Remove all the comments metadata which are orphaned from DB', 'breeze' ),
|
183 |
+
'no' => $comments_orphan_meta,
|
184 |
+
),
|
185 |
+
'optimize_database' => array( // @since 2.0.7
|
186 |
+
'title' => __( 'Optimize database', 'breeze' ),
|
187 |
+
'describe' => __( 'Try to optimize database tables.', 'breeze' ),
|
188 |
+
'no' => $tables_to_optimize,
|
189 |
+
),
|
190 |
+
'post_revisions' => array(
|
191 |
+
'title' => __( 'Post Revisions', 'breeze' ),
|
192 |
+
'describe' => __( 'Remove all post/pages revisions from DB', 'breeze' ),
|
193 |
+
'no' => $post_revisions,
|
194 |
+
),
|
195 |
+
'spam_comments' => array(
|
196 |
'title' => __( 'Spam Comments', 'breeze' ),
|
197 |
'describe' => __( 'Remove all the comments that are considered spam from DB', 'breeze' ),
|
198 |
'no' => $comments_spam,
|
199 |
),
|
200 |
+
'trashed_posts' => array(
|
201 |
+
'title' => __( 'Trashed Posts', 'breeze' ),
|
202 |
+
'describe' => __( 'Remove all trashed posts from DB', 'breeze' ),
|
203 |
+
'no' => $trashed,
|
204 |
+
),
|
205 |
+
'trashed_comments' => array(
|
206 |
+
'title' => __( 'Trashed Comments', 'breeze' ),
|
207 |
+
'describe' => __( 'Remove all trashed comments from DB', 'breeze' ),
|
208 |
+
'no' => $comments_trash,
|
209 |
),
|
210 |
+
'trackbacks_pingbacks' => array(
|
211 |
'title' => __( 'Trackbacks/Pingbacks', 'breeze' ),
|
212 |
'describe' => __( 'Remove all trackbacks/pingbakcs data from DB', 'breeze' ),
|
213 |
'no' => $trackbacks,
|
214 |
),
|
215 |
+
'comments_unapproved' => array( // @since 2.0.7
|
216 |
+
'title' => __( 'Unapproved/Pending Comments', 'breeze' ),
|
217 |
+
'describe' => __( 'Remove all the comments that are considered as unapproved from DB', 'breeze' ),
|
218 |
+
'no' => $comments_unapproved,
|
219 |
+
),
|
220 |
// 'clean_optimizer' => array(
|
221 |
// 'title' => __( 'Clean CSS/JS Optimizer (0)', 'breeze' ),
|
222 |
// 'describe' => __( 'Optimise CSS/JS', 'breeze' ),
|
229 |
// ),
|
230 |
);
|
231 |
|
232 |
+
/**
|
233 |
+
* Database summary
|
234 |
+
*/
|
235 |
+
if ( ! class_exists( 'Breeze_Db_Summary_List_Table' ) ) {
|
236 |
+
require_once BREEZE_PLUGIN_DIR . 'inc/helpers/class-breeze-db-summary-table.php';
|
237 |
+
|
238 |
+
}
|
239 |
+
$myListTable = new Breeze_Db_Summary_List_Table();
|
240 |
+
|
241 |
?>
|
242 |
<section>
|
243 |
<div class="br-section-title">
|
254 |
</div>
|
255 |
</label><br>
|
256 |
</div>
|
257 |
+
<label for="br-clean-all" class="br-clean-label"><?php _e( 'Clean All', 'breeze' ); ?> <span
|
258 |
+
class="br-has">( <?php echo esc_html( $total_no ); ?> )</span></label>
|
259 |
+
<p>
|
260 |
+
<?php _e( 'Cleall the trashed posts and pages.', 'breeze' ); ?>
|
261 |
+
</p>
|
262 |
<p class="br-important">
|
263 |
<?php
|
264 |
echo '<strong>';
|
268 |
?>
|
269 |
</p>
|
270 |
|
271 |
+
<input type="button" class="simple-btn" value="<?php _e( 'Clean Now', 'breeze' ); ?>" disabled
|
272 |
+
id="br-clean-all-cta">
|
273 |
</div>
|
274 |
+
|
275 |
+
|
276 |
<div class="br-db-boxes">
|
277 |
<?php
|
278 |
if ( ! empty( $sections_actions ) ) {
|
289 |
}
|
290 |
}
|
291 |
?>
|
292 |
+
<div class="br-db-item" data-section-title="<?php echo esc_attr( $section_data['title'] ); ?>"
|
293 |
+
data-section="<?php echo esc_attr( $section_slug ); ?>">
|
294 |
<img src="<?php echo BREEZE_PLUGIN_URL . 'assets/images/' . esc_attr( $section_slug ) . '.png'; ?>">
|
295 |
<h3>
|
296 |
<?php
|
309 |
}
|
310 |
?>
|
311 |
</div>
|
312 |
+
|
313 |
+
|
314 |
<div class="cta-cleanall">
|
315 |
<input type="button" class="simple-btn" id="optimize-selected-services" value="<?php _e( 'Optimize', 'breeze' ); ?>">
|
316 |
<br/><br/>
|
317 |
</div>
|
318 |
+
|
319 |
</section>
|
320 |
+
|
321 |
+
<section>
|
322 |
+
<div class="br-section-title">
|
323 |
+
<img src="<?php echo $summary_icon; ?>"/>
|
324 |
+
<?php _e( 'AUTOLOAD SUMMARY', 'breeze' ); ?>
|
325 |
+
</div>
|
326 |
+
<div>
|
327 |
+
<!-- START OPTION -->
|
328 |
+
<div class="br-option-item">
|
329 |
+
<div id="dbsummary-content">
|
330 |
+
|
331 |
+
<?php
|
332 |
+
// Get statistics data
|
333 |
+
echo $myListTable->get_statistics();
|
334 |
+
|
335 |
+
// Invoke table helper
|
336 |
+
$myListTable->prepare_items();
|
337 |
+
$myListTable->display();
|
338 |
+
?>
|
339 |
+
|
340 |
+
</div>
|
341 |
+
</div>
|
342 |
+
<!-- END OPTION -->
|
343 |
+
</div>
|
344 |
+
<script>
|
345 |
+
|
346 |
+
var all_lines = jQuery('#dbsummary-content').find('tbody').find('tr');
|
347 |
+
all_lines.each( function ( index, element ) {
|
348 |
+
// element == this
|
349 |
+
jQuery(this).addClass('is-expanded');
|
350 |
+
} );
|
351 |
+
|
352 |
+
|
353 |
+
jQuery('.br-option-item').on('click tap', '.toggle-row', function ( e ){
|
354 |
+
e.preventDefault();
|
355 |
+
var tr_action = jQuery(this).closest('tr');
|
356 |
+
|
357 |
+
if(!tr_action.hasClass('is-expanded')){
|
358 |
+
tr_action.addClass('is-expanded');
|
359 |
+
}else{
|
360 |
+
tr_action.removeClass('is-expanded');
|
361 |
+
}
|
362 |
+
})
|
363 |
+
</script>
|
364 |
+
</section>
|
365 |
+
|
views/option-tabs/dbsummary-tab.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Basic tab
|
4 |
+
*/
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
header( 'Status: 403 Forbidden' );
|
7 |
+
header( 'HTTP/1.1 403 Forbidden' );
|
8 |
+
exit;
|
9 |
+
}
|
10 |
+
|
11 |
+
set_as_network_screen();
|
12 |
+
|
13 |
+
if ( ! class_exists( 'Breeze_Db_Summary_List_Table' ) ) {
|
14 |
+
require_once BREEZE_PLUGIN_DIR . 'inc/helpers/class-breeze-db-summary-table.php';
|
15 |
+
|
16 |
+
}
|
17 |
+
$myListTable = new Breeze_Db_Summary_List_Table();
|
18 |
+
|
19 |
+
|
20 |
+
$summary_icon = BREEZE_PLUGIN_URL . 'assets/images/dbsummary-active.png';
|
21 |
+
|
22 |
+
|
23 |
+
?>
|
24 |
+
<section>
|
25 |
+
<div class="br-section-title">
|
26 |
+
<img src="<?php echo $summary_icon; ?>"/>
|
27 |
+
<?php _e( 'DATABASE SUMMARY', 'breeze' ); ?>
|
28 |
+
</div>
|
29 |
+
<div>
|
30 |
+
<!-- START OPTION -->
|
31 |
+
<div class="br-option-item">
|
32 |
+
<div id="dbsummary-content">
|
33 |
+
|
34 |
+
<?php
|
35 |
+
// Get statistics data
|
36 |
+
echo $myListTable->get_statistics();
|
37 |
+
|
38 |
+
// Invoke table helper
|
39 |
+
$myListTable->prepare_items();
|
40 |
+
$myListTable->display();
|
41 |
+
?>
|
42 |
+
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<!-- END OPTION -->
|
46 |
+
</div>
|
47 |
+
|
48 |
+
</section>
|
views/option-tabs/file-tab.php
CHANGED
@@ -162,7 +162,7 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
162 |
|
163 |
if ( false === $css_minify_state ) {
|
164 |
//$disable_inline_css = 'disabled="disabled"';
|
165 |
-
$disable_overlay
|
166 |
}
|
167 |
?>
|
168 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
@@ -200,7 +200,7 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
200 |
|
201 |
if ( false === $css_minify_state ) {
|
202 |
//$disable_group_css = 'disabled="disabled"';
|
203 |
-
$disable_overlay
|
204 |
}
|
205 |
?>
|
206 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
@@ -336,7 +336,7 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
336 |
$disable_overlay = '';
|
337 |
if ( false === $js_minify_state ) {
|
338 |
//$disable_group_js = 'disabled="disabled"';
|
339 |
-
$disable_overlay
|
340 |
}
|
341 |
?>
|
342 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
@@ -372,7 +372,7 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
372 |
$disable_overlay = '';
|
373 |
if ( false === $js_minify_state ) {
|
374 |
//$disable_inline_js = 'disabled="disabled"';
|
375 |
-
$disable_overlay
|
376 |
}
|
377 |
?>
|
378 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
@@ -585,29 +585,29 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
585 |
</div>
|
586 |
<div class="br-option">
|
587 |
<?php
|
588 |
-
|
589 |
/**
|
590 |
* Used to disable one of the options when the ther is active.
|
591 |
*/
|
592 |
$basic_value_all = isset( $options['breeze-delay-all-js'] ) ? filter_var( $options['breeze-delay-all-js'], FILTER_VALIDATE_BOOLEAN ) : false;
|
593 |
$is_enabled_all = ( isset( $basic_value_all ) && true === $basic_value_all ) ? checked( $options['breeze-delay-all-js'], '1', false ) : '';
|
594 |
-
|
595 |
|
596 |
$basic_value_inlinejs = isset( $options['breeze-enable-js-delay'] ) ? filter_var( $options['breeze-enable-js-delay'], FILTER_VALIDATE_BOOLEAN ) : false;
|
597 |
$is_enabled_inlinejs = ( isset( $basic_value_inlinejs ) && true === $basic_value_inlinejs ) ? checked( $options['breeze-enable-js-delay'], '1', false ) : '';
|
598 |
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
?>
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
<?php
|
612 |
$js_output = '';
|
613 |
if ( ! empty( $options['breeze-delay-js-scripts'] ) ) {
|
@@ -637,14 +637,14 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
637 |
</p>
|
638 |
</div>
|
639 |
</div>
|
640 |
-
|
641 |
<?php
|
642 |
echo '<strong>';
|
643 |
_e( 'Important: ', 'breeze' );
|
644 |
echo '</strong>';
|
645 |
_e( 'Use only one option "Delay JS Inline Scripts" OR "Delay All JavaScript" at same time.', 'breeze' );
|
646 |
?>
|
647 |
-
|
648 |
</div>
|
649 |
</div>
|
650 |
<!-- END OPTION -->
|
@@ -667,17 +667,17 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
667 |
}
|
668 |
|
669 |
$delay_js_disabled = '';
|
670 |
-
if(true ===
|
671 |
$delay_js_disabled = 'disabled="disabled"';
|
672 |
}
|
673 |
?>
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
|
682 |
<div class="br-note">
|
683 |
<p>
|
@@ -727,14 +727,14 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
727 |
</p>
|
728 |
</div>
|
729 |
</div>
|
730 |
-
|
731 |
<?php
|
732 |
echo '<strong>';
|
733 |
_e( 'Important: ', 'breeze' );
|
734 |
echo '</strong>';
|
735 |
_e( 'Use only one option "Delay JS Inline Scripts" OR "Delay All JavaScript" at same time.', 'breeze' );
|
736 |
?>
|
737 |
-
|
738 |
</div>
|
739 |
</div>
|
740 |
<!-- END OPTION -->
|
162 |
|
163 |
if ( false === $css_minify_state ) {
|
164 |
//$disable_inline_css = 'disabled="disabled"';
|
165 |
+
$disable_overlay = ' br-apply-disable';
|
166 |
}
|
167 |
?>
|
168 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
200 |
|
201 |
if ( false === $css_minify_state ) {
|
202 |
//$disable_group_css = 'disabled="disabled"';
|
203 |
+
$disable_overlay = ' br-apply-disable';
|
204 |
}
|
205 |
?>
|
206 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
336 |
$disable_overlay = '';
|
337 |
if ( false === $js_minify_state ) {
|
338 |
//$disable_group_js = 'disabled="disabled"';
|
339 |
+
$disable_overlay = ' br-apply-disable';
|
340 |
}
|
341 |
?>
|
342 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
372 |
$disable_overlay = '';
|
373 |
if ( false === $js_minify_state ) {
|
374 |
//$disable_inline_js = 'disabled="disabled"';
|
375 |
+
$disable_overlay = ' br-apply-disable';
|
376 |
}
|
377 |
?>
|
378 |
<div class="br-option-item<?php echo $disable_overlay; ?>">
|
585 |
</div>
|
586 |
<div class="br-option">
|
587 |
<?php
|
588 |
+
// Delay All JavaScript START
|
589 |
/**
|
590 |
* Used to disable one of the options when the ther is active.
|
591 |
*/
|
592 |
$basic_value_all = isset( $options['breeze-delay-all-js'] ) ? filter_var( $options['breeze-delay-all-js'], FILTER_VALIDATE_BOOLEAN ) : false;
|
593 |
$is_enabled_all = ( isset( $basic_value_all ) && true === $basic_value_all ) ? checked( $options['breeze-delay-all-js'], '1', false ) : '';
|
594 |
+
// END
|
595 |
|
596 |
$basic_value_inlinejs = isset( $options['breeze-enable-js-delay'] ) ? filter_var( $options['breeze-enable-js-delay'], FILTER_VALIDATE_BOOLEAN ) : false;
|
597 |
$is_enabled_inlinejs = ( isset( $basic_value_inlinejs ) && true === $basic_value_inlinejs ) ? checked( $options['breeze-enable-js-delay'], '1', false ) : '';
|
598 |
|
599 |
+
$delay_inline_disabled = '';
|
600 |
+
if ( true === $basic_value_all ) {
|
601 |
+
$delay_inline_disabled = 'disabled="disabled"';
|
602 |
+
}
|
603 |
?>
|
604 |
+
<div class="on-off-checkbox">
|
605 |
+
<label class="br-switcher">
|
606 |
+
<input <?php echo $delay_inline_disabled; ?> id="enable-js-delay" name="enable-js-delay" type="checkbox" class="br-box" value="1" <?php echo $is_enabled_inlinejs; ?>>
|
607 |
+
<div class="br-see-state">
|
608 |
+
</div>
|
609 |
+
</label><br>
|
610 |
+
</div>
|
611 |
<?php
|
612 |
$js_output = '';
|
613 |
if ( ! empty( $options['breeze-delay-js-scripts'] ) ) {
|
637 |
</p>
|
638 |
</div>
|
639 |
</div>
|
640 |
+
<p class="br-important">
|
641 |
<?php
|
642 |
echo '<strong>';
|
643 |
_e( 'Important: ', 'breeze' );
|
644 |
echo '</strong>';
|
645 |
_e( 'Use only one option "Delay JS Inline Scripts" OR "Delay All JavaScript" at same time.', 'breeze' );
|
646 |
?>
|
647 |
+
</p>
|
648 |
</div>
|
649 |
</div>
|
650 |
<!-- END OPTION -->
|
667 |
}
|
668 |
|
669 |
$delay_js_disabled = '';
|
670 |
+
if ( true === $basic_value_inlinejs ) {
|
671 |
$delay_js_disabled = 'disabled="disabled"';
|
672 |
}
|
673 |
?>
|
674 |
+
<div class="on-off-checkbox">
|
675 |
+
<label class="br-switcher">
|
676 |
+
<input <?php echo $delay_js_disabled; ?> id="breeze-delay-all-js" name="breeze-delay-all-js" type="checkbox" class="br-box" value="1" <?php echo $is_enabled_all; ?>>
|
677 |
+
<div class="br-see-state">
|
678 |
+
</div>
|
679 |
+
</label><br>
|
680 |
+
</div>
|
681 |
|
682 |
<div class="br-note">
|
683 |
<p>
|
727 |
</p>
|
728 |
</div>
|
729 |
</div>
|
730 |
+
<p class="br-important">
|
731 |
<?php
|
732 |
echo '<strong>';
|
733 |
_e( 'Important: ', 'breeze' );
|
734 |
echo '</strong>';
|
735 |
_e( 'Use only one option "Delay JS Inline Scripts" OR "Delay All JavaScript" at same time.', 'breeze' );
|
736 |
?>
|
737 |
+
</p>
|
738 |
</div>
|
739 |
</div>
|
740 |
<!-- END OPTION -->
|
views/option-tabs/tools-tab.php
CHANGED
@@ -94,4 +94,5 @@ if ( is_multisite() ) {
|
|
94 |
</div>
|
95 |
</div>
|
96 |
<!-- END OPTION -->
|
|
|
97 |
</section>
|
94 |
</div>
|
95 |
</div>
|
96 |
<!-- END OPTION -->
|
97 |
+
|
98 |
</section>
|