Asset CleanUp: Page Speed Booster - Version 1.3.5.6

Version Description

  • Added "Debugging" tab to "Tools" page, allowing the option to download the error log file & view other debugging options
  • Improvement: Sometimes, 200 OK (success) is returned, but due to an issue with the page, the assets list is not retrieved; Notify the admin about this
  • Fix: Sometimes, warnings (harmless, but obtrusive) were given when updating plugin's settings and previewing pages: "Warning: array_unique() expects parameter 1 to be array, null given"
Download this release

Release Info

Developer gabelivan
Plugin Icon 128x128 Asset CleanUp: Page Speed Booster
Version 1.3.5.6
Comparing to
See all releases

Code changes from version 1.3.5.5 to 1.3.5.6

assets/script.js DELETED
@@ -1,3 +0,0 @@
1
- function wpacuTabOpenSettingsArea(a,b){a.preventDefault();var c,d,e;for(d=document.getElementsByClassName("wpacu-settings-tab-content"),c=0;c<d.length;c++)d[c].style.display="none";for(e=document.getElementsByClassName("wpacu-settings-tab-link"),c=0;c<e.length;c++)e[c].className=e[c].className.replace(" active","");document.getElementById(b).style.display="table-cell",jQuery('a[href="#'+b+'"]').addClass("active"),jQuery("#wpacu-selected-tab-area").val(b)}function wpacuBytesToSize(a){return 0===a?"N/A":(a/1024).toFixed(4)+" KB"}function wpacuAjaxClearCache(){var a={action:wpacu_object.plugin_id+"_clear_cache",time_r:(new Date).getTime()};jQuery.post(wpacu_object.ajax_url+"?wpacu_clear_cache",a,function(a){})}jQuery(document).ready(function(a){function b(){if(!a("#wpacu_ajax_fetch_assets_list_dashboard_view").length)return!1;var b={};"direct"===wpacu_object.dom_get_type?(b[wpacu_object.plugin_name+"_load"]=1,b[wpacu_object.plugin_name+"_time_r"]=(new Date).getTime(),a.ajax({method:"GET",url:wpacu_object.page_url,data:b,cache:!1,complete:function(b,c){if("error"===b.statusText){var d=wpacu_object.ajax_direct_fetch_error;d=d.replace(/\{wpacu_output\}/,b.responseText),d=d.replace(/\{wpacu_status_code_error\}/,b.status),a("#wpacu_meta_box_content").html(d)}}}).done(function(b){var c=b.substring(b.lastIndexOf(wpacu_object.start_del_e)+wpacu_object.start_del_e.length,b.lastIndexOf(wpacu_object.end_del_e)),d=b.substring(b.lastIndexOf(wpacu_object.start_del_h)+wpacu_object.start_del_h.length,b.lastIndexOf(wpacu_object.end_del_h)),f={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list_e:c,
2
- post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id,time_r:(new Date).getTime()};
3
- a.post(wpacu_object.ajax_url,f,function(b){if(!b)return!1;a("#wpacu_meta_box_content").html(b),a("#wpacu_home_page_form").length>0&&a("#submit").show(),setTimeout(function(){e.load(),a(".wpacu_asset_row").removeClass("wpacu-loading"),a("#wpacu-assets-reloading").remove(),e.checkSourcesFor404Errors()},200)})})):"wp_remote_post"===wpacu_object.dom_get_type&&(b={action:wpacu_object.plugin_name+"_get_loaded_assets",post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id,time_r:(new Date).getTime()},a.post(wpacu_object.ajax_url,b,function(b){if(!b)return!1;a("#wpacu_meta_box_content").html(b),a("#wpacu_home_page_form").length>0&&a("#submit").show(),setTimeout(function(){e.load(),setTimeout(function(){e.checkSourcesFor404Errors()},100)},200)}))}a('input[name="wpacu_sub_tab_area"]').click(function(){a(this).prop("checked")&&a("#wpacu-selected-sub-tab-area").val(a(this).val())}),a("#wpacu_minify_css_enable, #wpacu_combine_loaded_css_enable, #wpacu_minify_js_enable, #wpacu_combine_loaded_js_enable, #wpacu_cdn_rewrite_enable, #wpacu_enable_test_mode").click(function(){a(this).prop("checked")?a('[data-linked-to="'+a(this).attr("id")+'"]').find(".wpacu-circle-status").addClass("wpacu-on").removeClass("wpacu-off"):a('[data-linked-to="'+a(this).attr("id")+'"]').find(".wpacu-circle-status").addClass("wpacu-off").removeClass("wpacu-on")}),a("#wpacu-mark-license-valid-button").click(function(){return confirm(wpacu_object.mark_license_valid_confirm)}),a("#wpacu-license-form").submit(function(){a("#edd_license_activate_btn").attr("disabled","disabled"),a("#edd_license_deactivate_btn").attr("disabled","disabled"),a(".wpacu-license-spinner").show()});var c,d;a("#wpacu-reset-drop-down").on("change keyup keydown mouseup mousedown click",function(){""===a(this).val()?(a("#wpacu-warning-read").removeClass("wpacu-visible"),a("#wpacu-reset-submit-btn").attr("disabled","disabled").removeClass("button-primary").addClass("button-secondary")):("reset_everything"===a(this).val()?a("#wpacu-license-data-remove-area").addClass("wpacu-visible"):a("#wpacu-license-data-remove-area").removeClass("wpacu-visible"),a("#wpacu-warning-read").addClass("wpacu-visible"),a("#wpacu-reset-submit-btn").removeAttr("disabled").removeClass("button-secondary").addClass("button-primary")),a(".wpacu-tools-area .wpacu-warning").hide(),c=a(this).find("option:selected"),a("#"+c.attr("data-id")).show()}),a("#wpacu-reset-submit-btn").on("click",function(){if("reset_settings"===a("#wpacu-reset-drop-down").val()?d=wpacu_object.reset_settings_confirm_msg:"reset_everything_except_settings"===a("#wpacu-reset-drop-down").val()?d=wpacu_object.reset_everything_except_settings_confirm_msg:"reset_everything"===a("#wpacu-reset-drop-down").val()&&(d=wpacu_object.reset_everything_confirm_msg),!confirm(d))return!1;a("#wpacu-action-confirmed").val("yes"),setTimeout(function(){"yes"===a("#wpacu-action-confirmed").val()&&a("#wpacu-tools-form").submit()},1e3)}),a("#wpacu-import-form").submit(function(){if(!confirm(wpacu_object.import_confirm_msg))return!1;a(this).find("button").addClass("wpacu-importing").prop("disabled",!0)});var e={load:function(){var b,c,d,f=".input-unload-on-this-page.wpacu-not-locked";a(".input-unload-on-this-page").on("click change",function(){b=a(this).attr("data-handle"),c=a(this).hasClass("wpacu_unload_rule_for_style")?"style":"script",a(this).prop("checked")?(e.uncheckAllOtherBulkUnloadRules(a(this),!1),a("div.wpacu_exception_options_area_wrap[data-"+c+'-handle="'+b+'"]').parent("div").removeClass("wpacu_hide"),a(this).closest("tr").addClass("wpacu_not_load")):(a(this).closest("tr").removeClass("wpacu_not_load"),d=a(this).parents(".wpacu_asset_row"),e.hideLoadExceptionArea(d,b,c))}),a(".wpacu-plugin-check-all").on("click",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin");a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]').find(f).prop("checked",!0).closest("tr").addClass("wpacu_not_load")}),a(".wpacu-plugin-uncheck-all").on("click",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin");a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]').find(f).prop("checked",!1).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu-plugin-check-load-all").on("click change",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin"),d=a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]');d.find(".wpacu_load_it_option_one.wpacu_load_exception").prop("checked",!0).closest("tr.wpacu_is_bulk_unloaded").removeClass("wpacu_not_load"),d.find(f).prop("checked",!1).trigger("change")}),a(".wpacu-plugin-uncheck-load-all").on("click change",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin"),d=a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]');d.find(".wpacu_load_it_option_one.wpacu_load_exception").prop("checked",!1).closest("tr.wpacu_is_bulk_unloaded").addClass("wpacu_not_load"),d.find(f).prop("checked",!1).trigger("change")}),a(".wpacu_keep_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").next().removeClass("remove_rule")}),a(".wpacu_remove_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").addClass("remove_rule")}),a(".wpacu_bulk_unload").on("click change",function(){b=a(this).attr("data-handle"),c=a(this).attr("data-handle-for"),d=a("[data-"+c+'-handle-row="'+b+'"]'),a(this).prop("checked")?(a(this).hasClass("wpacu_unload_it_regex_checkbox")||(a(this).parent("label").addClass("wpacu_input_load_checked"),a(this).closest("tr").addClass("wpacu_not_load")),a("div.wpacu_exception_options_area_wrap[data-"+c+'-handle="'+b+'"]').parent("div").removeClass("wpacu_hide"),a(this).hasClass("wpacu_global_unload")?(e.uncheckAllOtherBulkUnloadRules(a(this),!0),a('.input-unload-on-this-page[data-handle-for="'+c+'"][data-handle="'+b+'"]').prop("checked",!1)):a(this).hasClass("wpacu_post_type_unload")&&(e.uncheckAllOtherBulkUnloadRules(a(this),!1),a('.input-unload-on-this-page[data-handle-for="'+c+'"][data-handle="'+b+'"]').prop("checked",!1))):(a(this).hasClass("wpacu_unload_it_regex_checkbox")||(a(this).parent("label").removeClass("wpacu_input_load_checked"),a(this).closest("tr").removeClass("wpacu_not_load")),e.hideLoadExceptionArea(d,b,c)),d.hasClass("wpacu_is_bulk_unloaded")||a(".wpacu_bulk_unload:not(.wpacu_unload_it_regex_checkbox)").is(":checked")||a(this).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu_load_it_option_one.wpacu_load_exception").on("click change",function(){var b=a(this).attr("data-handle");if(a(this).prop("checked")){a(this).parent("label").addClass("wpacu_global_unload_exception");var c="";a(this).hasClass("wpacu_style")?c="style":a(this).hasClass("wpacu_script")&&(c="script"),a("#"+c+"_"+b).prop("checked",!1).trigger("change")}else a(this).parent("label").removeClass("wpacu_global_unload_exception")}),a(".wpacu_unload_it_regex_checkbox").on("click change",function(){var b=a(this).parents("li");a(this).prop("checked")?(b.find("label").addClass("wpacu_unload_checked"),b.find("textarea").prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_handle_unload_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_unload_checked"),b.find("textarea").blur().addClass("wpacu_disabled"),""===b.find("textarea").val().trim()&&(b.find("textarea").prop("disabled",!0).val(""),b.find(".wpacu_handle_unload_regex_input_wrap").addClass("wpacu_hide")))}),a(".wpacu_load_it_option_two").on("click change",function(){var b=a(this).parents("li");a(this).prop("checked")?(b.find("label").addClass("wpacu_bold"),b.find("textarea").prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_load_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_bold"),b.find("textarea").blur().addClass("wpacu_disabled"),""===b.find("textarea").val().trim()&&(b.find("textarea").prop("disabled",!0).val(""),b.find(".wpacu_load_regex_input_wrap").addClass("wpacu_hide")))}),a(".wpacu_script_attr_rule_input").on("click change",function(){a(this).is(":checked")&&(a(this).parents("ul").find(".wpacu_script_attr_rule_input").not(a(this)).prop("checked",!1),a(this).hasClass("wpacu_script_attr_rule_global")&&a(this).parents("ul").find(".wpacu-script-attr-make-exception").removeClass("wpacu_hide")),a(this).parents("ul").find(".wpacu_script_attr_rule_global").is(":checked")||a(this).parents("ul").find(".wpacu-script-attr-make-exception").addClass("wpacu_hide")}),a(".wpacu-add-handle-note").on("click",function(b){b.preventDefault();var c,d,e=a(this).attr("data-handle");a(this).hasClass("wpacu-for-script")?c=a('.wpacu-handle-notes-field[data-script-handle="'+e+'"]'):a(this).hasClass("wpacu-for-style")&&(c=a('.wpacu-handle-notes-field[data-style-handle="'+e+'"]')),c.length<1||(d=c.find(":input"),c.is(":hidden")?(c.show(),d.prop("disabled",!1)):(c.hide(),""===d.val().trim()&&"true"===d.attr("data-wpacu-is-empty-on-page-load")&&d.prop("disabled",!0).val("")))}),a(".wpacu-external-file-size").on("click",function(b){b.preventDefault();var c,d=a(this),e=d.attr("data-src");d.hide(),c=d.next(),c.show(),e.includes("/?")?a.get(e,{},function(a,b,d){if("success"!==b)return"N/A";c.html(wpacuBytesToSize(a.length))}):a.post(wpacu_object.ajax_url,{action:wpacu_object.plugin_id+"_get_external_file_size",wpacu_remote_file:e},function(a){c.html(a)})})},pluginLoadManager:function(){a(".wpacu_plugin_load_it").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")&&(a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wpacu_plugin_unload_site_wide[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_radio[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"))}),a(".wpacu_plugin_unload_site_wide").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_radio[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide")):(a(this).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"))}),a(".wpacu_plugin_unload_regex_radio").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"),a('.wpacu_plugin_unload_site_wide[data-wpacu-plugin-path="'+b+'"]').prop("checked",!1).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked")):(a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a(this).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"))}),a(".wpacu_plugin_load_exception_regex").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?a('.wpacu_load_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"):a('.wpacu_load_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide")})},hideLoadExceptionArea:function(b,c,d){b.hasClass("wpacu_is_bulk_unloaded")||b.find(".wpacu_bulk_unload").is(":checked")||a("div.wpacu_exception_options_area_wrap[data-"+d+'-handle="'+c+'"]').parent("div").addClass("wpacu_hide")},uncheckAllOtherBulkUnloadRules:function(a,b){var c=".wpacu_bulk_unload";!1===b&&(c=".wpacu_bulk_unload:not(.wpacu_unload_it_regex_checkbox)"),a.closest("tr").find(c).not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_checked").removeClass("wpacu_unload_checked")},httpLoadSource:function(a,b){window.XMLHttpRequest?xmlhttp=new XMLHttpRequest:xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");try{xmlhttp.onreadystatechange=function(){if(4===xmlhttp.readyState&&200===xmlhttp.status)return xmlhttp.responseText;200!==xmlhttp.status&&(console.log(a+" "+xmlhttp.status),b.css({color:"#cc0000"}).parent("div").find("[data-wpacu-source-status]").html('<small>* <em style="font-weight: 600;">'+wpacu_object.source_load_error_msg+"</em></small>"))},xmlhttp.open("GET",a,!1),xmlhttp.send()}catch(a){console.log(a)}},checkSourcesFor404Errors:function(){var b=a("[data-wpacu-external-source]");if(!(b.length<1)){var c=b.length,d="";b.each(function(b){var e=a(this),f=e.attr("data-wpacu-external-source");d+=f+"-at-wpacu-at-",b===c-1&&jQuery.post(wpacu_object.ajax_url+"?wpacu_check_external_url",{action:wpacu_object.plugin_id+"_check_external_urls_for_status_code",wpacu_check_urls:d},function(b){var c=jQuery.parseJSON(b);a.each(c,function(b,c){a('[data-wpacu-external-source="'+c+'"]').css({color:"#cc0000"}).parent("div").find("[data-wpacu-external-source-status]").html('<small>* <em style="font-weight: 600;">'+wpacu_object.source_load_error_msg+"</em></small>")})})})}}};a(window).load(function(){e.checkSourcesFor404Errors()}),a("#wpacu_post_type_select").change(function(){a("#wpacu_post_type_form").submit()}),a("#wpacu_taxonomy_select").change(function(){a("#wpacu_taxonomy_form").submit()}),a("#wpacu_dashboard").click(function(){a(this).prop("checked")?a("#wpacu-settings-assets-retrieval-mode").show():a("#wpacu-settings-assets-retrieval-mode").hide()}),a(".wpacu-dom-get-type-selection").change(function(){a(this).is(":checked")&&(a(".wpacu-dom-get-type-info").hide(),a("#"+a(this).attr("data-target")).fadeIn("fast"))}),a("#wpacu_frontend").click(function(){a(this).prop("checked")?a("#wpacu-settings-frontend-exceptions").show():a("#wpacu-settings-frontend-exceptions").hide()}),a(".google_fonts_combine_type").change(function(){a(".wpacu_google_fonts_combine_type_area").hide(),"async"===a(this).val()?a("#wpacu_google_fonts_combine_type_async_info_area").fadeIn():"async_preload"===a(this).val()?a("#wpacu_google_fonts_combine_type_async_preload_info_area").fadeIn():a("#wpacu_google_fonts_combine_type_rb_info_area").fadeIn()}),a("#wpacu_assets_list_layout").on("click change",function(){"by-location"===a(this).val()?a("#wpacu-assets-list-by-location-selected").fadeIn("fast"):a("#wpacu-assets-list-by-location-selected").fadeOut("fast")}),a("#wpacu_disable_jquery_migrate").on("click",function(){return!a(this).is(":checked")||(!(!a(this).is(":checked")||!confirm(wpacu_object.jquery_migration_disable_confirm_msg))||(a(this).prop("checked",!1),!1))}),a("#wpacu_disable_comment_reply").on("click",function(){return!a(this).is(":checked")||(!(!a(this).is(":checked")||!confirm(wpacu_object.comment_reply_disable_confirm_msg))||(a(this).prop("checked",!1),!1))}),a("[data-target-opacity]").click(function(){a(this).prop("checked")?a("#"+a(this).attr("data-target-opacity")).css({opacity:1}):a("#"+a(this).attr("data-target-opacity")).css({opacity:.4})}),a(".wpacu-combine-loaded-js-level").change(function(){a(this).is(":checked")&&(a(".wpacu_combine_loaded_js_level_area").removeClass("wpacu_active"),a("#"+a(this).attr("data-target")).addClass("wpacu_active"))});var f=a('#wpacu-update-button-area input[type="submit"]');f.parents("form").submit(function(){f.attr("disabled",!0),a("#wpacu-updating-settings").show()});var g=a("#wpacu-update-front-settings-area .wpacu_update_btn");if(g.parents("form").submit(function(){return g.attr("disabled",!0).addClass("wpacu_submitting"),a("#wpacu-updating-front-settings").show(),!0}),a("form#wpacu-settings-form, form#wpacu_home_page_form").submit(function(){return f.attr("disabled",!0),!0}),a(".wpacu_bulk_rule_checkbox, .wpacu_remove_preload").click(function(){var b=a(this).parents(".wpacu_bulk_change_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a(".wpacu_remove_regex").click(function(){var b=a(this).parents(".wpacu_regex_rule_row");a(this).prop("checked")?b.addClass("wpacu_enabled"):b.removeClass("wpacu_enabled")}),a(".wpacu_restore_position").click(function(){var b=a(this).parents(".wpacu_restore_position_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a(".wpacu_remove_global_attr").click(function(){var b=a(this).parents(".wpacu_remove_global_attr_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a("#wpacu_wrap_assets").length>0&&setTimeout(function(){e.load()},200),a("#wpacu-plugins-load-manager-wrap").length>0&&setTimeout(function(){e.pluginLoadManager()},200),"undefined"==typeof wpacu_object||a("#wpacu_meta_box_content").length<1)return!1;("default"===wpacu_object.list_show_status||""===wpacu_object.list_show_status||wpacu_object.override_assets_list_load)&&b(),"fetch_on_click"===wpacu_object.list_show_status&&a("#wpacu_ajax_fetch_on_click_btn").click(function(c){c.preventDefault(),a(this).hide(),a("#wpacu_fetching_assets_list_wrap").show(),b()}),a(document).on("click",".wp-admin.post-php .edit-post-header__settings button.is-primary",function(){var c=function(){if(0===a(".edit-post-header__settings .is-saving").length){if(a("#wpacu_unload_assets_area_loaded").length>0&&a("#wpacu_unload_assets_area_loaded").val()){a("#wpacu-assets-reloading").remove();var c='<span id="wpacu-assets-reloading" class="editor-post-saved-state is-wpacu-reloading">'+wpacu_object.reload_icon+wpacu_object.reload_msg+"</span>";a(".wp-admin.post-php .edit-post-header__settings").prepend(c)}a(".wpacu_asset_row").addClass("wpacu-loading"),b(),wpacuAjaxClearCache(),clearInterval(d)}},d=setInterval(c,900)})}),""!==wpacu_object.clear_cache_on_page_load&&wpacuAjaxClearCache(),jQuery(document).ready(function(a){var b;void 0!==a('input[type="hidden"][name="_wp_http_referer"]')&&(b=a('input[type="hidden"][name="_wp_http_referer"]').val(),b.includes("term.php?taxonomy=")&&b.includes("message=")&&wpacuAjaxClearCache(),b.includes("post.php?post=")&&b.includes("message=")&&wpacuAjaxClearCache())});
assets/script.min.js CHANGED
@@ -1,3 +1 @@
1
- function wpacuTabOpenSettingsArea(a,b){a.preventDefault();var c,d,e;for(d=document.getElementsByClassName("wpacu-settings-tab-content"),c=0;c<d.length;c++)d[c].style.display="none";for(e=document.getElementsByClassName("wpacu-settings-tab-link"),c=0;c<e.length;c++)e[c].className=e[c].className.replace(" active","");document.getElementById(b).style.display="table-cell",jQuery('a[href="#'+b+'"]').addClass("active"),jQuery("#wpacu-selected-tab-area").val(b)}function wpacuBytesToSize(a){return 0===a?"N/A":(a/1024).toFixed(4)+" KB"}function wpacuAjaxClearCache(){jQuery.post(wpacu_object.ajax_url+"?wpacu_clear_cache",{action:wpacu_object.plugin_id+"_clear_cache",time_r:(new Date).getTime()},function(a){})}jQuery(document).ready(function(a){function b(){if(!a("#wpacu_ajax_fetch_assets_list_dashboard_view").length)return!1;var b,c,d,f={};"direct"===wpacu_object.dom_get_type?(f[wpacu_object.plugin_name+"_load"]=1,f[wpacu_object.plugin_name+"_time_r"]=(new Date).getTime(),a.ajax({method:"GET",url:wpacu_object.page_url,data:f,cache:!1,complete:function(b,c){if("error"===b.statusText){var d=wpacu_object.ajax_direct_fetch_error;d=d.replace(/\{wpacu_output\}/,b.responseText),d=d.replace(/\{wpacu_status_code_error\}/,b.status),a("#wpacu_meta_box_content").html(d)}}}).done(function(f){c=f.substring(f.lastIndexOf(wpacu_object.start_del_e)+wpacu_object.start_del_e.length,f.lastIndexOf(wpacu_object.end_del_e)),
2
- b={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list_e:c,
3
- post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id,time_r:(new Date).getTime()},a.post(wpacu_object.ajax_url,b,function(b){if(!b)return!1;a("#wpacu_meta_box_content").html(b),a("#wpacu_home_page_form").length>0&&a("#submit").show(),setTimeout(function(){e.load(),a(".wpacu_asset_row").removeClass("wpacu-loading"),a("#wpacu-assets-reloading").remove(),e.checkSourcesFor404Errors()},200)})})):"wp_remote_post"===wpacu_object.dom_get_type&&(b={action:wpacu_object.plugin_name+"_get_loaded_assets",post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id,time_r:(new Date).getTime()},a.post(wpacu_object.ajax_url,data,function(b){if(!b)return!1;a("#wpacu_meta_box_content").html(b),a("#wpacu_home_page_form").length>0&&a("#submit").show(),setTimeout(function(){e.load(),setTimeout(function(){e.checkSourcesFor404Errors()},100)},200)}))}a('input[name="wpacu_sub_tab_area"]').click(function(){a(this).prop("checked")&&a("#wpacu-selected-sub-tab-area").val(a(this).val())}),a("#wpacu_minify_css_enable, #wpacu_combine_loaded_css_enable, #wpacu_minify_js_enable, #wpacu_combine_loaded_js_enable, #wpacu_cdn_rewrite_enable, #wpacu_enable_test_mode").click(function(){a(this).prop("checked")?a('[data-linked-to="'+a(this).attr("id")+'"]').find(".wpacu-circle-status").addClass("wpacu-on").removeClass("wpacu-off"):a('[data-linked-to="'+a(this).attr("id")+'"]').find(".wpacu-circle-status").addClass("wpacu-off").removeClass("wpacu-on")}),a("#wpacu-mark-license-valid-button").click(function(){return confirm(wpacu_object.mark_license_valid_confirm)}),a("#wpacu-license-form").submit(function(){a("#edd_license_activate_btn").attr("disabled","disabled"),a("#edd_license_deactivate_btn").attr("disabled","disabled"),a(".wpacu-license-spinner").show()});var c,d;a("#wpacu-reset-drop-down").on("change keyup keydown mouseup mousedown click",function(){""===a(this).val()?(a("#wpacu-warning-read").removeClass("wpacu-visible"),a("#wpacu-reset-submit-btn").attr("disabled","disabled").removeClass("button-primary").addClass("button-secondary")):("reset_everything"===a(this).val()?a("#wpacu-license-data-remove-area").addClass("wpacu-visible"):a("#wpacu-license-data-remove-area").removeClass("wpacu-visible"),a("#wpacu-warning-read").addClass("wpacu-visible"),a("#wpacu-reset-submit-btn").removeAttr("disabled").removeClass("button-secondary").addClass("button-primary")),a(".wpacu-tools-area .wpacu-warning").hide(),c=a(this).find("option:selected"),a("#"+c.attr("data-id")).show()}),a("#wpacu-reset-submit-btn").on("click",function(){if("reset_settings"===a("#wpacu-reset-drop-down").val()?d=wpacu_object.reset_settings_confirm_msg:"reset_everything_except_settings"===a("#wpacu-reset-drop-down").val()?d=wpacu_object.reset_everything_except_settings_confirm_msg:"reset_everything"===a("#wpacu-reset-drop-down").val()&&(d=wpacu_object.reset_everything_confirm_msg),!confirm(d))return!1;a("#wpacu-action-confirmed").val("yes"),setTimeout(function(){"yes"===a("#wpacu-action-confirmed").val()&&a("#wpacu-tools-form").submit()},1e3)}),a("#wpacu-import-form").submit(function(){if(!confirm(wpacu_object.import_confirm_msg))return!1;a(this).find("button").addClass("wpacu-importing").prop("disabled",!0)});var e={load:function(){var b,c,d,f=".input-unload-on-this-page.wpacu-not-locked";a(".input-unload-on-this-page").on("click change",function(){b=a(this).attr("data-handle"),c=a(this).hasClass("wpacu_unload_rule_for_style")?"style":"script",a(this).prop("checked")?(e.uncheckAllOtherBulkUnloadRules(a(this),!1),a("div.wpacu_exception_options_area_wrap[data-"+c+'-handle="'+b+'"]').parent("div").removeClass("wpacu_hide"),a(this).closest("tr").addClass("wpacu_not_load")):(a(this).closest("tr").removeClass("wpacu_not_load"),d=a(this).parents(".wpacu_asset_row"),e.hideLoadExceptionArea(d,b,c))}),a(".wpacu-plugin-check-all").on("click",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin");a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]').find(f).prop("checked",!0).closest("tr").addClass("wpacu_not_load")}),a(".wpacu-plugin-uncheck-all").on("click",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin");a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]').find(f).prop("checked",!1).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu-plugin-check-load-all").on("click change",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin"),d=a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]');d.find(".wpacu_load_it_option_one.wpacu_load_exception").prop("checked",!0).closest("tr.wpacu_is_bulk_unloaded").removeClass("wpacu_not_load"),d.find(f).prop("checked",!1).trigger("change")}),a(".wpacu-plugin-uncheck-load-all").on("click change",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin"),d=a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]');d.find(".wpacu_load_it_option_one.wpacu_load_exception").prop("checked",!1).closest("tr.wpacu_is_bulk_unloaded").addClass("wpacu_not_load"),d.find(f).prop("checked",!1).trigger("change")}),a(".wpacu_keep_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").next().removeClass("remove_rule")}),a(".wpacu_remove_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").addClass("remove_rule")}),a(".wpacu_bulk_unload").on("click change",function(){b=a(this).attr("data-handle"),c=a(this).attr("data-handle-for"),d=a("[data-"+c+'-handle-row="'+b+'"]'),a(this).prop("checked")?(a(this).hasClass("wpacu_unload_it_regex_checkbox")||(a(this).parent("label").addClass("wpacu_input_load_checked"),a(this).closest("tr").addClass("wpacu_not_load")),a("div.wpacu_exception_options_area_wrap[data-"+c+'-handle="'+b+'"]').parent("div").removeClass("wpacu_hide"),a(this).hasClass("wpacu_global_unload")?(e.uncheckAllOtherBulkUnloadRules(a(this),!0),a('.input-unload-on-this-page[data-handle-for="'+c+'"][data-handle="'+b+'"]').prop("checked",!1)):a(this).hasClass("wpacu_post_type_unload")&&(e.uncheckAllOtherBulkUnloadRules(a(this),!1),a('.input-unload-on-this-page[data-handle-for="'+c+'"][data-handle="'+b+'"]').prop("checked",!1))):(a(this).hasClass("wpacu_unload_it_regex_checkbox")||(a(this).parent("label").removeClass("wpacu_input_load_checked"),a(this).closest("tr").removeClass("wpacu_not_load")),e.hideLoadExceptionArea(d,b,c)),d.hasClass("wpacu_is_bulk_unloaded")||a(".wpacu_bulk_unload:not(.wpacu_unload_it_regex_checkbox)").is(":checked")||a(this).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu_load_it_option_one.wpacu_load_exception").on("click change",function(){var b=a(this).attr("data-handle");if(a(this).prop("checked")){a(this).parent("label").addClass("wpacu_global_unload_exception");var c="";a(this).hasClass("wpacu_style")?c="style":a(this).hasClass("wpacu_script")&&(c="script"),a("#"+c+"_"+b).prop("checked",!1).trigger("change")}else a(this).parent("label").removeClass("wpacu_global_unload_exception")}),a(".wpacu_unload_it_regex_checkbox").on("click change",function(){var b=a(this).parents("li");a(this).prop("checked")?(b.find("label").addClass("wpacu_unload_checked"),b.find("textarea").prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_handle_unload_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_unload_checked"),b.find("textarea").blur().addClass("wpacu_disabled"),""===b.find("textarea").val().trim()&&(b.find("textarea").prop("disabled",!0).val(""),b.find(".wpacu_handle_unload_regex_input_wrap").addClass("wpacu_hide")))}),a(".wpacu_load_it_option_two").on("click change",function(){var b=a(this).parents("li");a(this).prop("checked")?(b.find("label").addClass("wpacu_bold"),b.find("textarea").prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_load_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_bold"),b.find("textarea").blur().addClass("wpacu_disabled"),""===b.find("textarea").val().trim()&&(b.find("textarea").prop("disabled",!0).val(""),b.find(".wpacu_load_regex_input_wrap").addClass("wpacu_hide")))}),a(".wpacu_script_attr_rule_input").on("click change",function(){a(this).is(":checked")&&(a(this).parents("ul").find(".wpacu_script_attr_rule_input").not(a(this)).prop("checked",!1),a(this).hasClass("wpacu_script_attr_rule_global")&&a(this).parents("ul").find(".wpacu-script-attr-make-exception").removeClass("wpacu_hide")),a(this).parents("ul").find(".wpacu_script_attr_rule_global").is(":checked")||a(this).parents("ul").find(".wpacu-script-attr-make-exception").addClass("wpacu_hide")}),a(".wpacu-add-handle-note").on("click",function(b){b.preventDefault();var c,d,e=a(this).attr("data-handle");a(this).hasClass("wpacu-for-script")?c=a('.wpacu-handle-notes-field[data-script-handle="'+e+'"]'):a(this).hasClass("wpacu-for-style")&&(c=a('.wpacu-handle-notes-field[data-style-handle="'+e+'"]')),c.length<1||(d=c.find(":input"),c.is(":hidden")?(c.show(),d.prop("disabled",!1)):(c.hide(),""===d.val().trim()&&"true"===d.attr("data-wpacu-is-empty-on-page-load")&&d.prop("disabled",!0).val("")))}),a(".wpacu-external-file-size").on("click",function(b){b.preventDefault();var c,d=a(this),e=d.attr("data-src");d.hide(),c=d.next(),c.show(),e.includes("/?")?a.get(e,{},function(a,b,d){if("success"!==b)return"N/A";c.html(wpacuBytesToSize(a.length))}):a.post(wpacu_object.ajax_url,{action:wpacu_object.plugin_id+"_get_external_file_size",wpacu_remote_file:e},function(a){c.html(a)})})},pluginLoadManager:function(){a(".wpacu_plugin_load_it").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")&&(a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wpacu_plugin_unload_site_wide[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_radio[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"))}),a(".wpacu_plugin_unload_site_wide").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_radio[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide")):(a(this).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"))}),a(".wpacu_plugin_unload_regex_radio").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"),a('.wpacu_plugin_unload_site_wide[data-wpacu-plugin-path="'+b+'"]').prop("checked",!1).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked")):(a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a(this).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"))}),a(".wpacu_plugin_load_exception_regex").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?a('.wpacu_load_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"):a('.wpacu_load_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide")})},hideLoadExceptionArea:function(b,c,d){b.hasClass("wpacu_is_bulk_unloaded")||b.find(".wpacu_bulk_unload").is(":checked")||a("div.wpacu_exception_options_area_wrap[data-"+d+'-handle="'+c+'"]').parent("div").addClass("wpacu_hide")},uncheckAllOtherBulkUnloadRules:function(a,b){var c=".wpacu_bulk_unload";!1===b&&(c=".wpacu_bulk_unload:not(.wpacu_unload_it_regex_checkbox)"),a.closest("tr").find(c).not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_checked").removeClass("wpacu_unload_checked")},httpLoadSource:function(a,b){window.XMLHttpRequest?xmlhttp=new XMLHttpRequest:xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");try{xmlhttp.onreadystatechange=function(){if(4===xmlhttp.readyState&&200===xmlhttp.status)return xmlhttp.responseText;200!==xmlhttp.status&&(console.log(a+" "+xmlhttp.status),b.css({color:"#cc0000"}).parent("div").find("[data-wpacu-source-status]").html('<small>* <em style="font-weight: 600;">'+wpacu_object.source_load_error_msg+"</em></small>"))},xmlhttp.open("GET",a,!1),xmlhttp.send()}catch(a){console.log(a)}},checkSourcesFor404Errors:function(){var b=a("[data-wpacu-external-source]");if(!(b.length<1)){var c=b.length,d="";b.each(function(b){var e=a(this),f=e.attr("data-wpacu-external-source");d+=f+"-at-wpacu-at-",b===c-1&&jQuery.post(wpacu_object.ajax_url+"?wpacu_check_external_url",{action:wpacu_object.plugin_id+"_check_external_urls_for_status_code",wpacu_check_urls:d},function(b){var c=jQuery.parseJSON(b);a.each(c,function(b,c){a('[data-wpacu-external-source="'+c+'"]').css({color:"#cc0000"}).parent("div").find("[data-wpacu-external-source-status]").html('<small>* <em style="font-weight: 600;">'+wpacu_object.source_load_error_msg+"</em></small>")})})})}}};a(window).load(function(){e.checkSourcesFor404Errors()}),a("#wpacu_post_type_select").change(function(){a("#wpacu_post_type_form").submit()}),a("#wpacu_taxonomy_select").change(function(){a("#wpacu_taxonomy_form").submit()}),a("#wpacu_dashboard").click(function(){a(this).prop("checked")?a("#wpacu-settings-assets-retrieval-mode").show():a("#wpacu-settings-assets-retrieval-mode").hide()}),a(".wpacu-dom-get-type-selection").change(function(){a(this).is(":checked")&&(a(".wpacu-dom-get-type-info").hide(),a("#"+a(this).attr("data-target")).fadeIn("fast"))}),a("#wpacu_frontend").click(function(){a(this).prop("checked")?a("#wpacu-settings-frontend-exceptions").show():a("#wpacu-settings-frontend-exceptions").hide()}),a(".google_fonts_combine_type").change(function(){a(".wpacu_google_fonts_combine_type_area").hide(),"async"===a(this).val()?a("#wpacu_google_fonts_combine_type_async_info_area").fadeIn():"async_preload"===a(this).val()?a("#wpacu_google_fonts_combine_type_async_preload_info_area").fadeIn():a("#wpacu_google_fonts_combine_type_rb_info_area").fadeIn()}),a("#wpacu_assets_list_layout").on("click change",function(){"by-location"===a(this).val()?a("#wpacu-assets-list-by-location-selected").fadeIn("fast"):a("#wpacu-assets-list-by-location-selected").fadeOut("fast")}),a("#wpacu_disable_jquery_migrate").on("click",function(){return!a(this).is(":checked")||(!(!a(this).is(":checked")||!confirm(wpacu_object.jquery_migration_disable_confirm_msg))||(a(this).prop("checked",!1),!1))}),a("#wpacu_disable_comment_reply").on("click",function(){return!a(this).is(":checked")||(!(!a(this).is(":checked")||!confirm(wpacu_object.comment_reply_disable_confirm_msg))||(a(this).prop("checked",!1),!1))}),a("[data-target-opacity]").click(function(){a(this).prop("checked")?a("#"+a(this).attr("data-target-opacity")).css({opacity:1}):a("#"+a(this).attr("data-target-opacity")).css({opacity:.4})}),a(".wpacu-combine-loaded-js-level").change(function(){a(this).is(":checked")&&(a(".wpacu_combine_loaded_js_level_area").removeClass("wpacu_active"),a("#"+a(this).attr("data-target")).addClass("wpacu_active"))});var f=a('#wpacu-update-button-area input[type="submit"]');f.parents("form").submit(function(){f.attr("disabled",!0),a("#wpacu-updating-settings").show()});var g=a("#wpacu-update-front-settings-area .wpacu_update_btn");if(g.parents("form").submit(function(){return g.attr("disabled",!0).addClass("wpacu_submitting"),a("#wpacu-updating-front-settings").show(),!0}),a("form#wpacu-settings-form, form#wpacu_home_page_form").submit(function(){return f.attr("disabled",!0),!0}),a(".wpacu_bulk_rule_checkbox, .wpacu_remove_preload").click(function(){var b=a(this).parents(".wpacu_bulk_change_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a(".wpacu_remove_regex").click(function(){var b=a(this).parents(".wpacu_regex_rule_row");a(this).prop("checked")?b.addClass("wpacu_enabled"):b.removeClass("wpacu_enabled")}),a(".wpacu_restore_position").click(function(){var b=a(this).parents(".wpacu_restore_position_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a(".wpacu_remove_global_attr").click(function(){var b=a(this).parents(".wpacu_remove_global_attr_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a("#wpacu_wrap_assets").length>0&&setTimeout(function(){e.load()},200),a("#wpacu-plugins-load-manager-wrap").length>0&&setTimeout(function(){e.pluginLoadManager()},200),"undefined"==typeof wpacu_object||a("#wpacu_meta_box_content").length<1)return!1;("default"===wpacu_object.list_show_status||""===wpacu_object.list_show_status||wpacu_object.override_assets_list_load)&&b(),"fetch_on_click"===wpacu_object.list_show_status&&a("#wpacu_ajax_fetch_on_click_btn").click(function(c){c.preventDefault(),a(this).hide(),a("#wpacu_fetching_assets_list_wrap").show(),b()}),a(document).on("click",".wp-admin.post-php .edit-post-header__settings button.is-primary",function(){var c=function(){if(0===a(".edit-post-header__settings .is-saving").length){if(a("#wpacu_unload_assets_area_loaded").length>0&&a("#wpacu_unload_assets_area_loaded").val()){a("#wpacu-assets-reloading").remove();var c='<span id="wpacu-assets-reloading" class="editor-post-saved-state is-wpacu-reloading">'+wpacu_object.reload_icon+wpacu_object.reload_msg+"</span>";a(".wp-admin.post-php .edit-post-header__settings").prepend(c)}a(".wpacu_asset_row").addClass("wpacu-loading"),b(),wpacuAjaxClearCache(),clearInterval(d)}},d=setInterval(c,900)})}),""!==wpacu_object.clear_cache_on_page_load&&wpacuAjaxClearCache(),jQuery(document).ready(function(a){try{var b;a('input[type="hidden"][name="_wp_http_referer"]').length>0&&(b=a('input[type="hidden"][name="_wp_http_referer"]').val(),b.includes("term.php?taxonomy=")&&b.includes("message=")&&wpacuAjaxClearCache(),b.includes("post.php?post=")&&b.includes("message=")&&wpacuAjaxClearCache())}catch(a){console.log(a)}});
1
+ function wpacuTabOpenSettingsArea(a,b){a.preventDefault();var c,d,e;for(d=document.getElementsByClassName("wpacu-settings-tab-content"),c=0;c<d.length;c++)d[c].style.display="none";for(e=document.getElementsByClassName("wpacu-settings-tab-link"),c=0;c<e.length;c++)e[c].className=e[c].className.replace(" active","");document.getElementById(b).style.display="table-cell",jQuery('a[href="#'+b+'"]').addClass("active"),jQuery("#wpacu-selected-tab-area").val(b)}function wpacuBytesToSize(a){return 0===a?"N/A":(a/1024).toFixed(4)+" KB"}function wpacuAjaxClearCache(){jQuery.post(wpacu_object.ajax_url+"?wpacu_clear_cache",{action:wpacu_object.plugin_id+"_clear_cache",time_r:(new Date).getTime()},function(a){})}jQuery(document).ready(function(a){function b(){if(!a("#wpacu_ajax_fetch_assets_list_dashboard_view").length)return!1;var b,c,d,f,g={};"direct"===wpacu_object.dom_get_type?(g[wpacu_object.plugin_name+"_load"]=1,g[wpacu_object.plugin_name+"_time_r"]=(new Date).getTime(),a.ajax({method:"GET",url:wpacu_object.page_url,data:g,cache:!1,complete:function(b,c){"error"===b.statusText&&(f=wpacu_object.ajax_direct_fetch_error,f=f.replace(/{wpacu_output}/,b.responseText),f=f.replace(/{wpacu_status_code_error}/,b.status),a("#wpacu_meta_box_content").html(f))}}).done(function(g){if(g.lastIndexOf(wpacu_object.start_del_e)<0||g.lastIndexOf(wpacu_object.end_del_e)<0||g.lastIndexOf(wpacu_object.start_del_h)<0||g.lastIndexOf(wpacu_object.end_del_h)<0)return f=wpacu_object.ajax_direct_fetch_error_with_success_response,f=f.replace(/{wpacu_output}/,xhr.responseText.replace(/(<([^>]+)>)/gi,"")),void a("#wpacu_meta_box_content").html(f);c=g.substring(g.lastIndexOf(wpacu_object.start_del_e)+wpacu_object.start_del_e.length,g.lastIndexOf(wpacu_object.end_del_e)),d=g.substring(g.lastIndexOf(wpacu_object.start_del_h)+wpacu_object.start_del_h.length,g.lastIndexOf(wpacu_object.end_del_h)),b={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list_e:c,wpacu_list_h:d,post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id,time_r:(new Date).getTime()},a.post(wpacu_object.ajax_url,b,function(b){b&&(a("#wpacu_meta_box_content").html(b),a("#wpacu_home_page_form").length>0&&a("#submit").show(),setTimeout(function(){e.load(),a(".wpacu_asset_row").removeClass("wpacu-loading"),a("#wpacu-assets-reloading").remove(),e.checkSourcesFor404Errors()},200))})})):"wp_remote_post"===wpacu_object.dom_get_type&&(b={action:wpacu_object.plugin_name+"_get_loaded_assets",post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id,time_r:(new Date).getTime()},a.post(wpacu_object.ajax_url,b,function(b){if(!b)return!1;a("#wpacu_meta_box_content").html(b),a("#wpacu_home_page_form").length>0&&a("#submit").show(),setTimeout(function(){e.load(),setTimeout(function(){e.checkSourcesFor404Errors()},100)},200)}))}a('input[name="wpacu_sub_tab_area"]').click(function(){a(this).prop("checked")&&a("#wpacu-selected-sub-tab-area").val(a(this).val())}),a("#wpacu_minify_css_enable, #wpacu_combine_loaded_css_enable, #wpacu_minify_js_enable, #wpacu_combine_loaded_js_enable, #wpacu_cdn_rewrite_enable, #wpacu_enable_test_mode").click(function(){a(this).prop("checked")?a('[data-linked-to="'+a(this).attr("id")+'"]').find(".wpacu-circle-status").addClass("wpacu-on").removeClass("wpacu-off"):a('[data-linked-to="'+a(this).attr("id")+'"]').find(".wpacu-circle-status").addClass("wpacu-off").removeClass("wpacu-on")}),a("#wpacu-mark-license-valid-button").click(function(){return confirm(wpacu_object.mark_license_valid_confirm)}),a("#wpacu-license-form").submit(function(){a("#edd_license_activate_btn").attr("disabled","disabled"),a("#edd_license_deactivate_btn").attr("disabled","disabled"),a(".wpacu-license-spinner").show()});var c,d;a("#wpacu-reset-drop-down").on("change keyup keydown mouseup mousedown click",function(){""===a(this).val()?(a("#wpacu-warning-read").removeClass("wpacu-visible"),a("#wpacu-reset-submit-btn").attr("disabled","disabled").removeClass("button-primary").addClass("button-secondary")):("reset_everything"===a(this).val()?a("#wpacu-license-data-remove-area").addClass("wpacu-visible"):a("#wpacu-license-data-remove-area").removeClass("wpacu-visible"),a("#wpacu-warning-read").addClass("wpacu-visible"),a("#wpacu-reset-submit-btn").removeAttr("disabled").removeClass("button-secondary").addClass("button-primary")),a(".wpacu-tools-area .wpacu-warning").hide(),c=a(this).find("option:selected"),a("#"+c.attr("data-id")).show()}),a("#wpacu-reset-submit-btn").on("click",function(){if("reset_settings"===a("#wpacu-reset-drop-down").val()?d=wpacu_object.reset_settings_confirm_msg:"reset_everything_except_settings"===a("#wpacu-reset-drop-down").val()?d=wpacu_object.reset_everything_except_settings_confirm_msg:"reset_everything"===a("#wpacu-reset-drop-down").val()&&(d=wpacu_object.reset_everything_confirm_msg),!confirm(d))return!1;a("#wpacu-action-confirmed").val("yes"),setTimeout(function(){"yes"===a("#wpacu-action-confirmed").val()&&a("#wpacu-tools-form").submit()},1e3)}),a("#wpacu-import-form").submit(function(){if(!confirm(wpacu_object.import_confirm_msg))return!1;a(this).find("button").addClass("wpacu-importing").prop("disabled",!0)});var e={load:function(){var b,c,d,f=".input-unload-on-this-page.wpacu-not-locked";a(".input-unload-on-this-page").on("click change",function(){b=a(this).attr("data-handle"),c=a(this).hasClass("wpacu_unload_rule_for_style")?"style":"script",a(this).prop("checked")?(e.uncheckAllOtherBulkUnloadRules(a(this),!1),a("div.wpacu_exception_options_area_wrap[data-"+c+'-handle="'+b+'"]').parent("div").removeClass("wpacu_hide"),a(this).closest("tr").addClass("wpacu_not_load")):(a(this).closest("tr").removeClass("wpacu_not_load"),d=a(this).parents(".wpacu_asset_row"),e.hideLoadExceptionArea(d,b,c))}),a(".wpacu-plugin-check-all").on("click",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin");a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]').find(f).prop("checked",!0).closest("tr").addClass("wpacu_not_load")}),a(".wpacu-plugin-uncheck-all").on("click",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin");a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]').find(f).prop("checked",!1).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu-plugin-check-load-all").on("click change",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin"),d=a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]');d.find(".wpacu_load_it_option_one.wpacu_load_exception").prop("checked",!0).closest("tr.wpacu_is_bulk_unloaded").removeClass("wpacu_not_load"),d.find(f).prop("checked",!1).trigger("change")}),a(".wpacu-plugin-uncheck-load-all").on("click change",function(b){b.preventDefault();var c=a(this).attr("data-wpacu-plugin"),d=a('table.wpacu_list_by_location[data-wpacu-plugin="'+c+'"]');d.find(".wpacu_load_it_option_one.wpacu_load_exception").prop("checked",!1).closest("tr.wpacu_is_bulk_unloaded").addClass("wpacu_not_load"),d.find(f).prop("checked",!1).trigger("change")}),a(".wpacu_keep_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").next().removeClass("remove_rule")}),a(".wpacu_remove_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").addClass("remove_rule")}),a(".wpacu_bulk_unload").on("click change",function(){b=a(this).attr("data-handle"),c=a(this).attr("data-handle-for"),d=a("[data-"+c+'-handle-row="'+b+'"]'),a(this).prop("checked")?(a(this).hasClass("wpacu_unload_it_regex_checkbox")||(a(this).parent("label").addClass("wpacu_input_load_checked"),a(this).closest("tr").addClass("wpacu_not_load")),a("div.wpacu_exception_options_area_wrap[data-"+c+'-handle="'+b+'"]').parent("div").removeClass("wpacu_hide"),a(this).hasClass("wpacu_global_unload")?(e.uncheckAllOtherBulkUnloadRules(a(this),!0),a('.input-unload-on-this-page[data-handle-for="'+c+'"][data-handle="'+b+'"]').prop("checked",!1)):a(this).hasClass("wpacu_post_type_unload")&&(e.uncheckAllOtherBulkUnloadRules(a(this),!1),a('.input-unload-on-this-page[data-handle-for="'+c+'"][data-handle="'+b+'"]').prop("checked",!1))):(a(this).hasClass("wpacu_unload_it_regex_checkbox")||(a(this).parent("label").removeClass("wpacu_input_load_checked"),a(this).closest("tr").removeClass("wpacu_not_load")),e.hideLoadExceptionArea(d,b,c)),d.hasClass("wpacu_is_bulk_unloaded")||a(".wpacu_bulk_unload:not(.wpacu_unload_it_regex_checkbox)").is(":checked")||a(this).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu_load_it_option_one.wpacu_load_exception").on("click change",function(){var b=a(this).attr("data-handle");if(a(this).prop("checked")){a(this).parent("label").addClass("wpacu_global_unload_exception");var c="";a(this).hasClass("wpacu_style")?c="style":a(this).hasClass("wpacu_script")&&(c="script"),a("#"+c+"_"+b).prop("checked",!1).trigger("change")}else a(this).parent("label").removeClass("wpacu_global_unload_exception")}),a(".wpacu_unload_it_regex_checkbox").on("click change",function(){var b=a(this).parents("li");a(this).prop("checked")?(b.find("label").addClass("wpacu_unload_checked"),b.find("textarea").prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_handle_unload_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_unload_checked"),b.find("textarea").blur().addClass("wpacu_disabled"),""===b.find("textarea").val().trim()&&(b.find("textarea").prop("disabled",!0).val(""),b.find(".wpacu_handle_unload_regex_input_wrap").addClass("wpacu_hide")))}),a(".wpacu_load_it_option_two").on("click change",function(){var b=a(this).parents("li");a(this).prop("checked")?(b.find("label").addClass("wpacu_bold"),b.find("textarea").prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_load_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_bold"),b.find("textarea").blur().addClass("wpacu_disabled"),""===b.find("textarea").val().trim()&&(b.find("textarea").prop("disabled",!0).val(""),b.find(".wpacu_load_regex_input_wrap").addClass("wpacu_hide")))}),a(".wpacu_script_attr_rule_input").on("click change",function(){a(this).is(":checked")&&(a(this).parents("ul").find(".wpacu_script_attr_rule_input").not(a(this)).prop("checked",!1),a(this).hasClass("wpacu_script_attr_rule_global")&&a(this).parents("ul").find(".wpacu-script-attr-make-exception").removeClass("wpacu_hide")),a(this).parents("ul").find(".wpacu_script_attr_rule_global").is(":checked")||a(this).parents("ul").find(".wpacu-script-attr-make-exception").addClass("wpacu_hide")}),a(".wpacu-add-handle-note").on("click",function(b){b.preventDefault();var c,d,e=a(this).attr("data-handle");a(this).hasClass("wpacu-for-script")?c=a('.wpacu-handle-notes-field[data-script-handle="'+e+'"]'):a(this).hasClass("wpacu-for-style")&&(c=a('.wpacu-handle-notes-field[data-style-handle="'+e+'"]')),c.length<1||(d=c.find(":input"),c.is(":hidden")?(c.show(),d.prop("disabled",!1)):(c.hide(),""===d.val().trim()&&"true"===d.attr("data-wpacu-is-empty-on-page-load")&&d.prop("disabled",!0).val("")))}),a(".wpacu-external-file-size").on("click",function(b){b.preventDefault();var c,d=a(this),e=d.attr("data-src");d.hide(),c=d.next(),c.show(),e.includes("/?")?a.get(e,{},function(a,b,d){if("success"!==b)return"N/A";c.html(wpacuBytesToSize(a.length))}):a.post(wpacu_object.ajax_url,{action:wpacu_object.plugin_id+"_get_external_file_size",wpacu_remote_file:e},function(a){c.html(a)})})},pluginLoadManager:function(){a(".wpacu_plugin_load_it").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")&&(a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wpacu_plugin_unload_site_wide[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_radio[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"))}),a(".wpacu_plugin_unload_site_wide").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_radio[data-wpacu-plugin-path="'+b+'"]').parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide")):(a(this).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"))}),a(".wpacu_plugin_unload_regex_radio").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_plugin_unload_rule_input_checked"),a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"),a('.wpacu_plugin_unload_site_wide[data-wpacu-plugin-path="'+b+'"]').prop("checked",!1).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked")):(a('.wpacu_plugin_unload_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"),a(this).parent("label").removeClass("wpacu_plugin_unload_rule_input_checked"),a('.wrap_plugin_load_exception_options[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide"))}),a(".wpacu_plugin_load_exception_regex").on("click",function(){var b=a(this).attr("data-wpacu-plugin-path");a(this).prop("checked")?a('.wpacu_load_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').removeClass("wpacu_hide"):a('.wpacu_load_regex_input_wrap[data-wpacu-plugin-path="'+b+'"]').addClass("wpacu_hide")})},hideLoadExceptionArea:function(b,c,d){b.hasClass("wpacu_is_bulk_unloaded")||b.find(".wpacu_bulk_unload").is(":checked")||a("div.wpacu_exception_options_area_wrap[data-"+d+'-handle="'+c+'"]').parent("div").addClass("wpacu_hide")},uncheckAllOtherBulkUnloadRules:function(a,b){var c=".wpacu_bulk_unload";!1===b&&(c=".wpacu_bulk_unload:not(.wpacu_unload_it_regex_checkbox)"),a.closest("tr").find(c).not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_checked").removeClass("wpacu_unload_checked")},checkSourcesFor404Errors:function(){var b=a("[data-wpacu-external-source]");if(!(b.length<1)){var c=b.length,d="";b.each(function(b){var e=a(this),f=e.attr("data-wpacu-external-source");d+=f+"-at-wpacu-at-",b===c-1&&jQuery.post(wpacu_object.ajax_url+"?wpacu_check_external_url",{action:wpacu_object.plugin_id+"_check_external_urls_for_status_code",wpacu_check_urls:d},function(b){var c=jQuery.parseJSON(b);a.each(c,function(b,c){a('[data-wpacu-external-source="'+c+'"]').css({color:"#cc0000"}).parent("div").find("[data-wpacu-external-source-status]").html('<small>* <em style="font-weight: 600;">'+wpacu_object.source_load_error_msg+"</em></small>")})})})}}};a(window).load(function(){e.checkSourcesFor404Errors()}),a("#wpacu_post_type_select").change(function(){a("#wpacu_post_type_form").submit()}),a("#wpacu_taxonomy_select").change(function(){a("#wpacu_taxonomy_form").submit()}),a("#wpacu_dashboard").click(function(){a(this).prop("checked")?a("#wpacu-settings-assets-retrieval-mode").show():a("#wpacu-settings-assets-retrieval-mode").hide()}),a(".wpacu-dom-get-type-selection").change(function(){a(this).is(":checked")&&(a(".wpacu-dom-get-type-info").hide(),a("#"+a(this).attr("data-target")).fadeIn("fast"))}),a("#wpacu_frontend").click(function(){a(this).prop("checked")?a("#wpacu-settings-frontend-exceptions").show():a("#wpacu-settings-frontend-exceptions").hide()}),a(".google_fonts_combine_type").change(function(){a(".wpacu_google_fonts_combine_type_area").hide(),"async"===a(this).val()?a("#wpacu_google_fonts_combine_type_async_info_area").fadeIn():"async_preload"===a(this).val()?a("#wpacu_google_fonts_combine_type_async_preload_info_area").fadeIn():a("#wpacu_google_fonts_combine_type_rb_info_area").fadeIn()}),a("#wpacu_assets_list_layout").on("click change",function(){"by-location"===a(this).val()?a("#wpacu-assets-list-by-location-selected").fadeIn("fast"):a("#wpacu-assets-list-by-location-selected").fadeOut("fast")}),a("#wpacu_disable_jquery_migrate").on("click",function(){return!a(this).is(":checked")||(!(!a(this).is(":checked")||!confirm(wpacu_object.jquery_migration_disable_confirm_msg))||(a(this).prop("checked",!1),!1))}),a("#wpacu_disable_comment_reply").on("click",function(){return!a(this).is(":checked")||(!(!a(this).is(":checked")||!confirm(wpacu_object.comment_reply_disable_confirm_msg))||(a(this).prop("checked",!1),!1))}),a("[data-target-opacity]").click(function(){a(this).prop("checked")?a("#"+a(this).attr("data-target-opacity")).css({opacity:1}):a("#"+a(this).attr("data-target-opacity")).css({opacity:.4})}),a(".wpacu-combine-loaded-js-level").change(function(){a(this).is(":checked")&&(a(".wpacu_combine_loaded_js_level_area").removeClass("wpacu_active"),a("#"+a(this).attr("data-target")).addClass("wpacu_active"))});var f=a('#wpacu-update-button-area input[type="submit"]');f.parents("form").submit(function(){f.attr("disabled",!0),a("#wpacu-updating-settings").show()});var g=a("#wpacu-update-front-settings-area .wpacu_update_btn");if(g.parents("form").submit(function(){return g.attr("disabled",!0).addClass("wpacu_submitting"),a("#wpacu-updating-front-settings").show(),!0}),a("form#wpacu-settings-form, form#wpacu_home_page_form").submit(function(){return f.attr("disabled",!0),!0}),a(".wpacu_bulk_rule_checkbox, .wpacu_remove_preload").click(function(){var b=a(this).parents(".wpacu_bulk_change_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a(".wpacu_remove_regex").click(function(){var b=a(this).parents(".wpacu_regex_rule_row");a(this).prop("checked")?b.addClass("wpacu_enabled"):b.removeClass("wpacu_enabled")}),a(".wpacu_restore_position").click(function(){var b=a(this).parents(".wpacu_restore_position_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a(".wpacu_remove_global_attr").click(function(){var b=a(this).parents(".wpacu_remove_global_attr_row");a(this).prop("checked")?b.addClass("wpacu_selected"):b.removeClass("wpacu_selected")}),a("#wpacu_wrap_assets").length>0&&setTimeout(function(){e.load()},200),a("#wpacu-plugins-load-manager-wrap").length>0&&setTimeout(function(){e.pluginLoadManager()},200),"undefined"==typeof wpacu_object||a("#wpacu_meta_box_content").length<1)return!1;("default"===wpacu_object.list_show_status||""===wpacu_object.list_show_status||wpacu_object.override_assets_list_load)&&b(),"fetch_on_click"===wpacu_object.list_show_status&&a("#wpacu_ajax_fetch_on_click_btn").click(function(c){c.preventDefault(),a(this).hide(),a("#wpacu_fetching_assets_list_wrap").show(),b()}),a(document).on("click",".wp-admin.post-php .edit-post-header__settings button.is-primary",function(){var c=function(){if(0===a(".edit-post-header__settings .is-saving").length){if(a("#wpacu_unload_assets_area_loaded").length>0&&a("#wpacu_unload_assets_area_loaded").val()){a("#wpacu-assets-reloading").remove();var c='<span id="wpacu-assets-reloading" class="editor-post-saved-state is-wpacu-reloading">'+wpacu_object.reload_icon+wpacu_object.reload_msg+"</span>";a(".wp-admin.post-php .edit-post-header__settings").prepend(c)}a(".wpacu_asset_row").addClass("wpacu-loading"),b(),wpacuAjaxClearCache(),clearInterval(d)}},d=setInterval(c,900)})}),""!==wpacu_object.clear_cache_on_page_load&&wpacuAjaxClearCache(),jQuery(document).ready(function(a){try{var b;a('input[type="hidden"][name="_wp_http_referer"]').length>0&&(b=a('input[type="hidden"][name="_wp_http_referer"]').val(),b.includes("term.php?taxonomy=")&&b.includes("message=")&&wpacuAjaxClearCache(),b.includes("post.php?post=")&&b.includes("message=")&&wpacuAjaxClearCache())}catch(a){console.log(a)}});
classes/Main.php CHANGED
@@ -17,7 +17,17 @@ class Main
17
*/
18
const END_DEL_ENQUEUED = 'END WPACU PLUGIN JSON ENQUEUED';
19
20
- /**
21
* @var string
22
* Can be managed in the Dashboard within the plugin's settings
23
* e.g. 'direct', 'wp_remote_post'
@@ -1118,6 +1128,13 @@ SQL;
1118
1119
$existingListData = $this->existingList($existingListJson, $existingListEmpty);
1120
1121
return $existingListData['list'];
1122
}
1123
@@ -1700,6 +1717,7 @@ SQL;
1700
}
1701
1702
echo self::START_DEL_ENQUEUED . base64_encode(json_encode($list)) . self::END_DEL_ENQUEUED; // Loaded via wp_enqueue_scripts()
1703
1704
// Do not allow further processes as cache plugins such as W3 Total Cache could alter the source code
1705
// and we need the non-minified version of the DOM (e.g. to determine the position of the elements)
@@ -1757,12 +1775,13 @@ SQL;
1757
1758
if (self::$domGetType === 'direct') {
1759
$wpacuListE = Misc::getVar('post', 'wpacu_list_e');
1760
- } elseif (self::$domGetType === 'wp_remote_post') {
1761
$wpRemotePost = wp_remote_post($pageUrl, array(
1762
'body' => array(
1763
WPACU_LOAD_ASSETS_REQ_KEY => 1
1764
)
1765
- ));
1766
1767
$contents = isset($wpRemotePost['body']) ? $wpRemotePost['body'] : '';
1768
@@ -1778,9 +1797,22 @@ SQL;
1778
);
1779
}
1780
1781
- // The list of assets could not be retrieved via "WP Remote Post" for this server
1782
// Print out the 'error' response to make the user aware about it
1783
- if (! $wpacuListE || ! $wpacuListH) {
1784
$data = array(
1785
'is_dashboard_view' => true,
1786
'plugin_settings' => $settings->getAll(),
@@ -1788,7 +1820,7 @@ SQL;
1788
);
1789
1790
$this->parseTemplate('meta-box-loaded', $data, true);
1791
- exit;
1792
}
1793
}
1794
@@ -1800,7 +1832,28 @@ SQL;
1800
'plugin_settings' => $settings->getAll()
1801
);
1802
1803
- $data['all'] = (array)json_decode($jsonE);
1804
1805
// [wpacu_pro]
1806
if (isset($data['all']['unloaded_plugins']) && ! empty($data['all']['unloaded_plugins'])) {
@@ -1871,7 +1924,7 @@ SQL;
1871
1872
$this->parseTemplate('meta-box-loaded', $data, true);
1873
1874
- exit;
1875
}
1876
1877
/**
17
*/
18
const END_DEL_ENQUEUED = 'END WPACU PLUGIN JSON ENQUEUED';
19
20
+ /**
21
+ *
22
+ */
23
+ const START_DEL_HARDCODED = 'BEGIN WPACU PLUGIN JSON HARDCODED';
24
+
25
+ /**
26
+ *
27
+ */
28
+ const END_DEL_HARDCODED = 'END WPACU PLUGIN JSON HARDCODED';
29
+
30
+ /**
31
* @var string
32
* Can be managed in the Dashboard within the plugin's settings
33
* e.g. 'direct', 'wp_remote_post'
1128
1129
$existingListData = $this->existingList($existingListJson, $existingListEmpty);
1130
1131
+ // No 'styles' or 'scripts' - Set them as empty to avoid any PHP warning errors
1132
+ foreach ( array('styles', 'scripts') as $assetType ) {
1133
+ if ( ! isset( $existingListData['list'][$assetType] ) || ! is_array( $existingListData['list'][$assetType] ) ) {
1134
+ $existingListData['list'][$assetType] = array();
1135
+ }
1136
+ }
1137
+
1138
return $existingListData['list'];
1139
}
1140
1717
}
1718
1719
echo self::START_DEL_ENQUEUED . base64_encode(json_encode($list)) . self::END_DEL_ENQUEUED; // Loaded via wp_enqueue_scripts()
1720
+ echo self::START_DEL_HARDCODED . '{wpacu_hardcoded_assets}' . self::END_DEL_HARDCODED; // Make the user aware of any hardcoded CSS/JS (if any)
1721
1722
// Do not allow further processes as cache plugins such as W3 Total Cache could alter the source code
1723
// and we need the non-minified version of the DOM (e.g. to determine the position of the elements)
1775
1776
if (self::$domGetType === 'direct') {
1777
$wpacuListE = Misc::getVar('post', 'wpacu_list_e');
1778
+ $wpacuListH = Misc::getVar('post', 'wpacu_list_h');
1779
+ } elseif (self::$domGetType === 'wp_remote_post') {
1780
$wpRemotePost = wp_remote_post($pageUrl, array(
1781
'body' => array(
1782
WPACU_LOAD_ASSETS_REQ_KEY => 1
1783
)
1784
+ ));
1785
1786
$contents = isset($wpRemotePost['body']) ? $wpRemotePost['body'] : '';
1787
1797
);
1798
}
1799
1800
+ // Hardcoded List
1801
+ if ($contents
1802
+ && ( strpos($contents, self::START_DEL_HARDCODED) !== false)
1803
+ && ( strpos($contents, self::END_DEL_HARDCODED) !== false)) {
1804
+ // Hardcoded (if any)
1805
+ $wpacuListH = Misc::extractBetween(
1806
+ $contents,
1807
+ self::START_DEL_HARDCODED,
1808
+ self::END_DEL_HARDCODED
1809
+ );
1810
+ }
1811
+
1812
+ // The list of assets COULD NOT be retrieved via "WP Remote Post" for this server
1813
+ // EITHER the enqueued or hardcoded list of assets HAS TO BE RETRIEVED
1814
// Print out the 'error' response to make the user aware about it
1815
+ if ( ! ($wpacuListE || $wpacuListH) ) {
1816
$data = array(
1817
'is_dashboard_view' => true,
1818
'plugin_settings' => $settings->getAll(),
1820
);
1821
1822
$this->parseTemplate('meta-box-loaded', $data, true);
1823
+ exit();
1824
}
1825
}
1826
1832
'plugin_settings' => $settings->getAll()
1833
);
1834
1835
+ // [START] Enqueued CSS/JS (most of them or all)
1836
+ $jsonE = base64_decode($wpacuListE);
1837
+ $data['all'] = (array)json_decode($jsonE);
1838
+
1839
+ // Make sure if there are no STYLES enqueued, the list will be empty to avoid any notice errors
1840
+ if (! isset($data['all']['styles'])) {
1841
+ $data['all']['styles'] = array();
1842
+ }
1843
+
1844
+ // Make sure if there are no SCRIPTS enqueued, the list will be empty to avoid any notice errors
1845
+ if (! isset($data['all']['scripts'])) {
1846
+ $data['all']['scripts'] = array();
1847
+ }
1848
+ // [END] Enqueued CSS/JS (most of them or all)
1849
+
1850
+ // [START] Hardcoded (if any)
1851
+ if ($wpacuListH) {
1852
+ // Only set the following variables if there is at least one hardcoded LINK/STYLE/SCRIPT
1853
+ $jsonH = base64_decode( $wpacuListH );
1854
+ $data['all']['hardcoded'] = (array) json_decode( $jsonH, ARRAY_A );
1855
+ }
1856
+ // [END] Hardcoded (if any)
1857
1858
// [wpacu_pro]
1859
if (isset($data['all']['unloaded_plugins']) && ! empty($data['all']['unloaded_plugins'])) {
1924
1925
$this->parseTemplate('meta-box-loaded', $data, true);
1926
1927
+ exit();
1928
}
1929
1930
/**
classes/OptimiseAssets/OptimizeCommon.php CHANGED
@@ -101,6 +101,11 @@ class OptimizeCommon
101
*/
102
public static function alterHtmlSource($htmlSource)
103
{
104
// This is useful to avoid changing the DOM via wp_loaded action hook
105
// In order to check how fast the page loads without the DOM changes (for debugging purposes)
106
$wpacuNoHtmlChanges = array_key_exists( 'wpacu_no_html_changes', $_GET );
@@ -172,6 +177,135 @@ class OptimizeCommon
172
return apply_filters( 'wpacu_html_source_after_optimization', $htmlSource );
173
}
174
175
/**
176
* @return string
177
*/
101
*/
102
public static function alterHtmlSource($htmlSource)
103
{
104
+ if (Main::instance()->isGetAssetsCall) {
105
+ $anyHardCodedAssets = self::getHardcodedAssets($htmlSource);
106
+ $htmlSource = str_replace('{wpacu_hardcoded_assets}', $anyHardCodedAssets, $htmlSource);
107
+ }
108
+
109
// This is useful to avoid changing the DOM via wp_loaded action hook
110
// In order to check how fast the page loads without the DOM changes (for debugging purposes)
111
$wpacuNoHtmlChanges = array_key_exists( 'wpacu_no_html_changes', $_GET );
177
return apply_filters( 'wpacu_html_source_after_optimization', $htmlSource );
178
}
179
180
+ /**
181
+ * @param $htmlSource
182
+ *
183
+ * @return string
184
+ */
185
+ public static function getHardcodedAssets($htmlSource)
186
+ {
187
+ $htmlSourceAlt = self::cleanerHtmlSource($htmlSource);
188
+
189
+ $hardCodedAssets = array(
190
+ 'link_and_style_tags' => array(), // LINK (rel="stylesheet") & STYLE (inline)
191
+ 'script_tags_src_and_inline' => array(), // SCRIPT (with "src" attribute) & SCRIPT (inline)
192
+ );
193
+
194
+ /*
195
+ * [START] Collect Hardcoded LINK (stylesheet) & STYLE tags
196
+ */
197
+ // Extract all the LINK tag that do not have "data-wpacu-debug-style-handle="
198
+ preg_match_all('#(?=(?P<link_tag><link[^>]*stylesheet[^>]*(>)))|(?=(?P<style_tag><style[^>]*?>.*</style>))#Umsi', $htmlSourceAlt, $matchesSourcesFromTags, PREG_SET_ORDER);
199
+
200
+ if (! empty($matchesSourcesFromTags)) {
201
+ foreach ($matchesSourcesFromTags as $matchedTagIndex => $matchedTag) {
202
+ // LINK "stylesheet" tags (if any)
203
+ if (isset($matchedTag['link_tag']) && trim($matchedTag['link_tag']) !== '' && (trim(strip_tags($matchedTag['link_tag'])) === '')) {
204
+ $matchedTagOutput = trim($matchedTag['link_tag']);
205
+
206
+ if ( strpos( $matchedTagOutput, 'data-wpacu-style-handle=' ) !== false ) {
207
+ // Skip the LINK with src that was enqueued properly and keep the hardcoded ones
208
+ continue;
209
+ }
210
+
211
+ $hardCodedAssets['link_and_style_tags'][] = $matchedTagOutput;
212
+ }
213
+
214
+ // STYLE inline tags (if any)
215
+ if (isset($matchedTag['style_tag']) && trim($matchedTag['style_tag']) !== '') {
216
+ $matchedTagOutput = trim($matchedTag['style_tag']);
217
+
218
+ // Do not add to the list elements such as Emojis (not relevant for hard-coded tags)
219
+ if (strpos($matchedTagOutput, 'img.wp-smiley') !== false
220
+ && strpos($matchedTagOutput, 'img.emoji') !== false
221
+ && strpos($matchedTagOutput, '!important;') !== false) {
222
+ continue;
223
+ }
224
+
225
+ foreach ( wp_styles()->done as $cssHandle ) {
226
+ if ( strpos( $matchedTagOutput, '<style id=\'' . trim( $cssHandle ) . '-inline-css\'' ) !== false ) {
227
+ // Do not consider the STYLE added via WordPress with wp_add_inline_style() as it's not hardcoded
228
+ continue 2;
229
+ }
230
+ }
231
+
232
+ $hardCodedAssets['link_and_style_tags'][] = $matchedTagOutput;
233
+ }
234
+ }
235
+ }
236
+ /*
237
+ * [END] Collect Hardcoded LINK (stylesheet) & STYLE tags
238
+ */
239
+
240
+ /*
241
+ * [START] Collect Hardcoded SCRIPT (src/inline)
242
+ */
243
+ preg_match_all('@<script[^>]*?>.*?</script>@si', $htmlSourceAlt, $matchesScriptTags, PREG_SET_ORDER);
244
+
245
+ if ( isset(wp_scripts()->done) && ! empty(wp_scripts()->done) ) {
246
+ foreach ( wp_scripts()->done as $assetHandle ) {
247
+ // Go through the STYLE list
248
+ foreach ( $matchesScriptTags as $matchedTagIndex => $matchedTag ) {
249
+ if ( isset( $matchedTag[0] ) ) {
250
+ $matchedTagOutput = trim( $matchedTag[0] );
251
+
252
+ if (strpos($matchedTagOutput, 'window._wpemojiSettings') !== false
253
+ && strpos($matchedTagOutput, 'twemoji') !== false) {
254
+ unset( $matchesScriptTags[ $matchedTagIndex ] );
255
+ continue;
256
+ }
257
+
258
+ // Check the type and only allow SCRIPT tags with type='text/javascript' or no type at all (it default to 'text/javascript')
259
+ $matchedTagInner = strip_tags($matchedTagOutput);
260
+ $matchedTagOnlyTags = str_replace($matchedTagInner, '', $matchedTagOutput);
261
+ preg_match_all('#type=(["\'])' . '(.*)' . '(["\'])#Usmi', $matchedTagOnlyTags, $outputMatches);
262
+ $scriptType = isset($outputMatches[2][0]) ? trim($outputMatches[2][0], '"\'') : 'text/javascript';
263
+
264
+ if (strpos($scriptType, 'text/javascript') === false) {
265
+ unset( $matchesScriptTags[ $matchedTagIndex ] );
266
+ }
267
+
268
+ if ( strpos( $matchedTagOutput, 'data-wpacu-script-handle=' ) !== false ) {
269
+ unset( $matchesScriptTags[ $matchedTagIndex ] ); // remove the SCRIPT with src that was enqueued properly and keep the hardcoded ones
270
+ continue;
271
+ }
272
+
273
+ if ( strpos( $matchedTagOutput, 'data-wpacu-own-inline-script=') !== false ) {
274
+ unset( $matchesScriptTags[ $matchedTagIndex ] ); // remove plugin's own SCRIPT tags as they are not relevant in this context
275
+ continue;
276
+ }
277
+
278
+ // Now, go through the list of inline SCRIPTs associated with an enqueued SCRIPT (with "src" attribute)
279
+ $anyInlineAssocWithJsHandle = OptimizeJs::getInlineAssociatedWithScriptHandle($assetHandle, wp_scripts()->registered, 'handle', false);
280
+
281
+ if (! empty($anyInlineAssocWithJsHandle)) {
282
+ foreach ($anyInlineAssocWithJsHandle as $jsInlineTagContent) {
283
+ if (trim($jsInlineTagContent) !== '' && strpos($matchedTagOutput, $jsInlineTagContent)) {
284
+ unset( $matchesScriptTags[ $matchedTagIndex ] );
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+ }
293
+
294
+ // Go through the remaining hardcoded (SCRIPT) ones (if any)
295
+ if (isset($matchesScriptTags) && ! empty($matchesScriptTags)) {
296
+ foreach ($matchesScriptTags as $matchedTag) {
297
+ if (isset($matchedTag[0]) && $matchedTag[0] && strpos($matchedTag[0], '<script') === 0) {
298
+ $hardCodedAssets['script_src_and_inline_tags'][] = trim( $matchedTag[0] );
299
+ }
300
+ }
301
+ }
302
+ /*
303
+ * [END] Collect Hardcoded SCRIPT (src/inline)
304
+ */
305
+
306
+ return base64_encode(json_encode($hardCodedAssets));
307
+ }
308
+
309
/**
310
* @return string
311
*/
classes/OwnAssets.php CHANGED
@@ -257,6 +257,9 @@ HTML;
257
'start_del_e' => Main::START_DEL_ENQUEUED,
258
'end_del_e' => Main::END_DEL_ENQUEUED,
259
260
'ajax_url' => admin_url('admin-ajax.php'),
261
'post_id' => $postId, // if any
262
'page_url' => $pageUrl // post, page, custom post type, homepage etc.
@@ -274,7 +277,7 @@ HTML;
274
$submitTicketLink = 'https://wordpress.org/support/plugin/wp-asset-clean-up';
275
// [/wpacu_lite]
276
277
- $wpacuObjectData['ajax_direct_fetch_error'] = <<<HTML
278
<div class="ajax-direct-call-error-area">
279
<p class="note"><strong>Note:</strong> The checked URL returned an error when fetching the assets via AJAX call. This could be because of a firewall that is blocking the AJAX call, a redirect loop or an error in the script that is retrieving the output which could be due to an incompatibility between the plugin and the WordPress setup you are using.</p>
280
<p>Here is the response from the call:</p>
@@ -289,8 +292,25 @@ HTML;
289
<td>Select "WP Remote Post" as a method of retrieving the assets from the "Settings" page. If that doesn't fix the issue, just use "Manage in Front-end" option which should always work and <a target="_blank" href="{$submitTicketLink}">submit a ticket</a> about your problem.</td>
290
</tr>
291
<tr>
292
- <td><strong>Output:</strong></td>
293
- <td>{wpacu_output}</td>
294
</tr>
295
</table>
296
</div>
@@ -546,7 +566,6 @@ JS;
546
//wpacuTabOpenSettingsArea(event, hashFromUrl.substring(1));
547
//console.log(hashFromUrl);
548
jQuery('a[href="'+ hashFromUrl +'"]').trigger('click');
549
- //console.log(hashFromUrl);
550
//console.log(hashFromUrl.substring(1));
551
}
552
</script>
257
'start_del_e' => Main::START_DEL_ENQUEUED,
258
'end_del_e' => Main::END_DEL_ENQUEUED,
259
260
+ 'start_del_h' => Main::START_DEL_HARDCODED,
261
+ 'end_del_h' => Main::END_DEL_HARDCODED,
262
+
263
'ajax_url' => admin_url('admin-ajax.php'),
264
'post_id' => $postId, // if any
265
'page_url' => $pageUrl // post, page, custom post type, homepage etc.
277
$submitTicketLink = 'https://wordpress.org/support/plugin/wp-asset-clean-up';
278
// [/wpacu_lite]
279
280
+ $wpacuObjectData['ajax_direct_fetch_error'] = <<<HTML
281
<div class="ajax-direct-call-error-area">
282
<p class="note"><strong>Note:</strong> The checked URL returned an error when fetching the assets via AJAX call. This could be because of a firewall that is blocking the AJAX call, a redirect loop or an error in the script that is retrieving the output which could be due to an incompatibility between the plugin and the WordPress setup you are using.</p>
283
<p>Here is the response from the call:</p>
292
<td>Select "WP Remote Post" as a method of retrieving the assets from the "Settings" page. If that doesn't fix the issue, just use "Manage in Front-end" option which should always work and <a target="_blank" href="{$submitTicketLink}">submit a ticket</a> about your problem.</td>
293
</tr>
294
<tr>
295
+ <td valign="top"><strong>Output:</strong></td>
296
+ <td valign="top">{wpacu_output}</td>
297
+ </tr>
298
+ </table>
299
+ </div>
300
+ HTML;
301
+
302
+ // Sometimes, 200 OK (success) is returned, but due to an issue with the page, the assets list is not retrieved
303
+ $wpacuObjectData['ajax_direct_fetch_error_with_success_response'] = <<<HTML
304
+ <div style="overflow-y: scroll; max-height: 290px;" class="ajax-direct-call-error-area">
305
+ <p class="note"><strong>Note:</strong> The assets could not be fetched via the AJAX call. Here is the response:</p>
306
+ <table>
307
+ <tr>
308
+ <td valign="top"><strong>Suggestion:</strong></td>
309
+ <td>Select "WP Remote Post" as a method of retrieving the assets from the "Settings" page. If that doesn't fix the issue, just use "Manage in Front-end" option which should always work and <a target="_blank" href="{$submitTicketLink}">submit a ticket</a> about your problem.</td>
310
+ </tr>
311
+ <tr>
312
+ <td valign="top"><strong>Output:</strong></td>
313
+ <td valign="top">{wpacu_output}</td>
314
</tr>
315
</table>
316
</div>
566
//wpacuTabOpenSettingsArea(event, hashFromUrl.substring(1));
567
//console.log(hashFromUrl);
568
jQuery('a[href="'+ hashFromUrl +'"]').trigger('click');
569
//console.log(hashFromUrl.substring(1));
570
}
571
</script>
classes/Tools.php CHANGED
@@ -15,6 +15,11 @@ class Tools
15
*/
16
public $wpacuFor = 'reset';
17
18
/**
19
* @var
20
*/
@@ -36,6 +41,14 @@ class Tools
36
public function __construct()
37
{
38
$this->wpacuFor = Misc::getVar('request', 'wpacu_for', $this->wpacuFor);
39
}
40
41
/**
@@ -59,6 +72,10 @@ class Tools
59
$this->downloadSystemInfo();
60
}
61
62
if (! empty($_POST) && $this->wpacuFor === 'import_export') {
63
$wpacuImportExport = new ImportExport();
64
@@ -116,6 +133,10 @@ class Tools
116
$this->data['system_info'] = $this->getSystemInfo();
117
}
118
119
Main::instance()->parseTemplate('admin-page-tools', $this->data, true);
120
}
121
@@ -491,6 +512,27 @@ SQL;
491
return json_encode($arrayFromJson);
492
}
493
494
/**
495
*
496
*/
15
*/
16
public $wpacuFor = 'reset';
17
18
+ /**
19
+ * @var array
20
+ */
21
+ public $errorLogsData = array();
22
+
23
/**
24
* @var
25
*/
41
public function __construct()
42
{
43
$this->wpacuFor = Misc::getVar('request', 'wpacu_for', $this->wpacuFor);
44
+
45
+ if ($this->wpacuFor === 'debug') {
46
+ $isLogPHPErrors = @ini_get( 'log_errors' );
47
+ $logPHPErrorsLocation = @ini_get( 'error_log' ) ?: 'none set';
48
+
49
+ $this->errorLogsData['log_status'] = $isLogPHPErrors;
50
+ $this->errorLogsData['log_file'] = $logPHPErrorsLocation;
51
+ }
52
}
53
54
/**
72
$this->downloadSystemInfo();
73
}
74
75
+ if (Misc::getVar('post', 'wpacu-get-error-log') && is_file($this->errorLogsData['log_file'])) {
76
+ self::downloadFile($this->errorLogsData['log_file']);
77
+ }
78
+
79
if (! empty($_POST) && $this->wpacuFor === 'import_export') {
80
$wpacuImportExport = new ImportExport();
81
133
$this->data['system_info'] = $this->getSystemInfo();
134
}
135
136
+ if ($this->data['for'] === 'debug') {
137
+ $this->data['error_log'] = $this->errorLogsData;
138
+ }
139
+
140
Main::instance()->parseTemplate('admin-page-tools', $this->data, true);
141
}
142
512
return json_encode($arrayFromJson);
513
}
514
515
+ /**
516
+ * e.g. error_log file for debugging purposes
517
+ *
518
+ * @param $localPathToFile
519
+ */
520
+ public static function downloadFile($localPathToFile)
521
+ {
522
+ if (! Menu::userCanManageAssets()) {
523
+ exit();
524
+ }
525
+
526
+ $date = date('j-M-Y');
527
+ $host = parse_url(site_url(), PHP_URL_HOST);
528
+
529
+ header('Content-type: text/plain');
530
+ header('Content-Disposition: attachment; filename="'.$host.'-website-errors-'.$date.'.log"');
531
+
532
+ echo file_get_contents($localPathToFile);
533
+ exit();
534
+ }
535
+
536
/**
537
*
538
*/
classes/Update.php CHANGED
@@ -613,8 +613,11 @@ HTML;
613
}
614
615
// Make sure all entries are unique (no handle duplicates)
616
- $existingList['styles'] = array_unique($existingList['styles']);
617
- $existingList['scripts'] = array_unique($existingList['scripts']);
618
619
Misc::addUpdateOption( WPACU_PLUGIN_ID . '_global_unload', json_encode(Misc::filterList($existingList)));
620
}
613
}
614
615
// Make sure all entries are unique (no handle duplicates)
616
+ foreach (array('styles', 'scripts') as $assetType) {
617
+ if ( isset( $existingList[$assetType] ) && is_array( $existingList[$assetType] ) ) {
618
+ $existingList[$assetType] = array_unique( $existingList[$assetType] );
619
+ }
620
+ }
621
622
Misc::addUpdateOption( WPACU_PLUGIN_ID . '_global_unload', json_encode(Misc::filterList($existingList)));
623
}
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: minify css, minify javascript, defer css javascript, page speed, dequeue,
4
Donate link: https://www.gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=wp_org_lite&utm_medium=donate
5
Requires at least: 4.5
6
Tested up to: 5.3.2
7
- Stable tag: 1.3.5.5
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
@@ -179,6 +179,11 @@ With the recently released "Test Mode" feature, you can safely unload assets on
179
4. Homepage CSS & JS Management (List sorted by location)
180
181
== Changelog ==
182
= 1.3.5.5 =
183
* Updated Minify CSS library for PHP 7.4 support (avoid any PHP errors from "implode" function)
184
* Improvement: "display=" is now also applied to Google Fonts loading via WebFontConfig within inline SCRIPT tags
4
Donate link: https://www.gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=wp_org_lite&utm_medium=donate
5
Requires at least: 4.5
6
Tested up to: 5.3.2
7
+ Stable tag: 1.3.5.6
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
179
4. Homepage CSS & JS Management (List sorted by location)
180
181
== Changelog ==
182
+ = 1.3.5.6 =
183
+ * Added "Debugging" tab to "Tools" page, allowing the option to download the error log file & view other debugging options
184
+ * Improvement: Sometimes, 200 OK (success) is returned, but due to an issue with the page, the assets list is not retrieved; Notify the admin about this
185
+ * Fix: Sometimes, warnings (harmless, but obtrusive) were given when updating plugin's settings and previewing pages: "Warning: array_unique() expects parameter 1 to be array, null given"
186
+
187
= 1.3.5.5 =
188
* Updated Minify CSS library for PHP 7.4 support (avoid any PHP errors from "implode" function)
189
* Improvement: "display=" is now also applied to Google Fonts loading via WebFontConfig within inline SCRIPT tags
templates/admin-page-tools.php CHANGED
@@ -15,6 +15,7 @@ do_action('wpacu_admin_notices');
15
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=reset'); ?>" class="nav-tab <?php if ($data['for'] === 'reset') { ?>nav-tab-active<?php } ?>"><?php _e('Reset', 'wp-asset-clean-up'); ?></a>
16
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=system_info'); ?>" class="nav-tab <?php if ($data['for'] === 'system_info') { ?>nav-tab-active<?php } ?>"><?php _e('System Info', 'wp-asset-clean-up'); ?></a>
17
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=storage'); ?>" class="nav-tab <?php if ($data['for'] === 'storage') { ?>nav-tab-active<?php } ?>"><?php _e('Storage Info', 'wp-asset-clean-up'); ?></a>
18
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=import_export'); ?>" class="nav-tab <?php if ($data['for'] === 'import_export') { ?>nav-tab-active<?php } ?>"><?php _e('Import &amp; Export', 'wp-asset-clean-up'); ?></a>
19
</nav>
20
@@ -30,11 +31,11 @@ do_action('wpacu_admin_notices');
30
<option data-id="wpacu-warning-reset-everything" value="reset_everything"><?php _e('Reset everything: "Settings", All Unloads (bulk &amp; per page) &amp; Load Exceptions', 'wp-asset-clean-up'); ?></option>
31
</select>
32
33
- <div id="wpacu-license-data-remove-area">
34
- <label for="wpacu-remove-license-data">
35
- <input id="wpacu-remove-license-data" type="checkbox" name="wpacu-remove-license-data" value="1" /> <?php _e('Also remove license data in case the premium version was active at any point', 'wp-asset-clean-up'); ?>
36
- </label>
37
- </div>
38
39
<div id="wpacu-warning-read"><span class="dashicons dashicons-warning"></span> <strong><?php _e('Please read carefully below what the chosen action does as this process is NOT reversible.', 'wp-asset-clean-up'); ?></strong></div>
40
@@ -144,6 +145,40 @@ do_action('wpacu_admin_notices');
144
<?php }
145
}
146
147
if ($data['for'] === 'import_export') {
148
?>
149
<div id="wpacu-import-area" class="wpacu-export-import-area">
@@ -159,7 +194,7 @@ do_action('wpacu_admin_notices');
159
<span style="padding-top: 1px;"
160
class="dashicons dashicons-upload"></span>
161
<?php esc_attr_e('Import', 'wp-asset-clean-up'); ?>
162
- <img class="wpacu-spinner" src="<?php site_url(); ?>/wp-includes/images/wpspin-2x.gif" alt="" />
163
</button> &nbsp;<small>* only .json extension allowed</small>
164
</p>
165
<?php wp_nonce_field('wpacu_do_import', 'wpacu_do_import_nonce'); ?>
15
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=reset'); ?>" class="nav-tab <?php if ($data['for'] === 'reset') { ?>nav-tab-active<?php } ?>"><?php _e('Reset', 'wp-asset-clean-up'); ?></a>
16
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=system_info'); ?>" class="nav-tab <?php if ($data['for'] === 'system_info') { ?>nav-tab-active<?php } ?>"><?php _e('System Info', 'wp-asset-clean-up'); ?></a>
17
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=storage'); ?>" class="nav-tab <?php if ($data['for'] === 'storage') { ?>nav-tab-active<?php } ?>"><?php _e('Storage Info', 'wp-asset-clean-up'); ?></a>
18
+ <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=debug'); ?>" class="nav-tab <?php if ($data['for'] === 'debug') { ?>nav-tab-active<?php } ?>"><?php _e('Debugging', 'wp-asset-clean-up'); ?></a>
19
<a href="<?php echo admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=import_export'); ?>" class="nav-tab <?php if ($data['for'] === 'import_export') { ?>nav-tab-active<?php } ?>"><?php _e('Import &amp; Export', 'wp-asset-clean-up'); ?></a>
20
</nav>
21
31
<option data-id="wpacu-warning-reset-everything" value="reset_everything"><?php _e('Reset everything: "Settings", All Unloads (bulk &amp; per page) &amp; Load Exceptions', 'wp-asset-clean-up'); ?></option>
32
</select>
33
34
+ <div id="wpacu-license-data-remove-area">
35
+ <label for="wpacu-remove-license-data">
36
+ <input id="wpacu-remove-license-data" type="checkbox" name="wpacu-remove-license-data" value="1" /> <?php _e('Also remove license data (not recommended, unless you\'re uninstalling / deleting the plugin)', 'wp-asset-clean-up'); ?>
37
+ </label>
38
+ </div>
39
40
<div id="wpacu-warning-read"><span class="dashicons dashicons-warning"></span> <strong><?php _e('Please read carefully below what the chosen action does as this process is NOT reversible.', 'wp-asset-clean-up'); ?></strong></div>
41
145
<?php }
146
}
147
148
+ if ($data['for'] === 'debug') {
149
+ $logPHPErrorsLocationFileSize = false;
150
+
151
+ $isLogPHPErrors = $data['error_log']['log_status'];
152
+ $logPHPErrorsLocation = $data['error_log']['log_file'];
153
+
154
+ if ($logPHPErrorsLocation !== 'none_set' && is_file($logPHPErrorsLocation)) {
155
+ $logPHPErrorsLocationFileSize = filesize($logPHPErrorsLocation);
156
+ $logPHPErrorsLocationFileSizeFormatted = \WpAssetCleanUp\Misc::formatBytes($logPHPErrorsLocationFileSize);
157
+ }
158
+ ?>
159
+ <form method="post" action="">
160
+ <p>In case you experience timeout errors, blank screens, 500 internal server errors and so on, it's a good idea to check the PHP error logs (they are usually activated in your PHP.ini configuration) for more information about the reason behind any issues you might have. The error log file (if any set), it meant to record PHP errors (either from Asset CleanUp or any other active plugin/theme, etc.).</p>
161
+ <ul>
162
+ <li>Log PHP Errors Status: <strong><?php echo $isLogPHPErrors ? 'On' : 'Off'; ?></strong></li>
163
+ <li>Log PHP Errors Location: <code><?php echo $logPHPErrorsLocation; ?></code> <?php if($logPHPErrorsLocationFileSize) { ?> / <?php _e('File Size', 'wp-asset-clean-up'); ?>: <?php echo $logPHPErrorsLocationFileSizeFormatted; ?> &nbsp; <input style="vertical-align: middle;" type="submit" class="button button-primary" value="Download Error Log File" /><?php } ?></li>
164
+ </ul>
165
+ <input type="hidden" name="wpacu-get-error-log" value="1" />
166
+ </form>
167
+ <hr />
168
+ <div>There are situations when you might want to access a certain page as if <?php echo WPACU_PLUGIN_TITLE; ?> is deactivated or you wish to access the page with only a part of the plugin's settings (without going through the standard deactivation and re-activation process which takes time). To do that, you can use the following query strings:</div>
169
+ <style type="text/css">
170
+ ul.wpacu-debug-list-params li {
171
+ margin-bottom: 15px;
172
+ }
173
+ </style>
174
+ <ul class="wpacu-debug-list-params">
175
+ <li><a href="<?php echo site_url().'/?wpacu_debug'; ?>"><code><?php echo site_url(); ?><strong>/?wpacu_debug</strong></code></a> - If you are logged-in, it will print a form at the bottom of the requested page with options to view the page with certain options deactivated (e.g. do not apply any JavaScript unloading), as well as print information about all the unloaded assets.</li>
176
+ <li><a href="<?php echo site_url().'/?wpacu_no_load'; ?>"><code><?php echo site_url(); ?><strong>/?wpacu_no_load</strong></code></a> - On any page request if you apply this parameter, it will be like <?php echo WPACU_PLUGIN_TITLE; ?> is deactivated. The plugin's menu from the top admin bar (if shown), will also get hidden.</li>
177
+ <li><a href="<?php echo site_url().'/?wpacu_clean_load'; ?>"><code><?php echo site_url(); ?><strong>/?wpacu_clean_load</strong></code></a> - This parameter is useful if you are checking a website that has lots of CSS/JS unloaded and combined by <?php echo WPACU_PLUGIN_TITLE; ?> or other performance plugin, but you want to view the page as if no optimization was applied (e.g. 20 CSS files were combined into one, but you want to see each one in the HTML source code, for debugging purposes). The difference between this option and "wpacu_no_load" is that it also attempts to prevent any optimization made by other performance plugins, not just from <?php echo WPACU_PLUGIN_TITLE; ?></li>
178
+ </ul>
179
+ <?php
180
+ }
181
+
182
if ($data['for'] === 'import_export') {
183
?>
184
<div id="wpacu-import-area" class="wpacu-export-import-area">
194
<span style="padding-top: 1px;"
195
class="dashicons dashicons-upload"></span>
196
<?php esc_attr_e('Import', 'wp-asset-clean-up'); ?>
197
+ <img class="wpacu-spinner" src="<?php echo includes_url('images/wpspin-2x.gif'); ?>" alt="" />
198
</button> &nbsp;<small>* only .json extension allowed</small>
199
</p>
200
<?php wp_nonce_field('wpacu_do_import', 'wpacu_do_import_nonce'); ?>
templates/meta-box-loaded-assets/_asset-script-single-row/_source.php CHANGED
@@ -48,7 +48,7 @@ if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && $data['row'
48
}
49
?>
50
<div class="wpacu-source-row" style="margin-top: 12px;">
51
- <?php _e('Source:', 'wp-asset-clean-up'); ?> <a target="_blank" style="color: green;" <?php if ($isExternalSrc) { ?> data-wpacu-external-source="<?php echo $data['row']['obj']->srcHref . $verToAppend; ?>" <?php } ?> href="<?php echo $data['row']['obj']->src . $verToAppend; ?>"><?php echo $relSrc; ?></a> <?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?>
52
&nbsp;&#10230;&nbsp;
53
Preload (if kept loaded)?
54
&nbsp;<select style="display: inline-block; width: auto;"
48
}
49
?>
50
<div class="wpacu-source-row" style="margin-top: 12px;">
51
+ <?php _e('Source:', 'wp-asset-clean-up'); ?> <a target="_blank" style="color: green;" <?php if ($isExternalSrc) { ?> data-wpacu-external-source="<?php echo $data['row']['obj']->srcHref . $verToAppend; ?>" <?php } ?> href="<?php echo $data['row']['obj']->srcHref . $verToAppend; ?>"><?php echo $relSrc; ?></a> <?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?>
52
&nbsp;&#10230;&nbsp;
53
Preload (if kept loaded)?
54
&nbsp;<select style="display: inline-block; width: auto;"
templates/meta-box-loaded.php CHANGED
@@ -21,18 +21,15 @@ if (! $metaBoxLoadedFine) {
21
<p><span class="dashicons dashicons-warning"></span> <?php _e('It looks like "WP Remote Post" method for retrieving assets via the Dashboard is not working in this environment.', 'wp-asset-clean-up'); ?></p>
22
<p><?php _e('Since the server (from its IP) is making the call, it will not "behave" in the same way as the "Direct" method, which could bypass for instance any authentication request (you might use a staging website that is protected by login credentials).', 'wp-asset-clean-up'); ?></p>
23
<p><?php _e('Consider using "Direct" method. If that doesn\'t work either, use the "Manage in the Front-end" option (which should always work in any instance) and submit a ticket regarding the problem you\'re having. Here\'s the output received by the call:', 'wp-asset-clean-up'); ?></p>
24
-
25
<table class="table-data">
26
<tr>
27
<td><strong><?php _e('CODE', 'wp-asset-clean-up'); ?>:</strong></td>
28
<td><?php echo $data['wp_remote_post']['response']['code']; ?></td>
29
</tr>
30
-
31
<tr>
32
<td><strong><?php _e('MESSAGE', 'wp-asset-clean-up'); ?>:</strong></td>
33
<td><?php echo $data['wp_remote_post']['response']['message']; ?></td>
34
</tr>
35
-
36
<tr>
37
<td><strong><?php _e('OUTPUT', 'wp-asset-clean-up'); ?>:</strong></td>
38
<td><?php echo $data['wp_remote_post']['body']; ?></td>
@@ -40,8 +37,7 @@ if (! $metaBoxLoadedFine) {
40
</table>
41
</div>
42
<?php
43
-
44
- exit;
45
}
46
47
$tipsClass = new \WpAssetCleanUp\Tips();
21
<p><span class="dashicons dashicons-warning"></span> <?php _e('It looks like "WP Remote Post" method for retrieving assets via the Dashboard is not working in this environment.', 'wp-asset-clean-up'); ?></p>
22
<p><?php _e('Since the server (from its IP) is making the call, it will not "behave" in the same way as the "Direct" method, which could bypass for instance any authentication request (you might use a staging website that is protected by login credentials).', 'wp-asset-clean-up'); ?></p>
23
<p><?php _e('Consider using "Direct" method. If that doesn\'t work either, use the "Manage in the Front-end" option (which should always work in any instance) and submit a ticket regarding the problem you\'re having. Here\'s the output received by the call:', 'wp-asset-clean-up'); ?></p>
24
<table class="table-data">
25
<tr>
26
<td><strong><?php _e('CODE', 'wp-asset-clean-up'); ?>:</strong></td>
27
<td><?php echo $data['wp_remote_post']['response']['code']; ?></td>
28
</tr>
29
<tr>
30
<td><strong><?php _e('MESSAGE', 'wp-asset-clean-up'); ?>:</strong></td>
31
<td><?php echo $data['wp_remote_post']['response']['message']; ?></td>
32
</tr>
33
<tr>
34
<td><strong><?php _e('OUTPUT', 'wp-asset-clean-up'); ?>:</strong></td>
35
<td><?php echo $data['wp_remote_post']['body']; ?></td>
37
</table>
38
</div>
39
<?php
40
+ exit();
41
}
42
43
$tipsClass = new \WpAssetCleanUp\Tips();
wpacu.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
* Plugin Name: Asset CleanUp: Page Speed Booster
4
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
5
- * Version: 1.3.5.5
6
* Description: Unload Chosen Scripts & Styles from Posts/Pages to reduce HTTP Requests, Combine/Minify CSS/JS files
7
* Author: Gabriel Livan
8
* Author URI: http://gabelivan.com/
@@ -12,7 +12,7 @@
12
13
// Is the Pro version triggered before the Lite one and are both plugins active?
14
if (! defined('WPACU_PLUGIN_VERSION')) {
15
- define('WPACU_PLUGIN_VERSION', '1.3.5.5');
16
}
17
18
// Exit if accessed directly
2
/*
3
* Plugin Name: Asset CleanUp: Page Speed Booster
4
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
5
+ * Version: 1.3.5.6
6
* Description: Unload Chosen Scripts & Styles from Posts/Pages to reduce HTTP Requests, Combine/Minify CSS/JS files
7
* Author: Gabriel Livan
8
* Author URI: http://gabelivan.com/
12
13
// Is the Pro version triggered before the Lite one and are both plugins active?
14
if (! defined('WPACU_PLUGIN_VERSION')) {
15
+ define('WPACU_PLUGIN_VERSION', '1.3.5.6');
16
}
17
18
// Exit if accessed directly