Asset CleanUp: Page Speed Booster - Version 1.3.5.0

Version Description

  • Bug Fix: Sometimes, when external URLs (from a different domain) were present in the assets management list, when checking them via JavaScript for their status, the browser returned some errors interfering with "Add Media" not allowing the user to upload new images from the edit post/page area
Download this release

Release Info

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

Code changes from version 1.3.4.9 to 1.3.5.0

assets/script.min.js CHANGED
@@ -1 +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"}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)+wpacu_object.start_del.length,b.lastIndexOf(wpacu_object.end_del)),d={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list:c,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,d,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(){a(this).prop("checked")?(e.uncheckAllOtherUnloadRules(a(this)),d=a(this).parents(".wpacu_asset_row"),b=a(this).attr("data-handle"),c=a(this).hasClass("wpacu_unload_rule_for_style")?"style":"script",e.hideLoadExceptionArea(d,b,c),a(this).closest("tr").addClass("wpacu_not_load")):a(this).closest("tr").removeClass("wpacu_not_load")}),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_global_unload").click(function(){b=a(this).attr("data-handle"),a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_input_load_checked"),a(this).closest("tr").addClass("wpacu_not_load"),e.uncheckAllOtherUnloadRules(a(this))):(a(this).parent("label").removeClass("wpacu_input_load_checked"),a(this).closest("tr").removeClass("wpacu_not_load"))}),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+'"]').removeClass("wpacu_hide"),e.uncheckAllOtherUnloadRules(a(this))):(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_bold"),b.find('input[type="text"]').prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_handle_unload_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_bold"),b.find('input[type="text"]').blur().addClass("wpacu_disabled"),""===b.find('input[type="text"]').val().trim()&&(b.find('input[type="text"]').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('input[type="text"]').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('input[type="text"]').blur().addClass("wpacu_disabled"),""===b.find('input[type="text"]').val().trim()&&(b.find('input[type="text"]').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:"get_external_file_size",wpacu_remote_file:e},function(a){c.html(a)})})},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+'"]').addClass("wpacu_hide")},uncheckAllOtherUnloadRules:function(a){a.closest("tr").find(".wpacu_unload_rule_input").not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_checked")},checkSourcesFor404Errors:function(){a("[data-wpacu-source]").each(function(b,c){var d=a(this),e=d.attr("data-wpacu-source");a.ajax({cache:!1,url:e,data:{},success:function(a){},error:function(a,b,c){console.log(b),"error"===b&&d.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>")}})})}};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),"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(),clearInterval(d)}},d=setInterval(c,900)})});
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"}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)+wpacu_object.start_del.length,b.lastIndexOf(wpacu_object.end_del)),d={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list:c,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,d,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(){a(this).prop("checked")?(e.uncheckAllOtherUnloadRules(a(this)),d=a(this).parents(".wpacu_asset_row"),b=a(this).attr("data-handle"),c=a(this).hasClass("wpacu_unload_rule_for_style")?"style":"script",e.hideLoadExceptionArea(d,b,c),a(this).closest("tr").addClass("wpacu_not_load")):a(this).closest("tr").removeClass("wpacu_not_load")}),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_global_unload").click(function(){b=a(this).attr("data-handle"),a(this).prop("checked")?(a(this).parent("label").addClass("wpacu_input_load_checked"),a(this).closest("tr").addClass("wpacu_not_load"),e.uncheckAllOtherUnloadRules(a(this))):(a(this).parent("label").removeClass("wpacu_input_load_checked"),a(this).closest("tr").removeClass("wpacu_not_load"))}),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+'"]').removeClass("wpacu_hide"),e.uncheckAllOtherUnloadRules(a(this))):(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_bold"),b.find('input[type="text"]').prop("disabled",!1).focus().removeClass("wpacu_disabled"),b.find(".wpacu_handle_unload_regex_input_wrap").removeClass("wpacu_hide")):(b.find("label").removeClass("wpacu_bold"),b.find('input[type="text"]').blur().addClass("wpacu_disabled"),""===b.find('input[type="text"]').val().trim()&&(b.find('input[type="text"]').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('input[type="text"]').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('input[type="text"]').blur().addClass("wpacu_disabled"),""===b.find('input[type="text"]').val().trim()&&(b.find('input[type="text"]').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)})})},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+'"]').addClass("wpacu_hide")},uncheckAllOtherUnloadRules:function(a){a.closest("tr").find(".wpacu_unload_rule_input").not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_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,{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),"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(),clearInterval(d)}},d=setInterval(c,900)})});
classes/Main.php CHANGED
@@ -337,6 +337,8 @@ SQL;
337
});
338
339
$this->wpacuHtmlNoticeForAdmin();
340
}
341
342
/**
@@ -1689,6 +1691,31 @@ SQL;
1689
exit;
1690
}
1691
1692
/**
1693
* @return void
1694
*/
337
});
338
339
$this->wpacuHtmlNoticeForAdmin();
340
+
341
+ add_action('wp_ajax_' . WPACU_PLUGIN_ID . '_check_external_urls_for_status_code', array($this, 'ajaxCheckExternalUrlsForStatusCode'));
342
}
343
344
/**
1691
exit;
1692
}
1693
1694
+ /**
1695
+ * @return false|mixed|string|void
1696
+ */
1697
+ public function ajaxCheckExternalUrlsForStatusCode()
1698
+ {
1699
+ if (! isset($_POST['action'], $_POST['wpacu_check_urls']) || ! Menu::userCanManageAssets()) {
1700
+ return;
1701
+ }
1702
+
1703
+ $checkUrls = explode('-at-wpacu-at-', $_POST['wpacu_check_urls']);
1704
+ $checkUrls = array_filter(array_unique($checkUrls));
1705
+
1706
+ foreach ($checkUrls as $index => $checkUrl) {
1707
+ $response = wp_remote_get($checkUrl);
1708
+
1709
+ // Remove 200 OK ones as the other ones will remain for highlighting
1710
+ if (wp_remote_retrieve_response_code($response) === 200) {
1711
+ unset($checkUrls[$index]);
1712
+ }
1713
+ }
1714
+
1715
+ echo json_encode($checkUrls);
1716
+ exit();
1717
+ }
1718
+
1719
/**
1720
* @return void
1721
*/
classes/Misc.php CHANGED
@@ -294,7 +294,7 @@ class Misc
294
$src .= '.js';
295
}
296
297
- $paths = array('wp-content/themes/','wp-content/plugins/','wp-content/uploads/');
298
299
foreach ($paths as $path) {
300
if (strpos($src, $path) !== false) {
294
$src .= '.js';
295
}
296
297
+ $paths = array('wp-includes/', 'wp-content/');
298
299
foreach ($paths as $path) {
300
if (strpos($src, $path) !== false) {
classes/OwnAssets.php CHANGED
@@ -41,6 +41,8 @@ class OwnAssets
41
42
add_filter('wpacu_object_data', static function($wpacu_object_data) {
43
$wpacu_object_data['source_load_error_msg'] = __('It looks like the source is not reachable', 'wp-asset-clean-up');
44
return $wpacu_object_data;
45
});
46
}
41
42
add_filter('wpacu_object_data', static function($wpacu_object_data) {
43
$wpacu_object_data['source_load_error_msg'] = __('It looks like the source is not reachable', 'wp-asset-clean-up');
44
+ $wpacu_object_data['plugin_id'] = WPACU_PLUGIN_ID;
45
+ $wpacu_object_data['ajax_url'] = admin_url('admin-ajax.php');
46
return $wpacu_object_data;
47
});
48
}
classes/Plugin.php CHANGED
@@ -275,7 +275,8 @@ HTACCESS;
275
public static function preventAnyChanges()
276
{
277
// Only relevant if all the plugins are already loaded
278
- if (! defined('WPACU_ALL_ACTIVE_PLUGINS_LOADED')) {
279
return false;
280
}
281
@@ -283,12 +284,13 @@ HTACCESS;
283
return WPACU_PREVENT_ANY_CHANGES;
284
}
285
286
// Is it an AMP endpoint?
287
- // Checks for "AMP WordPress plugin", "AMP for WP – Accelerated Mobile Pages", "WP AMP — Accelerated Mobile Pages for WordPress and WooCommerce" (Premium plugin)
288
- if ( (function_exists('is_amp_endpoint') && is_amp_endpoint())
289
- || (((isset($_SERVER['REQUEST_URI']) && (preg_match('/(\/amp$|\/amp\?)|(\/amp\/|\/amp\/\?)/', $_SERVER['REQUEST_URI']))) || (array_key_exists('amp', $_GET))) && Misc::isPluginActive('amp/amp.php')) // in case the first check fails
290
- || (function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint())
291
- || (function_exists('is_wp_amp') && Misc::isPluginActive('wp-amp/wp-amp.php') && is_wp_amp())
292
) {
293
define('WPACU_PREVENT_ANY_CHANGES', true);
294
return true; // do not print anything on an AMP page
275
public static function preventAnyChanges()
276
{
277
// Only relevant if all the plugins are already loaded
278
+ // and in the front-end view
279
+ if (! defined('WPACU_ALL_ACTIVE_PLUGINS_LOADED') || is_admin()) {
280
return false;
281
}
282
284
return WPACU_PREVENT_ANY_CHANGES;
285
}
286
287
+ // e.g. /amp/ - /amp? - /amp/? - /?amp or ending in /amp
288
+ $isAmpInRequestUri = ((isset($_SERVER['REQUEST_URI']) && (preg_match('/(\/amp$|\/amp\?)|(\/amp\/|\/amp\/\?)/', $_SERVER['REQUEST_URI']))) || (array_key_exists('amp', $_GET)));
289
+
290
// Is it an AMP endpoint?
291
+ if ( ($isAmpInRequestUri && Misc::isPluginActive('accelerated-mobile-pages/accelerated-moblie-pages.php')) // "AMP for WP – Accelerated Mobile Pages"
292
+ || ($isAmpInRequestUri && Misc::isPluginActive('amp/amp.php')) // "AMP – WordPress plugin"
293
+ || (function_exists('is_wp_amp') && Misc::isPluginActive('wp-amp/wp-amp.php') && is_wp_amp()) // "WP AMP Accelerated Mobile Pages for WordPress and WooCommerce" (Premium plugin)
294
) {
295
define('WPACU_PREVENT_ANY_CHANGES', true);
296
return true; // do not print anything on an AMP page
classes/Update.php CHANGED
@@ -706,7 +706,7 @@ HTML;
706
global $post;
707
708
// In the lite version, post type unload is the only option for bulk unloads
709
- $postType = isset($post->post_type) ? $post->post_type : false;
710
711
if (! $postType) {
712
return false;
@@ -764,9 +764,9 @@ HTML;
764
continue;
765
}
766
767
- foreach ( $existingList[ $assetType ][ $bulkType ][ $value ] as $handleKey => $handle ) {
768
if ( in_array( $handle, $list ) ) {
769
- unset( $existingList[ $assetType ][ $bulkType ][ $value ][ $handleKey ] );
770
$isUpdated = true;
771
}
772
}
706
global $post;
707
708
// In the lite version, post type unload is the only option for bulk unloads
709
+ $postType = isset($post->post_type) ? $post->post_type : false;
710
711
if (! $postType) {
712
return false;
764
continue;
765
}
766
767
+ foreach ( $existingList[ $assetType ][ $bulkType ][ $postType ] as $handleKey => $handle ) {
768
if ( in_array( $handle, $list ) ) {
769
+ unset( $existingList[ $assetType ][ $bulkType ][ $postType ][ $handleKey ] );
770
$isUpdated = true;
771
}
772
}
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: minify css, minify javascript, defer css javascript, page speed, dequeue,
4
Donate link: https://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
7
- Stable tag: 1.3.4.9
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
@@ -178,6 +178,9 @@ With the recently released "Test Mode" feature, you can safely unload assets on
178
4. Homepage CSS & JS Management (List sorted by location)
179
180
== Changelog ==
181
= 1.3.4.9 =
182
* New Feature: Check if the CSS/JS files are reachable; Once the Assets List is loaded for management, AJAX calls would be made to check if the files are not returning 404 not found errors and anyone that returns an "error" gets highlighted (e.g. it's good in situations when a file was enqueued, but later deleted and forgotten thus ending up with 404 Bad Requests in the browser)
183
* UI Improvement for "Bulk Changes": When a checkbox is ticked, highlight the area of the targeted handle (applies for any results in all the tabs)
4
Donate link: https://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
7
+ Stable tag: 1.3.5.0
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
178
4. Homepage CSS & JS Management (List sorted by location)
179
180
== Changelog ==
181
+ = 1.3.5.0 =
182
+ * Bug Fix: Sometimes, when external URLs (from a different domain) were present in the assets management list, when checking them via JavaScript for their status, the browser returned some errors interfering with "Add Media" not allowing the user to upload new images from the edit post/page area
183
+
184
= 1.3.4.9 =
185
* New Feature: Check if the CSS/JS files are reachable; Once the Assets List is loaded for management, AJAX calls would be made to check if the files are not returning 404 not found errors and anyone that returns an "error" gets highlighted (e.g. it's good in situations when a file was enqueued, but later deleted and forgotten thus ending up with 404 Bad Requests in the browser)
186
* UI Improvement for "Bulk Changes": When a checkbox is ticked, highlight the area of the targeted handle (applies for any results in all the tabs)
templates/_admin-page-settings-plugin-areas/_plugin-usage-settings.php CHANGED
@@ -168,6 +168,7 @@ foreach (\WpAssetCleanUp\MetaBoxes::$noMetaBoxesForPostTypes as $noMetaBoxesForP
168
<td>
169
<label>
170
<select id="wpacu_assets_list_layout"
171
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_layout]">
172
<option <?php if ($data['assets_list_layout'] === 'by-location') { echo 'selected="selected"'; } ?> value="by-location"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by location (themes, plugins, core &amp; external)', 'wp-asset-clean-up'); ?></option>
173
<option <?php if ($data['assets_list_layout'] === 'by-position') { echo 'selected="selected"'; } ?> value="by-position"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by tag position: &lt;head&gt; &amp; &lt;body&gt;', 'wp-asset-clean-up'); ?></option>
168
<td>
169
<label>
170
<select id="wpacu_assets_list_layout"
171
+ style="max-width: inherit;"
172
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_layout]">
173
<option <?php if ($data['assets_list_layout'] === 'by-location') { echo 'selected="selected"'; } ?> value="by-location"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by location (themes, plugins, core &amp; external)', 'wp-asset-clean-up'); ?></option>
174
<option <?php if ($data['assets_list_layout'] === 'by-position') { echo 'selected="selected"'; } ?> value="by-position"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by tag position: &lt;head&gt; &amp; &lt;body&gt;', 'wp-asset-clean-up'); ?></option>
templates/meta-box-loaded-assets/_asset-script-single-row.php CHANGED
@@ -65,6 +65,15 @@ if ($isBulkUnloaded) {
65
$data['row']['obj']->preload_status = 'not_preloaded'; // default
66
67
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && $data['row']['obj']->src !== '' && $data['row']['obj']->srcHref) {
68
$relSrc = str_replace(site_url(), '', $data['row']['obj']->src);
69
70
if (isset($data['row']['obj']->baseUrl)) {
@@ -82,7 +91,7 @@ if ($isBulkUnloaded) {
82
}
83
?>
84
<div class="wpacu-source-row" style="margin-top: 12px;">
85
- <?php _e('Source:', 'wp-asset-clean-up'); ?> <a target="_blank" style="color: green;" data-wpacu-source="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref . 'ver='. $ver; ?>" href="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref . 'ver='. $ver; ?>"><?php echo $relSrc; ?></a> <span data-wpacu-source-status></span>
86
&nbsp;&#10230;&nbsp;
87
Preload (if kept loaded)?
88
&nbsp;<select style="display: inline-block; width: auto;"
65
$data['row']['obj']->preload_status = 'not_preloaded'; // default
66
67
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && $data['row']['obj']->src !== '' && $data['row']['obj']->srcHref) {
68
+ $isExternalSrc = true;
69
+
70
+ if (\WpAssetCleanUp\Misc::getLocalSrc($data['row']['obj']->src)
71
+ || strpos($data['row']['obj']->src, '/?') !== false // Dynamic Local URL
72
+ || strpos(str_replace(site_url(), '', $data['row']['obj']->src), '?') === 0 // Starts with ? right after the site url (it's a local URL)
73
+ ) {
74
+ $isExternalSrc = false;
75
+ }
76
+
77
$relSrc = str_replace(site_url(), '', $data['row']['obj']->src);
78
79
if (isset($data['row']['obj']->baseUrl)) {
91
}
92
?>
93
<div class="wpacu-source-row" style="margin-top: 12px;">
94
+ <?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 . $appendAfterSrcHref . 'ver='. $ver; ?>" <?php } ?> href="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref . 'ver='. $ver; ?>"><?php echo $relSrc; ?></a> <?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?>
95
&nbsp;&#10230;&nbsp;
96
Preload (if kept loaded)?
97
&nbsp;<select style="display: inline-block; width: auto;"
templates/meta-box-loaded-assets/_asset-style-single-row.php CHANGED
@@ -62,7 +62,14 @@ if ($isBulkUnloaded) {
62
$styleHandleHasSrc = $showGoogleFontRemoveNotice = false;
63
64
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && $data['row']['obj']->src && $data['row']['obj']->srcHref) {
65
- $styleHandleHasSrc = true;
66
67
$isGoogleFontLink = stripos($data['row']['obj']->srcHref, '//fonts.googleapis.com/') !== false;
68
@@ -87,13 +94,8 @@ if ($isBulkUnloaded) {
87
88
$appendAfterSrcHref = '';
89
90
- if ($isGoogleFontLink) {
91
- $appendAfterSrcHref .= (strpos($data['row']['obj']->srcHref, '?') === false) ? '?' : '&';
92
- $appendAfterSrcHref .= 'ver=' . $ver;
93
-
94
- if ($data['plugin_settings']['google_fonts_remove']) {
95
- $showGoogleFontRemoveNotice = '<span style="color:#c00;">This resource is not loaded as "Remove Google Fonts" is enabled in "Settings" -&gt; "Google Fonts".</span>';
96
- }
97
}
98
99
$isCssPreload = (isset($data['preloads']['styles'][$data['row']['obj']->handle]) && $data['preloads']['styles'][$data['row']['obj']->handle])
@@ -109,7 +111,7 @@ if ($isBulkUnloaded) {
109
}
110
?>
111
<div class="wpacu-source-row" style="margin-top: 12px;">
112
- <?php _e('Source:', 'wp-asset-clean-up'); ?> <a data-wpacu-source="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref; ?>" target="_blank" style="color: green;" href="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref; ?>"><?php echo $relSrc; ?></a> <span data-wpacu-source-status></span>
113
&nbsp;&#10230;&nbsp;
114
Preload (if kept loaded)?
115
&nbsp;<select style="display: inline-block; width: auto;"
62
$styleHandleHasSrc = $showGoogleFontRemoveNotice = false;
63
64
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && $data['row']['obj']->src && $data['row']['obj']->srcHref) {
65
+ $styleHandleHasSrc = $isExternalSrc = true; // default
66
+
67
+ if (\WpAssetCleanUp\Misc::getLocalSrc($data['row']['obj']->src)
68
+ || strpos($data['row']['obj']->src, '/?') !== false // Dynamic Local URL
69
+ || strpos(str_replace(site_url(), '', $data['row']['obj']->src), '?') === 0 // Starts with ? right after the site url (it's a local URL)
70
+ ) {
71
+ $isExternalSrc = false;
72
+ }
73
74
$isGoogleFontLink = stripos($data['row']['obj']->srcHref, '//fonts.googleapis.com/') !== false;
75
94
95
$appendAfterSrcHref = '';
96
97
+ if ( $isGoogleFontLink && $data['plugin_settings']['google_fonts_remove'] ) {
98
+ $showGoogleFontRemoveNotice = '<span style="color:#c00;">This resource is not loaded as "Remove Google Fonts" is enabled in "Settings" -&gt; "Google Fonts".</span>';
99
}
100
101
$isCssPreload = (isset($data['preloads']['styles'][$data['row']['obj']->handle]) && $data['preloads']['styles'][$data['row']['obj']->handle])
111
}
112
?>
113
<div class="wpacu-source-row" style="margin-top: 12px;">
114
+ <?php _e('Source:', 'wp-asset-clean-up'); ?> <a <?php if ($isExternalSrc) { ?>data-wpacu-external-source="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref; ?>" <?php } ?> target="_blank" style="color: green;" href="<?php echo $data['row']['obj']->srcHref . $appendAfterSrcHref; ?>"><?php echo $relSrc; ?></a> <?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?>
115
&nbsp;&#10230;&nbsp;
116
Preload (if kept loaded)?
117
&nbsp;<select style="display: inline-block; width: auto;"
templates/meta-box-loaded.php CHANGED
@@ -157,6 +157,7 @@ ob_start();
157
?>
158
<label for="wpacu_assets_list_layout"><strong>Assets List Layout:</strong></label> <small>* any new change will take effect after you use the "Update" button</small>
159
<p style="margin: 8px 0;"><select id="wpacu_assets_list_layout"
160
name="wpacu_assets_list_layout">
161
<option <?php if ($data['plugin_settings']['assets_list_layout'] === 'by-location') { echo 'selected="selected"'; } ?> value="by-location"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by location (themes, plugins, core &amp; external)', 'wp-asset-clean-up'); ?></option>
162
<option <?php if ($data['plugin_settings']['assets_list_layout'] === 'by-position') { echo 'selected="selected"'; } ?> value="by-position"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by tag position: &lt;head&gt; &amp; &lt;body&gt;', 'wp-asset-clean-up'); ?></option>
157
?>
158
<label for="wpacu_assets_list_layout"><strong>Assets List Layout:</strong></label> <small>* any new change will take effect after you use the "Update" button</small>
159
<p style="margin: 8px 0;"><select id="wpacu_assets_list_layout"
160
+ style="max-width: inherit;"
161
name="wpacu_assets_list_layout">
162
<option <?php if ($data['plugin_settings']['assets_list_layout'] === 'by-location') { echo 'selected="selected"'; } ?> value="by-location"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by location (themes, plugins, core &amp; external)', 'wp-asset-clean-up'); ?></option>
163
<option <?php if ($data['plugin_settings']['assets_list_layout'] === 'by-position') { echo 'selected="selected"'; } ?> value="by-position"><?php _e('All Styles &amp; Scripts', 'wp-asset-clean-up'); ?> &#10230; <?php _e('Grouped by tag position: &lt;head&gt; &amp; &lt;body&gt;', 'wp-asset-clean-up'); ?></option>
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.4.9
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.4.9');
16
}
17
18
// Exit if accessed directly
@@ -104,7 +104,7 @@ define('WPACU_LOAD_ASSETS_REQ_KEY', WPACU_PLUGIN_ID . '_load');
104
require_once WPACU_PLUGIN_DIR.'/wpacu-load.php';
105
106
if (! is_admin()) {
107
- add_action('parse_query', static function() { // very early triggering to set WPACU_ALL_ACTIVE_PLUGINS_LOADED
108
if (defined('WPACU_ALL_ACTIVE_PLUGINS_LOADED')) { return; }
109
define('WPACU_ALL_ACTIVE_PLUGINS_LOADED', true);
110
\WpAssetCleanUp\Plugin::preventAnyChanges();
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.0
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.0');
16
}
17
18
// Exit if accessed directly
104
require_once WPACU_PLUGIN_DIR.'/wpacu-load.php';
105
106
if (! is_admin()) {
107
+ add_action('init', static function() { // very early triggering to set WPACU_ALL_ACTIVE_PLUGINS_LOADED
108
if (defined('WPACU_ALL_ACTIVE_PLUGINS_LOADED')) { return; }
109
define('WPACU_ALL_ACTIVE_PLUGINS_LOADED', true);
110
\WpAssetCleanUp\Plugin::preventAnyChanges();