Version Description
- Add: Improve page load by delaying JavaScript execution. Delay JS is disabled by default for new installations.
- Fix: Added JavaScript checks to see if the sortable library is loaded or not, if not then the JS code that requires the library will not execute.
- Fix: Undefined variable in Breeze minification scripts.
Download this release
Release Info
Developer | adeelkhan |
Plugin | Breeze – WordPress Cache Plugin |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- assets/js/breeze-main.js +65 -31
- assets/js/breeze-main.min.js +2 -2
- assets/js/js-front-end/breeze-lazy-load.min.js +1 -1
- assets/js/js-front-end/breeze-prefetch-links.min.js +1 -1
- breeze.php +3 -2
- inc/breeze-admin.php +2 -1
- inc/breeze-configuration.php +7 -1
- inc/functions.php +13 -1
- inc/helpers.php +2 -0
- inc/minification/breeze-js-deferred-loading.php +504 -143
- inc/minification/breeze-minification-scripts.php +126 -16
- inc/minification/breeze-minify-main.php +35 -19
- inc/plugin-incompatibility/class-breeze-incompatibility-plugins.php +18 -18
- inc/wp-cli/class-breeze-settings-import-export.php +4 -0
- readme.txt +7 -1
- views/option-tabs/basic-tab.php +7 -7
- views/option-tabs/file-tab.php +113 -4
- views/option-tabs/tools-tab.php +2 -2
assets/js/breeze-main.js
CHANGED
@@ -276,16 +276,40 @@ jQuery( document ).ready(
|
|
276 |
}
|
277 |
);
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
$box_container.on(
|
280 |
'change',
|
281 |
'#enable-js-delay',
|
282 |
function () {
|
283 |
-
$delay_js_div = $( '#breeze-delay-js-scripts-div' );
|
|
|
284 |
|
285 |
if ( $( this ).is( ':checked' ) ) {
|
286 |
$delay_js_div.show();
|
|
|
|
|
|
|
287 |
} else {
|
288 |
$delay_js_div.hide();
|
|
|
289 |
}
|
290 |
}
|
291 |
)
|
@@ -338,12 +362,15 @@ jQuery( document ).ready(
|
|
338 |
initRemoveBtn();
|
339 |
|
340 |
function initSortableHandle() {
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
|
|
|
|
|
|
347 |
}
|
348 |
|
349 |
initSortableHandle();
|
@@ -468,14 +495,16 @@ jQuery( document ).ready(
|
|
468 |
// Toggle right-side content
|
469 |
if ( id_tab === 'faq' ) {
|
470 |
$( '#breeze-and-cloudways' ).hide();
|
471 |
-
$( '#faq-content' ).
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
|
|
|
|
479 |
} else {
|
480 |
$( '#breeze-and-cloudways' ).show();
|
481 |
}
|
@@ -508,14 +537,16 @@ jQuery( document ).ready(
|
|
508 |
// Toggle right-side content
|
509 |
if ( active_tab === 'faq' ) {
|
510 |
$( '#breeze-and-cloudways' ).hide();
|
511 |
-
$( '#faq-content' ).
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
|
|
|
|
519 |
} else {
|
520 |
$( '#breeze-and-cloudways' ).show();
|
521 |
}
|
@@ -830,14 +861,17 @@ jQuery( document ).ready(
|
|
830 |
breeze_permission_check();
|
831 |
document.cookie = 'breeze_active_tab=' + requested_tab;
|
832 |
if ( 'faq' === requested_tab ) {
|
833 |
-
$( '#faq-content' ).
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
|
|
|
|
|
|
841 |
}
|
842 |
selected_services = [];
|
843 |
}
|
276 |
}
|
277 |
);
|
278 |
|
279 |
+
$box_container.on(
|
280 |
+
'change',
|
281 |
+
'#breeze-delay-all-js',
|
282 |
+
function () {
|
283 |
+
var $delay_js_div_all = $( '#breeze-delay-js-scripts-div-all' );
|
284 |
+
var $enable_inline_delay = $( '#enable-js-delay' );
|
285 |
+
|
286 |
+
if ( $( this ).is( ':checked' ) ) {
|
287 |
+
$delay_js_div_all.show();
|
288 |
+
$( 'input[name="enable-js-delay"]' ).prop( 'checked', false );
|
289 |
+
$( '#breeze-delay-js-scripts-div' ).hide();
|
290 |
+
$enable_inline_delay.attr( 'disabled', 'disabled' );
|
291 |
+
} else {
|
292 |
+
$delay_js_div_all.hide();
|
293 |
+
$enable_inline_delay.removeAttr( 'disabled' );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
)
|
297 |
+
|
298 |
$box_container.on(
|
299 |
'change',
|
300 |
'#enable-js-delay',
|
301 |
function () {
|
302 |
+
var $delay_js_div = $( '#breeze-delay-js-scripts-div' );
|
303 |
+
var $delay_all_js = $('#breeze-delay-all-js');
|
304 |
|
305 |
if ( $( this ).is( ':checked' ) ) {
|
306 |
$delay_js_div.show();
|
307 |
+
$( 'input[name="breeze-delay-all-js"]' ).prop( 'checked', false );
|
308 |
+
$( '#breeze-delay-js-scripts-div-all' ).hide();
|
309 |
+
$delay_all_js.attr( 'disabled', 'disabled' );
|
310 |
} else {
|
311 |
$delay_js_div.hide();
|
312 |
+
$delay_all_js.removeAttr( 'disabled' );
|
313 |
}
|
314 |
}
|
315 |
)
|
362 |
initRemoveBtn();
|
363 |
|
364 |
function initSortableHandle() {
|
365 |
+
|
366 |
+
if ( $( '.breeze-list-url' ).length ) {
|
367 |
+
$( '.breeze-list-url' ).sortable(
|
368 |
+
{
|
369 |
+
handle: $( 'span.sort-handle' ),
|
370 |
+
stop: validateMoveButtons
|
371 |
+
}
|
372 |
+
);
|
373 |
+
}
|
374 |
}
|
375 |
|
376 |
initSortableHandle();
|
495 |
// Toggle right-side content
|
496 |
if ( id_tab === 'faq' ) {
|
497 |
$( '#breeze-and-cloudways' ).hide();
|
498 |
+
if ( $( '#faq-content' ).length ) {
|
499 |
+
$( '#faq-content' ).accordion(
|
500 |
+
{
|
501 |
+
collapsible: true,
|
502 |
+
animate: 200,
|
503 |
+
header: '.faq-question',
|
504 |
+
heightStyle: 'content'
|
505 |
+
}
|
506 |
+
);
|
507 |
+
}
|
508 |
} else {
|
509 |
$( '#breeze-and-cloudways' ).show();
|
510 |
}
|
537 |
// Toggle right-side content
|
538 |
if ( active_tab === 'faq' ) {
|
539 |
$( '#breeze-and-cloudways' ).hide();
|
540 |
+
if ( $( '#faq-content' ).length ) {
|
541 |
+
$( '#faq-content' ).accordion(
|
542 |
+
{
|
543 |
+
collapsible: true,
|
544 |
+
animate: 200,
|
545 |
+
header: '.faq-question',
|
546 |
+
heightStyle: 'content'
|
547 |
+
}
|
548 |
+
);
|
549 |
+
}
|
550 |
} else {
|
551 |
$( '#breeze-and-cloudways' ).show();
|
552 |
}
|
861 |
breeze_permission_check();
|
862 |
document.cookie = 'breeze_active_tab=' + requested_tab;
|
863 |
if ( 'faq' === requested_tab ) {
|
864 |
+
if ( $( '#faq-content' ).length ) {
|
865 |
+
$( '#faq-content' ).accordion(
|
866 |
+
{
|
867 |
+
collapsible: true,
|
868 |
+
animate: 200,
|
869 |
+
header: '.faq-question',
|
870 |
+
heightStyle: 'content'
|
871 |
+
}
|
872 |
+
);
|
873 |
+
}
|
874 |
+
|
875 |
}
|
876 |
selected_services = [];
|
877 |
}
|
assets/js/breeze-main.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
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-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");n(this).is(":checked")?(e.show(),a.removeAttr("disabled"),i.removeAttr("disabled")):(e.hide(),t.removeAttr("checked"),a.removeAttr("checked").attr("disabled","disabled"),i.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js");n(this).is(":checked")?(e.removeAttr("disabled"),t.removeAttr("disabled")):(e.removeAttr("checked").attr("disabled","disabled"),t.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#enable-js-delay",function(){$delay_js_div=n("#breeze-delay-js-scripts-div"),n(this).is(":checked")?$delay_js_div.show():$delay_js_div.hide()})});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(),l()})})}function c(){r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:l})}function d(){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()),l()})}function l(){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(),d(),l(),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="",n=a.find(".breeze-input-group"),s=!1;if(n.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(s=!0)}),s)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(),d(),l()}),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").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),active_tab=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}("breeze_active_tab"),active_tab=active_tab||"basic","import_export"===active_tab&&(active_tab="basic"),0===r("#tab-"+active_tab).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-"+active_tab).addClass("active"),r("#tab-content-"+active_tab).addClass("active")),"faq"===active_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var t,a=["faq"],i=!0,n=!1,s=r("#breeze-inherit-settings-toggle");function b(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",n=a[1].split(/[&;]/g),s=n.length;0<s--;)-1!==n[s].lastIndexOf(i,0)&&n.splice(s,1);return a[0]+(0<n.length?"?"+n.join("&"):"")}return e}s.length&&(r("input",s).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))}),n=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);i&&n&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:s.serializeArray(),beforeSend:function(){s.addClass("loading")},complete:function(){s.removeClass("loading"),n=!1,t.submit()},success:function(){r("input:checked",s).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;!0===$valid_json&&(network=r("#breeze-level").val(),e=r("#breeze_import_settings").get(0).files[0],(t=new FormData).append("action","breeze_import_json"),t.append("network_level",network),t.append("breeze_import_file",e),a=r("#file-selected"),i=r("#file-error"),a.removeClass("file_green file_red").addClass("file_green"),a.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:t,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(a.removeClass("file_green file_red").addClass("file_green"),a.html(e.data),i.html(""),alert(e.data),window.location.reload(!0)):(a.removeClass("file_green file_red"),a.html(""),i.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(s){var n=[];setTimeout(function(){var e=s("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),s(window).on("resize",function(){632<=s(this).height()&&s(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}s(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var a=this.dataset.tabId,t=s(".br-options");o=(o=r("breeze_active_tab"))||"basic",s(".br-link").removeClass("br-active"),s(".br-link").each(function(e,t){var a=t.dataset.breezeLink,i=s(this).find("img"),t=i.get(0).dataset.path;i.attr("src",t+a+".png")});var i=s(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===s(".br-mobile-menu").is(":visible")&&s(".br-link").fadeOut(),s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:a,"is-network":s("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=s(".breeze-per");t.length&&(t.empty(),t.append("<p>Re-checking permissions, please wait...</p>"));s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":s("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e?t.remove():t.length?(s(e).insertBefore(t),t.remove()):s("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}})}(),document.cookie="breeze_active_tab="+a,"faq"===a&&s("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),n=[]}})});var e,o=r("breeze_active_tab");s("#tab-basic").closest("div.br-link").hasClass("br-hide")?s("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=s("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(t=s("#tab-basic")).length&&t.trigger("click");var t=s(".breeze-box");t.on("click",".br-db-item",function(){var e=this.dataset.section;if(s(this).hasClass("br-db-selected")){if(s(this).removeClass("br-db-selected"),n.length){for(var t=[],a=0;a<n.length;a++)e!==n[a]&&t.push(n[a]);n=t}}else s(this).addClass("br-db-selected"),n.push(e);var i=s("#optimize-selected-services");n.length?i.show():i.hide()}),t.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=n.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},n)),security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==s.inArray(a,n)&&(s(t).find("h3").find("span").removeClass("br-has").html("0"),s(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),s("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){n=[]}})}),t.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=s(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(s(this).addClass("opac"),s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":s("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=s(this).is(":checked"),a=s("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),t.on("click","#br-clean-all-cta",function(e){!1===s(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),s("div.br-db-item").each(function(e,t){s(t).find("h3").find("span").removeClass("br-has").html("0")});var t=s("#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(){s(".br-link").fadeToggle()}),t.on("click",".br-submit-save",function(e){e.preventDefault();var e=s(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":s("body").hasClass("network-admin")};s(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){s("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),s(document).on("change","#inherit-settings",function(){var a=s(this).is(":checked"),i=".br-is-network",n=".br-is-custom",e=s(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val();s(".br-overlay-disable").addClass("br-hide");e={action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":s("body").hasClass("network-admin")};s("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(s("#wpcontent")),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){s("#wpcontent").find("div.br-inherit-wait").remove(),!0===a?(s(i).removeClass("br-show").addClass("br-hide"),s(n).removeClass("br-hide").addClass("br-show"),s(".br-link").removeClass("br-hide"),s("#tab-basic").trigger("click")):(s(n).removeClass("br-show").addClass("br-hide"),s(i).removeClass("br-hide").addClass("br-show"),s(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&s(t).addClass("br-hide")}),s("#tab-faq").trigger("click"))}})}),s(document).on("click",".notice-dismiss",function(){var e=s(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
1 |
/*! Created by Cloudways
|
2 |
+
On 08-04-2022 */
|
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-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");n(this).is(":checked")?(e.show(),a.removeAttr("disabled"),i.removeAttr("disabled")):(e.hide(),t.removeAttr("checked"),a.removeAttr("checked").attr("disabled","disabled"),i.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js");n(this).is(":checked")?(e.removeAttr("disabled"),t.removeAttr("disabled")):(e.removeAttr("checked").attr("disabled","disabled"),t.removeAttr("checked").attr("disabled","disabled"))}),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(),l()})})}function c(){r(".breeze-list-url").length&&r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:l})}function d(){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()),l()})}function l(){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(),d(),l(),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="",n=a.find(".breeze-input-group"),s=!1;if(n.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(s=!0)}),s)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(),d(),l()}),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()}),active_tab=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}("breeze_active_tab"),active_tab=active_tab||"basic","import_export"===active_tab&&(active_tab="basic"),0===r("#tab-"+active_tab).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-"+active_tab).addClass("active"),r("#tab-content-"+active_tab).addClass("active")),"faq"===active_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();var t,a=["faq"],i=!0,n=!1,s=r("#breeze-inherit-settings-toggle");function b(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",n=a[1].split(/[&;]/g),s=n.length;0<s--;)-1!==n[s].lastIndexOf(i,0)&&n.splice(s,1);return a[0]+(0<n.length?"?"+n.join("&"):"")}return e}s.length&&(r("input",s).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))}),n=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);i&&n&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:s.serializeArray(),beforeSend:function(){s.addClass("loading")},complete:function(){s.removeClass("loading"),n=!1,t.submit()},success:function(){r("input:checked",s).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;!0===$valid_json&&(network=r("#breeze-level").val(),e=r("#breeze_import_settings").get(0).files[0],(t=new FormData).append("action","breeze_import_json"),t.append("network_level",network),t.append("breeze_import_file",e),a=r("#file-selected"),i=r("#file-error"),a.removeClass("file_green file_red").addClass("file_green"),a.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:t,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(a.removeClass("file_green file_red").addClass("file_green"),a.html(e.data),i.html(""),alert(e.data),window.location.reload(!0)):(a.removeClass("file_green file_red"),a.html(""),i.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(s){var n=[];setTimeout(function(){var e=s("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),s(window).on("resize",function(){632<=s(this).height()&&s(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}s(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var a=this.dataset.tabId,t=s(".br-options");o=(o=r("breeze_active_tab"))||"basic",s(".br-link").removeClass("br-active"),s(".br-link").each(function(e,t){var a=t.dataset.breezeLink,i=s(this).find("img"),t=i.get(0).dataset.path;i.attr("src",t+a+".png")});var i=s(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===s(".br-mobile-menu").is(":visible")&&s(".br-link").fadeOut(),s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:a,"is-network":s("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=s(".breeze-per");t.length&&(t.empty(),t.append("<p>Re-checking permissions, please wait...</p>"));s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":s("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e?t.remove():t.length?(s(e).insertBefore(t),t.remove()):s("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}})}(),document.cookie="breeze_active_tab="+a,"faq"===a&&s("#faq-content").length&&s("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),n=[]}})});var e,o=r("breeze_active_tab");s("#tab-basic").closest("div.br-link").hasClass("br-hide")?s("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=s("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(t=s("#tab-basic")).length&&t.trigger("click");var t=s(".breeze-box");t.on("click",".br-db-item",function(){var e=this.dataset.section;if(s(this).hasClass("br-db-selected")){if(s(this).removeClass("br-db-selected"),n.length){for(var t=[],a=0;a<n.length;a++)e!==n[a]&&t.push(n[a]);n=t}}else s(this).addClass("br-db-selected"),n.push(e);var i=s("#optimize-selected-services");n.length?i.show():i.hide()}),t.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=n.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},n)),security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==s.inArray(a,n)&&(s(t).find("h3").find("span").removeClass("br-has").html("0"),s(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),s("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){n=[]}})}),t.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=s(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(s(this).addClass("opac"),s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":s("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=s(this).is(":checked"),a=s("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),t.on("click","#br-clean-all-cta",function(e){!1===s(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),s("div.br-db-item").each(function(e,t){s(t).find("h3").find("span").removeClass("br-has").html("0")});var t=s("#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(){s(".br-link").fadeToggle()}),t.on("click",".br-submit-save",function(e){e.preventDefault();var e=s(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":s("body").hasClass("network-admin")};s(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){s("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),s(document).on("change","#inherit-settings",function(){var a=s(this).is(":checked"),i=".br-is-network",n=".br-is-custom",e=s(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val();s(".br-overlay-disable").addClass("br-hide");e={action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":s("body").hasClass("network-admin")};s("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(s("#wpcontent")),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){s("#wpcontent").find("div.br-inherit-wait").remove(),!0===a?(s(i).removeClass("br-show").addClass("br-hide"),s(n).removeClass("br-hide").addClass("br-show"),s(".br-link").removeClass("br-hide"),s("#tab-basic").trigger("click")):(s(n).removeClass("br-show").addClass("br-hide"),s(i).removeClass("br-hide").addClass("br-show"),s(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&s(t).addClass("br-hide")}),s("#tab-faq").trigger("click"))}})}),s(document).on("click",".notice-dismiss",function(){var e=s(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,4 @@
|
|
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 08-04-2022 */
|
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}});
|
assets/js/js-front-end/breeze-prefetch-links.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
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=n.replace(breeze_prefetch.local_url,""),t=new URL(breeze_prefetch.local_url).host,r=new URL(n).host;""!==n.trim()&&!1===i.includes(n)&&t===r&&!1===search_for_banned_links(breeze_prefetch.ignore_list,e)&&(i.push(n.trim()),(e=document.createElement("link")).href=n,e.rel="prefetch",document.head.appendChild(e))},150))}),addEventListener("mouseout",function(e){clearTimeout(timer)})});
|
1 |
/*! Created by Cloudways
|
2 |
+
On 08-04-2022 */
|
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=n.replace(breeze_prefetch.local_url,""),t=new URL(breeze_prefetch.local_url).host,r=new URL(n).host;""!==n.trim()&&!1===i.includes(n)&&t===r&&!1===search_for_banned_links(breeze_prefetch.ignore_list,e)&&(i.push(n.trim()),(e=document.createElement("link")).href=n,e.rel="prefetch",document.head.appendChild(e))},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() );
|
@@ -127,6 +127,7 @@ if ( is_admin() || 'cli' === php_sapi_name() ) {
|
|
127 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-html' ) )
|
128 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) )
|
129 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) )
|
|
|
130 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) )
|
131 |
) {
|
132 |
// Call back ob start
|
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.4
|
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.4' );
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
127 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-html' ) )
|
128 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) )
|
129 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) )
|
130 |
+
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-all-js' ) )
|
131 |
|| ! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) )
|
132 |
) {
|
133 |
// Call back ob start
|
inc/breeze-admin.php
CHANGED
@@ -87,7 +87,6 @@ class Breeze_Admin {
|
|
87 |
$is_lazy_load_native = false;
|
88 |
$is_lazy_load_iframe = false;
|
89 |
|
90 |
-
|
91 |
$option_breeze_lazy_load = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load' );
|
92 |
$option_breeze_lazy_load_native = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-native' );
|
93 |
$option_breeze_lazy_load_iframes = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-iframes' );
|
@@ -401,6 +400,8 @@ class Breeze_Admin {
|
|
401 |
'breeze-move-to-footer-js' => array(),
|
402 |
'breeze-defer-js' => array(),
|
403 |
'breeze-enable-js-delay' => '0',
|
|
|
|
|
404 |
);
|
405 |
|
406 |
$file = array_merge( $default_file, $file );
|
87 |
$is_lazy_load_native = false;
|
88 |
$is_lazy_load_iframe = false;
|
89 |
|
|
|
90 |
$option_breeze_lazy_load = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load' );
|
91 |
$option_breeze_lazy_load_native = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-native' );
|
92 |
$option_breeze_lazy_load_iframes = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-iframes' );
|
400 |
'breeze-move-to-footer-js' => array(),
|
401 |
'breeze-defer-js' => array(),
|
402 |
'breeze-enable-js-delay' => '0',
|
403 |
+
'no-breeze-no-delay-js' => array(),
|
404 |
+
'breeze-delay-all-js' => '0',
|
405 |
);
|
406 |
|
407 |
$file = array_merge( $default_file, $file );
|
inc/breeze-configuration.php
CHANGED
@@ -174,12 +174,17 @@ class Breeze_Configuration {
|
|
174 |
|
175 |
$exclude_css = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-css'] ) );
|
176 |
$exclude_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-js'] ) );
|
|
|
177 |
$delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['delay-js-scripts'] ) );
|
178 |
|
179 |
if ( ! empty( $exclude_js ) ) {
|
180 |
$exclude_js = array_unique( $exclude_js );
|
181 |
}
|
182 |
|
|
|
|
|
|
|
|
|
183 |
if ( ! empty( $delay_js ) ) {
|
184 |
$delay_js = array_unique( $delay_js );
|
185 |
}
|
@@ -227,7 +232,8 @@ class Breeze_Configuration {
|
|
227 |
'breeze-defer-js' => $defer_js,
|
228 |
'breeze-enable-js-delay' => ( isset( $_POST['enable-js-delay'] ) ? '1' : '0' ),
|
229 |
'breeze-delay-js-scripts' => $delay_js,
|
230 |
-
|
|
|
231 |
);
|
232 |
|
233 |
breeze_update_option( 'file_settings', $file_settings, true );
|
174 |
|
175 |
$exclude_css = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-css'] ) );
|
176 |
$exclude_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['exclude-js'] ) );
|
177 |
+
$no_delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['no-delay-js-scripts'] ) );
|
178 |
$delay_js = $this->string_convert_arr( sanitize_textarea_field( $_POST['delay-js-scripts'] ) );
|
179 |
|
180 |
if ( ! empty( $exclude_js ) ) {
|
181 |
$exclude_js = array_unique( $exclude_js );
|
182 |
}
|
183 |
|
184 |
+
if ( ! empty( $no_delay_js ) ) {
|
185 |
+
$no_delay_js = array_unique( $no_delay_js );
|
186 |
+
}
|
187 |
+
|
188 |
if ( ! empty( $delay_js ) ) {
|
189 |
$delay_js = array_unique( $delay_js );
|
190 |
}
|
232 |
'breeze-defer-js' => $defer_js,
|
233 |
'breeze-enable-js-delay' => ( isset( $_POST['enable-js-delay'] ) ? '1' : '0' ),
|
234 |
'breeze-delay-js-scripts' => $delay_js,
|
235 |
+
'no-breeze-no-delay-js' => $no_delay_js,
|
236 |
+
'breeze-delay-all-js' => ( isset( $_POST['breeze-delay-all-js'] ) ? '1' : '0' ),
|
237 |
);
|
238 |
|
239 |
breeze_update_option( 'file_settings', $file_settings, true );
|
inc/functions.php
CHANGED
@@ -45,7 +45,7 @@ function breeze_get_cache_base_path( $is_network = false, $blog_id_requested = 0
|
|
45 |
$path .= abs( intval( $blog_id ) ) . DIRECTORY_SEPARATOR;
|
46 |
}
|
47 |
} else {
|
48 |
-
$path
|
49 |
$path .= abs( intval( $blog_id_requested ) ) . DIRECTORY_SEPARATOR;
|
50 |
}
|
51 |
} else {
|
@@ -352,3 +352,15 @@ function breeze_which_role_folder( $hash = '' ) {
|
|
352 |
|
353 |
return $user_has_roles;
|
354 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
$path .= abs( intval( $blog_id ) ) . DIRECTORY_SEPARATOR;
|
46 |
}
|
47 |
} else {
|
48 |
+
$path = rtrim( WP_CONTENT_DIR, '/\\' ) . '/cache/breeze/';
|
49 |
$path .= abs( intval( $blog_id_requested ) ) . DIRECTORY_SEPARATOR;
|
50 |
}
|
51 |
} else {
|
352 |
|
353 |
return $user_has_roles;
|
354 |
}
|
355 |
+
|
356 |
+
|
357 |
+
function breeze_load_delay_script(){
|
358 |
+
|
359 |
+
$delay_script_js = <<<SCRIPT_TEST
|
360 |
+
<script>
|
361 |
+
var breeze_is_loading=!1,breeze_event_name="breeze-event";function Breeze_Queue(){this.breeze_elements=[]}Breeze_Queue.prototype.enqueue=function(e){this.breeze_elements.push(e)},Breeze_Queue.prototype.dequeue=function(){return this.breeze_elements.shift()},Breeze_Queue.prototype.isEmpty=function(){return 0==this.breeze_elements.length},Breeze_Queue.prototype.peek=function(){return this.isEmpty()?void 0:this.breeze_elements[0]},Breeze_Queue.prototype.length=function(){return this.breeze_elements.length},Breeze_Queue.prototype.fetch_array=function(){return this.breeze_elements},Breeze_Queue.prototype.get_current=function(){return this.breeze_elements[0]};let breeze_scripts_queue=new Breeze_Queue;function breeze_htmlspecialchars_decode(e,t){let n=0,r=0,u=!1;void 0===t&&(t=2),e=e.toString().replace(/</g,"<").replace(/>/g,">");const i={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===t&&(u=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r<t.length;r++)0===i[t[r]]?u=!0:i[t[r]]&&(n|=i[t[r]]);t=n}return t&i.ENT_HTML_QUOTE_SINGLE&&(e=e.replace(/�*39;/g,"'")),u||(e=e.replace(/"/g,'"')),e=e.replace(/&/g,"&")}window.addEventListener("DOMContentLoaded",e=>{document.querySelectorAll("div.breeze-scripts-load").forEach(function(e){breeze_scripts_queue.enqueue(e)});const t=function(){var e=breeze_scripts_queue.get_current();return new Promise(function(n,r){if(void 0!==e){var u=e.dataset.file,i=parseInt(u),o=e.dataset.async,s=e.dataset.defer,c=e.dataset.locate,_=e.textContent||e.innerText;_=_.trim(),i=1===i,s="true"===s,o="true"===o;const r=document.createElement("script");if(!0===i?(!0===o&&(r.async="async"),!0===s&&(r.defer="defer"),r.async=!1,r.type="text/javascript",r.src=_):(r.type="text/javascript",r.innerHTML=breeze_htmlspecialchars_decode(_,"ENT_QUOTES")),!0===i)r.onload=function(){if(breeze_is_loading=!1,window.CustomEvent){var e=new CustomEvent(breeze_event_name,{detail:{file_script:_}});document.body.dispatchEvent(e)}breeze_scripts_queue.dequeue(),setTimeout(function(){t()},1)},r.addEventListener("load",function(){n(r)});else{if(window.CustomEvent){var a=new CustomEvent(breeze_event_name,{detail:{file_script:_}});document.body.dispatchEvent(a)}breeze_scripts_queue.dequeue(),setTimeout(function(){t()},1)}"footer"===c?e.parentNode.insertBefore(r,e):document.getElementsByTagName("head")[0].appendChild(r),e.remove()}else breeze_scripts_queue.dequeue(),breeze_scripts_queue.isEmpty()||t()})};setTimeout(function(){t()},1)});
|
362 |
+
</script>
|
363 |
+
SCRIPT_TEST;
|
364 |
+
|
365 |
+
return $delay_script_js;
|
366 |
+
}
|
inc/helpers.php
CHANGED
@@ -960,8 +960,10 @@ function breeze_migrate_old_settings( $is_sigle = true, $subsite_id = 0, $is_roo
|
|
960 |
'breeze-exclude-js' => ( isset( $options['breeze-exclude-js'] ) ? $options['breeze-exclude-js'] : array() ),
|
961 |
'breeze-move-to-footer-js' => ( isset( $options['breeze-move-to-footer-js'] ) ? $options['breeze-move-to-footer-js'] : array() ),
|
962 |
'breeze-defer-js' => ( isset( $options['breeze-defer-js'] ) ? $options['breeze-defer-js'] : array() ),
|
|
|
963 |
'breeze-enable-js-delay' => ( isset( $options['breeze-enable-js-delay'] ) ? $options['breeze-enable-js-delay'] : '0' ),
|
964 |
'breeze-delay-js-scripts' => ( isset( $options['breeze-delay-js-scripts'] ) ? $options['breeze-delay-js-scripts'] : array() ),
|
|
|
965 |
|
966 |
);
|
967 |
|
960 |
'breeze-exclude-js' => ( isset( $options['breeze-exclude-js'] ) ? $options['breeze-exclude-js'] : array() ),
|
961 |
'breeze-move-to-footer-js' => ( isset( $options['breeze-move-to-footer-js'] ) ? $options['breeze-move-to-footer-js'] : array() ),
|
962 |
'breeze-defer-js' => ( isset( $options['breeze-defer-js'] ) ? $options['breeze-defer-js'] : array() ),
|
963 |
+
'breeze-delay-all-js' => ( isset( $options['breeze-delay-all-js'] ) ? $options['breeze-delay-all-js'] : '0' ),
|
964 |
'breeze-enable-js-delay' => ( isset( $options['breeze-enable-js-delay'] ) ? $options['breeze-enable-js-delay'] : '0' ),
|
965 |
'breeze-delay-js-scripts' => ( isset( $options['breeze-delay-js-scripts'] ) ? $options['breeze-delay-js-scripts'] : array() ),
|
966 |
+
'no-breeze-no-delay-js' => ( isset( $options['no-breeze-no-delay-js'] ) ? $options['no-breeze-no-delay-js'] : array() ),
|
967 |
|
968 |
);
|
969 |
|
inc/minification/breeze-js-deferred-loading.php
CHANGED
@@ -141,6 +141,19 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
141 |
'post_id',
|
142 |
'data-noptimize',
|
143 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
/**
|
145 |
* Defer/Delay the inline scripts.
|
146 |
*
|
@@ -148,6 +161,13 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
148 |
*/
|
149 |
private $delay_inline_js = array();
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Contains all the scripts that will be delayed.
|
153 |
*
|
@@ -158,6 +178,10 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
158 |
'footer' => array(),
|
159 |
);
|
160 |
|
|
|
|
|
|
|
|
|
161 |
/**
|
162 |
* Reads the page content and fetches the JavaScript script tags.
|
163 |
*
|
@@ -174,6 +198,15 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
174 |
$this->delay_inline_js = $options['delay_inline_js'];
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
// Read the list of scripts that need defer tag.
|
178 |
if ( ! empty( $options['defer_js'] ) ) {
|
179 |
$this->defer_js = $options['defer_js'];
|
@@ -243,11 +276,25 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
243 |
}
|
244 |
|
245 |
if ( preg_match_all( '#<script.*</script>#Usmi', $content, $matches ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
foreach ( $matches[0] as $tag ) {
|
247 |
if ( ! empty( $tag ) ) {
|
248 |
$tag = str_replace( '”', '"', $tag );
|
249 |
}
|
250 |
|
|
|
|
|
|
|
|
|
251 |
|
252 |
// only consider aggregation whitelisted in should_aggregate-function
|
253 |
if ( ! $this->should_aggregate( $tag ) ) {
|
@@ -279,50 +326,138 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
279 |
$url = substr( $url, 0, - 1 );
|
280 |
}
|
281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
$path = $this->getpath( $url );
|
283 |
-
if ( $path !== false && preg_match( '#\.js$#', $path ) ) {
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
} else {
|
309 |
-
$this->
|
|
|
310 |
}
|
311 |
} else {
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
$content = str_replace( $tag, '', $content );
|
314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
} else {
|
316 |
-
//
|
|
|
317 |
if ( $this->is_movable( $tag ) ) {
|
318 |
-
//Yeah, move it
|
319 |
if ( $this->move_to_last( $tag ) ) {
|
320 |
$this->move['last'][] = $tag;
|
321 |
} else {
|
322 |
$this->move['first'][] = $tag;
|
323 |
}
|
324 |
} else {
|
325 |
-
$is_delayed = $this->
|
326 |
if ( $is_delayed ) {
|
327 |
if ( true === $head ) {
|
328 |
$this->delay_scripts['header'][ $url ] = array(
|
@@ -335,47 +470,69 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
335 |
'version' => $script_version,
|
336 |
);
|
337 |
}
|
338 |
-
|
|
|
|
|
339 |
}
|
340 |
|
341 |
-
//We shouldn't touch this
|
342 |
-
$tag = '';
|
343 |
}
|
344 |
}
|
345 |
-
}
|
346 |
-
|
|
|
|
|
|
|
347 |
|
|
|
|
|
|
|
348 |
if ( true === $head ) {
|
349 |
-
|
350 |
-
if ( in_array( $url, $this->move_to_footer_js ) ) {
|
351 |
-
$this->move_to_footer[ $url ] = $url;
|
352 |
-
} else {
|
353 |
-
$this->head_scripts[ $url ] = $url;
|
354 |
-
}
|
355 |
} else {
|
356 |
-
$this->
|
357 |
}
|
358 |
-
|
359 |
-
//Remove the original script tag
|
360 |
$content = str_replace( $tag, '', $content );
|
361 |
}
|
362 |
-
}
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
-
|
|
|
|
|
365 |
|
366 |
-
|
367 |
-
|
|
|
368 |
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
} else {
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
377 |
-
|
|
|
378 |
}
|
|
|
|
|
|
|
|
|
|
|
379 |
}
|
380 |
}
|
381 |
}
|
@@ -433,121 +590,239 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
433 |
}
|
434 |
}
|
435 |
|
436 |
-
|
437 |
-
if ( ! empty( $this->head_scripts ) ) {
|
438 |
|
439 |
-
|
440 |
-
$
|
441 |
|
442 |
-
|
443 |
-
$
|
444 |
|
445 |
-
|
446 |
-
$
|
447 |
-
|
|
|
|
|
|
|
448 |
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
|
|
|
|
|
|
460 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
|
462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
}
|
464 |
-
$js_replacement = '';
|
465 |
-
$js_replacement .= implode( '', $js_head );
|
466 |
-
$this->inject_in_html( $js_replacement, $replaceTag );
|
467 |
-
}
|
468 |
|
469 |
-
if ( ! empty( $this->footer_scripts ) ) {
|
470 |
-
$replaceTag = array( '</body>', 'before' );
|
471 |
-
$js_footer = array();
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
}
|
|
|
|
|
|
|
|
|
478 |
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
$
|
487 |
-
|
488 |
-
|
489 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
}
|
491 |
|
492 |
-
$
|
|
|
|
|
493 |
}
|
494 |
-
$js_replacement = '';
|
495 |
-
$js_replacement .= implode( '', $js_footer );
|
496 |
-
$this->inject_in_html( $js_replacement, $replaceTag );
|
497 |
-
}
|
498 |
|
|
|
499 |
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
$
|
508 |
-
}
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
$js_url_add = '?' . $js_script['version'];
|
513 |
-
$js_url_add = trim( $js_url_add, "'" );
|
514 |
}
|
515 |
-
|
516 |
-
|
517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
|
|
|
|
|
|
519 |
}
|
520 |
-
$js_replacement = '';
|
521 |
-
$js_replacement .= implode( '', $js_head_defer );
|
522 |
-
$this->inject_in_html( $js_replacement, $replace_tag );
|
523 |
-
}
|
524 |
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
|
535 |
-
if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
|
536 |
-
if ( ! empty( $js_script['version'] ) ) {
|
537 |
-
$js_url_add = $js_url . '?' . $js_script['version'];
|
538 |
-
$js_url_add = trim( $js_url_add, "'" );
|
539 |
}
|
540 |
-
$js_footer_defer[] = "<script type=\"application/javascript\" {$defer} src=\"{$js_url_add}\"></script>\n";
|
541 |
-
} else {
|
542 |
-
$js_footer_defer[] = "<script type='module'>{$js_script}</script>\n";
|
543 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
}
|
545 |
|
546 |
-
$js_replacement = '';
|
547 |
-
$js_replacement .= implode( '', $js_footer_defer );
|
548 |
-
$this->inject_in_html( $js_replacement, $replace_tag );
|
549 |
}
|
550 |
|
|
|
551 |
// restore comments
|
552 |
$this->content = $this->restore_comments( $this->content );
|
553 |
|
@@ -560,7 +835,6 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
560 |
return $this->content;
|
561 |
}
|
562 |
|
563 |
-
|
564 |
// Checks against the white- and blacklists
|
565 |
private function is_merge_valid( $tag ) {
|
566 |
if ( ! empty( $this->whitelist ) ) {
|
@@ -584,10 +858,24 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
584 |
return false;
|
585 |
}
|
586 |
|
|
|
587 |
foreach ( $this->dontmove as $match ) {
|
588 |
if ( strpos( $tag, $match ) !== false ) {
|
589 |
//Matched something
|
590 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
}
|
592 |
}
|
593 |
|
@@ -629,6 +917,25 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
629 |
return true;
|
630 |
}
|
631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
/**
|
633 |
* Check if the inline script is in the list of delay.
|
634 |
*
|
@@ -731,4 +1038,58 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
731 |
|
732 |
return $url;
|
733 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
141 |
'post_id',
|
142 |
'data-noptimize',
|
143 |
);
|
144 |
+
/**
|
145 |
+
* Defer/Delay the inline scripts.
|
146 |
+
*
|
147 |
+
* @var array
|
148 |
+
*/
|
149 |
+
private $no_delay_js = array();
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Delay the Javascript
|
153 |
+
* @var array
|
154 |
+
*/
|
155 |
+
private $delay_javascript = false;
|
156 |
+
|
157 |
/**
|
158 |
* Defer/Delay the inline scripts.
|
159 |
*
|
161 |
*/
|
162 |
private $delay_inline_js = array();
|
163 |
|
164 |
+
/**
|
165 |
+
* If Inline JS delay is on/off.
|
166 |
+
*
|
167 |
+
* @var array
|
168 |
+
*/
|
169 |
+
private $is_inline_delay_on = false;
|
170 |
+
|
171 |
/**
|
172 |
* Contains all the scripts that will be delayed.
|
173 |
*
|
178 |
'footer' => array(),
|
179 |
);
|
180 |
|
181 |
+
private $donotmove_exception = array( 'jQuery' );
|
182 |
+
|
183 |
+
private $custom_js_exclude = array();
|
184 |
+
|
185 |
/**
|
186 |
* Reads the page content and fetches the JavaScript script tags.
|
187 |
*
|
198 |
$this->delay_inline_js = $options['delay_inline_js'];
|
199 |
}
|
200 |
|
201 |
+
// Inline delay scripts.
|
202 |
+
if ( ! empty( $options['no_delay_js'] ) ) {
|
203 |
+
$this->no_delay_js = $options['no_delay_js'];
|
204 |
+
}
|
205 |
+
|
206 |
+
$this->delay_javascript = $options['delay_javascript'];
|
207 |
+
$this->is_inline_delay_on = $options['is_inline_delay_on'];
|
208 |
+
|
209 |
+
|
210 |
// Read the list of scripts that need defer tag.
|
211 |
if ( ! empty( $options['defer_js'] ) ) {
|
212 |
$this->defer_js = $options['defer_js'];
|
276 |
}
|
277 |
|
278 |
if ( preg_match_all( '#<script.*</script>#Usmi', $content, $matches ) ) {
|
279 |
+
|
280 |
+
if ( wp_script_is( 'spai-sniper', 'enqueued' ) ) {
|
281 |
+
$jquery_local_path = home_url( '/wp-includes/js/jquery/jquery.js' );
|
282 |
+
$this->custom_js_exclude[] = $jquery_local_path;
|
283 |
+
}
|
284 |
+
|
285 |
+
if ( isset( $matches[0] ) && ! empty( $matches[0] ) ) {
|
286 |
+
$matches[0] = $this->delay_script_loading( $matches[0] );
|
287 |
+
}
|
288 |
+
|
289 |
foreach ( $matches[0] as $tag ) {
|
290 |
if ( ! empty( $tag ) ) {
|
291 |
$tag = str_replace( '”', '"', $tag );
|
292 |
}
|
293 |
|
294 |
+
if ( false !== strpos( $tag, 'ga(' ) || false !== strpos( $tag, 'google-analytics.com/analytics.js' ) ) {
|
295 |
+
$tag = '';
|
296 |
+
continue;
|
297 |
+
}
|
298 |
|
299 |
// only consider aggregation whitelisted in should_aggregate-function
|
300 |
if ( ! $this->should_aggregate( $tag ) ) {
|
326 |
$url = substr( $url, 0, - 1 );
|
327 |
}
|
328 |
|
329 |
+
// Let's check if this file is in the excluded list.
|
330 |
+
$is_excluded = breeze_is_string_in_array_values( $url, $this->custom_js_exclude );
|
331 |
+
|
332 |
+
//exclude js
|
333 |
+
if ( ! empty( $is_excluded ) ) {
|
334 |
+
continue;
|
335 |
+
}
|
336 |
+
|
337 |
$path = $this->getpath( $url );
|
|
|
338 |
|
339 |
+
if ( true === $this->is_inline_delay_on ) {
|
340 |
+
if ( $path !== false && preg_match( '#\.js$#', $path ) ) {
|
341 |
+
|
342 |
+
if ( $this->is_merge_valid( $tag ) ) {
|
343 |
+
//We can merge it
|
344 |
+
if ( true === $head ) {
|
345 |
+
// If this file will be move to footer
|
346 |
+
$compare_url = ltrim( $url, 'https:' );
|
347 |
+
$cdn_url = $this->url_replace_cdn( $url );
|
348 |
+
$cdn_url_trim = ltrim( $cdn_url, 'https:' );
|
349 |
+
|
350 |
+
if (
|
351 |
+
( in_array( $compare_url, $this->move_to_footer_js ) ||
|
352 |
+
in_array( $url, $this->move_to_footer_js ) ||
|
353 |
+
in_array( $cdn_url, $this->move_to_footer_js ) ||
|
354 |
+
in_array( $cdn_url_trim, $this->move_to_footer_js )
|
355 |
+
) ||
|
356 |
+
(
|
357 |
+
in_array( $compare_url, $cdn_array_move_to_footer ) ||
|
358 |
+
in_array( $url, $cdn_array_move_to_footer ) ||
|
359 |
+
in_array( $cdn_url, $cdn_array_move_to_footer ) ||
|
360 |
+
in_array( $cdn_url_trim, $cdn_array_move_to_footer )
|
361 |
+
)
|
362 |
+
) {
|
363 |
+
$this->footer_scripts[ $url ] = $path;
|
364 |
+
$content = str_replace( $tag, '', $content );
|
365 |
+
} else {
|
366 |
+
$this->head_scripts[ $url ] = $path;
|
367 |
+
}
|
368 |
} else {
|
369 |
+
$this->footer_scripts[ $url ] = $path;
|
370 |
+
$content = str_replace( $tag, '', $content );
|
371 |
}
|
372 |
} else {
|
373 |
+
//No merge, but maybe we can move it
|
374 |
+
if ( $this->is_movable( $tag ) ) {
|
375 |
+
//Yeah, move it
|
376 |
+
if ( $this->move_to_last( $tag ) ) {
|
377 |
+
$this->move['last'][] = $tag;
|
378 |
+
} else {
|
379 |
+
$this->move['first'][] = $tag;
|
380 |
+
}
|
381 |
+
} else {
|
382 |
+
$is_delayed = $this->is_inline_delay( $tag );
|
383 |
+
if ( $is_delayed ) {
|
384 |
+
if ( true === $head ) {
|
385 |
+
$this->delay_scripts['header'][ $url ] = array(
|
386 |
+
'path' => $path,
|
387 |
+
'version' => $script_version,
|
388 |
+
);
|
389 |
+
} else {
|
390 |
+
$this->delay_scripts['footer'][ $url ] = array(
|
391 |
+
'path' => $path,
|
392 |
+
'version' => $script_version,
|
393 |
+
);
|
394 |
+
}
|
395 |
+
$content = str_replace( $tag, '', $content );
|
396 |
+
}
|
397 |
+
|
398 |
+
//We shouldn't touch this
|
399 |
+
$tag = '';
|
400 |
+
}
|
401 |
+
}
|
402 |
+
} else {
|
403 |
+
if ( breeze_validate_url_via_regexp( $url ) ) {
|
404 |
+
|
405 |
+
if ( true === $head ) {
|
406 |
+
|
407 |
+
if ( in_array( $url, $this->move_to_footer_js ) ) {
|
408 |
+
$this->move_to_footer[ $url ] = $url;
|
409 |
+
} else {
|
410 |
+
$this->head_scripts[ $url ] = $url;
|
411 |
+
}
|
412 |
+
} else {
|
413 |
+
$this->footer_scripts[ $url ] = $url;
|
414 |
+
}
|
415 |
+
|
416 |
+
//Remove the original script tag
|
417 |
$content = str_replace( $tag, '', $content );
|
418 |
}
|
419 |
+
}
|
420 |
+
} else {
|
421 |
+
if ( $path !== false && preg_match( '#\.js$#', $path ) ) {
|
422 |
+
//Inline
|
423 |
+
if ( $this->is_merge_valid( $tag ) ) {
|
424 |
+
//We can merge it
|
425 |
+
if ( true === $head ) {
|
426 |
+
// If this file will be move to footer
|
427 |
+
|
428 |
+
if ( in_array( $url, $this->move_to_footer_js ) ) {
|
429 |
+
$this->move_to_footer[ $url ] = $path;
|
430 |
+
} else {
|
431 |
+
$this->head_scripts[ $url ] = $path;
|
432 |
+
}
|
433 |
+
} else {
|
434 |
+
$this->footer_scripts[ $url ] = $path;
|
435 |
+
}
|
436 |
+
} else {
|
437 |
+
//No merge, but maybe we can move it
|
438 |
+
if ( $this->is_movable( $tag ) ) {
|
439 |
+
//Yeah, move it
|
440 |
+
if ( $this->move_to_last( $tag ) ) {
|
441 |
+
$this->move['last'][] = $tag;
|
442 |
+
} else {
|
443 |
+
$this->move['first'][] = $tag;
|
444 |
+
}
|
445 |
+
} else {
|
446 |
+
//We shouldn't touch this
|
447 |
+
$tag = '';
|
448 |
+
}
|
449 |
+
}
|
450 |
} else {
|
451 |
+
//External script (example: google analytics)
|
452 |
+
//OR Script is dynamic (.php etc)
|
453 |
if ( $this->is_movable( $tag ) ) {
|
|
|
454 |
if ( $this->move_to_last( $tag ) ) {
|
455 |
$this->move['last'][] = $tag;
|
456 |
} else {
|
457 |
$this->move['first'][] = $tag;
|
458 |
}
|
459 |
} else {
|
460 |
+
$is_delayed = $this->ignore_from_delay( $tag );
|
461 |
if ( $is_delayed ) {
|
462 |
if ( true === $head ) {
|
463 |
$this->delay_scripts['header'][ $url ] = array(
|
470 |
'version' => $script_version,
|
471 |
);
|
472 |
}
|
473 |
+
} else {
|
474 |
+
//We shouldn't touch this
|
475 |
+
$tag = '';
|
476 |
}
|
477 |
|
|
|
|
|
478 |
}
|
479 |
}
|
480 |
+
}
|
481 |
+
} else {
|
482 |
+
if ( true === $this->is_inline_delay_on ) {
|
483 |
+
$is_delayed = $this->is_inline_delay( $tag );
|
484 |
+
if ( true === $is_delayed ) {
|
485 |
|
486 |
+
preg_match( '#<script.*>(.*)</script>#Usmi', $tag, $code );
|
487 |
+
$code = preg_replace( '#.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*#sm', '$1', $code[1] );
|
488 |
+
$code = preg_replace( '/(?:^\\s*<!--\\s*|\\s*(?:\\/\\/)?\\s*-->\\s*$)/', '', $code );
|
489 |
if ( true === $head ) {
|
490 |
+
$this->delay_scripts['header'][] = $code;
|
|
|
|
|
|
|
|
|
|
|
491 |
} else {
|
492 |
+
$this->delay_scripts['footer'][] = $code;
|
493 |
}
|
|
|
|
|
494 |
$content = str_replace( $tag, '', $content );
|
495 |
}
|
496 |
+
} else {
|
497 |
+
// Inline script
|
498 |
+
if ( $this->isremovable( $tag, $this->jsremovables ) ) {
|
499 |
+
$content = str_replace( $tag, '', $content );
|
500 |
+
continue;
|
501 |
+
}
|
502 |
|
503 |
+
// unhide comments, as javascript may be wrapped in comment-tags for old times' sake
|
504 |
+
$tag = $this->restore_comments( $tag );
|
505 |
+
if ( $this->is_merge_valid( $tag ) ) {
|
506 |
|
507 |
+
preg_match( '#<script.*>(.*)</script>#Usmi', $tag, $code );
|
508 |
+
$code = preg_replace( '#.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*#sm', '$1', $code[1] );
|
509 |
+
$code = preg_replace( '/(?:^\\s*<!--\\s*|\\s*(?:\\/\\/)?\\s*-->\\s*$)/', '', $code );
|
510 |
|
511 |
+
if ( $head ) {
|
512 |
+
$this->head_scripts[] = 'INLINE;' . $code;
|
513 |
+
} else {
|
514 |
+
$this->footer_scripts[] = 'INLINE;' . $code;
|
515 |
+
}
|
516 |
} else {
|
517 |
+
// Can we move this?
|
518 |
+
if ( $this->is_movable( $tag ) ) {
|
519 |
+
if ( $this->move_to_last( $tag ) ) {
|
520 |
+
$this->move['last'][] = $tag;
|
521 |
+
} else {
|
522 |
+
$this->move['first'][] = $tag;
|
523 |
+
}
|
524 |
+
} else {
|
525 |
+
$tag = '';
|
526 |
+
}
|
527 |
}
|
528 |
+
// re-hide comments to be able to do the removal based on tag from $this->content
|
529 |
+
$tag = $this->hide_comments( $tag );
|
530 |
}
|
531 |
+
|
532 |
+
}
|
533 |
+
//Remove the original script tag
|
534 |
+
if ( false === $this->is_inline_delay_on ) {
|
535 |
+
$content = str_replace( $tag, '', $content );
|
536 |
}
|
537 |
}
|
538 |
}
|
590 |
}
|
591 |
}
|
592 |
|
593 |
+
if ( true === $this->is_inline_delay_on ) {
|
|
|
594 |
|
595 |
+
// Load inline JS to html
|
596 |
+
if ( ! empty( $this->head_scripts ) ) {
|
597 |
|
598 |
+
$replaceTag = array( '</head>', 'before' );
|
599 |
+
$js_head = array();
|
600 |
|
601 |
+
foreach ( $this->head_scripts as $js_url => $js_path ) {
|
602 |
+
$defer = '';
|
603 |
+
|
604 |
+
if ( ! empty( $this->cdn_url ) ) {
|
605 |
+
$js_url = $this->url_replace_cdn( $js_url );
|
606 |
+
}
|
607 |
|
608 |
+
$js_url_trim = ltrim( $js_url, 'https:' );
|
609 |
+
|
610 |
+
if (
|
611 |
+
gettype( $js_url ) == 'string' &&
|
612 |
+
(
|
613 |
+
in_array( $js_url, $this->defer_js ) ||
|
614 |
+
in_array( $js_url_trim, $this->defer_js ) ||
|
615 |
+
$this->is_inline_delay( $js_url )
|
616 |
+
)
|
617 |
+
) {
|
618 |
+
$defer = 'defer ';
|
619 |
+
}
|
620 |
+
|
621 |
+
$js_head[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
622 |
}
|
623 |
+
$js_replacement = '';
|
624 |
+
$js_replacement .= implode( '', $js_head );
|
625 |
+
$this->inject_in_html( $js_replacement, $replaceTag );
|
626 |
+
}
|
627 |
+
|
628 |
+
if ( ! empty( $this->footer_scripts ) ) {
|
629 |
+
$replaceTag = array( '</body>', 'before' );
|
630 |
+
$js_footer = array();
|
631 |
+
|
632 |
+
foreach ( $this->footer_scripts as $js_url => $js_path ) {
|
633 |
+
$defer = '';
|
634 |
+
if ( ! empty( $this->cdn_url ) ) {
|
635 |
+
$js_url = $this->url_replace_cdn( $js_url );
|
636 |
+
}
|
637 |
|
638 |
+
$js_url_trim = ltrim( $js_url, 'https:' );
|
639 |
+
|
640 |
+
if (
|
641 |
+
gettype( $js_url ) == 'string' &&
|
642 |
+
(
|
643 |
+
in_array( $js_url, $this->defer_js ) ||
|
644 |
+
in_array( $js_url_trim, $this->defer_js ) ||
|
645 |
+
$this->is_inline_delay( $js_url )
|
646 |
+
)
|
647 |
+
) {
|
648 |
+
$defer = 'defer ';
|
649 |
+
}
|
650 |
+
|
651 |
+
$js_footer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
652 |
+
}
|
653 |
+
$js_replacement = '';
|
654 |
+
$js_replacement .= implode( '', $js_footer );
|
655 |
+
$this->inject_in_html( $js_replacement, $replaceTag );
|
656 |
}
|
|
|
|
|
|
|
|
|
657 |
|
|
|
|
|
|
|
658 |
|
659 |
+
// handle the 3rd party defer scripts in header.
|
660 |
+
if ( ! empty( $this->delay_scripts ) && ! empty( $this->delay_scripts['header'] ) ) {
|
661 |
+
$replace_tag = array( '</head>', 'before' );
|
662 |
+
$js_head_defer = array();
|
663 |
+
$defer = 'defer';
|
664 |
+
foreach ( $this->delay_scripts['header'] as $js_url => $js_script ) {
|
665 |
+
if ( is_string( $js_url ) ) {
|
666 |
+
$js_url = trim( $js_url, '”' );
|
667 |
+
}
|
668 |
+
|
669 |
+
if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
|
670 |
+
if ( ! empty( $js_script['version'] ) ) {
|
671 |
+
$js_url_add = '?' . $js_script['version'];
|
672 |
+
$js_url_add = trim( $js_url_add, "'" );
|
673 |
+
}
|
674 |
+
$js_head_defer[] = "<script type='application/javascript' {$defer} src='{$js_url_add}'></script>\n";
|
675 |
+
} else {
|
676 |
+
$js_head_defer[] = "<script type='module'>{$js_script}</script>\n";
|
677 |
+
}
|
678 |
}
|
679 |
+
$js_replacement = '';
|
680 |
+
$js_replacement .= implode( '', $js_head_defer );
|
681 |
+
$this->inject_in_html( $js_replacement, $replace_tag );
|
682 |
+
}
|
683 |
|
684 |
+
// handle the 3rd party defer scripts in footer.
|
685 |
+
if ( ! empty( $this->delay_scripts ) && ! empty( $this->delay_scripts['footer'] ) ) {
|
686 |
+
$replace_tag = array( '</body>', 'before' );
|
687 |
+
$js_footer_defer = array();
|
688 |
+
$defer = 'defer';
|
689 |
+
foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
|
690 |
+
if ( is_string( $js_url ) ) {
|
691 |
+
$js_url = trim( $js_url, '”' );
|
692 |
+
}
|
693 |
+
|
694 |
+
if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
|
695 |
+
if ( ! empty( $js_script['version'] ) ) {
|
696 |
+
$js_url_add = $js_url . '?' . $js_script['version'];
|
697 |
+
$js_url_add = trim( $js_url_add, "'" );
|
698 |
+
}
|
699 |
+
$js_footer_defer[] = "<script type=\"application/javascript\" {$defer} src=\"{$js_url_add}\"></script>\n";
|
700 |
+
} else {
|
701 |
+
$js_footer_defer[] = "<script type='module'>{$js_script}</script>\n";
|
702 |
+
}
|
703 |
}
|
704 |
|
705 |
+
$js_replacement = '';
|
706 |
+
$js_replacement .= implode( '', $js_footer_defer );
|
707 |
+
$this->inject_in_html( $js_replacement, $replace_tag );
|
708 |
}
|
|
|
|
|
|
|
|
|
709 |
|
710 |
+
} else {
|
711 |
|
712 |
+
// Load inline JS to html
|
713 |
+
if ( ! empty( $this->head_scripts ) ) {
|
714 |
+
|
715 |
+
$replaceTag = array( '</head>', 'before' );
|
716 |
+
$js_head = array();
|
717 |
+
|
718 |
+
foreach ( $this->head_scripts as $js_url => $js_path ) {
|
719 |
+
$defer = '';
|
|
|
720 |
|
721 |
+
if ( ! empty( $this->cdn_url ) ) {
|
722 |
+
$js_url = $this->url_replace_cdn( $js_url );
|
|
|
|
|
723 |
}
|
724 |
+
|
725 |
+
$js_url_trim = ltrim( $js_url, 'https:' );
|
726 |
+
|
727 |
+
if (
|
728 |
+
gettype( $js_url ) == 'string' &&
|
729 |
+
(
|
730 |
+
in_array( $js_url, $this->defer_js ) ||
|
731 |
+
in_array( $js_url_trim, $this->defer_js )
|
732 |
+
)
|
733 |
+
) {
|
734 |
+
$defer = 'defer ';
|
735 |
+
}
|
736 |
+
|
737 |
+
if ( empty( $defer ) ) {
|
738 |
+
$delay_defer = 'false';
|
739 |
+
} else {
|
740 |
+
$delay_defer = "true";
|
741 |
+
}
|
742 |
+
#$defer = "true";
|
743 |
+
if ( false !== strpos( $js_path, 'INLINE;' ) ) {
|
744 |
+
$js_path = str_replace( 'INLINE;', '', $js_path );
|
745 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_url ) ) {
|
746 |
+
$js_head[] = '<div class="breeze-scripts-load" data-file="0" data-async="false" data-locate="head" data-defer="' . $delay_defer . '" style="display:none">' . htmlspecialchars( $js_path, ENT_QUOTES ) . '</div>' . "\n";
|
747 |
+
} else {
|
748 |
+
$js_head[] = "<script type='application/javascript' {$defer}>{$js_url}</script>\n";
|
749 |
+
}
|
750 |
+
} else {
|
751 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_url ) ) {
|
752 |
+
$js_head[] = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="head" data-defer="' . $delay_defer . '" style="display:none">' . $js_url . '</div>' . "\n";
|
753 |
+
} else {
|
754 |
+
$js_head[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
755 |
+
}
|
756 |
+
|
757 |
+
}
|
758 |
+
|
759 |
+
//$js_head[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
760 |
}
|
761 |
+
$js_replacement = '';
|
762 |
+
$js_replacement .= implode( '', $js_head );
|
763 |
+
$this->inject_in_html( $js_replacement, $replaceTag );
|
764 |
}
|
|
|
|
|
|
|
|
|
765 |
|
766 |
+
if ( ! empty( $this->footer_scripts ) ) {
|
767 |
+
$replaceTag = array( '</body>', 'before' );
|
768 |
+
$js_footer = array();
|
769 |
+
|
770 |
+
foreach ( $this->footer_scripts as $js_url => $js_path ) {
|
771 |
+
$defer = '';
|
772 |
+
if ( ! empty( $this->cdn_url ) ) {
|
773 |
+
$js_url = $this->url_replace_cdn( $js_url );
|
774 |
+
}
|
775 |
+
|
776 |
+
$js_url_trim = ltrim( $js_url, 'https:' );
|
777 |
+
|
778 |
+
if (
|
779 |
+
gettype( $js_url ) == 'string' &&
|
780 |
+
(
|
781 |
+
in_array( $js_url, $this->defer_js ) ||
|
782 |
+
in_array( $js_url_trim, $this->defer_js )
|
783 |
+
)
|
784 |
+
) {
|
785 |
+
$defer = 'defer ';
|
786 |
+
}
|
787 |
+
|
788 |
+
if ( empty( $defer ) ) {
|
789 |
+
$delay_defer = 'false';
|
790 |
+
} else {
|
791 |
+
$delay_defer = "true";
|
792 |
+
}
|
793 |
+
|
794 |
+
|
795 |
+
if ( false !== strpos( $js_path, 'INLINE;' ) ) {
|
796 |
+
$js_path = str_replace( 'INLINE;', '', $js_path );
|
797 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_path ) ) {
|
798 |
+
$js_footer[] = '<div class="breeze-scripts-load" data-file="0" data-async="false" data-locate="footer" data-defer="' . $delay_defer . '" style="display:none">' . htmlspecialchars( $js_path, ENT_QUOTES ) . '</div>' . "\n";
|
799 |
+
} else {
|
800 |
+
$js_footer[] = "<script type='application/javascript' {$defer}>{$js_path}</script>\n";
|
801 |
+
}
|
802 |
+
|
803 |
+
} else {
|
804 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_url ) ) {
|
805 |
+
$js_footer[] = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="footer" data-defer="' . $delay_defer . '" style="display:none">' . $js_url . '</div>' . "\n";
|
806 |
+
} else {
|
807 |
+
$js_footer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
808 |
+
}
|
809 |
|
|
|
|
|
|
|
|
|
810 |
}
|
|
|
|
|
|
|
811 |
}
|
812 |
+
$js_replacement = '';
|
813 |
+
$js_replacement .= implode( '', $js_footer );
|
814 |
+
$this->inject_in_html( $js_replacement, $replaceTag );
|
815 |
+
}
|
816 |
+
|
817 |
+
if ( true === $this->delay_javascript ) {
|
818 |
+
$delay_script_js = breeze_load_delay_script();
|
819 |
+
$replace_tag = array( '</body>', 'before' );
|
820 |
+
$this->inject_in_html( $delay_script_js, $replace_tag );
|
821 |
}
|
822 |
|
|
|
|
|
|
|
823 |
}
|
824 |
|
825 |
+
|
826 |
// restore comments
|
827 |
$this->content = $this->restore_comments( $this->content );
|
828 |
|
835 |
return $this->content;
|
836 |
}
|
837 |
|
|
|
838 |
// Checks against the white- and blacklists
|
839 |
private function is_merge_valid( $tag ) {
|
840 |
if ( ! empty( $this->whitelist ) ) {
|
858 |
return false;
|
859 |
}
|
860 |
|
861 |
+
$return_value = true;
|
862 |
foreach ( $this->dontmove as $match ) {
|
863 |
if ( strpos( $tag, $match ) !== false ) {
|
864 |
//Matched something
|
865 |
+
$return_value = false;
|
866 |
+
|
867 |
+
}
|
868 |
+
}
|
869 |
+
|
870 |
+
if ( false === $return_value ) {
|
871 |
+
|
872 |
+
foreach ( $this->donotmove_exception as $match ) {
|
873 |
+
if ( strpos( $tag, $match ) !== false ) {
|
874 |
+
//Matched something
|
875 |
+
|
876 |
+
return true;
|
877 |
+
|
878 |
+
}
|
879 |
}
|
880 |
}
|
881 |
|
917 |
return true;
|
918 |
}
|
919 |
|
920 |
+
/**
|
921 |
+
* Check if the inline script is in the list of delay.
|
922 |
+
*
|
923 |
+
* @param $tag
|
924 |
+
*
|
925 |
+
* @return bool
|
926 |
+
*/
|
927 |
+
private function ignore_from_delay( $tag ) {
|
928 |
+
|
929 |
+
foreach ( $this->no_delay_js as $match ) {
|
930 |
+
if ( strpos( $tag, $match ) !== false ) {
|
931 |
+
//Matched something
|
932 |
+
return true;
|
933 |
+
}
|
934 |
+
}
|
935 |
+
|
936 |
+
return false;
|
937 |
+
}
|
938 |
+
|
939 |
/**
|
940 |
* Check if the inline script is in the list of delay.
|
941 |
*
|
1038 |
|
1039 |
return $url;
|
1040 |
}
|
1041 |
+
|
1042 |
+
/**
|
1043 |
+
* This is an exception for bad written plugins.
|
1044 |
+
* Where they use jQuery but do not load their script with jQuery dependency.
|
1045 |
+
* We will delay these scripts. But if jQuery is not loaded the issue will still persist.
|
1046 |
+
*
|
1047 |
+
* @since 1.2.4
|
1048 |
+
* @access private
|
1049 |
+
*/
|
1050 |
+
private function delay_script_loading( $scripts = array() ) {
|
1051 |
+
|
1052 |
+
if ( ! is_array( $scripts ) || empty( $scripts ) ) {
|
1053 |
+
return $scripts;
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
$to_move_last = apply_filters(
|
1057 |
+
'breeze_delay_bag_scripts',
|
1058 |
+
array(
|
1059 |
+
'sp-scripts.min.js',
|
1060 |
+
'js/tubular.js',
|
1061 |
+
)
|
1062 |
+
);
|
1063 |
+
|
1064 |
+
$return_scripts = array();
|
1065 |
+
$add_last = array();
|
1066 |
+
|
1067 |
+
foreach ( $scripts as $index => $script ) {
|
1068 |
+
$add_return = false;
|
1069 |
+
$add_later = false;
|
1070 |
+
foreach ( $to_move_last as $script_to_delay ) {
|
1071 |
+
if ( false === strpos( $script, $script_to_delay ) ) {
|
1072 |
+
$add_return = true;
|
1073 |
+
break;
|
1074 |
+
} else {
|
1075 |
+
$add_later = true;
|
1076 |
+
}
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
if ( false === $add_later && true === $add_return ) {
|
1080 |
+
$return_scripts[] = $script;
|
1081 |
+
} else if ( true === $add_later ) {
|
1082 |
+
$add_last[] = $script;
|
1083 |
+
}
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
if ( ! empty( $add_last ) ) {
|
1087 |
+
foreach ( $add_last as $delayed_js_script ) {
|
1088 |
+
$return_scripts[] = $delayed_js_script;
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
|
1092 |
+
return $return_scripts;
|
1093 |
+
|
1094 |
+
}
|
1095 |
}
|
inc/minification/breeze-minification-scripts.php
CHANGED
@@ -98,6 +98,19 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
98 |
private $original_content = '';
|
99 |
private $show_original_content = 0;
|
100 |
private $do_process = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
/**
|
102 |
* Defer/Delay the inline scripts.
|
103 |
*
|
@@ -105,6 +118,13 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
105 |
*/
|
106 |
private $delay_inline_js = array();
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* Contains all the scripts that will be delayed.
|
110 |
*
|
@@ -132,6 +152,8 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
132 |
return false;
|
133 |
}
|
134 |
|
|
|
|
|
135 |
// only optimize known good JS?
|
136 |
$whitelistJS = apply_filters( 'breeze_filter_js_whitelist', '' );
|
137 |
if ( ! empty( $whitelistJS ) ) {
|
@@ -181,6 +203,10 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
181 |
$this->delay_inline_js = $options['delay_inline_js'];
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
184 |
// filter to "late inject minified JS", default to true for now (it is faster)
|
185 |
$this->inject_min_late = apply_filters( 'breeze_filter_js_inject_min_late', true );
|
186 |
|
@@ -338,8 +364,11 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
338 |
$this->move['first'][] = $tag;
|
339 |
}
|
340 |
} else {
|
341 |
-
$is_delayed =
|
342 |
-
if ( $
|
|
|
|
|
|
|
343 |
if ( true === $head ) {
|
344 |
$this->delay_scripts['header'][ $url ] = array(
|
345 |
'path' => $path,
|
@@ -387,7 +416,10 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
387 |
$this->move['first'][] = $tag;
|
388 |
}
|
389 |
} else {
|
390 |
-
$is_delayed =
|
|
|
|
|
|
|
391 |
if ( true === $is_delayed ) {
|
392 |
preg_match( '#<script.*>(.*)</script>#Usmi', $tag, $code );
|
393 |
$code = preg_replace( '#.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*#sm', '$1', $code[1] );
|
@@ -694,7 +726,9 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
694 |
$url_exists = false;
|
695 |
} else {
|
696 |
$url = breeze_CACHE_URL . breeze_current_user_type() . $cache->getname();
|
697 |
-
if ( is_numeric( $old_url ) && $this->
|
|
|
|
|
698 |
$this->url_group_head['defer'] = $this->url_replace_cdn( $url );
|
699 |
} else {
|
700 |
$this->url_group_head[ $old_url ] = $this->url_replace_cdn( $url );
|
@@ -716,7 +750,9 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
716 |
$url_exists = false;
|
717 |
} else {
|
718 |
$url = breeze_CACHE_URL . breeze_current_user_type() . $cache->getname();
|
719 |
-
if ( is_numeric( $old_url ) && $this->
|
|
|
|
|
720 |
$this->url_group_footer['defer'] = $this->url_replace_cdn( $url );
|
721 |
} else {
|
722 |
$this->url_group_footer[ $old_url ] = $this->url_replace_cdn( $url );
|
@@ -750,7 +786,9 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
750 |
$replaceTag = array( '</head>', 'before' );
|
751 |
|
752 |
foreach ( $this->jscode_inline_head as $js ) {
|
753 |
-
if ( $
|
|
|
|
|
754 |
$jsHead[] = '<script type="module">' . $js . '</script>';
|
755 |
} else {
|
756 |
$jsHead[] = '<script type="text/javascript">' . $js . '</script>';
|
@@ -766,7 +804,9 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
766 |
$replaceTag = array( '</body>', 'before' );
|
767 |
|
768 |
foreach ( $this->jscode_inline_footer as $js ) {
|
769 |
-
if ( $
|
|
|
|
|
770 |
$jsFooter[] = '<script type="module">' . $js . '</script>';
|
771 |
} else {
|
772 |
$jsFooter[] = '<script type="text/javascript">' . $js . '</script>';
|
@@ -781,8 +821,13 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
781 |
|
782 |
if ( $this->group_js == true ) {
|
783 |
$replaceTag = array( '</body>', 'before' );
|
784 |
-
|
785 |
-
|
|
|
|
|
|
|
|
|
|
|
786 |
$bodyreplacementpayload = apply_filters( 'breeze_filter_js_bodyreplacementpayload', $bodyreplacementpayload );
|
787 |
|
788 |
$bodyreplacement = implode( '', $this->move['first'] );
|
@@ -811,9 +856,19 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
811 |
if ( ! empty( $js_script['version'] ) ) {
|
812 |
$js_url .= '?' . $js_script['version'];
|
813 |
}
|
814 |
-
$
|
|
|
|
|
|
|
|
|
|
|
815 |
} else {
|
816 |
-
$
|
|
|
|
|
|
|
|
|
|
|
817 |
}
|
818 |
}
|
819 |
$js_replacement = '';
|
@@ -828,16 +883,27 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
828 |
$defer = 'defer ';
|
829 |
foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
|
830 |
if ( is_string( $js_url ) ) {
|
831 |
-
|
832 |
}
|
833 |
|
834 |
if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
|
835 |
if ( ! empty( $js_script['version'] ) ) {
|
836 |
$js_url .= '?' . $js_script['version'];
|
837 |
}
|
838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
} else {
|
840 |
-
$
|
|
|
|
|
|
|
|
|
|
|
841 |
}
|
842 |
}
|
843 |
|
@@ -866,7 +932,17 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
866 |
$defer = 'defer ';
|
867 |
}
|
868 |
|
869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
870 |
}
|
871 |
$jsReplacementPayload = implode( '', $headScript );
|
872 |
|
@@ -894,8 +970,17 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
894 |
) {
|
895 |
$defer = 'defer ';
|
896 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
897 |
|
898 |
-
$footerScript[] = '<script type="text/javascript" ' . $defer . 'src="' . $url . '"></script>';
|
899 |
}
|
900 |
$jsReplacementPayload = implode( '', $footerScript );
|
901 |
|
@@ -910,6 +995,12 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
910 |
}
|
911 |
}
|
912 |
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
// restore comments
|
914 |
$this->content = $this->restore_comments( $this->content );
|
915 |
|
@@ -1086,6 +1177,25 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
1086 |
return false;
|
1087 |
}
|
1088 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1089 |
/**
|
1090 |
* Check if the inline script is in the list of delay.
|
1091 |
*
|
98 |
private $original_content = '';
|
99 |
private $show_original_content = 0;
|
100 |
private $do_process = false;
|
101 |
+
/**
|
102 |
+
* Defer/Delay the inline scripts.
|
103 |
+
*
|
104 |
+
* @var array
|
105 |
+
*/
|
106 |
+
private $no_delay_js = array();
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Delay the Javascript
|
110 |
+
* @var array
|
111 |
+
*/
|
112 |
+
private $delay_javascript = false;
|
113 |
+
|
114 |
/**
|
115 |
* Defer/Delay the inline scripts.
|
116 |
*
|
118 |
*/
|
119 |
private $delay_inline_js = array();
|
120 |
|
121 |
+
/**
|
122 |
+
* If Inline JS delay is on/off.
|
123 |
+
*
|
124 |
+
* @var array
|
125 |
+
*/
|
126 |
+
private $is_inline_delay_on = false;
|
127 |
+
|
128 |
/**
|
129 |
* Contains all the scripts that will be delayed.
|
130 |
*
|
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?
|
158 |
$whitelistJS = apply_filters( 'breeze_filter_js_whitelist', '' );
|
159 |
if ( ! empty( $whitelistJS ) ) {
|
203 |
$this->delay_inline_js = $options['delay_inline_js'];
|
204 |
}
|
205 |
|
206 |
+
if ( ! empty( $options['no_delay_js'] ) ) {
|
207 |
+
$this->no_delay_js = $options['no_delay_js'];
|
208 |
+
}
|
209 |
+
|
210 |
// filter to "late inject minified JS", default to true for now (it is faster)
|
211 |
$this->inject_min_late = apply_filters( 'breeze_filter_js_inject_min_late', true );
|
212 |
|
364 |
$this->move['first'][] = $tag;
|
365 |
}
|
366 |
} else {
|
367 |
+
$is_delayed = false;
|
368 |
+
if ( true === $this->is_inline_delay_on ) {
|
369 |
+
$is_delayed = $this->is_inline_delay( $tag );
|
370 |
+
}
|
371 |
+
if ( true === $is_delayed ) {
|
372 |
if ( true === $head ) {
|
373 |
$this->delay_scripts['header'][ $url ] = array(
|
374 |
'path' => $path,
|
416 |
$this->move['first'][] = $tag;
|
417 |
}
|
418 |
} else {
|
419 |
+
$is_delayed = false;
|
420 |
+
if ( true === $this->is_inline_delay_on ) {
|
421 |
+
$is_delayed = $this->is_inline_delay( $tag );
|
422 |
+
}
|
423 |
if ( true === $is_delayed ) {
|
424 |
preg_match( '#<script.*>(.*)</script>#Usmi', $tag, $code );
|
425 |
$code = preg_replace( '#.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*#sm', '$1', $code[1] );
|
726 |
$url_exists = false;
|
727 |
} else {
|
728 |
$url = breeze_CACHE_URL . breeze_current_user_type() . $cache->getname();
|
729 |
+
if ( true === $this->delay_javascript && is_numeric( $old_url ) && $this->ignore_from_delay( $js_code ) ) {
|
730 |
+
$this->url_group_head['defer'] = $this->url_replace_cdn( $url );
|
731 |
+
} elseif ( true === $this->is_inline_delay_on && is_numeric( $old_url ) && $this->is_inline_delay( $js_code ) ) {
|
732 |
$this->url_group_head['defer'] = $this->url_replace_cdn( $url );
|
733 |
} else {
|
734 |
$this->url_group_head[ $old_url ] = $this->url_replace_cdn( $url );
|
750 |
$url_exists = false;
|
751 |
} else {
|
752 |
$url = breeze_CACHE_URL . breeze_current_user_type() . $cache->getname();
|
753 |
+
if ( true === $this->delay_javascript && is_numeric( $old_url ) && $this->ignore_from_delay( $js_code ) ) {
|
754 |
+
$this->url_group_footer['defer'] = $this->url_replace_cdn( $url );
|
755 |
+
} elseif ( true === $this->is_inline_delay_on && is_numeric( $old_url ) && $this->is_inline_delay( $js_code ) ) {
|
756 |
$this->url_group_footer['defer'] = $this->url_replace_cdn( $url );
|
757 |
} else {
|
758 |
$this->url_group_footer[ $old_url ] = $this->url_replace_cdn( $url );
|
786 |
$replaceTag = array( '</head>', 'before' );
|
787 |
|
788 |
foreach ( $this->jscode_inline_head as $js ) {
|
789 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js ) ) {
|
790 |
+
$jsHead[] = '<div class="breeze-scripts-load" data-file="0" data-async="false" data-locate="head" data-defer="false" style="display:none">' . htmlspecialchars( $js, ENT_QUOTES ) . '</div>' . "\n";
|
791 |
+
} else if ( $this->is_inline_delay_on && $this->is_inline_delay( $js ) ) {
|
792 |
$jsHead[] = '<script type="module">' . $js . '</script>';
|
793 |
} else {
|
794 |
$jsHead[] = '<script type="text/javascript">' . $js . '</script>';
|
804 |
$replaceTag = array( '</body>', 'before' );
|
805 |
|
806 |
foreach ( $this->jscode_inline_footer as $js ) {
|
807 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js ) ) {
|
808 |
+
$jsFooter[] = '<div class="breeze-scripts-load" data-file="0" data-async="false" data-locate="footer" data-defer="false" style="display:none">' . htmlspecialchars( $js, ENT_QUOTES ) . '</div>' . "\n";
|
809 |
+
} else if ( $this->is_inline_delay_on && $this->is_inline_delay( $js ) ) {
|
810 |
$jsFooter[] = '<script type="module">' . $js . '</script>';
|
811 |
} else {
|
812 |
$jsFooter[] = '<script type="text/javascript">' . $js . '</script>';
|
821 |
|
822 |
if ( $this->group_js == true ) {
|
823 |
$replaceTag = array( '</body>', 'before' );
|
824 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $this->url ) ) {
|
825 |
+
$bodyreplacementpayload = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="footer" data-defer="true" style="display:none">' . $this->url . '</div>' . "\n";
|
826 |
+
} else if ( $this->is_inline_delay_on && $this->is_inline_delay( $this->url ) ) { // Might add specific changes later.
|
827 |
+
$bodyreplacementpayload = '<script type="text/javascript" defer src="' . $this->url . '"></script>';
|
828 |
+
} else {
|
829 |
+
$bodyreplacementpayload = '<script type="text/javascript" defer src="' . $this->url . '"></script>';
|
830 |
+
}
|
831 |
$bodyreplacementpayload = apply_filters( 'breeze_filter_js_bodyreplacementpayload', $bodyreplacementpayload );
|
832 |
|
833 |
$bodyreplacement = implode( '', $this->move['first'] );
|
856 |
if ( ! empty( $js_script['version'] ) ) {
|
857 |
$js_url .= '?' . $js_script['version'];
|
858 |
}
|
859 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_url ) ) {
|
860 |
+
$js_head_defer[] = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="head" data-defer="true" style="display:none">' . $js_url . '</div>' . "\n";
|
861 |
+
} else {
|
862 |
+
$js_head_defer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
863 |
+
}
|
864 |
+
|
865 |
} else {
|
866 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_script ) ) {
|
867 |
+
$js_head_defer[] = '<div class="breeze-scripts-load" data-file="0" data-async="false" data-locate="head" data-defer="true" style="display:none">' . htmlspecialchars( $js_script, ENT_QUOTES ) . '</div>' . "\n";
|
868 |
+
} else {
|
869 |
+
$js_head_defer[] = "<script type='module'>{$js_script}</script>\n";
|
870 |
+
}
|
871 |
+
|
872 |
}
|
873 |
}
|
874 |
$js_replacement = '';
|
883 |
$defer = 'defer ';
|
884 |
foreach ( $this->delay_scripts['footer'] as $js_url => $js_script ) {
|
885 |
if ( is_string( $js_url ) ) {
|
886 |
+
$js_url = trim( $js_url, '”' );
|
887 |
}
|
888 |
|
889 |
if ( filter_var( $js_url, FILTER_VALIDATE_URL ) ) {
|
890 |
if ( ! empty( $js_script['version'] ) ) {
|
891 |
$js_url .= '?' . $js_script['version'];
|
892 |
}
|
893 |
+
|
894 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_url ) ) {
|
895 |
+
$js_footer_defer[] = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="footer" data-defer="true" style="display:none">' . $js_url . '</div>' . "\n";
|
896 |
+
} else {
|
897 |
+
$js_footer_defer[] = "<script type='application/javascript' {$defer}src='{$js_url}'></script>\n";
|
898 |
+
}
|
899 |
+
|
900 |
} else {
|
901 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $js_script ) ) {
|
902 |
+
$js_footer_defer[] = '<div class="breeze-scripts-load" data-file="0" data-async="false" data-locate="footer" data-defer="true" style="display:none">' . htmlspecialchars( $js_script, ENT_QUOTES ) . '</div>' . "\n";
|
903 |
+
} else {
|
904 |
+
$js_footer_defer[] = "<script type='module'>{$js_script}</script>\n";
|
905 |
+
}
|
906 |
+
|
907 |
}
|
908 |
}
|
909 |
|
932 |
$defer = 'defer ';
|
933 |
}
|
934 |
|
935 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $url ) ) {
|
936 |
+
if ( empty( $defer ) ) {
|
937 |
+
$defer = 'false';
|
938 |
+
} else {
|
939 |
+
$defer = 'true';
|
940 |
+
}
|
941 |
+
$headScript[] = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="head" data-defer="' . $defer . '" style="display:none">' . $url . '</div>' . "\n";
|
942 |
+
} else {
|
943 |
+
$headScript[] = '<script type="text/javascript" ' . $defer . 'src="' . $url . '"></script>';
|
944 |
+
}
|
945 |
+
|
946 |
}
|
947 |
$jsReplacementPayload = implode( '', $headScript );
|
948 |
|
970 |
) {
|
971 |
$defer = 'defer ';
|
972 |
}
|
973 |
+
if ( true === $this->delay_javascript && false === $this->ignore_from_delay( $url ) ) {
|
974 |
+
if ( empty( $defer ) ) {
|
975 |
+
$defer = 'false';
|
976 |
+
} else {
|
977 |
+
$defer = 'true';
|
978 |
+
}
|
979 |
+
$footerScript[] = '<div class="breeze-scripts-load" data-file="1" data-async="false" data-locate="footer" data-defer="' . $defer . '" style="display:none">' . $url . '</div>' . "\n";
|
980 |
+
} else {
|
981 |
+
$footerScript[] = '<script type="text/javascript" ' . $defer . 'src="' . $url . '"></script>';
|
982 |
+
}
|
983 |
|
|
|
984 |
}
|
985 |
$jsReplacementPayload = implode( '', $footerScript );
|
986 |
|
995 |
}
|
996 |
}
|
997 |
|
998 |
+
if ( true === $this->delay_javascript ) {
|
999 |
+
$delay_script_js = breeze_load_delay_script();
|
1000 |
+
$replace_tag = array( '</body>', 'before' );
|
1001 |
+
$this->inject_in_html( $delay_script_js, $replace_tag );
|
1002 |
+
}
|
1003 |
+
|
1004 |
// restore comments
|
1005 |
$this->content = $this->restore_comments( $this->content );
|
1006 |
|
1177 |
return false;
|
1178 |
}
|
1179 |
|
1180 |
+
/**
|
1181 |
+
* Check if the inline script is in the list of delay.
|
1182 |
+
*
|
1183 |
+
* @param $tag
|
1184 |
+
*
|
1185 |
+
* @return bool
|
1186 |
+
*/
|
1187 |
+
private function ignore_from_delay( $tag ) {
|
1188 |
+
|
1189 |
+
foreach ( $this->no_delay_js as $match ) {
|
1190 |
+
if ( strpos( $tag, $match ) !== false ) {
|
1191 |
+
//Matched something
|
1192 |
+
return true;
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
return false;
|
1197 |
+
}
|
1198 |
+
|
1199 |
/**
|
1200 |
* Check if the inline script is in the list of delay.
|
1201 |
*
|
inc/minification/breeze-minify-main.php
CHANGED
@@ -52,6 +52,7 @@ class Breeze_Minify {
|
|
52 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-js' ) ) ||
|
53 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) ) ||
|
54 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) ) ||
|
|
|
55 |
(
|
56 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) ) &&
|
57 |
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN )
|
@@ -125,6 +126,7 @@ class Breeze_Minify {
|
|
125 |
} elseif (
|
126 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) ) ||
|
127 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) ) ||
|
|
|
128 |
(
|
129 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) ) &&
|
130 |
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN )
|
@@ -186,20 +188,25 @@ class Breeze_Minify {
|
|
186 |
if ( '1' === Breeze_Options_Reader::get_option_value( 'cdn-active' ) ) {
|
187 |
$cdn_url = Breeze_Options_Reader::get_option_value( 'cdn-url' );
|
188 |
}
|
|
|
189 |
// Choose the classes
|
190 |
$classes = array();
|
191 |
$js_include_inline = $css_include_inline = false;
|
192 |
if ( ! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-js' ) ) ) {
|
193 |
$classes[] = 'Breeze_MinificationScripts';
|
|
|
194 |
} elseif (
|
195 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) ) ||
|
196 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) ) ||
|
|
|
197 |
(
|
198 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) ) &&
|
199 |
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN )
|
200 |
)
|
|
|
201 |
) {
|
202 |
$classes[] = 'Breeze_Js_Deferred_Loading';
|
|
|
203 |
}
|
204 |
|
205 |
if ( ! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-css' ) ) ) {
|
@@ -226,20 +233,26 @@ class Breeze_Minify {
|
|
226 |
$font_swap = filter_var( Breeze_Options_Reader::get_option_value( 'breeze-font-display-swap' ), FILTER_VALIDATE_BOOLEAN );
|
227 |
|
228 |
// Set some options
|
229 |
-
$
|
230 |
-
$
|
|
|
|
|
|
|
231 |
'Breeze_MinificationScripts' => array(
|
232 |
-
'justhead'
|
233 |
-
'forcehead'
|
234 |
-
'trycatch'
|
235 |
-
'js_exclude'
|
236 |
-
'cdn_url'
|
237 |
-
'include_inline'
|
238 |
-
'group_js'
|
239 |
-
'custom_js_exclude'
|
240 |
-
'move_to_footer_js'
|
241 |
-
'defer_js'
|
242 |
-
'delay_inline_js'
|
|
|
|
|
|
|
243 |
),
|
244 |
'Breeze_MinificationStyles' => array(
|
245 |
'justhead' => false,
|
@@ -260,10 +273,13 @@ class Breeze_Minify {
|
|
260 |
'keepcomments' => false,
|
261 |
),
|
262 |
'Breeze_Js_Deferred_Loading' => array(
|
263 |
-
'move_to_footer_js'
|
264 |
-
'defer_js'
|
265 |
-
'delay_inline_js'
|
266 |
-
'
|
|
|
|
|
|
|
267 |
),
|
268 |
);
|
269 |
|
@@ -392,10 +408,10 @@ class Breeze_Minify {
|
|
392 |
} else {
|
393 |
|
394 |
$test_url = ltrim( $exclude_url_item, 'https:' );
|
395 |
-
$test_url = $this->rtrim_urls($test_url);
|
396 |
|
397 |
$current_url = ltrim( $current_url, 'https:' );
|
398 |
-
$current_url = $this->rtrim_urls($current_url);
|
399 |
|
400 |
// Whole path
|
401 |
if ( mb_strtolower( $test_url ) === mb_strtolower( $current_url ) ) {
|
52 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-js' ) ) ||
|
53 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) ) ||
|
54 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) ) ||
|
55 |
+
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-delay-all-js' ), FILTER_VALIDATE_BOOLEAN ) ||
|
56 |
(
|
57 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) ) &&
|
58 |
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN )
|
126 |
} elseif (
|
127 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) ) ||
|
128 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) ) ||
|
129 |
+
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-delay-all-js' ), FILTER_VALIDATE_BOOLEAN ) ||
|
130 |
(
|
131 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) ) &&
|
132 |
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN )
|
188 |
if ( '1' === Breeze_Options_Reader::get_option_value( 'cdn-active' ) ) {
|
189 |
$cdn_url = Breeze_Options_Reader::get_option_value( 'cdn-url' );
|
190 |
}
|
191 |
+
|
192 |
// Choose the classes
|
193 |
$classes = array();
|
194 |
$js_include_inline = $css_include_inline = false;
|
195 |
if ( ! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-js' ) ) ) {
|
196 |
$classes[] = 'Breeze_MinificationScripts';
|
197 |
+
|
198 |
} elseif (
|
199 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ) ) ||
|
200 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ) ) ||
|
201 |
+
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-delay-all-js' ), FILTER_VALIDATE_BOOLEAN ) ||
|
202 |
(
|
203 |
! empty( Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' ) ) &&
|
204 |
true === filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN )
|
205 |
)
|
206 |
+
|
207 |
) {
|
208 |
$classes[] = 'Breeze_Js_Deferred_Loading';
|
209 |
+
|
210 |
}
|
211 |
|
212 |
if ( ! empty( Breeze_Options_Reader::get_option_value( 'breeze-minify-css' ) ) ) {
|
233 |
$font_swap = filter_var( Breeze_Options_Reader::get_option_value( 'breeze-font-display-swap' ), FILTER_VALIDATE_BOOLEAN );
|
234 |
|
235 |
// Set some options
|
236 |
+
$no_script_delay = Breeze_Options_Reader::get_option_value( 'no-breeze-no-delay-js' );
|
237 |
+
$breeze_delay_all_js = filter_var( Breeze_Options_Reader::get_option_value( 'breeze-delay-all-js' ), FILTER_VALIDATE_BOOLEAN );
|
238 |
+
$script_delay = Breeze_Options_Reader::get_option_value( 'breeze-delay-js-scripts' );
|
239 |
+
$is_inline_delay_on = filter_var( Breeze_Options_Reader::get_option_value( 'breeze-enable-js-delay' ), FILTER_VALIDATE_BOOLEAN );
|
240 |
+
$classoptions = array(
|
241 |
'Breeze_MinificationScripts' => array(
|
242 |
+
'justhead' => false,
|
243 |
+
'forcehead' => false,
|
244 |
+
'trycatch' => false,
|
245 |
+
'js_exclude' => 's_sid, smowtion_size, sc_project, WAU_, wau_add, comment-form-quicktags, edToolbar, ch_client, seal.js',
|
246 |
+
'cdn_url' => '',
|
247 |
+
'include_inline' => $js_include_inline,
|
248 |
+
'group_js' => $groupjs,
|
249 |
+
'custom_js_exclude' => Breeze_Options_Reader::get_option_value( 'breeze-exclude-js' ),
|
250 |
+
'move_to_footer_js' => Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ),
|
251 |
+
'defer_js' => Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ),
|
252 |
+
'delay_inline_js' => ( ! empty( $script_delay ) ? $script_delay : array() ),
|
253 |
+
'no_delay_js' => ( ! empty( $no_script_delay ) ? $no_script_delay : array() ),
|
254 |
+
'delay_javascript' => $breeze_delay_all_js,
|
255 |
+
'is_inline_delay_on' => $is_inline_delay_on,
|
256 |
),
|
257 |
'Breeze_MinificationStyles' => array(
|
258 |
'justhead' => false,
|
273 |
'keepcomments' => false,
|
274 |
),
|
275 |
'Breeze_Js_Deferred_Loading' => array(
|
276 |
+
'move_to_footer_js' => Breeze_Options_Reader::get_option_value( 'breeze-move-to-footer-js' ),
|
277 |
+
'defer_js' => Breeze_Options_Reader::get_option_value( 'breeze-defer-js' ),
|
278 |
+
'delay_inline_js' => ( ! empty( $script_delay ) ? $script_delay : array() ),
|
279 |
+
'no_delay_js' => ( ! empty( $no_script_delay ) ? $no_script_delay : array() ),
|
280 |
+
'cdn_url' => $cdn_url,
|
281 |
+
'delay_javascript' => $breeze_delay_all_js,
|
282 |
+
'is_inline_delay_on' => $is_inline_delay_on,
|
283 |
),
|
284 |
);
|
285 |
|
408 |
} else {
|
409 |
|
410 |
$test_url = ltrim( $exclude_url_item, 'https:' );
|
411 |
+
$test_url = $this->rtrim_urls( $test_url );
|
412 |
|
413 |
$current_url = ltrim( $current_url, 'https:' );
|
414 |
+
$current_url = $this->rtrim_urls( $current_url );
|
415 |
|
416 |
// Whole path
|
417 |
if ( mb_strtolower( $test_url ) === mb_strtolower( $current_url ) ) {
|
inc/plugin-incompatibility/class-breeze-incompatibility-plugins.php
CHANGED
@@ -185,11 +185,11 @@ if ( ! class_exists( 'Breeze_Incompatibility_Plugins' ) ) {
|
|
185 |
}
|
186 |
// Build data for the notice HTML
|
187 |
$final_list[] = array(
|
188 |
-
'warning_message'
|
189 |
-
'safe_version_message'
|
190 |
'display_deactivate_button' => $show_deactivate,
|
191 |
-
'deactivate_url'
|
192 |
-
'is_network_only'
|
193 |
);
|
194 |
|
195 |
}
|
@@ -270,79 +270,79 @@ if ( ! class_exists( 'Breeze_Incompatibility_Plugins' ) ) {
|
|
270 |
* If warning_version has the value -1, the compare_sign will be ignored.
|
271 |
* Current version of installed plugin compared to warning_version
|
272 |
*/
|
273 |
-
'w3-total-cache/w3-total-cache.php'
|
274 |
'warning_message' => '',
|
275 |
'warning_version' => - 1,
|
276 |
'compare_sign' => '>',
|
277 |
'safe_version_message' => '',
|
278 |
),
|
279 |
-
'wp-super-cache/wp-cache.php'
|
280 |
'warning_message' => '',
|
281 |
'warning_version' => - 1,
|
282 |
'compare_sign' => '>',
|
283 |
'safe_version_message' => '',
|
284 |
),
|
285 |
-
'litespeed-cache/litespeed-cache.php'
|
286 |
'warning_message' => '',
|
287 |
'warning_version' => '2.0',
|
288 |
'compare_sign' => '>=', // Current version of installed plugin compared to warning_version
|
289 |
'safe_version_message' => 'Version (1.0 - 1.9) are compatible.',
|
290 |
),
|
291 |
-
'quick-cache/quick-cache.php'
|
292 |
'warning_message' => '',
|
293 |
'warning_version' => - 1,
|
294 |
'compare_sign' => '>',
|
295 |
'safe_version_message' => '',
|
296 |
),
|
297 |
-
'hyper-cache/plugin.php'
|
298 |
'warning_message' => '',
|
299 |
'warning_version' => - 1,
|
300 |
'compare_sign' => '>',
|
301 |
'safe_version_message' => '',
|
302 |
),
|
303 |
-
'hyper-cache-extended/plugin.php'
|
304 |
'warning_message' => '',
|
305 |
'warning_version' => - 1,
|
306 |
'compare_sign' => '>',
|
307 |
'safe_version_message' => '',
|
308 |
),
|
309 |
-
'wp-fast-cache/wp-fast-cache.php'
|
310 |
'warning_message' => '',
|
311 |
'warning_version' => - 1,
|
312 |
'compare_sign' => '>',
|
313 |
'safe_version_message' => '',
|
314 |
),
|
315 |
-
'flexicache/wp-plugin.php'
|
316 |
'warning_message' => '',
|
317 |
'warning_version' => - 1,
|
318 |
'compare_sign' => '>',
|
319 |
'safe_version_message' => '',
|
320 |
),
|
321 |
-
'wp-fastest-cache/wpFastestCache.php'
|
322 |
'warning_message' => '',
|
323 |
'warning_version' => - 1,
|
324 |
'compare_sign' => '>',
|
325 |
'safe_version_message' => '',
|
326 |
),
|
327 |
-
'lite-cache/plugin.php'
|
328 |
'warning_message' => '',
|
329 |
'warning_version' => - 1,
|
330 |
'compare_sign' => '>',
|
331 |
'safe_version_message' => '',
|
332 |
),
|
333 |
-
'gator-cache/gator-cache.php'
|
334 |
'warning_message' => '',
|
335 |
'warning_version' => - 1,
|
336 |
'compare_sign' => '>',
|
337 |
'safe_version_message' => '',
|
338 |
),
|
339 |
-
'wp-http-compression/wp-http-compression.php'
|
340 |
'warning_message' => '',
|
341 |
'warning_version' => - 1,
|
342 |
'compare_sign' => '>',
|
343 |
'safe_version_message' => '',
|
344 |
),
|
345 |
-
'wordpress-gzip-compression/ezgz.php'
|
346 |
'warning_message' => '',
|
347 |
'warning_version' => - 1,
|
348 |
'compare_sign' => '>',
|
@@ -354,7 +354,7 @@ if ( ! class_exists( 'Breeze_Incompatibility_Plugins' ) ) {
|
|
354 |
'compare_sign' => '>',
|
355 |
'safe_version_message' => '',
|
356 |
),
|
357 |
-
'speed-booster-pack/speed-booster-pack.php'
|
358 |
'warning_message' => '',
|
359 |
'warning_version' => - 1,
|
360 |
'compare_sign' => '>',
|
185 |
}
|
186 |
// Build data for the notice HTML
|
187 |
$final_list[] = array(
|
188 |
+
'warning_message' => $message,
|
189 |
+
'safe_version_message' => ( ! empty( trim( $details['safe_version_message'] ) ) ? $details['safe_version_message'] : '' ),
|
190 |
'display_deactivate_button' => $show_deactivate,
|
191 |
+
'deactivate_url' => wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin ),
|
192 |
+
'is_network_only' => $network_only_text,
|
193 |
);
|
194 |
|
195 |
}
|
270 |
* If warning_version has the value -1, the compare_sign will be ignored.
|
271 |
* Current version of installed plugin compared to warning_version
|
272 |
*/
|
273 |
+
'w3-total-cache/w3-total-cache.php' => array(
|
274 |
'warning_message' => '',
|
275 |
'warning_version' => - 1,
|
276 |
'compare_sign' => '>',
|
277 |
'safe_version_message' => '',
|
278 |
),
|
279 |
+
'wp-super-cache/wp-cache.php' => array(
|
280 |
'warning_message' => '',
|
281 |
'warning_version' => - 1,
|
282 |
'compare_sign' => '>',
|
283 |
'safe_version_message' => '',
|
284 |
),
|
285 |
+
'litespeed-cache/litespeed-cache.php' => array(
|
286 |
'warning_message' => '',
|
287 |
'warning_version' => '2.0',
|
288 |
'compare_sign' => '>=', // Current version of installed plugin compared to warning_version
|
289 |
'safe_version_message' => 'Version (1.0 - 1.9) are compatible.',
|
290 |
),
|
291 |
+
'quick-cache/quick-cache.php' => array(
|
292 |
'warning_message' => '',
|
293 |
'warning_version' => - 1,
|
294 |
'compare_sign' => '>',
|
295 |
'safe_version_message' => '',
|
296 |
),
|
297 |
+
'hyper-cache/plugin.php' => array(
|
298 |
'warning_message' => '',
|
299 |
'warning_version' => - 1,
|
300 |
'compare_sign' => '>',
|
301 |
'safe_version_message' => '',
|
302 |
),
|
303 |
+
'hyper-cache-extended/plugin.php' => array(
|
304 |
'warning_message' => '',
|
305 |
'warning_version' => - 1,
|
306 |
'compare_sign' => '>',
|
307 |
'safe_version_message' => '',
|
308 |
),
|
309 |
+
'wp-fast-cache/wp-fast-cache.php' => array(
|
310 |
'warning_message' => '',
|
311 |
'warning_version' => - 1,
|
312 |
'compare_sign' => '>',
|
313 |
'safe_version_message' => '',
|
314 |
),
|
315 |
+
'flexicache/wp-plugin.php' => array(
|
316 |
'warning_message' => '',
|
317 |
'warning_version' => - 1,
|
318 |
'compare_sign' => '>',
|
319 |
'safe_version_message' => '',
|
320 |
),
|
321 |
+
'wp-fastest-cache/wpFastestCache.php' => array(
|
322 |
'warning_message' => '',
|
323 |
'warning_version' => - 1,
|
324 |
'compare_sign' => '>',
|
325 |
'safe_version_message' => '',
|
326 |
),
|
327 |
+
'lite-cache/plugin.php' => array(
|
328 |
'warning_message' => '',
|
329 |
'warning_version' => - 1,
|
330 |
'compare_sign' => '>',
|
331 |
'safe_version_message' => '',
|
332 |
),
|
333 |
+
'gator-cache/gator-cache.php' => array(
|
334 |
'warning_message' => '',
|
335 |
'warning_version' => - 1,
|
336 |
'compare_sign' => '>',
|
337 |
'safe_version_message' => '',
|
338 |
),
|
339 |
+
'wp-http-compression/wp-http-compression.php' => array(
|
340 |
'warning_message' => '',
|
341 |
'warning_version' => - 1,
|
342 |
'compare_sign' => '>',
|
343 |
'safe_version_message' => '',
|
344 |
),
|
345 |
+
'wordpress-gzip-compression/ezgz.php' => array(
|
346 |
'warning_message' => '',
|
347 |
'warning_version' => - 1,
|
348 |
'compare_sign' => '>',
|
354 |
'compare_sign' => '>',
|
355 |
'safe_version_message' => '',
|
356 |
),
|
357 |
+
'speed-booster-pack/speed-booster-pack.php' => array(
|
358 |
'warning_message' => '',
|
359 |
'warning_version' => - 1,
|
360 |
'compare_sign' => '>',
|
inc/wp-cli/class-breeze-settings-import-export.php
CHANGED
@@ -418,6 +418,8 @@ class Breeze_Settings_Import_Export {
|
|
418 |
'breeze-defer-js' => ( isset( $options['breeze-defer-js'] ) ? $options['breeze-defer-js'] : array() ),
|
419 |
'breeze-enable-js-delay' => ( isset( $options['breeze-enable-js-delay'] ) ? $options['breeze-enable-js-delay'] : '0' ),
|
420 |
'breeze-delay-js-scripts' => ( isset( $options['breeze-delay-js-scripts'] ) ? $options['breeze-delay-js-scripts'] : array() ),
|
|
|
|
|
421 |
|
422 |
);
|
423 |
|
@@ -657,6 +659,7 @@ class Breeze_Settings_Import_Export {
|
|
657 |
'auto-purge-varnish' => '1',
|
658 |
'breeze_inherit_settings' => '0',
|
659 |
'breeze-control-heartbeat' => '0',
|
|
|
660 |
);
|
661 |
|
662 |
if ( array_key_exists( $option, $checkboxes ) ) {
|
@@ -719,6 +722,7 @@ class Breeze_Settings_Import_Export {
|
|
719 |
'data-noptimize',
|
720 |
'googletagmanager',
|
721 |
),
|
|
|
722 |
'breeze-preload-fonts' => array(),
|
723 |
'breeze-exclude-urls' => array(),
|
724 |
'cached-query-strings' => array(),
|
418 |
'breeze-defer-js' => ( isset( $options['breeze-defer-js'] ) ? $options['breeze-defer-js'] : array() ),
|
419 |
'breeze-enable-js-delay' => ( isset( $options['breeze-enable-js-delay'] ) ? $options['breeze-enable-js-delay'] : '0' ),
|
420 |
'breeze-delay-js-scripts' => ( isset( $options['breeze-delay-js-scripts'] ) ? $options['breeze-delay-js-scripts'] : array() ),
|
421 |
+
'no-breeze-no-delay-js' => ( isset( $options['no-breeze-no-delay-js'] ) ? $options['no-breeze-no-delay-js'] : array() ),
|
422 |
+
'breeze-delay-all-js' => ( isset( $options['breeze-delay-all-js'] ) ? $options['breeze-delay-all-js'] : '0' ),
|
423 |
|
424 |
);
|
425 |
|
659 |
'auto-purge-varnish' => '1',
|
660 |
'breeze_inherit_settings' => '0',
|
661 |
'breeze-control-heartbeat' => '0',
|
662 |
+
'breeze-delay-all-js' => '0',
|
663 |
);
|
664 |
|
665 |
if ( array_key_exists( $option, $checkboxes ) ) {
|
722 |
'data-noptimize',
|
723 |
'googletagmanager',
|
724 |
),
|
725 |
+
'no-breeze-no-delay-js' => array(),
|
726 |
'breeze-preload-fonts' => array(),
|
727 |
'breeze-exclude-urls' => array(),
|
728 |
'cached-query-strings' => array(),
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Cloudways
|
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -145,6 +145,12 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
|
|
145 |
|
146 |
== Changelog ==
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 2.0.3 =
|
149 |
|
150 |
* Fix:All ajax actions are now restricted to the users that have manage_options capabilities. Vulnerability discovered from patchstack team.
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
+
Stable tag: 2.0.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
+
= 2.0.4 =
|
149 |
+
|
150 |
+
* Add: Improve page load by delaying JavaScript execution. Delay JS is disabled by default for new installations.
|
151 |
+
* Fix: Added JavaScript checks to see if the sortable library is loaded or not, if not then the JS code that requires the library will not execute.
|
152 |
+
* Fix: Undefined variable in Breeze minification scripts.
|
153 |
+
|
154 |
= 2.0.3 =
|
155 |
|
156 |
* Fix:All ajax actions are now restricted to the users that have manage_options capabilities. Vulnerability discovered from patchstack team.
|
views/option-tabs/basic-tab.php
CHANGED
@@ -220,7 +220,7 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/basic-active.png';
|
|
220 |
$iframe_lazy_load = ( isset( $basic_value ) && true === $basic_value ) ? checked( $basic['breeze-lazy-load-iframes'], '1', false ) : '';
|
221 |
?>
|
222 |
|
223 |
-
|
224 |
<div class="on-off-checkbox">
|
225 |
<input id="bz-lazy-load-iframe" type="checkbox" name="bz-lazy-load-iframe" class="br-box" value='1' <?php echo $iframe_lazy_load; ?>>
|
226 |
<label for="bz-lazy-load-iframe">
|
@@ -238,9 +238,9 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/basic-active.png';
|
|
238 |
_e( 'Apply lazy load to iframe/videos tags.', 'breeze' );
|
239 |
?>
|
240 |
</p>
|
241 |
-
|
242 |
|
243 |
-
|
244 |
<div class="on-off-checkbox">
|
245 |
<input id="bz-lazy-load-nat" type="checkbox" name="bz-lazy-load-nat" class="br-box" value='1' <?php echo $native_lazy_load; ?>>
|
246 |
<label for="bz-lazy-load-nat">
|
@@ -258,12 +258,12 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/basic-active.png';
|
|
258 |
_e( 'This is not supported by all browsers.', 'breeze' );
|
259 |
?>
|
260 |
</p>
|
261 |
-
|
262 |
|
263 |
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
|
268 |
<!-- START OPTION -->
|
269 |
<div class="br-option-item">
|
220 |
$iframe_lazy_load = ( isset( $basic_value ) && true === $basic_value ) ? checked( $basic['breeze-lazy-load-iframes'], '1', false ) : '';
|
221 |
?>
|
222 |
|
223 |
+
<span <?php echo $hide; ?> id="native-lazy-option-iframe">
|
224 |
<div class="on-off-checkbox">
|
225 |
<input id="bz-lazy-load-iframe" type="checkbox" name="bz-lazy-load-iframe" class="br-box" value='1' <?php echo $iframe_lazy_load; ?>>
|
226 |
<label for="bz-lazy-load-iframe">
|
238 |
_e( 'Apply lazy load to iframe/videos tags.', 'breeze' );
|
239 |
?>
|
240 |
</p>
|
241 |
+
</span>
|
242 |
|
243 |
+
<span <?php echo $hide; ?> id="native-lazy-option">
|
244 |
<div class="on-off-checkbox">
|
245 |
<input id="bz-lazy-load-nat" type="checkbox" name="bz-lazy-load-nat" class="br-box" value='1' <?php echo $native_lazy_load; ?>>
|
246 |
<label for="bz-lazy-load-nat">
|
258 |
_e( 'This is not supported by all browsers.', 'breeze' );
|
259 |
?>
|
260 |
</p>
|
261 |
+
</span>
|
262 |
|
263 |
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
<!-- END OPTION -->
|
267 |
|
268 |
<!-- START OPTION -->
|
269 |
<div class="br-option-item">
|
views/option-tabs/file-tab.php
CHANGED
@@ -552,11 +552,24 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
552 |
</div>
|
553 |
<div class="br-option">
|
554 |
<?php
|
555 |
-
|
556 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
?>
|
558 |
<div class="on-off-checkbox">
|
559 |
-
<input id="enable-js-delay" name="enable-js-delay" type="checkbox" class="br-box" value="1" <?php echo $
|
560 |
<label for="enable-js-delay">
|
561 |
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
562 |
</label>
|
@@ -569,7 +582,7 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
569 |
}
|
570 |
|
571 |
$display_text_area = 'style="display:none"';
|
572 |
-
if ( true === $
|
573 |
$display_text_area = 'style="display:block"';
|
574 |
}
|
575 |
?>
|
@@ -586,10 +599,106 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/file-active.png';
|
|
586 |
</p>
|
587 |
<p class="br-notice">
|
588 |
<?php _e( 'Please clear Varnish after applying the new settings.', 'breeze' ); ?>
|
|
|
589 |
</p>
|
590 |
</div>
|
591 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
</div>
|
594 |
</div>
|
595 |
<!-- END OPTION -->
|
552 |
</div>
|
553 |
<div class="br-option">
|
554 |
<?php
|
555 |
+
// Delay All JavaScript START
|
556 |
+
/**
|
557 |
+
* Used to disable one of the options when the ther is active.
|
558 |
+
*/
|
559 |
+
$basic_value_all = isset( $options['breeze-delay-all-js'] ) ? filter_var( $options['breeze-delay-all-js'], FILTER_VALIDATE_BOOLEAN ) : false;
|
560 |
+
$is_enabled_all = ( isset( $basic_value_all ) && true === $basic_value_all ) ? checked( $options['breeze-delay-all-js'], '1', false ) : '';
|
561 |
+
// END
|
562 |
+
|
563 |
+
$basic_value_inlinejs = isset( $options['breeze-enable-js-delay'] ) ? filter_var( $options['breeze-enable-js-delay'], FILTER_VALIDATE_BOOLEAN ) : false;
|
564 |
+
$is_enabled_inlinejs = ( isset( $basic_value_inlinejs ) && true === $basic_value_inlinejs ) ? checked( $options['breeze-enable-js-delay'], '1', false ) : '';
|
565 |
+
|
566 |
+
$delay_inline_disabled = '';
|
567 |
+
if(true === $basic_value_all){
|
568 |
+
$delay_inline_disabled = 'disabled="disabled"';
|
569 |
+
}
|
570 |
?>
|
571 |
<div class="on-off-checkbox">
|
572 |
+
<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; ?>>
|
573 |
<label for="enable-js-delay">
|
574 |
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
575 |
</label>
|
582 |
}
|
583 |
|
584 |
$display_text_area = 'style="display:none"';
|
585 |
+
if ( true === $basic_value_inlinejs ) {
|
586 |
$display_text_area = 'style="display:block"';
|
587 |
}
|
588 |
?>
|
599 |
</p>
|
600 |
<p class="br-notice">
|
601 |
<?php _e( 'Please clear Varnish after applying the new settings.', 'breeze' ); ?>
|
602 |
+
|
603 |
</p>
|
604 |
</div>
|
605 |
</div>
|
606 |
+
<p class="br-important">
|
607 |
+
<?php
|
608 |
+
echo '<strong>';
|
609 |
+
_e( 'Important: ', 'breeze' );
|
610 |
+
echo '</strong>';
|
611 |
+
_e( 'Use only one option "Delay JS Inline Scripts" OR "Delay All JavaScript" at same time.', 'breeze' );
|
612 |
+
?>
|
613 |
+
</p>
|
614 |
+
</div>
|
615 |
+
</div>
|
616 |
+
<!-- END OPTION -->
|
617 |
+
|
618 |
+
<!-- START OPTION -->
|
619 |
+
<div class="br-option-item">
|
620 |
+
<div class="br-label">
|
621 |
+
<div class="br-option-text">
|
622 |
+
<?php _e( 'Delay All JavaScript', 'breeze' ); ?>
|
623 |
+
</div>
|
624 |
+
</div>
|
625 |
+
<div class="br-option">
|
626 |
+
<?php
|
627 |
+
$basic_value_all = isset( $options['breeze-delay-all-js'] ) ? filter_var( $options['breeze-delay-all-js'], FILTER_VALIDATE_BOOLEAN ) : false;
|
628 |
+
$is_enabled_all = ( isset( $basic_value_all ) && true === $basic_value_all ) ? checked( $options['breeze-delay-all-js'], '1', false ) : '';
|
629 |
+
|
630 |
+
$js_minify_state = true;
|
631 |
+
if ( empty( $is_enabled_all ) ) {
|
632 |
+
$js_minify_state = false;
|
633 |
+
}
|
634 |
+
|
635 |
+
$delay_js_disabled = '';
|
636 |
+
if(true === $basic_value_inlinejs){
|
637 |
+
$delay_js_disabled = 'disabled="disabled"';
|
638 |
+
}
|
639 |
+
?>
|
640 |
+
<div class="on-off-checkbox">
|
641 |
+
<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; ?>>
|
642 |
+
<label for="breeze-delay-all-js">
|
643 |
+
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
644 |
+
</label>
|
645 |
+
</div>
|
646 |
+
<div class="br-note">
|
647 |
+
<p>
|
648 |
+
<?php _e( 'Improve the page load by delaying JavaScript execution.', 'breeze' ); ?>
|
649 |
+
</p>
|
650 |
|
651 |
+
<p class="br-important">
|
652 |
+
<?php
|
653 |
+
// echo '<strong>';
|
654 |
+
// _e( 'Important: ', 'breeze' );
|
655 |
+
// echo '</strong>';
|
656 |
+
// _e( 'We recommend testing minification on a staging website before deploying it on a live website. ', 'breeze' );
|
657 |
+
// echo '<br/>';
|
658 |
+
// _e( 'Minification is known to cause issues on the frontend.', 'breeze' );
|
659 |
+
?>
|
660 |
+
</p>
|
661 |
+
</div>
|
662 |
+
|
663 |
+
<?php
|
664 |
+
$js_output = '';
|
665 |
+
if ( ! empty( $options['no-breeze-no-delay-js'] ) ) {
|
666 |
+
$output = implode( "\n", $options['no-breeze-no-delay-js'] );
|
667 |
+
$js_output = esc_textarea( $output );
|
668 |
+
}
|
669 |
+
|
670 |
+
$display_text_area = 'style="display:none"';
|
671 |
+
if ( true === $basic_value_all ) {
|
672 |
+
$display_text_area = 'style="display:block"';
|
673 |
+
}
|
674 |
+
|
675 |
+
?>
|
676 |
+
|
677 |
+
<div <?php echo $display_text_area; ?> id="breeze-delay-js-scripts-div-all">
|
678 |
+
<br/>
|
679 |
+
<div class="br-option-text"><strong><?php _e( 'List of scripts not to delay', 'breeze' ); ?></strong></div>
|
680 |
+
<textarea cols="100" rows="7" id="no-delay-js-scripts" name="no-delay-js-scripts"><?php echo $js_output; ?></textarea>
|
681 |
+
<div class="br-note">
|
682 |
+
<p>
|
683 |
+
<?php
|
684 |
+
|
685 |
+
_e( 'You can add specific keywords to identify the Inline JavaScript or JavaScript files to not be delayed. Each script identifying keyword must be added on a new line.', 'breeze' );
|
686 |
+
?>
|
687 |
+
</p>
|
688 |
+
<p class="br-notice">
|
689 |
+
<?php _e( 'Please clear Varnish after applying the new settings.', 'breeze' ); ?>
|
690 |
+
|
691 |
+
</p>
|
692 |
+
</div>
|
693 |
+
</div>
|
694 |
+
<p class="br-important">
|
695 |
+
<?php
|
696 |
+
echo '<strong>';
|
697 |
+
_e( 'Important: ', 'breeze' );
|
698 |
+
echo '</strong>';
|
699 |
+
_e( 'Use only one option "Delay JS Inline Scripts" OR "Delay All JavaScript" at same time.', 'breeze' );
|
700 |
+
?>
|
701 |
+
</p>
|
702 |
</div>
|
703 |
</div>
|
704 |
<!-- END OPTION -->
|
views/option-tabs/tools-tab.php
CHANGED
@@ -66,9 +66,9 @@ if ( is_multisite() ) {
|
|
66 |
<div class="br-option">
|
67 |
<div class="br-input-container">
|
68 |
<div class="br-input-item">
|
69 |
-
|
70 |
<input type="file" name="breeze_import_settings" id="breeze_import_settings">
|
71 |
-
|
72 |
</div>
|
73 |
<div class="br-input-item">
|
74 |
<div class="br-file-text"><?php _e( 'No File Chosen', 'breeze' ); ?></div>
|
66 |
<div class="br-option">
|
67 |
<div class="br-input-container">
|
68 |
<div class="br-input-item">
|
69 |
+
<label for="breeze_import_settings" class="br-label-for-file">
|
70 |
<input type="file" name="breeze_import_settings" id="breeze_import_settings">
|
71 |
+
</label>
|
72 |
</div>
|
73 |
<div class="br-input-item">
|
74 |
<div class="br-file-text"><?php _e( 'No File Chosen', 'breeze' ); ?></div>
|