Version Description
Update Breeze through WordPress Admin > Dashboard >Updates. The settings will remain intact after the update.
Download this release
Release Info
Developer | adeelkhan |
Plugin | Breeze – WordPress Cache Plugin |
Version | 2.0.11 |
Comparing to | |
See all releases |
Code changes from version 2.0.10 to 2.0.11
- assets/js/breeze-main.js +41 -1
- assets/js/breeze-main.min.js +3 -2
- assets/js/js-front-end/breeze-lazy-load.min.js +3 -2
- assets/js/js-front-end/breeze-prefetch-links.min.js +3 -2
- breeze.php +2 -2
- inc/breeze-admin.php +14 -2
- inc/breeze-configuration.php +64 -0
- inc/cache/ecommerce-cache.php +4 -0
- inc/cache/execute-cache.php +36 -30
- inc/class-breeze-file-permissions.php +4 -0
- inc/class-breeze-lazy-load.php +1 -1
- inc/class-breeze-query-strings-rules.php +7 -0
- inc/functions.php +284 -1
- inc/helpers.php +68 -0
- inc/minification/breeze-js-deferred-loading.php +32 -0
- inc/minification/breeze-minification-scripts.php +7 -0
- inc/minification/breeze-minify-main.php +4 -0
- readme.txt +11 -2
- views/option-tabs-loader.php +2 -2
- views/option-tabs/cdn-tab.php +18 -0
assets/js/breeze-main.js
CHANGED
@@ -91,6 +91,46 @@ jQuery( document ).ready(
|
|
91 |
}
|
92 |
);
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
//clear cache by button
|
95 |
function breeze_purge_opcache_ajax() {
|
96 |
$.ajax(
|
@@ -1001,7 +1041,7 @@ jQuery( document ).ready(
|
|
1001 |
data: { action: "breeze_file_permission_check", 'is-network': $( 'body' ).hasClass( 'network-admin' ) },
|
1002 |
dataType: "html", // xml, html, script, json, jsonp, text
|
1003 |
success: function ( data ) {
|
1004 |
-
if ( '' === data ) {
|
1005 |
existing_notice.remove();
|
1006 |
} else {
|
1007 |
if ( existing_notice.length ) {
|
91 |
}
|
92 |
);
|
93 |
|
94 |
+
if ( $box_container.length ) {
|
95 |
+
$( '.breeze-box' ).on( 'keyup paste', '#cdn-url', function () {
|
96 |
+
var cdn_value = $.trim( $( this ).val() );
|
97 |
+
if ( '' !== cdn_value && true === is_valid_url( cdn_value ) ) {
|
98 |
+
|
99 |
+
$.ajax( {
|
100 |
+
type: "POST",
|
101 |
+
url: ajaxurl,
|
102 |
+
data: {
|
103 |
+
action: 'breeze_check_cdn_url',
|
104 |
+
'cdn_url': cdn_value,
|
105 |
+
security: breeze_token_name.breeze_check_cdn_url
|
106 |
+
},
|
107 |
+
dataType: "json", // xml, html, script, json, jsonp, text
|
108 |
+
success: function ( data ) {
|
109 |
+
if(false === data.success){
|
110 |
+
$('#cdn-message-error').show();
|
111 |
+
$('#cdn-message-error').html(data.message);
|
112 |
+
}else{
|
113 |
+
$('#cdn-message-error').hide();
|
114 |
+
}
|
115 |
+
},
|
116 |
+
error: function ( jqXHR, textStatus, errorThrown ) {
|
117 |
+
|
118 |
+
},
|
119 |
+
// called when the request finishes (after success and error callbacks are executed)
|
120 |
+
complete: function ( jqXHR, textStatus ) {
|
121 |
+
|
122 |
+
}
|
123 |
+
} );
|
124 |
+
}else{
|
125 |
+
$('#cdn-message-error').hide();
|
126 |
+
}
|
127 |
+
} );
|
128 |
+
}
|
129 |
+
|
130 |
+
function is_valid_url( url ) {
|
131 |
+
return /^(http(s)?:)?\/\/(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test( url );
|
132 |
+
}
|
133 |
+
|
134 |
//clear cache by button
|
135 |
function breeze_purge_opcache_ajax() {
|
136 |
$.ajax(
|
1041 |
data: { action: "breeze_file_permission_check", 'is-network': $( 'body' ).hasClass( 'network-admin' ) },
|
1042 |
dataType: "html", // xml, html, script, json, jsonp, text
|
1043 |
success: function ( data ) {
|
1044 |
+
if ( '' === data || 'no-issue' === data ) {
|
1045 |
existing_notice.remove();
|
1046 |
} else {
|
1047 |
if ( existing_notice.length ) {
|
assets/js/breeze-main.min.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
-
jQuery(document).ready(function(n){var e=n(".breeze-box"),t=(n("#breeze-plugins-notice").length&&n(document).on("click tap",".notice-dismiss",function(){n.ajax({type:"POST",url:ajaxurl,data:{action:"compatibility_warning_close",breeze_close_warning:"1"},dataType:"json",success:function(e){},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("click","#wp-admin-bar-breeze-purge-varnish-group",function(e){e.preventDefault(),a()}),n(document).on("click","#wp-admin-bar-breeze-purge-object-cache-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_opcache",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_opcache},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Object Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}),n(document).on("click","#wp-admin-bar-breeze-purge-file-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_file",security:breeze_token_name.breeze_purge_cache},success:function(e){current=location.href;var t=e=parseFloat(e);window.location.href=current+"#breeze-msg=success-cleancache&file="+e,div=0<t?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged: '+t+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody #wpbody-content").prepend(div)}})}),n(document).on("click","#breeze_reset_default",function(e){e.preventDefault(),(reset_confirm=confirm("Want to reset breeze settings?"))&&n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_reset_default",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_reset_default},success:function(e){!0===e?(alert("Settings reset to default"),t=!0):alert("Something went wrong - please try again"),location.reload()}})}),!0);function a(){n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_varnish",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_varnish},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Varnish Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}n(".breeze-box").on("click","#purge-varnish-button",function(e){e.preventDefault(),!0===t&&(t=!1,n(this).addClass("br-is-disabled"),a())});var i,s,r=location.href,o=parseFloat((i="file",s=(s=r)||window.location.href,i=i.replace(/[\[\]]/g,"\\$&"),(i=new RegExp("[?&]"+i+"(=([^&#]*)|&|#|$)").exec(s))?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null));n(window).on("load",function(){var e,t;/wp-admin/i.test(r)&&(e="",0<r.indexOf("msg=success-cleancache")&&!isNaN(o)&&(e=0<o?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: '+o+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody .wrap h1").after(e),t=r.split("breeze-msg"),setTimeout(function(){window.location=t[0]},2e3)))}),n("#breeze-hide-install-msg").unbind("click").click(function(){n(this).closest("div.notice").fadeOut()}),-1!==(s=location.search).indexOf("breeze_purge=1")&&-1!==s.indexOf("_wpnonce")&&((s=new URLSearchParams(location.search)).delete("breeze_purge"),s.delete("_wpnonce"),history.replaceState(null,"","?"+s+location.hash)),e.on("change","#bz-lazy-load",function(){var e=n("#native-lazy-option"),t=n("#native-lazy-option-iframe");!0===n(this).is(":checked")?(e.show(),t.show()):(e.hide(),t.hide(),n("#bz-lazy-load-nat").attr("checked",!1),n("#bz-lazy-load-iframe").attr("checked",!1))}),e.on("change","#minification-css",function(){var e=n("#font-display-swap"),t=n("#font-display"),a=n("#include-inline-css"),i=n("#group-css"),s=n("#exclude-css");n(this).is(":checked")?(e.show(),s.closest("div.br-option-item").removeClass("br-apply-disable"),i.closest("div.br-option-item").removeClass("br-apply-disable"),a.closest("div.br-option-item").removeClass("br-apply-disable")):(e.hide(),t.removeAttr("checked"),a.prop("checked",!1),i.prop("checked",!1),s.closest("div.br-option-item").addClass("br-apply-disable"),i.closest("div.br-option-item").addClass("br-apply-disable"),a.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js"),a=n("#exclude-js");n(this).is(":checked")?(a.closest("div.br-option-item").removeClass("br-apply-disable"),t.closest("div.br-option-item").removeClass("br-apply-disable"),e.closest("div.br-option-item").removeClass("br-apply-disable")):(e.prop("checked",!1),t.prop("checked",!1),a.closest("div.br-option-item").addClass("br-apply-disable"),t.closest("div.br-option-item").addClass("br-apply-disable"),e.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#breeze-delay-all-js",function(){var e=n("#breeze-delay-js-scripts-div-all"),t=n("#enable-js-delay");n(this).is(":checked")?(e.show(),n('input[name="enable-js-delay"]').prop("checked",!1),n("#breeze-delay-js-scripts-div").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))}),e.on("change","#enable-js-delay",function(){var e=n("#breeze-delay-js-scripts-div"),t=n("#breeze-delay-all-js");n(this).is(":checked")?(e.show(),n('input[name="breeze-delay-all-js"]').prop("checked",!1),n("#breeze-delay-js-scripts-div-all").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))})});var $valid_json=!1;jQuery(document).ready(function(r){var e=r(".breeze-box");function o(){e.on("click","span.item-remove",function(){var e=r(this).closest(".breeze-input-group");e.fadeOut(300,function(){e.remove(),d()})})}function c(){r(".breeze-list-url").length&&r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:d})}function l(){r(".sort-handle span").unbind("click").click(function(e){var t=r(this).parents(".breeze-input-group");r(this).hasClass("moveUp")?t.insertBefore(t.prev()):t.insertAfter(t.next()),d()})}function d(){var e=r(".breeze-list-url");e.find(".breeze-input-group").find(".sort-handle").find("span").removeClass("blur"),e.find(".breeze-input-group:first-child").find(".moveUp").addClass("blur"),e.find(".breeze-input-group:last-child").find(".moveDown").addClass("blur")}r('input[name="all_control"]').click(function(){1==r(this).is(":checked")?r(".clean-data").prop("checked",!0):r(".clean-data").prop("checked",!1)}),r(".clean-data").click(function(){0==r(this).is(":checked")&&r('input[name="all_control"]').prop("checked",!1)}),o(),c(),l(),d(),e.on("keyup change blur",".breeze-input-url",function(){var e=r(this).val();""!==e&&(!0==!!/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/.test(e)?r(this).removeClass("is-invalid-url"):r(this).addClass("is-invalid-url"))}),e.on("click","button.add-url",function(){var e=-1<r(this).attr("id").indexOf("defer"),t=-1<r(this).attr("id").indexOf("preload-fonts"),a=r(this).closest("div.br-option").find(".breeze-list-url"),i="",s=a.find(".breeze-input-group"),n=!1;if(s.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(n=!0)}),n)return!1;a.append(i=(i=(i=(i=(i=(i=i+'<div class="breeze-input-group">'+' <input type="text" size="98"')+'class="breeze-input-url"'+(t?'name="breeze-preload-font[]"':e?'name="defer-js[]"':'name="move-to-footer-js[]"'))+'placeholder="Enter URL..."'+'value="" />')+' <span class="sort-handle">'+' <span class="dashicons dashicons-arrow-up moveUp"></span>')+' <span class="dashicons dashicons-arrow-down moveDown"></span>'+" </span>")+' <span class="dashicons dashicons-no item-remove" title="Remove"></span>'+"</div>"),o(),c(),l(),d()}),r("#breeze-tabs .nav-tab").click(function(e){e.preventDefault(),r("#breeze-tabs .nav-tab").removeClass("active"),r(e.target).addClass("active"),id_tab=r(this).data("tab-id"),r("#tab-"+id_tab).addClass("active"),r("#breeze-tabs-content .tab-pane").removeClass("active"),r("#tab-content-"+id_tab).addClass("active"),document.cookie="breeze_active_tab="+id_tab,"faq"===id_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),t=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}("breeze_active_tab"),0===r("#tab-"+(t="import_export"===(t=t||"basic")?"basic":t)).length?(firstTab=r("#breeze-tabs").find("a:first-child")).length&&(tabType=firstTab.attr("id").replace("tab-",""),firstTab.addClass("active"),r("#tab-content-"+tabType).addClass("active")):(r("#tab-"+t).addClass("active"),r("#tab-content-"+t).addClass("active")),"faq"===t?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var t,a=["faq"],i=!0,s=!1,n=r("#breeze-inherit-settings-toggle");function b(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",s=a[1].split(/[&;]/g),n=s.length;0<n--;)-1!==s[n].lastIndexOf(i,0)&&s.splice(n,1);return a[0]+(0<s.length?"?"+s.join("&"):"")}return e}n.length&&(r("input",n).on("change",function(){var t="1"==r(this).val();r("#breeze-tabs").toggleClass("tabs-hidden",t),r("#breeze-tabs-content").toggleClass("tabs-hidden",t),r("#breeze-tabs .nav-tab").each(function(){var e=r(this).data("tab-id");-1===r.inArray(e,a)&&(r(this).toggleClass("inactive",t),r("#breeze-tabs-content #tab-content-"+e).toggleClass("inactive",t))}),s=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);i&&s&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:n.serializeArray(),beforeSend:function(){n.addClass("loading")},complete:function(){n.removeClass("loading"),s=!1,t.submit()},success:function(){r("input:checked",n).parents(".radio-field").addClass("active").siblings().removeClass("active")}}))})),r("#breeze-database-optimize").on("click",function(e){i=!1}),r("#tab-content-database .submit input").on("click",function(e){r("#tab-content-database input[type=checkbox]").attr("checked",!1)}),window.history&&"function"==typeof window.history.pushState&&(t=b(window.location.href,"save-settings"),t=b(t,"database-cleanup"),window.history.pushState(null,null,t)),e.on("click tap","#breeze_export_settings",function(){$network=r("#breeze-level").val(),window.location=ajaxurl+"?action=breeze_export_json&network_level="+$network}),r("#breeze_import_btn").attr("disabled","disabled"),e.on("change","#breeze_import_settings",function(){var e=this.files[0],t=r("#file-selected"),a=r("#file-error"),i=r("#breeze_import_btn");t.html(e.name),"application/json"!==e.type?($valid_json=!1,t.removeClass("file_green file_red").addClass("file_red"),a.html("File must be JSON"),i.attr("disabled","disabled")):($valid_json=!0,t.removeClass("file_green file_red").addClass("file_green"),a.html(""),i.removeAttr("disabled")),r(".br-file-text").remove()}),e.on("click tap","#breeze_import_btn",function(){var e,t,a,i,s;!0===$valid_json&&(e=r("#breeze-level").val(),t=r("#breeze_import_settings").get(0).files[0],(a=new FormData).append("action","breeze_import_json"),a.append("network_level",e),a.append("breeze_import_file",t),a.append("security",breeze_token_name.breeze_import_settings),i=r("#file-selected"),s=r("#file-error"),i.removeClass("file_green file_red").addClass("file_green"),i.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:a,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(i.removeClass("file_green file_red").addClass("file_green"),i.html(e.data),s.html(""),alert(e.data),window.location.reload(!0)):(i.removeClass("file_green file_red"),i.html(""),s.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(n){var s=[];setTimeout(function(){var e=n("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),n(window).on("resize",function(){632<=n(this).height()&&n(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}n(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var i=this.dataset.tabId,t=n(".br-options"),e=(o=(o=r("breeze_active_tab"))||"basic",n(".br-link").removeClass("br-active"),n(".br-link").each(function(e,t){var t=t.dataset.breezeLink,a=n(this).find("img"),i=a.get(0).dataset.path;a.attr("src",i+t+".png")}),n(this).closest(".br-link")),e=(e.addClass("br-active"),e.find("img")),a=e.get(0).dataset.path;e.attr("src",a+i+"-active.png"),t.html('<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>'),!0===n(".br-mobile-menu").is(":visible")&&n(".br-link").fadeOut(),n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:i,"is-network":n("body").hasClass("network-admin")},contentType:"text/html; charset=UTF-8",dataType:"html",success:function(e){t.html(e)},error:function(e,t,a){},complete:function(e,t){var a=n(".breeze-per");a.length&&(a.empty(),a.append("<p>Re-checking permissions, please wait...</p>")),n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":n("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e?a.remove():a.length?(n(e).insertBefore(a),a.remove()):n("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}}),document.cookie="breeze_active_tab="+i,"faq"===i&&n("#faq-content").length&&n("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),s=[]}})});var o=r("breeze_active_tab"),e=(n("#tab-basic").closest("div.br-link").hasClass("br-hide")?n("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=n("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(e=n("#tab-basic")).length&&e.trigger("click"),n(".breeze-box"));e.on("click",".br-db-item",function(){var e=this.dataset.section;if(n(this).hasClass("br-db-selected")){if(n(this).removeClass("br-db-selected"),s.length){for(var t=[],a=0;a<s.length;a++)e!==s[a]&&t.push(s[a]);s=t}}else n(this).addClass("br-db-selected"),s.push(e);var i=n("#optimize-selected-services");s.length?i.show():i.hide()}),e.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=s.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},s)),security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==n.inArray(a,s)&&(n(t).find("h3").find("span").removeClass("br-has").html("0"),n(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),n("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){s=[]}})}),e.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=n(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(n(this).addClass("opac"),n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){t.find("h3").find("span").removeClass("br-has").html("0"),alert("Data for "+a+" has been cleaned")},error:function(e,t,a){},complete:function(e,t){}}))}),e.on("change","#br-clean-all",function(e){var t=n(this).is(":checked"),a=n("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),e.on("click","#br-clean-all-cta",function(e){!1===n(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),n("div.br-db-item").each(function(e,t){n(t).find("h3").find("span").removeClass("br-has").html("0")});var t=n("#br-clean-all");t.is(":checked")&&t.trigger("click"),alert("Clean all process finished")},error:function(e,t,a){},complete:function(e,t){}})}),e.on("click",".br-mobile-menu",function(){n(".br-link").fadeToggle()}),e.on("click",".br-submit-save",function(e){e.preventDefault();var e=n(this).closest("form"),t=e.get(0).dataset.section,e={action:"save_settings_tab_"+t,security:breeze_token_name.breeze_save_options,"form-data":e.serialize(),"is-network":n("body").hasClass("network-admin")};n(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){n("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("change",'input:radio[name="inherit-settings"]',function(){var a=n('input:radio[name="inherit-settings"]:checked').val(),i=".br-is-network",s=".br-is-custom",e=n(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val(),e=(n(".br-overlay-disable").addClass("br-hide"),{action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":n("body").hasClass("network-admin")});n("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(n("#wpcontent")),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){n("#wpcontent").find("div.br-inherit-wait").remove(),("0"===a||!0===a?(n(i).removeClass("br-show").addClass("br-hide"),n(s).removeClass("br-hide").addClass("br-show"),n(".br-link").removeClass("br-hide"),n("#tab-basic")):(n(s).removeClass("br-show").addClass("br-hide"),n(i).removeClass("br-hide").addClass("br-show"),n(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&n(t).addClass("br-hide")}),n("#tab-faq"))).trigger("click")}})}),n(document).on("click",".notice-dismiss",function(){var e=n(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
|
1 |
/*! Created by Cloudways
|
2 |
+
On 31-10-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-object-cache-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_opcache",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_opcache},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Object Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}),n(document).on("click","#wp-admin-bar-breeze-purge-file-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_file",security:breeze_token_name.breeze_purge_cache},success:function(e){current=location.href;var t=e=parseFloat(e);window.location.href=current+"#breeze-msg=success-cleancache&file="+e,div=0<t?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged: '+t+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody #wpbody-content").prepend(div)}})}),n(document).on("click","#breeze_reset_default",function(e){e.preventDefault(),reset_confirm=confirm("Want to reset breeze settings?"),reset_confirm&&n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_reset_default",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_reset_default},success:function(e){!0===e?(alert("Settings reset to default"),t=!0):alert("Something went wrong - please try again"),location.reload()}})});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())}),e.length&&n(".breeze-box").on("keyup paste","#cdn-url",function(){var e=n.trim(n(this).val());""!==e&&!0===/^(http(s)?:)?\/\/(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(e)?n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_check_cdn_url",cdn_url:e,security:breeze_token_name.breeze_check_cdn_url},dataType:"json",success:function(e){!1===e.success?(n("#cdn-message-error").show(),n("#cdn-message-error").html(e.message)):n("#cdn-message-error").hide()},error:function(e,t,a){},complete:function(e,t){}}):n("#cdn-message-error").hide()});var i,s,r,o=location.href,c=parseFloat((i="file",s=(s=o)||window.location.href,i=i.replace(/[\[\]]/g,"\\$&"),(s=new RegExp("[?&]"+i+"(=([^&#]*)|&|#|$)").exec(s))?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null));n(window).on("load",function(){var e,t;/wp-admin/i.test(o)&&(e="",0<o.indexOf("msg=success-cleancache")&&!isNaN(c)&&(e=0<c?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: '+c+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody .wrap h1").after(e),t=o.split("breeze-msg"),setTimeout(function(){window.location=t[0]},2e3)))}),n("#breeze-hide-install-msg").unbind("click").click(function(){n(this).closest("div.notice").fadeOut()}),-1!==(r=location.search).indexOf("breeze_purge=1")&&-1!==r.indexOf("_wpnonce")&&((r=new URLSearchParams(location.search)).delete("breeze_purge"),r.delete("_wpnonce"),history.replaceState(null,"","?"+r+location.hash)),e.on("change","#bz-lazy-load",function(){var e=n("#native-lazy-option"),t=n("#native-lazy-option-iframe");!0===n(this).is(":checked")?(e.show(),t.show()):(e.hide(),t.hide(),n("#bz-lazy-load-nat").attr("checked",!1),n("#bz-lazy-load-iframe").attr("checked",!1))}),e.on("change","#minification-css",function(){var e=n("#font-display-swap"),t=n("#font-display"),a=n("#include-inline-css"),i=n("#group-css"),s=n("#exclude-css");n(this).is(":checked")?(e.show(),s.closest("div.br-option-item").removeClass("br-apply-disable"),i.closest("div.br-option-item").removeClass("br-apply-disable"),a.closest("div.br-option-item").removeClass("br-apply-disable")):(e.hide(),t.removeAttr("checked"),a.prop("checked",!1),i.prop("checked",!1),s.closest("div.br-option-item").addClass("br-apply-disable"),i.closest("div.br-option-item").addClass("br-apply-disable"),a.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js"),a=n("#exclude-js");n(this).is(":checked")?(a.closest("div.br-option-item").removeClass("br-apply-disable"),t.closest("div.br-option-item").removeClass("br-apply-disable"),e.closest("div.br-option-item").removeClass("br-apply-disable")):(e.prop("checked",!1),t.prop("checked",!1),a.closest("div.br-option-item").addClass("br-apply-disable"),t.closest("div.br-option-item").addClass("br-apply-disable"),e.closest("div.br-option-item").addClass("br-apply-disable"))}),e.on("change","#breeze-delay-all-js",function(){var e=n("#breeze-delay-js-scripts-div-all"),t=n("#enable-js-delay");n(this).is(":checked")?(e.show(),n('input[name="enable-js-delay"]').prop("checked",!1),n("#breeze-delay-js-scripts-div").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))}),e.on("change","#enable-js-delay",function(){var e=n("#breeze-delay-js-scripts-div"),t=n("#breeze-delay-all-js");n(this).is(":checked")?(e.show(),n('input[name="breeze-delay-all-js"]').prop("checked",!1),n("#breeze-delay-js-scripts-div-all").hide(),t.attr("disabled","disabled")):(e.hide(),t.removeAttr("disabled"))})});var $valid_json=!1;jQuery(document).ready(function(r){var e,t=r(".breeze-box");function o(){t.on("click","span.item-remove",function(){var e=r(this).closest(".breeze-input-group");e.fadeOut(300,function(){e.remove(),d()})})}function c(){r(".breeze-list-url").length&&r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:d})}function l(){r(".sort-handle span").unbind("click").click(function(e){var t=r(this).parents(".breeze-input-group");r(this).hasClass("moveUp")?t.insertBefore(t.prev()):t.insertAfter(t.next()),d()})}function d(){var e=r(".breeze-list-url");e.find(".breeze-input-group").find(".sort-handle").find("span").removeClass("blur"),e.find(".breeze-input-group:first-child").find(".moveUp").addClass("blur"),e.find(".breeze-input-group:last-child").find(".moveDown").addClass("blur")}r('input[name="all_control"]').click(function(){1==r(this).is(":checked")?r(".clean-data").prop("checked",!0):r(".clean-data").prop("checked",!1)}),r(".clean-data").click(function(){0==r(this).is(":checked")&&r('input[name="all_control"]').prop("checked",!1)}),o(),c(),l(),d(),t.on("keyup change blur",".breeze-input-url",function(){var e=r(this).val();""!==e&&(!0==!!/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/.test(e)?r(this).removeClass("is-invalid-url"):r(this).addClass("is-invalid-url"))}),t.on("click","button.add-url",function(){var e=-1<r(this).attr("id").indexOf("defer"),t=-1<r(this).attr("id").indexOf("preload-fonts"),a=r(this).closest("div.br-option").find(".breeze-list-url"),i="",s=a.find(".breeze-input-group"),n=!1;if(s.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(n=!0)}),n)return!1;i+='<div class="breeze-input-group">',i+=' <input type="text" size="98"',i+='class="breeze-input-url"',i+=t?'name="breeze-preload-font[]"':e?'name="defer-js[]"':'name="move-to-footer-js[]"',i+='placeholder="Enter URL..."',i+='value="" />',i+=' <span class="sort-handle">',i+=' <span class="dashicons dashicons-arrow-up moveUp"></span>',i+=' <span class="dashicons dashicons-arrow-down moveDown"></span>',i+=" </span>",i+=' <span class="dashicons dashicons-no item-remove" title="Remove"></span>',a.append(i+="</div>"),o(),c(),l(),d()}),r("#breeze-tabs .nav-tab").click(function(e){e.preventDefault(),r("#breeze-tabs .nav-tab").removeClass("active"),r(e.target).addClass("active"),id_tab=r(this).data("tab-id"),r("#tab-"+id_tab).addClass("active"),r("#breeze-tabs-content .tab-pane").removeClass("active"),r("#tab-content-"+id_tab).addClass("active"),document.cookie="breeze_active_tab="+id_tab,"faq"===id_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),e=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}("breeze_active_tab"),0===r("#tab-"+(e="import_export"===(e=e||"basic")?"basic":e)).length?(firstTab=r("#breeze-tabs").find("a:first-child"),firstTab.length&&(tabType=firstTab.attr("id").replace("tab-",""),firstTab.addClass("active"),r("#tab-content-"+tabType).addClass("active"))):(r("#tab-"+e).addClass("active"),r("#tab-content-"+e).addClass("active")),"faq"===e?(r("#breeze-and-cloudways").hide(),r("#faq-content").length&&r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var a,i=["faq"],s=!0,n=!1,b=r("#breeze-inherit-settings-toggle");function p(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",s=a[1].split(/[&;]/g),n=s.length;0<n--;)-1!==s[n].lastIndexOf(i,0)&&s.splice(n,1);return a[0]+(0<s.length?"?"+s.join("&"):"")}return e}b.length&&(r("input",b).on("change",function(){var t="1"==r(this).val();r("#breeze-tabs").toggleClass("tabs-hidden",t),r("#breeze-tabs-content").toggleClass("tabs-hidden",t),r("#breeze-tabs .nav-tab").each(function(){var e=r(this).data("tab-id");-1===r.inArray(e,i)&&(r(this).toggleClass("inactive",t),r("#breeze-tabs-content #tab-content-"+e).toggleClass("inactive",t))}),n=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);s&&n&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:b.serializeArray(),beforeSend:function(){b.addClass("loading")},complete:function(){b.removeClass("loading"),n=!1,t.submit()},success:function(){r("input:checked",b).parents(".radio-field").addClass("active").siblings().removeClass("active")}}))})),r("#breeze-database-optimize").on("click",function(e){s=!1}),r("#tab-content-database .submit input").on("click",function(e){r("#tab-content-database input[type=checkbox]").attr("checked",!1)}),window.history&&"function"==typeof window.history.pushState&&(a=p(window.location.href,"save-settings"),a=p(a,"database-cleanup"),window.history.pushState(null,null,a)),t.on("click tap","#breeze_export_settings",function(){$network=r("#breeze-level").val(),window.location=ajaxurl+"?action=breeze_export_json&network_level="+$network}),r("#breeze_import_btn").attr("disabled","disabled"),t.on("change","#breeze_import_settings",function(){var e=this.files[0],t=r("#file-selected"),a=r("#file-error"),i=r("#breeze_import_btn");t.html(e.name),"application/json"!==e.type?($valid_json=!1,t.removeClass("file_green file_red").addClass("file_red"),a.html("File must be JSON"),i.attr("disabled","disabled")):($valid_json=!0,t.removeClass("file_green file_red").addClass("file_green"),a.html(""),i.removeAttr("disabled")),r(".br-file-text").remove()}),t.on("click tap","#breeze_import_btn",function(){var e,t,a,i,s;!0===$valid_json&&(e=r("#breeze-level").val(),t=r("#breeze_import_settings").get(0).files[0],(a=new FormData).append("action","breeze_import_json"),a.append("network_level",e),a.append("breeze_import_file",t),a.append("security",breeze_token_name.breeze_import_settings),i=r("#file-selected"),s=r("#file-error"),i.removeClass("file_green file_red").addClass("file_green"),i.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:a,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(i.removeClass("file_green file_red").addClass("file_green"),i.html(e.data),s.html(""),alert(e.data),window.location.reload(!0)):(i.removeClass("file_green file_red"),i.html(""),s.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(n){var s=[];setTimeout(function(){var e=n("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),n(window).on("resize",function(){632<=n(this).height()&&n(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""}n(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var a=this.dataset.tabId,t=n(".br-options");o=(o=r("breeze_active_tab"))||"basic",n(".br-link").removeClass("br-active"),n(".br-link").each(function(e,t){var a=t.dataset.breezeLink,i=n(this).find("img"),t=i.get(0).dataset.path;i.attr("src",t+a+".png")});var i=n(this).closest(".br-link");i.addClass("br-active");e=i.find("img"),i=e.get(0).dataset.path;e.attr("src",i+a+"-active.png"),t.html('<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>'),!0===n(".br-mobile-menu").is(":visible")&&n(".br-link").fadeOut(),n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:a,"is-network":n("body").hasClass("network-admin")},contentType:"text/html; charset=UTF-8",dataType:"html",success:function(e){t.html(e)},error:function(e,t,a){},complete:function(e,t){!function(){var t=n(".breeze-per");t.length&&(t.empty(),t.append("<p>Re-checking permissions, please wait...</p>"));n.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":n("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e||"no-issue"===e?t.remove():t.length?(n(e).insertBefore(t),t.remove()):n("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}})}(),document.cookie="breeze_active_tab="+a,"faq"===a&&n("#faq-content").length&&n("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),s=[]}})});var e,o=r("breeze_active_tab");n("#tab-basic").closest("div.br-link").hasClass("br-hide")?n("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=n("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(t=n("#tab-basic")).length&&t.trigger("click");var t=n(".breeze-box");t.on("click",".br-db-item",function(){var e=this.dataset.section;if(n(this).hasClass("br-db-selected")){if(n(this).removeClass("br-db-selected"),s.length){for(var t=[],a=0;a<s.length;a++)e!==s[a]&&t.push(s[a]);s=t}}else n(this).addClass("br-db-selected"),s.push(e);var i=n("#optimize-selected-services");s.length?i.show():i.hide()}),t.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=s.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},s)),security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==n.inArray(a,s)&&(n(t).find("h3").find("span").removeClass("br-has").html("0"),n(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),n("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){s=[]}})}),t.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=n(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(n(this).addClass("opac"),n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){t.find("h3").find("span").removeClass("br-has").html("0"),alert("Data for "+a+" has been cleaned")},error:function(e,t,a){},complete:function(e,t){}}))}),t.on("change","#br-clean-all",function(e){var t=n(this).is(":checked"),a=n("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),t.on("click","#br-clean-all-cta",function(e){!1===n(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&n.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":n("body").hasClass("network-admin")},dataType:"JSON",success:function(e){n(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),n("div.br-db-item").each(function(e,t){n(t).find("h3").find("span").removeClass("br-has").html("0")});var t=n("#br-clean-all");t.is(":checked")&&t.trigger("click"),alert("Clean all process finished")},error:function(e,t,a){},complete:function(e,t){}})}),t.on("click",".br-mobile-menu",function(){n(".br-link").fadeToggle()}),t.on("click",".br-submit-save",function(e){e.preventDefault();var e=n(this).closest("form"),t=e.get(0).dataset.section,e={action:"save_settings_tab_"+t,security:breeze_token_name.breeze_save_options,"form-data":e.serialize(),"is-network":n("body").hasClass("network-admin")};n(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){n("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("change",'input:radio[name="inherit-settings"]',function(){var a=n('input:radio[name="inherit-settings"]:checked').val(),i=".br-is-network",s=".br-is-custom",e=n(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val();n(".br-overlay-disable").addClass("br-hide");e={action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":n("body").hasClass("network-admin")};n("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(n("#wpcontent")),n.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){n("#wpcontent").find("div.br-inherit-wait").remove(),"0"===a||!0===a?(n(i).removeClass("br-show").addClass("br-hide"),n(s).removeClass("br-hide").addClass("br-show"),n(".br-link").removeClass("br-hide"),n("#tab-basic").trigger("click")):(n(s).removeClass("br-show").addClass("br-hide"),n(i).removeClass("br-hide").addClass("br-show"),n(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&n(t).addClass("br-hide")}),n("#tab-faq").trigger("click"))}})}),n(document).on("click",".notice-dismiss",function(){var e=n(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
assets/js/js-front-end/breeze-lazy-load.min.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
-
|
|
1 |
/*! Created by Cloudways
|
2 |
+
On 31-10-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,3 +1,4 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
-
|
|
1 |
/*! Created by Cloudways
|
2 |
+
On 31-10-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,t,r;"#"!==n&&(r=n.replace(breeze_prefetch.local_url,""),e=new URL(breeze_prefetch.local_url).host,t=new URL(n).host,""!==n.trim()&&!1===i.includes(n)&&e===t&&!1===search_for_banned_links(breeze_prefetch.ignore_list,r)&&(i.push(n.trim()),(r=document.createElement("link")).href=n,r.rel="prefetch",document.head.appendChild(r)))},150))}),addEventListener("mouseout",function(e){clearTimeout(timer)})});
|
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() );
|
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.11
|
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.11' );
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
inc/breeze-admin.php
CHANGED
@@ -190,6 +190,7 @@ class Breeze_Admin {
|
|
190 |
'breeze_purge_opcache' => '',
|
191 |
'breeze_import_settings' => '',
|
192 |
'breeze_reset_default' => '',
|
|
|
193 |
);
|
194 |
|
195 |
// Only create the security nonce if the user has manage_options ( administrator capabilities ).
|
@@ -202,6 +203,7 @@ class Breeze_Admin {
|
|
202 |
'breeze_purge_opcache' => wp_create_nonce( '_breeze_purge_opcache' ),
|
203 |
'breeze_import_settings' => wp_create_nonce( '_breeze_import_settings' ),
|
204 |
'breeze_reset_default' => wp_create_nonce( '_breeze_reset_default' ),
|
|
|
205 |
);
|
206 |
}
|
207 |
|
@@ -256,18 +258,27 @@ class Breeze_Admin {
|
|
256 |
|
257 |
if ( is_multisite() && ! is_subdomain_install() ) {
|
258 |
$blog_details = get_blog_details();
|
|
|
|
|
|
|
|
|
259 |
$current_host .= rtrim( $blog_details->path, '/' );
|
260 |
}
|
261 |
|
262 |
-
|
|
|
|
|
263 |
$current_screen_url = remove_query_arg( array( 'breeze_purge', '_wpnonce' ), $current_screen_url );
|
264 |
|
|
|
|
|
|
|
265 |
// add purge all item
|
266 |
$args = array(
|
267 |
'id' => 'breeze-purge-all',
|
268 |
'title' => ( ! is_multisite() || $is_network ) ? esc_html__( 'Purge All Cache', 'breeze' ) : esc_html__( 'Purge Site Cache', 'breeze' ),
|
269 |
'parent' => 'breeze-topbar',
|
270 |
-
'href' =>
|
271 |
'meta' => array( 'class' => 'breeze-toolbar-group' ),
|
272 |
);
|
273 |
$wp_admin_bar->add_node( $args );
|
@@ -359,6 +370,7 @@ class Breeze_Admin {
|
|
359 |
add_action( 'wp_ajax_breeze_purge_database', array( 'Breeze_Configuration', 'breeze_ajax_purge_database' ) );
|
360 |
add_action( 'wp_ajax_breeze_purge_opcache', array( 'Breeze_Configuration', 'breeze_ajax_purge_opcache' ) );
|
361 |
add_action( 'wp_ajax_breeze_reset_default', array( 'Breeze_Configuration', 'reset_to_default_ajax' ) );
|
|
|
362 |
}
|
363 |
|
364 |
/*
|
190 |
'breeze_purge_opcache' => '',
|
191 |
'breeze_import_settings' => '',
|
192 |
'breeze_reset_default' => '',
|
193 |
+
'breeze_check_cdn_url' => '',
|
194 |
);
|
195 |
|
196 |
// Only create the security nonce if the user has manage_options ( administrator capabilities ).
|
203 |
'breeze_purge_opcache' => wp_create_nonce( '_breeze_purge_opcache' ),
|
204 |
'breeze_import_settings' => wp_create_nonce( '_breeze_import_settings' ),
|
205 |
'breeze_reset_default' => wp_create_nonce( '_breeze_reset_default' ),
|
206 |
+
'breeze_check_cdn_url' => wp_create_nonce( '_breeze_check_cdn_url' ),
|
207 |
);
|
208 |
}
|
209 |
|
258 |
|
259 |
if ( is_multisite() && ! is_subdomain_install() ) {
|
260 |
$blog_details = get_blog_details();
|
261 |
+
if ( ! empty( $blog_details->path ) ) {
|
262 |
+
$blog_details->path = '';
|
263 |
+
}
|
264 |
+
|
265 |
$current_host .= rtrim( $blog_details->path, '/' );
|
266 |
}
|
267 |
|
268 |
+
#$current_screen_url = $current_protocol . '://' . $current_host . $current_script . '?' . $current_params;
|
269 |
+
$current_script = str_replace( '/wp-admin/', '', $current_script);
|
270 |
+
$current_screen_url = trailingslashit( admin_url() ) . $current_script . '?' . $current_params;
|
271 |
$current_screen_url = remove_query_arg( array( 'breeze_purge', '_wpnonce' ), $current_screen_url );
|
272 |
|
273 |
+
$purge_site_cache_url = esc_url( wp_nonce_url( add_query_arg( 'breeze_purge', 1, $current_screen_url ), 'breeze_purge_cache' ) );
|
274 |
+
|
275 |
+
|
276 |
// add purge all item
|
277 |
$args = array(
|
278 |
'id' => 'breeze-purge-all',
|
279 |
'title' => ( ! is_multisite() || $is_network ) ? esc_html__( 'Purge All Cache', 'breeze' ) : esc_html__( 'Purge Site Cache', 'breeze' ),
|
280 |
'parent' => 'breeze-topbar',
|
281 |
+
'href' => $purge_site_cache_url,
|
282 |
'meta' => array( 'class' => 'breeze-toolbar-group' ),
|
283 |
);
|
284 |
$wp_admin_bar->add_node( $args );
|
370 |
add_action( 'wp_ajax_breeze_purge_database', array( 'Breeze_Configuration', 'breeze_ajax_purge_database' ) );
|
371 |
add_action( 'wp_ajax_breeze_purge_opcache', array( 'Breeze_Configuration', 'breeze_ajax_purge_opcache' ) );
|
372 |
add_action( 'wp_ajax_breeze_reset_default', array( 'Breeze_Configuration', 'reset_to_default_ajax' ) );
|
373 |
+
add_action( 'wp_ajax_breeze_check_cdn_url', array( 'Breeze_Configuration', 'breeze_ajax_check_cdn_url' ) );
|
374 |
}
|
375 |
|
376 |
/*
|
inc/breeze-configuration.php
CHANGED
@@ -1491,6 +1491,70 @@ class Breeze_Configuration {
|
|
1491 |
exit;
|
1492 |
}
|
1493 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1494 |
/**
|
1495 |
* Ajax purge Object Cache
|
1496 |
*
|
1491 |
exit;
|
1492 |
}
|
1493 |
|
1494 |
+
public static function breeze_ajax_check_cdn_url() {
|
1495 |
+
breeze_is_restricted_access();
|
1496 |
+
check_ajax_referer( '_breeze_check_cdn_url', 'security' );
|
1497 |
+
|
1498 |
+
$breeze_user_agent = 'breeze-cdn-check-help-user';
|
1499 |
+
|
1500 |
+
$verify_host = 2;
|
1501 |
+
$ssl_verification = apply_filters( 'breeze_ssl_check_certificate', true );
|
1502 |
+
if ( ! is_bool( $ssl_verification ) ) {
|
1503 |
+
$ssl_verification = true;
|
1504 |
+
}
|
1505 |
+
|
1506 |
+
if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
|
1507 |
+
$ssl_verification = false;
|
1508 |
+
$verify_host = 0;
|
1509 |
+
}
|
1510 |
+
|
1511 |
+
$cdn_url = isset( $_POST['cdn_url'] ) ? trim( $_POST['cdn_url'] ) : '';
|
1512 |
+
$cdn_url = ltrim( $cdn_url, 'https:' );
|
1513 |
+
$cdn_url = 'https:' . $cdn_url;
|
1514 |
+
|
1515 |
+
if ( false === filter_var( $cdn_url, FILTER_VALIDATE_URL ) ) {
|
1516 |
+
return false;
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
$connection = curl_init( 'https://sitecheck.sucuri.net/api/v3/?scan=' . $cdn_url );
|
1520 |
+
curl_setopt( $connection, CURLOPT_RETURNTRANSFER, true );
|
1521 |
+
curl_setopt( $connection, CURLOPT_SSL_VERIFYHOST, $verify_host );
|
1522 |
+
curl_setopt( $connection, CURLOPT_SSL_VERIFYPEER, $ssl_verification );
|
1523 |
+
curl_setopt( $connection, CURLOPT_USERAGENT, $breeze_user_agent );
|
1524 |
+
curl_setopt( $connection, CURLOPT_REFERER, home_url() );
|
1525 |
+
|
1526 |
+
/**
|
1527 |
+
* Accept up to 3 maximum redirects before cutting the connection.
|
1528 |
+
*/
|
1529 |
+
curl_setopt( $connection, CURLOPT_MAXREDIRS, 3 );
|
1530 |
+
curl_setopt( $connection, CURLOPT_FOLLOWLOCATION, true );
|
1531 |
+
|
1532 |
+
$the_json = curl_exec( $connection );
|
1533 |
+
$http_code = curl_getinfo( $connection, CURLINFO_HTTP_CODE );
|
1534 |
+
curl_close( $connection );
|
1535 |
+
|
1536 |
+
$response = array();
|
1537 |
+
|
1538 |
+
$is_json = json_decode( $the_json, true );
|
1539 |
+
if ( $is_json === null && json_last_error() !== JSON_ERROR_NONE ) {
|
1540 |
+
// incorrect data show error message
|
1541 |
+
$is_safe = true;
|
1542 |
+
} else {
|
1543 |
+
// decoded with success
|
1544 |
+
$is_safe = true;
|
1545 |
+
if ( isset( $is_json['warnings'], $is_json['warnings']['security'], $is_json['warnings']['security']['malware'] ) ) {
|
1546 |
+
$is_safe = false;
|
1547 |
+
|
1548 |
+
$response['message'] = '<strong>' . __( 'Important: ', 'breeze' ) . '</strong>';
|
1549 |
+
$response['message'] .= __( 'The CDN URL you\'ve used is insecure.', 'breeze' );
|
1550 |
+
}
|
1551 |
+
}
|
1552 |
+
$response['success'] = $is_safe;
|
1553 |
+
wp_send_json( $response );
|
1554 |
+
|
1555 |
+
exit;
|
1556 |
+
}
|
1557 |
+
|
1558 |
/**
|
1559 |
* Ajax purge Object Cache
|
1560 |
*
|
inc/cache/ecommerce-cache.php
CHANGED
@@ -624,6 +624,10 @@ class Breeze_Ecommerce_Cache {
|
|
624 |
* Remove '/' chacracter of end url
|
625 |
*/
|
626 |
public function rtrim_urls( $url ) {
|
|
|
|
|
|
|
|
|
627 |
return rtrim( $url, '/' );
|
628 |
}
|
629 |
|
624 |
* Remove '/' chacracter of end url
|
625 |
*/
|
626 |
public function rtrim_urls( $url ) {
|
627 |
+
if ( empty( $url ) || ! is_string( $url ) ) {
|
628 |
+
return $url;
|
629 |
+
}
|
630 |
+
|
631 |
return rtrim( $url, '/' );
|
632 |
}
|
633 |
|
inc/cache/execute-cache.php
CHANGED
@@ -139,6 +139,9 @@ if ( ! empty( $_COOKIE ) ) {
|
|
139 |
|
140 |
if ( ! empty( $_COOKIE['breeze_commented_posts'] ) ) {
|
141 |
foreach ( $_COOKIE['breeze_commented_posts'] as $path ) {
|
|
|
|
|
|
|
142 |
if ( rtrim( $path, '/' ) === rtrim( $_SERVER['REQUEST_URI'], '/' ) ) {
|
143 |
// User commented on this post
|
144 |
return;
|
@@ -246,25 +249,6 @@ function breeze_cache( $buffer, $flags ) {
|
|
246 |
|
247 |
$modified_time = time(); // Make sure modified time is consistent
|
248 |
|
249 |
-
if ( preg_match( '#</html>#i', $buffer ) ) {
|
250 |
-
$buffer .= "\n<!-- Cache served by breeze CACHE - Last modified: " . gmdate( 'D, d M Y H:i:s', $modified_time ) . " GMT -->\n";
|
251 |
-
}
|
252 |
-
$headers = array(
|
253 |
-
array(
|
254 |
-
'name' => 'Content-Length',
|
255 |
-
'value' => strlen( $buffer ),
|
256 |
-
),
|
257 |
-
array(
|
258 |
-
'name' => 'Content-Type',
|
259 |
-
'value' => 'text/html; charset=utf-8',
|
260 |
-
),
|
261 |
-
array(
|
262 |
-
'name' => 'Last-Modified',
|
263 |
-
'value' => gmdate( 'D, d M Y H:i:s', $modified_time ) . ' GMT',
|
264 |
-
),
|
265 |
-
);
|
266 |
-
|
267 |
-
|
268 |
// Lazy load implementation
|
269 |
if ( class_exists( 'Breeze_Lazy_Load' ) ) {
|
270 |
if ( isset( $GLOBALS['breeze_config'] ) ) {
|
@@ -286,8 +270,6 @@ function breeze_cache( $buffer, $flags ) {
|
|
286 |
}
|
287 |
|
288 |
if ( isset( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'] ) && filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'], FILTER_VALIDATE_BOOLEAN ) ) {
|
289 |
-
|
290 |
-
|
291 |
// ------------------------------------------------------------------------------------------
|
292 |
|
293 |
$home_url = $GLOBALS['breeze_config']['homepage'];
|
@@ -345,11 +327,31 @@ function breeze_cache( $buffer, $flags ) {
|
|
345 |
}
|
346 |
}
|
347 |
}
|
348 |
-
$buffer = $html_dom->saveHTML();
|
349 |
// ------------------------------------------------------------------------------------------
|
350 |
|
351 |
}
|
352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
$data = serialize(
|
354 |
array(
|
355 |
'body' => $buffer,
|
@@ -391,13 +393,15 @@ function breeze_cache( $buffer, $flags ) {
|
|
391 |
}
|
392 |
}
|
393 |
|
|
|
|
|
394 |
if ( strpos( $url_path, '_breeze_cache_' ) !== false ) {
|
395 |
if ( ! empty( $GLOBALS['breeze_config']['cache_options']['breeze-gzip-compression'] ) && function_exists( 'gzencode' ) ) {
|
396 |
-
$wp_filesystem->put_contents( $path . md5( $url_path . '/index.gzip.html' ) .
|
397 |
-
$wp_filesystem->touch( $path . md5( $url_path . '/index.gzip.html' ) .
|
398 |
} else {
|
399 |
-
$wp_filesystem->put_contents( $path . md5( $url_path . '/index.html' ) .
|
400 |
-
$wp_filesystem->touch( $path . md5( $url_path . '/index.html' ) .
|
401 |
}
|
402 |
} else {
|
403 |
return $buffer;
|
@@ -440,7 +444,9 @@ function breeze_get_url_path() {
|
|
440 |
|
441 |
$host = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
|
442 |
$domain = ( ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' );
|
443 |
-
|
|
|
|
|
444 |
$the_url = $domain . rtrim( $host, '/' ) . $_SERVER['REQUEST_URI'];
|
445 |
|
446 |
$query_instance = \Breeze_Query_Strings_Rules::get_instance();
|
@@ -461,11 +467,11 @@ function breeze_serve_cache( $filename, $url_path, $X1, $opts ) {
|
|
461 |
if ( strpos( $filename, '_breeze_cache_' ) === false ) {
|
462 |
return;
|
463 |
}
|
464 |
-
|
465 |
if ( function_exists( 'gzencode' ) && ! empty( $GLOBALS['breeze_config']['cache_options']['breeze-gzip-compression'] ) ) {
|
466 |
-
$file_name = md5( $filename . '/index.gzip.html' ) .
|
467 |
} else {
|
468 |
-
$file_name = md5( $filename . '/index.html' ) .
|
469 |
}
|
470 |
|
471 |
|
139 |
|
140 |
if ( ! empty( $_COOKIE['breeze_commented_posts'] ) ) {
|
141 |
foreach ( $_COOKIE['breeze_commented_posts'] as $path ) {
|
142 |
+
if(!empty($path)){
|
143 |
+
$path = '';
|
144 |
+
}
|
145 |
if ( rtrim( $path, '/' ) === rtrim( $_SERVER['REQUEST_URI'], '/' ) ) {
|
146 |
// User commented on this post
|
147 |
return;
|
249 |
|
250 |
$modified_time = time(); // Make sure modified time is consistent
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
// Lazy load implementation
|
253 |
if ( class_exists( 'Breeze_Lazy_Load' ) ) {
|
254 |
if ( isset( $GLOBALS['breeze_config'] ) ) {
|
270 |
}
|
271 |
|
272 |
if ( isset( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'] ) && filter_var( $GLOBALS['breeze_config']['cache_options']['breeze-cross-origin'], FILTER_VALIDATE_BOOLEAN ) ) {
|
|
|
|
|
273 |
// ------------------------------------------------------------------------------------------
|
274 |
|
275 |
$home_url = $GLOBALS['breeze_config']['homepage'];
|
327 |
}
|
328 |
}
|
329 |
}
|
330 |
+
$buffer = $html_dom->saveHTML( $html_dom->documentElement );
|
331 |
// ------------------------------------------------------------------------------------------
|
332 |
|
333 |
}
|
334 |
|
335 |
+
if ( preg_match( '#</html>#i', $buffer ) ) {
|
336 |
+
|
337 |
+
$buffer .= "\n<!-- Cache served by breeze CACHE - Last modified: " . gmdate( 'D, d M Y H:i:s', $modified_time ) . " GMT -->\n";
|
338 |
+
}
|
339 |
+
|
340 |
+
$headers = array(
|
341 |
+
array(
|
342 |
+
'name' => 'Content-Length',
|
343 |
+
'value' => strlen( $buffer ),
|
344 |
+
),
|
345 |
+
array(
|
346 |
+
'name' => 'Content-Type',
|
347 |
+
'value' => 'text/html; charset=utf-8',
|
348 |
+
),
|
349 |
+
array(
|
350 |
+
'name' => 'Last-Modified',
|
351 |
+
'value' => gmdate( 'D, d M Y H:i:s', $modified_time ) . ' GMT',
|
352 |
+
),
|
353 |
+
);
|
354 |
+
|
355 |
$data = serialize(
|
356 |
array(
|
357 |
'body' => $buffer,
|
393 |
}
|
394 |
}
|
395 |
|
396 |
+
$is_suffix = breeze_currency_switcher_cache();
|
397 |
+
|
398 |
if ( strpos( $url_path, '_breeze_cache_' ) !== false ) {
|
399 |
if ( ! empty( $GLOBALS['breeze_config']['cache_options']['breeze-gzip-compression'] ) && function_exists( 'gzencode' ) ) {
|
400 |
+
$wp_filesystem->put_contents( $path . md5( $url_path . '/index.gzip.html' ) . $is_suffix . '.php', $data );
|
401 |
+
$wp_filesystem->touch( $path . md5( $url_path . '/index.gzip.html' ) . $is_suffix . '.php', $modified_time );
|
402 |
} else {
|
403 |
+
$wp_filesystem->put_contents( $path . md5( $url_path . '/index.html' ) . $is_suffix . '.php', $data );
|
404 |
+
$wp_filesystem->touch( $path . md5( $url_path . '/index.html' ) . $is_suffix . '.php', $modified_time );
|
405 |
}
|
406 |
} else {
|
407 |
return $buffer;
|
444 |
|
445 |
$host = ( isset( $_SERVER['HTTP_HOST'] ) ) ? $_SERVER['HTTP_HOST'] : '';
|
446 |
$domain = ( ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https://' : 'http://' );
|
447 |
+
if(empty($host)){
|
448 |
+
$host = '';
|
449 |
+
}
|
450 |
$the_url = $domain . rtrim( $host, '/' ) . $_SERVER['REQUEST_URI'];
|
451 |
|
452 |
$query_instance = \Breeze_Query_Strings_Rules::get_instance();
|
467 |
if ( strpos( $filename, '_breeze_cache_' ) === false ) {
|
468 |
return;
|
469 |
}
|
470 |
+
$is_suffix = breeze_currency_switcher_cache();
|
471 |
if ( function_exists( 'gzencode' ) && ! empty( $GLOBALS['breeze_config']['cache_options']['breeze-gzip-compression'] ) ) {
|
472 |
+
$file_name = md5( $filename . '/index.gzip.html' ) . $is_suffix . '.php';
|
473 |
} else {
|
474 |
+
$file_name = md5( $filename . '/index.html' ) . $is_suffix . '.php';
|
475 |
}
|
476 |
|
477 |
|
inc/class-breeze-file-permissions.php
CHANGED
@@ -38,6 +38,10 @@ class Breeze_File_Permissions {
|
|
38 |
$message_display .= '</div>';
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
41 |
wp_die( $message_display );
|
42 |
}
|
43 |
|
38 |
$message_display .= '</div>';
|
39 |
}
|
40 |
|
41 |
+
if ( empty( $message_display ) ) {
|
42 |
+
$message_display = 'no-issue';
|
43 |
+
}
|
44 |
+
|
45 |
wp_die( $message_display );
|
46 |
}
|
47 |
|
inc/class-breeze-lazy-load.php
CHANGED
@@ -258,7 +258,7 @@ class Breeze_Lazy_Load {
|
|
258 |
}
|
259 |
}
|
260 |
|
261 |
-
return $html_dom->saveHTML();
|
262 |
}
|
263 |
|
264 |
/**
|
258 |
}
|
259 |
}
|
260 |
|
261 |
+
return $html_dom->saveHTML( $html_dom->documentElement );
|
262 |
}
|
263 |
|
264 |
/**
|
inc/class-breeze-query-strings-rules.php
CHANGED
@@ -275,7 +275,14 @@ class Breeze_Query_Strings_Rules {
|
|
275 |
}
|
276 |
|
277 |
$current_url_query = parse_url( $url, PHP_URL_QUERY );
|
|
|
|
|
278 |
parse_str( $current_url_query, $breeze_query_output );
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
return $breeze_query_output;
|
281 |
}
|
275 |
}
|
276 |
|
277 |
$current_url_query = parse_url( $url, PHP_URL_QUERY );
|
278 |
+
|
279 |
+
if ( ! empty( $current_url_query ) ) {
|
280 |
parse_str( $current_url_query, $breeze_query_output );
|
281 |
+
}
|
282 |
+
|
283 |
+
if ( empty( $breeze_query_output ) ) {
|
284 |
+
$breeze_query_output = array();
|
285 |
+
}
|
286 |
|
287 |
return $breeze_query_output;
|
288 |
}
|
inc/functions.php
CHANGED
@@ -65,7 +65,9 @@ function breeze_get_cache_base_path( $is_network = false, $blog_id_requested = 0
|
|
65 |
*/
|
66 |
function breeze_get_directory_size( $dir, $exclude = array() ) {
|
67 |
$size = 0;
|
68 |
-
|
|
|
|
|
69 |
foreach ( glob( rtrim( $dir, '/' ) . '/*', GLOB_NOSORT ) as $path ) {
|
70 |
if ( is_file( $path ) ) {
|
71 |
if ( in_array( basename( $path ), $exclude ) ) {
|
@@ -386,5 +388,286 @@ function breeze_currency_switcher_cache() {
|
|
386 |
}
|
387 |
}
|
388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
return $currency;
|
390 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
*/
|
66 |
function breeze_get_directory_size( $dir, $exclude = array() ) {
|
67 |
$size = 0;
|
68 |
+
if ( empty( $dir ) ) {
|
69 |
+
$dir = '';
|
70 |
+
}
|
71 |
foreach ( glob( rtrim( $dir, '/' ) . '/*', GLOB_NOSORT ) as $path ) {
|
72 |
if ( is_file( $path ) ) {
|
73 |
if ( in_array( basename( $path ), $exclude ) ) {
|
388 |
}
|
389 |
}
|
390 |
|
391 |
+
if ( empty( $currency ) ) {
|
392 |
+
if ( isset( $GLOBALS['_SERVER'], $GLOBALS['_SERVER']['REQUEST_URI'] ) ) {
|
393 |
+
$the_path = trim( $GLOBALS['_SERVER']['REQUEST_URI'], '/' );
|
394 |
+
|
395 |
+
if ( ! empty( $the_path ) ) {
|
396 |
+
$county_list = breeze_all_country_codes();
|
397 |
+
if ( false !== strpos( $the_path, '/' ) ) {
|
398 |
+
$e = explode( '/', $the_path );
|
399 |
+
if ( ! empty( $e ) ) {
|
400 |
+
$the_path = $e[0];
|
401 |
+
}
|
402 |
+
}
|
403 |
+
|
404 |
+
$the_path = strtoupper( $the_path );
|
405 |
+
if ( array_key_exists( $the_path, $county_list ) ) {
|
406 |
+
$currency = $currency.$the_path;
|
407 |
+
|
408 |
+
}
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
|
413 |
+
if ( function_exists( 'weglot_get_current_language' ) ) {
|
414 |
+
$currency = $currency.weglot_get_current_language();
|
415 |
+
}
|
416 |
+
|
417 |
return $currency;
|
418 |
}
|
419 |
+
|
420 |
+
|
421 |
+
function breeze_all_country_codes() {
|
422 |
+
return array(
|
423 |
+
'AF' => 'Afghanistan',
|
424 |
+
'AX' => 'Åland Islands',
|
425 |
+
'AL' => 'Albania',
|
426 |
+
'DZ' => 'Algeria',
|
427 |
+
'AS' => 'American Samoa',
|
428 |
+
'AD' => 'Andorra',
|
429 |
+
'AO' => 'Angola',
|
430 |
+
'AI' => 'Anguilla',
|
431 |
+
'AQ' => 'Antarctica',
|
432 |
+
'AG' => 'Antigua and Barbuda',
|
433 |
+
'AR' => 'Argentina',
|
434 |
+
'AM' => 'Armenia',
|
435 |
+
'AW' => 'Aruba',
|
436 |
+
'AU' => 'Australia',
|
437 |
+
'AT' => 'Austria',
|
438 |
+
'AZ' => 'Azerbaijan',
|
439 |
+
'BS' => 'Bahamas',
|
440 |
+
'BH' => 'Bahrain',
|
441 |
+
'BD' => 'Bangladesh',
|
442 |
+
'BB' => 'Barbados',
|
443 |
+
'BY' => 'Belarus',
|
444 |
+
'PW' => 'Belau',
|
445 |
+
'BE' => 'Belgium',
|
446 |
+
'BZ' => 'Belize',
|
447 |
+
'BJ' => 'Benin',
|
448 |
+
'BM' => 'Bermuda',
|
449 |
+
'BT' => 'Bhutan',
|
450 |
+
'BO' => 'Bolivia',
|
451 |
+
'BQ' => 'Bonaire, Saint Eustatius and Saba',
|
452 |
+
'BA' => 'Bosnia and Herzegovina',
|
453 |
+
'BW' => 'Botswana',
|
454 |
+
'BV' => 'Bouvet Island',
|
455 |
+
'BR' => 'Brazil',
|
456 |
+
'IO' => 'British Indian Ocean Territory',
|
457 |
+
'BN' => 'Brunei',
|
458 |
+
'BG' => 'Bulgaria',
|
459 |
+
'BF' => 'Burkina Faso',
|
460 |
+
'BI' => 'Burundi',
|
461 |
+
'KH' => 'Cambodia',
|
462 |
+
'CM' => 'Cameroon',
|
463 |
+
'CA' => 'Canada',
|
464 |
+
'CV' => 'Cape Verde',
|
465 |
+
'KY' => 'Cayman Islands',
|
466 |
+
'CF' => 'Central African Republic',
|
467 |
+
'TD' => 'Chad',
|
468 |
+
'CL' => 'Chile',
|
469 |
+
'CN' => 'China',
|
470 |
+
'CX' => 'Christmas Island',
|
471 |
+
'CC' => 'Cocos (Keeling) Islands',
|
472 |
+
'CO' => 'Colombia',
|
473 |
+
'KM' => 'Comoros',
|
474 |
+
'CG' => 'Congo (Brazzaville)',
|
475 |
+
'CD' => 'Congo (Kinshasa)',
|
476 |
+
'CK' => 'Cook Islands',
|
477 |
+
'CR' => 'Costa Rica',
|
478 |
+
'HR' => 'Croatia',
|
479 |
+
'CU' => 'Cuba',
|
480 |
+
'CW' => 'Curaçao',
|
481 |
+
'CY' => 'Cyprus',
|
482 |
+
'CZ' => 'Czech Republic',
|
483 |
+
'DK' => 'Denmark',
|
484 |
+
'DJ' => 'Djibouti',
|
485 |
+
'DM' => 'Dominica',
|
486 |
+
'DO' => 'Dominican Republic',
|
487 |
+
'EC' => 'Ecuador',
|
488 |
+
'EG' => 'Egypt',
|
489 |
+
'SV' => 'El Salvador',
|
490 |
+
'GQ' => 'Equatorial Guinea',
|
491 |
+
'ER' => 'Eritrea',
|
492 |
+
'EE' => 'Estonia',
|
493 |
+
'ET' => 'Ethiopia',
|
494 |
+
'FK' => 'Falkland Islands',
|
495 |
+
'FO' => 'Faroe Islands',
|
496 |
+
'FJ' => 'Fiji',
|
497 |
+
'FI' => 'Finland',
|
498 |
+
'FR' => 'France',
|
499 |
+
'GF' => 'French Guiana',
|
500 |
+
'PF' => 'French Polynesia',
|
501 |
+
'TF' => 'French Southern Territories',
|
502 |
+
'GA' => 'Gabon',
|
503 |
+
'GM' => 'Gambia',
|
504 |
+
'GE' => 'Georgia',
|
505 |
+
'DE' => 'Germany',
|
506 |
+
'GH' => 'Ghana',
|
507 |
+
'GI' => 'Gibraltar',
|
508 |
+
'GR' => 'Greece',
|
509 |
+
'GL' => 'Greenland',
|
510 |
+
'GD' => 'Grenada',
|
511 |
+
'GP' => 'Guadeloupe',
|
512 |
+
'GU' => 'Guam',
|
513 |
+
'GT' => 'Guatemala',
|
514 |
+
'GG' => 'Guernsey',
|
515 |
+
'GN' => 'Guinea',
|
516 |
+
'GW' => 'Guinea-Bissau',
|
517 |
+
'GY' => 'Guyana',
|
518 |
+
'HT' => 'Haiti',
|
519 |
+
'HM' => 'Heard Island and McDonald Islands',
|
520 |
+
'HN' => 'Honduras',
|
521 |
+
'HK' => 'Hong Kong',
|
522 |
+
'HU' => 'Hungary',
|
523 |
+
'IS' => 'Iceland',
|
524 |
+
'IN' => 'India',
|
525 |
+
'ID' => 'Indonesia',
|
526 |
+
'IR' => 'Iran',
|
527 |
+
'IQ' => 'Iraq',
|
528 |
+
'IE' => 'Ireland',
|
529 |
+
'IM' => 'Isle of Man',
|
530 |
+
'IL' => 'Israel',
|
531 |
+
'IT' => 'Italy',
|
532 |
+
'CI' => 'Ivory Coast',
|
533 |
+
'JM' => 'Jamaica',
|
534 |
+
'JP' => 'Japan',
|
535 |
+
'JE' => 'Jersey',
|
536 |
+
'JO' => 'Jordan',
|
537 |
+
'KZ' => 'Kazakhstan',
|
538 |
+
'KE' => 'Kenya',
|
539 |
+
'KI' => 'Kiribati',
|
540 |
+
'KW' => 'Kuwait',
|
541 |
+
'KG' => 'Kyrgyzstan',
|
542 |
+
'LA' => 'Laos',
|
543 |
+
'LV' => 'Latvia',
|
544 |
+
'LB' => 'Lebanon',
|
545 |
+
'LS' => 'Lesotho',
|
546 |
+
'LR' => 'Liberia',
|
547 |
+
'LY' => 'Libya',
|
548 |
+
'LI' => 'Liechtenstein',
|
549 |
+
'LT' => 'Lithuania',
|
550 |
+
'LU' => 'Luxembourg',
|
551 |
+
'MO' => 'Macao',
|
552 |
+
'MG' => 'Madagascar',
|
553 |
+
'MW' => 'Malawi',
|
554 |
+
'MY' => 'Malaysia',
|
555 |
+
'MV' => 'Maldives',
|
556 |
+
'ML' => 'Mali',
|
557 |
+
'MT' => 'Malta',
|
558 |
+
'MH' => 'Marshall Islands',
|
559 |
+
'MQ' => 'Martinique',
|
560 |
+
'MR' => 'Mauritania',
|
561 |
+
'MU' => 'Mauritius',
|
562 |
+
'YT' => 'Mayotte',
|
563 |
+
'MX' => 'Mexico',
|
564 |
+
'FM' => 'Micronesia',
|
565 |
+
'MD' => 'Moldova',
|
566 |
+
'MC' => 'Monaco',
|
567 |
+
'MN' => 'Mongolia',
|
568 |
+
'ME' => 'Montenegro',
|
569 |
+
'MS' => 'Montserrat',
|
570 |
+
'MA' => 'Morocco',
|
571 |
+
'MZ' => 'Mozambique',
|
572 |
+
'MM' => 'Myanmar',
|
573 |
+
'NA' => 'Namibia',
|
574 |
+
'NR' => 'Nauru',
|
575 |
+
'NP' => 'Nepal',
|
576 |
+
'NL' => 'Netherlands',
|
577 |
+
'NC' => 'New Caledonia',
|
578 |
+
'NZ' => 'New Zealand',
|
579 |
+
'NI' => 'Nicaragua',
|
580 |
+
'NE' => 'Niger',
|
581 |
+
'NG' => 'Nigeria',
|
582 |
+
'NU' => 'Niue',
|
583 |
+
'NF' => 'Norfolk Island',
|
584 |
+
'KP' => 'North Korea',
|
585 |
+
'MK' => 'North Macedonia',
|
586 |
+
'MP' => 'Northern Mariana Islands',
|
587 |
+
'NO' => 'Norway',
|
588 |
+
'OM' => 'Oman',
|
589 |
+
'PK' => 'Pakistan',
|
590 |
+
'PS' => 'Palestinian Territory',
|
591 |
+
'PA' => 'Panama',
|
592 |
+
'PG' => 'Papua New Guinea',
|
593 |
+
'PY' => 'Paraguay',
|
594 |
+
'PE' => 'Peru',
|
595 |
+
'PH' => 'Philippines',
|
596 |
+
'PN' => 'Pitcairn',
|
597 |
+
'PL' => 'Poland',
|
598 |
+
'PT' => 'Portugal',
|
599 |
+
'PR' => 'Puerto Rico',
|
600 |
+
'QA' => 'Qatar',
|
601 |
+
'RE' => 'Reunion',
|
602 |
+
'RO' => 'Romania',
|
603 |
+
'RU' => 'Russia',
|
604 |
+
'RW' => 'Rwanda',
|
605 |
+
'BL' => 'Saint Barthélemy',
|
606 |
+
'SH' => 'Saint Helena',
|
607 |
+
'KN' => 'Saint Kitts and Nevis',
|
608 |
+
'LC' => 'Saint Lucia',
|
609 |
+
'SX' => 'Saint Martin (Dutch part)',
|
610 |
+
'MF' => 'Saint Martin (French part)',
|
611 |
+
'PM' => 'Saint Pierre and Miquelon',
|
612 |
+
'VC' => 'Saint Vincent and the Grenadines',
|
613 |
+
'WS' => 'Samoa',
|
614 |
+
'SM' => 'San Marino',
|
615 |
+
'ST' => 'São Tomé and Príncipe',
|
616 |
+
'SA' => 'Saudi Arabia',
|
617 |
+
'SN' => 'Senegal',
|
618 |
+
'RS' => 'Serbia',
|
619 |
+
'SC' => 'Seychelles',
|
620 |
+
'SL' => 'Sierra Leone',
|
621 |
+
'SG' => 'Singapore',
|
622 |
+
'SK' => 'Slovakia',
|
623 |
+
'SI' => 'Slovenia',
|
624 |
+
'SB' => 'Solomon Islands',
|
625 |
+
'SO' => 'Somalia',
|
626 |
+
'ZA' => 'South Africa',
|
627 |
+
'GS' => 'South Georgia/Sandwich Islands',
|
628 |
+
'KR' => 'South Korea',
|
629 |
+
'SS' => 'South Sudan',
|
630 |
+
'ES' => 'Spain',
|
631 |
+
'LK' => 'Sri Lanka',
|
632 |
+
'SD' => 'Sudan',
|
633 |
+
'SR' => 'Suriname',
|
634 |
+
'SJ' => 'Svalbard and Jan Mayen',
|
635 |
+
'SZ' => 'Swaziland',
|
636 |
+
'SE' => 'Sweden',
|
637 |
+
'CH' => 'Switzerland',
|
638 |
+
'SY' => 'Syria',
|
639 |
+
'TW' => 'Taiwan',
|
640 |
+
'TJ' => 'Tajikistan',
|
641 |
+
'TZ' => 'Tanzania',
|
642 |
+
'TH' => 'Thailand',
|
643 |
+
'TL' => 'Timor-Leste',
|
644 |
+
'TG' => 'Togo',
|
645 |
+
'TK' => 'Tokelau',
|
646 |
+
'TO' => 'Tonga',
|
647 |
+
'TT' => 'Trinidad and Tobago',
|
648 |
+
'TN' => 'Tunisia',
|
649 |
+
'TR' => 'Turkey',
|
650 |
+
'TM' => 'Turkmenistan',
|
651 |
+
'TC' => 'Turks and Caicos Islands',
|
652 |
+
'TV' => 'Tuvalu',
|
653 |
+
'UG' => 'Uganda',
|
654 |
+
'UA' => 'Ukraine',
|
655 |
+
'AE' => 'United Arab Emirates',
|
656 |
+
'GB' => 'United Kingdom (UK)',
|
657 |
+
'US' => 'United States (US)',
|
658 |
+
'UM' => 'United States (US) Minor Outlying Islands',
|
659 |
+
'UY' => 'Uruguay',
|
660 |
+
'UZ' => 'Uzbekistan',
|
661 |
+
'VU' => 'Vanuatu',
|
662 |
+
'VA' => 'Vatican',
|
663 |
+
'VE' => 'Venezuela',
|
664 |
+
'VN' => 'Vietnam',
|
665 |
+
'VG' => 'Virgin Islands (British)',
|
666 |
+
'VI' => 'Virgin Islands (US)',
|
667 |
+
'WF' => 'Wallis and Futuna',
|
668 |
+
'EH' => 'Western Sahara',
|
669 |
+
'YE' => 'Yemen',
|
670 |
+
'ZM' => 'Zambia',
|
671 |
+
'ZW' => 'Zimbabwe',
|
672 |
+
);
|
673 |
+
}
|
inc/helpers.php
CHANGED
@@ -1053,5 +1053,73 @@ function breeze_migrate_old_settings( $is_sigle = true, $subsite_id = 0, $is_roo
|
|
1053 |
}
|
1054 |
|
1055 |
function breeze_rtrim_urls( $url ) {
|
|
|
|
|
|
|
1056 |
return rtrim( $url, '/' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1057 |
}
|
1053 |
}
|
1054 |
|
1055 |
function breeze_rtrim_urls( $url ) {
|
1056 |
+
if(empty($url)){
|
1057 |
+
$url = '';
|
1058 |
+
}
|
1059 |
return rtrim( $url, '/' );
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
/**
|
1063 |
+
* Check the CDN url to see if it's safe to use.
|
1064 |
+
*
|
1065 |
+
* @param $cdn_url
|
1066 |
+
*
|
1067 |
+
* @return false|string
|
1068 |
+
* @since 2.0.11
|
1069 |
+
*/
|
1070 |
+
function breeze_static_check_cdn_url( $cdn_url ) {
|
1071 |
+
if ( empty( trim( $cdn_url ) ) ) {
|
1072 |
+
return false;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
$breeze_user_agent = 'breeze-cdn-check-help-user';
|
1076 |
+
|
1077 |
+
$verify_host = 2;
|
1078 |
+
$ssl_verification = apply_filters( 'breeze_ssl_check_certificate', true );
|
1079 |
+
if ( ! is_bool( $ssl_verification ) ) {
|
1080 |
+
$ssl_verification = true;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
|
1084 |
+
$ssl_verification = false;
|
1085 |
+
$verify_host = 0;
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
|
1089 |
+
$cdn_url = ltrim( $cdn_url, 'https:' );
|
1090 |
+
$cdn_url = 'https:' . $cdn_url;
|
1091 |
+
|
1092 |
+
if ( false === filter_var( $cdn_url, FILTER_VALIDATE_URL ) ) {
|
1093 |
+
return false;
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
$connection = curl_init( 'https://sitecheck.sucuri.net/api/v3/?scan=' . $cdn_url );
|
1097 |
+
curl_setopt( $connection, CURLOPT_RETURNTRANSFER, true );
|
1098 |
+
curl_setopt( $connection, CURLOPT_SSL_VERIFYHOST, $verify_host );
|
1099 |
+
curl_setopt( $connection, CURLOPT_SSL_VERIFYPEER, $ssl_verification );
|
1100 |
+
curl_setopt( $connection, CURLOPT_USERAGENT, $breeze_user_agent );
|
1101 |
+
curl_setopt( $connection, CURLOPT_REFERER, home_url() );
|
1102 |
+
|
1103 |
+
/**
|
1104 |
+
* Accept up to 3 maximum redirects before cutting the connection.
|
1105 |
+
*/
|
1106 |
+
curl_setopt( $connection, CURLOPT_MAXREDIRS, 3 );
|
1107 |
+
curl_setopt( $connection, CURLOPT_FOLLOWLOCATION, true );
|
1108 |
+
$the_json = curl_exec( $connection );
|
1109 |
+
curl_close( $connection );
|
1110 |
+
|
1111 |
+
$is_json = json_decode( $the_json, true );
|
1112 |
+
if ( $is_json === null && json_last_error() !== JSON_ERROR_NONE ) {
|
1113 |
+
// incorrect data show error message
|
1114 |
+
$is_safe = false;
|
1115 |
+
} else {
|
1116 |
+
// decoded with success
|
1117 |
+
$is_safe = false;
|
1118 |
+
if ( isset( $is_json['warnings'], $is_json['warnings']['security'], $is_json['warnings']['security']['malware'] ) ) {
|
1119 |
+
$is_safe = 'warning';
|
1120 |
+
|
1121 |
+
}
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
return $is_safe;
|
1125 |
}
|
inc/minification/breeze-js-deferred-loading.php
CHANGED
@@ -334,6 +334,10 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
334 |
continue;
|
335 |
}
|
336 |
|
|
|
|
|
|
|
|
|
337 |
$path = $this->getpath( $url );
|
338 |
|
339 |
if ( true === $this->is_inline_delay_on ) {
|
@@ -624,6 +628,12 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
624 |
}
|
625 |
$js_replacement = '';
|
626 |
$js_replacement .= implode( '', $js_head );
|
|
|
|
|
|
|
|
|
|
|
|
|
627 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
628 |
}
|
629 |
|
@@ -654,6 +664,11 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
654 |
}
|
655 |
$js_replacement = '';
|
656 |
$js_replacement .= implode( '', $js_footer );
|
|
|
|
|
|
|
|
|
|
|
657 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
658 |
}
|
659 |
|
@@ -764,6 +779,14 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
764 |
|
765 |
$js_replacement = '';
|
766 |
$js_replacement .= implode( '', $js_head );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
767 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
768 |
}
|
769 |
|
@@ -815,6 +838,12 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
815 |
}
|
816 |
$js_replacement = '';
|
817 |
$js_replacement .= implode( '', $js_footer );
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
819 |
}
|
820 |
|
@@ -1018,6 +1047,9 @@ class Breeze_Js_Deferred_Loading extends Breeze_MinificationBase {
|
|
1018 |
if ( ! empty( $cdn_url ) ) {
|
1019 |
// secondly prepend domain-less absolute URL's
|
1020 |
if ( ( substr( $url, 0, 1 ) === '/' ) && ( substr( $url, 1, 1 ) !== '/' ) ) {
|
|
|
|
|
|
|
1021 |
$url = rtrim( $cdn_url, '/' ) . $url;
|
1022 |
} else {
|
1023 |
// get WordPress base URL
|
334 |
continue;
|
335 |
}
|
336 |
|
337 |
+
if ( false !== strpos( $tag, '.php' ) ) {
|
338 |
+
continue;
|
339 |
+
}
|
340 |
+
|
341 |
$path = $this->getpath( $url );
|
342 |
|
343 |
if ( true === $this->is_inline_delay_on ) {
|
628 |
}
|
629 |
$js_replacement = '';
|
630 |
$js_replacement .= implode( '', $js_head );
|
631 |
+
|
632 |
+
if ( ! empty( $this->move['first'] ) ) {
|
633 |
+
$js_replacement_first = implode( '', $this->move['first'] );
|
634 |
+
$js_replacement .= $js_replacement_first;
|
635 |
+
}
|
636 |
+
|
637 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
638 |
}
|
639 |
|
664 |
}
|
665 |
$js_replacement = '';
|
666 |
$js_replacement .= implode( '', $js_footer );
|
667 |
+
|
668 |
+
if ( ! empty( $this->move['last'] ) ) {
|
669 |
+
$js_replacement .= implode( '', $this->move['last'] );
|
670 |
+
}
|
671 |
+
|
672 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
673 |
}
|
674 |
|
779 |
|
780 |
$js_replacement = '';
|
781 |
$js_replacement .= implode( '', $js_head );
|
782 |
+
|
783 |
+
|
784 |
+
if ( ! empty( $this->move['first'] ) ) {
|
785 |
+
$js_replacement_first = implode( '', $this->move['first'] );
|
786 |
+
$js_replacement .= $js_replacement_first;
|
787 |
+
}
|
788 |
+
|
789 |
+
|
790 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
791 |
}
|
792 |
|
838 |
}
|
839 |
$js_replacement = '';
|
840 |
$js_replacement .= implode( '', $js_footer );
|
841 |
+
|
842 |
+
if ( ! empty( $this->move['last'] ) ) {
|
843 |
+
$js_replacement .= implode( '', $this->move['last'] );
|
844 |
+
}
|
845 |
+
|
846 |
+
|
847 |
$this->inject_in_html( $js_replacement, $replaceTag );
|
848 |
}
|
849 |
|
1047 |
if ( ! empty( $cdn_url ) ) {
|
1048 |
// secondly prepend domain-less absolute URL's
|
1049 |
if ( ( substr( $url, 0, 1 ) === '/' ) && ( substr( $url, 1, 1 ) !== '/' ) ) {
|
1050 |
+
if ( ! is_string( $cdn_url ) ) {
|
1051 |
+
$cdn_url = '';
|
1052 |
+
}
|
1053 |
$url = rtrim( $cdn_url, '/' ) . $url;
|
1054 |
} else {
|
1055 |
// get WordPress base URL
|
inc/minification/breeze-minification-scripts.php
CHANGED
@@ -332,6 +332,10 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
332 |
continue;
|
333 |
}
|
334 |
|
|
|
|
|
|
|
|
|
335 |
$path = $this->getpath( $url );
|
336 |
|
337 |
if ( $path !== false && preg_match( '#\.js$#', $path ) ) {
|
@@ -525,6 +529,9 @@ class Breeze_MinificationScripts extends Breeze_MinificationBase {
|
|
525 |
|
526 |
$scriptsrc = file_get_contents( $script );
|
527 |
$scriptsrc = preg_replace( '/\x{EF}\x{BB}\x{BF}/', '', $scriptsrc );
|
|
|
|
|
|
|
528 |
$scriptsrc = rtrim( $scriptsrc, ";\n\t\r" ) . ';';
|
529 |
|
530 |
//Add try-catch?
|
332 |
continue;
|
333 |
}
|
334 |
|
335 |
+
if ( false !== strpos( $tag, '.php' ) ) {
|
336 |
+
continue;
|
337 |
+
}
|
338 |
+
|
339 |
$path = $this->getpath( $url );
|
340 |
|
341 |
if ( $path !== false && preg_match( '#\.js$#', $path ) ) {
|
529 |
|
530 |
$scriptsrc = file_get_contents( $script );
|
531 |
$scriptsrc = preg_replace( '/\x{EF}\x{BB}\x{BF}/', '', $scriptsrc );
|
532 |
+
if(empty($scriptsrc)){
|
533 |
+
$scriptsrc = '';
|
534 |
+
}
|
535 |
$scriptsrc = rtrim( $scriptsrc, ";\n\t\r" ) . ';';
|
536 |
|
537 |
//Add try-catch?
|
inc/minification/breeze-minify-main.php
CHANGED
@@ -345,6 +345,10 @@ class Breeze_Minify {
|
|
345 |
* Remove '/' chacracter of end url
|
346 |
*/
|
347 |
public function rtrim_urls( $url ) {
|
|
|
|
|
|
|
|
|
348 |
return rtrim( $url, '/' );
|
349 |
}
|
350 |
|
345 |
* Remove '/' chacracter of end url
|
346 |
*/
|
347 |
public function rtrim_urls( $url ) {
|
348 |
+
if ( ! is_string( $url ) ) {
|
349 |
+
$url = '';
|
350 |
+
}
|
351 |
+
|
352 |
return rtrim( $url, '/' );
|
353 |
}
|
354 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: Cloudways
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 5.9
|
5 |
-
Tested up to: 6.
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -144,6 +144,15 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
|
|
144 |
|
145 |
== Changelog ==
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
= 2.0.10=
|
148 |
|
149 |
* Add: More options added in the Database option tab.
|
2 |
Contributors: Cloudways
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 5.9
|
5 |
+
Tested up to: 6.1
|
6 |
+
Stable tag: 2.0.11
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
144 |
|
145 |
== Changelog ==
|
146 |
|
147 |
+
= 2.0.11=
|
148 |
+
|
149 |
+
* Add: Scanning of CDN URL to verify it is not malicious in the CDN.
|
150 |
+
* Fix: Improvised process of generating JS files from PHP files.
|
151 |
+
* Fix: Improvised handling of multi-byte characters, languages, symbols such as Unicode icons, etc.
|
152 |
+
* Fix: Improvised the functionality of the Defer option while using an external JS file.
|
153 |
+
* Fix: Enhanced the compatibility with Weglot Translate.
|
154 |
+
|
155 |
+
|
156 |
= 2.0.10=
|
157 |
|
158 |
* Add: More options added in the Database option tab.
|
views/option-tabs-loader.php
CHANGED
@@ -23,7 +23,7 @@ class Breeze_Tab_Loader {
|
|
23 |
'heartbeat',
|
24 |
);
|
25 |
|
26 |
-
$requested_tab = $_GET['request_tab'];
|
27 |
|
28 |
if ( ! in_array( $requested_tab, $accepted_tabs, true ) || true === breeze_is_restricted_access( true ) ) {
|
29 |
die( '<h3>The requested tab does not exist</h3>' );
|
@@ -34,7 +34,7 @@ class Breeze_Tab_Loader {
|
|
34 |
ob_end_clean();
|
35 |
|
36 |
echo $html_tab_data;
|
37 |
-
|
38 |
}
|
39 |
}
|
40 |
|
23 |
'heartbeat',
|
24 |
);
|
25 |
|
26 |
+
$requested_tab = ( isset( $_GET['request_tab'] ) ? $_GET['request_tab'] : 'basic' );
|
27 |
|
28 |
if ( ! in_array( $requested_tab, $accepted_tabs, true ) || true === breeze_is_restricted_access( true ) ) {
|
29 |
die( '<h3>The requested tab does not exist</h3>' );
|
34 |
ob_end_clean();
|
35 |
|
36 |
echo $html_tab_data;
|
37 |
+
wp_die();
|
38 |
}
|
39 |
}
|
40 |
|
views/option-tabs/cdn-tab.php
CHANGED
@@ -79,6 +79,21 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/cdn-active.png';
|
|
79 |
$cdn_url = ( isset( $options['cdn-url'] ) ) ? esc_html( $options['cdn-url'] ) : '';
|
80 |
$cdn_url_validation = breeze_validate_url_via_regexp( $cdn_url );
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
?>
|
83 |
<input type="text" id="cdn-url" name="cdn-url" size="50" placeholder="<?php _e( 'https://www.domain.com', 'breeze' ); ?>" value="<?php echo $cdn_url; ?>"/>
|
84 |
<div class="br-note">
|
@@ -87,6 +102,9 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/cdn-active.png';
|
|
87 |
|
88 |
_e( 'Use double slash ‘//’ at the start of CDN CNAME, if you have some pages on HTTP and some are on HTTPS.', 'breeze' );
|
89 |
?>
|
|
|
|
|
|
|
90 |
</p>
|
91 |
<?php if ( false === $cdn_url_validation && ! empty( $cdn_url ) ) { ?>
|
92 |
<p class="br-notice">
|
79 |
$cdn_url = ( isset( $options['cdn-url'] ) ) ? esc_html( $options['cdn-url'] ) : '';
|
80 |
$cdn_url_validation = breeze_validate_url_via_regexp( $cdn_url );
|
81 |
|
82 |
+
$error_message_cdn = '';
|
83 |
+
if ( ! empty( $cdn_url ) && true === $cdn_url_validation ) {
|
84 |
+
$is_warning = breeze_static_check_cdn_url( $cdn_url );
|
85 |
+
if ( 'warning' === $is_warning ) {
|
86 |
+
$error_message_cdn = '<strong>' . __( 'Important: ', 'breeze' ) . '</strong>';
|
87 |
+
$error_message_cdn .= __( 'The CDN URL you\'ve used is insecure.', 'breeze' );
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
$display_error_cdn = 'none';
|
93 |
+
if(!empty($error_message_cdn)){
|
94 |
+
$display_error_cdn = 'block';
|
95 |
+
}
|
96 |
+
|
97 |
?>
|
98 |
<input type="text" id="cdn-url" name="cdn-url" size="50" placeholder="<?php _e( 'https://www.domain.com', 'breeze' ); ?>" value="<?php echo $cdn_url; ?>"/>
|
99 |
<div class="br-note">
|
102 |
|
103 |
_e( 'Use double slash ‘//’ at the start of CDN CNAME, if you have some pages on HTTP and some are on HTTPS.', 'breeze' );
|
104 |
?>
|
105 |
+
</p>
|
106 |
+
<p class="br-important" id="cdn-message-error" style="display:<?php echo $display_error_cdn; ?>; margin-top: 20px;">
|
107 |
+
<?php echo $error_message_cdn;?>
|
108 |
</p>
|
109 |
<?php if ( false === $cdn_url_validation && ! empty( $cdn_url ) ) { ?>
|
110 |
<p class="br-notice">
|