Version Description
- Fix: Atarim - Client Interface Plugin conflict with UI of Breeze in the admin area.
- Add: Make LazyLoad for iframes compatible
- Add: Control WordPress Heartbeat API. Users can disable it, independently on the admin, post editor page, and frontend.
- Add: DNS prefetch on pages.
- Add: Improve the handling of warning message while permission is not correct.
Download this release
Release Info
Developer | adeelkhan |
Plugin | Breeze – WordPress Cache Plugin |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- assets/images/heartbeat-active.png +0 -0
- assets/images/heartbeat.png +0 -0
- assets/js/breeze-main.js +59 -18
- assets/js/breeze-main.min.js +2 -2
- assets/js/js-front-end/breeze-lazy-load.min.js +1 -1
- assets/js/js-front-end/breeze-prefetch-links.min.js +1 -1
- breeze.php +7 -2
- inc/breeze-admin.php +54 -16
- inc/breeze-configuration.php +75 -12
- inc/cache/config-cache.php +19 -18
- inc/cache/execute-cache.php +0 -1
- inc/cache/purge-per-time.php +2 -2
- inc/cache/purge-varnish.php +3 -3
- inc/class-breeze-dns-prefetch.php +60 -0
- inc/class-breeze-file-permissions.php +44 -5
- inc/class-breeze-heartbeat-settings.php +196 -0
- inc/class-breeze-lazy-load.php +80 -3
- inc/class-breeze-options-reader.php +1 -0
- inc/class-breeze-prefetch.php +2 -1
- inc/class-exclude-pages-by-shortcode.php +1 -1
- inc/helpers.php +4 -0
- inc/wp-cli/class-breeze-cli-helpers.php +1 -1
- inc/wp-cli/class-breeze-settings-import-export.php +60 -23
- readme.txt +10 -2
- views/breeze-setting-views.php +5 -0
- views/option-tabs-loader.php +1 -0
- views/option-tabs/basic-tab.php +32 -8
- views/option-tabs/heartbeat-tab.php +207 -0
- views/option-tabs/preload-tab.php +45 -0
assets/images/heartbeat-active.png
ADDED
Binary file
|
assets/images/heartbeat.png
ADDED
Binary file
|
assets/js/breeze-main.js
CHANGED
@@ -207,12 +207,16 @@ jQuery( document ).ready(
|
|
207 |
'#bz-lazy-load',
|
208 |
function () {
|
209 |
|
210 |
-
var native_lazy
|
|
|
211 |
if ( true === $( this ).is( ':checked' ) ) {
|
212 |
native_lazy.show();
|
|
|
213 |
} else {
|
214 |
native_lazy.hide();
|
|
|
215 |
$( '#bz-lazy-load-nat' ).attr( 'checked', false );
|
|
|
216 |
}
|
217 |
}
|
218 |
);
|
@@ -759,6 +763,7 @@ jQuery( document ).ready(
|
|
759 |
1000
|
760 |
);
|
761 |
|
|
|
762 |
$( window ).on(
|
763 |
'resize',
|
764 |
function () {
|
@@ -769,7 +774,7 @@ jQuery( document ).ready(
|
|
769 |
}
|
770 |
);
|
771 |
|
772 |
-
var loader_spinner
|
773 |
var loader_spinner_save = '<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>';
|
774 |
|
775 |
$( '.breeze-box .br-link' ).on(
|
@@ -778,9 +783,9 @@ jQuery( document ).ready(
|
|
778 |
function ( e ) {
|
779 |
e.preventDefault();
|
780 |
var requested_tab = this.dataset.tabId;
|
781 |
-
var $html_area
|
782 |
-
active_tab
|
783 |
-
if ( !
|
784 |
active_tab = 'basic';
|
785 |
}
|
786 |
|
@@ -788,8 +793,8 @@ jQuery( document ).ready(
|
|
788 |
$( '.br-link' ).each(
|
789 |
function ( index, element ) {
|
790 |
// element == this
|
791 |
-
var $the_slug
|
792 |
-
var $image
|
793 |
var $image_path = $image.get( 0 ).dataset.path;
|
794 |
$image.attr( 'src', $image_path + $the_slug + '.png' );
|
795 |
}
|
@@ -797,7 +802,7 @@ jQuery( document ).ready(
|
|
797 |
|
798 |
var this_line = $( this ).closest( '.br-link' );
|
799 |
this_line.addClass( 'br-active' );
|
800 |
-
var $image
|
801 |
var $image_path = $image.get( 0 ).dataset.path;
|
802 |
$image.attr( 'src', $image_path + requested_tab + '-active.png' );
|
803 |
$html_area.html( loader_spinner );
|
@@ -822,6 +827,7 @@ jQuery( document ).ready(
|
|
822 |
},
|
823 |
// called when the request finishes (after success and error callbacks are executed)
|
824 |
complete: function ( jqXHR, textStatus ) {
|
|
|
825 |
document.cookie = 'breeze_active_tab=' + requested_tab;
|
826 |
if ( 'faq' === requested_tab ) {
|
827 |
$( '#faq-content' ).accordion(
|
@@ -840,9 +846,44 @@ jQuery( document ).ready(
|
|
840 |
}
|
841 |
);
|
842 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
843 |
function get_cookie( cname ) {
|
844 |
var name = cname + "=";
|
845 |
-
var ca
|
846 |
for ( var i = 0; i < ca.length; i++ ) {
|
847 |
var c = ca[ i ];
|
848 |
while ( c.charAt( 0 ) == ' ' ) {
|
@@ -863,7 +904,7 @@ jQuery( document ).ready(
|
|
863 |
} else {
|
864 |
|
865 |
if ( typeof active_tab !== 'undefined' && '' !== active_tab ) {
|
866 |
-
if ('import_export' === active_tab) {
|
867 |
active_tab = 'basic';
|
868 |
}
|
869 |
var link_target = $( '#tab-' + active_tab );
|
@@ -971,8 +1012,8 @@ jQuery( document ).ready(
|
|
971 |
'.do_clean_action',
|
972 |
function ( e ) {
|
973 |
e.preventDefault();
|
974 |
-
var action_type
|
975 |
-
var section
|
976 |
var section_title = section.get( 0 ).dataset.sectionTitle;
|
977 |
|
978 |
var confirm_action = confirm( 'Confirm the action to clean ' + section_title );
|
@@ -1012,7 +1053,7 @@ jQuery( document ).ready(
|
|
1012 |
'change',
|
1013 |
'#br-clean-all',
|
1014 |
function ( e ) {
|
1015 |
-
var is_selected
|
1016 |
var the_action_button = $( '#br-clean-all-cta' );
|
1017 |
|
1018 |
if ( true === is_selected ) {
|
@@ -1089,10 +1130,10 @@ jQuery( document ).ready(
|
|
1089 |
function ( e ) {
|
1090 |
e.preventDefault();
|
1091 |
|
1092 |
-
var $form
|
1093 |
var tab_is = $form.get( 0 ).dataset.section;
|
1094 |
|
1095 |
-
var data_send
|
1096 |
'action': 'save_settings_tab_' + tab_is,
|
1097 |
'security': breeze_token_name.breeze_save_options,
|
1098 |
'form-data': $form.serialize(),
|
@@ -1126,9 +1167,9 @@ jQuery( document ).ready(
|
|
1126 |
'#inherit-settings',
|
1127 |
function () {
|
1128 |
var is_selected = $( this ).is( ':checked' );
|
1129 |
-
var is_network
|
1130 |
-
var is_custom
|
1131 |
-
var tab_is
|
1132 |
|
1133 |
var nonce_is = $( this ).closest( 'div.change-settings-use' ).find( 'input#breeze_inherit_settings_nonce' ).val();
|
1134 |
|
207 |
'#bz-lazy-load',
|
208 |
function () {
|
209 |
|
210 |
+
var native_lazy = $( '#native-lazy-option' );
|
211 |
+
var native_lazy_iframes = $( '#native-lazy-option-iframe' );
|
212 |
if ( true === $( this ).is( ':checked' ) ) {
|
213 |
native_lazy.show();
|
214 |
+
native_lazy_iframes.show();
|
215 |
} else {
|
216 |
native_lazy.hide();
|
217 |
+
native_lazy_iframes.hide();
|
218 |
$( '#bz-lazy-load-nat' ).attr( 'checked', false );
|
219 |
+
$( '#bz-lazy-load-iframe' ).attr( 'checked', false );
|
220 |
}
|
221 |
}
|
222 |
);
|
763 |
1000
|
764 |
);
|
765 |
|
766 |
+
|
767 |
$( window ).on(
|
768 |
'resize',
|
769 |
function () {
|
774 |
}
|
775 |
);
|
776 |
|
777 |
+
var loader_spinner = '<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>';
|
778 |
var loader_spinner_save = '<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>';
|
779 |
|
780 |
$( '.breeze-box .br-link' ).on(
|
783 |
function ( e ) {
|
784 |
e.preventDefault();
|
785 |
var requested_tab = this.dataset.tabId;
|
786 |
+
var $html_area = $( '.br-options' );
|
787 |
+
active_tab = get_cookie( 'breeze_active_tab' );
|
788 |
+
if ( !active_tab ) {
|
789 |
active_tab = 'basic';
|
790 |
}
|
791 |
|
793 |
$( '.br-link' ).each(
|
794 |
function ( index, element ) {
|
795 |
// element == this
|
796 |
+
var $the_slug = element.dataset.breezeLink;
|
797 |
+
var $image = $( this ).find( 'img' );
|
798 |
var $image_path = $image.get( 0 ).dataset.path;
|
799 |
$image.attr( 'src', $image_path + $the_slug + '.png' );
|
800 |
}
|
802 |
|
803 |
var this_line = $( this ).closest( '.br-link' );
|
804 |
this_line.addClass( 'br-active' );
|
805 |
+
var $image = this_line.find( 'img' );
|
806 |
var $image_path = $image.get( 0 ).dataset.path;
|
807 |
$image.attr( 'src', $image_path + requested_tab + '-active.png' );
|
808 |
$html_area.html( loader_spinner );
|
827 |
},
|
828 |
// called when the request finishes (after success and error callbacks are executed)
|
829 |
complete: function ( jqXHR, textStatus ) {
|
830 |
+
breeze_permission_check();
|
831 |
document.cookie = 'breeze_active_tab=' + requested_tab;
|
832 |
if ( 'faq' === requested_tab ) {
|
833 |
$( '#faq-content' ).accordion(
|
846 |
}
|
847 |
);
|
848 |
|
849 |
+
function breeze_permission_check() {
|
850 |
+
var existing_notice = $( '.breeze-per' );
|
851 |
+
|
852 |
+
if ( existing_notice.length ) {
|
853 |
+
existing_notice.empty();
|
854 |
+
existing_notice.append( '<p>Re-checking permissions, please wait...</p>' );
|
855 |
+
}
|
856 |
+
|
857 |
+
$.ajax( {
|
858 |
+
type: "GET",
|
859 |
+
url: ajaxurl,
|
860 |
+
data: { action: "breeze_file_permission_check", 'is-network': $( 'body' ).hasClass( 'network-admin' ) },
|
861 |
+
dataType: "html", // xml, html, script, json, jsonp, text
|
862 |
+
success: function ( data ) {
|
863 |
+
if ( '' === data ) {
|
864 |
+
existing_notice.remove();
|
865 |
+
} else {
|
866 |
+
if ( existing_notice.length ) {
|
867 |
+
$( data ).insertBefore( existing_notice );
|
868 |
+
existing_notice.remove();
|
869 |
+
}else{
|
870 |
+
$('#wpbody-content').prepend(data);
|
871 |
+
}
|
872 |
+
}
|
873 |
+
},
|
874 |
+
error: function ( jqXHR, textStatus, errorThrown ) {
|
875 |
+
|
876 |
+
},
|
877 |
+
// called when the request finishes (after success and error callbacks are executed)
|
878 |
+
complete: function ( jqXHR, textStatus ) {
|
879 |
+
|
880 |
+
}
|
881 |
+
} );
|
882 |
+
}
|
883 |
+
|
884 |
function get_cookie( cname ) {
|
885 |
var name = cname + "=";
|
886 |
+
var ca = document.cookie.split( ';' );
|
887 |
for ( var i = 0; i < ca.length; i++ ) {
|
888 |
var c = ca[ i ];
|
889 |
while ( c.charAt( 0 ) == ' ' ) {
|
904 |
} else {
|
905 |
|
906 |
if ( typeof active_tab !== 'undefined' && '' !== active_tab ) {
|
907 |
+
if ( 'import_export' === active_tab ) {
|
908 |
active_tab = 'basic';
|
909 |
}
|
910 |
var link_target = $( '#tab-' + active_tab );
|
1012 |
'.do_clean_action',
|
1013 |
function ( e ) {
|
1014 |
e.preventDefault();
|
1015 |
+
var action_type = this.dataset.section;
|
1016 |
+
var section = $( this ).closest( 'div.br-db-item' );
|
1017 |
var section_title = section.get( 0 ).dataset.sectionTitle;
|
1018 |
|
1019 |
var confirm_action = confirm( 'Confirm the action to clean ' + section_title );
|
1053 |
'change',
|
1054 |
'#br-clean-all',
|
1055 |
function ( e ) {
|
1056 |
+
var is_selected = $( this ).is( ':checked' );
|
1057 |
var the_action_button = $( '#br-clean-all-cta' );
|
1058 |
|
1059 |
if ( true === is_selected ) {
|
1130 |
function ( e ) {
|
1131 |
e.preventDefault();
|
1132 |
|
1133 |
+
var $form = $( this ).closest( 'form' );
|
1134 |
var tab_is = $form.get( 0 ).dataset.section;
|
1135 |
|
1136 |
+
var data_send = {
|
1137 |
'action': 'save_settings_tab_' + tab_is,
|
1138 |
'security': breeze_token_name.breeze_save_options,
|
1139 |
'form-data': $form.serialize(),
|
1167 |
'#inherit-settings',
|
1168 |
function () {
|
1169 |
var is_selected = $( this ).is( ':checked' );
|
1170 |
+
var is_network = '.br-is-network';
|
1171 |
+
var is_custom = '.br-is-custom';
|
1172 |
+
var tab_is = 'inherit';
|
1173 |
|
1174 |
var nonce_is = $( this ).closest( 'div.change-settings-use' ).find( 'input#breeze_inherit_settings_nonce' ).val();
|
1175 |
|
assets/js/breeze-main.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
|
4 |
-
jQuery(document).ready(function(n){var e=n(".breeze-box");n("#breeze-plugins-notice").length&&n(document).on("click tap",".notice-dismiss",function(){n.ajax({type:"POST",url:ajaxurl,data:{action:"compatibility_warning_close",breeze_close_warning:"1"},dataType:"json",success:function(e){},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("click","#wp-admin-bar-breeze-purge-varnish-group",function(e){e.preventDefault(),a()}),n(document).on("click","#wp-admin-bar-breeze-purge-file-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_file",security:breeze_token_name.breeze_purge_cache},success:function(e){current=location.href;var t=e=parseFloat(e);window.location.href=current+"#breeze-msg=success-cleancache&file="+e,div=0<t?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged: '+t+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody #wpbody-content").prepend(div)}})});var t=!0;function a(){n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_varnish",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_varnish},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Varnish Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}n(".breeze-box").on("click","#purge-varnish-button",function(e){e.preventDefault(),!0===t&&(t=!1,n(this).addClass("br-is-disabled"),a())});var i,s,r,o=location.href,c=parseFloat((i="file",s=(s=o)||window.location.href,i=i.replace(/[\[\]]/g,"\\$&"),(s=new RegExp("[?&]"+i+"(=([^&#]*)|&|#|$)").exec(s))?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null));n(window).on("load",function(){var e,t;/wp-admin/i.test(o)&&(e="",0<o.indexOf("msg=success-cleancache")&&!isNaN(c)&&(e=0<c?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: '+c+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody .wrap h1").after(e),t=o.split("breeze-msg"),setTimeout(function(){window.location=t[0]},2e3)))}),n("#breeze-hide-install-msg").unbind("click").click(function(){n(this).closest("div.notice").fadeOut()}),-1!==(r=location.search).indexOf("breeze_purge=1")&&-1!==r.indexOf("_wpnonce")&&((r=new URLSearchParams(location.search)).delete("breeze_purge"),r.delete("_wpnonce"),history.replaceState(null,"","?"+r+location.hash)),e.on("change","#bz-lazy-load",function(){var e=n("#native-lazy-option");!0===n(this).is(":checked")?e.show():(e.hide(),n("#bz-lazy-load-nat").attr("checked",!1))}),e.on("change","#minification-css",function(){var e=n("#font-display-swap"),t=n("#font-display"),a=n("#include-inline-css"),i=n("#group-css");n(this).is(":checked")?(e.show(),a.removeAttr("disabled"),i.removeAttr("disabled")):(e.hide(),t.removeAttr("checked"),a.removeAttr("checked").attr("disabled","disabled"),i.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js");n(this).is(":checked")?(e.removeAttr("disabled"),t.removeAttr("disabled")):(e.removeAttr("checked").attr("disabled","disabled"),t.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#enable-js-delay",function(){$delay_js_div=n("#breeze-delay-js-scripts-div"),n(this).is(":checked")?$delay_js_div.show():$delay_js_div.hide()})});var $valid_json=!1;jQuery(document).ready(function(r){var e=r(".breeze-box");function o(){e.on("click","span.item-remove",function(){var e=r(this).closest(".breeze-input-group");e.fadeOut(300,function(){e.remove(),l()})})}function c(){r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:l})}function d(){r(".sort-handle span").unbind("click").click(function(e){var t=r(this).parents(".breeze-input-group");r(this).hasClass("moveUp")?t.insertBefore(t.prev()):t.insertAfter(t.next()),l()})}function l(){var e=r(".breeze-list-url");e.find(".breeze-input-group").find(".sort-handle").find("span").removeClass("blur"),e.find(".breeze-input-group:first-child").find(".moveUp").addClass("blur"),e.find(".breeze-input-group:last-child").find(".moveDown").addClass("blur")}r('input[name="all_control"]').click(function(){1==r(this).is(":checked")?r(".clean-data").prop("checked",!0):r(".clean-data").prop("checked",!1)}),r(".clean-data").click(function(){0==r(this).is(":checked")&&r('input[name="all_control"]').prop("checked",!1)}),o(),c(),d(),l(),e.on("keyup change blur",".breeze-input-url",function(){var e=r(this).val();""!==e&&(!0==!!/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/.test(e)?r(this).removeClass("is-invalid-url"):r(this).addClass("is-invalid-url"))}),e.on("click","button.add-url",function(){var e=-1<r(this).attr("id").indexOf("defer"),t=-1<r(this).attr("id").indexOf("preload-fonts"),a=r(this).closest("div.br-option").find(".breeze-list-url"),i="",n=a.find(".breeze-input-group"),s=!1;if(n.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(s=!0)}),s)return!1;i+='<div class="breeze-input-group">',i+=' <input type="text" size="98"',i+='class="breeze-input-url"',i+=t?'name="breeze-preload-font[]"':e?'name="defer-js[]"':'name="move-to-footer-js[]"',i+='placeholder="Enter URL..."',i+='value="" />',i+=' <span class="sort-handle">',i+=' <span class="dashicons dashicons-arrow-up moveUp"></span>',i+=' <span class="dashicons dashicons-arrow-down moveDown"></span>',i+=" </span>",i+=' <span class="dashicons dashicons-no item-remove" title="Remove"></span>',a.append(i+="</div>"),o(),c(),d(),l()}),r("#breeze-tabs .nav-tab").click(function(e){e.preventDefault(),r("#breeze-tabs .nav-tab").removeClass("active"),r(e.target).addClass("active"),id_tab=r(this).data("tab-id"),r("#tab-"+id_tab).addClass("active"),r("#breeze-tabs-content .tab-pane").removeClass("active"),r("#tab-content-"+id_tab).addClass("active"),document.cookie="breeze_active_tab="+id_tab,"faq"===id_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),active_tab=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}("breeze_active_tab"),active_tab=active_tab||"basic","import_export"===active_tab&&(active_tab="basic"),0===r("#tab-"+active_tab).length?(firstTab=r("#breeze-tabs").find("a:first-child"),firstTab.length&&(tabType=firstTab.attr("id").replace("tab-",""),firstTab.addClass("active"),r("#tab-content-"+tabType).addClass("active"))):(r("#tab-"+active_tab).addClass("active"),r("#tab-content-"+active_tab).addClass("active")),"faq"===active_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var t,a=["faq"],i=!0,n=!1,s=r("#breeze-inherit-settings-toggle");function b(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",n=a[1].split(/[&;]/g),s=n.length;0<s--;)-1!==n[s].lastIndexOf(i,0)&&n.splice(s,1);return a[0]+(0<n.length?"?"+n.join("&"):"")}return e}s.length&&(r("input",s).on("change",function(){var t="1"==r(this).val();r("#breeze-tabs").toggleClass("tabs-hidden",t),r("#breeze-tabs-content").toggleClass("tabs-hidden",t),r("#breeze-tabs .nav-tab").each(function(){var e=r(this).data("tab-id");-1===r.inArray(e,a)&&(r(this).toggleClass("inactive",t),r("#breeze-tabs-content #tab-content-"+e).toggleClass("inactive",t))}),n=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);i&&n&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:s.serializeArray(),beforeSend:function(){s.addClass("loading")},complete:function(){s.removeClass("loading"),n=!1,t.submit()},success:function(){r("input:checked",s).parents(".radio-field").addClass("active").siblings().removeClass("active")}}))})),r("#breeze-database-optimize").on("click",function(e){i=!1}),r("#tab-content-database .submit input").on("click",function(e){r("#tab-content-database input[type=checkbox]").attr("checked",!1)}),window.history&&"function"==typeof window.history.pushState&&(t=b(window.location.href,"save-settings"),t=b(t,"database-cleanup"),window.history.pushState(null,null,t)),e.on("click tap","#breeze_export_settings",function(){$network=r("#breeze-level").val(),window.location=ajaxurl+"?action=breeze_export_json&network_level="+$network}),r("#breeze_import_btn").attr("disabled","disabled"),e.on("change","#breeze_import_settings",function(){var e=this.files[0],t=r("#file-selected"),a=r("#file-error"),i=r("#breeze_import_btn");t.html(e.name),"application/json"!==e.type?($valid_json=!1,t.removeClass("file_green file_red").addClass("file_red"),a.html("File must be JSON"),i.attr("disabled","disabled")):($valid_json=!0,t.removeClass("file_green file_red").addClass("file_green"),a.html(""),i.removeAttr("disabled")),r(".br-file-text").remove()}),e.on("click tap","#breeze_import_btn",function(){var e,t,a,i;!0===$valid_json&&(network=r("#breeze-level").val(),e=r("#breeze_import_settings").get(0).files[0],(t=new FormData).append("action","breeze_import_json"),t.append("network_level",network),t.append("breeze_import_file",e),a=r("#file-selected"),i=r("#file-error"),a.removeClass("file_green file_red").addClass("file_green"),a.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:t,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(a.removeClass("file_green file_red").addClass("file_green"),a.html(e.data),i.html(""),alert(e.data),window.location.reload(!0)):(a.removeClass("file_green file_red"),a.html(""),i.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(s){var n=[];setTimeout(function(){var e=s("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),s(window).on("resize",function(){632<=s(this).height()&&s(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}s(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var a=this.dataset.tabId,t=s(".br-options");o=(o=r("breeze_active_tab"))||"basic",s(".br-link").removeClass("br-active"),s(".br-link").each(function(e,t){var a=t.dataset.breezeLink,i=s(this).find("img"),t=i.get(0).dataset.path;i.attr("src",t+a+".png")});var i=s(this).closest(".br-link");i.addClass("br-active");e=i.find("img"),i=e.get(0).dataset.path;e.attr("src",i+a+"-active.png"),t.html('<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>'),!0===s(".br-mobile-menu").is(":visible")&&s(".br-link").fadeOut(),s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:a,"is-network":s("body").hasClass("network-admin")},contentType:"text/html; charset=UTF-8",dataType:"html",success:function(e){t.html(e)},error:function(e,t,a){},complete:function(e,t){document.cookie="breeze_active_tab="+a,"faq"===a&&s("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),n=[]}})});var e,o=r("breeze_active_tab");s("#tab-basic").closest("div.br-link").hasClass("br-hide")?s("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=s("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(t=s("#tab-basic")).length&&t.trigger("click");var t=s(".breeze-box");t.on("click",".br-db-item",function(){var e=this.dataset.section;if(s(this).hasClass("br-db-selected")){if(s(this).removeClass("br-db-selected"),n.length){for(var t=[],a=0;a<n.length;a++)e!==n[a]&&t.push(n[a]);n=t}}else s(this).addClass("br-db-selected"),n.push(e);var i=s("#optimize-selected-services");n.length?i.show():i.hide()}),t.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=n.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},n)),security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==s.inArray(a,n)&&(s(t).find("h3").find("span").removeClass("br-has").html("0"),s(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),s("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){n=[]}})}),t.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=s(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(s(this).addClass("opac"),s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){t.find("h3").find("span").removeClass("br-has").html("0"),alert("Data for "+a+" has been cleaned")},error:function(e,t,a){},complete:function(e,t){}}))}),t.on("change","#br-clean-all",function(e){var t=s(this).is(":checked"),a=s("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),t.on("click","#br-clean-all-cta",function(e){!1===s(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),s("div.br-db-item").each(function(e,t){s(t).find("h3").find("span").removeClass("br-has").html("0")});var t=s("#br-clean-all");t.is(":checked")&&t.trigger("click"),alert("Clean all process finished")},error:function(e,t,a){},complete:function(e,t){}})}),t.on("click",".br-mobile-menu",function(){s(".br-link").fadeToggle()}),t.on("click",".br-submit-save",function(e){e.preventDefault();var e=s(this).closest("form"),t=e.get(0).dataset.section,e={action:"save_settings_tab_"+t,security:breeze_token_name.breeze_save_options,"form-data":e.serialize(),"is-network":s("body").hasClass("network-admin")};s(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){s("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),s(document).on("change","#inherit-settings",function(){var a=s(this).is(":checked"),i=".br-is-network",n=".br-is-custom",e=s(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val();s(".br-overlay-disable").addClass("br-hide");e={action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":s("body").hasClass("network-admin")};s("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(s("#wpcontent")),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){s("#wpcontent").find("div.br-inherit-wait").remove(),!0===a?(s(i).removeClass("br-show").addClass("br-hide"),s(n).removeClass("br-hide").addClass("br-show"),s(".br-link").removeClass("br-hide"),s("#tab-basic").trigger("click")):(s(n).removeClass("br-show").addClass("br-hide"),s(i).removeClass("br-hide").addClass("br-show"),s(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&s(t).addClass("br-hide")}),s("#tab-faq").trigger("click"))}})}),s(document).on("click",".notice-dismiss",function(){var e=s(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
1 |
/*! Created by Cloudways
|
2 |
+
On 09-03-2022 */
|
3 |
|
4 |
+
jQuery(document).ready(function(n){var e=n(".breeze-box");n("#breeze-plugins-notice").length&&n(document).on("click tap",".notice-dismiss",function(){n.ajax({type:"POST",url:ajaxurl,data:{action:"compatibility_warning_close",breeze_close_warning:"1"},dataType:"json",success:function(e){},error:function(e,t,a){},complete:function(e,t){}})}),n(document).on("click","#wp-admin-bar-breeze-purge-varnish-group",function(e){e.preventDefault(),a()}),n(document).on("click","#wp-admin-bar-breeze-purge-file-group",function(e){e.preventDefault(),n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_file",security:breeze_token_name.breeze_purge_cache},success:function(e){current=location.href;var t=e=parseFloat(e);window.location.href=current+"#breeze-msg=success-cleancache&file="+e,div=0<t?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged: '+t+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody #wpbody-content").prepend(div)}})});var t=!0;function a(){n.ajax({url:ajaxurl,dataType:"json",method:"POST",data:{action:"breeze_purge_varnish",is_network:n("body").hasClass("network-admin"),security:breeze_token_name.breeze_purge_varnish},success:function(e){current=location.href,e.clear?(n("#wpbody #wpbody-content").prepend('<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;margin-left: 0;"><p><strong>Varnish Cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>'),setTimeout(function(){t=!0},2e3)):(window.location.href=current+"breeze-msg=purge-fail",t=!0,location.reload())}})}n(".breeze-box").on("click","#purge-varnish-button",function(e){e.preventDefault(),!0===t&&(t=!1,n(this).addClass("br-is-disabled"),a())});var i,s,r,o=location.href,c=parseFloat((i="file",s=(s=o)||window.location.href,i=i.replace(/[\[\]]/g,"\\$&"),(s=new RegExp("[?&]"+i+"(=([^&#]*)|&|#|$)").exec(s))?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null));n(window).on("load",function(){var e,t;/wp-admin/i.test(o)&&(e="",0<o.indexOf("msg=success-cleancache")&&!isNaN(c)&&(e=0<c?'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged: '+c+'Kb cleaned</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>':'<div id="message" class="notice notice-success is-dismissible breeze-notice" style="margin-top:10px; margin-bottom:10px;padding: 10px;"><p><strong>Internal cache has been purged.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',n("#wpbody .wrap h1").after(e),t=o.split("breeze-msg"),setTimeout(function(){window.location=t[0]},2e3)))}),n("#breeze-hide-install-msg").unbind("click").click(function(){n(this).closest("div.notice").fadeOut()}),-1!==(r=location.search).indexOf("breeze_purge=1")&&-1!==r.indexOf("_wpnonce")&&((r=new URLSearchParams(location.search)).delete("breeze_purge"),r.delete("_wpnonce"),history.replaceState(null,"","?"+r+location.hash)),e.on("change","#bz-lazy-load",function(){var e=n("#native-lazy-option"),t=n("#native-lazy-option-iframe");!0===n(this).is(":checked")?(e.show(),t.show()):(e.hide(),t.hide(),n("#bz-lazy-load-nat").attr("checked",!1),n("#bz-lazy-load-iframe").attr("checked",!1))}),e.on("change","#minification-css",function(){var e=n("#font-display-swap"),t=n("#font-display"),a=n("#include-inline-css"),i=n("#group-css");n(this).is(":checked")?(e.show(),a.removeAttr("disabled"),i.removeAttr("disabled")):(e.hide(),t.removeAttr("checked"),a.removeAttr("checked").attr("disabled","disabled"),i.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#minification-js",function(){var e=n("#include-inline-js"),t=n("#group-js");n(this).is(":checked")?(e.removeAttr("disabled"),t.removeAttr("disabled")):(e.removeAttr("checked").attr("disabled","disabled"),t.removeAttr("checked").attr("disabled","disabled"))}),e.on("change","#enable-js-delay",function(){$delay_js_div=n("#breeze-delay-js-scripts-div"),n(this).is(":checked")?$delay_js_div.show():$delay_js_div.hide()})});var $valid_json=!1;jQuery(document).ready(function(r){var e=r(".breeze-box");function o(){e.on("click","span.item-remove",function(){var e=r(this).closest(".breeze-input-group");e.fadeOut(300,function(){e.remove(),l()})})}function c(){r(".breeze-list-url").sortable({handle:r("span.sort-handle"),stop:l})}function d(){r(".sort-handle span").unbind("click").click(function(e){var t=r(this).parents(".breeze-input-group");r(this).hasClass("moveUp")?t.insertBefore(t.prev()):t.insertAfter(t.next()),l()})}function l(){var e=r(".breeze-list-url");e.find(".breeze-input-group").find(".sort-handle").find("span").removeClass("blur"),e.find(".breeze-input-group:first-child").find(".moveUp").addClass("blur"),e.find(".breeze-input-group:last-child").find(".moveDown").addClass("blur")}r('input[name="all_control"]').click(function(){1==r(this).is(":checked")?r(".clean-data").prop("checked",!0):r(".clean-data").prop("checked",!1)}),r(".clean-data").click(function(){0==r(this).is(":checked")&&r('input[name="all_control"]').prop("checked",!1)}),o(),c(),d(),l(),e.on("keyup change blur",".breeze-input-url",function(){var e=r(this).val();""!==e&&(!0==!!/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/.test(e)?r(this).removeClass("is-invalid-url"):r(this).addClass("is-invalid-url"))}),e.on("click","button.add-url",function(){var e=-1<r(this).attr("id").indexOf("defer"),t=-1<r(this).attr("id").indexOf("preload-fonts"),a=r(this).closest("div.br-option").find(".breeze-list-url"),i="",n=a.find(".breeze-input-group"),s=!1;if(n.each(function(){var e=r(this).find(".breeze-input-url");if(""===e.val().trim())return e.focus(),!(s=!0)}),s)return!1;i+='<div class="breeze-input-group">',i+=' <input type="text" size="98"',i+='class="breeze-input-url"',i+=t?'name="breeze-preload-font[]"':e?'name="defer-js[]"':'name="move-to-footer-js[]"',i+='placeholder="Enter URL..."',i+='value="" />',i+=' <span class="sort-handle">',i+=' <span class="dashicons dashicons-arrow-up moveUp"></span>',i+=' <span class="dashicons dashicons-arrow-down moveDown"></span>',i+=" </span>",i+=' <span class="dashicons dashicons-no item-remove" title="Remove"></span>',a.append(i+="</div>"),o(),c(),d(),l()}),r("#breeze-tabs .nav-tab").click(function(e){e.preventDefault(),r("#breeze-tabs .nav-tab").removeClass("active"),r(e.target).addClass("active"),id_tab=r(this).data("tab-id"),r("#tab-"+id_tab).addClass("active"),r("#breeze-tabs-content .tab-pane").removeClass("active"),r("#tab-content-"+id_tab).addClass("active"),document.cookie="breeze_active_tab="+id_tab,"faq"===id_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show()}),active_tab=function(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}("breeze_active_tab"),active_tab=active_tab||"basic","import_export"===active_tab&&(active_tab="basic"),0===r("#tab-"+active_tab).length?(firstTab=r("#breeze-tabs").find("a:first-child"),firstTab.length&&(tabType=firstTab.attr("id").replace("tab-",""),firstTab.addClass("active"),r("#tab-content-"+tabType).addClass("active"))):(r("#tab-"+active_tab).addClass("active"),r("#tab-content-"+active_tab).addClass("active")),"faq"===active_tab?(r("#breeze-and-cloudways").hide(),r("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"})):r("#breeze-and-cloudways").show();var t,a=["faq"],i=!0,n=!1,s=r("#breeze-inherit-settings-toggle");function b(e,t){var a=e.split("?");if(2<=a.length){for(var i=encodeURIComponent(t)+"=",n=a[1].split(/[&;]/g),s=n.length;0<s--;)-1!==n[s].lastIndexOf(i,0)&&n.splice(s,1);return a[0]+(0<n.length?"?"+n.join("&"):"")}return e}s.length&&(r("input",s).on("change",function(){var t="1"==r(this).val();r("#breeze-tabs").toggleClass("tabs-hidden",t),r("#breeze-tabs-content").toggleClass("tabs-hidden",t),r("#breeze-tabs .nav-tab").each(function(){var e=r(this).data("tab-id");-1===r.inArray(e,a)&&(r(this).toggleClass("inactive",t),r("#breeze-tabs-content #tab-content-"+e).toggleClass("inactive",t))}),n=!r(this).parents(".radio-field").hasClass("active")}),r("#breeze-tabs-content form").on("submit",function(e){var t=r(this);i&&n&&(e.preventDefault(),r.ajax({url:window.location,method:"post",data:s.serializeArray(),beforeSend:function(){s.addClass("loading")},complete:function(){s.removeClass("loading"),n=!1,t.submit()},success:function(){r("input:checked",s).parents(".radio-field").addClass("active").siblings().removeClass("active")}}))})),r("#breeze-database-optimize").on("click",function(e){i=!1}),r("#tab-content-database .submit input").on("click",function(e){r("#tab-content-database input[type=checkbox]").attr("checked",!1)}),window.history&&"function"==typeof window.history.pushState&&(t=b(window.location.href,"save-settings"),t=b(t,"database-cleanup"),window.history.pushState(null,null,t)),e.on("click tap","#breeze_export_settings",function(){$network=r("#breeze-level").val(),window.location=ajaxurl+"?action=breeze_export_json&network_level="+$network}),r("#breeze_import_btn").attr("disabled","disabled"),e.on("change","#breeze_import_settings",function(){var e=this.files[0],t=r("#file-selected"),a=r("#file-error"),i=r("#breeze_import_btn");t.html(e.name),"application/json"!==e.type?($valid_json=!1,t.removeClass("file_green file_red").addClass("file_red"),a.html("File must be JSON"),i.attr("disabled","disabled")):($valid_json=!0,t.removeClass("file_green file_red").addClass("file_green"),a.html(""),i.removeAttr("disabled")),r(".br-file-text").remove()}),e.on("click tap","#breeze_import_btn",function(){var e,t,a,i;!0===$valid_json&&(network=r("#breeze-level").val(),e=r("#breeze_import_settings").get(0).files[0],(t=new FormData).append("action","breeze_import_json"),t.append("network_level",network),t.append("breeze_import_file",e),a=r("#file-selected"),i=r("#file-error"),a.removeClass("file_green file_red").addClass("file_green"),a.html('<div class="br-loader-spinner import_settings"><div></div><div></div><div></div><div></div></div>'),r.ajax({type:"POST",url:ajaxurl,data:t,processData:!1,contentType:!1,enctype:"multipart/form-data",mimeType:"multipart/form-data",cache:!1,dataType:"json",success:function(e){1==e.success?(a.removeClass("file_green file_red").addClass("file_green"),a.html(e.data),i.html(""),alert(e.data),window.location.reload(!0)):(a.removeClass("file_green file_red"),a.html(""),i.html(e.data[0].message))},error:function(e,t,a){},complete:function(e,t){}}))})}),function(s){var n=[];setTimeout(function(){var e=s("#message-clear-cache-top");e.length&&(e.prependTo("#wpbody-content"),e.show())},1e3),s(window).on("resize",function(){632<=s(this).height()&&s(".br-link").removeAttr("style")});function r(e){for(var t=e+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var n=a[i];" "==n.charAt(0);)n=n.substring(1);if(0==n.indexOf(t))return n.substring(t.length,n.length)}return""}s(".breeze-box .br-link").on("click tap","a",function(e){e.preventDefault();var a=this.dataset.tabId,t=s(".br-options");o=(o=r("breeze_active_tab"))||"basic",s(".br-link").removeClass("br-active"),s(".br-link").each(function(e,t){var a=t.dataset.breezeLink,i=s(this).find("img"),t=i.get(0).dataset.path;i.attr("src",t+a+".png")});var i=s(this).closest(".br-link");i.addClass("br-active");e=i.find("img"),i=e.get(0).dataset.path;e.attr("src",i+a+"-active.png"),t.html('<div class="br-loader-spinner loading_tab"><div></div><div></div><div></div><div></div></div>'),!0===s(".br-mobile-menu").is(":visible")&&s(".br-link").fadeOut(),s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_load_options_tab",request_tab:a,"is-network":s("body").hasClass("network-admin")},contentType:"text/html; charset=UTF-8",dataType:"html",success:function(e){t.html(e)},error:function(e,t,a){},complete:function(e,t){!function(){var t=s(".breeze-per");t.length&&(t.empty(),t.append("<p>Re-checking permissions, please wait...</p>"));s.ajax({type:"GET",url:ajaxurl,data:{action:"breeze_file_permission_check","is-network":s("body").hasClass("network-admin")},dataType:"html",success:function(e){""===e?t.remove():t.length?(s(e).insertBefore(t),t.remove()):s("#wpbody-content").prepend(e)},error:function(e,t,a){},complete:function(e,t){}})}(),document.cookie="breeze_active_tab="+a,"faq"===a&&s("#faq-content").accordion({collapsible:!0,animate:200,header:".faq-question",heightStyle:"content"}),n=[]}})});var e,o=r("breeze_active_tab");s("#tab-basic").closest("div.br-link").hasClass("br-hide")?s("#tab-faq").trigger("click"):void 0!==o&&""!==o?(e=s("#tab-"+(o="import_export"===o?"basic":o))).length&&e.trigger("click"):(t=s("#tab-basic")).length&&t.trigger("click");var t=s(".breeze-box");t.on("click",".br-db-item",function(){var e=this.dataset.section;if(s(this).hasClass("br-db-selected")){if(s(this).removeClass("br-db-selected"),n.length){for(var t=[],a=0;a<n.length;a++)e!==n[a]&&t.push(n[a]);n=t}}else s(this).addClass("br-db-selected"),n.push(e);var i=s("#optimize-selected-services");n.length?i.show():i.hide()}),t.on("click","#optimize-selected-services",function(e){var t=!1;!1===(t=n.length?!0:t)?alert("Please select an options first"):confirm("Proceed to optimize the selected items?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"custom",services:JSON.stringify(Object.assign({},n)),security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s("div.br-db-item").each(function(e,t){var a=t.dataset.section;-1!==s.inArray(a,n)&&(s(t).find("h3").find("span").removeClass("br-has").html("0"),s(t).removeClass("br-db-selected"))}),alert("Optimization process finished"),s("#tab-database").trigger("click")},error:function(e,t,a){},complete:function(e,t){n=[]}})}),t.on("click",".do_clean_action",function(e){e.preventDefault();var e=this.dataset.section,t=s(this).closest("div.br-db-item"),a=t.get(0).dataset.sectionTitle;confirm("Confirm the action to clean "+a)&&(s(this).addClass("opac"),s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:e,security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){t.find("h3").find("span").removeClass("br-has").html("0"),alert("Data for "+a+" has been cleaned")},error:function(e,t,a){},complete:function(e,t){}}))}),t.on("change","#br-clean-all",function(e){var t=s(this).is(":checked"),a=s("#br-clean-all-cta");!0===t?a.removeAttr("disabled"):a.attr("disabled","disabled")}),t.on("click","#br-clean-all-cta",function(e){!1===s(this).is(":disabled")&&confirm("Proceed to clean all trashed posts and pages?")&&s.ajax({type:"POST",url:ajaxurl,data:{action:"breeze_purge_database",action_type:"all",security:breeze_token_name.breeze_purge_database,"is-network":s("body").hasClass("network-admin")},dataType:"JSON",success:function(e){s(".br-clean-label").find("span").removeClass("br-has").html("( 0 )"),s("div.br-db-item").each(function(e,t){s(t).find("h3").find("span").removeClass("br-has").html("0")});var t=s("#br-clean-all");t.is(":checked")&&t.trigger("click"),alert("Clean all process finished")},error:function(e,t,a){},complete:function(e,t){}})}),t.on("click",".br-mobile-menu",function(){s(".br-link").fadeToggle()}),t.on("click",".br-submit-save",function(e){e.preventDefault();var e=s(this).closest("form"),t=e.get(0).dataset.section,e={action:"save_settings_tab_"+t,security:breeze_token_name.breeze_save_options,"form-data":e.serialize(),"is-network":s("body").hasClass("network-admin")};s(".br-options").html('<div class="br-loader-spinner saving_settings"><div></div><div></div><div></div><div></div></div>'),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){s("#tab-"+t).trigger("click")},error:function(e,t,a){},complete:function(e,t){}})}),s(document).on("change","#inherit-settings",function(){var a=s(this).is(":checked"),i=".br-is-network",n=".br-is-custom",e=s(this).closest("div.change-settings-use").find("input#breeze_inherit_settings_nonce").val();s(".br-overlay-disable").addClass("br-hide");e={action:"save_settings_tab_inherit","is-selected":a,security:e,"is-network":s("body").hasClass("network-admin")};s("<div/>",{class:"br-inherit-wait",html:'<div class="br-loader-spinner switch-to-settings"><div></div><div></div><div></div><div></div></div>'}).appendTo(s("#wpcontent")),s.ajax({type:"POST",url:ajaxurl,data:e,dataType:"JSON",success:function(e){},error:function(e,t,a){},complete:function(e,t){s("#wpcontent").find("div.br-inherit-wait").remove(),!0===a?(s(i).removeClass("br-show").addClass("br-hide"),s(n).removeClass("br-hide").addClass("br-show"),s(".br-link").removeClass("br-hide"),s("#tab-basic").trigger("click")):(s(n).removeClass("br-show").addClass("br-hide"),s(i).removeClass("br-hide").addClass("br-show"),s(".br-link").each(function(e,t){"faq"!==t.dataset.breezeLink&&s(t).addClass("br-hide")}),s("#tab-faq").trigger("click"))}})}),s(document).on("click",".notice-dismiss",function(){var e=s(this).closest("div.notice");e.hasClass("breeze-notice")&&e.fadeOut("fast").remove()})}(jQuery);
|
assets/js/js-front-end/breeze-lazy-load.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
|
4 |
!function(e,t){t=t(e,e.document,Date);"object"==typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd?define(t):e.lazySizes=t}(window,function(n,f,s){"use strict";var m,h;if(!function(){var e,t={lazyClass:"br-lazy",loadedClass:"br-loaded",loadingClass:"br-loading",preloadClass:"br-preload",errorClass:"br-error",autosizesClass:"br-autosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-breeze",srcsetAttr:"data-brsrcset",sizesAttr:"data-brsizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=n.lazySizesConfig||n.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!f||!f.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};function c(e,t){M(e,t)||e.setAttribute("class",(e[g]("class")||"").trim()+" "+t)}function u(e,t){(t=M(e,t))&&e.setAttribute("class",(e[g]("class")||"").replace(t," "))}function z(e,t){var a;!l&&(a=n.picturefill||h.pf)?(t&&t.src&&!e[g]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)}var a,i,t,o,r,y=f.documentElement,l=n.HTMLPictureElement,d="addEventListener",g="getAttribute",e=n[d].bind(n),v=n.setTimeout,p=n.requestAnimationFrame||v,b=n.requestIdleCallback,C=/^picture$/i,A=["load","error","lazyincluded","_lazyloaded"],E={},_=Array.prototype.forEach,M=function(e,t){return E[t]||(E[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),E[t].test(e[g]("class")||"")&&E[t]},N=function(t,a,e){var n=e?d:"removeEventListener";e&&N(t,a),A.forEach(function(e){t[n](e,a)})},w=function(e,t,a,n,i){var s=f.createEvent("Event");return(a=a||{}).instance=m,s.initEvent(t,!n,!i),s.detail=a,e.dispatchEvent(s),s},L=function(e,t){return(getComputedStyle(e,null)||{})[t]},x=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},W=(o=[],r=t=[],B._lsFlush=S,B);function S(){var e=r;for(r=t.length?o:t,i=!(a=!0);e.length;)e.shift()();a=!1}function B(e,t){a&&!t?e.apply(this,arguments):(r.push(e),i||(i=!0,(f.hidden?v:p)(S)))}function T(a,e){return e?function(){W(a)}:function(){var e=this,t=arguments;W(function(){a.apply(e,t)})}}function F(e){function t(){var e=s.now()-n;e<99?v(t,99-e):(b||i)(i)}var a,n,i=function(){a=null,e()};return function(){n=s.now(),a=a||v(t,99)}}var R,D,k,H,O,P,$,q,I,U,j,G,J,K,Q,V,X,Y,Z,ee,te,ae,ne,ie,se,oe,re,le,de,ce,ue,fe=(Z=/^img$/i,ee=/^iframe$/i,te="onscroll"in n&&!/(gle|ing)bot/.test(navigator.userAgent),ie=-1,se=function(e){return(G=null==G?"hidden"==L(f.body,"visibility"):G)||!("hidden"==L(e.parentNode,"visibility")&&"hidden"==L(e,"visibility"))},J=he,Q=ne=ae=0,V=h.throttleDelay,X=h.ricTimeout,Y=b&&49<X?function(){b(ze,{timeout:X}),X!==h.ricTimeout&&(X=h.ricTimeout)}:T(function(){v(ze)},!0),re=T(ye),le=function(e){re({target:e.target})},de=T(function(t,e,a,n,i){var s,o,r,l,d;(r=w(t,"lazybeforeunveil",e)).defaultPrevented||(n&&(a?c(t,h.autosizesClass):t.setAttribute("sizes",n)),s=t[g](h.srcsetAttr),a=t[g](h.srcAttr),i&&(o=(d=t.parentNode)&&C.test(d.nodeName||"")),l=e.firesLoad||"src"in t&&(s||a||o),r={target:t},c(t,h.loadingClass),l&&(clearTimeout(k),k=v(me,2500),N(t,le,!0)),o&&_.call(d.getElementsByTagName("source"),ge),s?t.setAttribute("srcset",s):a&&!o&&(ee.test(t.nodeName)?(n=a,0==(d=(e=t).getAttribute("data-load-mode")||h.iframeLoadMode)?e.contentWindow.location.replace(n):1==d&&(e.src=n)):t.src=a),i&&(s||o)&&z(t,{src:a})),t._lazyRace&&delete t._lazyRace,u(t,h.lazyClass),W(function(){var e=t.complete&&1<t.naturalWidth;l&&!e||(e&&c(t,h.fastLoadedClass),ye(r),t._lazyCache=!0,v(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&ne--},!0)}),ue=F(function(){h.loadMode=3,oe()}),{_:function(){O=s.now(),m.elements=f.getElementsByClassName(h.lazyClass),R=f.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",oe,!0),e("resize",oe,!0),e("pageshow",function(e){var t;!e.persisted||(t=f.querySelectorAll("."+h.loadingClass)).length&&t.forEach&&p(function(){t.forEach(function(e){e.complete&&ce(e)})})}),n.MutationObserver?new MutationObserver(oe).observe(y,{childList:!0,subtree:!0,attributes:!0}):(y[d]("DOMNodeInserted",oe,!0),y[d]("DOMAttrModified",oe,!0),setInterval(oe,999)),e("hashchange",oe,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[d](e,oe,!0)}),/d$|^c/.test(f.readyState)?pe():(e("load",pe),f[d]("DOMContentLoaded",oe),v(pe,2e4)),m.elements.length?(he(),W._lsFlush()):oe()},checkElems:oe=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(s.now()-Q))<0&&(t=0),e||t<9?Y():v(Y,t))},unveil:ce=function(e){var t,a,n,i;e._lazyRace||(!(i="auto"==(n=(a=Z.test(e.nodeName))&&(e[g](h.sizesAttr)||e[g]("sizes"))))&&D||!a||!e[g]("src")&&!e.srcset||e.complete||M(e,h.errorClass)||!M(e,h.lazyClass))&&(t=w(e,"lazyunveilread").detail,i&&Ee.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,ne++,de(e,t,i,n,a))},_aLSL:ve});function me(e){ne--,e&&!(ne<0)&&e.target||(ne=0)}function he(){var e,t,a,n,i,s,o,r,l,d,c,u=m.elements;if((H=h.loadMode)&&ne<8&&(e=u.length)){for(t=0,ie++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!te||m.prematureUnveil&&m.prematureUnveil(u[t]))ce(u[t]);else if((o=u[t][g]("data-expand"))&&(i=+o)||(i=ae),l||(l=!h.expand||h.expand<1?500<y.clientHeight&&500<y.clientWidth?500:370:h.expand,d=(m._defEx=l)*h.expFactor,c=h.hFac,G=null,ae<d&&ne<1&&2<ie&&2<H&&!f.hidden?(ae=d,ie=0):ae=1<H&&1<ie&&ne<6?l:0),r!==i&&(P=innerWidth+i*c,$=innerHeight+i,s=-1*i,r=i),d=u[t].getBoundingClientRect(),(j=d.bottom)>=s&&(q=d.top)<=$&&(U=d.right)>=s*c&&(I=d.left)<=P&&(j||U||I||q)&&(h.loadHidden||se(u[t]))&&(D&&ne<3&&!o&&(H<3||ie<4)||function(e,t){var a,n=e,i=se(e);for(q-=t,j+=t,I-=t,U+=t;i&&(n=n.offsetParent)&&n!=f.body&&n!=y;)(i=0<(L(n,"opacity")||1))&&"visible"!=L(n,"overflow")&&(a=n.getBoundingClientRect(),i=U>a.left&&I<a.right&&j>a.top-1&&q<a.bottom+1);return i}(u[t],i))){if(ce(u[t]),n=!0,9<ne)break}else!n&&D&&!a&&ne<4&&ie<4&&2<H&&(R[0]||h.preloadAfterLoad)&&(R[0]||!o&&(j||U||I||q||"auto"!=u[t][g](h.sizesAttr)))&&(a=R[0]||u[t]);a&&!n&&ce(a)}}function ze(){K=!1,Q=s.now(),J()}function ye(e){var t=e.target;t._lazyCache?delete t._lazyCache:(me(e),c(t,h.loadedClass),u(t,h.loadingClass),N(t,le),w(t,"lazyloaded"))}function ge(e){var t,a=e[g](h.srcsetAttr);(t=h.customMedia[e[g]("data-media")||e[g]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function ve(){3==h.loadMode&&(h.loadMode=2),ue()}function pe(){D||(s.now()-O<999?v(pe,999):(D=!0,h.loadMode=3,oe(),e("scroll",ve,!0)))}var be,Ce,Ae,Ee=(Ce=T(function(e,t,a,n){var i,s,o;if(e._lazysizesWidth=n,e.setAttribute("sizes",n+="px"),C.test(t.nodeName||""))for(s=0,o=(i=t.getElementsByTagName("source")).length;s<o;s++)i[s].setAttribute("sizes",n);a.detail.dataAttr||z(e,a.detail)}),{_:function(){be=f.getElementsByClassName(h.autosizesClass),e("resize",Ae)},checkElems:Ae=F(function(){var e,t=be.length;if(t)for(e=0;e<t;e++)_e(be[e])}),updateElem:_e});function _e(e,t,a){var n=e.parentNode;n&&(a=x(e,n,a),(t=w(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&Ce(e,n,t,a))}function Me(){!Me.i&&f.getElementsByClassName&&(Me.i=!0,Ee._(),fe._())}return v(function(){h.init&&Me()}),m={cfg:h,autoSizer:Ee,loader:fe,init:Me,uP:z,aC:c,rC:u,hC:M,fire:w,gW:x,rAF:W}});
|
1 |
/*! Created by Cloudways
|
2 |
+
On 09-03-2022 */
|
3 |
|
4 |
!function(e,t){t=t(e,e.document,Date);"object"==typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd?define(t):e.lazySizes=t}(window,function(n,f,s){"use strict";var m,h;if(!function(){var e,t={lazyClass:"br-lazy",loadedClass:"br-loaded",loadingClass:"br-loading",preloadClass:"br-preload",errorClass:"br-error",autosizesClass:"br-autosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-breeze",srcsetAttr:"data-brsrcset",sizesAttr:"data-brsizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=n.lazySizesConfig||n.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!f||!f.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};function c(e,t){M(e,t)||e.setAttribute("class",(e[g]("class")||"").trim()+" "+t)}function u(e,t){(t=M(e,t))&&e.setAttribute("class",(e[g]("class")||"").replace(t," "))}function z(e,t){var a;!l&&(a=n.picturefill||h.pf)?(t&&t.src&&!e[g]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)}var a,i,t,o,r,y=f.documentElement,l=n.HTMLPictureElement,d="addEventListener",g="getAttribute",e=n[d].bind(n),v=n.setTimeout,p=n.requestAnimationFrame||v,b=n.requestIdleCallback,C=/^picture$/i,A=["load","error","lazyincluded","_lazyloaded"],E={},_=Array.prototype.forEach,M=function(e,t){return E[t]||(E[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),E[t].test(e[g]("class")||"")&&E[t]},N=function(t,a,e){var n=e?d:"removeEventListener";e&&N(t,a),A.forEach(function(e){t[n](e,a)})},w=function(e,t,a,n,i){var s=f.createEvent("Event");return(a=a||{}).instance=m,s.initEvent(t,!n,!i),s.detail=a,e.dispatchEvent(s),s},L=function(e,t){return(getComputedStyle(e,null)||{})[t]},x=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},W=(o=[],r=t=[],B._lsFlush=S,B);function S(){var e=r;for(r=t.length?o:t,i=!(a=!0);e.length;)e.shift()();a=!1}function B(e,t){a&&!t?e.apply(this,arguments):(r.push(e),i||(i=!0,(f.hidden?v:p)(S)))}function T(a,e){return e?function(){W(a)}:function(){var e=this,t=arguments;W(function(){a.apply(e,t)})}}function F(e){function t(){var e=s.now()-n;e<99?v(t,99-e):(b||i)(i)}var a,n,i=function(){a=null,e()};return function(){n=s.now(),a=a||v(t,99)}}var R,D,k,H,O,P,$,q,I,U,j,G,J,K,Q,V,X,Y,Z,ee,te,ae,ne,ie,se,oe,re,le,de,ce,ue,fe=(Z=/^img$/i,ee=/^iframe$/i,te="onscroll"in n&&!/(gle|ing)bot/.test(navigator.userAgent),ie=-1,se=function(e){return(G=null==G?"hidden"==L(f.body,"visibility"):G)||!("hidden"==L(e.parentNode,"visibility")&&"hidden"==L(e,"visibility"))},J=he,Q=ne=ae=0,V=h.throttleDelay,X=h.ricTimeout,Y=b&&49<X?function(){b(ze,{timeout:X}),X!==h.ricTimeout&&(X=h.ricTimeout)}:T(function(){v(ze)},!0),re=T(ye),le=function(e){re({target:e.target})},de=T(function(t,e,a,n,i){var s,o,r,l,d;(r=w(t,"lazybeforeunveil",e)).defaultPrevented||(n&&(a?c(t,h.autosizesClass):t.setAttribute("sizes",n)),s=t[g](h.srcsetAttr),a=t[g](h.srcAttr),i&&(o=(d=t.parentNode)&&C.test(d.nodeName||"")),l=e.firesLoad||"src"in t&&(s||a||o),r={target:t},c(t,h.loadingClass),l&&(clearTimeout(k),k=v(me,2500),N(t,le,!0)),o&&_.call(d.getElementsByTagName("source"),ge),s?t.setAttribute("srcset",s):a&&!o&&(ee.test(t.nodeName)?(n=a,0==(d=(e=t).getAttribute("data-load-mode")||h.iframeLoadMode)?e.contentWindow.location.replace(n):1==d&&(e.src=n)):t.src=a),i&&(s||o)&&z(t,{src:a})),t._lazyRace&&delete t._lazyRace,u(t,h.lazyClass),W(function(){var e=t.complete&&1<t.naturalWidth;l&&!e||(e&&c(t,h.fastLoadedClass),ye(r),t._lazyCache=!0,v(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&ne--},!0)}),ue=F(function(){h.loadMode=3,oe()}),{_:function(){O=s.now(),m.elements=f.getElementsByClassName(h.lazyClass),R=f.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",oe,!0),e("resize",oe,!0),e("pageshow",function(e){var t;!e.persisted||(t=f.querySelectorAll("."+h.loadingClass)).length&&t.forEach&&p(function(){t.forEach(function(e){e.complete&&ce(e)})})}),n.MutationObserver?new MutationObserver(oe).observe(y,{childList:!0,subtree:!0,attributes:!0}):(y[d]("DOMNodeInserted",oe,!0),y[d]("DOMAttrModified",oe,!0),setInterval(oe,999)),e("hashchange",oe,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[d](e,oe,!0)}),/d$|^c/.test(f.readyState)?pe():(e("load",pe),f[d]("DOMContentLoaded",oe),v(pe,2e4)),m.elements.length?(he(),W._lsFlush()):oe()},checkElems:oe=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(s.now()-Q))<0&&(t=0),e||t<9?Y():v(Y,t))},unveil:ce=function(e){var t,a,n,i;e._lazyRace||(!(i="auto"==(n=(a=Z.test(e.nodeName))&&(e[g](h.sizesAttr)||e[g]("sizes"))))&&D||!a||!e[g]("src")&&!e.srcset||e.complete||M(e,h.errorClass)||!M(e,h.lazyClass))&&(t=w(e,"lazyunveilread").detail,i&&Ee.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,ne++,de(e,t,i,n,a))},_aLSL:ve});function me(e){ne--,e&&!(ne<0)&&e.target||(ne=0)}function he(){var e,t,a,n,i,s,o,r,l,d,c,u=m.elements;if((H=h.loadMode)&&ne<8&&(e=u.length)){for(t=0,ie++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!te||m.prematureUnveil&&m.prematureUnveil(u[t]))ce(u[t]);else if((o=u[t][g]("data-expand"))&&(i=+o)||(i=ae),l||(l=!h.expand||h.expand<1?500<y.clientHeight&&500<y.clientWidth?500:370:h.expand,d=(m._defEx=l)*h.expFactor,c=h.hFac,G=null,ae<d&&ne<1&&2<ie&&2<H&&!f.hidden?(ae=d,ie=0):ae=1<H&&1<ie&&ne<6?l:0),r!==i&&(P=innerWidth+i*c,$=innerHeight+i,s=-1*i,r=i),d=u[t].getBoundingClientRect(),(j=d.bottom)>=s&&(q=d.top)<=$&&(U=d.right)>=s*c&&(I=d.left)<=P&&(j||U||I||q)&&(h.loadHidden||se(u[t]))&&(D&&ne<3&&!o&&(H<3||ie<4)||function(e,t){var a,n=e,i=se(e);for(q-=t,j+=t,I-=t,U+=t;i&&(n=n.offsetParent)&&n!=f.body&&n!=y;)(i=0<(L(n,"opacity")||1))&&"visible"!=L(n,"overflow")&&(a=n.getBoundingClientRect(),i=U>a.left&&I<a.right&&j>a.top-1&&q<a.bottom+1);return i}(u[t],i))){if(ce(u[t]),n=!0,9<ne)break}else!n&&D&&!a&&ne<4&&ie<4&&2<H&&(R[0]||h.preloadAfterLoad)&&(R[0]||!o&&(j||U||I||q||"auto"!=u[t][g](h.sizesAttr)))&&(a=R[0]||u[t]);a&&!n&&ce(a)}}function ze(){K=!1,Q=s.now(),J()}function ye(e){var t=e.target;t._lazyCache?delete t._lazyCache:(me(e),c(t,h.loadedClass),u(t,h.loadingClass),N(t,le),w(t,"lazyloaded"))}function ge(e){var t,a=e[g](h.srcsetAttr);(t=h.customMedia[e[g]("data-media")||e[g]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function ve(){3==h.loadMode&&(h.loadMode=2),ue()}function pe(){D||(s.now()-O<999?v(pe,999):(D=!0,h.loadMode=3,oe(),e("scroll",ve,!0)))}var be,Ce,Ae,Ee=(Ce=T(function(e,t,a,n){var i,s,o;if(e._lazysizesWidth=n,e.setAttribute("sizes",n+="px"),C.test(t.nodeName||""))for(s=0,o=(i=t.getElementsByTagName("source")).length;s<o;s++)i[s].setAttribute("sizes",n);a.detail.dataAttr||z(e,a.detail)}),{_:function(){be=f.getElementsByClassName(h.autosizesClass),e("resize",Ae)},checkElems:Ae=F(function(){var e,t=be.length;if(t)for(e=0;e<t;e++)_e(be[e])}),updateElem:_e});function _e(e,t,a){var n=e.parentNode;n&&(a=x(e,n,a),(t=w(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&Ce(e,n,t,a))}function Me(){!Me.i&&f.getElementsByClassName&&(Me.i=!0,Ee._(),fe._())}return v(function(){h.init&&Me()}),m={cfg:h,autoSizer:Ee,loader:fe,init:Me,uP:z,aC:c,rC:u,hC:M,fire:w,gW:x,rAF:W}});
|
assets/js/js-front-end/breeze-prefetch-links.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
/*! Created by Cloudways
|
2 |
-
On
|
3 |
|
4 |
var timer,ready=e=>{"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)};function search_for_banned_links(e,t){var r=!1;if(e.length)for(i=0;i<e.length;i++)-1===t.indexOf(e[i])&&-1===e[i].indexOf(t)||(r=!0);return r}ready(()=>{var i=[];addEventListener("mouseover",function(e){var n;e.target instanceof HTMLAnchorElement&&(n=e.target.attributes.href.value,timer=setTimeout(function(){var e=n.replace(breeze_prefetch.local_url,""),t=new URL(breeze_prefetch.local_url).host,r=new URL(n).host;""!==n.trim()&&!1===i.includes(n)&&t===r&&!1===search_for_banned_links(breeze_prefetch.ignore_list,e)&&(i.push(n.trim()),(e=document.createElement("link")).href=n,e.rel="prefetch",document.head.appendChild(e))},150))}),addEventListener("mouseout",function(e){clearTimeout(timer)})});
|
1 |
/*! Created by Cloudways
|
2 |
+
On 09-03-2022 */
|
3 |
|
4 |
var timer,ready=e=>{"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)};function search_for_banned_links(e,t){var r=!1;if(e.length)for(i=0;i<e.length;i++)-1===t.indexOf(e[i])&&-1===e[i].indexOf(t)||(r=!0);return r}ready(()=>{var i=[];addEventListener("mouseover",function(e){var n;e.target instanceof HTMLAnchorElement&&(n=e.target.attributes.href.value,timer=setTimeout(function(){var e=n.replace(breeze_prefetch.local_url,""),t=new URL(breeze_prefetch.local_url).host,r=new URL(n).host;""!==n.trim()&&!1===i.includes(n)&&t===r&&!1===search_for_banned_links(breeze_prefetch.ignore_list,e)&&(i.push(n.trim()),(e=document.createElement("link")).href=n,e.rel="prefetch",document.head.appendChild(e))},150))}),addEventListener("mouseout",function(e){clearTimeout(timer)})});
|
breeze.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Breeze
|
4 |
* Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
|
5 |
-
* Version: 2.0.
|
6 |
* Text Domain: breeze
|
7 |
* Domain Path: /languages
|
8 |
* Author: Cloudways
|
@@ -37,7 +37,7 @@ if ( ! defined( 'BREEZE_PLUGIN_DIR' ) ) {
|
|
37 |
define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
38 |
}
|
39 |
if ( ! defined( 'BREEZE_VERSION' ) ) {
|
40 |
-
define( 'BREEZE_VERSION', '2.0.
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
@@ -80,6 +80,9 @@ require_once BREEZE_PLUGIN_DIR . 'inc/plugin-incompatibility/breeze-amp-compatib
|
|
80 |
require_once BREEZE_PLUGIN_DIR . 'inc/helpers.php';
|
81 |
require_once BREEZE_PLUGIN_DIR . 'inc/functions.php';
|
82 |
|
|
|
|
|
|
|
83 |
//action to purge cache
|
84 |
require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-varnish.php' );
|
85 |
require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-cache.php' );
|
@@ -88,6 +91,8 @@ require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-per-time.php' );
|
|
88 |
require_once( BREEZE_PLUGIN_DIR . 'inc/class-exclude-pages-by-shortcode.php' );
|
89 |
// Handle the WP emoji library.
|
90 |
require_once( BREEZE_PLUGIN_DIR . 'inc/class-breeze-disable-emoji-option.php' );
|
|
|
|
|
91 |
|
92 |
// Activate plugin hook
|
93 |
register_activation_hook( __FILE__, array( 'Breeze_Admin', 'plugin_active_hook' ) );
|
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.2
|
6 |
* Text Domain: breeze
|
7 |
* Domain Path: /languages
|
8 |
* Author: Cloudways
|
37 |
define( 'BREEZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
38 |
}
|
39 |
if ( ! defined( 'BREEZE_VERSION' ) ) {
|
40 |
+
define( 'BREEZE_VERSION', '2.0.2' );
|
41 |
}
|
42 |
if ( ! defined( 'BREEZE_SITEURL' ) ) {
|
43 |
define( 'BREEZE_SITEURL', get_site_url() );
|
80 |
require_once BREEZE_PLUGIN_DIR . 'inc/helpers.php';
|
81 |
require_once BREEZE_PLUGIN_DIR . 'inc/functions.php';
|
82 |
|
83 |
+
// Handle Heartbeat options.
|
84 |
+
require_once BREEZE_PLUGIN_DIR . 'inc/class-breeze-heartbeat-settings.php';
|
85 |
+
|
86 |
//action to purge cache
|
87 |
require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-varnish.php' );
|
88 |
require_once( BREEZE_PLUGIN_DIR . 'inc/cache/purge-cache.php' );
|
91 |
require_once( BREEZE_PLUGIN_DIR . 'inc/class-exclude-pages-by-shortcode.php' );
|
92 |
// Handle the WP emoji library.
|
93 |
require_once( BREEZE_PLUGIN_DIR . 'inc/class-breeze-disable-emoji-option.php' );
|
94 |
+
// Prefetch URLs.
|
95 |
+
require_once( BREEZE_PLUGIN_DIR . 'inc/class-breeze-dns-prefetch.php' );
|
96 |
|
97 |
// Activate plugin hook
|
98 |
register_activation_hook( __FILE__, array( 'Breeze_Admin', 'plugin_active_hook' ) );
|
inc/breeze-admin.php
CHANGED
@@ -85,9 +85,12 @@ class Breeze_Admin {
|
|
85 |
|
86 |
$is_lazy_load_enabled = false;
|
87 |
$is_lazy_load_native = false;
|
|
|
88 |
|
89 |
-
|
90 |
-
$
|
|
|
|
|
91 |
|
92 |
if ( isset( $option_breeze_lazy_load ) ) {
|
93 |
$is_lazy_load_enabled = filter_var( $option_breeze_lazy_load, FILTER_VALIDATE_BOOLEAN );
|
@@ -95,8 +98,11 @@ class Breeze_Admin {
|
|
95 |
if ( isset( $option_breeze_lazy_load_native ) ) {
|
96 |
$is_lazy_load_native = filter_var( $option_breeze_lazy_load_native, FILTER_VALIDATE_BOOLEAN );
|
97 |
}
|
|
|
|
|
|
|
98 |
|
99 |
-
if ( true === $is_lazy_load_enabled && false === $is_lazy_load_native ) {
|
100 |
if ( ! wp_script_is( 'jquery', 'enqueued' ) ) {
|
101 |
wp_enqueue_script( 'jquery' );
|
102 |
}
|
@@ -156,14 +162,13 @@ class Breeze_Admin {
|
|
156 |
if ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) {
|
157 |
$min = '';
|
158 |
}
|
159 |
-
wp_enqueue_script( 'breeze-backend', plugins_url( 'assets/js/breeze-main' . $min . '.js', dirname( __FILE__ ) ), array( 'jquery' ),
|
160 |
-
#wp_enqueue_style( 'breeze-topbar', plugins_url( 'assets/css/topbar.css', dirname( __FILE__ ) ), array(), BREEZE_VERSION );
|
161 |
wp_enqueue_style( 'breeze-notice', plugins_url( 'assets/css/breeze-admin-global.css', dirname( __FILE__ ) ), array(), BREEZE_VERSION );
|
162 |
$current_screen = get_current_screen();
|
163 |
if ( $current_screen->base == 'settings_page_breeze' || $current_screen->base == 'settings_page_breeze-network' ) {
|
164 |
//add css
|
165 |
wp_enqueue_style( 'breeze-fonts', plugins_url( 'assets/css/breeze-fonts.css', dirname( __FILE__ ) ), array(), BREEZE_VERSION ); // BREEZE_VERSION
|
166 |
-
wp_enqueue_style( 'breeze-style', plugins_url( 'assets/css/breeze-admin.css', dirname( __FILE__ ) ), array( 'breeze-fonts' ),
|
167 |
|
168 |
//js
|
169 |
#wp_enqueue_script( 'breeze-configuration', plugins_url( 'assets/js/breeze-configuration.js', dirname( __FILE__ ) ), array( 'jquery' ), BREEZE_VERSION, true );
|
@@ -351,16 +356,17 @@ class Breeze_Admin {
|
|
351 |
}
|
352 |
|
353 |
$default_basic = array(
|
354 |
-
'breeze-active'
|
355 |
-
'breeze-cross-origin'
|
356 |
-
'breeze-disable-admin'
|
357 |
-
'breeze-gzip-compression'
|
358 |
-
'breeze-desktop-cache'
|
359 |
-
'breeze-mobile-cache'
|
360 |
-
'breeze-browser-cache'
|
361 |
-
'breeze-lazy-load'
|
362 |
-
'breeze-lazy-load-native'
|
363 |
-
'breeze-
|
|
|
364 |
|
365 |
);
|
366 |
$basic = array_merge( $default_basic, $basic );
|
@@ -401,6 +407,19 @@ class Breeze_Admin {
|
|
401 |
'breeze-wp-emoji' => '0',
|
402 |
);
|
403 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
$is_advanced = get_option( 'breeze_advanced_settings_120' );
|
405 |
|
406 |
if ( empty( $is_advanced ) ) {
|
@@ -467,6 +486,7 @@ class Breeze_Admin {
|
|
467 |
$default_preload = array(
|
468 |
'breeze-preload-fonts' => array(),
|
469 |
'breeze-preload-links' => '0',
|
|
|
470 |
);
|
471 |
$preload = array_merge( $default_preload, $preload );
|
472 |
|
@@ -505,6 +525,11 @@ class Breeze_Admin {
|
|
505 |
update_blog_option( (int) $blog->blog_id, 'breeze_advanced_settings', $advanced );
|
506 |
}
|
507 |
|
|
|
|
|
|
|
|
|
|
|
508 |
$blog_preload = get_blog_option( (int) $blog->blog_id, 'breeze_preload_settings', '' );
|
509 |
if ( empty( $blog_preload ) ) {
|
510 |
update_blog_option( (int) $blog->blog_id, 'breeze_preload_settings', $preload );
|
@@ -549,6 +574,11 @@ class Breeze_Admin {
|
|
549 |
breeze_update_option( 'advanced_settings', $advanced );
|
550 |
}
|
551 |
|
|
|
|
|
|
|
|
|
|
|
552 |
$network_preload = breeze_get_option( 'preload_settings' );
|
553 |
if ( ! $network_preload ) {
|
554 |
breeze_update_option( 'preload_settings', $preload );
|
@@ -594,6 +624,11 @@ class Breeze_Admin {
|
|
594 |
breeze_update_option( 'advanced_settings', $advanced );
|
595 |
}
|
596 |
|
|
|
|
|
|
|
|
|
|
|
597 |
$singe_network_preload = breeze_get_option( 'preload_settings' );
|
598 |
if ( ! $singe_network_preload ) {
|
599 |
breeze_update_option( 'preload_settings', $preload );
|
@@ -689,6 +724,7 @@ class Breeze_Admin {
|
|
689 |
delete_site_option( 'breeze_preload_settings' );
|
690 |
delete_site_option( 'breeze_file_settings' );
|
691 |
delete_site_option( 'breeze_advanced_settings' );
|
|
|
692 |
delete_site_option( 'breeze_cdn_integration' );
|
693 |
delete_site_option( 'breeze_varnish_cache' );
|
694 |
delete_site_option( 'breeze_inherit_settings' );
|
@@ -707,6 +743,7 @@ class Breeze_Admin {
|
|
707 |
delete_option( 'breeze_preload_settings' );
|
708 |
delete_option( 'breeze_file_settings' );
|
709 |
delete_option( 'breeze_advanced_settings' );
|
|
|
710 |
delete_option( 'breeze_cdn_integration' );
|
711 |
delete_option( 'breeze_varnish_cache' );
|
712 |
delete_option( 'breeze_inherit_settings' );
|
@@ -725,6 +762,7 @@ class Breeze_Admin {
|
|
725 |
delete_option( 'breeze_preload_settings' );
|
726 |
delete_option( 'breeze_file_settings' );
|
727 |
delete_option( 'breeze_advanced_settings' );
|
|
|
728 |
delete_option( 'breeze_cdn_integration' );
|
729 |
delete_option( 'breeze_varnish_cache' );
|
730 |
delete_option( 'breeze_inherit_settings' );
|
85 |
|
86 |
$is_lazy_load_enabled = false;
|
87 |
$is_lazy_load_native = false;
|
88 |
+
$is_lazy_load_iframe = false;
|
89 |
|
90 |
+
|
91 |
+
$option_breeze_lazy_load = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load' );
|
92 |
+
$option_breeze_lazy_load_native = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-native' );
|
93 |
+
$option_breeze_lazy_load_iframes = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-iframes' );
|
94 |
|
95 |
if ( isset( $option_breeze_lazy_load ) ) {
|
96 |
$is_lazy_load_enabled = filter_var( $option_breeze_lazy_load, FILTER_VALIDATE_BOOLEAN );
|
98 |
if ( isset( $option_breeze_lazy_load_native ) ) {
|
99 |
$is_lazy_load_native = filter_var( $option_breeze_lazy_load_native, FILTER_VALIDATE_BOOLEAN );
|
100 |
}
|
101 |
+
if ( isset( $option_breeze_lazy_load_iframes ) ) {
|
102 |
+
$is_lazy_load_iframe = filter_var( $option_breeze_lazy_load_iframes, FILTER_VALIDATE_BOOLEAN );
|
103 |
+
}
|
104 |
|
105 |
+
if ( ( true === $is_lazy_load_enabled && false === $is_lazy_load_native ) || true === $is_lazy_load_iframe ) {
|
106 |
if ( ! wp_script_is( 'jquery', 'enqueued' ) ) {
|
107 |
wp_enqueue_script( 'jquery' );
|
108 |
}
|
162 |
if ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) {
|
163 |
$min = '';
|
164 |
}
|
165 |
+
wp_enqueue_script( 'breeze-backend', plugins_url( 'assets/js/breeze-main' . $min . '.js', dirname( __FILE__ ) ), array( 'jquery' ), BREEZE_VERSION, true ); // BREEZE_VERSION
|
|
|
166 |
wp_enqueue_style( 'breeze-notice', plugins_url( 'assets/css/breeze-admin-global.css', dirname( __FILE__ ) ), array(), BREEZE_VERSION );
|
167 |
$current_screen = get_current_screen();
|
168 |
if ( $current_screen->base == 'settings_page_breeze' || $current_screen->base == 'settings_page_breeze-network' ) {
|
169 |
//add css
|
170 |
wp_enqueue_style( 'breeze-fonts', plugins_url( 'assets/css/breeze-fonts.css', dirname( __FILE__ ) ), array(), BREEZE_VERSION ); // BREEZE_VERSION
|
171 |
+
wp_enqueue_style( 'breeze-style', plugins_url( 'assets/css/breeze-admin.css', dirname( __FILE__ ) ), array( 'breeze-fonts' ), BREEZE_VERSION ); // BREEZE_VERSION
|
172 |
|
173 |
//js
|
174 |
#wp_enqueue_script( 'breeze-configuration', plugins_url( 'assets/js/breeze-configuration.js', dirname( __FILE__ ) ), array( 'jquery' ), BREEZE_VERSION, true );
|
356 |
}
|
357 |
|
358 |
$default_basic = array(
|
359 |
+
'breeze-active' => '1',
|
360 |
+
'breeze-cross-origin' => '0',
|
361 |
+
'breeze-disable-admin' => $active_cache_users,
|
362 |
+
'breeze-gzip-compression' => '1',
|
363 |
+
'breeze-desktop-cache' => '1',
|
364 |
+
'breeze-mobile-cache' => '1',
|
365 |
+
'breeze-browser-cache' => '1',
|
366 |
+
'breeze-lazy-load' => '0',
|
367 |
+
'breeze-lazy-load-native' => '0',
|
368 |
+
'breeze-lazy-load-iframes' => '0',
|
369 |
+
'breeze-display-clean' => '1',
|
370 |
|
371 |
);
|
372 |
$basic = array_merge( $default_basic, $basic );
|
407 |
'breeze-wp-emoji' => '0',
|
408 |
);
|
409 |
|
410 |
+
$heartbeat = breeze_get_option( 'heartbeat_settings' );
|
411 |
+
if ( empty( $heartbeat ) ) {
|
412 |
+
$heartbeat = array();
|
413 |
+
}
|
414 |
+
|
415 |
+
$default_heartbeat = array(
|
416 |
+
'breeze-control-heartbeat' => '0',
|
417 |
+
'breeze-heartbeat-front' => '',
|
418 |
+
'breeze-heartbeat-postedit' => '',
|
419 |
+
'breeze-heartbeat-backend' => '',
|
420 |
+
);
|
421 |
+
$heartbeat = array_merge( $default_heartbeat, $heartbeat );
|
422 |
+
|
423 |
$is_advanced = get_option( 'breeze_advanced_settings_120' );
|
424 |
|
425 |
if ( empty( $is_advanced ) ) {
|
486 |
$default_preload = array(
|
487 |
'breeze-preload-fonts' => array(),
|
488 |
'breeze-preload-links' => '0',
|
489 |
+
'breeze-prefetch-urls' => array(),
|
490 |
);
|
491 |
$preload = array_merge( $default_preload, $preload );
|
492 |
|
525 |
update_blog_option( (int) $blog->blog_id, 'breeze_advanced_settings', $advanced );
|
526 |
}
|
527 |
|
528 |
+
$blog_heartbeat = get_blog_option( (int) $blog->blog_id, 'breeze_heartbeat_settings', '' );
|
529 |
+
if ( empty( $blog_heartbeat ) ) {
|
530 |
+
update_blog_option( (int) $blog->blog_id, 'breeze_heartbeat_settings', $heartbeat );
|
531 |
+
}
|
532 |
+
|
533 |
$blog_preload = get_blog_option( (int) $blog->blog_id, 'breeze_preload_settings', '' );
|
534 |
if ( empty( $blog_preload ) ) {
|
535 |
update_blog_option( (int) $blog->blog_id, 'breeze_preload_settings', $preload );
|
574 |
breeze_update_option( 'advanced_settings', $advanced );
|
575 |
}
|
576 |
|
577 |
+
$network_heartbeat = breeze_get_option( 'heartbeat_settings' );
|
578 |
+
if ( ! $network_heartbeat ) {
|
579 |
+
breeze_update_option( 'heartbeat_settings', $heartbeat );
|
580 |
+
}
|
581 |
+
|
582 |
$network_preload = breeze_get_option( 'preload_settings' );
|
583 |
if ( ! $network_preload ) {
|
584 |
breeze_update_option( 'preload_settings', $preload );
|
624 |
breeze_update_option( 'advanced_settings', $advanced );
|
625 |
}
|
626 |
|
627 |
+
$singe_network_heartbeat = breeze_get_option( 'heartbeat_settings' );
|
628 |
+
if ( ! $singe_network_heartbeat ) {
|
629 |
+
breeze_update_option( 'heartbeat_settings', $heartbeat );
|
630 |
+
}
|
631 |
+
|
632 |
$singe_network_preload = breeze_get_option( 'preload_settings' );
|
633 |
if ( ! $singe_network_preload ) {
|
634 |
breeze_update_option( 'preload_settings', $preload );
|
724 |
delete_site_option( 'breeze_preload_settings' );
|
725 |
delete_site_option( 'breeze_file_settings' );
|
726 |
delete_site_option( 'breeze_advanced_settings' );
|
727 |
+
delete_site_option( 'breeze_heartbeat_settings' );
|
728 |
delete_site_option( 'breeze_cdn_integration' );
|
729 |
delete_site_option( 'breeze_varnish_cache' );
|
730 |
delete_site_option( 'breeze_inherit_settings' );
|
743 |
delete_option( 'breeze_preload_settings' );
|
744 |
delete_option( 'breeze_file_settings' );
|
745 |
delete_option( 'breeze_advanced_settings' );
|
746 |
+
delete_option( 'breeze_heartbeat_settings' );
|
747 |
delete_option( 'breeze_cdn_integration' );
|
748 |
delete_option( 'breeze_varnish_cache' );
|
749 |
delete_option( 'breeze_inherit_settings' );
|
762 |
delete_option( 'breeze_preload_settings' );
|
763 |
delete_option( 'breeze_file_settings' );
|
764 |
delete_option( 'breeze_advanced_settings' );
|
765 |
+
delete_option( 'breeze_heartbeat_settings' );
|
766 |
delete_option( 'breeze_cdn_integration' );
|
767 |
delete_option( 'breeze_varnish_cache' );
|
768 |
delete_option( 'breeze_inherit_settings' );
|
inc/breeze-configuration.php
CHANGED
@@ -30,6 +30,7 @@ class Breeze_Configuration {
|
|
30 |
add_action( 'wp_ajax_save_settings_tab_file', array( &$this, 'update_options_for_file' ) );
|
31 |
add_action( 'wp_ajax_save_settings_tab_preload', array( &$this, 'update_options_for_preload' ) );
|
32 |
add_action( 'wp_ajax_save_settings_tab_advanced', array( &$this, 'update_options_for_advanced' ) );
|
|
|
33 |
add_action( 'wp_ajax_save_settings_tab_database', array( &$this, 'update_options_for_database' ) );
|
34 |
add_action( 'wp_ajax_save_settings_tab_cdn', array( &$this, 'update_options_for_cdn' ) );
|
35 |
add_action( 'wp_ajax_save_settings_tab_tools', array( &$this, 'update_options_for_tools' ) );
|
@@ -99,18 +100,25 @@ class Breeze_Configuration {
|
|
99 |
}
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
$basic = array(
|
103 |
-
'breeze-active'
|
104 |
-
'breeze-cross-origin'
|
105 |
-
'breeze-disable-admin'
|
106 |
-
'breeze-gzip-compression'
|
107 |
-
'breeze-browser-cache'
|
108 |
-
'breeze-lazy-load'
|
109 |
-
'breeze-lazy-load-native'
|
110 |
-
'breeze-
|
111 |
-
'breeze-
|
112 |
-
'breeze-
|
113 |
-
'breeze-
|
|
|
114 |
);
|
115 |
|
116 |
breeze_update_option( 'basic_settings', $basic, true );
|
@@ -256,7 +264,7 @@ class Breeze_Configuration {
|
|
256 |
|
257 |
if ( isset( $_POST['breeze-preload-font'] ) && ! empty( $_POST['breeze-preload-font'] ) ) {
|
258 |
foreach ( $_POST['breeze-preload-font'] as $font_url ) {
|
259 |
-
if ( trim( $font_url )
|
260 |
continue;
|
261 |
}
|
262 |
$font_url = current( explode( '?', $font_url, 2 ) );
|
@@ -264,9 +272,25 @@ class Breeze_Configuration {
|
|
264 |
}
|
265 |
}
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
$preload = array(
|
268 |
'breeze-preload-fonts' => $preload_fonts,
|
269 |
'breeze-preload-links' => ( isset( $_POST['preload-links'] ) ? '1' : '0' ),
|
|
|
270 |
);
|
271 |
|
272 |
breeze_update_option( 'preload_settings', $preload, true );
|
@@ -328,6 +352,45 @@ class Breeze_Configuration {
|
|
328 |
wp_send_json( $response );
|
329 |
}
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
/**
|
332 |
* Database tab only has actions for now and it will not save anything.
|
333 |
*
|
30 |
add_action( 'wp_ajax_save_settings_tab_file', array( &$this, 'update_options_for_file' ) );
|
31 |
add_action( 'wp_ajax_save_settings_tab_preload', array( &$this, 'update_options_for_preload' ) );
|
32 |
add_action( 'wp_ajax_save_settings_tab_advanced', array( &$this, 'update_options_for_advanced' ) );
|
33 |
+
add_action( 'wp_ajax_save_settings_tab_heartbeat', array( &$this, 'update_options_for_heartbeat' ) );
|
34 |
add_action( 'wp_ajax_save_settings_tab_database', array( &$this, 'update_options_for_database' ) );
|
35 |
add_action( 'wp_ajax_save_settings_tab_cdn', array( &$this, 'update_options_for_cdn' ) );
|
36 |
add_action( 'wp_ajax_save_settings_tab_tools', array( &$this, 'update_options_for_tools' ) );
|
100 |
}
|
101 |
}
|
102 |
|
103 |
+
$iframe_lazy_load = ( isset( $_POST['bz-lazy-load-iframe'] ) ? '1' : '0' );
|
104 |
+
$lazy_load = ( isset( $_POST['bz-lazy-load'] ) ? '1' : '0' );
|
105 |
+
if ( false === filter_var( $lazy_load, FILTER_VALIDATE_BOOLEAN ) ) {
|
106 |
+
$iframe_lazy_load = '0';
|
107 |
+
}
|
108 |
+
|
109 |
$basic = array(
|
110 |
+
'breeze-active' => ( isset( $_POST['cache-system'] ) ? '1' : '0' ),
|
111 |
+
'breeze-cross-origin' => ( isset( $_POST['safe-cross-origin'] ) ? '1' : '0' ),
|
112 |
+
'breeze-disable-admin' => $active_cache_users,
|
113 |
+
'breeze-gzip-compression' => ( isset( $_POST['gzip-compression'] ) ? '1' : '0' ),
|
114 |
+
'breeze-browser-cache' => ( isset( $_POST['browser-cache'] ) ? '1' : '0' ),
|
115 |
+
'breeze-lazy-load' => ( isset( $_POST['bz-lazy-load'] ) ? '1' : '0' ),
|
116 |
+
'breeze-lazy-load-native' => ( isset( $_POST['bz-lazy-load-nat'] ) ? '1' : '0' ),
|
117 |
+
'breeze-lazy-load-iframes' => $iframe_lazy_load,
|
118 |
+
'breeze-desktop-cache' => '1',
|
119 |
+
'breeze-mobile-cache' => '1',
|
120 |
+
'breeze-display-clean' => '1',
|
121 |
+
'breeze-ttl' => (int) $_POST['cache-ttl'],
|
122 |
);
|
123 |
|
124 |
breeze_update_option( 'basic_settings', $basic, true );
|
264 |
|
265 |
if ( isset( $_POST['breeze-preload-font'] ) && ! empty( $_POST['breeze-preload-font'] ) ) {
|
266 |
foreach ( $_POST['breeze-preload-font'] as $font_url ) {
|
267 |
+
if ( '' === trim( $font_url ) ) {
|
268 |
continue;
|
269 |
}
|
270 |
$font_url = current( explode( '?', $font_url, 2 ) );
|
272 |
}
|
273 |
}
|
274 |
|
275 |
+
$prefetch_urls = $this->string_convert_arr( sanitize_textarea_field( $_POST['br-prefetch-urls'] ) );
|
276 |
+
if ( ! empty( $prefetch_urls ) ) {
|
277 |
+
$prefetch_urls = array_unique( $prefetch_urls );
|
278 |
+
// ltrim( $current_url, 'https:' )
|
279 |
+
foreach ( $prefetch_urls as &$url_prefetch ) {
|
280 |
+
//$url_prefetch = ltrim( $url_prefetch, 'https:' );
|
281 |
+
$link_schema = parse_url( $url_prefetch );
|
282 |
+
if ( isset( $link_schema['host'] ) ) {
|
283 |
+
$url_prefetch = '//' . $link_schema['host'];
|
284 |
+
} else {
|
285 |
+
unset( $url_prefetch );
|
286 |
+
}
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
$preload = array(
|
291 |
'breeze-preload-fonts' => $preload_fonts,
|
292 |
'breeze-preload-links' => ( isset( $_POST['preload-links'] ) ? '1' : '0' ),
|
293 |
+
'breeze-prefetch-urls' => $prefetch_urls,
|
294 |
);
|
295 |
|
296 |
breeze_update_option( 'preload_settings', $preload, true );
|
352 |
wp_send_json( $response );
|
353 |
}
|
354 |
|
355 |
+
/**
|
356 |
+
* Save the Heartbeat API settings via Ajax call.
|
357 |
+
*
|
358 |
+
* @access public
|
359 |
+
* @since 2.0.0
|
360 |
+
*/
|
361 |
+
public function update_options_for_heartbeat() {
|
362 |
+
check_ajax_referer( '_breeze_save_options', 'security' );
|
363 |
+
set_as_network_screen();
|
364 |
+
|
365 |
+
global $wp_filesystem;
|
366 |
+
|
367 |
+
if ( empty( $wp_filesystem ) ) {
|
368 |
+
require_once( ABSPATH . '/wp-admin/includes/file.php' );
|
369 |
+
WP_Filesystem();
|
370 |
+
}
|
371 |
+
|
372 |
+
$response = array();
|
373 |
+
parse_str( $_POST['form-data'], $_POST );
|
374 |
+
|
375 |
+
$heartbeat = array(
|
376 |
+
'breeze-control-heartbeat' => ( isset( $_POST['breeze-control-hb'] ) ? '1' : '0' ),
|
377 |
+
'breeze-heartbeat-front' => sanitize_textarea_field( $_POST['br-heartbeat-front'] ),
|
378 |
+
'breeze-heartbeat-postedit' => sanitize_textarea_field( $_POST['br-heartbeat-postedit'] ),
|
379 |
+
'breeze-heartbeat-backend' => sanitize_textarea_field( $_POST['br-heartbeat-backend'] ),
|
380 |
+
);
|
381 |
+
|
382 |
+
breeze_update_option( 'heartbeat_settings', $heartbeat, true );
|
383 |
+
|
384 |
+
// Storage information to cache pages.
|
385 |
+
Breeze_ConfigCache::factory()->write();
|
386 |
+
Breeze_ConfigCache::factory()->write_config_cache();
|
387 |
+
|
388 |
+
// Delete cache after settings
|
389 |
+
do_action( 'breeze_clear_all_cache' );
|
390 |
+
|
391 |
+
wp_send_json( $response );
|
392 |
+
}
|
393 |
+
|
394 |
/**
|
395 |
* Database tab only has actions for now and it will not save anything.
|
396 |
*
|
inc/cache/config-cache.php
CHANGED
@@ -53,15 +53,15 @@ class Breeze_ConfigCache {
|
|
53 |
switch_to_blog( $blog_id );
|
54 |
|
55 |
//if ( ! empty( Breeze_Options_Reader::get_option_value( 'breeze-active' ) ) ) {
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
//}
|
66 |
restore_current_blog();
|
67 |
}
|
@@ -180,8 +180,8 @@ class Breeze_ConfigCache {
|
|
180 |
public static function write_config_cache( $create_root_config = false ) {
|
181 |
|
182 |
if ( true === $create_root_config ) {
|
183 |
-
$network_id
|
184 |
-
$settings
|
185 |
#$settings = get_network_option( $network_id, 'breeze_basic_settings' );
|
186 |
$homepage_url = network_site_url();
|
187 |
} else {
|
@@ -204,14 +204,15 @@ class Breeze_ConfigCache {
|
|
204 |
|
205 |
$storage['wp-user-roles'] = breeze_all_wp_user_roles();
|
206 |
|
207 |
-
$lazy_load
|
208 |
-
$lazy_load_native
|
209 |
-
$preload_links
|
210 |
-
|
211 |
-
$storage['enabled-lazy-load'] = ( isset( $lazy_load ) ? $lazy_load : 0 );
|
212 |
-
$storage['use-lazy-load-native'] = ( isset( $lazy_load_native ) ? $lazy_load_native : 0 );
|
213 |
-
$storage['breeze-preload-links'] = ( isset( $preload_links ) ? $preload_links : 0 );
|
214 |
|
|
|
|
|
|
|
|
|
215 |
|
216 |
if ( isset( $_POST['woocommerce_default_customer_address'] ) ) {
|
217 |
$storage['woocommerce_geolocation_ajax'] = ( 'geolocation_ajax' === $_POST['woocommerce_default_customer_address'] ) ? 1 : 0;
|
53 |
switch_to_blog( $blog_id );
|
54 |
|
55 |
//if ( ! empty( Breeze_Options_Reader::get_option_value( 'breeze-active' ) ) ) {
|
56 |
+
$inherit_option = get_blog_option( $blog_id, 'breeze_inherit_settings', '0' );
|
57 |
+
$inherit_option = filter_var( $inherit_option, FILTER_VALIDATE_BOOLEAN );
|
58 |
+
if ( false === $inherit_option ) {
|
59 |
+
// Site uses own (custom) configuration.
|
60 |
+
$cache_configs["breeze-config-{$blog_id}"] = preg_replace( '(^https?://)', '', site_url() );
|
61 |
+
} else {
|
62 |
+
// Site uses global configuration.
|
63 |
+
$cache_configs['breeze-config'][ $blog_id ] = preg_replace( '(^https?://)', '', site_url() );
|
64 |
+
}
|
65 |
//}
|
66 |
restore_current_blog();
|
67 |
}
|
180 |
public static function write_config_cache( $create_root_config = false ) {
|
181 |
|
182 |
if ( true === $create_root_config ) {
|
183 |
+
$network_id = get_current_network_id();
|
184 |
+
$settings = Breeze_Options_Reader::fetch_all_saved_settings( true );
|
185 |
#$settings = get_network_option( $network_id, 'breeze_basic_settings' );
|
186 |
$homepage_url = network_site_url();
|
187 |
} else {
|
204 |
|
205 |
$storage['wp-user-roles'] = breeze_all_wp_user_roles();
|
206 |
|
207 |
+
$lazy_load = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load', false, $create_root_config );
|
208 |
+
$lazy_load_native = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-native', false, $create_root_config );
|
209 |
+
$preload_links = Breeze_Options_Reader::get_option_value( 'breeze-preload-links', false, $create_root_config );
|
210 |
+
$lazy_load_iframes = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-iframes', false, $create_root_config );
|
|
|
|
|
|
|
211 |
|
212 |
+
$storage['enabled-lazy-load'] = ( isset( $lazy_load ) ? $lazy_load : 0 );
|
213 |
+
$storage['use-lazy-load-native'] = ( isset( $lazy_load_native ) ? $lazy_load_native : 0 );
|
214 |
+
$storage['breeze-preload-links'] = ( isset( $preload_links ) ? $preload_links : 0 );
|
215 |
+
$storage['breeze-lazy-load-iframes'] = ( isset( $lazy_load_iframes ) ? $lazy_load_iframes : 0 );
|
216 |
|
217 |
if ( isset( $_POST['woocommerce_default_customer_address'] ) ) {
|
218 |
$storage['woocommerce_geolocation_ajax'] = ( 'geolocation_ajax' === $_POST['woocommerce_default_customer_address'] ) ? 1 : 0;
|
inc/cache/execute-cache.php
CHANGED
@@ -554,7 +554,6 @@ function check_exclude_page( $opts_config, $current_url ) {
|
|
554 |
|
555 |
$exclude_url = ltrim( $exclude_url, 'https:' );
|
556 |
$current_url = ltrim( $current_url, 'https:' );
|
557 |
-
|
558 |
if ( mb_strtolower( $exclude_url ) === mb_strtolower( $current_url ) ) {
|
559 |
return true;
|
560 |
}
|
554 |
|
555 |
$exclude_url = ltrim( $exclude_url, 'https:' );
|
556 |
$current_url = ltrim( $current_url, 'https:' );
|
|
|
557 |
if ( mb_strtolower( $exclude_url ) === mb_strtolower( $current_url ) ) {
|
558 |
return true;
|
559 |
}
|
inc/cache/purge-per-time.php
CHANGED
@@ -21,8 +21,8 @@
|
|
21 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
22 |
|
23 |
class Breeze_PurgeCacheTime {
|
24 |
-
protected $timettl
|
25 |
-
protected $normalcache
|
26 |
protected $varnishcache = 0;
|
27 |
|
28 |
public function __construct( $settings = null ) {
|
21 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
22 |
|
23 |
class Breeze_PurgeCacheTime {
|
24 |
+
protected $timettl = false;
|
25 |
+
protected $normalcache = 0;
|
26 |
protected $varnishcache = 0;
|
27 |
|
28 |
public function __construct( $settings = null ) {
|
inc/cache/purge-varnish.php
CHANGED
@@ -22,9 +22,9 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
|
22 |
|
23 |
class Breeze_PurgeVarnish {
|
24 |
protected $blogId;
|
25 |
-
protected $urlsPurge
|
26 |
-
protected $auto_purge
|
27 |
-
protected $actions
|
28 |
'switch_theme', // After a theme is changed
|
29 |
'save_post', // Save a post
|
30 |
'deleted_post', // Delete a post
|
22 |
|
23 |
class Breeze_PurgeVarnish {
|
24 |
protected $blogId;
|
25 |
+
protected $urlsPurge = array();
|
26 |
+
protected $auto_purge = false;
|
27 |
+
protected $actions = array(
|
28 |
'switch_theme', // After a theme is changed
|
29 |
'save_post', // Save a post
|
30 |
'deleted_post', // Delete a post
|
inc/class-breeze-dns-prefetch.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
header( 'Status: 403 Forbidden' );
|
4 |
+
header( 'HTTP/1.1 403 Forbidden' );
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
class Breeze_DNS_Prefetch {
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
add_filter( 'wp_resource_hints', array( &$this, 'breeze_dns_prefetch' ), 10, 2 );
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Optimize by adding URLs to the prefetch DNS list.
|
16 |
+
*
|
17 |
+
* @param array $urls Array of resources and their attributes, or URLs to print for resource hints.
|
18 |
+
* @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
|
19 |
+
*
|
20 |
+
* @return array
|
21 |
+
* @since 2.0.2
|
22 |
+
* @access public
|
23 |
+
*/
|
24 |
+
public function breeze_dns_prefetch( $urls, $relation_type ) {
|
25 |
+
|
26 |
+
$prefetch_url_list = Breeze_Options_Reader::get_option_value( 'breeze-prefetch-urls' );
|
27 |
+
if ( ! is_array( $prefetch_url_list ) ) {
|
28 |
+
$prefetch_url_list = array();
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! empty( $prefetch_url_list ) ) {
|
32 |
+
$prefetch_url_list = array_map( 'breeze_rtrim_urls', $prefetch_url_list );
|
33 |
+
$prefetch_url_list = array_map( array( $this, 'clean_schema' ), $prefetch_url_list );
|
34 |
+
|
35 |
+
foreach ( $prefetch_url_list as $url_domain ) {
|
36 |
+
|
37 |
+
if ( 'dns-prefetch' === $relation_type ) {
|
38 |
+
$urls[] = $url_domain;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return $urls;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Remove link schema.
|
48 |
+
*
|
49 |
+
* @param string $current_url Given url string.
|
50 |
+
*
|
51 |
+
* @return string
|
52 |
+
* @since 2.0.2
|
53 |
+
* @access public
|
54 |
+
*/
|
55 |
+
private function clean_schema( $current_url ) {
|
56 |
+
return ltrim( $current_url, 'https:' );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
new Breeze_DNS_Prefetch();
|
inc/class-breeze-file-permissions.php
CHANGED
@@ -15,6 +15,30 @@ class Breeze_File_Permissions {
|
|
15 |
|
16 |
add_action( 'admin_notices', array( &$this, 'display_the_errors' ) );
|
17 |
add_action( 'network_admin_notices', array( &$this, 'display_the_errors' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
// The object is created from within the class itself
|
@@ -51,7 +75,9 @@ class Breeze_File_Permissions {
|
|
51 |
// Advanced cache file.
|
52 |
$file = $wp_content_dir . 'advanced-cache.php';
|
53 |
|
54 |
-
if ( !
|
|
|
|
|
55 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
56 |
}
|
57 |
|
@@ -75,9 +101,15 @@ class Breeze_File_Permissions {
|
|
75 |
* Checking multisite specific folders.
|
76 |
*/
|
77 |
if ( is_multisite() ) {
|
|
|
|
|
78 |
if ( is_network_admin() ) {
|
|
|
79 |
$file = $wp_content_dir . 'breeze-config/breeze-config.php';
|
80 |
-
|
|
|
|
|
|
|
81 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
82 |
}
|
83 |
|
@@ -111,6 +143,7 @@ class Breeze_File_Permissions {
|
|
111 |
}
|
112 |
}
|
113 |
} else {
|
|
|
114 |
$the_blog_id = get_current_blog_id();
|
115 |
|
116 |
$inherit_option = get_blog_option( $the_blog_id, 'breeze_inherit_settings' );
|
@@ -123,7 +156,9 @@ class Breeze_File_Permissions {
|
|
123 |
|
124 |
|
125 |
$file = $wp_content_dir . 'breeze-config/breeze-config-' . $the_blog_id . '.php';
|
126 |
-
if ( false === $inherit_option &&
|
|
|
|
|
127 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
128 |
}
|
129 |
|
@@ -147,8 +182,12 @@ class Breeze_File_Permissions {
|
|
147 |
}// endif
|
148 |
}
|
149 |
} else {
|
|
|
150 |
$file = $wp_content_dir . 'breeze-config/breeze-config.php';
|
151 |
-
|
|
|
|
|
|
|
152 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
153 |
}
|
154 |
|
@@ -177,7 +216,7 @@ class Breeze_File_Permissions {
|
|
177 |
|
178 |
$this->check_specific_files_folders();
|
179 |
if ( ! empty( self::$errors ) ) {
|
180 |
-
echo '<div class="notice notice-error is-dismissible">';
|
181 |
echo '<p><strong>' . __( 'Breeze settings will not reflect because there is file permission issue', 'breeze' ) . '</strong></p>';
|
182 |
foreach ( self::$errors as $message ) {
|
183 |
echo '<p>' . $message . '</p>';
|
15 |
|
16 |
add_action( 'admin_notices', array( &$this, 'display_the_errors' ) );
|
17 |
add_action( 'network_admin_notices', array( &$this, 'display_the_errors' ) );
|
18 |
+
|
19 |
+
add_action( 'wp_ajax_breeze_file_permission_check', array( &$this, 'breeze_check_the_files_permission' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
public function breeze_check_the_files_permission() {
|
23 |
+
$this->check_specific_files_folders();
|
24 |
+
$message_display = '';
|
25 |
+
if ( ! empty( self::$errors ) ) {
|
26 |
+
$message_display .= '<div class="notice notice-error is-dismissible breeze-per" style="margin-left:2px">';
|
27 |
+
$message_display .= '<p><strong>' . __( 'Breeze settings will not reflect because there is file permission issue', 'breeze' ) . '</strong></p>';
|
28 |
+
foreach ( self::$errors as $message ) {
|
29 |
+
$message_display .= '<p>' . $message . '</p>';
|
30 |
+
}
|
31 |
+
$message_display .= '<p>';
|
32 |
+
$message_display .= sprintf(
|
33 |
+
'<a href="%s" target="_blank">%s</a>',
|
34 |
+
esc_url( 'https://support.cloudways.com/en/articles/5126387-how-can-i-reset-file-and-folder-permissions' ),
|
35 |
+
esc_html__( 'For reference please click on the KB', 'breeze' )
|
36 |
+
);
|
37 |
+
$message_display .= '</p>';
|
38 |
+
$message_display .= '</div>';
|
39 |
+
}
|
40 |
+
|
41 |
+
wp_die( $message_display );
|
42 |
}
|
43 |
|
44 |
// The object is created from within the class itself
|
75 |
// Advanced cache file.
|
76 |
$file = $wp_content_dir . 'advanced-cache.php';
|
77 |
|
78 |
+
if ( ! file_exists( $file ) ) {
|
79 |
+
self::append_permission_error( $file . __( ' file does not exist. Save Breeze settings to create the file.', 'breeze' ) );
|
80 |
+
} else if ( ! is_writable( $file ) ) {
|
81 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
82 |
}
|
83 |
|
101 |
* Checking multisite specific folders.
|
102 |
*/
|
103 |
if ( is_multisite() ) {
|
104 |
+
set_as_network_screen();
|
105 |
+
|
106 |
if ( is_network_admin() ) {
|
107 |
+
|
108 |
$file = $wp_content_dir . 'breeze-config/breeze-config.php';
|
109 |
+
|
110 |
+
if ( ! file_exists( $file ) ) {
|
111 |
+
self::append_permission_error( $file . __( ' file does not exist. Save Breeze settings to create the file.', 'breeze' ) );
|
112 |
+
} elseif ( ! is_writable( $file ) ) {
|
113 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
114 |
}
|
115 |
|
143 |
}
|
144 |
}
|
145 |
} else {
|
146 |
+
|
147 |
$the_blog_id = get_current_blog_id();
|
148 |
|
149 |
$inherit_option = get_blog_option( $the_blog_id, 'breeze_inherit_settings' );
|
156 |
|
157 |
|
158 |
$file = $wp_content_dir . 'breeze-config/breeze-config-' . $the_blog_id . '.php';
|
159 |
+
if ( false === $inherit_option && ! file_exists( $file ) ) {
|
160 |
+
self::append_permission_error( $file . __( ' file does not exist. Save Breeze settings to create the file.', 'breeze' ) );
|
161 |
+
} elseif ( false === $inherit_option && file_exists( $file ) && ! is_writable( $file ) ) {
|
162 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
163 |
}
|
164 |
|
182 |
}// endif
|
183 |
}
|
184 |
} else {
|
185 |
+
|
186 |
$file = $wp_content_dir . 'breeze-config/breeze-config.php';
|
187 |
+
|
188 |
+
if ( ! file_exists( $file ) ) {
|
189 |
+
self::append_permission_error( $file . __( ' file does not exist. Save Breeze settings to create the file.', 'breeze' ) );
|
190 |
+
} elseif ( ! is_writable( $file ) ) {
|
191 |
self::append_permission_error( $file . __( ' file is not writable.', 'breeze' ) );
|
192 |
}
|
193 |
|
216 |
|
217 |
$this->check_specific_files_folders();
|
218 |
if ( ! empty( self::$errors ) ) {
|
219 |
+
echo '<div class="notice notice-error is-dismissible breeze-per" style="margin-left:2px">';
|
220 |
echo '<p><strong>' . __( 'Breeze settings will not reflect because there is file permission issue', 'breeze' ) . '</strong></p>';
|
221 |
foreach ( self::$errors as $message ) {
|
222 |
echo '<p>' . $message . '</p>';
|
inc/class-breeze-heartbeat-settings.php
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handle Heartbeat options.
|
5 |
+
* @since 2.0.2
|
6 |
+
*/
|
7 |
+
class Breeze_Heartbeat_Settings {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Front-end Heartbeat option.
|
11 |
+
* @var string
|
12 |
+
* @access private
|
13 |
+
* @since 2.0.2
|
14 |
+
*/
|
15 |
+
private $heartbeat_frontend = '';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Post Editor Heartbeat option.
|
19 |
+
* @var string
|
20 |
+
* @access private
|
21 |
+
* @since 2.0.2
|
22 |
+
*/
|
23 |
+
private $heartbeat_editor = '';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Back-end Heartbeat option.
|
27 |
+
* @var string
|
28 |
+
* @access private
|
29 |
+
* @since 2.0.2
|
30 |
+
*/
|
31 |
+
private $heartbeat_backend = '';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Whether the option is enabled in Breeze plugin.
|
35 |
+
* @var bool
|
36 |
+
*/
|
37 |
+
private $heartbeat_active = false;
|
38 |
+
|
39 |
+
function __construct() {
|
40 |
+
$options = $this->fetch_heartbeat_options();
|
41 |
+
$this->heartbeat_frontend = $options['front-end'];
|
42 |
+
$this->heartbeat_editor = $options['editor'];
|
43 |
+
$this->heartbeat_backend = $options['back-end'];
|
44 |
+
$this->heartbeat_active = $options['active-status'];
|
45 |
+
|
46 |
+
// Disable script in back-end if setting is set to disable.
|
47 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'deregister_heartbeat_script' ), 99 );
|
48 |
+
// Disable script in front-end if setting is set to disable.
|
49 |
+
add_action( 'wp_enqueue_scripts', array( &$this, 'deregister_heartbeat_script' ), 99 );
|
50 |
+
// Change the timer for heartbeat.
|
51 |
+
add_filter( 'heartbeat_settings', array( &$this, 'change_heartbeat_interval' ), 99, 1 );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Change the Heartbeat interval timer.
|
56 |
+
*
|
57 |
+
* @return void
|
58 |
+
* @since public
|
59 |
+
* @since 2.0.2
|
60 |
+
* @see https://developer.wordpress.org/reference/hooks/heartbeat_settings/
|
61 |
+
*/
|
62 |
+
public function change_heartbeat_interval( $settings ) {
|
63 |
+
// If the option is not enabled in Breeze, skip this step.
|
64 |
+
|
65 |
+
if ( false === $this->heartbeat_active ) {
|
66 |
+
return $settings;
|
67 |
+
}
|
68 |
+
|
69 |
+
$location = $this->detect_current_screen();
|
70 |
+
|
71 |
+
if (
|
72 |
+
'front-end' === $location &&
|
73 |
+
is_numeric( $this->heartbeat_frontend )
|
74 |
+
) {
|
75 |
+
$settings['interval'] = intval( $this->heartbeat_frontend );
|
76 |
+
}
|
77 |
+
|
78 |
+
if (
|
79 |
+
'back-end' === $location &&
|
80 |
+
is_numeric( $this->heartbeat_backend )
|
81 |
+
) {
|
82 |
+
$settings['interval'] = intval( $this->heartbeat_backend );
|
83 |
+
}
|
84 |
+
|
85 |
+
if (
|
86 |
+
'editor' === $location &&
|
87 |
+
is_numeric( $this->heartbeat_editor )
|
88 |
+
) {
|
89 |
+
$settings['interval'] = intval( $this->heartbeat_editor );
|
90 |
+
}
|
91 |
+
|
92 |
+
return $settings;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Disable Heartbeat scrip if setting is set to disable.
|
97 |
+
* @return void
|
98 |
+
* @access public
|
99 |
+
* @since 2.0.2
|
100 |
+
*/
|
101 |
+
public function deregister_heartbeat_script() {
|
102 |
+
// If the option is not enabled in Breeze, skip this step.
|
103 |
+
if ( false === $this->heartbeat_active ) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
$location = $this->detect_current_screen();
|
108 |
+
|
109 |
+
$disable_script = false;
|
110 |
+
|
111 |
+
if (
|
112 |
+
'front-end' === $location &&
|
113 |
+
'disable' === $this->heartbeat_frontend
|
114 |
+
) {
|
115 |
+
$disable_script = true;
|
116 |
+
}
|
117 |
+
|
118 |
+
if (
|
119 |
+
'back-end' === $location &&
|
120 |
+
'disable' === $this->heartbeat_backend
|
121 |
+
) {
|
122 |
+
$disable_script = true;
|
123 |
+
}
|
124 |
+
|
125 |
+
if (
|
126 |
+
'editor' === $location &&
|
127 |
+
'disable' === $this->heartbeat_editor
|
128 |
+
) {
|
129 |
+
$disable_script = true;
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( true === $disable_script ) {
|
133 |
+
wp_deregister_script( 'heartbeat' );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Used to detect if we are in front-end, back-end or WP editor.
|
139 |
+
*
|
140 |
+
* @return string|void
|
141 |
+
* @access private
|
142 |
+
* @since 2.0.2
|
143 |
+
*/
|
144 |
+
private function detect_current_screen() {
|
145 |
+
|
146 |
+
if ( ! is_admin() ) {
|
147 |
+
return 'front-end';
|
148 |
+
}
|
149 |
+
|
150 |
+
if ( is_admin() ) {
|
151 |
+
$the_current_url = $_SERVER['REQUEST_URI'];
|
152 |
+
preg_match( '/\/wp-admin\/post(-new)?\.php/', $the_current_url, $output_array );
|
153 |
+
|
154 |
+
if ( !empty( $output_array ) ) {
|
155 |
+
return 'editor';
|
156 |
+
} else {
|
157 |
+
return 'back-end';
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Fetch the Breeze settings for Heartbeat.
|
165 |
+
*
|
166 |
+
* @return array
|
167 |
+
* @access private
|
168 |
+
* @since 2.0.2
|
169 |
+
*/
|
170 |
+
private function fetch_heartbeat_options() {
|
171 |
+
|
172 |
+
if ( is_multisite() ) {
|
173 |
+
$get_inherit = get_option( 'breeze_inherit_settings', '1' );
|
174 |
+
$is_custom = filter_var( $get_inherit, FILTER_VALIDATE_BOOLEAN );
|
175 |
+
|
176 |
+
set_as_network_screen();
|
177 |
+
if ( true === $is_custom ) {
|
178 |
+
$option = get_site_option( 'breeze_heartbeat_settings', array() );
|
179 |
+
} else {
|
180 |
+
$network_id = get_current_blog_id();
|
181 |
+
$option = get_blog_option( $network_id, 'breeze_heartbeat_settings' );
|
182 |
+
}
|
183 |
+
} else {
|
184 |
+
$option = get_option( 'breeze_heartbeat_settings', array() );
|
185 |
+
}
|
186 |
+
|
187 |
+
$heartbeat_options['front-end'] = isset( $option['breeze-heartbeat-front'] ) ? $option['breeze-heartbeat-front'] : '';
|
188 |
+
$heartbeat_options['editor'] = isset( $option['breeze-heartbeat-postedit'] ) ? $option['breeze-heartbeat-postedit'] : '';
|
189 |
+
$heartbeat_options['back-end'] = isset( $option['breeze-heartbeat-backend'] ) ? $option['breeze-heartbeat-backend'] : '';
|
190 |
+
$heartbeat_options['active-status'] = isset( $option['breeze-control-heartbeat'] ) ? filter_var( $option['breeze-control-heartbeat'], FILTER_VALIDATE_BOOLEAN ) : false;
|
191 |
+
|
192 |
+
return $heartbeat_options;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
new Breeze_Heartbeat_Settings();
|
inc/class-breeze-lazy-load.php
CHANGED
@@ -108,9 +108,7 @@ class Breeze_Lazy_Load {
|
|
108 |
$html_dom->loadHTML( $content, LIBXML_NOERROR ); // | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD
|
109 |
|
110 |
$dom_last_error = libxml_get_last_error();
|
111 |
-
|
112 |
-
$dom_all_error = libxml_get_errors();
|
113 |
-
#error_log( '$dom_all_error: ' . var_export( $dom_all_error, true ) );
|
114 |
|
115 |
$dom_xpath = new DOMXPath( $html_dom );
|
116 |
/**
|
@@ -181,6 +179,85 @@ class Breeze_Lazy_Load {
|
|
181 |
}
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
return $html_dom->saveHTML();
|
185 |
}
|
186 |
|
108 |
$html_dom->loadHTML( $content, LIBXML_NOERROR ); // | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD
|
109 |
|
110 |
$dom_last_error = libxml_get_last_error();
|
111 |
+
$dom_all_error = libxml_get_errors();
|
|
|
|
|
112 |
|
113 |
$dom_xpath = new DOMXPath( $html_dom );
|
114 |
/**
|
179 |
}
|
180 |
}
|
181 |
|
182 |
+
|
183 |
+
$apply_to_iframes = Breeze_Options_Reader::get_option_value( 'breeze-lazy-load-iframes' );
|
184 |
+
$apply_to_iframes = apply_filters( 'breeze_enable_lazy_load_iframes', $apply_to_iframes );
|
185 |
+
|
186 |
+
if ( true === filter_var( $apply_to_iframes, FILTER_VALIDATE_BOOLEAN ) ) {
|
187 |
+
// Iterate each iframe item found in the content.
|
188 |
+
foreach ( $html_dom->getElementsByTagName( 'iframe' ) as $iframe ) {
|
189 |
+
// fetch iframe video source.
|
190 |
+
$src = $iframe->getAttribute( 'src' );
|
191 |
+
|
192 |
+
$allowed_url = false;
|
193 |
+
$allowed_iframes_url = apply_filters( 'breeze_iframe_lazy_load_list', array(
|
194 |
+
'youtube.com',
|
195 |
+
'dailymotion.com/embed/video',
|
196 |
+
'facebook.com/plugins/video.php',
|
197 |
+
'player.vimeo.com',
|
198 |
+
'fast.wistia.net/embed/',
|
199 |
+
'players.brightcove.net',
|
200 |
+
's3.amazonaws.com',
|
201 |
+
'cincopa.com/media',
|
202 |
+
'twitch.tv',
|
203 |
+
'bitchute.com',
|
204 |
+
'media.myspace.com/play/video',
|
205 |
+
'tiktok.com/embed',
|
206 |
+
) );
|
207 |
+
|
208 |
+
foreach ( $allowed_iframes_url as $iframe_url ) {
|
209 |
+
if ( false !== strpos( $src, $iframe_url ) ) {
|
210 |
+
$allowed_url = true;
|
211 |
+
break;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
// We only need iframes that handle youtube videos.
|
216 |
+
if ( true === $allowed_url ) {
|
217 |
+
// Fetch the video ID from iframe source.
|
218 |
+
$video_link = explode( '/', $src );
|
219 |
+
$video_id = end( $video_link );
|
220 |
+
|
221 |
+
// Set the video ID as attribute on iframe.
|
222 |
+
$iframe->setAttribute( 'data-video-id', $video_id );
|
223 |
+
|
224 |
+
// Fetch the current CSS classes if any
|
225 |
+
$current_classes = $iframe->getAttribute( 'class' );
|
226 |
+
if ( ! empty( trim( $current_classes ) ) ) {
|
227 |
+
$current_classes .= ' ';
|
228 |
+
}
|
229 |
+
$current_classes .= 'br-lazy';
|
230 |
+
|
231 |
+
// Remove the current CSS class attribute.
|
232 |
+
$iframe->removeAttribute( 'class' );
|
233 |
+
// Add the CSS classes back including the extra.
|
234 |
+
$iframe->setAttribute( 'class', $current_classes );
|
235 |
+
|
236 |
+
$iframe->setAttribute( 'data-breeze', $src );
|
237 |
+
$iframe->removeAttribute( 'src' );
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
foreach ( $html_dom->getElementsByTagName( 'video' ) as $video_tab ) {
|
242 |
+
$src = $video_tab->getAttribute( 'src' );
|
243 |
+
|
244 |
+
// Fetch the current CSS classes if any
|
245 |
+
$current_classes = $video_tab->getAttribute( 'class' );
|
246 |
+
if ( ! empty( trim( $current_classes ) ) ) {
|
247 |
+
$current_classes .= ' ';
|
248 |
+
}
|
249 |
+
$current_classes .= 'br-lazy';
|
250 |
+
|
251 |
+
// Remove the current CSS class attribute.
|
252 |
+
$video_tab->removeAttribute( 'class' );
|
253 |
+
// Add the CSS classes back including the extra.
|
254 |
+
$video_tab->setAttribute( 'class', $current_classes );
|
255 |
+
|
256 |
+
$video_tab->setAttribute( 'data-breeze', $src );
|
257 |
+
$video_tab->removeAttribute( 'src' );
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
return $html_dom->saveHTML();
|
262 |
}
|
263 |
|
inc/class-breeze-options-reader.php
CHANGED
@@ -51,6 +51,7 @@ class Breeze_Options_Reader {
|
|
51 |
'file_settings',
|
52 |
'preload_settings',
|
53 |
'advanced_settings',
|
|
|
54 |
'cdn_integration',
|
55 |
'varnish_cache',
|
56 |
'inherit_settings',
|
51 |
'file_settings',
|
52 |
'preload_settings',
|
53 |
'advanced_settings',
|
54 |
+
'heartbeat_settings',
|
55 |
'cdn_integration',
|
56 |
'varnish_cache',
|
57 |
'inherit_settings',
|
inc/class-breeze-prefetch.php
CHANGED
@@ -27,6 +27,7 @@ if ( ! class_exists( 'Breeze_Prefetch' ) ) {
|
|
27 |
public function load_prefetch_scripts() {
|
28 |
// Check if the option is enabled by admin.
|
29 |
$preload_links = Breeze_Options_Reader::get_option_value( 'breeze-preload-links' );
|
|
|
30 |
if ( isset( $preload_links ) && true === filter_var( $preload_links, FILTER_VALIDATE_BOOLEAN ) ) {
|
31 |
// Load the prefetch library.
|
32 |
wp_enqueue_script( 'breeze-prefetch', BREEZE_PLUGIN_URL . 'assets/js/js-front-end/breeze-prefetch-links.min.js', array(), BREEZE_VERSION, false );
|
@@ -44,7 +45,7 @@ if ( ! class_exists( 'Breeze_Prefetch' ) ) {
|
|
44 |
|
45 |
|
46 |
/**
|
47 |
-
* The list of links that do not need
|
48 |
*
|
49 |
* @return array|mixed
|
50 |
* @since 1.2.0
|
27 |
public function load_prefetch_scripts() {
|
28 |
// Check if the option is enabled by admin.
|
29 |
$preload_links = Breeze_Options_Reader::get_option_value( 'breeze-preload-links' );
|
30 |
+
|
31 |
if ( isset( $preload_links ) && true === filter_var( $preload_links, FILTER_VALIDATE_BOOLEAN ) ) {
|
32 |
// Load the prefetch library.
|
33 |
wp_enqueue_script( 'breeze-prefetch', BREEZE_PLUGIN_URL . 'assets/js/js-front-end/breeze-prefetch-links.min.js', array(), BREEZE_VERSION, false );
|
45 |
|
46 |
|
47 |
/**
|
48 |
+
* The list of links that do not need pre-fetch.
|
49 |
*
|
50 |
* @return array|mixed
|
51 |
* @since 1.2.0
|
inc/class-exclude-pages-by-shortcode.php
CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
class Exclude_Pages_By_Shortcode {
|
15 |
|
16 |
function __construct() {
|
17 |
-
add_action( 'save_post',
|
18 |
}
|
19 |
|
20 |
public function post_check_content_on_save( $post_id = 0, $post = null, $update = false ) {
|
14 |
class Exclude_Pages_By_Shortcode {
|
15 |
|
16 |
function __construct() {
|
17 |
+
add_action( 'save_post', array( &$this, 'post_check_content_on_save' ), 10, 3 );
|
18 |
}
|
19 |
|
20 |
public function post_check_content_on_save( $post_id = 0, $post = null, $update = false ) {
|
inc/helpers.php
CHANGED
@@ -1017,3 +1017,7 @@ function breeze_migrate_old_settings( $is_sigle = true, $subsite_id = 0, $is_roo
|
|
1017 |
update_site_option( 'breeze_varnish_cache', $varnish );
|
1018 |
}
|
1019 |
}
|
|
|
|
|
|
|
|
1017 |
update_site_option( 'breeze_varnish_cache', $varnish );
|
1018 |
}
|
1019 |
}
|
1020 |
+
|
1021 |
+
function breeze_rtrim_urls( $url ) {
|
1022 |
+
return rtrim( $url, '/' );
|
1023 |
+
}
|
inc/wp-cli/class-breeze-cli-helpers.php
CHANGED
@@ -66,4 +66,4 @@ class Breeze_Cli_Helpers {
|
|
66 |
WP_CLI::line( WP_CLI::colorize( '%Y--level=%n%GblogID|network%n will clear cache for the specified blogID or at network level(all sub-sites).' ) );
|
67 |
WP_CLI::line( '---' );
|
68 |
}
|
69 |
-
}
|
66 |
WP_CLI::line( WP_CLI::colorize( '%Y--level=%n%GblogID|network%n will clear cache for the specified blogID or at network level(all sub-sites).' ) );
|
67 |
WP_CLI::line( '---' );
|
68 |
}
|
69 |
+
}
|
inc/wp-cli/class-breeze-settings-import-export.php
CHANGED
@@ -122,24 +122,26 @@ class Breeze_Settings_Import_Export {
|
|
122 |
if ( is_multisite() ) {
|
123 |
// If this export is made from network admin
|
124 |
if ( 'network' === $level ) {
|
125 |
-
$breeze_basic_settings
|
126 |
-
$breeze_advanced_settings
|
127 |
-
$
|
128 |
-
$
|
129 |
-
$
|
130 |
-
$
|
|
|
131 |
|
132 |
// Extra options
|
133 |
$breeze_first_install = get_site_option( 'breeze_first_install' );
|
134 |
$breeze_advanced_settings_120 = get_site_option( 'breeze_advanced_settings_120' );
|
135 |
} else { // if this export is made from sub-site.
|
136 |
-
$network_id
|
137 |
-
$breeze_basic_settings
|
138 |
-
$breeze_advanced_settings
|
139 |
-
$
|
140 |
-
$
|
141 |
-
$
|
142 |
-
$
|
|
|
143 |
|
144 |
// Extra options
|
145 |
$breeze_first_install = get_blog_option( $network_id, 'breeze_first_install' );
|
@@ -148,12 +150,13 @@ class Breeze_Settings_Import_Export {
|
|
148 |
$breeze_advanced_settings_120 = get_blog_option( $network_id, 'breeze_advanced_settings_120' );
|
149 |
}
|
150 |
} else { // If WP is single site.
|
151 |
-
$breeze_basic_settings
|
152 |
-
$breeze_advanced_settings
|
153 |
-
$
|
154 |
-
$
|
155 |
-
$
|
156 |
-
$
|
|
|
157 |
|
158 |
// Extra options
|
159 |
$breeze_first_install = get_option( 'breeze_first_install' );
|
@@ -161,10 +164,11 @@ class Breeze_Settings_Import_Export {
|
|
161 |
$breeze_advanced_settings_120 = get_option( 'breeze_advanced_settings_120' );
|
162 |
}
|
163 |
|
164 |
-
$export['breeze_basic_settings']
|
165 |
-
$export['breeze_advanced_settings']
|
166 |
-
$export['
|
167 |
-
$export['
|
|
|
168 |
|
169 |
// Extra options
|
170 |
if ( isset( $breeze_first_install ) ) {
|
@@ -427,6 +431,13 @@ class Breeze_Settings_Import_Export {
|
|
427 |
'breeze-wp-emoji' => ( isset( $options['breeze-wp-emoji'] ) ? $options['breeze-wp-emoji'] : '0' ),
|
428 |
);
|
429 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
$wp_content = substr( WP_CONTENT_DIR, strlen( ABSPATH ) );
|
431 |
$cdn = array(
|
432 |
'cdn-active' => ( isset( $options['cdn-active'] ) ? $options['cdn-active'] : '0' ),
|
@@ -460,6 +471,7 @@ class Breeze_Settings_Import_Export {
|
|
460 |
update_site_option( 'breeze_file_settings', $file );
|
461 |
update_site_option( 'breeze_preload_settings', $preload );
|
462 |
update_site_option( 'breeze_advanced_settings', $advanced );
|
|
|
463 |
update_site_option( 'breeze_cdn_integration', $cdn );
|
464 |
update_site_option( 'breeze_varnish_cache', $varnish );
|
465 |
|
@@ -485,6 +497,7 @@ class Breeze_Settings_Import_Export {
|
|
485 |
update_blog_option( $blog_id, 'breeze_file_settings', $file );
|
486 |
update_blog_option( $blog_id, 'breeze_preload_settings', $preload );
|
487 |
update_blog_option( $blog_id, 'breeze_advanced_settings', $advanced );
|
|
|
488 |
update_blog_option( $blog_id, 'breeze_cdn_integration', $cdn );
|
489 |
update_blog_option( $blog_id, 'breeze_varnish_cache', $varnish );
|
490 |
|
@@ -506,6 +519,7 @@ class Breeze_Settings_Import_Export {
|
|
506 |
update_option( 'breeze_file_settings', $file );
|
507 |
update_option( 'breeze_preload_settings', $preload );
|
508 |
update_option( 'breeze_advanced_settings', $advanced );
|
|
|
509 |
update_option( 'breeze_cdn_integration', $cdn );
|
510 |
update_option( 'breeze_varnish_cache', $varnish );
|
511 |
|
@@ -537,6 +551,26 @@ class Breeze_Settings_Import_Export {
|
|
537 |
* @static
|
538 |
*/
|
539 |
private static function validate_json_entry( $value, $option = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
|
541 |
/**
|
542 |
* Treat options that are not checkbox or array.
|
@@ -602,6 +636,7 @@ class Breeze_Settings_Import_Export {
|
|
602 |
'breeze-browser-cache' => '1',
|
603 |
'breeze-lazy-load' => '0',
|
604 |
'breeze-lazy-load-native' => '0',
|
|
|
605 |
'breeze-desktop-cache' => '1',
|
606 |
'breeze-mobile-cache' => '1',
|
607 |
'breeze-display-clean' => '1',
|
@@ -620,6 +655,7 @@ class Breeze_Settings_Import_Export {
|
|
620 |
'cdn-relative-path' => '1',
|
621 |
'auto-purge-varnish' => '1',
|
622 |
'breeze_inherit_settings' => '0',
|
|
|
623 |
);
|
624 |
|
625 |
if ( array_key_exists( $option, $checkboxes ) ) {
|
@@ -687,6 +723,7 @@ class Breeze_Settings_Import_Export {
|
|
687 |
'cached-query-strings' => array(),
|
688 |
'cdn-content' => array( 'wp-includes', $wp_content ),
|
689 |
'cdn-exclude-content' => array( '.php' ),
|
|
|
690 |
);
|
691 |
|
692 |
if ( array_key_exists( $option, $array_list ) ) {
|
122 |
if ( is_multisite() ) {
|
123 |
// If this export is made from network admin
|
124 |
if ( 'network' === $level ) {
|
125 |
+
$breeze_basic_settings = get_site_option( 'breeze_basic_settings' );
|
126 |
+
$breeze_advanced_settings = get_site_option( 'breeze_advanced_settings' );
|
127 |
+
$breeze_heartbeat_settings = get_site_option( 'breeze_heartbeat_settings' );
|
128 |
+
$breeze_cdn_integration = get_site_option( 'breeze_cdn_integration' );
|
129 |
+
$breeze_varnish_cache = get_site_option( 'breeze_varnish_cache' );
|
130 |
+
$breeze_file_settings = get_site_option( 'breeze_file_settings' );
|
131 |
+
$breeze_preload_settings = get_site_option( 'breeze_preload_settings' );
|
132 |
|
133 |
// Extra options
|
134 |
$breeze_first_install = get_site_option( 'breeze_first_install' );
|
135 |
$breeze_advanced_settings_120 = get_site_option( 'breeze_advanced_settings_120' );
|
136 |
} else { // if this export is made from sub-site.
|
137 |
+
$network_id = (int) $level;
|
138 |
+
$breeze_basic_settings = get_blog_option( $network_id, 'breeze_basic_settings' );
|
139 |
+
$breeze_advanced_settings = get_blog_option( $network_id, 'breeze_advanced_settings' );
|
140 |
+
$breeze_heartbeat_settings = get_blog_option( $network_id, 'breeze_heartbeat_settings' );
|
141 |
+
$breeze_cdn_integration = get_blog_option( $network_id, 'breeze_cdn_integration' );
|
142 |
+
$breeze_varnish_cache = get_blog_option( $network_id, 'breeze_varnish_cache' );
|
143 |
+
$breeze_file_settings = get_blog_option( $network_id, 'breeze_file_settings' );
|
144 |
+
$breeze_preload_settings = get_blog_option( $network_id, 'breeze_preload_settings' );
|
145 |
|
146 |
// Extra options
|
147 |
$breeze_first_install = get_blog_option( $network_id, 'breeze_first_install' );
|
150 |
$breeze_advanced_settings_120 = get_blog_option( $network_id, 'breeze_advanced_settings_120' );
|
151 |
}
|
152 |
} else { // If WP is single site.
|
153 |
+
$breeze_basic_settings = get_option( 'breeze_basic_settings' );
|
154 |
+
$breeze_advanced_settings = get_option( 'breeze_advanced_settings' );
|
155 |
+
$breeze_heartbeat_settings = get_option( 'breeze_heartbeat_settings' );
|
156 |
+
$breeze_cdn_integration = get_option( 'breeze_cdn_integration' );
|
157 |
+
$breeze_varnish_cache = get_option( 'breeze_varnish_cache' );
|
158 |
+
$breeze_file_settings = get_option( 'breeze_file_settings' );
|
159 |
+
$breeze_preload_settings = get_option( 'breeze_preload_settings' );
|
160 |
|
161 |
// Extra options
|
162 |
$breeze_first_install = get_option( 'breeze_first_install' );
|
164 |
$breeze_advanced_settings_120 = get_option( 'breeze_advanced_settings_120' );
|
165 |
}
|
166 |
|
167 |
+
$export['breeze_basic_settings'] = $breeze_basic_settings;
|
168 |
+
$export['breeze_advanced_settings'] = $breeze_advanced_settings;
|
169 |
+
$export['breeze_heartbeat_settings'] = $breeze_heartbeat_settings;
|
170 |
+
$export['breeze_cdn_integration'] = $breeze_cdn_integration;
|
171 |
+
$export['breeze_varnish_cache'] = $breeze_varnish_cache;
|
172 |
|
173 |
// Extra options
|
174 |
if ( isset( $breeze_first_install ) ) {
|
431 |
'breeze-wp-emoji' => ( isset( $options['breeze-wp-emoji'] ) ? $options['breeze-wp-emoji'] : '0' ),
|
432 |
);
|
433 |
|
434 |
+
$heartbeat = array(
|
435 |
+
'breeze-control-heartbeat' => ( isset( $options['breeze-control-heartbeat'] ) ? $options['breeze-control-heartbeat'] : '0' ),
|
436 |
+
'breeze-heartbeat-front' => ( isset( $options['breeze-heartbeat-front'] ) ? $options['breeze-heartbeat-front'] : '' ),
|
437 |
+
'breeze-heartbeat-postedit' => ( isset( $options['breeze-heartbeat-postedit'] ) ? $options['breeze-heartbeat-postedit'] : '' ),
|
438 |
+
'breeze-heartbeat-backend' => ( isset( $options['breeze-heartbeat-backend'] ) ? $options['breeze-heartbeat-backend'] : '' ),
|
439 |
+
);
|
440 |
+
|
441 |
$wp_content = substr( WP_CONTENT_DIR, strlen( ABSPATH ) );
|
442 |
$cdn = array(
|
443 |
'cdn-active' => ( isset( $options['cdn-active'] ) ? $options['cdn-active'] : '0' ),
|
471 |
update_site_option( 'breeze_file_settings', $file );
|
472 |
update_site_option( 'breeze_preload_settings', $preload );
|
473 |
update_site_option( 'breeze_advanced_settings', $advanced );
|
474 |
+
update_site_option( 'breeze_heartbeat_settings', $heartbeat );
|
475 |
update_site_option( 'breeze_cdn_integration', $cdn );
|
476 |
update_site_option( 'breeze_varnish_cache', $varnish );
|
477 |
|
497 |
update_blog_option( $blog_id, 'breeze_file_settings', $file );
|
498 |
update_blog_option( $blog_id, 'breeze_preload_settings', $preload );
|
499 |
update_blog_option( $blog_id, 'breeze_advanced_settings', $advanced );
|
500 |
+
update_blog_option( $blog_id, 'breeze_heartbeat_settings', $heartbeat );
|
501 |
update_blog_option( $blog_id, 'breeze_cdn_integration', $cdn );
|
502 |
update_blog_option( $blog_id, 'breeze_varnish_cache', $varnish );
|
503 |
|
519 |
update_option( 'breeze_file_settings', $file );
|
520 |
update_option( 'breeze_preload_settings', $preload );
|
521 |
update_option( 'breeze_advanced_settings', $advanced );
|
522 |
+
update_option( 'breeze_heartbeat_settings', $heartbeat );
|
523 |
update_option( 'breeze_cdn_integration', $cdn );
|
524 |
update_option( 'breeze_varnish_cache', $varnish );
|
525 |
|
551 |
* @static
|
552 |
*/
|
553 |
private static function validate_json_entry( $value, $option = '' ) {
|
554 |
+
$heartbeat_options = array(
|
555 |
+
'',
|
556 |
+
'120',
|
557 |
+
'180',
|
558 |
+
'240',
|
559 |
+
'300',
|
560 |
+
'disable',
|
561 |
+
);
|
562 |
+
if (
|
563 |
+
'breeze-heartbeat-front' === $option ||
|
564 |
+
'breeze-heartbeat-postedit' === $option ||
|
565 |
+
'breeze-heartbeat-backend' === $option
|
566 |
+
) {
|
567 |
+
$value = (string) $value;
|
568 |
+
if ( in_array( $value, $heartbeat_options, true ) ) {
|
569 |
+
return $value;
|
570 |
+
} else {
|
571 |
+
return '';
|
572 |
+
}
|
573 |
+
}
|
574 |
|
575 |
/**
|
576 |
* Treat options that are not checkbox or array.
|
636 |
'breeze-browser-cache' => '1',
|
637 |
'breeze-lazy-load' => '0',
|
638 |
'breeze-lazy-load-native' => '0',
|
639 |
+
'breeze-lazy-load-iframes' => '0',
|
640 |
'breeze-desktop-cache' => '1',
|
641 |
'breeze-mobile-cache' => '1',
|
642 |
'breeze-display-clean' => '1',
|
655 |
'cdn-relative-path' => '1',
|
656 |
'auto-purge-varnish' => '1',
|
657 |
'breeze_inherit_settings' => '0',
|
658 |
+
'breeze-control-heartbeat' => '0',
|
659 |
);
|
660 |
|
661 |
if ( array_key_exists( $option, $checkboxes ) ) {
|
723 |
'cached-query-strings' => array(),
|
724 |
'cdn-content' => array( 'wp-includes', $wp_content ),
|
725 |
'cdn-exclude-content' => array( '.php' ),
|
726 |
+
'breeze-prefetch-urls' => array(),
|
727 |
);
|
728 |
|
729 |
if ( array_key_exists( $option, $array_list ) ) {
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Cloudways
|
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -145,10 +145,18 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
|
|
145 |
|
146 |
== Changelog ==
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 2.0.1 =
|
149 |
|
150 |
* Fix: Improved handling of minification in Never Cache URL(s) option.
|
151 |
-
|
152 |
|
153 |
= 2.0.0 =
|
154 |
|
3 |
Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
+
Stable tag: 2.0.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
+
= 2.0.2 =
|
149 |
+
|
150 |
+
* Fix: Atarim - Client Interface Plugin conflict with UI of Breeze in the admin area.
|
151 |
+
* Add: Make LazyLoad for iframes compatible
|
152 |
+
* Add: Control WordPress Heartbeat API. Users can disable it, independently on the admin, post editor page, and frontend.
|
153 |
+
* Add: DNS prefetch on pages.
|
154 |
+
* Add: Improve the handling of warning message while permission is not correct.
|
155 |
+
|
156 |
= 2.0.1 =
|
157 |
|
158 |
* Fix: Improved handling of minification in Never Cache URL(s) option.
|
159 |
+
|
160 |
|
161 |
= 2.0.0 =
|
162 |
|
views/breeze-setting-views.php
CHANGED
@@ -27,6 +27,11 @@ $breeze_option_tabs = array(
|
|
27 |
'tab-name' => __( 'ADVANCED OPTIONS', 'breeze' ),
|
28 |
'tab-icon' => 'advanced',
|
29 |
),
|
|
|
|
|
|
|
|
|
|
|
30 |
array(
|
31 |
'tab-slug' => 'database',
|
32 |
'tab-name' => __( 'DATABASE OPTIONS', 'breeze' ),
|
27 |
'tab-name' => __( 'ADVANCED OPTIONS', 'breeze' ),
|
28 |
'tab-icon' => 'advanced',
|
29 |
),
|
30 |
+
array(
|
31 |
+
'tab-slug' => 'heartbeat',
|
32 |
+
'tab-name' => __( 'HEARTBEAT API', 'breeze' ),
|
33 |
+
'tab-icon' => 'heartbeat',
|
34 |
+
),
|
35 |
array(
|
36 |
'tab-slug' => 'database',
|
37 |
'tab-name' => __( 'DATABASE OPTIONS', 'breeze' ),
|
views/option-tabs-loader.php
CHANGED
@@ -20,6 +20,7 @@ class Breeze_Tab_Loader {
|
|
20 |
'tools',
|
21 |
'faq',
|
22 |
'varnish',
|
|
|
23 |
);
|
24 |
|
25 |
$requested_tab = $_GET['request_tab'];
|
20 |
'tools',
|
21 |
'faq',
|
22 |
'varnish',
|
23 |
+
'heartbeat',
|
24 |
);
|
25 |
|
26 |
$requested_tab = $_GET['request_tab'];
|
views/option-tabs/basic-tab.php
CHANGED
@@ -213,13 +213,36 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/basic-active.png';
|
|
213 |
} else {
|
214 |
$hide = ' style="display:none"';
|
215 |
}
|
216 |
-
$basic_value
|
217 |
-
$
|
|
|
|
|
|
|
218 |
?>
|
219 |
|
220 |
-
|
221 |
<div class="on-off-checkbox">
|
222 |
-
<input id="bz-lazy-load-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
<label for="bz-lazy-load-nat">
|
224 |
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
225 |
</label>
|
@@ -235,11 +258,12 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/basic-active.png';
|
|
235 |
_e( 'This is not supported by all browsers.', 'breeze' );
|
236 |
?>
|
237 |
</p>
|
238 |
-
|
239 |
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
|
244 |
<!-- START OPTION -->
|
245 |
<div class="br-option-item">
|
213 |
} else {
|
214 |
$hide = ' style="display:none"';
|
215 |
}
|
216 |
+
$basic_value = isset( $basic['breeze-lazy-load-native'] ) ? filter_var( $basic['breeze-lazy-load-native'], FILTER_VALIDATE_BOOLEAN ) : false;
|
217 |
+
$native_lazy_load = ( isset( $basic_value ) && true === $basic_value ) ? checked( $basic['breeze-lazy-load-native'], '1', false ) : '';
|
218 |
+
|
219 |
+
$basic_value = isset( $basic['breeze-lazy-load-iframes'] ) ? filter_var( $basic['breeze-lazy-load-iframes'], FILTER_VALIDATE_BOOLEAN ) : false;
|
220 |
+
$iframe_lazy_load = ( isset( $basic_value ) && true === $basic_value ) ? checked( $basic['breeze-lazy-load-iframes'], '1', false ) : '';
|
221 |
?>
|
222 |
|
223 |
+
<span <?php echo $hide; ?> id="native-lazy-option-iframe">
|
224 |
<div class="on-off-checkbox">
|
225 |
+
<input id="bz-lazy-load-iframe" type="checkbox" name="bz-lazy-load-iframe" class="br-box" value='1' <?php echo $iframe_lazy_load; ?>>
|
226 |
+
<label for="bz-lazy-load-iframe">
|
227 |
+
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
228 |
+
</label>
|
229 |
+
</div>
|
230 |
+
<p>
|
231 |
+
<?php _e( 'iFrame lazy load', 'breeze' ); ?><br/>
|
232 |
+
</p>
|
233 |
+
<p class="br-important">
|
234 |
+
<?php
|
235 |
+
echo '<strong>';
|
236 |
+
_e( 'Important: ', 'breeze' );
|
237 |
+
echo '</strong>';
|
238 |
+
_e( 'Apply lazy load to iframe/videos tags.', 'breeze' );
|
239 |
+
?>
|
240 |
+
</p>
|
241 |
+
</span>
|
242 |
+
|
243 |
+
<span <?php echo $hide; ?> id="native-lazy-option">
|
244 |
+
<div class="on-off-checkbox">
|
245 |
+
<input id="bz-lazy-load-nat" type="checkbox" name="bz-lazy-load-nat" class="br-box" value='1' <?php echo $native_lazy_load; ?>>
|
246 |
<label for="bz-lazy-load-nat">
|
247 |
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
248 |
</label>
|
258 |
_e( 'This is not supported by all browsers.', 'breeze' );
|
259 |
?>
|
260 |
</p>
|
261 |
+
</span>
|
262 |
|
263 |
+
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
<!-- END OPTION -->
|
267 |
|
268 |
<!-- START OPTION -->
|
269 |
<div class="br-option-item">
|
views/option-tabs/heartbeat-tab.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Basic tab
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
header( 'Status: 403 Forbidden' );
|
8 |
+
header( 'HTTP/1.1 403 Forbidden' );
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
set_as_network_screen();
|
13 |
+
|
14 |
+
$is_custom = false;
|
15 |
+
if ( ( ! defined( 'WP_NETWORK_ADMIN' ) || ( defined( 'WP_NETWORK_ADMIN' ) && false === WP_NETWORK_ADMIN ) ) && is_multisite() ) {
|
16 |
+
$get_inherit = get_option( 'breeze_inherit_settings', '1' );
|
17 |
+
$is_custom = filter_var( $get_inherit, FILTER_VALIDATE_BOOLEAN );
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
$options = breeze_get_option( 'heartbeat_settings', true );
|
22 |
+
|
23 |
+
$icon = BREEZE_PLUGIN_URL . 'assets/images/heartbeat-active.png';
|
24 |
+
?>
|
25 |
+
<form data-section="heartbeat">
|
26 |
+
<?php if ( true === $is_custom ) { ?>
|
27 |
+
<div class="br-overlay-disable"><?php _e( 'Settings are inherited', 'breeze' ); ?></div>
|
28 |
+
<?php } ?>
|
29 |
+
<section>
|
30 |
+
<div class="br-section-title">
|
31 |
+
<img src="<?php echo $icon; ?>"/>
|
32 |
+
<?php _e( 'HEARTBEAT API', 'breeze' ); ?>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<div class="br-option-group">
|
36 |
+
<span class="section-title"><?php _e( 'Heartbeat Control', 'breeze' ); ?></span>
|
37 |
+
<!-- START OPTION -->
|
38 |
+
<div class="br-option-item br-top">
|
39 |
+
<div class="br-label">
|
40 |
+
<div class="br-option-text">
|
41 |
+
<?php _e( 'Control Heartbeat', 'breeze' ); ?>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
<div class="br-option">
|
45 |
+
<?php
|
46 |
+
$basic_value = isset( $options['breeze-control-heartbeat'] ) ? filter_var( $options['breeze-control-heartbeat'], FILTER_VALIDATE_BOOLEAN ) : false;
|
47 |
+
$is_enabled = ( isset( $basic_value ) && true === $basic_value ) ? checked( $options['breeze-control-heartbeat'], '1', false ) : '';
|
48 |
+
?>
|
49 |
+
<div class="on-off-checkbox">
|
50 |
+
<input id="breeze-control-hb" name="breeze-control-hb" type="checkbox" class="br-box" value="1" <?php echo $is_enabled; ?>>
|
51 |
+
<label for="breeze-control-hb">
|
52 |
+
<div class="status-switch" data-unchecked="OFF" data-checked="ON"></div>
|
53 |
+
</label>
|
54 |
+
</div>
|
55 |
+
<div class="br-note">
|
56 |
+
<p>
|
57 |
+
<?php
|
58 |
+
_e( 'Can help save some of the server resources when it\'s controlled.', 'breeze' );
|
59 |
+
?>
|
60 |
+
</p>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<!-- END OPTION -->
|
65 |
+
|
66 |
+
<?php
|
67 |
+
$heartbeat_options = array(
|
68 |
+
'default' => __( 'Default', 'breeze' ),
|
69 |
+
'120' => __( 'Every 2 minutes', 'breeze' ),
|
70 |
+
'180' => __( 'Every 3 minutes', 'breeze' ),
|
71 |
+
'240' => __( 'Every 4 minutes', 'breeze' ),
|
72 |
+
'300' => __( 'Every 5 minutes', 'breeze' ),
|
73 |
+
'disable' => __( 'Disable', 'breeze' ),
|
74 |
+
);
|
75 |
+
|
76 |
+
?>
|
77 |
+
<!-- START OPTION -->
|
78 |
+
<div class="br-option-item">
|
79 |
+
<div class="br-label">
|
80 |
+
<div class="br-option-text">
|
81 |
+
<?php _e( 'Heartbeat Front-end', 'breeze' ); ?>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
<div class="br-option">
|
85 |
+
<?php
|
86 |
+
$select_active = isset( $options['breeze-heartbeat-front'] ) ? $options['breeze-heartbeat-front'] : '';
|
87 |
+
?>
|
88 |
+
<select name="br-heartbeat-front" id="br-heartbeat-front">
|
89 |
+
<?php
|
90 |
+
foreach ( $heartbeat_options as $value => $label ) {
|
91 |
+
$selected = '';
|
92 |
+
if ( $select_active === (string) $value || empty( $select_active ) ) {
|
93 |
+
$selected = 'selected';
|
94 |
+
}
|
95 |
+
echo "<option value='{$value}' {$selected}>{$label}</option>";
|
96 |
+
}
|
97 |
+
?>
|
98 |
+
</select>
|
99 |
+
<div class="br-note">
|
100 |
+
<p>
|
101 |
+
<?php
|
102 |
+
_e( 'Change front-end Heartbeat behaviour or disable it completely', 'breeze' );
|
103 |
+
?>
|
104 |
+
</p>
|
105 |
+
<p class="br-important">
|
106 |
+
<?php
|
107 |
+
echo '<strong>';
|
108 |
+
_e( 'Important: ', 'breeze' );
|
109 |
+
echo '</strong>';
|
110 |
+
_e( 'Disabling Heartbeat may break some functionalities from plugins and themes which are dependent on Heartbeat API.', 'breeze' );
|
111 |
+
?>
|
112 |
+
</p>
|
113 |
+
</div>
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
<!-- END OPTION -->
|
117 |
+
|
118 |
+
<!-- START OPTION -->
|
119 |
+
<div class="br-option-item">
|
120 |
+
<div class="br-label">
|
121 |
+
<div class="br-option-text">
|
122 |
+
<?php _e( 'Heartbeat Post Editor', 'breeze' ); ?>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
<div class="br-option">
|
126 |
+
<?php
|
127 |
+
$select_active = isset( $options['breeze-heartbeat-postedit'] ) ? $options['breeze-heartbeat-postedit'] : '';
|
128 |
+
?>
|
129 |
+
<select name="br-heartbeat-postedit" id="br-heartbeat-postedit">
|
130 |
+
<?php
|
131 |
+
foreach ( $heartbeat_options as $value => $label ) {
|
132 |
+
$selected = '';
|
133 |
+
|
134 |
+
if ( $select_active === (string) $value ) {
|
135 |
+
$selected = 'selected';
|
136 |
+
}
|
137 |
+
echo "<option value='{$value}' {$selected}>{$label}</option>";
|
138 |
+
}
|
139 |
+
?>
|
140 |
+
</select>
|
141 |
+
<div class="br-note">
|
142 |
+
<p>
|
143 |
+
<?php
|
144 |
+
_e( 'Change Heartbeat behaviour or disable it completely in post edit screen', 'breeze' );
|
145 |
+
?>
|
146 |
+
</p>
|
147 |
+
<p class="br-important">
|
148 |
+
<?php
|
149 |
+
echo '<strong>';
|
150 |
+
_e( 'Important: ', 'breeze' );
|
151 |
+
echo '</strong>';
|
152 |
+
_e( 'Disabling Heartbeat may break some functionalities from plugins and themes which are dependent on Heartbeat API.', 'breeze' );
|
153 |
+
?>
|
154 |
+
</p>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
<!-- END OPTION -->
|
159 |
+
|
160 |
+
<!-- START OPTION -->
|
161 |
+
<div class="br-option-item">
|
162 |
+
<div class="br-label">
|
163 |
+
<div class="br-option-text">
|
164 |
+
<?php _e( 'Heartbeat Back-end', 'breeze' ); ?>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
<div class="br-option">
|
168 |
+
<?php
|
169 |
+
$select_active = isset( $options['breeze-heartbeat-backend'] ) ? $options['breeze-heartbeat-backend'] : '';
|
170 |
+
?>
|
171 |
+
<select name="br-heartbeat-backend" id="br-heartbeat-backend">
|
172 |
+
<?php
|
173 |
+
foreach ( $heartbeat_options as $value => $label ) {
|
174 |
+
$selected = '';
|
175 |
+
|
176 |
+
if ( $select_active === (string) $value ) {
|
177 |
+
$selected = 'selected';
|
178 |
+
}
|
179 |
+
echo "<option value='{$value}' {$selected}>{$label}</option>";
|
180 |
+
}
|
181 |
+
?>
|
182 |
+
</select>
|
183 |
+
<div class="br-note">
|
184 |
+
<p>
|
185 |
+
<?php
|
186 |
+
_e( 'Change Heartbeat behaviour or disable it completely in the admin area', 'breeze' );
|
187 |
+
?>
|
188 |
+
</p>
|
189 |
+
<p class="br-important">
|
190 |
+
<?php
|
191 |
+
echo '<strong>';
|
192 |
+
_e( 'Important: ', 'breeze' );
|
193 |
+
echo '</strong>';
|
194 |
+
_e( 'Disabling Heartbeat may break some functionalities from plugins and themes which are dependent on Heartbeat API.', 'breeze' );
|
195 |
+
?>
|
196 |
+
</p>
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
</div>
|
200 |
+
<!-- END OPTION -->
|
201 |
+
|
202 |
+
</div><!-- END GROUP -->
|
203 |
+
</section>
|
204 |
+
<div class="br-submit">
|
205 |
+
<input type="submit" value="<?php echo __( 'Save Changes', 'breeze' ); ?>" class="br-submit-save"/>
|
206 |
+
</div>
|
207 |
+
</form>
|
views/option-tabs/preload-tab.php
CHANGED
@@ -133,6 +133,51 @@ $icon = BREEZE_PLUGIN_URL . 'assets/images/preload-active.png';
|
|
133 |
</div>
|
134 |
</div>
|
135 |
<!-- END OPTION -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
</section>
|
137 |
<div class="br-submit">
|
138 |
<input type="submit" value="<?php echo __( 'Save Changes', 'breeze' ); ?>" class="br-submit-save"/>
|
133 |
</div>
|
134 |
</div>
|
135 |
<!-- END OPTION -->
|
136 |
+
|
137 |
+
<!-- START OPTION -->
|
138 |
+
<div class="br-option-item">
|
139 |
+
<div class="br-label">
|
140 |
+
<div class="br-option-text">
|
141 |
+
<?php _e( 'Prefetch of DNS Request', 'breeze' ); ?>
|
142 |
+
</div>
|
143 |
+
</div>
|
144 |
+
<div class="br-option">
|
145 |
+
<p>
|
146 |
+
<?php _e( 'Specify domain URLs, one per line', 'breeze' ); ?>
|
147 |
+
</p>
|
148 |
+
<?php
|
149 |
+
$prefetch_domain_list = true;
|
150 |
+
|
151 |
+
if ( isset( $options['breeze-prefetch-urls'] ) && ! empty( $options['breeze-prefetch-urls'] ) ) {
|
152 |
+
$prefetch_domain_list = breeze_validate_urls( $options['breeze-prefetch-urls'] );
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
$domains_output = '';
|
157 |
+
if ( ! empty( $options['breeze-prefetch-urls'] ) ) {
|
158 |
+
$output = implode( "\n", $options['breeze-prefetch-urls'] );
|
159 |
+
$domains_output = esc_textarea( $output );
|
160 |
+
}
|
161 |
+
|
162 |
+
$placeholder_never_cache_url = '//demo.com';
|
163 |
+
?>
|
164 |
+
<textarea cols="100" rows="7" id="br-prefetch-urls" name="br-prefetch-urls" placeholder="<?php echo esc_attr( $placeholder_never_cache_url ); ?>"><?php echo $domains_output; ?></textarea>
|
165 |
+
<div class="br-note">
|
166 |
+
<p>
|
167 |
+
<?php
|
168 |
+
|
169 |
+
_e( 'Third-party content load will be optimized if we prefetch the domains.', 'breeze' );
|
170 |
+
?>
|
171 |
+
</p>
|
172 |
+
<?php if ( false === $prefetch_domain_list ) { ?>
|
173 |
+
<p class="br-notice">
|
174 |
+
<?php _e( 'One (or more) URL is invalid. Please check and correct the entry.', 'breeze' ); ?>
|
175 |
+
</p>
|
176 |
+
<?php } ?>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
<!-- END OPTION -->
|
181 |
</section>
|
182 |
<div class="br-submit">
|
183 |
<input type="submit" value="<?php echo __( 'Save Changes', 'breeze' ); ?>" class="br-submit-save"/>
|