Version Description
- Option to disable "Freemius Analytics & Insights?" in "Settings" -> "Plugin Usage Preferences" (good if you do debugging & often deactivate the plugin or you just don't like plugin feedback popups)
- Changed the vertical "Settings" menu by renaming "Minify CSS & JS Files" & "Combine CSS & JS Files" to "Optimize CSS" & Optimize JavaScript; Added the status of the minify/combine below the menu titles to easily check what optimizations were done
- Improved the way JS files are combined; If "Defer loading JavaScript combined files" is enabled in "Optimize JavaScript", make sure that any external script between the first and last combined JS tags has "defer" attribute applied to it to avoid any JS errors in case a "child" JS file is loaded before a combined "parent" one.
- Option to minify inline content between from STYLE and SCRIPT (without any "src" attribute) tags
- Optimize minify CSS/JS feature to use less resource when dinamicaly generating the optimized (cached) files; Minification is performed via a new library (ref: https://www.minifier.org/)
- Option to choose between "Render-blocking" and "Asynchronous via Web Font Loader (webfont.js)" when loading the combined Google Font requests
- Bug Fix: Sometimes the dynamically created drop-down from "Hide all meta boxes for the following public post types" (in "Settings" -> "Plugin Usage Preferences") via jQuery Chosen plugin was returning an empty (0px in width) selector
Download this release
Release Info
Developer | gabelivan |
Plugin | Asset CleanUp: Page Speed Booster |
Version | 1.3.3.9 |
Comparing to | |
See all releases |
Code changes from version 1.3.3.8 to 1.3.3.9
- assets/chosen/chosen.jquery.min.js +0 -1
- assets/images/wpacu-deactivate-modal.jpg +0 -0
- assets/script.min.js +1 -1
- assets/style.min.css +1 -1
- classes/CleanUp.php +34 -17
- classes/Main.php +6 -10
- classes/Misc.php +4 -15
- classes/OptimiseAssets/CombineCss.php +89 -41
- classes/OptimiseAssets/CombineJs.php +228 -186
- classes/OptimiseAssets/FontsGoogle.php +112 -33
- classes/OptimiseAssets/FontsLocal.php +25 -19
- classes/OptimiseAssets/MinifyCss.php +69 -0
- classes/OptimiseAssets/MinifyJs.php +79 -0
- classes/OptimiseAssets/OptimizeCommon.php +1 -61
- classes/OptimiseAssets/OptimizeCss.php +56 -37
- classes/OptimiseAssets/OptimizeJs.php +55 -115
- classes/OwnAssets.php +13 -17
- classes/PluginTracking.php +4 -5
- classes/Preloads.php +8 -12
- classes/Settings.php +26 -9
- classes/ThirdParty/Browser.php +6 -4
- classes/Tools.php +46 -15
- classes/Update.php +1 -1
- composer.json +29 -0
- composer.lock +176 -0
- readme.txt +10 -1
- templates/_admin-page-settings-plugin-areas/_fonts-google.php +68 -20
- templates/_admin-page-settings-plugin-areas/_fonts-local.php +1 -1
- templates/_admin-page-settings-plugin-areas/_minify-loaded-files.php +0 -134
- templates/_admin-page-settings-plugin-areas/_optimize-css.php +215 -0
- templates/_admin-page-settings-plugin-areas/{_combine-loaded-files.php → _optimize-js.php} +79 -91
- templates/_admin-page-settings-plugin-areas/_plugin-usage-settings.php +27 -0
- templates/admin-page-settings-plugin.php +41 -11
- vendor/autoload.php +7 -0
- vendor/bin/minifycss +45 -0
- vendor/bin/minifyjs +45 -0
- vendor/composer/ClassLoader.php +445 -0
- vendor/composer/LICENSE +21 -0
- vendor/composer/autoload_classmap.php +9 -0
- vendor/composer/autoload_namespaces.php +9 -0
- vendor/composer/autoload_psr4.php +12 -0
- vendor/composer/autoload_real.php +52 -0
- vendor/composer/autoload_static.php +45 -0
- vendor/composer/installed.json +163 -0
- vendor/matthiasmullie/minify/CONTRIBUTING.md +59 -0
- vendor/matthiasmullie/minify/Dockerfile +13 -0
- vendor/matthiasmullie/minify/LICENSE +18 -0
- vendor/matthiasmullie/minify/bin/minifycss +45 -0
- vendor/matthiasmullie/minify/bin/minifyjs +45 -0
- vendor/matthiasmullie/minify/composer.json +38 -0
- vendor/matthiasmullie/minify/data/js/keywords_after.txt +7 -0
- vendor/matthiasmullie/minify/data/js/keywords_before.txt +26 -0
- vendor/matthiasmullie/minify/data/js/keywords_reserved.txt +63 -0
- vendor/matthiasmullie/minify/data/js/operators.txt +46 -0
- vendor/matthiasmullie/minify/data/js/operators_after.txt +43 -0
- vendor/matthiasmullie/minify/data/js/operators_before.txt +43 -0
- vendor/matthiasmullie/minify/docker-compose.yml +31 -0
- vendor/matthiasmullie/minify/src/CSS.php +751 -0
- vendor/matthiasmullie/minify/src/Exception.php +20 -0
- vendor/matthiasmullie/minify/src/Exceptions/BasicException.php +23 -0
- vendor/matthiasmullie/minify/src/Exceptions/FileImportException.php +21 -0
- vendor/matthiasmullie/minify/src/Exceptions/IOException.php +21 -0
- vendor/matthiasmullie/minify/src/JS.php +612 -0
- vendor/matthiasmullie/minify/src/Minify.php +459 -0
- vendor/matthiasmullie/path-converter/LICENSE +18 -0
- vendor/matthiasmullie/path-converter/composer.json +28 -0
- vendor/matthiasmullie/path-converter/src/Converter.php +196 -0
- vendor/matthiasmullie/path-converter/src/ConverterInterface.php +24 -0
- vendor/matthiasmullie/path-converter/src/NoConverter.php +23 -0
- vendor/psr/cache/CHANGELOG.md +16 -0
- vendor/psr/cache/LICENSE.txt +19 -0
- vendor/psr/cache/README.md +9 -0
- vendor/psr/cache/composer.json +25 -0
- vendor/psr/cache/src/CacheException.php +10 -0
- vendor/psr/cache/src/CacheItemInterface.php +105 -0
- vendor/psr/cache/src/CacheItemPoolInterface.php +138 -0
- vendor/psr/cache/src/InvalidArgumentException.php +13 -0
- wpacu.php +11 -4
assets/chosen/chosen.jquery.min.js
CHANGED
@@ -1,3 +1,2 @@
|
|
1 |
/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
-
|
3 |
(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+this.escape_html(t.group_label)+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(t){var e,s,i,n,r,o,h,l,c,_,a,u,d,p,f;for(this.no_results_clear(),_=0,e=(h=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.get_search_regex(e),i=0,n=(l=this.results_data).length;i<n;i++)(r=l[i]).search_match=!1,a=null,u=null,r.highlighted_html="",this.include_option_in_results(r)&&(r.group&&(r.group_match=!1,r.active_options=0),null!=r.group_array_index&&this.results_data[r.group_array_index]&&(0===(a=this.results_data[r.group_array_index]).active_options&&a.search_match&&(_+=1),a.active_options+=1),f=r.group?r.label:r.text,r.group&&!this.group_search||(u=this.search_string_match(f,c),r.search_match=null!=u,r.search_match&&!r.group&&(_+=1),r.search_match?(h.length&&(d=u.index,o=f.slice(0,d),s=f.slice(d,d+h.length),p=f.slice(d+h.length),r.highlighted_html=this.escape_html(o)+"<em>"+this.escape_html(s)+"</em>"+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
|
1 |
/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
|
|
2 |
(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+this.escape_html(t.group_label)+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(t){var e,s,i,n,r,o,h,l,c,_,a,u,d,p,f;for(this.no_results_clear(),_=0,e=(h=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.get_search_regex(e),i=0,n=(l=this.results_data).length;i<n;i++)(r=l[i]).search_match=!1,a=null,u=null,r.highlighted_html="",this.include_option_in_results(r)&&(r.group&&(r.group_match=!1,r.active_options=0),null!=r.group_array_index&&this.results_data[r.group_array_index]&&(0===(a=this.results_data[r.group_array_index]).active_options&&a.search_match&&(_+=1),a.active_options+=1),f=r.group?r.label:r.text,r.group&&!this.group_search||(u=this.search_string_match(f,c),r.search_match=null!=u,r.search_match&&!r.group&&(_+=1),r.search_match?(h.length&&(d=u.index,o=f.slice(0,d),s=f.slice(d,d+h.length),p=f.slice(d+h.length),r.highlighted_html=this.escape_html(o)+"<em>"+this.escape_html(s)+"</em>"+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
|
assets/images/wpacu-deactivate-modal.jpg
ADDED
Binary file
|
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)}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()},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()},200)}))}a("#wpacu-mark-license-valid-button").click(function(){return confirm(wpacu_object.mark_license_valid_confirm)});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;a(".input-unload-on-this-page").on("click change",function(){a(this).prop("checked")?(e.uncheckAllOtherUnloadRules(a(this)),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(".input-unload-on-this-page.wpacu-not-locked").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(".input-unload-on-this-page.wpacu-not-locked").prop("checked",!1).closest("tr").removeClass("wpacu_not_load")}),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").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_load_it_option").click(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-add-handle-note").on("click",function(b){b.preventDefault();var c,d=a(this).attr("data-handle");a(this).hasClass("wpacu-for-script")?c=a('.wpacu-handle-notes-field[data-script-handle="'+d+'"]'):a(this).hasClass("wpacu-for-style")&&(c=a('.wpacu-handle-notes-field[data-style-handle="'+d+'"]')),c.is(":hidden")?c.show():c.hide()}),a(".wpacu-external-file-size").on("click",function(b){b.preventDefault();var c,d=a(this);d.hide(),c=d.next(),c.show(),a.post(wpacu_object.ajax_url,{action:"get_external_file_size",wpacu_remote_file:d.attr("data-src")},function(a){c.html(a)})})},uncheckAllOtherUnloadRules:function(a){a.closest("tr").find(".wpacu_unload_rule_input").not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_checked")}};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_hide_meta_boxes_for_post_types_chosen .chosen-choices, #wpacu-hide-meta-boxes-for-post-types-info").css({opacity:1})):(a("#wpacu-settings-assets-retrieval-mode").hide(),a("#wpacu_hide_meta_boxes_for_post_types_chosen .chosen-choices, #wpacu-hide-meta-boxes-for-post-types-info").css({opacity:.4}))}),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("#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.click(function(){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_remove_rule").click(function(){var b=a(this).parents(".wpacu_global_rule_row");a(this).prop("checked")?b.addClass("selected"):b.removeClass("selected")}),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;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)}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()},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()},200)}))}a("#wpacu_minify_css_enable, #wpacu_combine_loaded_css_enable, #wpacu_minify_js_enable, #wpacu_combine_loaded_js_enable").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)});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;a(".input-unload-on-this-page").on("click change",function(){a(this).prop("checked")?(e.uncheckAllOtherUnloadRules(a(this)),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(".input-unload-on-this-page.wpacu-not-locked").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(".input-unload-on-this-page.wpacu-not-locked").prop("checked",!1).closest("tr").removeClass("wpacu_not_load")}),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").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_load_it_option").click(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-add-handle-note").on("click",function(b){b.preventDefault();var c,d=a(this).attr("data-handle");a(this).hasClass("wpacu-for-script")?c=a('.wpacu-handle-notes-field[data-script-handle="'+d+'"]'):a(this).hasClass("wpacu-for-style")&&(c=a('.wpacu-handle-notes-field[data-style-handle="'+d+'"]')),c.is(":hidden")?c.show():c.hide()}),a(".wpacu-external-file-size").on("click",function(b){b.preventDefault();var c,d=a(this);d.hide(),c=d.next(),c.show(),a.post(wpacu_object.ajax_url,{action:"get_external_file_size",wpacu_remote_file:d.attr("data-src")},function(a){c.html(a)})})},uncheckAllOtherUnloadRules:function(a){a.closest("tr").find(".wpacu_unload_rule_input").not(a).prop("checked",!1).parent("label").removeClass("wpacu_input_load_checked")}};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_hide_meta_boxes_for_post_types_chosen .chosen-choices, #wpacu-hide-meta-boxes-for-post-types-info").css({opacity:1})):(a("#wpacu-settings-assets-retrieval-mode").hide(),a("#wpacu_hide_meta_boxes_for_post_types_chosen .chosen-choices, #wpacu-hide-meta-boxes-for-post-types-info").css({opacity:.4}))}),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():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.click(function(){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_remove_rule").click(function(){var b=a(this).parents(".wpacu_global_rule_row");a(this).prop("checked")?b.addClass("selected"):b.removeClass("selected")}),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;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)})});
|
assets/style.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#wpacu-pages-info-area{width:98%}#wpacu-top-area{margin:15px 0;padding:0 10px}#wpacu-quick-actions{color:#74777b;float:right;width:auto;margin-right:30px;background:rgba(40,44,42,.05);border-radius:10px;padding:6px 12px}#wpacu-quick-actions .wpacu-actions-title{font-weight:200;letter-spacing:.5px}#wpacu-quick-actions a{color:#004567;text-decoration:none}#wpacu-quick-actions a:hover{color:#0073aa}#wpacu-logo-wrap{width:auto;display:inline-block;position:relative}#wpacu-logo-wrap a{display:block}#wpacu-logo-wrap img{width:352px;height:79px}#wpacu-logo-wrap .wpacu-pro-sign{position:absolute;height:auto;font-family:FiraSans-Medium,proxima-nova-1,Montserrat,Helvetica,sans-serif;font-size:13px;font-weight:600;letter-spacing:1px;padding:5px 11px;border-radius:15px;right:-60px;top:30px;width:auto;display:inline-block;text-align:center}#wpacu-logo-wrap .wpacu-pro-sign.wpacu-lite{color:#74777b;background:rgba(40,44,42,.05)}#wpacu-logo-wrap .wpacu-pro-sign.wpacu-pro{color:#004567;background-color:rgba(40,44,42,.05)}#wpacu_meta_box_content .dashicons.dashicons-warning,.wpacu-tabs nav ul li span.extra-info.license-status.inactive{color:#c00}.wpacu-tabs{position:relative;overflow:hidden;margin:0 auto 20px;width:100%;font-weight:300;font-size:20px}.wpacu-tabs nav{text-align:center}.wpacu-tabs nav ul{position:relative;display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;display:flex;margin:0 auto;padding:0;max-width:1200px;list-style:none;-ms-box-orient:horizontal;-ms-box-pack:center;-webkit-flex-flow:row wrap;-moz-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;justify-content:center}.wpacu-tabs nav ul li{position:relative;z-index:1;display:block;margin:0;text-align:center;-webkit-flex:1;-moz-flex:1;-ms-flex:1;flex:1}.wpacu-tabs nav ul li span.extra-info{position:absolute;font-size:12px;left:0;right:50%;bottom:12px;-webkit-transform:translate(50%,50%);transform:translate(50%,50%)}.wpacu-tabs nav ul li span.extra-info .dashicons{font-size:16px;margin-right:-3px;margin-top:1px}.wpacu-tabs nav ul li span.extra-info.license-status.active{color:green}.wpacu-tabs nav ul li span.extra-info.assets-unloaded-false{color:#004567}.wpacu-license-area .notice .dashicons,.wpacu-settings-area .notice .dashicons,.wpacu-tabs nav ul li span.extra-info.assets-unloaded-true,.wpacu-tabs nav ul li span.extra-info.bulk-unloads-true{color:green}.wpacu-tabs nav a{position:relative;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:2.5}.wpacu-tabs nav a span{vertical-align:middle;font-size:14px}.wpacu-tabs nav li.wpacu-tab-current a{color:#74777b}.wpacu-tabs nav a:focus{outline:0}.wpacu-tabs .dashicons{font-size:20px}.no-js .wpacu-content-wrap section{display:block;padding-bottom:2em;border-bottom:1px solid rgba(255,255,255,.6)}.no-flexbox nav ul{display:block}.no-flexbox nav ul li{min-width:15%;display:inline-block}@media screen and (max-width:58em){.wpacu-tabs nav a.icon span{display:none}.wpacu-tabs nav a:before{margin-right:0}}.wpacu-tabs-style-underline nav{background:#fff}.wpacu-tabs-style-underline nav a{color:#74777b;font-size:18px;text-transform:uppercase;text-decoration:none;padding:.25em 0 .5em;border-left:1px solid #e7ecea;-webkit-transition:color .2s;transition:color .2s}.wpacu-tabs-style-underline nav li:last-child a{border-right:1px solid #e7ecea}.wpacu-tabs-style-underline nav li a::after{position:absolute;bottom:0;left:0;width:100%;height:6px;background:#2CC185;content:'';-webkit-transition:-webkit-transform .3s;transition:transform .3s;-webkit-transform:translate3d(0,150%,0);transform:translate3d(0,150%,0)}.wpacu-tabs-style-underline nav li.wpacu-tab-current a::after{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.wpacu-tabs-style-underline nav a span{font-weight:700}.wpacu-tabs-style-topline{max-width:1200px;margin:20px auto 30px 0;width:100%;font-weight:300;text-decoration:none}.wpacu-tabs-style-topline nav li{border:1px solid rgba(40,44,42,.1)}.wpacu-tabs-style-topline nav li:not(:last-child){border-right:none}.wpacu-tabs-style-topline nav li.wpacu-tab-current{border-top-color:#008f9c;border-bottom:none}.wpacu-tabs-style-topline nav a{padding:20px 18px;background:rgba(40,44,42,.05);color:#74777b;line-height:1;-webkit-transition:color .2s;transition:color .2s;text-decoration:none}.wpacu-tabs-style-topline nav a:focus,.wpacu-tabs-style-topline nav a:hover{background:0 0;color:#008f9c}.wpacu-tabs-style-topline nav li.wpacu-tab-current a{background:0 0;box-shadow:inset 0 3px 0 #008f9c;color:#008f9c}.wpacu-tabs-style-topline nav li.wpacu-tab-current a span:not(.dashicons){font-weight:600}.wpacu-tabs-style-topline nav a span{text-transform:uppercase;font-weight:400}.wpacu-tab-nav-wrapper{border-bottom:none!important}.wpacu-tab-nav-wrapper .nav-tab.nav-tab-active{background:#fff;position:relative}.wpacu-tab-nav-wrapper .nav-tab.nav-tab-active:after{content:'';width:100%;bottom:-2px;left:0;position:absolute;border-bottom:2px solid #fff}.wpacu-script-attributes-area{margin:20px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings{padding:5px 7px!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings.wpacu-first{margin:0 28px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings label{margin:0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings li{margin:0 16px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings li:first-child{margin:0 10px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings li:last-child{margin:0 2px 0 0!important}.wpacu-script-attributes-area .wpacu-script-attributes-settings{background:#fff!important;border:1px solid #eee!important;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:5px 10px!important;list-style:none;display:inline-block;margin:0}.wpacu-script-attributes-area .wpacu-script-attributes-settings input[type=radio]{width:auto;padding:0;margin:0 5px 0 0}.wpacu-script-attributes-area .wpacu-script-attributes-settings.wpacu-first{margin:0 34px 0 0!important}.wpacu-script-attributes-area .wpacu-script-attributes-settings li{float:left;margin:0 17px 0 0}.wpacu-script-attributes-area .wpacu-script-attributes-settings li:first-child{margin:0 10px 0 0!important}.wpacu-script-attributes-area .wpacu-script-attributes-settings li:last-child{margin:0}.wpacu-script-attributes-area .wpacu-script-attributes-settings:hover{background:#f2faf2}tr.wpacu_location_changed>td{border-left:#004567 4px solid}tr.wpacu_not_load td,tr.wpacu_not_load th{background:#FFE1E1!important}tr.wpacu_not_load td .wpacu-assets-inline-code-wrap,tr.wpacu_not_load td .wpacu-script-attributes-area,tr.wpacu_not_load th .wpacu-assets-inline-code-wrap,tr.wpacu_not_load th .wpacu-script-attributes-area{filter:alpha(opacity=45);opacity:.45}.dashicons-wpacu{width:17px;height:17px;margin:2px 0 0;font-size:16px;text-decoration:none}#wpacu_meta_box_content,.wpacu_widefat{width:99%}.wpacu_widefat .check-column.wpacu_check{padding:10px}body[class*=wpassetcleanup] #footer-left{border-left:2px solid green;padding-left:10px}#wpassetcleanup_asset_list small{width:auto;float:none;display:inline}#wpacu_meta_box_content .emoji{font-size:18px}#wpacu_meta_box_content h3{margin-left:0;padding-left:0}#wpacu_meta_box_content div.wpacu_note{padding:10px;background-color:#f5f5f5}#wpacu_meta_box_content .wpacu_verified{padding:10px;background-color:#f5f5f5;border-left:1px solid #ddd}#wpacu_meta_box_content .wpacu_verified span{color:#0073aa;font-weight:700}#wpacu_meta_box_content div.wpacu_warning{border:1px solid #c00}#wpacu_meta_box_content ul.wpacu_asset_options{margin:0;padding:0}#wpacu_meta_box_content ul.wpacu_asset_options li{list-style:none;display:inline-block}#wpacu_meta_box_content ul.wpacu_asset_options label{font-weight:400;margin-right:5px;margin-top:5px;margin-bottom:5px}.wpacu-updated-frontend{font-weight:400;background-color:#fff;border-left:4px solid #46b450;border-top:1px solid #46b450;border-right:1px solid #46b450;border-bottom:1px solid #46b450;padding:9px 14px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wpacu-updated-frontend span.dashicons-yes{color:#46b450;font-size:26px}#wpacu-update-front-settings-area{margin:10px 0;display:inline-block;position:relative}#wpacu-updating-front-settings{display:none;position:absolute;top:5px;right:-35px}#wpacu_wrap_assets{color:#000!important;text-align:left!important;clear:both!important;width:90%!important;padding:20px!important;margin:30px 0 0 15px!important;border:1px solid #cdcdcd;z-index:10000!important;position:relative!important;background-color:#fff!important}#wpacu_wrap_assets div.wpacu_warning{border:1px solid #c00;padding:5px 10px}#wpacu_wrap_assets small{display:inline!important;margin:0!important;letter-spacing:normal!important}#wpacu_wrap_assets input[type=checkbox]{width:auto!important;margin-right:4px!important}#wpacu_wrap_assets img:not(.wpacu-ajax-loader){display:inline-block!important}#wpacu_wrap_assets p{line-height:22px!important;margin:10px 0!important;text-align:left!important;font-weight:400!important}#wpacu_wrap_assets p:first-child,.wpacu_verified{margin:0 0 10px!important}#wpacu_wrap_assets h1{margin:0 0 20px!important;font-size:160%!important;text-align:left!important}#wpacu_wrap_assets h3{margin:20px 0;font-size:130%}.wpacu_asset_row:first-child td{border-top:1px solid #cdcdcd}.wpacu_asset_row td{border-left:1px solid #cdcdcd;border-right:1px solid #cdcdcd;border-bottom:1px solid #cdcdcd}.wpacu_asset_row.wpacu_notice_row td{position:relative;padding:5px;border-bottom:1px solid transparent}.wpacu_asset_row.wpacu_notice_row td div.wpacu-warning{width:auto;margin:5px;font-style:italic}.wpacu_asset_row:not(.wpacu_notice_row) td{padding:18px!important;position:relative}.wpacu_asset_row:not(.wpacu_notice_row) td.selected,.wpacu_asset_row:not(.wpacu_notice_row) td:hover{-moz-box-shadow:inset 0 0 12px #cdcdcd;-webkit-box-shadow:inset 0 0 12px #cdcdcd;box-shadow:inset 0 0 12px #cdcdcd}.wpacu_asset_row:not(.wpacu_notice_row) td p{padding:0!important;margin-bottom:10px!important;word-wrap:break-word!important;-ms-word-break:break-all;word-break:break-word}.wpacu_asset_row:not(.wpacu_notice_row) td label{width:auto!important;margin:0!important;cursor:pointer!important;display:inline-block!important;font-size:100%!important;font-weight:400!important}.wpacu_asset_row:not(.wpacu_notice_row) td label span:not(.dashicons){font-size:100%!important}.wpacu_asset_row:not(.wpacu_notice_row) td.wpacu_check{width:50px!important}.asset-table-extra-info td{padding:5px!important}body.wp-admin .wpacu_asset_row td.wpacu_check{width:25px!important}.wpacu_asset_row .dashicons-warning{color:red!important}label.wpacu_add_global{cursor:pointer!important}label.wpacu_input_load_checked{font-weight:700;color:#d54e21}label.wpacu_global_unload_exception{font-weight:700!important}tr.wpacu_global_rule_row.selected{background:#e7e7e7}.nav-tab-wrapper{border-bottom:1px solid #ccc;width:95%}.nav-tab-wrapper.nav-assets-manager .nav-tab{font-size:13px;font-weight:500;padding:6px 10px}.nav-tab-wrapper.nav-assets-manager .nav-tab.for-pro{padding:6px 8px 6px 3px}ul.wpacu_asset_options{margin:0 10px 0 0;padding:0}ul.wpacu_asset_options li{margin:0 10px 0 0;list-style:none;display:inline-block;line-height:normal}ul.wpacu_asset_options li.remove_rule label{font-weight:700}ul.wpacu_asset_options label{margin-right:20px;font-weight:400}ul.wpacu_asset_options label input{margin-right:4px}.wpacu_list_table,.wpacu_list_table div,.wpacu_list_table li,.wpacu_list_table p{font-weight:400}.wpacu_striped>tbody>:nth-child(even),ul.wpacu_striped>:nth-child(even){background-color:#fff!important}.wpacu_striped>tbody>:nth-child(odd),ul.wpacu_striped>:nth-child(odd){background-color:#f9f9f9!important}.wpacu_update_btn{-moz-box-shadow:inset 0 1px 0 0 #54a3f7!important;-webkit-box-shadow:inset 0 1px 0 0 #54a3f7!important;box-shadow:inset 0 1px 0 0 #54a3f7!important;background:-webkit-gradient(linear,left top,left bottom,color-stop(.05,#007dc1),color-stop(1,#0061a7))!important;background:-moz-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:-webkit-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:-o-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:-ms-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:linear-gradient(to bottom,#007dc1 5%,#0061a7 100%)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7', GradientType=0)!important;background-color:#007dc1!important;-moz-border-radius:3px!important;-webkit-border-radius:3px!important;border-radius:3px!important;border:1px solid #124d77!important;display:inline-block!important;cursor:pointer!important;color:#fff!important;font-size:15px!important;padding:10px 24px!important;text-decoration:none!important;text-shadow:0 1px 0 #154682!important;height:auto!important;line-height:normal!important}.wpacu-btns .btn:focus,.wpacu-btns .btn:hover,.wpacu-btns a{text-decoration:none}.wpacu_update_btn.wpacu_submitting,.wpacu_update_btn:hover{background:-webkit-gradient(linear,left top,left bottom,color-stop(.05,#0061a7),color-stop(1,#007dc1))!important;background:-moz-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:-webkit-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:-o-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:-ms-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:linear-gradient(to bottom,#0061a7 5%,#007dc1 100%)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0061a7', endColorstr='#007dc1', GradientType=0)!important;background-color:#0061a7!important}.wpacu_update_btn.wpacu_submitting{cursor:default!important}.wpacu_update_btn:active{position:relative!important;top:1px!important}.wpacu-btns .btn{display:inline-block;font-weight:400;line-height:1.25;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.5rem 1rem;font-size:1rem;-webkit-border-radius:.25rem;-moz-border-radius:.25rem;border-radius:.25rem;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.wpacu-btns .btn.focus,.wpacu-btns .btn:focus{outline:0;-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.25);box-shadow:0 0 0 2px rgba(2,117,216,.25)}.wpacu-btns .btn.disabled,.wpacu-btns .btn:disabled{cursor:not-allowed;opacity:.65}.wpacu-btns .btn.active,.wpacu-btns .btn:active{background-image:none}.wpacu-btns a.btn.disabled,.wpacu-btns fieldset[disabled] a.btn{pointer-events:none}.wpacu-btns .btn-primary{color:#fff;background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-primary:hover{color:#fff;background-color:#025aa5;border-color:#01549b}.wpacu-btns .btn-primary.focus,.wpacu-btns .btn-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.wpacu-btns .btn-primary.disabled,.wpacu-btns .btn-primary:disabled{background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-primary.active,.wpacu-btns .btn-primary:active,.wpacu-btns .show>.btn-primary.dropdown-toggle{color:#fff;background-color:#025aa5;background-image:none;border-color:#01549b}.wpacu-btns .btn-secondary{color:#292b2c;background-color:#fff;border-color:#ccc}.wpacu-btns .btn-secondary:hover{color:#292b2c;background-color:#e6e6e6;border-color:#adadad}.wpacu-btns .btn-secondary.focus,.wpacu-btns .btn-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.wpacu-btns .btn-secondary.disabled,.wpacu-btns .btn-secondary:disabled{background-color:#fff;border-color:#ccc}.wpacu-btns .btn-secondary.active,.wpacu-btns .btn-secondary:active,.wpacu-btns .show>.btn-secondary.dropdown-toggle{color:#292b2c;background-color:#e6e6e6;background-image:none;border-color:#adadad}.wpacu-btns .btn-info{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#2aabd2}.wpacu-btns .btn-info.focus,.wpacu-btns .btn-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.wpacu-btns .btn-info.disabled,.wpacu-btns .btn-info:disabled{background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-info.active,.wpacu-btns .btn-info:active,.wpacu-btns .show>.btn-info.dropdown-toggle{color:#fff;background-color:#31b0d5;background-image:none;border-color:#2aabd2}.wpacu-btns .btn-success{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-success:hover{color:#fff;background-color:#449d44;border-color:#419641}.wpacu-btns .btn-success.focus,.wpacu-btns .btn-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.wpacu-btns .btn-success.disabled,.wpacu-btns .btn-success:disabled{background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-success.active,.wpacu-btns .btn-success:active,.wpacu-btns .show>.btn-success.dropdown-toggle{color:#fff;background-color:#449d44;background-image:none;border-color:#419641}.wpacu-btns .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#eb9316}.wpacu-btns .btn-warning.focus,.wpacu-btns .btn-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.wpacu-btns .btn-warning.disabled,.wpacu-btns .btn-warning:disabled{background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-warning.active,.wpacu-btns .btn-warning:active,.wpacu-btns .show>.btn-warning.dropdown-toggle{color:#fff;background-color:#ec971f;background-image:none;border-color:#eb9316}.wpacu-btns .btn-danger{color:#fff;background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#c12e2a}.wpacu-btns .btn-danger.focus,.wpacu-btns .btn-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.wpacu-btns .btn-danger.disabled,.wpacu-btns .btn-danger:disabled{background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-danger.active,.wpacu-btns .btn-danger:active,.wpacu-btns .show>.btn-danger.dropdown-toggle{color:#fff;background-color:#c9302c;background-image:none;border-color:#c12e2a}.wpacu-btns .btn-outline-primary{color:#0275d8;background-image:none;background-color:transparent;border-color:#0275d8}.wpacu-btns .btn-outline-primary:hover{color:#fff;background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-outline-primary.focus,.wpacu-btns .btn-outline-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.wpacu-btns .btn-outline-primary.disabled,.wpacu-btns .btn-outline-primary:disabled{color:#0275d8;background-color:transparent}.wpacu-btns .btn-outline-primary.active,.wpacu-btns .btn-outline-primary:active,.wpacu-btns .show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-outline-secondary{color:#ccc;background-image:none;background-color:transparent;border-color:#ccc}.wpacu-btns .btn-outline-secondary:hover{color:#fff;background-color:#ccc;border-color:#ccc}.wpacu-btns .btn-outline-secondary.focus,.wpacu-btns .btn-outline-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.wpacu-btns .btn-outline-secondary.disabled,.wpacu-btns .btn-outline-secondary:disabled{color:#ccc;background-color:transparent}.wpacu-btns .btn-outline-secondary.active,.wpacu-btns .btn-outline-secondary:active,.wpacu-btns .show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#ccc;border-color:#ccc}.wpacu-btns .btn-outline-info{color:#5bc0de;background-image:none;background-color:transparent;border-color:#5bc0de}.wpacu-btns .btn-outline-info:hover{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-outline-info.focus,.wpacu-btns .btn-outline-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.wpacu-btns .btn-outline-info.disabled,.wpacu-btns .btn-outline-info:disabled{color:#5bc0de;background-color:transparent}.wpacu-btns .btn-outline-info.active,.wpacu-btns .btn-outline-info:active,.wpacu-btns .show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-outline-success{color:#5cb85c;background-image:none;background-color:transparent;border-color:#5cb85c}.wpacu-btns .btn-outline-success:hover{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-outline-success.focus,.wpacu-btns .btn-outline-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.wpacu-btns .btn-outline-success.disabled,.wpacu-btns .btn-outline-success:disabled{color:#5cb85c;background-color:transparent}.wpacu-btns .btn-outline-success.active,.wpacu-btns .btn-outline-success:active,.wpacu-btns .show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-outline-warning{color:#f0ad4e;background-image:none;background-color:transparent;border-color:#f0ad4e}.wpacu-btns .btn-outline-warning:hover{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-outline-warning.focus,.wpacu-btns .btn-outline-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.wpacu-btns .btn-outline-warning.disabled,.wpacu-btns .btn-outline-warning:disabled{color:#f0ad4e;background-color:transparent}.wpacu-btns .btn-outline-warning.active,.wpacu-btns .btn-outline-warning:active,.wpacu-btns .show>.btn-outline-warning.dropdown-toggle{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-outline-danger{color:#d9534f;background-image:none;background-color:transparent;border-color:#d9534f}.wpacu-btns .btn-outline-danger:hover{color:#fff;background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-outline-danger.focus,.wpacu-btns .btn-outline-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.wpacu-btns .btn-outline-danger.disabled,.wpacu-btns .btn-outline-danger:disabled{color:#d9534f;background-color:transparent}.wpacu-btns .btn-outline-danger.active,.wpacu-btns .btn-outline-danger:active,.wpacu-btns .show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-link{font-weight:400;color:#0275d8;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.wpacu-btns .btn-link,.wpacu-btns .btn-link.active,.wpacu-btns .btn-link:active,.wpacu-btns .btn-link:disabled{background-color:transparent}.wpacu-btns .btn-link,.wpacu-btns .btn-link:active,.wpacu-btns .btn-link:focus,.wpacu-btns .btn-link:hover{border-color:transparent}.wpacu-btns .btn-link:focus,.wpacu-btns .btn-link:hover{color:#014c8c;text-decoration:underline;background-color:transparent}.wpacu-btns .btn-link:disabled{color:#636c72}.wpacu-btns .btn-link:disabled:focus,.wpacu-btns .btn-link:disabled:hover{text-decoration:none}.wpacu-btns .btn-group-lg>.btn,.wpacu-btns .btn-lg{padding:.75rem 1.5rem;font-size:1.25rem;-webkit-border-radius:.3rem;-moz-border-radius:.3rem;border-radius:.3rem}.wpacu-btns .btn-group-sm>.btn,.wpacu-btns .btn-sm{padding:.25rem .5rem;font-size:.875rem;-webkit-border-radius:.2rem;-moz-border-radius:.2rem;border-radius:.2rem}.wpacu-btns .btn-block{display:block;width:100%}.go-pro-button,.go-pro-link-no-style,.wordpress-core-file{display:inline-block;text-decoration:none}.wpacu-btns .btn-block+.btn-block{margin-top:.5rem}.wpacu-btns input[type=reset].btn-block,.wpacu-btns input[type=button].btn-block,.wpacu-btns input[type=submit].btn-block{width:100%}.wpacu-btns .fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.go-pro-button{background-color:#4CAF50;border:2px solid #4CAF50;color:#fff;padding:12px 18px;text-align:center;font-size:16px;margin:4px 2px;cursor:pointer;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-transition-duration:.4s;transition-duration:.4s}.go-pro-button:hover{background-color:#fff;color:#000;border:2px solid #4CAF50;text-decoration:none}.wpacu-restore-pos-btn{font-size:14px!important;line-height:normal!important;height:42px!important;padding:0 18px!important;margin-top:10px!important}body.wp-admin .wpacu_asset_row .go-pro-link-no-style .wpacu-tooltip{padding:8px 2px}body.wp-admin .go-pro-link-no-style .wpacu-tooltip{text-shadow:none;font-weight:400;font-size:12px;line-height:16px;padding:8px 11px}.go-pro-link-no-style{position:relative;color:inherit}.go-pro-link-no-style:not(.nav-tab){font-style:italic}.go-pro-link-no-style.no-transition .wpacu-tooltip{-webkit-transition:0s all ease;transition:0s all ease;-webkit-transition-delay:0s;transition-delay:0s}.go-pro-link-no-style>img{max-width:20px;max-height:20px}.go-pro-link-no-style .wpacu-tooltip{font-size:14px;line-height:18px;position:absolute;z-index:1;visibility:hidden;width:160px;background-color:#00a7a7;color:#fff;text-align:center;padding:8px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;bottom:100%;bottom:calc(100% + 15px);left:50%;margin-left:-65px;-webkit-transition:.1s all ease;transition:.1s all ease;-webkit-transition-delay:0s;transition-delay:0s}.go-pro-link-no-style .wpacu-tooltip:after{content:"";position:absolute;border-width:10px;border-style:solid;top:100%;left:50%;left:calc(50% - 10px);border-color:#00a7a7 transparent transparent}.go-pro-link-no-style .wpacu-tooltip.wpacu-on-pages-btn{cursor:pointer;margin-left:-77px;width:130px}.go-pro-link-no-style .wpacu-tooltip.wpacu-larger{width:240px}.go-pro-link-no-style:hover .wpacu-tooltip{visibility:visible}.wpacu_list_table tr:first-child .wordpress-core-file .wpacu-tooltip{bottom:-40px;left:120px;margin-left:-86px}.wpacu_list_table tr:first-child .wordpress-core-file .wpacu-tooltip:after{top:41px;left:-20px;border-color:transparent #c00 transparent transparent}.wordpress-core-file{position:relative;font-style:normal;color:inherit}.wordpress-core-file .wpacu-tooltip{font-size:14px;line-height:18px;position:absolute;z-index:1;visibility:hidden;width:160px;background-color:#c00;color:#fff;text-align:center;padding:6px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;bottom:100%;bottom:calc(100% + 15px);left:50%;margin-left:-86px;-webkit-transition:.1s all ease;transition:.1s all ease;-webkit-transition-delay:0s;transition-delay:0s}.wordpress-core-file .wpacu-tooltip:after{content:"";position:absolute;border-width:10px;border-style:solid;top:100%;left:50%;left:calc(50% - 10px);border-color:#c00 transparent transparent}.wordpress-core-file:hover .wpacu-tooltip{visibility:visible}.ajax-direct-call-error-area{background:#fff;padding:10px;border:1px solid #c00;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.ajax-direct-call-error-area td{padding:6px}.ajax-direct-call-error-area .note{margin-top:0;padding-top:0}.ajax-direct-call-error-area .error-code{color:#c00;font-weight:700}.ajax-wp-remote-post-call-error-area{background:#fff;padding:20px}.ajax-wp-remote-post-call-error-area .table-data{background:0 0;border:1px solid #c66;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.ajax-wp-remote-post-call-error-area .table-data td{padding:10px}.wrap-upgrade-info{background:#fff;padding:0 15px;border:1px solid #cdcdcd;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu-notice{margin:20px 20px 0 0!important}.wpacu-notice p{font-weight:600!important;font-style:italic}.wpacu-notice .dashicons{font-weight:inherit!important;color:#46b450!important;margin-right:4px;vertical-align:text-bottom;font-size:27px}.wpacu-notice-info{padding:12px 12px 12px 16px;background:#fff;border-left:4px solid #008f9c}.wpacu-notice-info p{margin-top:8px}.wpacu-notice-info p:first-child{margin-top:0}.wpacu-notice-info p:last-child{margin-bottom:0}.wpacu-warning{font-size:15px;padding:10px;background:#fffcec;border:1px solid #fdd5c9;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;margin:0 0 5px;width:100%}.pro-page-unlock-notice{-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;padding:10px;background:#f2faf2;border:1px solid #c0e8c0;width:auto;display:block}.wpacu-license-area .notice,.wpacu-settings-area .notice{margin-left:0;padding:10px!important;width:97%;box-sizing:border-box;font-weight:600;font-style:italic}#wpacu-dom-get-type-selections,.wpacu-radio-selections{float:none;clear:both;width:auto;display:inline-block;margin-bottom:0;margin-top:0}#wpacu-dom-get-type-selections.wpacu-vertical,.wpacu-radio-selections.wpacu-vertical{display:block;margin-top:15px;margin-bottom:18px}#wpacu-dom-get-type-selections.wpacu-vertical li,.wpacu-radio-selections.wpacu-vertical li{float:none;margin-bottom:12px}#wpacu-dom-get-type-selections.wpacu-vertical li:last-child,.wpacu-radio-selections.wpacu-vertical li:last-child{margin-bottom:0}#wpacu-dom-get-type-selections li,.wpacu-radio-selections li{margin-right:30px;float:left;margin-bottom:0}#wpacu-dom-get-type-selections li:first-child,.wpacu-radio-selections li:first-child{margin-right:15px}#wpacu-dom-get-type-selections li:last-child,.wpacu-radio-selections li:last-child{margin-right:0}.wpacu_combine_loaded_js_level_area{display:none;background:0 0;border-left:2px solid #008f9c;padding-top:8px;padding-bottom:8px;padding-right:10px;padding-left:10px;margin:20px 0 15px}.wpacu_combine_loaded_js_level_area.wpacu_active{display:block}#wpacu-dom-get-type-infos{margin-bottom:0}#wpacu-dom-get-type-infos li{margin-bottom:0;line-height:20px}.wpacu-wrap li,.wpacu-wrap p,.wpacu-wrap td{font-weight:400}.wpacu-wrap small{width:auto;float:none;display:inline}.wpacu-wrap.wpacu-settings-show-all .wpacu-settings-tab-content{display:block;width:100%}.wpacu-wrap.wpacu-settings-show-all .wpacu-settings-area-title{color:#004567;padding:16px 15px;background:#f8f8f8;border-left:5px solid #004567b0;border-top:1px solid #e7e7e7;border-right:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;font-size:1.45em;font-weight:500}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider.wpacu_round,.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch .wpacu_slider.wpacu_round{border-radius:29px}.wpacu-wrap.wpacu-settings-show-all #wpacu-update-button-area{margin:0}.wpacu-wrap.wpacu-settings-show-all #wpacu-update-button-area .button{padding:11px 28px;height:auto;font-size:18px}.wpacu-wrap.wpacu-settings-show-all #wpacu-updating-settings{margin-left:224px;top:25px}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch,.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch{width:auto;height:auto}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch input,.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch input{display:block}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch input[type=checkbox],.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch input[type=checkbox]{margin:0 0 3px}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch .wpacu_slider,.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch .wpacu_slider{display:none}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch{position:relative;display:inline-block;width:52px;height:29px}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input{display:none}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch:not(.wpacu_switch_standard) .wpacu_slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.2s;transition:.2s}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch:not(.wpacu_switch_standard) .wpacu_slider:before{position:absolute;content:'';height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;-webkit-transition:.2s;transition:.2s}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input:checked+.wpacu_slider{background-color:#52af00}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input:focus+.wpacu_slider{box-shadow:0 0 1px #52af00}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input:checked+.wpacu_slider:before{-webkit-transform:translateX(22px);-ms-transform:translateX(22px);transform:translateX(22px)}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch .wpacu_slider.wpacu_round:before{border-radius:50%}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch.wpacu_disabled,.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch.wpacu_locked_for_pro{opacity:.3}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch.wpacu_disabled:before{content:"\f160";font-family:Dashicons,Arial,"Times New Roman","Bitstream Charter",Times,serif;position:absolute;font-size:23px;top:5px;right:2px;z-index:1000}.asset-cleanup-pro_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle,.asset-cleanup_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle{margin-top:4px;line-height:1.4}.asset-cleanup-pro_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle em,.asset-cleanup_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle em{font-weight:200}.asset-cleanup-pro_page_wpassetcleanup_settings .setting_title p.wpacu_read_more,.asset-cleanup_page_wpassetcleanup_settings .setting_title p.wpacu_read_more{margin-top:-10px;font-style:italic;font-size:12px}.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_inline_code_status_choices,.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices,.asset-cleanup-pro_page_wpassetcleanup_settings .input_style_choices,.asset-cleanup_page_wpassetcleanup_settings .assets_list_inline_code_status_choices,.asset-cleanup_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices,.asset-cleanup_page_wpassetcleanup_settings .input_style_choices{list-style:none;margin:0}.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li,.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li,.asset-cleanup-pro_page_wpassetcleanup_settings .input_style_choices li,.asset-cleanup_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li,.asset-cleanup_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li,.asset-cleanup_page_wpassetcleanup_settings .input_style_choices li{float:left;margin-right:30px}.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li:last-child,.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li:last-child,.asset-cleanup-pro_page_wpassetcleanup_settings .input_style_choices li:last-child,.asset-cleanup_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li:last-child,.asset-cleanup_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li:last-child,.asset-cleanup_page_wpassetcleanup_settings .input_style_choices li:last-child{margin-right:0}#wpacu-assets-list-by-location-selected{background:0 0;border:1px solid #e7e7e7;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:8px;clear:both}.notice.notice-success+.wpacu-wrap.wpacu-settings-area{margin-top:20px}.wpacu-form-table th{vertical-align:top;text-align:left;padding:5px 20px 20px 0;width:200px;line-height:1.3;font-weight:600}.wpacu-form-table th label{color:#23282d;font-weight:600;font-size:14px;text-shadow:none;vertical-align:middle;cursor:pointer}.wpacu-form-table td{padding-bottom:25px}.wpacu-form-table td:last-child p:last-child{margin:0}.wpacu-form-table label input[type=checkbox]{height:19px;width:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.wpacu-form-table label input[type=checkbox]:checked,.wpacu-form-table label input[type=checkbox]:hover{border:1px solid green}.wpacu-form-table label input[type=checkbox]:checked:before{color:#52af00;font:400 24px/1 dashicons}#wpacu-settings-vertical-tab-wrap{display:table;width:100%}#wpacu-settings-vertical-tab-wrap *{box-sizing:border-box}.wpacu-settings-tab{display:table-cell;width:20%;height:100%;vertical-align:top}.wpacu-settings-tab a{text-decoration:none;border-left:3px solid transparent;display:block;background-color:#f1f1f1;color:#004567;padding:17px 16px;width:100%;outline:0;text-align:left;cursor:pointer;font-size:14px;font-weight:600;border-bottom:1px solid #ccc}.wpacu-settings-tab a:first-child{border-top:1px solid transparent!important}.wpacu-settings-tab a:last-child{border-bottom:1px solid transparent!important}.wpacu-settings-tab a:hover{background-color:#fff;border-left:3px solid #004567;position:relative}.wpacu-settings-tab a.active{color:#004567;background-color:#fff;border-left:3px solid #004567;position:relative;border-bottom:1px solid #ccc}.wpacu-settings-tab a.active:after{content:'';position:absolute;height:100%;width:1px;top:0;right:-1px;background-color:#fff}.wpacu-settings-tab-content{background-color:#fff;display:none;padding:12px 18px;width:79%;border-left:none;height:100%;border-top-right-radius:10px;border-bottom-right-radius:10px}.wpacu-settings-tab-content h2{padding:0 0 15px;border-bottom:1px solid #e7e7e7}.wpacu-settings-tab-content.active{display:table-cell}#wpacu_minify_css_exceptions_area,#wpacu_minify_js_exceptions_area{margin:16px 0 0}#wpacu-update-button-area{position:relative;margin-left:20%}#wpacu-update-button-area.no-left-margin{margin-left:0}#wpacu-update-button-area p{margin-top:10px}#wpacu-update-button-area .button{padding:5px 18px;height:38px;font-size:15px}#wpacu-updating-settings{position:absolute;margin-left:183px;top:19px;display:none}#combine_loaded_js_info_area{position:relative}#combine_loaded_js_info_area.locked-for-pro:before{position:absolute;content:'';height:100%;width:100%;background:#fff;opacity:.5;z-index:10000}body.wp-admin .wpacu-handle-notes{margin-top:10px!important}body.wp-admin .wpacu-handle-notes p{margin-top:0!important}body.wp-admin .wpacu-handle-notes p a{font-size:inherit}body.wp-admin .wpacu-handle-notes p a span.dashicons{font-size:19px;width:19px;height:19px;vertical-align:bottom;text-decoration:none}.wpacu-handle-notes{margin-top:12px!important;padding-top:5px;border-top:1px solid #e7e7e7}.wpacu-handle-notes .wpacu-handle-notes-field{display:none}.wpacu-handle-notes .wpacu-handle-notes-field>textarea{font-size:85%;padding:6px;width:320px;max-width:100%}.wpacu-handle-notes p{margin:10px 0 0!important}.wpacu-handle-notes p a.wpacu-add-handle-note{text-decoration:none;font-size:80%;display:inline-block;color:inherit}.wpacu-handle-notes p a.wpacu-add-handle-note span.dashicons{font-size:18px;width:18px;height:18px}.wrap_bulk_unload_options{width:auto;display:inline-flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.wrap_bulk_unload_options .wpacu_asset_options_wrap{flex-grow:1;margin:5px 10px 14px 0!important;padding:8px 10px 2px!important}.wrap_bulk_unload_options .wpacu_asset_options_wrap .wpacu_slider_text{position:relative!important;vertical-align:top;left:inherit!important;top:inherit!important}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch{position:relative;display:inline-block;min-width:52px;width:52px;height:29px;margin-right:5px!important}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input{display:none}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.15s;transition:.15s}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider:before{position:absolute;content:'';height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;-webkit-transition:.15s;transition:.15s}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input:checked+.wpacu_slider{background-color:#C00}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input:focus+.wpacu_slider{box-shadow:0 0 1px #C00}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input:checked+.wpacu_slider:before{-webkit-transform:translateX(22px);-ms-transform:translateX(22px);transform:translateX(22px)}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider.wpacu_round:before{border-radius:50%}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_slider_text{position:absolute;left:62px;top:3px}.editor-post-saved-state.is-wpacu-reloading{animation:edit-post__loading-fade-animation .5s infinite}body.wp-admin .wpacu_asset_row.wpacu-loading{position:relative}body.wp-admin .wpacu_asset_row.wpacu-loading .wpacu-ajax-loader{display:block!important}body.wp-admin .wpacu_asset_row .wpacu-ajax-loader{display:none;width:58px;height:58px;position:absolute;bottom:0;right:0;opacity:.75}.wpacu_asset_row input{width:auto;height:auto;min-height:16px}.wpacu_asset_row .tip{background:inherit;border-left:4px solid #e7e7e7;margin:5px 0;padding:7px;font-style:italic;font-size:small;line-height:1.4}.wpacu_asset_row td{width:100%;text-align:left}.wpacu_asset_row td p:last-child{margin-bottom:0!important}.wpacu_asset_row td .wpacu_asset_options_wrap{padding:8px 10px;margin:15px 0;background:#fff;border:1px solid #eee;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wpacu_asset_row td .wpacu_asset_options_wrap p:first-child{margin-top:0;margin-bottom:8px!important}.wpacu_asset_row p.wpacu_handle{margin-top:0}.wpacu_asset_row li.wpacu_unload_this_page{display:block!important;position:relative}.wpacu-clearfix:after,.wpacu-clearfix:before{display:table;content:''}.wpacu-contract-expand-area{width:100%;margin:20px 0 0}.wpacu-contract-expand-area .col-left{float:left}.wpacu-contract-expand-area .col-left h4{margin-bottom:0}.wpacu-contract-expand-area .col-right{float:right}.wpacu-clearfix:after{clear:both}.wpacu-wp-button{color:#555;border-color:#ccc;background:#f7f7f7;box-shadow:0 1px 0 #ccc;vertical-align:top}body.wp-admin .wpacu-wp-button{font-size:13px;line-height:26px;height:28px}.wpacu-wp-button.wpacu-wp-button-secondary{display:inline-block;text-decoration:none;height:auto;margin:0 5px 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-sizing:border-box}.wpacu-wp-button:hover{background:#fafafa;border-color:#999;color:#23282d}.distinguish-asset-list{list-style:none;margin-left:0;margin-bottom:5px;display:inline-block}.distinguish-asset-list li{float:left;margin-right:20px}.distinguish-asset-list li:last-child{margin-right:0}body[class*=asset-cleanup-pro] a.wpacu-plugin-contracted-wrap-link{padding:16px 6px 16px 41px!important}body[class*=asset-cleanup-pro] .wpacu-area-open .wpacu-plugin-toggle-all{font-size:12px!important;width:calc(100% - 26px)!important}body.wp-admin .wpacu-area-expanded .wpacu-plugin-toggle-all{top:5px}body.wp-admin .wpacu-area-expanded .wpacu-plugin-toggle-all ul li{font-size:12px!important}.wpacu-assets-collapsible-wrap{border:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-by-location{margin-bottom:15px}.wpacu-assets-collapsible-wrap.wpacu-wrap-all{margin-top:20px}.wpacu-assets-collapsible-wrap.wpacu-wrap-area{margin-top:10px}.wpacu-assets-collapsible-wrap.wpacu-by-location>a.wpacu-assets-collapsible{padding:15px 15px 15px 43px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu_list_table{border-width:0;margin:0;border-spacing:inherit;width:100%;box-shadow:3px 3px 2px #ddd;border-bottom-right-radius:5px;border-top-right-radius:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location span.wpacu-child-location-name{font-weight:600}.wpacu-assets-collapsible-wrap.wpacu-by-location span.wpacu-child-location-version{font-weight:200}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area[data-wpacu-plugin=oxygen] .icon-area{border-radius:50%}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all{display:inline-block;padding:0;font-size:13px;width:100%;width:calc(100% + 46px);min-width:250px;position:absolute;left:100%;left:calc(100% + 6px);margin:0;top:4px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all ul{display:inline-block;margin:0;list-style:none;padding-left:13px;padding-top:0}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all ul li{padding:0;margin:0;line-height:normal;font-size:14px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all ul li:first-child{font-style:italic;margin-bottom:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content>table:last-child{margin-bottom:20px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title{display:inline;position:relative;z-index:1}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title:after{content:'';position:absolute;width:100%;left:0;bottom:0;height:1px;background-color:#fdfdfd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-plugin-assets-wrap{padding:0 0 10px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-plugin-assets-wrap.wpacu-area-open .wpacu-plugin-toggle-all{display:inline-block;padding:7px 12px 16px;font-size:14px;width:100%;text-align:left;border-left:1px solid #cdcdcd;border-right:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-plugin-assets-wrap.wpacu-area-open.wpacu-plugin-assets-last{margin-bottom:18px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link{color:inherit;text-decoration:none;font-weight:inherit;font-style:inherit;font-size:105%;line-height:initial;height:auto;margin:14px 0 0;padding:13px 6px 14px 39px;position:relative;display:block}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link:after{position:absolute;font-size:18px;font-family:Dashicons;right:12px;top:14px;content:"\f132"}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-open:after{content:"\f460"}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-closed{border:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link:hover{border:1px solid #878787;background:#f9f9f9}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link:hover.wpacu-link-closed{box-shadow:3px 3px 2px #ddd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-open{border-top:1px solid #cdcdcd;border-left:1px solid #cdcdcd;border-right:1px solid #cdcdcd;border-bottom:none}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-closed.wpacu-last-wrap-link{margin-bottom:20px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .icon-plugin-default{top:10px;left:10px;width:30px;height:30px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .icon-plugin-default .icon-area{width:30px;height:30px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .icon-plugin-default .icon-area:before{font-size:22px;line-height:22px;top:4px;left:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .wpacu-area-title{position:relative;padding:17px 10px 16px 46px;z-index:1}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .wpacu-area-title:after{content:'';position:absolute;width:100%;left:0;bottom:0;height:1px;background-color:#fdfdfd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-area-last{margin-bottom:18px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-area-open{padding:0;max-height:100%}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-area-closed{padding:0;overflow:hidden;max-height:0}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content>table:last-child{margin-bottom:20px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title{margin-top:0;margin-bottom:-1px;padding:14px 10px 16px 12px!important}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title.wpacu-theme-has-icon{padding:18px 10px 16px 58px!important}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area{margin-top:22px;margin-bottom:-1px;font-size:110%;line-height:initial}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area.wpacu-location-child-area-first{margin-top:2px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area.wpacu-area-expanded .wpacu-area-title{display:inline-block;z-index:1;padding:17px 10px 16px 46px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title{display:inline;border-top-right-radius:8px;border-top-left-radius:8px;background-color:#f9f9f9;border-left:1px solid #cdcdcd;border-top:1px solid #cdcdcd;border-bottom:1px solid transparent;border-right:1px solid #cdcdcd;position:relative}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default{position:absolute;padding:0;top:10px;left:10px;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default:not(.has-icon){color:#b4b9be;background-color:#eee;box-shadow:inset 0 0 10px rgba(160,165,170,.15);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default:not(.has-icon) .icon-area:before{content:"\f106";font-family:Dashicons;position:absolute;font-size:28px;line-height:28px;top:5px;left:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default .icon-area{position:relative;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-theme{position:absolute;padding:0;top:10px;left:10px;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-theme .icon-area{position:relative;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-wp_core{border:1px solid #c00}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content{padding:0}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table{width:100%;margin:0}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row td,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row td{border-left:hidden;border-right:hidden;border-bottom:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child{margin-bottom:0!important}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child td:last-child,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child td:last-child{border-bottom:hidden}a.wpacu-assets-collapsible{color:#000;font-size:20px;text-decoration:none;display:block;position:relative;background-color:#f1f3f8;cursor:pointer;padding:15px 15px 15px 36px;width:auto;border:none;text-align:left;outline:0}a.wpacu-assets-collapsible>span.dashicons{font-size:25px;line-height:normal;position:absolute;top:15px;top:calc(50% - 21px);left:22px;-webkit-transform:translate(-50%,50%);transform:translate(-50%,50%)}a.wpacu-assets-collapsible:hover{background-color:#f1f3f8;text-decoration:none}a.wpacu-assets-collapsible:after{position:absolute;font-size:22px;font-family:Dashicons;right:14px;top:16px}a.wpacu-assets-collapsible:not(.wpacu-assets-collapsible-active):after{content:"\f132"}a.wpacu-assets-collapsible.wpacu-assets-collapsible-active{background-color:#f1f3f8}a.wpacu-assets-collapsible.wpacu-assets-collapsible-active:after{content:"\f460"}.wpacu-assets-collapsible-content{padding:0 16px;max-height:0;overflow:hidden;background-color:#fbfbfb8c}.wpacu-assets-collapsible-content .wpacu-assets-note{margin:0;padding:15px 15px 10px}.wpacu-assets-collapsible-content>div:not(.wpacu-assets-table-list-wrap){padding:16px 0 0}.wpacu-assets-collapsible-content>div>p:first-child{margin-top:0}.wpacu-assets-collapsible-content.wpacu-open{max-height:100%}a.wpacu-assets-inline-code-collapsible{color:inherit;font-size:14px;text-decoration:none;display:inline-block;position:relative;cursor:pointer;width:auto;outline:0;background:#f1f3f8;border:1px solid #cdcdcd;padding:4px 21px 4px 8px;margin:0 0 0 6px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}a.wpacu-assets-inline-code-collapsible:hover{border:1px solid #5c5c5c}a.wpacu-assets-inline-code-collapsible:after{position:absolute;font-size:15px;font-family:Dashicons;right:-3px;top:-1px;width:14px;height:14px;-webkit-transform:translate(-50%,50%);transform:translate(-50%,50%)}a.wpacu-assets-inline-code-collapsible:not(.wpacu-assets-inline-code-collapsible-active):after{content:"\f132"}a.wpacu-assets-inline-code-collapsible.wpacu-assets-inline-code-collapsible-active:after{content:"\f460"}.wpacu-assets-inline-code-collapsible-content{font-size:80%;padding:0 8px;max-height:0;overflow:hidden;background-color:#fbfbfb8c}.wpacu-assets-inline-code-collapsible-content>div{padding:7px 8px 0}.wpacu-assets-inline-code-collapsible-content>div>p{line-height:normal!important}.wpacu-assets-inline-code-collapsible-content>div>p:first-child{margin-top:0}.wpacu-assets-inline-code-collapsible-content.wpacu-open{max-height:100%}.wpacu_asset_row p div.select{display:inline-block}.wpacu-wrap-choose-position{display:inline}.wpacu-wrap-choose-position>div{display:inline-block}.wpacu-wrap-choose-position select{width:auto;font-size:inherit;display:inline;margin-left:6px;margin-right:4px}.wpacu-wrap-choose-position>.select>.select{display:inline}.wpacu-wrap-choose-position>.select>.select select{padding-right:30px}.wpacu-wrap-choose-position>.select>.select:after{right:15px;top:-4px}.wpacu_table_wrap{margin:20px 0 0}.wpacu_table_wrap>table{border:1px solid #cdcdcd}.wpacu_table_wrap .table{width:100%;max-width:100%;margin-bottom:1rem;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu_table_wrap .table td,.wpacu_table_wrap .table th{padding:.75rem;vertical-align:top;border-top:1px solid #eceeef}.wpacu_table_wrap .table thead th{vertical-align:bottom;border-bottom:2px solid #eceeef}.wpacu_table_wrap .table tbody+tbody{border-top:2px solid #eceeef}.wpacu_table_wrap .table .table{background-color:#fff}.wpacu_table_wrap .table-sm td,.wpacu_table_wrap .table-sm th{padding:.3rem}.wpacu_table_wrap .table-bordered,.wpacu_table_wrap .table-bordered td,.wpacu_table_wrap .table-bordered th{border:1px solid #eceeef}.wpacu_table_wrap .table-bordered thead td,.wpacu_table_wrap .table-bordered thead th{border-bottom-width:2px}.wpacu_table_wrap .table-striped tbody tr:nth-of-type(even){background-color:#f9f9f9}.wpacu_table_wrap .table-striped tbody tr:nth-of-type(odd){background-color:#fff}.wpacu_table_wrap .table-active,.wpacu_table_wrap .table-active>td,.wpacu_table_wrap .table-active>th,.wpacu_table_wrap .table-hover .table-active:hover,.wpacu_table_wrap .table-hover .table-active:hover>td,.wpacu_table_wrap .table-hover .table-active:hover>th,.wpacu_table_wrap .table-hover tbody tr:hover{background-color:rgba(0,0,0,.075)}.wpacu_table_wrap .table-success,.wpacu_table_wrap .table-success>td,.wpacu_table_wrap .table-success>th{background-color:#dff0d8}.wpacu_table_wrap .table-hover .table-success:hover,.wpacu_table_wrap .table-hover .table-success:hover>td,.wpacu_table_wrap .table-hover .table-success:hover>th{background-color:#d0e9c6}.wpacu_table_wrap .table-info,.wpacu_table_wrap .table-info>td,.wpacu_table_wrap .table-info>th{background-color:#d9edf7}.wpacu_table_wrap .table-hover .table-info:hover,.wpacu_table_wrap .table-hover .table-info:hover>td,.wpacu_table_wrap .table-hover .table-info:hover>th{background-color:#c4e3f3}.wpacu_table_wrap .table-warning,.wpacu_table_wrap .table-warning>td,.wpacu_table_wrap .table-warning>th{background-color:#fcf8e3}.wpacu_table_wrap .table-hover .table-warning:hover,.wpacu_table_wrap .table-hover .table-warning:hover>td,.wpacu_table_wrap .table-hover .table-warning:hover>th{background-color:#faf2cc}.wpacu_table_wrap .table-danger,.wpacu_table_wrap .table-danger>td,.wpacu_table_wrap .table-danger>th{background-color:#f2dede}.wpacu_table_wrap .table-hover .table-danger:hover,.wpacu_table_wrap .table-hover .table-danger:hover>td,.wpacu_table_wrap .table-hover .table-danger:hover>th{background-color:#ebcccc}.wpacu_table_wrap .thead-inverse th{color:#fff;background-color:#292b2c}.wpacu_table_wrap .thead-default th{color:#464a4c;background-color:#eceeef}.wpacu_table_wrap .table-inverse{color:#fff;background-color:#292b2c}.wpacu_table_wrap .table-inverse td,.wpacu_table_wrap .table-inverse th,.wpacu_table_wrap .table-inverse thead th{border-color:#fff}.wpacu_table_wrap .table-inverse.table-bordered,.wpacu_table_wrap .table-responsive.table-bordered{border:0}.wpacu_table_wrap .table-responsive{display:block;width:100%;overflow-x:auto;-ms-overflow-style:-ms-autohiding-scrollbar}.wp-list-table .wpacu_remove_global_attr_row.wpacu_selected,.wp-list-table .wpacu_restore_position_row.wpacu_selected{background:#e7e7e7}ul.hire-reasons{margin-bottom:20px}ul.hire-reasons li{font-size:14px;line-height:22px;margin-bottom:12px}ul.hire-reasons li .dashicons{font-size:23px;line-height:23px}ul.hire-reasons li .dashicons.dashicons-yes{color:green}ol.getting-started li{font-size:14px;line-height:22px;margin-bottom:8px}.wpacu-get-help-wrap p{font-size:14px}.wpacu-get-help-wrap .help-content-wrap{margin:20px 0 25px;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-moz-flex;display:-webkit-flex;display:flex;width:100%}@media only screen and (min-width:768px){.wpacu-get-help-wrap .help-content-wrap{-webkit-box-align:start;-ms-flex-align:start;-ms-grid-row-align:flex-start;align-items:flex-start}}@media only screen and (max-width:767px){.wpacu-get-help-wrap .help-content-wrap{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}}.wpacu-get-help-wrap .help-content-wrap .help-content{padding:15px;background:#fff;border:1px solid #E0E0E0;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;box-shadow:2px 3px 8px 0 #231f2038;flex:1 1 50%;margin-bottom:10px}.wpacu-get-help-wrap .help-content-wrap .help-content .content-title{margin:5px 0 15px}.wpacu-get-help-wrap .help-content-wrap .help-content .cols-wrap{width:100%;margin:0 auto;display:table}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area{margin:5px 0 0;position:relative}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area.col-left{float:left;width:48%}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area.col-right{float:right;width:48%}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area.activate-plugin img{max-width:280px}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area img{width:99%;margin:8px 0;border:1px solid #cdcdcd;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu-get-help-wrap .help-content-wrap .help-content.upgrade-help{order:2}@media only screen and (min-width:768px){.wpacu-get-help-wrap .help-content-wrap .help-content{margin-right:24px}.wpacu-get-help-wrap .help-content-wrap .help-content.upgrade-help{margin-right:0}}.wpacu-get-help-wrap .help-content-wrap .help-content.tech-help{order:1}@media only screen and (max-width:767px){.wpacu-get-help-wrap .help-content-wrap .help-content.tech-help{margin-bottom:30px}}.wpacu-get-help-wrap .help-content-wrap .help-content ul{list-style:none;padding-left:0}.wpacu-get-help-wrap .help-content-wrap .help-content ul li{font-size:14px;line-height:22px;margin-bottom:15px}.wpacu-get-help-wrap .help-content-wrap .help-content p:last-child,.wpacu-get-help-wrap .help-content-wrap .help-content ul li:last-child{margin-bottom:0}#wpacu-license-data-remove-area{display:none;margin:10px 0 25px}#wpacu-license-data-remove-area.wpacu-visible{display:block}span#wpacu-license-data-removed-msg{display:block;padding-left:26px}#wpacu-warning-read{display:none;margin:10px 0}#wpacu-warning-read span.dashicons-warning{color:#c00}#wpacu-warning-read.wpacu-visible{display:block}#wpacu-reset-submit-area{margin:10px 0;clear:both}#wpacu-reset-submit-btn{margin:10px 0 0}.wpacu-tools-area{margin:10px 20px 0 2px}.wpacu-tools-area .wpacu-tools-container{background:#fff;padding:15px;border:1px solid #cdcdcd;width:96%}.wpacu-tools-area .wpacu-tools-container form>div:first-child{margin:0 0 10px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning{display:none;box-sizing:border-box;margin-top:10px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning p{margin:0 0 10px;line-height:22px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning p:only-child{margin:0}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning ul{font-size:13px;list-style-type:disc;padding-left:30px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning.wpacu-visible{display:block}.wpacu-tools-area .wpacu-export-import-area{padding:10px}.wpacu-tools-area .wpacu-export-import-area form>p:first-of-type{margin-top:0}.wpacu-tools-area .wpacu-export-import-area form>p:last-of-type{margin-bottom:0}.wpacu-tools-area .wpacu-export-import-area:hover{background:rgba(40,44,42,.05);box-shadow:inset 0 0 10px rgba(160,165,170,.15)}.wpacu-tools-area .wpacu-export-import-area+hr{display:block;height:1px;border:0;border-top:1px solid #cdcdcd;margin:10px 0;padding:0}#wpacu-import-form button.wpacu-importing img.wpacu-spinner{display:inline-block}#wpacu-import-form button img.wpacu-spinner{display:none;margin:0 0 0 5px;height:16px;width:16px;vertical-align:middle}.wpacu-about-wrap .wpacu-about-text img{width:auto;height:150px;position:absolute;top:20px;right:-20px}@media only screen and (max-width:767px){.wpacu-about-wrap h1{margin:20px}.wpacu-about-wrap .wpacu-about-text img{display:none}.wpacu-about-wrap .wpacu-about-text{margin:20px}}.wpacu-about-wrap .about-wrap-content .area-title{font-size:19px;line-height:19px;margin-bottom:0}.wpacu-about-wrap hr{margin:10px 0}.wpacu-lite-vs-pro-wrap ul{display:flex;top:0;z-index:10;padding-bottom:14px}.wpacu-lite-vs-pro-wrap li{list-style:none;flex:1}.wpacu-lite-vs-pro-wrap li:last-child{border-right:1px solid #DDD}.wpacu-lite-vs-pro-wrap button{width:100%;border:1px solid #DDD;border-right:0;border-top:0;padding:10px;background:#FFF;font-size:14px;font-weight:700;height:60px;color:#999}.wpacu-lite-vs-pro-wrap li.active button{background:#F5F5F5;color:#000}.wpacu-lite-vs-pro-wrap table{border-collapse:collapse;table-layout:fixed;width:100%}.wpacu-lite-vs-pro-wrap th{background:inherit}.wpacu-lite-vs-pro-wrap tr.first{background:inherit;font-size:18px}.wpacu-lite-vs-pro-wrap tr.first .bg-lite{border-top:4px solid #6d6e70;background:#fff;color:#6d6e70}.wpacu-lite-vs-pro-wrap tr.first .bg-pro{border-top:4px solid green;background:#fff;color:green}.wpacu-lite-vs-pro-wrap tr:not(.first){background:#fff}.wpacu-lite-vs-pro-wrap tr:not(:last-child):hover{background:#f8f8f8}.wpacu-lite-vs-pro-wrap td,.wpacu-lite-vs-pro-wrap th{height:53px;border:1px solid #DDD;padding:10px 16px;empty-cells:show;text-align:left}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap td,.wpacu-lite-vs-pro-wrap th{font-size:14px}}.wpacu-lite-vs-pro-wrap td+td,.wpacu-lite-vs-pro-wrap th+th{text-align:center;display:none}.wpacu-lite-vs-pro-wrap td.default{display:table-cell}.wpacu-lite-vs-pro-wrap .txt-l{font-size:28px;font-weight:700}.wpacu-lite-vs-pro-wrap .txt-top{position:relative;top:-9px;left:-2px}.wpacu-lite-vs-pro-wrap svg{width:18px;height:18px}.wpacu-lite-vs-pro-wrap svg path{fill:green}.wpacu-lite-vs-pro-wrap .tick{color:#2CA01C}.wpacu-lite-vs-pro-wrap .tick img{fill:#2CA01C}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap .txt-l{font-size:20px}.wpacu-lite-vs-pro-wrap .tick{font-size:15px}}.wpacu-lite-vs-pro-wrap .na{font-size:18px;opacity:.3;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.wpacu-lite-vs-pro-wrap .hide{border:0;background:0 0}.wpacu-lite-vs-pro-wrap td,.wpacu-lite-vs-pro-wrap th{display:table-cell!important;width:auto}.wpacu-lite-vs-pro-wrap td+td,.wpacu-lite-vs-pro-wrap th+th{width:130px}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap .na{font-size:15px}.wpacu-lite-vs-pro-wrap td+td,.wpacu-lite-vs-pro-wrap th+th{width:42px}}@media only screen and (min-width:768px){.wpacu-lite-vs-pro-wrap td .button{font-size:16px!important}}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap td .button{font-size:14px!important;padding:0 20px!important}.wpacu-lite-vs-pro-wrap td .button.button-primary{margin-top:6px;margin-bottom:14px}}@media only screen and (min-width:768px){.wpacu-lite-vs-pro-wrap{margin-bottom:40px;clear:both}}.wpacu-video-areas>div{padding:20px;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu-video-areas>div:nth-child(odd){background:#fff}.wpacu-video-areas>div:nth-child(even){background:inherit}@media only screen and (min-width:1200px){.wpacu-video-areas .wpacu-video-area-wrapper{margin:0 0 15px;display:flex}.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-col-right{padding:0 20px 0 25px}}@media only screen and (min-width:992px) and (max-width:1199px){.wpacu-video-areas .wpacu-video-area-wrapper{margin:0 0 40px}}.wpacu-video-areas .wpacu-video-area-wrapper ol{font-size:14px}.wpacu-video-areas .wpacu-video-area-wrapper ul{font-size:14px;list-style:disc;margin-left:22px}@media only screen and (min-width:1200px){.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-col-right p:first-child{margin-top:0}.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-col-right p:last-child{margin-bottom:0}}@media only screen and (max-width:1199px){.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-video-wrapper{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-video-wrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}}#wpassetcleanup_asset_list.postbox h2{padding-left:52px!important;position:relative}#wpassetcleanup_asset_list.postbox h2:before{content:'';position:absolute;background-image:url(images/wpacu-logo-transparent-bg-v1.png);background-size:cover;top:6px;left:13px;width:33px;height:26px;opacity:.8;-webkit-filter:grayscale(100%);filter:grayscale(100%)}body.wp-admin .wpacu-modal{display:none;position:fixed;z-index:1000000;padding-top:15%;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}body.wp-admin .wpacu-modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:80%;max-width:600px;border-radius:10px}body.wp-admin .wpacu-close{color:#aaa;float:right;font-size:28px;font-weight:700}body.wp-admin .wpacu-close:focus,body.wp-admin .wpacu-close:hover{color:#000;text-decoration:none;cursor:pointer}.wpacu-bulk-changes-tabs{display:table;position:relative;overflow:hidden;margin:0;width:100%}.wpacu-bulk-changes-tabs li{border-top:1px solid rgba(40,44,42,.1);border-left:1px solid rgba(40,44,42,.1);border-bottom:1px solid rgba(40,44,42,.1);float:left;line-height:38px;padding:0;position:relative;margin-bottom:12px}.wpacu-bulk-changes-tabs li:last-child{border-right:1px solid rgba(40,44,42,.1)}.wpacu-bulk-changes-tabs a{position:relative;background:rgba(40,44,42,.05);color:#004567;font-size:14px;font-weight:500;display:block;letter-spacing:0;outline:0;padding:6px 20px;text-decoration:none;border-top:3px solid transparent}.wpacu-bulk-changes-tabs a:hover{background:#f1f1f1;border-top:3px solid transparent}.wpacu-bulk-changes-tabs .current a{background:#fff;border-top:3px solid #004567}.wpacu-bulk-changes-tabs .current a:hover{background:#fff}.wpacu-bulk-changes-tabs .current a:after,.wpacu-bulk-changes-tabs .current a:before{top:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.wpacu-bulk-changes-tabs .current a:after{border-color:rgba(136,183,213,0);border-top-color:#fff;border-width:12px;margin-left:-12px}.wpacu-bulk-changes-tabs .current a:before{border-color:rgba(194,225,245,0);border-top-color:rgba(40,44,42,.1);border-width:13px;margin-left:-13px}
|
1 |
+
#wpacu-pages-info-area{width:98%}#wpacu-top-area{margin:15px 0;padding:0 10px}#wpacu-quick-actions{color:#74777b;float:right;width:auto;margin-right:30px;background:rgba(40,44,42,.05);border-radius:10px;padding:6px 12px}#wpacu-quick-actions .wpacu-actions-title{font-weight:200;letter-spacing:.5px}#wpacu-quick-actions a{color:#004567;text-decoration:none}#wpacu-quick-actions a:hover{color:#0073aa}#wpacu-logo-wrap{width:auto;display:inline-block;position:relative}#wpacu-logo-wrap a{display:block}#wpacu-logo-wrap img{width:352px;height:79px}#wpacu-logo-wrap .wpacu-pro-sign{position:absolute;height:auto;font-family:FiraSans-Medium,proxima-nova-1,Montserrat,Helvetica,sans-serif;font-size:13px;font-weight:600;letter-spacing:1px;padding:5px 11px;border-radius:15px;right:-60px;top:30px;width:auto;display:inline-block;text-align:center}#wpacu-logo-wrap .wpacu-pro-sign.wpacu-lite{color:#74777b;background:rgba(40,44,42,.05)}#wpacu-logo-wrap .wpacu-pro-sign.wpacu-pro{color:#004567;background-color:rgba(40,44,42,.05)}#wpacu_meta_box_content .dashicons.dashicons-warning,.wpacu-tabs nav ul li span.extra-info.license-status.inactive{color:#c00}.wpacu-tabs{position:relative;overflow:hidden;margin:0 auto 20px;width:100%;font-weight:300;font-size:20px}.wpacu-tabs nav{text-align:center}.wpacu-tabs nav ul{position:relative;display:-ms-flexbox;display:-webkit-flex;display:-moz-flex;display:-ms-flex;display:flex;margin:0 auto;padding:0;max-width:1200px;list-style:none;-ms-box-orient:horizontal;-ms-box-pack:center;-webkit-flex-flow:row wrap;-moz-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;justify-content:center}.wpacu-tabs nav ul li{position:relative;z-index:1;display:block;margin:0;text-align:center;-webkit-flex:1;-moz-flex:1;-ms-flex:1;flex:1}.wpacu-tabs nav ul li span.extra-info{position:absolute;font-size:12px;left:0;right:50%;bottom:12px;-webkit-transform:translate(50%,50%);transform:translate(50%,50%)}.wpacu-tabs nav ul li span.extra-info .dashicons{font-size:16px;margin-right:-3px;margin-top:1px}.wpacu-tabs nav ul li span.extra-info.license-status.active{color:green}.wpacu-tabs nav ul li span.extra-info.assets-unloaded-false{color:#004567}.wpacu-license-area .notice .dashicons,.wpacu-settings-area .notice .dashicons,.wpacu-tabs nav ul li span.extra-info.assets-unloaded-true,.wpacu-tabs nav ul li span.extra-info.bulk-unloads-true{color:green}.wpacu-tabs nav a{position:relative;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:2.5}.wpacu-tabs nav a span{vertical-align:middle;font-size:14px}.wpacu-tabs nav li.wpacu-tab-current a{color:#74777b}.wpacu-tabs nav a:focus{outline:0}.wpacu-tabs .dashicons{font-size:20px}.no-js .wpacu-content-wrap section{display:block;padding-bottom:2em;border-bottom:1px solid rgba(255,255,255,.6)}.no-flexbox nav ul{display:block}.no-flexbox nav ul li{min-width:15%;display:inline-block}@media screen and (max-width:58em){.wpacu-tabs nav a.icon span{display:none}.wpacu-tabs nav a:before{margin-right:0}}.wpacu-tabs-style-underline nav{background:#fff}.wpacu-tabs-style-underline nav a{color:#74777b;font-size:18px;text-transform:uppercase;text-decoration:none;padding:.25em 0 .5em;border-left:1px solid #e7ecea;-webkit-transition:color .2s;transition:color .2s}.wpacu-tabs-style-underline nav li:last-child a{border-right:1px solid #e7ecea}.wpacu-tabs-style-underline nav li a::after{position:absolute;bottom:0;left:0;width:100%;height:6px;background:#2CC185;content:'';-webkit-transition:-webkit-transform .3s;transition:transform .3s;-webkit-transform:translate3d(0,150%,0);transform:translate3d(0,150%,0)}.wpacu-tabs-style-underline nav li.wpacu-tab-current a::after{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.wpacu-tabs-style-underline nav a span{font-weight:700}.wpacu-tabs-style-topline{max-width:1200px;margin:20px auto 30px 0;width:100%;font-weight:300;text-decoration:none}.wpacu-tabs-style-topline nav li{border:1px solid rgba(40,44,42,.1)}.wpacu-tabs-style-topline nav li:not(:last-child){border-right:none}.wpacu-tabs-style-topline nav li.wpacu-tab-current{border-top-color:#008f9c;border-bottom:none}.wpacu-tabs-style-topline nav a{padding:20px 18px;background:rgba(40,44,42,.05);color:#74777b;line-height:1;-webkit-transition:color .2s;transition:color .2s;text-decoration:none}.wpacu-tabs-style-topline nav a:focus,.wpacu-tabs-style-topline nav a:hover{background:0 0;color:#008f9c}.wpacu-tabs-style-topline nav li.wpacu-tab-current a{background:0 0;box-shadow:inset 0 3px 0 #008f9c;color:#008f9c}.wpacu-tabs-style-topline nav li.wpacu-tab-current a span:not(.dashicons){font-weight:600}.wpacu-tabs-style-topline nav a span{text-transform:uppercase;font-weight:400}.wpacu-tab-nav-wrapper{border-bottom:none!important}.wpacu-tab-nav-wrapper .nav-tab.nav-tab-active{background:#fff;position:relative}.wpacu-tab-nav-wrapper .nav-tab.nav-tab-active:after{content:'';width:100%;bottom:-2px;left:0;position:absolute;border-bottom:2px solid #fff}.wpacu-script-attributes-area{margin:20px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings{padding:5px 7px!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings.wpacu-first{margin:0 28px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings label{margin:0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings li{margin:0 16px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings li:first-child{margin:0 10px 0 0!important}.wpacu-script-attributes-area.wpacu-lite ul.wpacu-script-attributes-settings li:last-child{margin:0 2px 0 0!important}.wpacu-script-attributes-area .wpacu-script-attributes-settings{background:#fff!important;border:1px solid #eee!important;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:5px 10px!important;list-style:none;display:inline-block;margin:0}.wpacu-script-attributes-area .wpacu-script-attributes-settings input[type=radio]{width:auto;padding:0;margin:0 5px 0 0}.wpacu-script-attributes-area .wpacu-script-attributes-settings.wpacu-first{margin:0 34px 0 0!important}.wpacu-script-attributes-area .wpacu-script-attributes-settings li{float:left;margin:0 17px 0 0}.wpacu-script-attributes-area .wpacu-script-attributes-settings li:first-child{margin:0 10px 0 0!important}.wpacu-script-attributes-area .wpacu-script-attributes-settings li:last-child{margin:0}.wpacu-script-attributes-area .wpacu-script-attributes-settings:hover{background:#f2faf2}tr.wpacu_location_changed>td{border-left:#004567 4px solid}tr.wpacu_not_load td,tr.wpacu_not_load th{background:#FFE1E1!important}tr.wpacu_not_load td .wpacu-assets-inline-code-wrap,tr.wpacu_not_load td .wpacu-script-attributes-area,tr.wpacu_not_load th .wpacu-assets-inline-code-wrap,tr.wpacu_not_load th .wpacu-script-attributes-area{filter:alpha(opacity=45);opacity:.45}.dashicons-wpacu{width:17px;height:17px;margin:2px 0 0;font-size:16px;text-decoration:none}#wpacu_meta_box_content,.wpacu_widefat{width:99%}.wpacu_widefat .check-column.wpacu_check{padding:10px}body[class*=wpassetcleanup] #footer-left{border-left:2px solid green;padding-left:10px}#wpassetcleanup_asset_list small{width:auto;float:none;display:inline}#wpacu_meta_box_content .emoji{font-size:18px}#wpacu_meta_box_content h3{margin-left:0;padding-left:0}#wpacu_meta_box_content div.wpacu_note{padding:10px;background-color:#f5f5f5}#wpacu_meta_box_content .wpacu_verified{padding:10px;background-color:#f5f5f5;border-left:1px solid #ddd}#wpacu_meta_box_content .wpacu_verified span{color:#0073aa;font-weight:700}#wpacu_meta_box_content div.wpacu_warning{border:1px solid #c00}#wpacu_meta_box_content ul.wpacu_asset_options{margin:0;padding:0}#wpacu_meta_box_content ul.wpacu_asset_options li{list-style:none;display:inline-block}#wpacu_meta_box_content ul.wpacu_asset_options label{font-weight:400;margin-right:5px;margin-top:5px;margin-bottom:5px}.wpacu-updated-frontend{font-weight:400;background-color:#fff;border-left:4px solid #46b450;border-top:1px solid #46b450;border-right:1px solid #46b450;border-bottom:1px solid #46b450;padding:9px 14px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wpacu-updated-frontend span.dashicons-yes{color:#46b450;font-size:26px}#wpacu-update-front-settings-area{margin:10px 0;display:inline-block;position:relative}#wpacu-updating-front-settings{display:none;position:absolute;top:5px;right:-35px}#wpacu_wrap_assets{color:#000!important;text-align:left!important;clear:both!important;width:90%!important;padding:20px!important;margin:30px 0 0 15px!important;border:1px solid #cdcdcd;z-index:10000!important;position:relative!important;background-color:#fff!important}#wpacu_wrap_assets div.wpacu_warning{border:1px solid #c00;padding:5px 10px}#wpacu_wrap_assets small{display:inline!important;margin:0!important;letter-spacing:normal!important}#wpacu_wrap_assets input[type=checkbox]{width:auto!important;margin-right:4px!important}#wpacu_wrap_assets img:not(.wpacu-ajax-loader){display:inline-block!important}#wpacu_wrap_assets p{line-height:22px!important;margin:10px 0!important;text-align:left!important;font-weight:400!important}#wpacu_wrap_assets p:first-child,.wpacu_verified{margin:0 0 10px!important}#wpacu_wrap_assets h1{margin:0 0 20px!important;font-size:160%!important;text-align:left!important}#wpacu_wrap_assets h3{margin:20px 0;font-size:130%}.wpacu_asset_row:first-child td{border-top:1px solid #cdcdcd}.wpacu_asset_row td{border-left:1px solid #cdcdcd;border-right:1px solid #cdcdcd;border-bottom:1px solid #cdcdcd}.wpacu_asset_row.wpacu_notice_row td{position:relative;padding:5px;border-bottom:1px solid transparent}.wpacu_asset_row.wpacu_notice_row td div.wpacu-warning{width:auto;margin:5px;font-style:italic}.wpacu_asset_row:not(.wpacu_notice_row) td{padding:18px!important;position:relative}.wpacu_asset_row:not(.wpacu_notice_row) td.selected,.wpacu_asset_row:not(.wpacu_notice_row) td:hover{-moz-box-shadow:inset 0 0 12px #cdcdcd;-webkit-box-shadow:inset 0 0 12px #cdcdcd;box-shadow:inset 0 0 12px #cdcdcd}.wpacu_asset_row:not(.wpacu_notice_row) td p{padding:0!important;margin-bottom:10px!important;word-wrap:break-word!important;-ms-word-break:break-all;word-break:break-word}.wpacu_asset_row:not(.wpacu_notice_row) td label{width:auto!important;margin:0!important;cursor:pointer!important;display:inline-block!important;font-size:100%!important;font-weight:400!important}.wpacu_asset_row:not(.wpacu_notice_row) td label span:not(.dashicons){font-size:100%!important}.wpacu_asset_row:not(.wpacu_notice_row) td.wpacu_check{width:50px!important}.asset-table-extra-info td{padding:5px!important}body.wp-admin .wpacu_asset_row td.wpacu_check{width:25px!important}.wpacu_asset_row .dashicons-warning{color:red!important}label.wpacu_add_global{cursor:pointer!important}label.wpacu_input_load_checked{font-weight:700;color:#d54e21}label.wpacu_global_unload_exception{font-weight:700!important}tr.wpacu_global_rule_row.selected{background:#e7e7e7}.nav-tab-wrapper{border-bottom:1px solid #ccc;width:95%}.nav-tab-wrapper.nav-assets-manager .nav-tab{font-size:13px;font-weight:500;padding:6px 10px}.nav-tab-wrapper.nav-assets-manager .nav-tab.for-pro{padding:6px 8px 6px 3px}ul.wpacu_asset_options{margin:0 10px 0 0;padding:0}ul.wpacu_asset_options li{margin:0 10px 0 0;list-style:none;display:inline-block;line-height:normal}ul.wpacu_asset_options li.remove_rule label{font-weight:700}ul.wpacu_asset_options label{margin-right:20px;font-weight:400}ul.wpacu_asset_options label input{margin-right:4px}.wpacu_list_table,.wpacu_list_table div,.wpacu_list_table li,.wpacu_list_table p{font-weight:400}.wpacu_striped>tbody>:nth-child(even),ul.wpacu_striped>:nth-child(even){background-color:#fff!important}.wpacu_striped>tbody>:nth-child(odd),ul.wpacu_striped>:nth-child(odd){background-color:#f9f9f9!important}.wpacu_update_btn{-moz-box-shadow:inset 0 1px 0 0 #54a3f7!important;-webkit-box-shadow:inset 0 1px 0 0 #54a3f7!important;box-shadow:inset 0 1px 0 0 #54a3f7!important;background:-webkit-gradient(linear,left top,left bottom,color-stop(.05,#007dc1),color-stop(1,#0061a7))!important;background:-moz-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:-webkit-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:-o-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:-ms-linear-gradient(top,#007dc1 5%,#0061a7 100%)!important;background:linear-gradient(to bottom,#007dc1 5%,#0061a7 100%)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7', GradientType=0)!important;background-color:#007dc1!important;-moz-border-radius:3px!important;-webkit-border-radius:3px!important;border-radius:3px!important;border:1px solid #124d77!important;display:inline-block!important;cursor:pointer!important;color:#fff!important;font-size:15px!important;padding:10px 24px!important;text-decoration:none!important;text-shadow:0 1px 0 #154682!important;height:auto!important;line-height:normal!important}.wpacu-btns .btn:focus,.wpacu-btns .btn:hover,.wpacu-btns a{text-decoration:none}.wpacu_update_btn.wpacu_submitting,.wpacu_update_btn:hover{background:-webkit-gradient(linear,left top,left bottom,color-stop(.05,#0061a7),color-stop(1,#007dc1))!important;background:-moz-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:-webkit-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:-o-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:-ms-linear-gradient(top,#0061a7 5%,#007dc1 100%)!important;background:linear-gradient(to bottom,#0061a7 5%,#007dc1 100%)!important;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0061a7', endColorstr='#007dc1', GradientType=0)!important;background-color:#0061a7!important}.wpacu_update_btn.wpacu_submitting{cursor:default!important}.wpacu_update_btn:active{position:relative!important;top:1px!important}.wpacu-btns .btn{display:inline-block;font-weight:400;line-height:1.25;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.5rem 1rem;font-size:1rem;-webkit-border-radius:.25rem;-moz-border-radius:.25rem;border-radius:.25rem;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.wpacu-btns .btn.focus,.wpacu-btns .btn:focus{outline:0;-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.25);box-shadow:0 0 0 2px rgba(2,117,216,.25)}.wpacu-btns .btn.disabled,.wpacu-btns .btn:disabled{cursor:not-allowed;opacity:.65}.wpacu-btns .btn.active,.wpacu-btns .btn:active{background-image:none}.wpacu-btns a.btn.disabled,.wpacu-btns fieldset[disabled] a.btn{pointer-events:none}.wpacu-btns .btn-primary{color:#fff;background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-primary:hover{color:#fff;background-color:#025aa5;border-color:#01549b}.wpacu-btns .btn-primary.focus,.wpacu-btns .btn-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.wpacu-btns .btn-primary.disabled,.wpacu-btns .btn-primary:disabled{background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-primary.active,.wpacu-btns .btn-primary:active,.wpacu-btns .show>.btn-primary.dropdown-toggle{color:#fff;background-color:#025aa5;background-image:none;border-color:#01549b}.wpacu-btns .btn-secondary{color:#292b2c;background-color:#fff;border-color:#ccc}.wpacu-btns .btn-secondary:hover{color:#292b2c;background-color:#e6e6e6;border-color:#adadad}.wpacu-btns .btn-secondary.focus,.wpacu-btns .btn-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.wpacu-btns .btn-secondary.disabled,.wpacu-btns .btn-secondary:disabled{background-color:#fff;border-color:#ccc}.wpacu-btns .btn-secondary.active,.wpacu-btns .btn-secondary:active,.wpacu-btns .show>.btn-secondary.dropdown-toggle{color:#292b2c;background-color:#e6e6e6;background-image:none;border-color:#adadad}.wpacu-btns .btn-info{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#2aabd2}.wpacu-btns .btn-info.focus,.wpacu-btns .btn-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.wpacu-btns .btn-info.disabled,.wpacu-btns .btn-info:disabled{background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-info.active,.wpacu-btns .btn-info:active,.wpacu-btns .show>.btn-info.dropdown-toggle{color:#fff;background-color:#31b0d5;background-image:none;border-color:#2aabd2}.wpacu-btns .btn-success{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-success:hover{color:#fff;background-color:#449d44;border-color:#419641}.wpacu-btns .btn-success.focus,.wpacu-btns .btn-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.wpacu-btns .btn-success.disabled,.wpacu-btns .btn-success:disabled{background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-success.active,.wpacu-btns .btn-success:active,.wpacu-btns .show>.btn-success.dropdown-toggle{color:#fff;background-color:#449d44;background-image:none;border-color:#419641}.wpacu-btns .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#eb9316}.wpacu-btns .btn-warning.focus,.wpacu-btns .btn-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.wpacu-btns .btn-warning.disabled,.wpacu-btns .btn-warning:disabled{background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-warning.active,.wpacu-btns .btn-warning:active,.wpacu-btns .show>.btn-warning.dropdown-toggle{color:#fff;background-color:#ec971f;background-image:none;border-color:#eb9316}.wpacu-btns .btn-danger{color:#fff;background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#c12e2a}.wpacu-btns .btn-danger.focus,.wpacu-btns .btn-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.wpacu-btns .btn-danger.disabled,.wpacu-btns .btn-danger:disabled{background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-danger.active,.wpacu-btns .btn-danger:active,.wpacu-btns .show>.btn-danger.dropdown-toggle{color:#fff;background-color:#c9302c;background-image:none;border-color:#c12e2a}.wpacu-btns .btn-outline-primary{color:#0275d8;background-image:none;background-color:transparent;border-color:#0275d8}.wpacu-btns .btn-outline-primary:hover{color:#fff;background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-outline-primary.focus,.wpacu-btns .btn-outline-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.wpacu-btns .btn-outline-primary.disabled,.wpacu-btns .btn-outline-primary:disabled{color:#0275d8;background-color:transparent}.wpacu-btns .btn-outline-primary.active,.wpacu-btns .btn-outline-primary:active,.wpacu-btns .show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#0275d8;border-color:#0275d8}.wpacu-btns .btn-outline-secondary{color:#ccc;background-image:none;background-color:transparent;border-color:#ccc}.wpacu-btns .btn-outline-secondary:hover{color:#fff;background-color:#ccc;border-color:#ccc}.wpacu-btns .btn-outline-secondary.focus,.wpacu-btns .btn-outline-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.wpacu-btns .btn-outline-secondary.disabled,.wpacu-btns .btn-outline-secondary:disabled{color:#ccc;background-color:transparent}.wpacu-btns .btn-outline-secondary.active,.wpacu-btns .btn-outline-secondary:active,.wpacu-btns .show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#ccc;border-color:#ccc}.wpacu-btns .btn-outline-info{color:#5bc0de;background-image:none;background-color:transparent;border-color:#5bc0de}.wpacu-btns .btn-outline-info:hover{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-outline-info.focus,.wpacu-btns .btn-outline-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.wpacu-btns .btn-outline-info.disabled,.wpacu-btns .btn-outline-info:disabled{color:#5bc0de;background-color:transparent}.wpacu-btns .btn-outline-info.active,.wpacu-btns .btn-outline-info:active,.wpacu-btns .show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.wpacu-btns .btn-outline-success{color:#5cb85c;background-image:none;background-color:transparent;border-color:#5cb85c}.wpacu-btns .btn-outline-success:hover{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-outline-success.focus,.wpacu-btns .btn-outline-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.wpacu-btns .btn-outline-success.disabled,.wpacu-btns .btn-outline-success:disabled{color:#5cb85c;background-color:transparent}.wpacu-btns .btn-outline-success.active,.wpacu-btns .btn-outline-success:active,.wpacu-btns .show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.wpacu-btns .btn-outline-warning{color:#f0ad4e;background-image:none;background-color:transparent;border-color:#f0ad4e}.wpacu-btns .btn-outline-warning:hover{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-outline-warning.focus,.wpacu-btns .btn-outline-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.wpacu-btns .btn-outline-warning.disabled,.wpacu-btns .btn-outline-warning:disabled{color:#f0ad4e;background-color:transparent}.wpacu-btns .btn-outline-warning.active,.wpacu-btns .btn-outline-warning:active,.wpacu-btns .show>.btn-outline-warning.dropdown-toggle{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.wpacu-btns .btn-outline-danger{color:#d9534f;background-image:none;background-color:transparent;border-color:#d9534f}.wpacu-btns .btn-outline-danger:hover{color:#fff;background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-outline-danger.focus,.wpacu-btns .btn-outline-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.wpacu-btns .btn-outline-danger.disabled,.wpacu-btns .btn-outline-danger:disabled{color:#d9534f;background-color:transparent}.wpacu-btns .btn-outline-danger.active,.wpacu-btns .btn-outline-danger:active,.wpacu-btns .show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#d9534f;border-color:#d9534f}.wpacu-btns .btn-link{font-weight:400;color:#0275d8;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.wpacu-btns .btn-link,.wpacu-btns .btn-link.active,.wpacu-btns .btn-link:active,.wpacu-btns .btn-link:disabled{background-color:transparent}.wpacu-btns .btn-link,.wpacu-btns .btn-link:active,.wpacu-btns .btn-link:focus,.wpacu-btns .btn-link:hover{border-color:transparent}.wpacu-btns .btn-link:focus,.wpacu-btns .btn-link:hover{color:#014c8c;text-decoration:underline;background-color:transparent}.wpacu-btns .btn-link:disabled{color:#636c72}.wpacu-btns .btn-link:disabled:focus,.wpacu-btns .btn-link:disabled:hover{text-decoration:none}.wpacu-btns .btn-group-lg>.btn,.wpacu-btns .btn-lg{padding:.75rem 1.5rem;font-size:1.25rem;-webkit-border-radius:.3rem;-moz-border-radius:.3rem;border-radius:.3rem}.wpacu-btns .btn-group-sm>.btn,.wpacu-btns .btn-sm{padding:.25rem .5rem;font-size:.875rem;-webkit-border-radius:.2rem;-moz-border-radius:.2rem;border-radius:.2rem}.wpacu-btns .btn-block{display:block;width:100%}.go-pro-button,.go-pro-link-no-style,.wordpress-core-file{display:inline-block;text-decoration:none}.wpacu-btns .btn-block+.btn-block{margin-top:.5rem}.wpacu-btns input[type=reset].btn-block,.wpacu-btns input[type=button].btn-block,.wpacu-btns input[type=submit].btn-block{width:100%}.wpacu-btns .fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.go-pro-button{background-color:#4CAF50;border:2px solid #4CAF50;color:#fff;padding:12px 18px;text-align:center;font-size:16px;margin:4px 2px;cursor:pointer;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-transition-duration:.4s;transition-duration:.4s}.go-pro-button:hover{background-color:#fff;color:#000;border:2px solid #4CAF50;text-decoration:none}.wpacu-restore-pos-btn{font-size:14px!important;line-height:normal!important;height:42px!important;padding:0 18px!important;margin-top:10px!important}body.wp-admin .wpacu_asset_row .go-pro-link-no-style .wpacu-tooltip{padding:8px 2px}body.wp-admin .go-pro-link-no-style .wpacu-tooltip{text-shadow:none;font-weight:400;font-size:12px;line-height:16px;padding:8px 11px}.go-pro-link-no-style{position:relative;color:inherit}.go-pro-link-no-style:not(.nav-tab){font-style:italic}.go-pro-link-no-style.no-transition .wpacu-tooltip{-webkit-transition:0s all ease;transition:0s all ease;-webkit-transition-delay:0s;transition-delay:0s}.go-pro-link-no-style>img{max-width:20px;max-height:20px}.go-pro-link-no-style .wpacu-tooltip{font-size:14px;line-height:18px;position:absolute;z-index:1;visibility:hidden;width:160px;background-color:#00a7a7;color:#fff;text-align:center;padding:8px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;bottom:100%;bottom:calc(100% + 15px);left:50%;margin-left:-65px;-webkit-transition:.1s all ease;transition:.1s all ease;-webkit-transition-delay:0s;transition-delay:0s}.go-pro-link-no-style .wpacu-tooltip:after{content:"";position:absolute;border-width:10px;border-style:solid;top:100%;left:50%;left:calc(50% - 10px);border-color:#00a7a7 transparent transparent}.go-pro-link-no-style .wpacu-tooltip.wpacu-on-pages-btn{cursor:pointer;margin-left:-77px;width:130px}.go-pro-link-no-style .wpacu-tooltip.wpacu-larger{width:240px}.go-pro-link-no-style:hover .wpacu-tooltip{visibility:visible}.wpacu_list_table tr:first-child .wordpress-core-file .wpacu-tooltip{bottom:-40px;left:120px;margin-left:-86px}.wpacu_list_table tr:first-child .wordpress-core-file .wpacu-tooltip:after{top:41px;left:-20px;border-color:transparent #c00 transparent transparent}.wordpress-core-file{position:relative;font-style:normal;color:inherit}.wordpress-core-file .wpacu-tooltip{font-size:14px;line-height:18px;position:absolute;z-index:1;visibility:hidden;width:160px;background-color:#c00;color:#fff;text-align:center;padding:6px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;bottom:100%;bottom:calc(100% + 15px);left:50%;margin-left:-86px;-webkit-transition:.1s all ease;transition:.1s all ease;-webkit-transition-delay:0s;transition-delay:0s}.wordpress-core-file .wpacu-tooltip:after{content:"";position:absolute;border-width:10px;border-style:solid;top:100%;left:50%;left:calc(50% - 10px);border-color:#c00 transparent transparent}.wordpress-core-file:hover .wpacu-tooltip{visibility:visible}.ajax-direct-call-error-area{background:#fff;padding:10px;border:1px solid #c00;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.ajax-direct-call-error-area td{padding:6px}.ajax-direct-call-error-area .note{margin-top:0;padding-top:0}.ajax-direct-call-error-area .error-code{color:#c00;font-weight:700}.ajax-wp-remote-post-call-error-area{background:#fff;padding:20px}.ajax-wp-remote-post-call-error-area .table-data{background:0 0;border:1px solid #c66;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.ajax-wp-remote-post-call-error-area .table-data td{padding:10px}.wrap-upgrade-info{background:#fff;padding:0 15px;border:1px solid #cdcdcd;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu-notice{margin:20px 20px 0 0!important}.wpacu-notice p{font-weight:600!important;font-style:italic}.wpacu-notice .dashicons{font-weight:inherit!important;color:#46b450!important;margin-right:4px;vertical-align:text-bottom;font-size:27px}.wpacu-notice-info{padding:12px 12px 12px 16px;background:#fff;border-left:4px solid #008f9c}.wpacu-notice-info p{margin-top:8px}.wpacu-notice-info p:first-child{margin-top:0}.wpacu-notice-info p:last-child{margin-bottom:0}.wpacu-warning{font-size:15px;padding:10px;background:#fffcec;border:1px solid #fdd5c9;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;margin:0 0 5px;width:100%}.pro-page-unlock-notice{-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;padding:10px;background:#f2faf2;border:1px solid #c0e8c0;width:auto;display:block}.wpacu-license-area .notice,.wpacu-settings-area .notice{margin-left:0;padding:10px!important;width:97%;box-sizing:border-box;font-weight:600;font-style:italic}#wpacu-dom-get-type-selections,.wpacu-radio-selections{float:none;clear:both;width:auto;display:inline-block;margin-bottom:0;margin-top:0}#wpacu-dom-get-type-selections.wpacu-vertical,.wpacu-radio-selections.wpacu-vertical{display:block;margin-top:15px;margin-bottom:18px}#wpacu-dom-get-type-selections.wpacu-vertical li,.wpacu-radio-selections.wpacu-vertical li{float:none;margin-bottom:12px}#wpacu-dom-get-type-selections.wpacu-vertical li:last-child,.wpacu-radio-selections.wpacu-vertical li:last-child{margin-bottom:0}#wpacu-dom-get-type-selections li,.wpacu-radio-selections li{margin-right:30px;float:left;margin-bottom:0}#wpacu-dom-get-type-selections li:first-child,.wpacu-radio-selections li:first-child{margin-right:15px}#wpacu-dom-get-type-selections li:last-child,.wpacu-radio-selections li:last-child{margin-right:0}.wpacu_combine_loaded_js_level_area{display:none;background:0 0;border-left:2px solid #008f9c;padding-top:8px;padding-bottom:8px;padding-right:10px;padding-left:10px;margin:20px 0 15px}.wpacu_combine_loaded_js_level_area.wpacu_active{display:block}#wpacu-dom-get-type-infos{margin-bottom:0}#wpacu-dom-get-type-infos li{margin-bottom:0;line-height:20px}.wpacu-wrap li,.wpacu-wrap p,.wpacu-wrap td{font-weight:400}.wpacu-wrap small{width:auto;float:none;display:inline}.wpacu-wrap.wpacu-settings-show-all .wpacu-settings-tab-content{display:block;width:100%}.wpacu-wrap.wpacu-settings-show-all .wpacu-settings-area-title{color:#004567;padding:16px 15px;background:#f8f8f8;border-left:5px solid #004567b0;border-top:1px solid #e7e7e7;border-right:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;font-size:1.45em;font-weight:500}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider.wpacu_round,.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch .wpacu_slider.wpacu_round{border-radius:29px}.wpacu-wrap.wpacu-settings-show-all #wpacu-update-button-area{margin:0}.wpacu-wrap.wpacu-settings-show-all #wpacu-update-button-area .button{padding:11px 28px;height:auto;font-size:18px}.wpacu-wrap.wpacu-settings-show-all #wpacu-updating-settings{margin-left:224px;top:25px}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch,.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch{width:auto;height:auto}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch input,.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch input{display:block}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch input[type=checkbox],.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch input[type=checkbox]{margin:0 0 3px}.wpacu-wrap.wpacu-switch-standard .asset-cleanup-pro_page_wpassetcleanup_settings .wpacu_switch .wpacu_slider,.wpacu-wrap.wpacu-switch-standard .asset-cleanup_page_wpassetcleanup_settings .wpacu_switch .wpacu_slider{display:none}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch{position:relative;display:inline-block;width:52px;height:29px}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input{display:none}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch:not(.wpacu_switch_standard) .wpacu_slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.2s;transition:.2s}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch:not(.wpacu_switch_standard) .wpacu_slider:before{position:absolute;content:'';height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;-webkit-transition:.2s;transition:.2s}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input:checked+.wpacu_slider{background-color:#52af00}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input:focus+.wpacu_slider{box-shadow:0 0 1px #52af00}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch input:checked+.wpacu_slider:before{-webkit-transform:translateX(22px);-ms-transform:translateX(22px);transform:translateX(22px)}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch .wpacu_slider.wpacu_round:before{border-radius:50%}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch.wpacu_disabled,.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch.wpacu_locked_for_pro{opacity:.3}.wpacu-wrap.wpacu-switch-enhanced .wpacu_switch.wpacu_disabled:before{content:"\f160";font-family:Dashicons,Arial,"Times New Roman","Bitstream Charter",Times,serif;position:absolute;font-size:23px;top:5px;right:2px;z-index:1000}.asset-cleanup-pro_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle,.asset-cleanup_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle{margin-top:4px;line-height:1.4}.asset-cleanup-pro_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle em,.asset-cleanup_page_wpassetcleanup_settings .setting_title p.wpacu_subtitle em{font-weight:200}.asset-cleanup-pro_page_wpassetcleanup_settings .setting_title p.wpacu_read_more,.asset-cleanup_page_wpassetcleanup_settings .setting_title p.wpacu_read_more{margin-top:-10px;font-style:italic;font-size:12px}.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_inline_code_status_choices,.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices,.asset-cleanup-pro_page_wpassetcleanup_settings .input_style_choices,.asset-cleanup_page_wpassetcleanup_settings .assets_list_inline_code_status_choices,.asset-cleanup_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices,.asset-cleanup_page_wpassetcleanup_settings .input_style_choices{list-style:none;margin:0}.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li,.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li,.asset-cleanup-pro_page_wpassetcleanup_settings .input_style_choices li,.asset-cleanup_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li,.asset-cleanup_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li,.asset-cleanup_page_wpassetcleanup_settings .input_style_choices li{float:left;margin-right:30px}.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li:last-child,.asset-cleanup-pro_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li:last-child,.asset-cleanup-pro_page_wpassetcleanup_settings .input_style_choices li:last-child,.asset-cleanup_page_wpassetcleanup_settings .assets_list_inline_code_status_choices li:last-child,.asset-cleanup_page_wpassetcleanup_settings .assets_list_layout_areas_status_choices li:last-child,.asset-cleanup_page_wpassetcleanup_settings .input_style_choices li:last-child{margin-right:0}#wpacu-assets-list-by-location-selected{background:0 0;border:1px solid #e7e7e7;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:8px;clear:both}.notice.notice-success+.wpacu-wrap.wpacu-settings-area{margin-top:20px}.wpacu-form-table th{vertical-align:top;text-align:left;padding:5px 20px 20px 0;width:200px;line-height:1.3;font-weight:600}.wpacu-form-table th label{color:#23282d;font-weight:600;font-size:14px;text-shadow:none;vertical-align:middle;cursor:pointer}.wpacu-form-table td{padding-bottom:25px}.wpacu-form-table td:last-child p:last-child{margin:0}.wpacu-form-table .wpacu-fancy-checkbox input[type=checkbox],.wpacu-form-table label input[type=checkbox]{height:19px;width:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.wpacu-form-table .wpacu-fancy-checkbox input[type=checkbox]:checked,.wpacu-form-table .wpacu-fancy-checkbox input[type=checkbox]:hover,.wpacu-form-table label input[type=checkbox]:checked,.wpacu-form-table label input[type=checkbox]:hover{border:1px solid green}.wpacu-form-table .wpacu-fancy-checkbox input[type=checkbox]:checked:before,.wpacu-form-table label input[type=checkbox]:checked:before{color:#52af00;font:400 24px/1 dashicons}#wpacu-settings-vertical-tab-wrap{display:table;width:100%}#wpacu-settings-vertical-tab-wrap .wpacu-tab-extra-text{margin:4px 0 0}#wpacu-settings-vertical-tab-wrap .wpacu-tab-extra-text small{font-weight:lighter}#wpacu-settings-vertical-tab-wrap .wpacu-tab-extra-text small span.wpacu-status-wrap{position:relative;padding-left:14px}#wpacu-settings-vertical-tab-wrap .wpacu-tab-extra-text small span.wpacu-status-wrap span.wpacu-circle-status{position:absolute;left:0;top:2px;height:10px;width:10px;border-radius:50%;display:inline-block;opacity:.75}#wpacu-settings-vertical-tab-wrap .wpacu-tab-extra-text small span.wpacu-status-wrap span.wpacu-circle-status.wpacu-on{background:#52af00}#wpacu-settings-vertical-tab-wrap .wpacu-tab-extra-text small span.wpacu-status-wrap span.wpacu-circle-status.wpacu-off{background:#ccc}#wpacu-settings-vertical-tab-wrap *{box-sizing:border-box}.wpacu-settings-tab{display:table-cell;width:20%;height:100%;vertical-align:top}.wpacu-settings-tab a{text-decoration:none;border-left:3px solid transparent;display:block;background-color:#f1f1f1;color:#004567;padding:17px 16px;width:100%;outline:0;text-align:left;cursor:pointer;font-size:14px;font-weight:600;border-bottom:1px solid #ccc}.wpacu-settings-tab a:first-child{border-top:1px solid transparent!important}.wpacu-settings-tab a:last-child{border-bottom:1px solid transparent!important}.wpacu-settings-tab a:hover{background-color:#fff;border-left:3px solid #004567;position:relative}.wpacu-settings-tab a.active{color:#004567;background-color:#fff;border-left:3px solid #004567;position:relative;border-bottom:1px solid #ccc}.wpacu-settings-tab a.active:after{content:'';position:absolute;height:100%;width:1px;top:0;right:-1px;background-color:#fff}.wpacu-settings-tab-content{background-color:#fff;display:none;padding:12px 18px;width:79%;border-left:none;height:100%;border-top-right-radius:10px;border-bottom-right-radius:10px}.wpacu-settings-tab-content h2{padding:0 0 15px;border-bottom:1px solid #e7e7e7}.wpacu-settings-tab-content.active{display:table-cell}#wpacu_minify_css_exceptions_area,#wpacu_minify_js_exceptions_area{margin:16px 0 0}#wpacu-update-button-area{position:relative;margin-left:20%}#wpacu-update-button-area.no-left-margin{margin-left:0}#wpacu-update-button-area p{margin-top:10px}#wpacu-update-button-area .button{padding:5px 18px;height:38px;font-size:15px}#wpacu-updating-settings{position:absolute;margin-left:183px;top:19px;display:none}#combine_loaded_js_info_area{position:relative}#combine_loaded_js_info_area.locked-for-pro:before{position:absolute;content:'';height:100%;width:100%;background:#fff;opacity:.5;z-index:10000}.google_fonts_load_types{clear:both;margin-bottom:4px}.google_fonts_load_types ul{clear:both;display:inline-block;margin:14px 0 0}.google_fonts_load_types ul li{float:left}body.wp-admin .wpacu-handle-notes{margin-top:10px!important}body.wp-admin .wpacu-handle-notes p{margin-top:0!important}body.wp-admin .wpacu-handle-notes p a{font-size:inherit}body.wp-admin .wpacu-handle-notes p a span.dashicons{font-size:19px;width:19px;height:19px;vertical-align:bottom;text-decoration:none}.wpacu-handle-notes{margin-top:12px!important;padding-top:5px;border-top:1px solid #e7e7e7}.wpacu-handle-notes .wpacu-handle-notes-field{display:none}.wpacu-handle-notes .wpacu-handle-notes-field>textarea{font-size:85%;padding:6px;width:320px;max-width:100%}.wpacu-handle-notes p{margin:10px 0 0!important}.wpacu-handle-notes p a.wpacu-add-handle-note{text-decoration:none;font-size:80%;display:inline-block;color:inherit}.wpacu-handle-notes p a.wpacu-add-handle-note span.dashicons{font-size:18px;width:18px;height:18px}.wrap_bulk_unload_options{width:auto;display:inline-flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.wrap_bulk_unload_options .wpacu_asset_options_wrap{flex-grow:1;margin:5px 10px 14px 0!important;padding:8px 10px 2px!important}.wrap_bulk_unload_options .wpacu_asset_options_wrap .wpacu_slider_text{position:relative!important;vertical-align:top;left:inherit!important;top:inherit!important}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch{position:relative;display:inline-block;min-width:52px;width:52px;height:29px;margin-right:5px!important}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input{display:none}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.15s;transition:.15s}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider:before{position:absolute;content:'';height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;-webkit-transition:.15s;transition:.15s}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input:checked+.wpacu_slider{background-color:#C00}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input:focus+.wpacu_slider{box-shadow:0 0 1px #C00}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch input:checked+.wpacu_slider:before{-webkit-transform:translateX(22px);-ms-transform:translateX(22px);transform:translateX(22px)}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_switch .wpacu_slider.wpacu_round:before{border-radius:50%}.wpacu-switch-enhanced .wpacu_asset_row .wpacu_slider_text{position:absolute;left:62px;top:3px}.editor-post-saved-state.is-wpacu-reloading{animation:edit-post__loading-fade-animation .5s infinite}body.wp-admin .wpacu_asset_row.wpacu-loading{position:relative}body.wp-admin .wpacu_asset_row.wpacu-loading .wpacu-ajax-loader{display:block!important}body.wp-admin .wpacu_asset_row .wpacu-ajax-loader{display:none;width:58px;height:58px;position:absolute;bottom:0;right:0;opacity:.75}.wpacu_asset_row input{width:auto;height:auto;min-height:16px}.wpacu_asset_row .tip{background:inherit;border-left:4px solid #e7e7e7;margin:5px 0;padding:7px;font-style:italic;font-size:small;line-height:1.4}.wpacu_asset_row td{width:100%;text-align:left}.wpacu_asset_row td p:last-child{margin-bottom:0!important}.wpacu_asset_row td .wpacu_asset_options_wrap{padding:8px 10px;margin:15px 0;background:#fff;border:1px solid #eee;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wpacu_asset_row td .wpacu_asset_options_wrap p:first-child{margin-top:0;margin-bottom:8px!important}.wpacu_asset_row p.wpacu_handle{margin-top:0}.wpacu_asset_row li.wpacu_unload_this_page{display:block!important;position:relative}.wpacu-clearfix:after,.wpacu-clearfix:before{display:table;content:''}.wpacu-contract-expand-area{width:100%;margin:20px 0 0}.wpacu-contract-expand-area .col-left{float:left}.wpacu-contract-expand-area .col-left h4{margin-bottom:0}.wpacu-contract-expand-area .col-right{float:right}.wpacu-clearfix:after{clear:both}.wpacu-wp-button{color:#555;border-color:#ccc;background:#f7f7f7;box-shadow:0 1px 0 #ccc;vertical-align:top}body.wp-admin .wpacu-wp-button{font-size:13px;line-height:26px;height:28px}.wpacu-wp-button.wpacu-wp-button-secondary{display:inline-block;text-decoration:none;height:auto;margin:0 5px 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-sizing:border-box}.wpacu-wp-button:hover{background:#fafafa;border-color:#999;color:#23282d}.distinguish-asset-list{list-style:none;margin-left:0;margin-bottom:5px;display:inline-block}.distinguish-asset-list li{float:left;margin-right:20px}.distinguish-asset-list li:last-child{margin-right:0}body[class*=asset-cleanup-pro] a.wpacu-plugin-contracted-wrap-link{padding:16px 6px 16px 41px!important}body[class*=asset-cleanup-pro] .wpacu-area-open .wpacu-plugin-toggle-all{font-size:12px!important;width:calc(100% - 26px)!important}body.wp-admin .wpacu-area-expanded .wpacu-plugin-toggle-all{top:5px}body.wp-admin .wpacu-area-expanded .wpacu-plugin-toggle-all ul li{font-size:12px!important}.wpacu-assets-collapsible-wrap{border:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-by-location{margin-bottom:15px}.wpacu-assets-collapsible-wrap.wpacu-wrap-all{margin-top:20px}.wpacu-assets-collapsible-wrap.wpacu-wrap-area{margin-top:10px}.wpacu-assets-collapsible-wrap.wpacu-by-location>a.wpacu-assets-collapsible{padding:15px 15px 15px 43px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu_list_table{border-width:0;margin:0;border-spacing:inherit;width:100%;box-shadow:3px 3px 2px #ddd;border-bottom-right-radius:5px;border-top-right-radius:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location span.wpacu-child-location-name{font-weight:600}.wpacu-assets-collapsible-wrap.wpacu-by-location span.wpacu-child-location-version{font-weight:200}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area[data-wpacu-plugin=oxygen] .icon-area{border-radius:50%}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all{display:inline-block;padding:0;font-size:13px;width:100%;width:calc(100% + 46px);min-width:250px;position:absolute;left:100%;left:calc(100% + 6px);margin:0;top:4px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all ul{display:inline-block;margin:0;list-style:none;padding-left:13px;padding-top:0}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all ul li{padding:0;margin:0;line-height:normal;font-size:14px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-location-child-area .wpacu-plugin-toggle-all ul li:first-child{font-style:italic;margin-bottom:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content>table:last-child{margin-bottom:20px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title{display:inline;position:relative;z-index:1}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title:after{content:'';position:absolute;width:100%;left:0;bottom:0;height:1px;background-color:#fdfdfd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-plugin-assets-wrap{padding:0 0 10px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-plugin-assets-wrap.wpacu-area-open .wpacu-plugin-toggle-all{display:inline-block;padding:7px 12px 16px;font-size:14px;width:100%;text-align:left;border-left:1px solid #cdcdcd;border-right:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-plugin-assets-wrap.wpacu-area-open.wpacu-plugin-assets-last{margin-bottom:18px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link{color:inherit;text-decoration:none;font-weight:inherit;font-style:inherit;font-size:105%;line-height:initial;height:auto;margin:14px 0 0;padding:13px 6px 14px 39px;position:relative;display:block}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link:after{position:absolute;font-size:18px;font-family:Dashicons;right:12px;top:14px;content:"\f132"}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-open:after{content:"\f460"}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-closed{border:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link:hover{border:1px solid #878787;background:#f9f9f9}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link:hover.wpacu-link-closed{box-shadow:3px 3px 2px #ddd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-open{border-top:1px solid #cdcdcd;border-left:1px solid #cdcdcd;border-right:1px solid #cdcdcd;border-bottom:none}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-link-closed.wpacu-last-wrap-link{margin-bottom:20px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .icon-plugin-default{top:10px;left:10px;width:30px;height:30px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .icon-plugin-default .icon-area{width:30px;height:30px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .icon-plugin-default .icon-area:before{font-size:22px;line-height:22px;top:4px;left:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .wpacu-area-title{position:relative;padding:17px 10px 16px 46px;z-index:1}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link .wpacu-area-title:after{content:'';position:absolute;width:100%;left:0;bottom:0;height:1px;background-color:#fdfdfd}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content a.wpacu-plugin-contracted-wrap-link.wpacu-area-last{margin-bottom:18px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-area-open{padding:0;max-height:100%}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content .wpacu-area-closed{padding:0;overflow:hidden;max-height:0}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-plugins .wpacu-assets-collapsible-content>table:last-child{margin-bottom:20px}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title{margin-top:0;margin-bottom:-1px;padding:14px 10px 16px 12px!important}.wpacu-assets-collapsible-wrap.wpacu-by-location.wpacu-themes .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title.wpacu-theme-has-icon{padding:18px 10px 16px 58px!important}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area{margin-top:22px;margin-bottom:-1px;font-size:110%;line-height:initial}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area.wpacu-location-child-area-first{margin-top:2px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area.wpacu-area-expanded .wpacu-area-title{display:inline-block;z-index:1;padding:17px 10px 16px 46px}.wpacu-assets-collapsible-wrap.wpacu-by-location .wpacu-assets-collapsible-content .wpacu-location-child-area .wpacu-area-title{display:inline;border-top-right-radius:8px;border-top-left-radius:8px;background-color:#f9f9f9;border-left:1px solid #cdcdcd;border-top:1px solid #cdcdcd;border-bottom:1px solid transparent;border-right:1px solid #cdcdcd;position:relative}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default{position:absolute;padding:0;top:10px;left:10px;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default:not(.has-icon){color:#b4b9be;background-color:#eee;box-shadow:inset 0 0 10px rgba(160,165,170,.15);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default:not(.has-icon) .icon-area:before{content:"\f106";font-family:Dashicons;position:absolute;font-size:28px;line-height:28px;top:5px;left:5px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-plugin-default .icon-area{position:relative;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-theme{position:absolute;padding:0;top:10px;left:10px;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-by-location .icon-theme .icon-area{position:relative;width:37px;height:37px}.wpacu-assets-collapsible-wrap.wpacu-wp_core{border:1px solid #c00}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content{padding:0}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table{width:100%;margin:0}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row td,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row td{border-left:hidden;border-right:hidden;border-bottom:1px solid #cdcdcd}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child{margin-bottom:0!important}.wpacu-assets-collapsible-wrap.wpacu-external .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child td:last-child,.wpacu-assets-collapsible-wrap.wpacu-wp_core .wpacu-assets-collapsible-content .wpacu_list_table .wpacu_asset_row:last-child td:last-child{border-bottom:hidden}a.wpacu-assets-collapsible{color:#000;font-size:20px;text-decoration:none;display:block;position:relative;background-color:#f1f3f8;cursor:pointer;padding:15px 15px 15px 36px;width:auto;border:none;text-align:left;outline:0}a.wpacu-assets-collapsible>span.dashicons{font-size:25px;line-height:normal;position:absolute;top:15px;top:calc(50% - 21px);left:22px;-webkit-transform:translate(-50%,50%);transform:translate(-50%,50%)}a.wpacu-assets-collapsible:hover{background-color:#f1f3f8;text-decoration:none}a.wpacu-assets-collapsible:after{position:absolute;font-size:22px;font-family:Dashicons;right:14px;top:16px}a.wpacu-assets-collapsible:not(.wpacu-assets-collapsible-active):after{content:"\f132"}a.wpacu-assets-collapsible.wpacu-assets-collapsible-active{background-color:#f1f3f8}a.wpacu-assets-collapsible.wpacu-assets-collapsible-active:after{content:"\f460"}.wpacu-assets-collapsible-content{padding:0 16px;max-height:0;overflow:hidden;background-color:#fbfbfb8c}.wpacu-assets-collapsible-content .wpacu-assets-note{margin:0;padding:15px 15px 10px}.wpacu-assets-collapsible-content>div:not(.wpacu-assets-table-list-wrap){padding:16px 0 0}.wpacu-assets-collapsible-content>div>p:first-child{margin-top:0}.wpacu-assets-collapsible-content.wpacu-open{max-height:100%}a.wpacu-assets-inline-code-collapsible{color:inherit;font-size:14px;text-decoration:none;display:inline-block;position:relative;cursor:pointer;width:auto;outline:0;background:#f1f3f8;border:1px solid #cdcdcd;padding:4px 21px 4px 8px;margin:0 0 0 6px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}a.wpacu-assets-inline-code-collapsible:hover{border:1px solid #5c5c5c}a.wpacu-assets-inline-code-collapsible:after{position:absolute;font-size:15px;font-family:Dashicons;right:-3px;top:-1px;width:14px;height:14px;-webkit-transform:translate(-50%,50%);transform:translate(-50%,50%)}a.wpacu-assets-inline-code-collapsible:not(.wpacu-assets-inline-code-collapsible-active):after{content:"\f132"}a.wpacu-assets-inline-code-collapsible.wpacu-assets-inline-code-collapsible-active:after{content:"\f460"}.wpacu-assets-inline-code-collapsible-content{font-size:80%;padding:0 8px;max-height:0;overflow:hidden;background-color:#fbfbfb8c}.wpacu-assets-inline-code-collapsible-content>div{padding:7px 8px 0}.wpacu-assets-inline-code-collapsible-content>div>p{line-height:normal!important}.wpacu-assets-inline-code-collapsible-content>div>p:first-child{margin-top:0}.wpacu-assets-inline-code-collapsible-content.wpacu-open{max-height:100%}.wpacu_asset_row p div.select{display:inline-block}.wpacu-wrap-choose-position{display:inline}.wpacu-wrap-choose-position>div{display:inline-block}.wpacu-wrap-choose-position select{width:auto;font-size:inherit;display:inline;margin-left:6px;margin-right:4px}.wpacu-wrap-choose-position>.select>.select{display:inline}.wpacu-wrap-choose-position>.select>.select select{padding-right:30px}.wpacu-wrap-choose-position>.select>.select:after{right:15px;top:-4px}.wpacu_table_wrap{margin:20px 0 0}.wpacu_table_wrap>table{border:1px solid #cdcdcd}.wpacu_table_wrap .table{width:100%;max-width:100%;margin-bottom:1rem;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu_table_wrap .table td,.wpacu_table_wrap .table th{padding:.75rem;vertical-align:top;border-top:1px solid #eceeef}.wpacu_table_wrap .table thead th{vertical-align:bottom;border-bottom:2px solid #eceeef}.wpacu_table_wrap .table tbody+tbody{border-top:2px solid #eceeef}.wpacu_table_wrap .table .table{background-color:#fff}.wpacu_table_wrap .table-sm td,.wpacu_table_wrap .table-sm th{padding:.3rem}.wpacu_table_wrap .table-bordered,.wpacu_table_wrap .table-bordered td,.wpacu_table_wrap .table-bordered th{border:1px solid #eceeef}.wpacu_table_wrap .table-bordered thead td,.wpacu_table_wrap .table-bordered thead th{border-bottom-width:2px}.wpacu_table_wrap .table-striped tbody tr:nth-of-type(even){background-color:#f9f9f9}.wpacu_table_wrap .table-striped tbody tr:nth-of-type(odd){background-color:#fff}.wpacu_table_wrap .table-active,.wpacu_table_wrap .table-active>td,.wpacu_table_wrap .table-active>th,.wpacu_table_wrap .table-hover .table-active:hover,.wpacu_table_wrap .table-hover .table-active:hover>td,.wpacu_table_wrap .table-hover .table-active:hover>th,.wpacu_table_wrap .table-hover tbody tr:hover{background-color:rgba(0,0,0,.075)}.wpacu_table_wrap .table-success,.wpacu_table_wrap .table-success>td,.wpacu_table_wrap .table-success>th{background-color:#dff0d8}.wpacu_table_wrap .table-hover .table-success:hover,.wpacu_table_wrap .table-hover .table-success:hover>td,.wpacu_table_wrap .table-hover .table-success:hover>th{background-color:#d0e9c6}.wpacu_table_wrap .table-info,.wpacu_table_wrap .table-info>td,.wpacu_table_wrap .table-info>th{background-color:#d9edf7}.wpacu_table_wrap .table-hover .table-info:hover,.wpacu_table_wrap .table-hover .table-info:hover>td,.wpacu_table_wrap .table-hover .table-info:hover>th{background-color:#c4e3f3}.wpacu_table_wrap .table-warning,.wpacu_table_wrap .table-warning>td,.wpacu_table_wrap .table-warning>th{background-color:#fcf8e3}.wpacu_table_wrap .table-hover .table-warning:hover,.wpacu_table_wrap .table-hover .table-warning:hover>td,.wpacu_table_wrap .table-hover .table-warning:hover>th{background-color:#faf2cc}.wpacu_table_wrap .table-danger,.wpacu_table_wrap .table-danger>td,.wpacu_table_wrap .table-danger>th{background-color:#f2dede}.wpacu_table_wrap .table-hover .table-danger:hover,.wpacu_table_wrap .table-hover .table-danger:hover>td,.wpacu_table_wrap .table-hover .table-danger:hover>th{background-color:#ebcccc}.wpacu_table_wrap .thead-inverse th{color:#fff;background-color:#292b2c}.wpacu_table_wrap .thead-default th{color:#464a4c;background-color:#eceeef}.wpacu_table_wrap .table-inverse{color:#fff;background-color:#292b2c}.wpacu_table_wrap .table-inverse td,.wpacu_table_wrap .table-inverse th,.wpacu_table_wrap .table-inverse thead th{border-color:#fff}.wpacu_table_wrap .table-inverse.table-bordered,.wpacu_table_wrap .table-responsive.table-bordered{border:0}.wpacu_table_wrap .table-responsive{display:block;width:100%;overflow-x:auto;-ms-overflow-style:-ms-autohiding-scrollbar}.wp-list-table .wpacu_remove_global_attr_row.wpacu_selected,.wp-list-table .wpacu_restore_position_row.wpacu_selected{background:#e7e7e7}ul.hire-reasons{margin-bottom:20px}ul.hire-reasons li{font-size:14px;line-height:22px;margin-bottom:12px}ul.hire-reasons li .dashicons{font-size:23px;line-height:23px}ul.hire-reasons li .dashicons.dashicons-yes{color:green}ol.getting-started li{font-size:14px;line-height:22px;margin-bottom:8px}.wpacu-get-help-wrap p{font-size:14px}.wpacu-get-help-wrap .help-content-wrap{margin:20px 0 25px;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-moz-flex;display:-webkit-flex;display:flex;width:100%}@media only screen and (min-width:768px){.wpacu-get-help-wrap .help-content-wrap{-webkit-box-align:start;-ms-flex-align:start;-ms-grid-row-align:flex-start;align-items:flex-start}}@media only screen and (max-width:767px){.wpacu-get-help-wrap .help-content-wrap{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}}.wpacu-get-help-wrap .help-content-wrap .help-content{padding:15px;background:#fff;border:1px solid #E0E0E0;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;box-shadow:2px 3px 8px 0 #231f2038;flex:1 1 50%;margin-bottom:10px}.wpacu-get-help-wrap .help-content-wrap .help-content .content-title{margin:5px 0 15px}.wpacu-get-help-wrap .help-content-wrap .help-content .cols-wrap{width:100%;margin:0 auto;display:table}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area{margin:5px 0 0;position:relative}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area.col-left{float:left;width:48%}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area.col-right{float:right;width:48%}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area.activate-plugin img{max-width:280px}.wpacu-get-help-wrap .help-content-wrap .help-content .wpacu-image-area img{width:99%;margin:8px 0;border:1px solid #cdcdcd;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu-get-help-wrap .help-content-wrap .help-content.upgrade-help{order:2}@media only screen and (min-width:768px){.wpacu-get-help-wrap .help-content-wrap .help-content{margin-right:24px}.wpacu-get-help-wrap .help-content-wrap .help-content.upgrade-help{margin-right:0}}.wpacu-get-help-wrap .help-content-wrap .help-content.tech-help{order:1}@media only screen and (max-width:767px){.wpacu-get-help-wrap .help-content-wrap .help-content.tech-help{margin-bottom:30px}}.wpacu-get-help-wrap .help-content-wrap .help-content ul{list-style:none;padding-left:0}.wpacu-get-help-wrap .help-content-wrap .help-content ul li{font-size:14px;line-height:22px;margin-bottom:15px}.wpacu-get-help-wrap .help-content-wrap .help-content p:last-child,.wpacu-get-help-wrap .help-content-wrap .help-content ul li:last-child{margin-bottom:0}#wpacu-license-data-remove-area{display:none;margin:10px 0 25px}#wpacu-license-data-remove-area.wpacu-visible{display:block}span#wpacu-license-data-removed-msg{display:block;padding-left:26px}#wpacu-warning-read{display:none;margin:10px 0}#wpacu-warning-read span.dashicons-warning{color:#c00}#wpacu-warning-read.wpacu-visible{display:block}#wpacu-reset-submit-area{margin:10px 0;clear:both}#wpacu-reset-submit-btn{margin:10px 0 0}.wpacu-tools-area{margin:10px 20px 0 2px}.wpacu-tools-area .wpacu-tools-container{background:#fff;padding:15px;border:1px solid #cdcdcd;width:96%}.wpacu-tools-area .wpacu-tools-container form>div:first-child{margin:0 0 10px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning{display:none;box-sizing:border-box;margin-top:10px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning p{margin:0 0 10px;line-height:22px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning p:only-child{margin:0}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning ul{font-size:13px;list-style-type:disc;padding-left:30px}.wpacu-tools-area .wpacu-tools-container form .wpacu-warning.wpacu-visible{display:block}.wpacu-tools-area .wpacu-export-import-area{padding:10px}.wpacu-tools-area .wpacu-export-import-area form>p:first-of-type{margin-top:0}.wpacu-tools-area .wpacu-export-import-area form>p:last-of-type{margin-bottom:0}.wpacu-tools-area .wpacu-export-import-area:hover{background:rgba(40,44,42,.05);box-shadow:inset 0 0 10px rgba(160,165,170,.15)}.wpacu-tools-area .wpacu-export-import-area+hr{display:block;height:1px;border:0;border-top:1px solid #cdcdcd;margin:10px 0;padding:0}#wpacu-import-form button.wpacu-importing img.wpacu-spinner{display:inline-block}#wpacu-import-form button img.wpacu-spinner{display:none;margin:0 0 0 5px;height:16px;width:16px;vertical-align:middle}.wpacu-about-wrap .wpacu-about-text img{width:auto;height:150px;position:absolute;top:20px;right:-20px}@media only screen and (max-width:767px){.wpacu-about-wrap h1{margin:20px}.wpacu-about-wrap .wpacu-about-text img{display:none}.wpacu-about-wrap .wpacu-about-text{margin:20px}}.wpacu-about-wrap .about-wrap-content .area-title{font-size:19px;line-height:19px;margin-bottom:0}.wpacu-about-wrap hr{margin:10px 0}.wpacu-lite-vs-pro-wrap ul{display:flex;top:0;z-index:10;padding-bottom:14px}.wpacu-lite-vs-pro-wrap li{list-style:none;flex:1}.wpacu-lite-vs-pro-wrap li:last-child{border-right:1px solid #DDD}.wpacu-lite-vs-pro-wrap button{width:100%;border:1px solid #DDD;border-right:0;border-top:0;padding:10px;background:#FFF;font-size:14px;font-weight:700;height:60px;color:#999}.wpacu-lite-vs-pro-wrap li.active button{background:#F5F5F5;color:#000}.wpacu-lite-vs-pro-wrap table{border-collapse:collapse;table-layout:fixed;width:100%}.wpacu-lite-vs-pro-wrap th{background:inherit}.wpacu-lite-vs-pro-wrap tr.first{background:inherit;font-size:18px}.wpacu-lite-vs-pro-wrap tr.first .bg-lite{border-top:4px solid #6d6e70;background:#fff;color:#6d6e70}.wpacu-lite-vs-pro-wrap tr.first .bg-pro{border-top:4px solid green;background:#fff;color:green}.wpacu-lite-vs-pro-wrap tr:not(.first){background:#fff}.wpacu-lite-vs-pro-wrap tr:not(:last-child):hover{background:#f8f8f8}.wpacu-lite-vs-pro-wrap td,.wpacu-lite-vs-pro-wrap th{height:53px;border:1px solid #DDD;padding:10px 16px;empty-cells:show;text-align:left}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap td,.wpacu-lite-vs-pro-wrap th{font-size:14px}}.wpacu-lite-vs-pro-wrap td+td,.wpacu-lite-vs-pro-wrap th+th{text-align:center;display:none}.wpacu-lite-vs-pro-wrap td.default{display:table-cell}.wpacu-lite-vs-pro-wrap .txt-l{font-size:28px;font-weight:700}.wpacu-lite-vs-pro-wrap .txt-top{position:relative;top:-9px;left:-2px}.wpacu-lite-vs-pro-wrap svg{width:18px;height:18px}.wpacu-lite-vs-pro-wrap svg path{fill:green}.wpacu-lite-vs-pro-wrap .tick{color:#2CA01C}.wpacu-lite-vs-pro-wrap .tick img{fill:#2CA01C}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap .txt-l{font-size:20px}.wpacu-lite-vs-pro-wrap .tick{font-size:15px}}.wpacu-lite-vs-pro-wrap .na{font-size:18px;opacity:.3;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.wpacu-lite-vs-pro-wrap .hide{border:0;background:0 0}.wpacu-lite-vs-pro-wrap td,.wpacu-lite-vs-pro-wrap th{display:table-cell!important;width:auto}.wpacu-lite-vs-pro-wrap td+td,.wpacu-lite-vs-pro-wrap th+th{width:130px}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap .na{font-size:15px}.wpacu-lite-vs-pro-wrap td+td,.wpacu-lite-vs-pro-wrap th+th{width:42px}}@media only screen and (min-width:768px){.wpacu-lite-vs-pro-wrap td .button{font-size:16px!important}}@media only screen and (max-width:767px){.wpacu-lite-vs-pro-wrap td .button{font-size:14px!important;padding:0 20px!important}.wpacu-lite-vs-pro-wrap td .button.button-primary{margin-top:6px;margin-bottom:14px}}@media only screen and (min-width:768px){.wpacu-lite-vs-pro-wrap{margin-bottom:40px;clear:both}}.wpacu-video-areas>div{padding:20px;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.wpacu-video-areas>div:nth-child(odd){background:#fff}.wpacu-video-areas>div:nth-child(even){background:inherit}@media only screen and (min-width:1200px){.wpacu-video-areas .wpacu-video-area-wrapper{margin:0 0 15px;display:flex}.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-col-right{padding:0 20px 0 25px}}@media only screen and (min-width:992px) and (max-width:1199px){.wpacu-video-areas .wpacu-video-area-wrapper{margin:0 0 40px}}.wpacu-video-areas .wpacu-video-area-wrapper ol{font-size:14px}.wpacu-video-areas .wpacu-video-area-wrapper ul{font-size:14px;list-style:disc;margin-left:22px}@media only screen and (min-width:1200px){.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-col-right p:first-child{margin-top:0}.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-col-right p:last-child{margin-bottom:0}}@media only screen and (max-width:1199px){.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-video-wrapper{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.wpacu-video-areas .wpacu-video-area-wrapper .wpacu-video-wrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}}#wpassetcleanup_asset_list.postbox h2{padding-left:52px!important;position:relative}#wpassetcleanup_asset_list.postbox h2:before{content:'';position:absolute;background-image:url(images/wpacu-logo-transparent-bg-v1.png);background-size:cover;top:6px;left:13px;width:33px;height:26px;opacity:.8;-webkit-filter:grayscale(100%);filter:grayscale(100%)}body.wp-admin .wpacu-modal{display:none;position:fixed;z-index:1000000;padding-top:15%;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}body.wp-admin .wpacu-modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:80%;max-width:600px;border-radius:10px}body.wp-admin .wpacu-close{color:#aaa;float:right;font-size:28px;font-weight:700}body.wp-admin .wpacu-close:focus,body.wp-admin .wpacu-close:hover{color:#000;text-decoration:none;cursor:pointer}.wpacu-bulk-changes-tabs{display:table;position:relative;overflow:hidden;margin:0;width:100%}.wpacu-bulk-changes-tabs li{border-top:1px solid rgba(40,44,42,.1);border-left:1px solid rgba(40,44,42,.1);border-bottom:1px solid rgba(40,44,42,.1);float:left;line-height:38px;padding:0;position:relative;margin-bottom:12px}.wpacu-bulk-changes-tabs li:last-child{border-right:1px solid rgba(40,44,42,.1)}.wpacu-bulk-changes-tabs a{position:relative;background:rgba(40,44,42,.05);color:#004567;font-size:14px;font-weight:500;display:block;letter-spacing:0;outline:0;padding:6px 20px;text-decoration:none;border-top:3px solid transparent}.wpacu-bulk-changes-tabs a:hover{background:#f1f1f1;border-top:3px solid transparent}.wpacu-bulk-changes-tabs .current a{background:#fff;border-top:3px solid #004567}.wpacu-bulk-changes-tabs .current a:hover{background:#fff}.wpacu-bulk-changes-tabs .current a:after,.wpacu-bulk-changes-tabs .current a:before{top:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.wpacu-bulk-changes-tabs .current a:after{border-color:rgba(136,183,213,0);border-top-color:#fff;border-width:12px;margin-left:-12px}.wpacu-bulk-changes-tabs .current a:before{border-color:rgba(194,225,245,0);border-top-color:rgba(40,44,42,.1);border-width:13px;margin-left:-13px}
|
classes/CleanUp.php
CHANGED
@@ -264,7 +264,7 @@ class CleanUp
|
|
264 |
$commentsWithinQuotes = array();
|
265 |
|
266 |
if (isset($matchesRegExpComments[1]) && count($matchesRegExpComments[1]) !== count($comments)) {
|
267 |
-
preg_match_all('#=(|\s+)(\'
|
268 |
|
269 |
if (isset($matchesCommentsWithinQuotes[0]) && ! empty($matchesCommentsWithinQuotes[0])) {
|
270 |
foreach ($matchesCommentsWithinQuotes[0] as $matchedDataOriginal) {
|
@@ -359,9 +359,8 @@ class CleanUp
|
|
359 |
}
|
360 |
|
361 |
$strContainsFormat = preg_quote($strContains, '/');
|
362 |
-
$regExpPattern = '#<link[^>]*stylesheet[^>]*'. $strContainsFormat. '.*(>)#Usmi';
|
363 |
|
364 |
-
preg_match_all($
|
365 |
|
366 |
if (isset($matchesSourcesFromTags[0][0])) {
|
367 |
$linkTag = $matchesSourcesFromTags[0][0];
|
@@ -388,9 +387,7 @@ class CleanUp
|
|
388 |
|
389 |
$strContainsFormat = preg_quote($strContains, '/');
|
390 |
|
391 |
-
|
392 |
-
|
393 |
-
preg_match_all($regExpPattern, $htmlSource, $matchesSourcesFromTags, PREG_SET_ORDER);
|
394 |
|
395 |
if (isset($matchesSourcesFromTags[0][0])) {
|
396 |
$htmlSource = str_replace($matchesSourcesFromTags[0][0].'</script>', '', $htmlSource);
|
@@ -489,6 +486,37 @@ class CleanUp
|
|
489 |
// W3 Total Cache: No Minify
|
490 |
add_filter('w3tc_minify_enable', '__return_false');
|
491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
// SG Optimizer Plugin
|
493 |
$sgOptimizerMapping = array(
|
494 |
'autoflush' => 'siteground_optimizer_autoflush_cache',
|
@@ -516,17 +544,6 @@ class CleanUp
|
|
516 |
foreach ($sgOptimizerMapping as $optionName) {
|
517 |
add_filter('pre_option_'.$optionName, '__return_false');
|
518 |
}
|
519 |
-
|
520 |
-
// Fallback in case SG Optimizer is triggered BEFORE Asset CleanUp and the filter above will not work
|
521 |
-
add_filter('sgo_css_combine_exclude', array($this, 'allCssHandles'));
|
522 |
-
add_filter('sgo_css_minify_exclude', array($this, 'allCssHandles'));
|
523 |
-
add_filter('sgo_js_minify_exclude', array($this, 'allJsHandles'));
|
524 |
-
add_filter('sgo_js_async_exclude', array($this, 'allJsHandles'));
|
525 |
-
|
526 |
-
add_filter('sgo_html_minify_exclude_params', static function ($excludeParams) {
|
527 |
-
$excludeParams[] = WPACU_LOAD_ASSETS_REQ_KEY;
|
528 |
-
return $excludeParams;
|
529 |
-
});
|
530 |
}
|
531 |
|
532 |
/**
|
264 |
$commentsWithinQuotes = array();
|
265 |
|
266 |
if (isset($matchesRegExpComments[1]) && count($matchesRegExpComments[1]) !== count($comments)) {
|
267 |
+
preg_match_all('#=(|\s+)([\'"])(|\s+)<!--(.*?)-->(|\s+)([\'"])#s', $htmlSource, $matchesCommentsWithinQuotes);
|
268 |
|
269 |
if (isset($matchesCommentsWithinQuotes[0]) && ! empty($matchesCommentsWithinQuotes[0])) {
|
270 |
foreach ($matchesCommentsWithinQuotes[0] as $matchedDataOriginal) {
|
359 |
}
|
360 |
|
361 |
$strContainsFormat = preg_quote($strContains, '/');
|
|
|
362 |
|
363 |
+
preg_match_all('#<link[^>]*stylesheet[^>]*'. $strContainsFormat. '.*(>)#Usmi', $htmlSource, $matchesSourcesFromTags, PREG_SET_ORDER);
|
364 |
|
365 |
if (isset($matchesSourcesFromTags[0][0])) {
|
366 |
$linkTag = $matchesSourcesFromTags[0][0];
|
387 |
|
388 |
$strContainsFormat = preg_quote($strContains, '/');
|
389 |
|
390 |
+
preg_match_all('#<script[^>]*src(|\s+)=(|\s+)[^>]*'. $strContainsFormat. '.*(>)#Usmi', $htmlSource, $matchesSourcesFromTags, PREG_SET_ORDER);
|
|
|
|
|
391 |
|
392 |
if (isset($matchesSourcesFromTags[0][0])) {
|
393 |
$htmlSource = str_replace($matchesSourcesFromTags[0][0].'</script>', '', $htmlSource);
|
486 |
// W3 Total Cache: No Minify
|
487 |
add_filter('w3tc_minify_enable', '__return_false');
|
488 |
|
489 |
+
// [SG Optimiser]
|
490 |
+
self::filterSGOptions();
|
491 |
+
|
492 |
+
// Do not strip query strings
|
493 |
+
add_filter('sgo_rqs_exclude', array('.css', '.js'));
|
494 |
+
|
495 |
+
// Emulate page builder param to view page with no SG Optimiser on request
|
496 |
+
// Extra params to be used in case 'SG Optimiser' is called before Asset CleanUp: 'fl_builder', 'vcv-action', 'et_fb', 'ct_builder', 'tve'
|
497 |
+
add_filter('sgo_pb_params', static function($pbParams) {
|
498 |
+
$pbParams[] = 'wpassetclean_load';
|
499 |
+
return $pbParams;
|
500 |
+
});
|
501 |
+
|
502 |
+
// Fallback in case SG Optimizer is triggered BEFORE Asset CleanUp and the filter above will not work
|
503 |
+
add_filter('sgo_css_combine_exclude', array($this, 'allCssHandles'));
|
504 |
+
add_filter('sgo_css_minify_exclude', array($this, 'allCssHandles'));
|
505 |
+
add_filter('sgo_js_minify_exclude', array($this, 'allJsHandles'));
|
506 |
+
add_filter('sgo_js_async_exclude', array($this, 'allJsHandles'));
|
507 |
+
|
508 |
+
add_filter('sgo_html_minify_exclude_params', static function ($excludeParams) {
|
509 |
+
$excludeParams[] = WPACU_LOAD_ASSETS_REQ_KEY;
|
510 |
+
return $excludeParams;
|
511 |
+
});
|
512 |
+
// [/SG Optimiser]
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
*
|
517 |
+
*/
|
518 |
+
public static function filterSGOptions()
|
519 |
+
{
|
520 |
// SG Optimizer Plugin
|
521 |
$sgOptimizerMapping = array(
|
522 |
'autoflush' => 'siteground_optimizer_autoflush_cache',
|
544 |
foreach ($sgOptimizerMapping as $optionName) {
|
545 |
add_filter('pre_option_'.$optionName, '__return_false');
|
546 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
}
|
548 |
|
549 |
/**
|
classes/Main.php
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
<?php
|
2 |
namespace WpAssetCleanUp;
|
3 |
|
4 |
-
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
|
5 |
-
use WpAssetCleanUp\OptimiseAssets\OptimizeCss;
|
6 |
-
use WpAssetCleanUp\OptimiseAssets\OptimizeJs;
|
7 |
-
|
8 |
/**
|
9 |
* Class Main
|
10 |
* @package WpAssetCleanUp
|
@@ -240,8 +236,8 @@ class Main
|
|
240 |
add_action( 'wp_print_footer_scripts', array( $this, 'filterStyles' ), 1 );
|
241 |
|
242 |
// Preloads
|
243 |
-
add_action('wp_head', function() {
|
244 |
-
if (
|
245 |
return;
|
246 |
}
|
247 |
|
@@ -619,13 +615,13 @@ class Main
|
|
619 |
wp_cache_set('wpacu_all_styles_handles', array_keys($this->wpAllStyles['registered']));
|
620 |
}
|
621 |
|
622 |
-
//
|
623 |
-
if (
|
624 |
return;
|
625 |
}
|
626 |
|
627 |
-
//
|
628 |
-
if ($
|
629 |
return;
|
630 |
}
|
631 |
|
1 |
<?php
|
2 |
namespace WpAssetCleanUp;
|
3 |
|
|
|
|
|
|
|
|
|
4 |
/**
|
5 |
* Class Main
|
6 |
* @package WpAssetCleanUp
|
236 |
add_action( 'wp_print_footer_scripts', array( $this, 'filterStyles' ), 1 );
|
237 |
|
238 |
// Preloads
|
239 |
+
add_action('wp_head', static function() {
|
240 |
+
if (Main::instance()->preventAssetsSettings()) {
|
241 |
return;
|
242 |
}
|
243 |
|
615 |
wp_cache_set('wpacu_all_styles_handles', array_keys($this->wpAllStyles['registered']));
|
616 |
}
|
617 |
|
618 |
+
// e.g. for test mode or AJAX calls (where all assets have to load)
|
619 |
+
if ($this->preventAssetsSettings()) {
|
620 |
return;
|
621 |
}
|
622 |
|
623 |
+
// Nothing to unload?
|
624 |
+
if (empty($list)) {
|
625 |
return;
|
626 |
}
|
627 |
|
classes/Misc.php
CHANGED
@@ -684,17 +684,6 @@ class Misc
|
|
684 |
return 0;
|
685 |
}
|
686 |
|
687 |
-
/**
|
688 |
-
* @param $string
|
689 |
-
*
|
690 |
-
* @return bool
|
691 |
-
*/
|
692 |
-
public static function isJsonValid($string)
|
693 |
-
{
|
694 |
-
@json_decode($string, ARRAY_A);
|
695 |
-
return JSON_ERROR_NONE === self::jsonLastError();
|
696 |
-
}
|
697 |
-
|
698 |
/**
|
699 |
* @param $requestMethod
|
700 |
* @param $key
|
@@ -749,10 +738,10 @@ class Misc
|
|
749 |
}
|
750 |
|
751 |
$pageOptionsJson = json_encode(array(
|
752 |
-
'no_css_minify'
|
753 |
-
'no_css_optimize'
|
754 |
-
'no_js_minify'
|
755 |
-
'no_js_optimize'
|
756 |
));
|
757 |
|
758 |
if (! add_post_meta($pageId, '_' . WPACU_PLUGIN_ID . '_page_options', $pageOptionsJson, true)) {
|
684 |
return 0;
|
685 |
}
|
686 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
687 |
/**
|
688 |
* @param $requestMethod
|
689 |
* @param $key
|
738 |
}
|
739 |
|
740 |
$pageOptionsJson = json_encode(array(
|
741 |
+
'no_css_minify' => 1,
|
742 |
+
'no_css_optimize' => 1,
|
743 |
+
'no_js_minify' => 1,
|
744 |
+
'no_js_optimize' => 1
|
745 |
));
|
746 |
|
747 |
if (! add_post_meta($pageId, '_' . WPACU_PLUGIN_ID . '_page_options', $pageOptionsJson, true)) {
|
classes/OptimiseAssets/CombineCss.php
CHANGED
@@ -23,14 +23,11 @@ class CombineCss
|
|
23 |
*/
|
24 |
public static function doCombine($htmlSource)
|
25 |
{
|
26 |
-
|
27 |
-
|
28 |
-
if (! $useDom) {
|
29 |
return $htmlSource;
|
30 |
}
|
31 |
|
32 |
-
if (
|
33 |
-
! self::proceedWithCssCombine() ) {
|
34 |
return $htmlSource;
|
35 |
}
|
36 |
|
@@ -55,33 +52,29 @@ class CombineCss
|
|
55 |
|
56 |
libxml_use_internal_errors(true);
|
57 |
|
58 |
-
$documentForCSS->loadHTML($htmlSource);
|
59 |
-
|
60 |
-
// [Start] Strip NOSCRIPT tags
|
61 |
-
$noScripts = $documentForCSS->getElementsByTagName('noscript');
|
62 |
-
|
63 |
-
while ($noScripts->length > 0) {
|
64 |
-
$noScriptItem = $noScripts->item(0);
|
65 |
-
$noScriptItem->parentNode->removeChild($noScriptItem);
|
66 |
-
}
|
67 |
-
// [End] Strip NOSCRIPT tags
|
68 |
-
|
69 |
$storageJsonContents = array();
|
70 |
|
71 |
foreach ( array( 'head', 'body' ) as $docLocationTag ) {
|
72 |
$combinedUriPaths = $localAssetsPaths = $linkHrefs = array();
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
$docLocationElements = $documentForCSS->getElementsByTagName( $docLocationTag )->item( 0 );
|
75 |
-
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
|
81 |
foreach ( $linkTags as $tagObject ) {
|
82 |
-
if ( ! $tagObject->hasAttributes() ) {
|
83 |
-
continue;
|
84 |
-
}
|
85 |
|
86 |
$linkAttributes = array();
|
87 |
|
@@ -89,24 +82,17 @@ class CombineCss
|
|
89 |
$linkAttributes[ $attrObj->nodeName ] = trim( $attrObj->nodeValue );
|
90 |
}
|
91 |
|
92 |
-
// The attribute's value was fetched for verification, thus the attribute is not relevant anymore
|
93 |
-
if (isset($linkAttributes['data-wpacu-link-href-before']) && $linkAttributes['data-wpacu-link-href-before']) {
|
94 |
-
$htmlSource = str_replace('<link data-wpacu-link-href-before="'.$linkAttributes['data-wpacu-link-href-before'].'" ', '<link ', $htmlSource);
|
95 |
-
}
|
96 |
-
|
97 |
// Only rel="stylesheet" (with no rel="preload" associated with it) gets prepared for combining as links with rel="preload" (if any) are never combined into a standard render-blocking CSS file
|
98 |
// rel="preload" is there for a reason to make sure the CSS code is made available earlier prior to the one from rel="stylesheet" which is render-blocking
|
99 |
if (isset($linkAttributes['rel'], $linkAttributes['href']) && $linkAttributes['href']) {
|
100 |
-
// Make sure that tag value is checked and it's matched against the value from the HTML source code
|
101 |
-
//$htmlSource .= $attrObj->nodeValue."\n";
|
102 |
$href = (string) $linkAttributes['href'];
|
103 |
|
104 |
// 1) Check if there is any rel="preload" connected to the rel="stylesheet"
|
105 |
// making sure the file is not added to the final CSS combined file
|
106 |
|
107 |
-
// 2) Only combine media "all"
|
108 |
-
// Do not combine media='only screen and (max-width: 768px)' etc.
|
109 |
-
if (
|
110 |
continue;
|
111 |
}
|
112 |
|
@@ -114,11 +100,12 @@ class CombineCss
|
|
114 |
continue;
|
115 |
}
|
116 |
|
117 |
-
|
|
|
118 |
continue;
|
119 |
}
|
120 |
|
121 |
-
if (self::skipCombine(
|
122 |
continue;
|
123 |
}
|
124 |
|
@@ -127,13 +114,13 @@ class CombineCss
|
|
127 |
continue;
|
128 |
}
|
129 |
|
130 |
-
$localAssetPath = OptimizeCommon::getLocalAssetPath(
|
131 |
|
132 |
// It will skip external stylesheets (from a different domain)
|
133 |
if ( $localAssetPath ) {
|
134 |
-
$combinedUriPaths[]
|
135 |
-
$localAssetsPaths[
|
136 |
-
$linkHrefs[]
|
137 |
}
|
138 |
}
|
139 |
}
|
@@ -201,11 +188,11 @@ HTML;
|
|
201 |
$firstLinkTag = OptimizeCss::getFirstLinkTag($storageJsonContentLocation['link_hrefs'][0], $htmlSource);
|
202 |
|
203 |
if ($firstLinkTag) {
|
204 |
-
$htmlSource = str_replace(
|
205 |
}
|
206 |
|
207 |
if ($htmlSource !== $htmlSourceBeforeAnyLinkTagReplacement) {
|
208 |
-
$htmlSource =
|
209 |
|
210 |
// There should be at least two replacements made
|
211 |
if ($htmlSource === 'do_not_combine') {
|
@@ -218,6 +205,62 @@ HTML;
|
|
218 |
return $htmlSource;
|
219 |
}
|
220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
/**
|
222 |
* @param $href
|
223 |
*
|
@@ -352,6 +395,11 @@ HTML;
|
|
352 |
*/
|
353 |
public static function proceedWithCssCombine()
|
354 |
{
|
|
|
|
|
|
|
|
|
|
|
355 |
// No CSS files are combined in the Dashboard
|
356 |
// Always in the front-end view
|
357 |
// Do not combine if there's a POST request as there could be assets loading conditionally
|
23 |
*/
|
24 |
public static function doCombine($htmlSource)
|
25 |
{
|
26 |
+
if (! (function_exists('libxml_use_internal_errors') && function_exists('libxml_clear_errors') && class_exists('DOMDocument'))) {
|
|
|
|
|
27 |
return $htmlSource;
|
28 |
}
|
29 |
|
30 |
+
if ( ! self::proceedWithCssCombine() ) {
|
|
|
31 |
return $htmlSource;
|
32 |
}
|
33 |
|
52 |
|
53 |
libxml_use_internal_errors(true);
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
$storageJsonContents = array();
|
56 |
|
57 |
foreach ( array( 'head', 'body' ) as $docLocationTag ) {
|
58 |
$combinedUriPaths = $localAssetsPaths = $linkHrefs = array();
|
59 |
|
60 |
+
if ($docLocationTag === 'body') {
|
61 |
+
// Remove HEAD tag if it has NOSCRIPT tags
|
62 |
+
$htmlSourceAlt = preg_replace('#<head(.*?)(<noscript(.*?)</noscript(\s+|)>.*?)</head(\s+|)>#is', '', $htmlSource);
|
63 |
+
} else {
|
64 |
+
// Remove all NOSCRIPT tags
|
65 |
+
$htmlSourceAlt = preg_replace('#<noscript(.*?)</noscript(\s+|)>#is', '', $htmlSource);
|
66 |
+
}
|
67 |
+
|
68 |
+
$documentForCSS->loadHTML($htmlSourceAlt);
|
69 |
+
|
70 |
$docLocationElements = $documentForCSS->getElementsByTagName( $docLocationTag )->item( 0 );
|
71 |
+
if ($docLocationElements === null) { continue; }
|
72 |
|
73 |
+
$linkTags = $docLocationElements->getElementsByTagName( 'link' );
|
74 |
+
if ($linkTags === null) { continue; }
|
|
|
75 |
|
76 |
foreach ( $linkTags as $tagObject ) {
|
77 |
+
if ( ! $tagObject->hasAttributes() ) { continue; }
|
|
|
|
|
78 |
|
79 |
$linkAttributes = array();
|
80 |
|
82 |
$linkAttributes[ $attrObj->nodeName ] = trim( $attrObj->nodeValue );
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
// Only rel="stylesheet" (with no rel="preload" associated with it) gets prepared for combining as links with rel="preload" (if any) are never combined into a standard render-blocking CSS file
|
86 |
// rel="preload" is there for a reason to make sure the CSS code is made available earlier prior to the one from rel="stylesheet" which is render-blocking
|
87 |
if (isset($linkAttributes['rel'], $linkAttributes['href']) && $linkAttributes['href']) {
|
|
|
|
|
88 |
$href = (string) $linkAttributes['href'];
|
89 |
|
90 |
// 1) Check if there is any rel="preload" connected to the rel="stylesheet"
|
91 |
// making sure the file is not added to the final CSS combined file
|
92 |
|
93 |
+
// 2) Only combine media "all" and the ones with no media
|
94 |
+
// Do not combine media='only screen and (max-width: 768px)', media='print' etc.
|
95 |
+
if ($linkAttributes['rel'] === 'preload') {
|
96 |
continue;
|
97 |
}
|
98 |
|
100 |
continue;
|
101 |
}
|
102 |
|
103 |
+
// If a "media" attribute is there, check it out, if it's different then "all", do not proceed
|
104 |
+
if (array_key_exists('media', $linkAttributes) && $linkAttributes['media'] && $linkAttributes['media'] !== 'all') {
|
105 |
continue;
|
106 |
}
|
107 |
|
108 |
+
if (self::skipCombine($linkAttributes['href'])) {
|
109 |
continue;
|
110 |
}
|
111 |
|
114 |
continue;
|
115 |
}
|
116 |
|
117 |
+
$localAssetPath = OptimizeCommon::getLocalAssetPath($href, 'css');
|
118 |
|
119 |
// It will skip external stylesheets (from a different domain)
|
120 |
if ( $localAssetPath ) {
|
121 |
+
$combinedUriPaths[] = OptimizeCommon::getHrefRelPath( $href );
|
122 |
+
$localAssetsPaths[$href] = $localAssetPath;
|
123 |
+
$linkHrefs[] = $href;
|
124 |
}
|
125 |
}
|
126 |
}
|
188 |
$firstLinkTag = OptimizeCss::getFirstLinkTag($storageJsonContentLocation['link_hrefs'][0], $htmlSource);
|
189 |
|
190 |
if ($firstLinkTag) {
|
191 |
+
$htmlSource = str_replace($firstLinkTag, $finalCssTag, $htmlSource);
|
192 |
}
|
193 |
|
194 |
if ($htmlSource !== $htmlSourceBeforeAnyLinkTagReplacement) {
|
195 |
+
$htmlSource = self::stripJustCombinedLinkTags($storageJsonContentLocation['link_hrefs'], $htmlSource); // Strip the combined files to avoid duplicate code
|
196 |
|
197 |
// There should be at least two replacements made
|
198 |
if ($htmlSource === 'do_not_combine') {
|
205 |
return $htmlSource;
|
206 |
}
|
207 |
|
208 |
+
/**
|
209 |
+
* @param $filesSources
|
210 |
+
* @param $htmlSource
|
211 |
+
*
|
212 |
+
* @return mixed
|
213 |
+
*/
|
214 |
+
public static function stripJustCombinedLinkTags($filesSources, $htmlSource)
|
215 |
+
{
|
216 |
+
preg_match_all('#<link[^>]*stylesheet[^>]*(>)#Usmi', $htmlSource, $matchesSourcesFromTags, PREG_SET_ORDER);
|
217 |
+
|
218 |
+
$linkTagsStripped = 0;
|
219 |
+
|
220 |
+
foreach ($matchesSourcesFromTags as $matchSourceFromTag) {
|
221 |
+
$matchedSourceFromTag = trim($matchSourceFromTag[0]);
|
222 |
+
|
223 |
+
$domTag = new \DOMDocument();
|
224 |
+
|
225 |
+
libxml_use_internal_errors(true);
|
226 |
+
$domTag->loadHTML($matchedSourceFromTag);
|
227 |
+
|
228 |
+
foreach ($domTag->getElementsByTagName('link') as $tagObject) {
|
229 |
+
if (! $tagObject->hasAttributes()) { continue; }
|
230 |
+
|
231 |
+
foreach ($tagObject->attributes as $tagAttrs) {
|
232 |
+
if ($tagAttrs->nodeName === 'href' && in_array($tagAttrs->nodeValue, $filesSources)) {
|
233 |
+
$htmlSourceBeforeLinkTagReplacement = $htmlSource;
|
234 |
+
|
235 |
+
$styleExtraAfter = false;
|
236 |
+
|
237 |
+
if ($styleExtraAfter) {
|
238 |
+
$htmlSource = str_replace($matchedSourceFromTag . $styleExtraAfter, '', $htmlSource);
|
239 |
+
} else {
|
240 |
+
$htmlSource = str_replace($matchedSourceFromTag, '', $htmlSource);
|
241 |
+
}
|
242 |
+
|
243 |
+
$htmlSource = str_replace($matchedSourceFromTag, '', $htmlSource);
|
244 |
+
|
245 |
+
if ($htmlSource !== $htmlSourceBeforeLinkTagReplacement) {
|
246 |
+
$linkTagsStripped++;
|
247 |
+
}
|
248 |
+
|
249 |
+
continue;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
libxml_clear_errors();
|
255 |
+
}
|
256 |
+
|
257 |
+
if ($linkTagsStripped < 1) {
|
258 |
+
return 'do_not_combine';
|
259 |
+
}
|
260 |
+
|
261 |
+
return $htmlSource;
|
262 |
+
}
|
263 |
+
|
264 |
/**
|
265 |
* @param $href
|
266 |
*
|
395 |
*/
|
396 |
public static function proceedWithCssCombine()
|
397 |
{
|
398 |
+
// Not on query string request (debugging purposes)
|
399 |
+
if (array_key_exists('wpacu_no_css_combine', $_GET)) {
|
400 |
+
return false;
|
401 |
+
}
|
402 |
+
|
403 |
// No CSS files are combined in the Dashboard
|
404 |
// Always in the front-end view
|
405 |
// Do not combine if there's a POST request as there could be assets loading conditionally
|
classes/OptimiseAssets/CombineJs.php
CHANGED
@@ -23,18 +23,18 @@ class CombineJs
|
|
23 |
*/
|
24 |
public static function doCombine($htmlSource)
|
25 |
{
|
26 |
-
if (
|
27 |
return $htmlSource;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
if (! $useDom) {
|
33 |
return $htmlSource;
|
34 |
}
|
35 |
|
36 |
$combineLevel = 2;
|
37 |
|
|
|
|
|
38 |
// Speed up processing by getting the already existing final CSS file URI
|
39 |
// This will avoid parsing the HTML DOM and determine the combined URI paths for all the CSS files
|
40 |
$finalCacheList = OptimizeCommon::getAssetCachedData(self::$jsonStorageFile, OptimizeJs::getRelPathJsCacheDir(), 'js');
|
@@ -51,256 +51,302 @@ class CombineJs
|
|
51 |
// Nothing in the database records or the retrieved cached file does not exist?
|
52 |
OptimizeCommon::clearAssetCachedData(self::$jsonStorageFile);
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
preg_match_all($regExpPattern, OptimizeCommon::cleanerHtmlSource($htmlSource), $matchesSourcesFromTags, PREG_SET_ORDER);
|
57 |
-
|
58 |
-
// No <script> tag found? Do not continue
|
59 |
-
if (empty($matchesSourcesFromTags)) {
|
60 |
-
return $htmlSource;
|
61 |
-
}
|
62 |
-
|
63 |
-
if ($combineLevel === 2) {
|
64 |
-
$matchesSourcesFromTags = OptimizeJs::clearInlineScriptTags($matchesSourcesFromTags);
|
65 |
-
}
|
66 |
|
67 |
-
|
68 |
-
return $htmlSource;
|
69 |
-
}
|
70 |
|
71 |
-
$combinableList =
|
72 |
|
73 |
-
$
|
74 |
-
$
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
$matchedSourceFromTag = trim( $matchSourceFromTag[0] );
|
89 |
|
90 |
-
$
|
|
|
91 |
|
92 |
-
$
|
93 |
-
|
94 |
-
foreach ($domTag->getElementsByTagName( 'script' ) as $tagObject) {
|
95 |
-
if (! $tagObject->hasAttributes()) {
|
96 |
-
continue;
|
97 |
-
}
|
98 |
|
99 |
$scriptAttributes = array();
|
100 |
|
101 |
foreach ( $tagObject->attributes as $attrObj ) {
|
102 |
-
$scriptAttributes[
|
103 |
}
|
104 |
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
-
//
|
109 |
-
|
110 |
-
|
111 |
-
$
|
112 |
-
$htmlSource = str_replace(array_keys($beforeAfterReps), array_values($beforeAfterReps), $htmlSource);
|
113 |
}
|
|
|
114 |
|
115 |
-
|
|
|
116 |
|
117 |
if (self::skipCombine($src)) {
|
118 |
$scriptNotCombinable = true;
|
119 |
}
|
120 |
|
121 |
-
// Do not add it to the combination list if it has "async"
|
122 |
-
if (
|
123 |
$scriptNotCombinable = true;
|
124 |
}
|
125 |
|
126 |
if (isset($scriptAttributes['data-wpacu-to-be-preloaded-basic']) && $scriptAttributes['data-wpacu-to-be-preloaded-basic']) {
|
127 |
-
$scriptNotCombinable =
|
128 |
}
|
129 |
|
130 |
// Was it optimized and has the URL updated? Check the Source URL
|
131 |
if (! $scriptNotCombinable && isset($scriptAttributes['data-wpacu-script-src-before']) && $scriptAttributes['data-wpacu-script-src-before'] && self::skipCombine($scriptAttributes['data-wpacu-script-src-before'])) {
|
132 |
$scriptNotCombinable = true;
|
133 |
}
|
134 |
-
}
|
135 |
-
|
136 |
-
}
|
137 |
|
138 |
-
|
139 |
-
|
|
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
'local' => $localAssetPath,
|
145 |
-
'html' => $matchedSourceFromTag
|
146 |
-
);
|
147 |
-
|
148 |
-
if ( strpos( $localAssetPath, '/wp-includes/js/jquery/jquery.js' ) !== false ) {
|
149 |
-
$loadsLocaljQuery = true;
|
150 |
-
$jQueryGroupIndex = $groupIndex;
|
151 |
-
|
152 |
-
$jQueryArrayGroupKeys = array_keys( $combinableList[ $groupIndex ] );
|
153 |
-
$jQueryScriptIndex = array_pop( $jQueryArrayGroupKeys );
|
154 |
-
|
155 |
-
$jQueryAndMigrateGroup ++;
|
156 |
-
} elseif ( strpos( $localAssetPath,
|
157 |
-
'/wp-includes/js/jquery/jquery-migrate.' ) !== false ) {
|
158 |
-
$loadsLocaljQueryMigrate = true;
|
159 |
-
$jQueryAndMigrateGroup ++;
|
160 |
}
|
161 |
}
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
$groupIndex ++;
|
168 |
-
$jQueryAndMigrateGroup = 0; // reset it to avoid having one file per group!
|
169 |
}
|
170 |
-
|
171 |
-
// Have we passed <head> and stumbled upon the first script tag from the <body>
|
172 |
-
// Then consider the group completed
|
173 |
-
if ($lastScriptSrcFromHead && ($src === $lastScriptSrcFromHead)) {
|
174 |
-
$groupIndex++;
|
175 |
-
$reachedBody = true;
|
176 |
-
}
|
177 |
-
} elseif (! $scriptPreloaded) {
|
178 |
-
$groupIndex ++;
|
179 |
-
}
|
180 |
-
|
181 |
-
if ($reachedBody) {
|
182 |
-
$bodyGroupIndexes[] = $groupIndex;
|
183 |
}
|
184 |
}
|
185 |
|
186 |
-
// Is the page loading local jQuery but not local jQuery Migrate?
|
187 |
-
// Keep jQuery as standalone file (not in the combinable list)
|
188 |
-
if ( $loadsLocaljQuery && ! $loadsLocaljQueryMigrate && isset($jQueryScriptIndex) ) {
|
189 |
-
unset($combinableList[$jQueryGroupIndex][$jQueryScriptIndex]);
|
190 |
-
}
|
191 |
-
|
192 |
// Could be pages such as maintenance mode with no external JavaScript files
|
193 |
if (empty($combinableList)) {
|
194 |
return $htmlSource;
|
195 |
}
|
196 |
|
197 |
-
$groupNo = 1;
|
198 |
-
|
199 |
$finalCacheList = array();
|
200 |
|
201 |
-
foreach ($combinableList as $
|
202 |
-
|
203 |
-
// Could be one extra file besides the jQuery & jQuery Migrate group or the only JS file called within the HEAD
|
204 |
-
if (count($groupFiles) < 2) {
|
205 |
-
continue;
|
206 |
-
}
|
207 |
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
-
|
211 |
-
$
|
212 |
-
$groupScriptSrcs[] = $src;
|
213 |
-
$combinedUriPaths[] = OptimizeCommon::getHrefRelPath( $src );
|
214 |
-
$localAssetsPaths[ $src ] = $groupFileData['local'];
|
215 |
-
$groupScriptTags[] = $groupFileData['html'];
|
216 |
-
}
|
217 |
|
218 |
-
|
219 |
-
|
|
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
226 |
|
227 |
-
|
228 |
-
|
|
|
|
|
|
|
229 |
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
}
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
}, $groupScriptSrcs );
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
'script_tags' => $groupScriptTagsFilter
|
249 |
-
);
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
-
|
|
|
256 |
}
|
257 |
|
258 |
OptimizeCommon::setAssetCachedData(self::$jsonStorageFile, OptimizeJs::getRelPathJsCacheDir(), json_encode($finalCacheList));
|
259 |
}
|
260 |
|
261 |
if (! empty($finalCacheList)) {
|
262 |
-
foreach ( $finalCacheList as $
|
263 |
-
$
|
|
|
264 |
|
265 |
-
|
266 |
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
|
271 |
-
|
272 |
|
273 |
-
|
274 |
|
275 |
-
|
276 |
-
<script {$deferAttr} id='wpacu-combined-js-group-{$groupNo}' type='text/javascript' src='{$finalTagUrl}'></script>
|
277 |
HTML;
|
278 |
-
|
279 |
|
280 |
-
|
281 |
-
$scriptTag = str_replace( '{site_url}', site_url(), $scriptTag );
|
282 |
|
283 |
-
|
|
|
284 |
$htmlSourceBeforeTagReplacement = $htmlSource;
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
|
|
|
|
289 |
}
|
290 |
|
291 |
-
|
292 |
-
|
|
|
|
|
293 |
}
|
294 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
-
//
|
297 |
-
|
298 |
-
|
299 |
-
$htmlSource = $htmlSourceBeforeGroupReplacement;
|
300 |
}
|
|
|
|
|
|
|
|
|
301 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
|
|
|
|
|
|
|
304 |
return $htmlSource;
|
305 |
}
|
306 |
|
@@ -367,7 +413,7 @@ HTML;
|
|
367 |
|
368 |
if ($skipIfFileExists || ! file_exists($localFinalJsFile)) {
|
369 |
// Change $assetsContents as paths to fonts and images that are relative (e.g. ../, ../../) have to be updated
|
370 |
-
$
|
371 |
|
372 |
foreach ($localAssetsPaths as $assetHref => $localAssetsPath) {
|
373 |
$posLastSlash = strrpos($assetHref, '/');
|
@@ -389,33 +435,29 @@ HTML;
|
|
389 |
);
|
390 |
}
|
391 |
|
392 |
-
$jsContent = FileSystem::file_get_contents($localAssetsPath)
|
393 |
-
|
394 |
-
if ($jsContent) {
|
395 |
// Does it have a source map? Strip it
|
396 |
if (strpos($jsContent, 'sourceMappingURL') !== false) {
|
397 |
$jsContent = OptimizeCommon::stripSourceMap($jsContent);
|
398 |
}
|
399 |
|
400 |
-
$
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
-
$
|
403 |
}
|
404 |
}
|
405 |
|
406 |
-
if (
|
407 |
-
$
|
408 |
-
|
409 |
-
|
410 |
-
$finalJsContents = $contentsOne . $contentsTwo;
|
411 |
|
412 |
-
|
413 |
-
|
414 |
-
$makeLocalDirForJs = @mkdir($localDirForJsFile);
|
415 |
-
|
416 |
-
if (! $makeLocalDirForJs) {
|
417 |
-
return array('uri_final_js_file' => '', 'local_final_js_file' => '');
|
418 |
-
}
|
419 |
}
|
420 |
}
|
421 |
|
23 |
*/
|
24 |
public static function doCombine($htmlSource)
|
25 |
{
|
26 |
+
if (! (function_exists('libxml_use_internal_errors') && function_exists('libxml_clear_errors') && class_exists('DOMDocument'))) {
|
27 |
return $htmlSource;
|
28 |
}
|
29 |
|
30 |
+
if ( ! self::proceedWithJsCombine() ) {
|
|
|
|
|
31 |
return $htmlSource;
|
32 |
}
|
33 |
|
34 |
$combineLevel = 2;
|
35 |
|
36 |
+
$isDeferAppliedOnBodyCombineGroupNo = 0;
|
37 |
+
|
38 |
// Speed up processing by getting the already existing final CSS file URI
|
39 |
// This will avoid parsing the HTML DOM and determine the combined URI paths for all the CSS files
|
40 |
$finalCacheList = OptimizeCommon::getAssetCachedData(self::$jsonStorageFile, OptimizeJs::getRelPathJsCacheDir(), 'js');
|
51 |
// Nothing in the database records or the retrieved cached file does not exist?
|
52 |
OptimizeCommon::clearAssetCachedData(self::$jsonStorageFile);
|
53 |
|
54 |
+
// Fetch the DOM
|
55 |
+
$documentForJS = new \DOMDocument();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
libxml_use_internal_errors(true);
|
|
|
|
|
58 |
|
59 |
+
$combinableList = array();
|
60 |
|
61 |
+
$jQueryMigrateInBody = false;
|
62 |
+
$jQueryLibInBodyCount = 0;
|
63 |
|
64 |
+
// Only keep combinable JS files
|
65 |
+
foreach ( array( 'head', 'body' ) as $docLocationScript ) {
|
66 |
+
if ($docLocationScript === 'body') {
|
67 |
+
// Remove HEAD tag if it has NOSCRIPT tags
|
68 |
+
$htmlSourceAlt = preg_replace('#<head(.*?)(<noscript(.*?)</noscript(\s+|)>.*?)</head(\s+|)>#is', '', $htmlSource);
|
69 |
+
} else {
|
70 |
+
// Remove all NOSCRIPT tags
|
71 |
+
$htmlSourceAlt = preg_replace('#<noscript(.*?)</noscript(\s+|)>#is', '', $htmlSource);
|
72 |
+
}
|
73 |
|
74 |
+
$documentForJS->loadHTML($htmlSourceAlt);
|
75 |
|
76 |
+
$groupIndex = 1;
|
77 |
|
78 |
+
$docLocationElements = $documentForJS->getElementsByTagName( $docLocationScript )->item( 0 );
|
79 |
+
if ($docLocationElements === null) { continue; }
|
|
|
80 |
|
81 |
+
$scriptTags = $docLocationElements->getElementsByTagName( 'script' );
|
82 |
+
if ($scriptTags === null) { continue; }
|
83 |
|
84 |
+
foreach ($scriptTags as $scriptTagIndex => $tagObject) {
|
85 |
+
if (! $tagObject->hasAttributes()) { continue; }
|
|
|
|
|
|
|
|
|
86 |
|
87 |
$scriptAttributes = array();
|
88 |
|
89 |
foreach ( $tagObject->attributes as $attrObj ) {
|
90 |
+
$scriptAttributes[$attrObj->nodeName] = trim($attrObj->nodeValue);
|
91 |
}
|
92 |
|
93 |
+
$scriptNotCombinable = false;
|
94 |
+
|
95 |
+
$hasSrc = isset($scriptAttributes['src']) && trim($scriptAttributes['src']);// No valid SRC attribute? It's not combinable (e.g. an inline tag)
|
96 |
+
$isPluginScript = isset($scriptAttributes['data-wpacu-plugin-script']); // Only of the user is logged-in (skip it as it belongs to the Asset CleanUp (Pro) plugin)
|
97 |
+
|
98 |
+
if (! $hasSrc || $isPluginScript) {
|
99 |
+
// Inline tag? Skip it in the BODY
|
100 |
+
if ($docLocationScript === 'body') {
|
101 |
+
continue;
|
102 |
+
}
|
103 |
|
104 |
+
// Because of jQuery, we will not have the list of all inline scripts and then the combined files as it is in BODY
|
105 |
+
// Once an inline SCRIPT is stumbled upon, a new combined group in the HEAD tag will be formed
|
106 |
+
if ($docLocationScript === 'head') {
|
107 |
+
$scriptNotCombinable = true;
|
|
|
108 |
}
|
109 |
+
}
|
110 |
|
111 |
+
if (! $scriptNotCombinable) { // Has SRC and $isPluginScript is set to false? Check the script
|
112 |
+
$src = (string)$scriptAttributes['src'];
|
113 |
|
114 |
if (self::skipCombine($src)) {
|
115 |
$scriptNotCombinable = true;
|
116 |
}
|
117 |
|
118 |
+
// Do not add it to the combination list if it has "async" attribute
|
119 |
+
if (isset($scriptAttributes['async'])) {
|
120 |
$scriptNotCombinable = true;
|
121 |
}
|
122 |
|
123 |
if (isset($scriptAttributes['data-wpacu-to-be-preloaded-basic']) && $scriptAttributes['data-wpacu-to-be-preloaded-basic']) {
|
124 |
+
$scriptNotCombinable = true;
|
125 |
}
|
126 |
|
127 |
// Was it optimized and has the URL updated? Check the Source URL
|
128 |
if (! $scriptNotCombinable && isset($scriptAttributes['data-wpacu-script-src-before']) && $scriptAttributes['data-wpacu-script-src-before'] && self::skipCombine($scriptAttributes['data-wpacu-script-src-before'])) {
|
129 |
$scriptNotCombinable = true;
|
130 |
}
|
|
|
|
|
|
|
131 |
|
132 |
+
// Does it have "defer" attribute, it's combinable (all checks were already done), loads in the BODY tag and "combine_loaded_js_defer_body" is ON? Keep it to the combination list
|
133 |
+
if (isset($scriptAttributes['defer'])) {
|
134 |
+
$isCombinableWithDefer = (! $scriptNotCombinable && $docLocationScript === 'body' && Main::instance()->settings['combine_loaded_js_defer_body']);
|
135 |
|
136 |
+
if (! $isCombinableWithDefer) { // Does it have "defer" and it's in the HEAD or before the first combinable script? Do not combine it
|
137 |
+
$scriptNotCombinable = true;
|
138 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
}
|
141 |
|
142 |
+
if ( ! $scriptNotCombinable ) {
|
143 |
+
// It also checks the domain name to make sure no external scripts would be added to the list
|
144 |
+
if ( $localAssetPath = OptimizeCommon::getLocalAssetPath( $src, 'js' ) ) {
|
145 |
+
$combinableList[$docLocationScript][ $groupIndex ][] = array(
|
146 |
+
'src' => $src,
|
147 |
+
'local' => $localAssetPath
|
148 |
+
);
|
149 |
+
|
150 |
+
if ($docLocationScript === 'body') {
|
151 |
+
if (strpos( $localAssetPath, '/wp-includes/js/jquery/jquery.js' ) !== false) {
|
152 |
+
$jQueryLibInBodyCount++;
|
153 |
+
}
|
154 |
+
|
155 |
+
if (strpos( $localAssetPath, '/wp-includes/js/jquery/jquery-migrate' ) !== false) {
|
156 |
+
$jQueryLibInBodyCount++;
|
157 |
+
$jQueryMigrateInBody = true;
|
158 |
+
}
|
159 |
+
|
160 |
+
if ($jQueryLibInBodyCount === 2) {
|
161 |
+
$jQueryLibInBodyCount = 0; // reset it
|
162 |
+
$groupIndex ++;
|
163 |
+
continue;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
} else {
|
168 |
$groupIndex ++;
|
|
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
// Could be pages such as maintenance mode with no external JavaScript files
|
174 |
if (empty($combinableList)) {
|
175 |
return $htmlSource;
|
176 |
}
|
177 |
|
|
|
|
|
178 |
$finalCacheList = array();
|
179 |
|
180 |
+
foreach ($combinableList as $docLocationScript => $combinableListIndexes) {
|
181 |
+
$groupNo = 1;
|
|
|
|
|
|
|
|
|
182 |
|
183 |
+
foreach ($combinableListIndexes as $groupIndex => $groupFiles) {
|
184 |
+
// Any groups having one file? Then it's not really a group and the file should load on its own
|
185 |
+
// Could be one extra file besides the jQuery & jQuery Migrate group or the only JS file called within the HEAD
|
186 |
+
if (count($groupFiles) < 2) {
|
187 |
+
continue;
|
188 |
+
}
|
189 |
|
190 |
+
$combinedUriPaths = $localAssetsPaths = $groupScriptSrcs = array();
|
191 |
+
$jQueryIsIncludedInGroup = false;
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
+
foreach ($groupFiles as $groupFileData) {
|
194 |
+
if (strpos( $groupFileData['local'], '/wp-includes/js/jquery/jquery.js' ) !== false) {
|
195 |
+
$jQueryIsIncludedInGroup = true;
|
196 |
|
197 |
+
// Is jQuery in the BODY without jQuery Migrate loaded?
|
198 |
+
// Isolate it as it needs to be the first to load in case there are inline scripts calling it before the combined group(s)
|
199 |
+
if ($docLocationScript === 'body' && ! $jQueryMigrateInBody) {
|
200 |
+
continue 2;
|
201 |
+
}
|
202 |
+
}
|
203 |
|
204 |
+
$src = $groupFileData['src'];
|
205 |
+
$groupScriptSrcs[] = $src;
|
206 |
+
$combinedUriPaths[] = OptimizeCommon::getHrefRelPath($src);
|
207 |
+
$localAssetsPaths[$src] = $groupFileData['local'];
|
208 |
+
}
|
209 |
|
210 |
+
$maybeDoJsCombine = self::maybeDoJsCombine(
|
211 |
+
sha1(implode('', $combinedUriPaths)) . '-' . $groupNo,
|
212 |
+
$localAssetsPaths,
|
213 |
+
$docLocationScript
|
214 |
+
);
|
215 |
|
216 |
+
// Local path to combined CSS file
|
217 |
+
$localFinalJsFile = $maybeDoJsCombine['local_final_js_file'];
|
|
|
218 |
|
219 |
+
// URI (e.g. /wp-content/cache/asset-cleanup/[file-name-here.js]) to the combined JS file
|
220 |
+
$uriToFinalJsFile = $maybeDoJsCombine['uri_final_js_file'];
|
|
|
221 |
|
222 |
+
if (! file_exists($localFinalJsFile)) {
|
223 |
+
return $htmlSource; // something is not right as the file wasn't created, we will return the original HTML source
|
224 |
+
}
|
225 |
|
226 |
+
$groupScriptSrcsFilter = array_map(static function($src) {
|
227 |
+
return str_replace(site_url(), '{site_url}', $src);
|
228 |
+
}, $groupScriptSrcs);
|
|
|
|
|
229 |
|
230 |
+
$finalCacheList[$docLocationScript][$groupNo] = array(
|
231 |
+
'uri_to_final_js_file' => $uriToFinalJsFile,
|
232 |
+
'script_srcs' => $groupScriptSrcsFilter
|
233 |
+
);
|
234 |
+
|
235 |
+
// Apply defer="defer" to combined JS files from the BODY tag (if enabled), except the combined jQuery & jQuery Migrate Group
|
236 |
+
if ($docLocationScript === 'body' && ! $jQueryIsIncludedInGroup && Main::instance()->settings['combine_loaded_js_defer_body']) {
|
237 |
+
if ($isDeferAppliedOnBodyCombineGroupNo === 0) {
|
238 |
+
// Only record the first one
|
239 |
+
$isDeferAppliedOnBodyCombineGroupNo = $groupNo;
|
240 |
+
}
|
241 |
+
$finalCacheList[$docLocationScript][$groupNo]['extra_attributes'][] = 'defer';
|
242 |
+
}
|
243 |
|
244 |
+
$groupNo ++;
|
245 |
+
}
|
246 |
}
|
247 |
|
248 |
OptimizeCommon::setAssetCachedData(self::$jsonStorageFile, OptimizeJs::getRelPathJsCacheDir(), json_encode($finalCacheList));
|
249 |
}
|
250 |
|
251 |
if (! empty($finalCacheList)) {
|
252 |
+
foreach ( $finalCacheList as $docLocationScript => $cachedGroupsList ) {
|
253 |
+
foreach ($cachedGroupsList as $groupNo => $cachedValues) {
|
254 |
+
$htmlSourceBeforeGroupReplacement = $htmlSource;
|
255 |
|
256 |
+
$uriToFinalJsFile = $cachedValues['uri_to_final_js_file'];
|
257 |
|
258 |
+
// Basic Combining (1) -> replace "first" tag with the final combination tag (there would be most likely multiple groups)
|
259 |
+
// Enhanced Combining (2) -> replace "last" tag with the final combination tag (most likely one group)
|
260 |
+
$indexReplacement = ($combineLevel === 2) ? (count($cachedValues['script_srcs']) - 1) : 0;
|
261 |
|
262 |
+
$finalTagUrl = OptimizeCommon::filterWpContentUrl() . OptimizeJs::getRelPathJsCacheDir() . $uriToFinalJsFile;
|
263 |
|
264 |
+
$deferAttr = (isset($cachedValues['extra_attributes']) && in_array('defer', $cachedValues['extra_attributes'])) ? 'defer="defer"' : '';
|
265 |
|
266 |
+
$finalJsTag = <<<HTML
|
267 |
+
<script {$deferAttr} id='wpacu-combined-js-{$docLocationScript}-group-{$groupNo}' type='text/javascript' src='{$finalTagUrl}'></script>
|
268 |
HTML;
|
269 |
+
$tagsStripped = 0;
|
270 |
|
271 |
+
$scriptTags = OptimizeJs::getScriptTagsFromSrcs($cachedValues['script_srcs'], $htmlSource);
|
|
|
272 |
|
273 |
+
foreach ($scriptTags as $groupScriptTagIndex => $scriptTag) {
|
274 |
+
$replaceWith = ($groupScriptTagIndex === $indexReplacement) ? $finalJsTag : '';
|
275 |
$htmlSourceBeforeTagReplacement = $htmlSource;
|
276 |
+
|
277 |
+
$htmlSource = OptimizeJs::strReplaceOnce($scriptTag, $replaceWith, $htmlSource);
|
278 |
+
|
279 |
+
if ($htmlSource !== $htmlSourceBeforeTagReplacement) {
|
280 |
+
$tagsStripped ++;
|
281 |
+
}
|
282 |
}
|
283 |
|
284 |
+
// At least two tags has have be stripped from the group to consider doing the group replacement
|
285 |
+
// If the tags weren't replaced it's likely there were changes to their structure after they were cached for the group merging
|
286 |
+
if ($tagsStripped < 2) {
|
287 |
+
$htmlSource = $htmlSourceBeforeGroupReplacement;
|
288 |
}
|
289 |
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
// Only relevant if "Defer loading JavaScript combined files from <body>"" in "Settings" - "Combine CSS & JS Files" - "Combine loaded JS (JavaScript) into fewer files"
|
294 |
+
// and there is at least one combined deferred tag
|
295 |
+
if ($isDeferAppliedOnBodyCombineGroupNo > 0) {
|
296 |
+
$strPart = "id='wpacu-combined-js-body-group-".$isDeferAppliedOnBodyCombineGroupNo."' type='text/javascript'";
|
297 |
+
list(,$htmlAfterFirstCombinedDeferScript) = explode($strPart, $htmlSource);
|
298 |
+
$htmlAfterFirstCombinedDeferScriptMaybeChanged = $htmlAfterFirstCombinedDeferScript;
|
299 |
+
|
300 |
+
$documentForPartBodyHtml = new \DOMDocument();
|
301 |
+
libxml_use_internal_errors(true);
|
302 |
+
|
303 |
+
$documentForPartBodyHtml->loadHTML($htmlSource);
|
304 |
+
|
305 |
+
$scriptTags = $documentForPartBodyHtml->getElementsByTagName( 'script' );
|
306 |
+
|
307 |
+
// No other SCRIPT tags found after the first (maybe last) deferred combined tag? Just return the HTML source
|
308 |
+
if ($scriptTags === null) {
|
309 |
+
libxml_clear_errors();
|
310 |
+
return $htmlSource;
|
311 |
+
}
|
312 |
+
|
313 |
+
foreach ($scriptTags as $scriptTagIndex => $tagObject) {
|
314 |
+
if (! $tagObject->hasAttributes()) {
|
315 |
+
continue;
|
316 |
+
}
|
317 |
+
|
318 |
+
$scriptAttributes = array();
|
319 |
+
|
320 |
+
foreach ($tagObject->attributes as $attrObj) {
|
321 |
+
$scriptAttributes[$attrObj->nodeName] = trim($attrObj->nodeValue);
|
322 |
+
}
|
323 |
|
324 |
+
// No "src" attribute? Skip it (most likely an inline script tag)
|
325 |
+
if (! (isset($scriptAttributes['src']) && $scriptAttributes['src'])) {
|
326 |
+
continue;
|
|
|
327 |
}
|
328 |
+
|
329 |
+
// Skip it as "defer" is already set
|
330 |
+
if (isset($scriptAttributes['defer'])) {
|
331 |
+
continue;
|
332 |
}
|
333 |
+
|
334 |
+
// Has "src" attribute and "defer" is not applied? Add it
|
335 |
+
$htmlAfterFirstCombinedDeferScriptMaybeChanged = trim(preg_replace(
|
336 |
+
'#src(\s+|)=(\s+|)(|"|\'|\s+)('.preg_quote($scriptAttributes['src'], '/').')(\3)#si',
|
337 |
+
'src=\3\4\3 defer=\'defer\'',
|
338 |
+
$htmlAfterFirstCombinedDeferScriptMaybeChanged
|
339 |
+
));
|
340 |
+
}
|
341 |
+
|
342 |
+
if ($htmlAfterFirstCombinedDeferScriptMaybeChanged && $htmlAfterFirstCombinedDeferScriptMaybeChanged !== $htmlAfterFirstCombinedDeferScript) {
|
343 |
+
$htmlSource = str_replace($htmlAfterFirstCombinedDeferScript, $htmlAfterFirstCombinedDeferScriptMaybeChanged, $htmlSource);
|
344 |
+
}
|
345 |
}
|
346 |
|
347 |
+
libxml_clear_errors();
|
348 |
+
|
349 |
+
// Finally, return the HTML source
|
350 |
return $htmlSource;
|
351 |
}
|
352 |
|
413 |
|
414 |
if ($skipIfFileExists || ! file_exists($localFinalJsFile)) {
|
415 |
// Change $assetsContents as paths to fonts and images that are relative (e.g. ../, ../../) have to be updated
|
416 |
+
$finalJsContents = '';
|
417 |
|
418 |
foreach ($localAssetsPaths as $assetHref => $localAssetsPath) {
|
419 |
$posLastSlash = strrpos($assetHref, '/');
|
435 |
);
|
436 |
}
|
437 |
|
438 |
+
if ($jsContent = trim(FileSystem::file_get_contents($localAssetsPath))) {
|
|
|
|
|
439 |
// Does it have a source map? Strip it
|
440 |
if (strpos($jsContent, 'sourceMappingURL') !== false) {
|
441 |
$jsContent = OptimizeCommon::stripSourceMap($jsContent);
|
442 |
}
|
443 |
|
444 |
+
if ($jsContent === '') {
|
445 |
+
continue;
|
446 |
+
}
|
447 |
+
|
448 |
+
$contentToAddToCombinedFile = '/*** Source: '.str_replace(ABSPATH, '/', $localAssetsPath)." ***/\n";
|
449 |
+
$contentToAddToCombinedFile .= OptimizeJs::maybeDoJsFixes($jsContent, $pathToAssetDir . '/') . "\n";
|
450 |
|
451 |
+
$finalJsContents .= $contentToAddToCombinedFile;
|
452 |
}
|
453 |
}
|
454 |
|
455 |
+
if ($finalJsContents !== '') {
|
456 |
+
if ($dirToUserCachedFile !== '' && isset($current_user->ID) && $current_user->ID > 0 && ! is_dir($localDirForJsFile)) {
|
457 |
+
$makeLocalDirForJs = @mkdir($localDirForJsFile);
|
|
|
|
|
458 |
|
459 |
+
if (! $makeLocalDirForJs) {
|
460 |
+
return array('uri_final_js_file' => '', 'local_final_js_file' => '');
|
|
|
|
|
|
|
|
|
|
|
461 |
}
|
462 |
}
|
463 |
|
classes/OptimiseAssets/FontsGoogle.php
CHANGED
@@ -25,13 +25,12 @@ class FontsGoogle
|
|
25 |
public function init()
|
26 |
{
|
27 |
add_filter('wp_resource_hints', array($this, 'resourceHints'), 10, 2);
|
28 |
-
|
29 |
add_action('wp_head', array($this, 'preloadFontFiles'), 1);
|
30 |
|
31 |
add_action('init', function() {
|
32 |
// don't apply any changes if not in the front-end view (e.g. Dashboard view)
|
33 |
// or test mode is enabled and a guest user is accessing the page
|
34 |
-
if (
|
35 |
return;
|
36 |
}
|
37 |
|
@@ -49,6 +48,12 @@ class FontsGoogle
|
|
49 |
*/
|
50 |
public function resourceHints($urls, $relationType)
|
51 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
if ('preconnect' === $relationType && Main::instance()->settings['google_fonts_preconnect']) {
|
53 |
$urls[] = array(
|
54 |
'href' => 'https://fonts.gstatic.com/',
|
@@ -64,34 +69,42 @@ class FontsGoogle
|
|
64 |
*/
|
65 |
public function preloadFontFiles()
|
66 |
{
|
67 |
-
if (
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
77 |
|
78 |
-
|
|
|
79 |
}
|
80 |
-
} else {
|
81 |
-
$preloadFontFilesArray[] = $preloadFontFiles;
|
82 |
-
}
|
83 |
|
84 |
-
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
|
87 |
|
88 |
-
|
89 |
-
foreach ($preloadFontFilesArray as $preloadFontFile) {
|
90 |
-
$preloadFontFilesOutput .= '<link rel="preload" as="font" href="'.esc_attr($preloadFontFile).'" data-wpacu-preload-font="1" crossorigin>'."\n";
|
91 |
-
}
|
92 |
|
93 |
-
|
|
|
|
|
94 |
}
|
|
|
|
|
95 |
}
|
96 |
|
97 |
/**
|
@@ -101,7 +114,7 @@ class FontsGoogle
|
|
101 |
{
|
102 |
// don't apply any changes if not in the front-end view (e.g. Dashboard view)
|
103 |
// or test mode is enabled and a guest user is accessing the page
|
104 |
-
if (
|
105 |
return;
|
106 |
}
|
107 |
|
@@ -119,9 +132,8 @@ class FontsGoogle
|
|
119 |
|
120 |
// Get all valid LINKs that have the $string within them
|
121 |
$strContainsFormat = preg_quote(self::$containsStr, '/');
|
122 |
-
$regExpPattern = '#<link[^>]*' . $strContainsFormat . '.*(>)#Usmi';
|
123 |
|
124 |
-
preg_match_all($
|
125 |
|
126 |
// Needs to match at least one to carry on with the replacements
|
127 |
if (isset($matchesFromLinkTags[0]) && ! empty($matchesFromLinkTags[0])) {
|
@@ -243,8 +255,7 @@ class FontsGoogle
|
|
243 |
return $htmlSource;
|
244 |
}
|
245 |
|
246 |
-
|
247 |
-
preg_match_all($regExpPattern, $htmlSource, $styleMatches, PREG_SET_ORDER);
|
248 |
|
249 |
if (empty($styleMatches)) {
|
250 |
return $htmlSource;
|
@@ -289,6 +300,8 @@ class FontsGoogle
|
|
289 |
|
290 |
if (! empty($matchesFromInlineCode)) {
|
291 |
foreach ($matchesFromInlineCode as $matchIndex => $matchesFromInlineCodeArray) {
|
|
|
|
|
292 |
if ($regExpIndex === 0) {
|
293 |
$googleApisUrl = trim($matchesFromInlineCodeArray[2], '"\' ');
|
294 |
} else {
|
@@ -302,7 +315,10 @@ class FontsGoogle
|
|
302 |
|
303 |
$newGoogleApisUrl = self::alterGoogleFontLink($googleApisUrl, false);
|
304 |
|
305 |
-
|
|
|
|
|
|
|
306 |
}
|
307 |
}
|
308 |
}
|
@@ -404,7 +420,7 @@ class FontsGoogle
|
|
404 |
|
405 |
// Any types? e.g. 400, 400italic, bold, etc.
|
406 |
if (isset($fontValues['types']) && is_array($fontValues['types']) && ! empty($fontValues['types'])) {
|
407 |
-
$finalCombinedParameters .= ':'.implode(',', $fontValues['types']);
|
408 |
}
|
409 |
|
410 |
$finalCombinedParameters .= '|';
|
@@ -415,27 +431,90 @@ class FontsGoogle
|
|
415 |
// Subsets
|
416 |
if (isset($fontsArray['subsets']) && ! empty($fontsArray['subsets'])) {
|
417 |
sort($fontsArray['subsets']);
|
418 |
-
$finalCombinedParameters .= '&subset='.implode(',', array_unique($fontsArray['subsets']));
|
419 |
}
|
420 |
|
421 |
// Effects
|
422 |
if (isset($fontsArray['effects']) && ! empty($fontsArray['effects'])) {
|
423 |
sort($fontsArray['effects']);
|
424 |
-
$finalCombinedParameters .= '&effect='.implode('|', array_unique($fontsArray['effects']));
|
425 |
}
|
426 |
|
427 |
if ($fontDisplay = Main::instance()->settings['google_fonts_display']) {
|
428 |
-
$finalCombinedParameters .= '&display='
|
429 |
}
|
430 |
|
431 |
$finalCombinedParameters = esc_attr($finalCombinedParameters);
|
432 |
|
|
|
433 |
$finalCombinedLink = <<<HTML
|
434 |
<link rel='stylesheet' id='wpacu-combined-google-fonts-css' href='https://fonts.googleapis.com/css?family={$finalCombinedParameters}' type='text/css' media='all' />
|
435 |
HTML;
|
436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
}
|
440 |
|
441 |
return $htmlSource;
|
25 |
public function init()
|
26 |
{
|
27 |
add_filter('wp_resource_hints', array($this, 'resourceHints'), 10, 2);
|
|
|
28 |
add_action('wp_head', array($this, 'preloadFontFiles'), 1);
|
29 |
|
30 |
add_action('init', function() {
|
31 |
// don't apply any changes if not in the front-end view (e.g. Dashboard view)
|
32 |
// or test mode is enabled and a guest user is accessing the page
|
33 |
+
if (Main::instance()->preventAssetsSettings()) {
|
34 |
return;
|
35 |
}
|
36 |
|
48 |
*/
|
49 |
public function resourceHints($urls, $relationType)
|
50 |
{
|
51 |
+
// don't apply any changes if not in the front-end view (e.g. Dashboard view)
|
52 |
+
// or test mode is enabled and a guest user is accessing the page
|
53 |
+
if (is_admin() || Main::instance()->preventAssetsSettings()) {
|
54 |
+
return $urls;
|
55 |
+
}
|
56 |
+
|
57 |
if ('preconnect' === $relationType && Main::instance()->settings['google_fonts_preconnect']) {
|
58 |
$urls[] = array(
|
59 |
'href' => 'https://fonts.gstatic.com/',
|
69 |
*/
|
70 |
public function preloadFontFiles()
|
71 |
{
|
72 |
+
// don't apply any changes if not in the front-end view (e.g. Dashboard view)
|
73 |
+
// or test mode is enabled and a guest user is accessing the page
|
74 |
+
if (Main::instance()->preventAssetsSettings()) {
|
75 |
+
return;
|
76 |
+
}
|
77 |
|
78 |
+
if (! $preloadFontFiles = trim(Main::instance()->settings['google_fonts_preload_files'])) {
|
79 |
+
return;
|
80 |
+
}
|
81 |
|
82 |
+
$preloadFontFilesArray = array();
|
83 |
+
|
84 |
+
if (strpos($preloadFontFiles, "\n") !== false) {
|
85 |
+
foreach (explode("\n", $preloadFontFiles) as $preloadFontFile) {
|
86 |
+
$preloadFontFile = trim($preloadFontFile);
|
87 |
|
88 |
+
if (! $preloadFontFile) {
|
89 |
+
continue;
|
90 |
}
|
|
|
|
|
|
|
91 |
|
92 |
+
$preloadFontFilesArray[] = $preloadFontFile;
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
$preloadFontFilesArray[] = $preloadFontFiles;
|
96 |
+
}
|
97 |
|
98 |
+
$preloadFontFilesArray = array_unique($preloadFontFilesArray);
|
99 |
|
100 |
+
$preloadFontFilesOutput = '';
|
|
|
|
|
|
|
101 |
|
102 |
+
// Finally, go through the list
|
103 |
+
foreach ($preloadFontFilesArray as $preloadFontFile) {
|
104 |
+
$preloadFontFilesOutput .= '<link rel="preload" as="font" href="'.esc_attr($preloadFontFile).'" data-wpacu-preload-font="1" crossorigin>'."\n";
|
105 |
}
|
106 |
+
|
107 |
+
echo apply_filters('wpacu_preload_google_font_files_output', $preloadFontFilesOutput);
|
108 |
}
|
109 |
|
110 |
/**
|
114 |
{
|
115 |
// don't apply any changes if not in the front-end view (e.g. Dashboard view)
|
116 |
// or test mode is enabled and a guest user is accessing the page
|
117 |
+
if (Main::instance()->preventAssetsSettings()) {
|
118 |
return;
|
119 |
}
|
120 |
|
132 |
|
133 |
// Get all valid LINKs that have the $string within them
|
134 |
$strContainsFormat = preg_quote(self::$containsStr, '/');
|
|
|
135 |
|
136 |
+
preg_match_all('#<link[^>]*' . $strContainsFormat . '.*(>)#Usmi', $altHtmlSource, $matchesFromLinkTags, PREG_SET_ORDER);
|
137 |
|
138 |
// Needs to match at least one to carry on with the replacements
|
139 |
if (isset($matchesFromLinkTags[0]) && ! empty($matchesFromLinkTags[0])) {
|
255 |
return $htmlSource;
|
256 |
}
|
257 |
|
258 |
+
preg_match_all('#<\s*?style\b[^>]*>(.*?)</style\b[^>]*>#s', $htmlSource, $styleMatches, PREG_SET_ORDER);
|
|
|
259 |
|
260 |
if (empty($styleMatches)) {
|
261 |
return $htmlSource;
|
300 |
|
301 |
if (! empty($matchesFromInlineCode)) {
|
302 |
foreach ($matchesFromInlineCode as $matchIndex => $matchesFromInlineCodeArray) {
|
303 |
+
$cssImportRule = $matchesFromInlineCodeArray[0];
|
304 |
+
|
305 |
if ($regExpIndex === 0) {
|
306 |
$googleApisUrl = trim($matchesFromInlineCodeArray[2], '"\' ');
|
307 |
} else {
|
315 |
|
316 |
$newGoogleApisUrl = self::alterGoogleFontLink($googleApisUrl, false);
|
317 |
|
318 |
+
if ($newGoogleApisUrl !== $googleApisUrl) {
|
319 |
+
$newCssImportRule = str_replace($googleApisUrl, $newGoogleApisUrl, $cssImportRule);
|
320 |
+
$newCssOutput = str_replace($cssImportRule, $newCssImportRule, $newCssOutput);
|
321 |
+
}
|
322 |
}
|
323 |
}
|
324 |
}
|
420 |
|
421 |
// Any types? e.g. 400, 400italic, bold, etc.
|
422 |
if (isset($fontValues['types']) && is_array($fontValues['types']) && ! empty($fontValues['types'])) {
|
423 |
+
$finalCombinedParameters .= ':' . implode(',', $fontValues['types']);
|
424 |
}
|
425 |
|
426 |
$finalCombinedParameters .= '|';
|
431 |
// Subsets
|
432 |
if (isset($fontsArray['subsets']) && ! empty($fontsArray['subsets'])) {
|
433 |
sort($fontsArray['subsets']);
|
434 |
+
$finalCombinedParameters .= '&subset=' . implode(',', array_unique($fontsArray['subsets']));
|
435 |
}
|
436 |
|
437 |
// Effects
|
438 |
if (isset($fontsArray['effects']) && ! empty($fontsArray['effects'])) {
|
439 |
sort($fontsArray['effects']);
|
440 |
+
$finalCombinedParameters .= '&effect=' . implode('|', array_unique($fontsArray['effects']));
|
441 |
}
|
442 |
|
443 |
if ($fontDisplay = Main::instance()->settings['google_fonts_display']) {
|
444 |
+
$finalCombinedParameters .= '&display=' . $fontDisplay;
|
445 |
}
|
446 |
|
447 |
$finalCombinedParameters = esc_attr($finalCombinedParameters);
|
448 |
|
449 |
+
// This is needed for both render-blocking and async (within NOSCRIPT tag as a fallback)
|
450 |
$finalCombinedLink = <<<HTML
|
451 |
<link rel='stylesheet' id='wpacu-combined-google-fonts-css' href='https://fonts.googleapis.com/css?family={$finalCombinedParameters}' type='text/css' media='all' />
|
452 |
HTML;
|
453 |
+
if (Main::instance()->settings['google_fonts_combine_type'] !== 'async') {
|
454 |
+
// Loading Type: Render-Blocking (Default)
|
455 |
+
$finalCombinedLink .= "\n";
|
456 |
+
$htmlSource = str_replace(self::COMBINED_LINK_DEL, apply_filters('wpacu_combined_google_fonts_link_tag', $finalCombinedLink), $htmlSource);
|
457 |
+
} else {
|
458 |
+
// Loading Type: Asynchronous via Web Font Loader (webfont.js)
|
459 |
+
$subSetsStr = '';
|
460 |
+
if (isset($fontsArray['subsets']) && ! empty($fontsArray['subsets'])) {
|
461 |
+
sort($fontsArray['subsets']);
|
462 |
+
$subSetsStr = implode(',', array_unique($fontsArray['subsets']));
|
463 |
+
}
|
464 |
+
|
465 |
+
$wfConfigGoogleFamilies = array();
|
466 |
+
|
467 |
+
// Families
|
468 |
+
$iCount = 0;
|
469 |
+
|
470 |
+
foreach ($fontsArray['families'] as $familyRaw => $fontValues) {
|
471 |
+
$wfConfigGoogleFamily = str_replace(' ', '+', $familyRaw);
|
472 |
+
|
473 |
+
// Any types? e.g. 400, 400italic, bold, etc.
|
474 |
+
$hasTypes = false;
|
475 |
+
if (isset($fontValues['types']) && is_array($fontValues['types']) && ! empty($fontValues['types'])) {
|
476 |
+
$wfConfigGoogleFamily .= ':' . implode(',', $fontValues['types']);
|
477 |
+
$hasTypes = true;
|
478 |
+
}
|
479 |
+
|
480 |
+
if ($subSetsStr) {
|
481 |
+
// No type and has a subset? Add the default "regular" one
|
482 |
+
if (! $hasTypes) {
|
483 |
+
$wfConfigGoogleFamily .= ':regular';
|
484 |
+
}
|
485 |
+
|
486 |
+
$wfConfigGoogleFamily .= ':' . $subSetsStr;
|
487 |
+
}
|
488 |
|
489 |
+
// Append extra parameters to the last family from the list
|
490 |
+
if ($iCount === count($fontsArray['families']) - 1) {
|
491 |
+
// Effects
|
492 |
+
if (isset($fontsArray['effects']) && ! empty($fontsArray['effects'])) {
|
493 |
+
sort($fontsArray['effects']);
|
494 |
+
$wfConfigGoogleFamily .= '&effect=' . implode('|', array_unique($fontsArray['effects']));
|
495 |
+
}
|
496 |
+
|
497 |
+
if ($fontDisplay = Main::instance()->settings['google_fonts_display']) {
|
498 |
+
$wfConfigGoogleFamily .= '&display=' . $fontDisplay;
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
$wfConfigGoogleFamilies[] = "'".$wfConfigGoogleFamily."'";
|
503 |
+
|
504 |
+
$iCount++;
|
505 |
+
}
|
506 |
+
|
507 |
+
$wfConfigGoogleFamiliesStr = '['.implode(',', $wfConfigGoogleFamilies).']';
|
508 |
+
|
509 |
+
$finalInlineTagWebFontConfig = '<script id=\'wpacu-google-fonts-async-load\' type=\'text/javascript\'>'."\n".'WebFontConfig={google:{families:'.$wfConfigGoogleFamiliesStr.'}};(function(wpacuD){var wpacuWf=wpacuD.createElement(\'script\'),wpacuS=wpacuD.scripts[0];wpacuWf.src=(\'https:\'===document.location.protocol?\'https\':\'http\')+\'://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js\';wpacuWf.async=!0;wpacuS.parentNode.insertBefore(wpacuWf,wpacuS)})(document);'."\n".'</script>';
|
510 |
+
$noScriptFallback = '<noscript>'.$finalCombinedLink.'</noscript>'. "\n";
|
511 |
+
|
512 |
+
$htmlSource = str_replace(
|
513 |
+
self::COMBINED_LINK_DEL,
|
514 |
+
apply_filters('wpacu_combined_google_fonts_inline_script_tag', $finalInlineTagWebFontConfig) . $noScriptFallback,
|
515 |
+
$htmlSource
|
516 |
+
);
|
517 |
+
}
|
518 |
}
|
519 |
|
520 |
return $htmlSource;
|
classes/OptimiseAssets/FontsLocal.php
CHANGED
@@ -22,33 +22,39 @@ class FontsLocal
|
|
22 |
*/
|
23 |
public function preloadFontFiles()
|
24 |
{
|
25 |
-
if (
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
foreach (explode("\n", $preloadFontFiles) as $preloadFontFile) {
|
30 |
-
$preloadFontFile = trim($preloadFontFile);
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
|
|
37 |
}
|
38 |
-
} else {
|
39 |
-
$preloadFontFilesArray[] = $preloadFontFiles;
|
40 |
-
}
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
foreach ($preloadFontFilesArray as $preloadFontFile) {
|
48 |
-
$preloadFontFilesOutput .= '<link rel="preload" as="font" href="'.esc_attr($preloadFontFile).'" data-wpacu-preload-font="1" crossorigin>'."\n";
|
49 |
-
}
|
50 |
|
51 |
-
|
|
|
|
|
52 |
}
|
|
|
|
|
53 |
}
|
54 |
}
|
22 |
*/
|
23 |
public function preloadFontFiles()
|
24 |
{
|
25 |
+
if (Main::instance()->preventAssetsSettings()) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
if (! $preloadFontFiles = trim(Main::instance()->settings['local_fonts_preload_files'])) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
|
33 |
+
$preloadFontFilesArray = array();
|
|
|
|
|
34 |
|
35 |
+
if (strpos($preloadFontFiles, "\n") !== false) {
|
36 |
+
foreach (explode("\n", $preloadFontFiles) as $preloadFontFile) {
|
37 |
+
$preloadFontFile = trim($preloadFontFile);
|
38 |
|
39 |
+
if (! $preloadFontFile) {
|
40 |
+
continue;
|
41 |
}
|
|
|
|
|
|
|
42 |
|
43 |
+
$preloadFontFilesArray[] = $preloadFontFile;
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
$preloadFontFilesArray[] = $preloadFontFiles;
|
47 |
+
}
|
48 |
|
49 |
+
$preloadFontFilesArray = array_unique($preloadFontFilesArray);
|
50 |
|
51 |
+
$preloadFontFilesOutput = '';
|
|
|
|
|
|
|
52 |
|
53 |
+
// Finally, go through the list
|
54 |
+
foreach ($preloadFontFilesArray as $preloadFontFile) {
|
55 |
+
$preloadFontFilesOutput .= '<link rel="preload" as="font" href="'.esc_attr($preloadFontFile).'" data-wpacu-preload-font="1" crossorigin>'."\n";
|
56 |
}
|
57 |
+
|
58 |
+
echo apply_filters('wpacu_preload_local_font_files_output', $preloadFontFilesOutput);
|
59 |
}
|
60 |
}
|
classes/OptimiseAssets/MinifyCss.php
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
<?php
|
2 |
namespace WpAssetCleanUp\OptimiseAssets;
|
3 |
|
|
|
4 |
use WpAssetCleanUp\Main;
|
5 |
use WpAssetCleanUp\Menu;
|
6 |
use WpAssetCleanUp\MetaBoxes;
|
|
|
7 |
|
8 |
/**
|
9 |
* Class MinifyCss
|
@@ -11,6 +13,14 @@ use WpAssetCleanUp\MetaBoxes;
|
|
11 |
*/
|
12 |
class MinifyCss
|
13 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* @param $cssContent
|
16 |
*
|
@@ -18,6 +28,11 @@ class MinifyCss
|
|
18 |
*/
|
19 |
public static function applyMinification($cssContent)
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
21 |
// Replace multiple whitespace with only one
|
22 |
$cssContent = preg_replace( '/\s+/', ' ', $cssContent );
|
23 |
|
@@ -42,6 +57,9 @@ class MinifyCss
|
|
42 |
// Converts #ff000 to #f00
|
43 |
$cssContent = preg_replace("/#([0-9a-fA-F])\\1([0-9a-fA-F])\\2([0-9a-fA-F])\\3/", '#$1$2$3', $cssContent);
|
44 |
|
|
|
|
|
|
|
45 |
$strReps = array(
|
46 |
// Converts things such as "margin:0 0 0 0;" to "margin:0;"
|
47 |
':0 0 0 0;' => ':0;'
|
@@ -115,6 +133,57 @@ class MinifyCss
|
|
115 |
return false;
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
/**
|
119 |
* @return bool
|
120 |
*/
|
1 |
<?php
|
2 |
namespace WpAssetCleanUp\OptimiseAssets;
|
3 |
|
4 |
+
use WpAssetCleanUp\CleanUp;
|
5 |
use WpAssetCleanUp\Main;
|
6 |
use WpAssetCleanUp\Menu;
|
7 |
use WpAssetCleanUp\MetaBoxes;
|
8 |
+
use MatthiasMullie\Minify;
|
9 |
|
10 |
/**
|
11 |
* Class MinifyCss
|
13 |
*/
|
14 |
class MinifyCss
|
15 |
{
|
16 |
+
/**
|
17 |
+
* 1: Basic
|
18 |
+
* 2: Minify via https://github.com/matthiasmullie/minify
|
19 |
+
*
|
20 |
+
* @var int
|
21 |
+
*/
|
22 |
+
public static $minType = 2;
|
23 |
+
|
24 |
/**
|
25 |
* @param $cssContent
|
26 |
*
|
28 |
*/
|
29 |
public static function applyMinification($cssContent)
|
30 |
{
|
31 |
+
if (self::$minType === 2) {
|
32 |
+
$minifier = new Minify\CSS($cssContent);
|
33 |
+
return trim($minifier->minify());
|
34 |
+
}
|
35 |
+
|
36 |
// Replace multiple whitespace with only one
|
37 |
$cssContent = preg_replace( '/\s+/', ' ', $cssContent );
|
38 |
|
57 |
// Converts #ff000 to #f00
|
58 |
$cssContent = preg_replace("/#([0-9a-fA-F])\\1([0-9a-fA-F])\\2([0-9a-fA-F])\\3/", '#$1$2$3', $cssContent);
|
59 |
|
60 |
+
// No empty @font-face
|
61 |
+
$cssContent = preg_replace('/@font-face(|\s+){(|\s+)}/i', '', $cssContent);
|
62 |
+
|
63 |
$strReps = array(
|
64 |
// Converts things such as "margin:0 0 0 0;" to "margin:0;"
|
65 |
':0 0 0 0;' => ':0;'
|
133 |
return false;
|
134 |
}
|
135 |
|
136 |
+
/**
|
137 |
+
* @param $htmlSource
|
138 |
+
*
|
139 |
+
* @return mixed|string
|
140 |
+
*/
|
141 |
+
public static function minifyInlineStyleTags($htmlSource)
|
142 |
+
{
|
143 |
+
if (stripos($htmlSource, '<style') === false) {
|
144 |
+
return $htmlSource; // no STYLE tags
|
145 |
+
}
|
146 |
+
|
147 |
+
$domTag = new \DOMDocument();
|
148 |
+
libxml_use_internal_errors(true);
|
149 |
+
$domTag->loadHTML($htmlSource);
|
150 |
+
|
151 |
+
$styleTagsObj = $domTag->getElementsByTagName( 'style' );
|
152 |
+
|
153 |
+
if ($styleTagsObj === null) {
|
154 |
+
return $htmlSource;
|
155 |
+
}
|
156 |
+
|
157 |
+
$skipTagsContaining = array(
|
158 |
+
'astra-theme-css-inline-css',
|
159 |
+
'astra-edd-inline-css',
|
160 |
+
'et-builder-module-design-cached-inline-styles',
|
161 |
+
'fusion-stylesheet-inline-css'
|
162 |
+
);
|
163 |
+
|
164 |
+
foreach ($styleTagsObj as $styleTagObj) {
|
165 |
+
$originalTag = CleanUp::getOuterHTML($styleTagObj);
|
166 |
+
|
167 |
+
// No need to use extra resources as the tag is already minified
|
168 |
+
if (preg_match('('.implode('|', $skipTagsContaining).')', $originalTag)) {
|
169 |
+
continue;
|
170 |
+
}
|
171 |
+
|
172 |
+
$originalTagContents = (isset($styleTagObj->nodeValue) && trim($styleTagObj->nodeValue) !== '') ? $styleTagObj->nodeValue : false;
|
173 |
+
|
174 |
+
if ($originalTagContents) {
|
175 |
+
$minifier = new Minify\CSS($originalTagContents);
|
176 |
+
$newTagContents = trim($minifier->minify());
|
177 |
+
|
178 |
+
$htmlSource = str_ireplace('>'.$originalTagContents.'</style', '>'.$newTagContents.'</style', $htmlSource);
|
179 |
+
|
180 |
+
libxml_clear_errors();
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
return $htmlSource;
|
185 |
+
}
|
186 |
+
|
187 |
/**
|
188 |
* @return bool
|
189 |
*/
|
classes/OptimiseAssets/MinifyJs.php
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
<?php
|
2 |
namespace WpAssetCleanUp\OptimiseAssets;
|
3 |
|
|
|
4 |
use WpAssetCleanUp\Main;
|
5 |
use WpAssetCleanUp\Menu;
|
6 |
use WpAssetCleanUp\MetaBoxes;
|
|
|
7 |
|
8 |
/**
|
9 |
* Class MinifyJs
|
@@ -11,6 +13,14 @@ use WpAssetCleanUp\MetaBoxes;
|
|
11 |
*/
|
12 |
class MinifyJs
|
13 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* @param $jsContent
|
16 |
*
|
@@ -18,6 +28,11 @@ class MinifyJs
|
|
18 |
*/
|
19 |
public static function applyMinification($jsContent)
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
21 |
$jsContent = preg_replace(array("/\s+\n/", "/\n\s+/", '/ +/'), array("\n", "\n ", ' '), $jsContent);
|
22 |
|
23 |
// Going line by line
|
@@ -238,6 +253,70 @@ class MinifyJs
|
|
238 |
return false;
|
239 |
}
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
/**
|
242 |
* @return bool
|
243 |
*/
|
1 |
<?php
|
2 |
namespace WpAssetCleanUp\OptimiseAssets;
|
3 |
|
4 |
+
use WpAssetCleanUp\CleanUp;
|
5 |
use WpAssetCleanUp\Main;
|
6 |
use WpAssetCleanUp\Menu;
|
7 |
use WpAssetCleanUp\MetaBoxes;
|
8 |
+
use MatthiasMullie\Minify;
|
9 |
|
10 |
/**
|
11 |
* Class MinifyJs
|
13 |
*/
|
14 |
class MinifyJs
|
15 |
{
|
16 |
+
/**
|
17 |
+
* 1: Basic
|
18 |
+
* 2: Minify via https://github.com/matthiasmullie/minify
|
19 |
+
*
|
20 |
+
* @var int
|
21 |
+
*/
|
22 |
+
public static $minType = 2;
|
23 |
+
|
24 |
/**
|
25 |
* @param $jsContent
|
26 |
*
|
28 |
*/
|
29 |
public static function applyMinification($jsContent)
|
30 |
{
|
31 |
+
if (self::$minType === 2) {
|
32 |
+
$minifier = new Minify\JS($jsContent);
|
33 |
+
return trim($minifier->minify());
|
34 |
+
}
|
35 |
+
|
36 |
$jsContent = preg_replace(array("/\s+\n/", "/\n\s+/", '/ +/'), array("\n", "\n ", ' '), $jsContent);
|
37 |
|
38 |
// Going line by line
|
253 |
return false;
|
254 |
}
|
255 |
|
256 |
+
/**
|
257 |
+
* @param $htmlSource
|
258 |
+
*
|
259 |
+
* @return mixed|string
|
260 |
+
*/
|
261 |
+
public static function minifyInlineScriptTags($htmlSource)
|
262 |
+
{
|
263 |
+
if (stripos($htmlSource, '<script') === false) {
|
264 |
+
return $htmlSource; // no SCRIPT tags, hmm
|
265 |
+
}
|
266 |
+
|
267 |
+
$domTag = new \DOMDocument();
|
268 |
+
libxml_use_internal_errors(true);
|
269 |
+
$domTag->loadHTML($htmlSource);
|
270 |
+
|
271 |
+
$scriptTagsObj = $domTag->getElementsByTagName( 'script' );
|
272 |
+
|
273 |
+
if ($scriptTagsObj === null) {
|
274 |
+
return $htmlSource;
|
275 |
+
}
|
276 |
+
|
277 |
+
$skipTagsContaining = array_map( static function ( $toMatch ) {
|
278 |
+
return preg_quote($toMatch, '/');
|
279 |
+
}, array(
|
280 |
+
'/* <![CDATA[ */', // added via wp_localize_script()
|
281 |
+
'window._wpemojiSettings', // Emoji
|
282 |
+
'wpacu-google-fonts-async-load',
|
283 |
+
'wpacu-preload-async-css-fallback',
|
284 |
+
'document.body.prepend(wpacuLinkTag',
|
285 |
+
'var wc_product_block_data = JSON.parse( decodeURIComponent('
|
286 |
+
));
|
287 |
+
|
288 |
+
foreach ($scriptTagsObj as $scriptTagObj) {
|
289 |
+
// Does it have the "src" attribute? Skip it as it's not an inline SCRIPT tag
|
290 |
+
if (isset($scriptTagObj->attributes) && $scriptTagObj->attributes !== null) {
|
291 |
+
foreach ($scriptTagObj->attributes as $attrObj) {
|
292 |
+
if ($attrObj->nodeName === 'src') {
|
293 |
+
continue 2;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
$originalTag = CleanUp::getOuterHTML($scriptTagObj);
|
299 |
+
|
300 |
+
// No need to use extra resources as the tag is already minified
|
301 |
+
if (preg_match('/('.implode('|', $skipTagsContaining).')/', $originalTag)) {
|
302 |
+
continue;
|
303 |
+
}
|
304 |
+
|
305 |
+
$originalTagContents = (isset($scriptTagObj->nodeValue) && trim($scriptTagObj->nodeValue) !== '') ? $scriptTagObj->nodeValue : false;
|
306 |
+
|
307 |
+
if ($originalTagContents) {
|
308 |
+
$minifier = new Minify\JS($originalTagContents);
|
309 |
+
$newTagContents = trim($minifier->minify());
|
310 |
+
|
311 |
+
$htmlSource = str_ireplace('>'.$originalTagContents.'</script', '>'.$newTagContents.'</script', $htmlSource);
|
312 |
+
|
313 |
+
libxml_clear_errors();
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
return $htmlSource;
|
318 |
+
}
|
319 |
+
|
320 |
/**
|
321 |
* @return bool
|
322 |
*/
|
classes/OptimiseAssets/OptimizeCommon.php
CHANGED
@@ -68,7 +68,7 @@ class OptimizeCommon
|
|
68 |
public static function cleanerHtmlSource($htmlSource)
|
69 |
{
|
70 |
// Removes HTML comments including MSIE conditional ones as they are left intact
|
71 |
-
// and not combined with other JavaScript files in case the method is called from
|
72 |
return preg_replace('/<!--(.|\s)*?-->/', '', $htmlSource);
|
73 |
}
|
74 |
|
@@ -101,66 +101,6 @@ class OptimizeCommon
|
|
101 |
return true;
|
102 |
}
|
103 |
|
104 |
-
/**
|
105 |
-
* @param $filesSources
|
106 |
-
* @param $htmlSource
|
107 |
-
* @param $assetType
|
108 |
-
*
|
109 |
-
* @return mixed
|
110 |
-
*/
|
111 |
-
public static function stripJustCombinedFileTags($filesSources, $htmlSource, $assetType = 'css')
|
112 |
-
{
|
113 |
-
if ($assetType === 'css') {
|
114 |
-
$tagName = 'link';
|
115 |
-
$sourceAttr = 'href';
|
116 |
-
$regExpPattern = '#<link[^>]*stylesheet[^>]*(>)#Usmi';
|
117 |
-
} else {
|
118 |
-
return $htmlSource;
|
119 |
-
}
|
120 |
-
|
121 |
-
preg_match_all($regExpPattern, $htmlSource, $matchesSourcesFromTags, PREG_SET_ORDER);
|
122 |
-
|
123 |
-
$linkTagsStripped = 0;
|
124 |
-
|
125 |
-
foreach ($matchesSourcesFromTags as $matchSourceFromTag) {
|
126 |
-
$matchedSourceFromTag = trim($matchSourceFromTag[0]);
|
127 |
-
|
128 |
-
$domTag = new \DOMDocument();
|
129 |
-
|
130 |
-
libxml_use_internal_errors(true);
|
131 |
-
$domTag->loadHTML($matchedSourceFromTag);
|
132 |
-
|
133 |
-
foreach ($domTag->getElementsByTagName($tagName) as $tagObject) {
|
134 |
-
if (! $tagObject->hasAttributes()) {
|
135 |
-
continue;
|
136 |
-
}
|
137 |
-
|
138 |
-
foreach ($tagObject->attributes as $tagAttrs) {
|
139 |
-
if ($tagAttrs->nodeName === $sourceAttr && in_array($tagAttrs->nodeValue, $filesSources)) {
|
140 |
-
$replaceWith = '';
|
141 |
-
|
142 |
-
$htmlSourceBeforeLinkTagReplacement = $htmlSource;
|
143 |
-
$htmlSource = str_replace($matchedSourceFromTag, $replaceWith, $htmlSource);
|
144 |
-
|
145 |
-
if ($htmlSource !== $htmlSourceBeforeLinkTagReplacement) {
|
146 |
-
$linkTagsStripped++;
|
147 |
-
}
|
148 |
-
|
149 |
-
continue;
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
libxml_clear_errors();
|
155 |
-
}
|
156 |
-
|
157 |
-
if ($linkTagsStripped < 1) {
|
158 |
-
return 'do_not_combine';
|
159 |
-
}
|
160 |
-
|
161 |
-
return $htmlSource;
|
162 |
-
}
|
163 |
-
|
164 |
/**
|
165 |
* @param $href
|
166 |
* @param $assetType
|
68 |
public static function cleanerHtmlSource($htmlSource)
|
69 |
{
|
70 |
// Removes HTML comments including MSIE conditional ones as they are left intact
|
71 |
+
// and not combined with other JavaScript files in case the method is called from CombineJs.php
|
72 |
return preg_replace('/<!--(.|\s)*?-->/', '', $htmlSource);
|
73 |
}
|
74 |
|
101 |
return true;
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
/**
|
105 |
* @param $href
|
106 |
* @param $assetType
|
classes/OptimiseAssets/OptimizeCss.php
CHANGED
@@ -20,6 +20,11 @@ class OptimizeCss
|
|
20 |
*/
|
21 |
public static $cachedCssAssetsFileExpiresIn = 28800; // 8 hours in seconds (60 * 60 * 8)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
*
|
25 |
*/
|
@@ -42,6 +47,8 @@ class OptimizeCss
|
|
42 |
return;
|
43 |
}
|
44 |
|
|
|
|
|
45 |
$cssOptimizeList = array();
|
46 |
|
47 |
// [Start] Collect for caching
|
@@ -49,14 +56,16 @@ class OptimizeCss
|
|
49 |
$wpStylesRegistered = $wp_styles->registered;
|
50 |
|
51 |
foreach ($wpStylesDone as $handle) {
|
52 |
-
if (isset($wpStylesRegistered[$handle])) {
|
53 |
-
|
|
|
54 |
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
}
|
61 |
}
|
62 |
|
@@ -85,12 +94,14 @@ class OptimizeCss
|
|
85 |
|
86 |
$doFileMinify = true;
|
87 |
|
88 |
-
if (!
|
89 |
$doFileMinify = false;
|
90 |
-
} elseif(MinifyCss::skipMinify($src, $value->handle)) {
|
91 |
$doFileMinify = false;
|
92 |
}
|
93 |
|
|
|
|
|
94 |
$handleDbStr = md5($value->handle);
|
95 |
|
96 |
$transientName = 'wpacu_css_optimize_'.$handleDbStr;
|
@@ -100,7 +111,7 @@ class OptimizeCss
|
|
100 |
if ( $savedValues ) {
|
101 |
$savedValuesArray = json_decode( $savedValues, ARRAY_A );
|
102 |
|
103 |
-
if ( $savedValuesArray['ver'] !== $
|
104 |
// New File Version? Delete transient as it will be re-added to the database with the new version
|
105 |
delete_transient( $transientName );
|
106 |
} else {
|
@@ -109,13 +120,12 @@ class OptimizeCss
|
|
109 |
if ( isset( $savedValuesArray['source_uri'] ) && file_exists( $localPathToCssOptimized ) ) {
|
110 |
return array(
|
111 |
$savedValuesArray['source_uri'],
|
112 |
-
$savedValuesArray['optimize_uri']
|
113 |
-
|
114 |
}
|
115 |
}
|
116 |
}
|
117 |
-
|
118 |
-
if (strpos($src, '/wp-includes/') === 0) {
|
119 |
$src = site_url() . $src;
|
120 |
}
|
121 |
|
@@ -143,7 +153,6 @@ class OptimizeCss
|
|
143 |
if (! FileSystem::file_put_contents($newLocalSrc, $cssContent)) {
|
144 |
return array();
|
145 |
}
|
146 |
-
// strpos($src, '.css?ver=') === false
|
147 |
} elseif (strpos($src, '/?custom-css=') !== false) {
|
148 |
/*
|
149 |
* JetPack Custom CSS
|
@@ -233,7 +242,7 @@ class OptimizeCss
|
|
233 |
|
234 |
if ($doFileMinify) {
|
235 |
// Minify this file?
|
236 |
-
$cssContent = MinifyCss::applyMinification($cssContent);
|
237 |
}
|
238 |
|
239 |
if ($isCssFile && $cssContentBefore === $cssContent) {
|
@@ -241,21 +250,26 @@ class OptimizeCss
|
|
241 |
return array();
|
242 |
}
|
243 |
|
244 |
-
$cssContent =
|
245 |
/*
|
246 |
* [END] CSS Content Optimization
|
247 |
*/
|
248 |
|
249 |
// Relative path to the new file
|
250 |
-
$ver = (isset($value->ver) && $value->ver) ? $value->ver : $wp_version;
|
251 |
-
|
252 |
// Save it to /wp-content/cache/css/{OptimizeCommon::$optimizedSingleFilesDir}/
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
-
|
|
|
256 |
|
257 |
-
|
258 |
-
|
|
|
259 |
}
|
260 |
|
261 |
$newFilePathUri .= '.css';
|
@@ -276,7 +290,7 @@ class OptimizeCss
|
|
276 |
$saveValues = array(
|
277 |
'source_uri' => OptimizeCommon::getHrefRelPath($src),
|
278 |
'optimize_uri' => OptimizeCommon::getHrefRelPath($newLocalPathUrl),
|
279 |
-
'ver' => $
|
280 |
);
|
281 |
|
282 |
// Add / Re-add (with new version) transient
|
@@ -284,8 +298,8 @@ class OptimizeCss
|
|
284 |
|
285 |
return array(
|
286 |
OptimizeCommon::getHrefRelPath($src),
|
287 |
-
OptimizeCommon::getHrefRelPath($newLocalPathUrl)
|
288 |
-
|
289 |
}
|
290 |
|
291 |
/**
|
@@ -344,6 +358,14 @@ class OptimizeCss
|
|
344 |
$htmlSource = CombineCss::doCombine($htmlSource);
|
345 |
}
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
return $htmlSource;
|
348 |
});
|
349 |
}
|
@@ -364,9 +386,7 @@ class OptimizeCss
|
|
364 |
*/
|
365 |
public static function getFirstLinkTag($firstLinkHref, $htmlSource)
|
366 |
{
|
367 |
-
|
368 |
-
|
369 |
-
preg_match_all($regExpPattern, $htmlSource, $matches);
|
370 |
foreach ($matches[0] as $matchTag) {
|
371 |
if (strpos($matchTag, $firstLinkHref) !== false) {
|
372 |
return trim($matchTag);
|
@@ -390,8 +410,11 @@ class OptimizeCss
|
|
390 |
$cssContent
|
391 |
);
|
392 |
|
393 |
-
//
|
394 |
-
|
|
|
|
|
|
|
395 |
|
396 |
// If it start with forward slash (/), it doesn't need fix, just skip it
|
397 |
// Also skip ../ types as they were already processed
|
@@ -449,14 +472,11 @@ class OptimizeCss
|
|
449 |
{
|
450 |
$cssOptimizeList = wp_cache_get('wpacu_css_optimize_list');
|
451 |
|
452 |
-
// This will be taken from the transient
|
453 |
if (empty($cssOptimizeList)) {
|
454 |
return $htmlSource;
|
455 |
}
|
456 |
|
457 |
-
|
458 |
-
|
459 |
-
preg_match_all($regExpPattern, OptimizeCommon::cleanerHtmlSource($htmlSource), $matchesSourcesFromTags, PREG_SET_ORDER);
|
460 |
|
461 |
if (empty($matchesSourcesFromTags)) {
|
462 |
return $htmlSource;
|
@@ -486,8 +506,7 @@ class OptimizeCss
|
|
486 |
break;
|
487 |
}
|
488 |
}
|
489 |
-
|
490 |
-
}
|
491 |
|
492 |
return $htmlSource;
|
493 |
}
|
@@ -505,7 +524,7 @@ class OptimizeCss
|
|
505 |
|
506 |
// Needed in case it's added to the Combine CSS exceptions list
|
507 |
if (CombineCss::proceedWithCssCombine()) {
|
508 |
-
$newLinkSourceTag = str_ireplace('<link ', '<link data-wpacu-link-href-before="'
|
509 |
}
|
510 |
|
511 |
// Strip ?ver=
|
20 |
*/
|
21 |
public static $cachedCssAssetsFileExpiresIn = 28800; // 8 hours in seconds (60 * 60 * 8)
|
22 |
|
23 |
+
/**
|
24 |
+
* @var
|
25 |
+
*/
|
26 |
+
public $isMinifyCssEnabled = false;
|
27 |
+
|
28 |
/**
|
29 |
*
|
30 |
*/
|
47 |
return;
|
48 |
}
|
49 |
|
50 |
+
$this->isMinifyCssEnabled = MinifyCss::isMinifyCssEnabled(); // call it only once
|
51 |
+
|
52 |
$cssOptimizeList = array();
|
53 |
|
54 |
// [Start] Collect for caching
|
56 |
$wpStylesRegistered = $wp_styles->registered;
|
57 |
|
58 |
foreach ($wpStylesDone as $handle) {
|
59 |
+
if (! isset($wpStylesRegistered[$handle])) {
|
60 |
+
continue;
|
61 |
+
}
|
62 |
|
63 |
+
$value = $wpStylesRegistered[$handle];
|
64 |
|
65 |
+
$optimizeValues = $this->maybeOptimizeIt($value);
|
66 |
+
|
67 |
+
if (! empty($optimizeValues)) {
|
68 |
+
$cssOptimizeList[] = $optimizeValues;
|
69 |
}
|
70 |
}
|
71 |
|
94 |
|
95 |
$doFileMinify = true;
|
96 |
|
97 |
+
if (! $this->isMinifyCssEnabled) {
|
98 |
$doFileMinify = false;
|
99 |
+
} elseif (MinifyCss::skipMinify($src, $value->handle)) {
|
100 |
$doFileMinify = false;
|
101 |
}
|
102 |
|
103 |
+
$fileVer = $dbVer = (isset($value->ver) && $value->ver) ? $value->ver : $wp_version;
|
104 |
+
|
105 |
$handleDbStr = md5($value->handle);
|
106 |
|
107 |
$transientName = 'wpacu_css_optimize_'.$handleDbStr;
|
111 |
if ( $savedValues ) {
|
112 |
$savedValuesArray = json_decode( $savedValues, ARRAY_A );
|
113 |
|
114 |
+
if ( $savedValuesArray['ver'] !== $dbVer ) {
|
115 |
// New File Version? Delete transient as it will be re-added to the database with the new version
|
116 |
delete_transient( $transientName );
|
117 |
} else {
|
120 |
if ( isset( $savedValuesArray['source_uri'] ) && file_exists( $localPathToCssOptimized ) ) {
|
121 |
return array(
|
122 |
$savedValuesArray['source_uri'],
|
123 |
+
$savedValuesArray['optimize_uri']
|
124 |
+
);
|
125 |
}
|
126 |
}
|
127 |
}
|
128 |
+
if (strpos($src, '/wp-includes/') === 0) {
|
|
|
129 |
$src = site_url() . $src;
|
130 |
}
|
131 |
|
153 |
if (! FileSystem::file_put_contents($newLocalSrc, $cssContent)) {
|
154 |
return array();
|
155 |
}
|
|
|
156 |
} elseif (strpos($src, '/?custom-css=') !== false) {
|
157 |
/*
|
158 |
* JetPack Custom CSS
|
242 |
|
243 |
if ($doFileMinify) {
|
244 |
// Minify this file?
|
245 |
+
$cssContent = MinifyCss::applyMinification($cssContent) ?: $cssContent;
|
246 |
}
|
247 |
|
248 |
if ($isCssFile && $cssContentBefore === $cssContent) {
|
250 |
return array();
|
251 |
}
|
252 |
|
253 |
+
$cssContent = self::maybeFixCssBackgroundUrls($cssContent, $pathToAssetDir . '/');
|
254 |
/*
|
255 |
* [END] CSS Content Optimization
|
256 |
*/
|
257 |
|
258 |
// Relative path to the new file
|
|
|
|
|
259 |
// Save it to /wp-content/cache/css/{OptimizeCommon::$optimizedSingleFilesDir}/
|
260 |
+
if ($fileVer !== $wp_version) {
|
261 |
+
$fileVer = trim(str_replace(' ', '_', preg_replace('/\s+/', ' ', $fileVer)));
|
262 |
+
$fileVer = (strlen($fileVer) > 50) ? substr(md5($fileVer), 0, 20) : $fileVer; // don't end up with too long filenames
|
263 |
+
}
|
264 |
+
|
265 |
+
$newFilePathUri = self::getRelPathCssCacheDir() . OptimizeCommon::$optimizedSingleFilesDir . '/' . $value->handle . '-v' . $fileVer;
|
266 |
|
267 |
+
if (isset($localAssetPath)) { // could be from "/?custom-css=" so a check is needed
|
268 |
+
$sha1File = @sha1_file($localAssetPath);
|
269 |
|
270 |
+
if ($sha1File) {
|
271 |
+
$newFilePathUri .= '-' . $sha1File;
|
272 |
+
}
|
273 |
}
|
274 |
|
275 |
$newFilePathUri .= '.css';
|
290 |
$saveValues = array(
|
291 |
'source_uri' => OptimizeCommon::getHrefRelPath($src),
|
292 |
'optimize_uri' => OptimizeCommon::getHrefRelPath($newLocalPathUrl),
|
293 |
+
'ver' => $dbVer
|
294 |
);
|
295 |
|
296 |
// Add / Re-add (with new version) transient
|
298 |
|
299 |
return array(
|
300 |
OptimizeCommon::getHrefRelPath($src),
|
301 |
+
OptimizeCommon::getHrefRelPath($newLocalPathUrl)
|
302 |
+
);
|
303 |
}
|
304 |
|
305 |
/**
|
358 |
$htmlSource = CombineCss::doCombine($htmlSource);
|
359 |
}
|
360 |
|
361 |
+
if (! Main::instance()->preventAssetsSettings() && Main::instance()->settings['minify_loaded_css'] && Main::instance()->settings['minify_loaded_css_inline']) {
|
362 |
+
$htmlSource = MinifyCss::minifyInlineStyleTags($htmlSource);
|
363 |
+
}
|
364 |
+
|
365 |
+
// Final cleanups
|
366 |
+
$htmlSource = preg_replace('#<link(\s+|)data-wpacu-link-href-before=(["\'])' . '(.*)' . '(\1)#Usmi', '<link ', $htmlSource);
|
367 |
+
$htmlSource = preg_replace('#<link(\s+|)data-wpacu-style-handle=(["\'])' . '(.*)' . '(\1)#Usmi', '<link ', $htmlSource);
|
368 |
+
|
369 |
return $htmlSource;
|
370 |
});
|
371 |
}
|
386 |
*/
|
387 |
public static function getFirstLinkTag($firstLinkHref, $htmlSource)
|
388 |
{
|
389 |
+
preg_match_all('#<link[^>]*stylesheet[^>]*(>)#Usmi', $htmlSource, $matches);
|
|
|
|
|
390 |
foreach ($matches[0] as $matchTag) {
|
391 |
if (strpos($matchTag, $firstLinkHref) !== false) {
|
392 |
return trim($matchTag);
|
410 |
$cssContent
|
411 |
);
|
412 |
|
413 |
+
// Rare cases
|
414 |
+
$cssContent = preg_replace('/url\((\s+)http/i', 'url(http', $cssContent);
|
415 |
+
|
416 |
+
// Avoid Background URLs starting with "data", "http" or "https" as they do not need to have a path updated
|
417 |
+
preg_match_all('/url\((?![\'"]?(?:data|http|https):)[\'"]?([^\'"\)]*)[\'"]?\)/i', $cssContent, $matches);
|
418 |
|
419 |
// If it start with forward slash (/), it doesn't need fix, just skip it
|
420 |
// Also skip ../ types as they were already processed
|
472 |
{
|
473 |
$cssOptimizeList = wp_cache_get('wpacu_css_optimize_list');
|
474 |
|
|
|
475 |
if (empty($cssOptimizeList)) {
|
476 |
return $htmlSource;
|
477 |
}
|
478 |
|
479 |
+
preg_match_all('#<link[^>]*(stylesheet|preload)[^>]*(>)#Usmi', OptimizeCommon::cleanerHtmlSource($htmlSource), $matchesSourcesFromTags, PREG_SET_ORDER);
|
|
|
|
|
480 |
|
481 |
if (empty($matchesSourcesFromTags)) {
|
482 |
return $htmlSource;
|
506 |
break;
|
507 |
}
|
508 |
}
|
509 |
+
}
|
|
|
510 |
|
511 |
return $htmlSource;
|
512 |
}
|
524 |
|
525 |
// Needed in case it's added to the Combine CSS exceptions list
|
526 |
if (CombineCss::proceedWithCssCombine()) {
|
527 |
+
$newLinkSourceTag = str_ireplace('<link ', '<link data-wpacu-link-href-before="'.$sourceUrl.'" ', $newLinkSourceTag);
|
528 |
}
|
529 |
|
530 |
// Strip ?ver=
|
classes/OptimiseAssets/OptimizeJs.php
CHANGED
@@ -10,16 +10,11 @@ use WpAssetCleanUp\Misc;
|
|
10 |
use WpAssetCleanUp\Preloads;
|
11 |
|
12 |
/**
|
13 |
-
* Class
|
14 |
* @package WpAssetCleanUp
|
15 |
*/
|
16 |
class OptimizeJs
|
17 |
{
|
18 |
-
/**
|
19 |
-
* @var array
|
20 |
-
*/
|
21 |
-
public $optimizeList = array();
|
22 |
-
|
23 |
/**
|
24 |
* @var float|int
|
25 |
*/
|
@@ -30,28 +25,17 @@ class OptimizeJs
|
|
30 |
*/
|
31 |
public function init()
|
32 |
{
|
33 |
-
add_action('init', array($this, 'whatToOptimize'), 20);
|
34 |
add_action('wp_print_footer_scripts', array($this, 'prepareOptimizeList'), PHP_INT_MAX);
|
35 |
add_action('wp_loaded', array($this, 'alterHtmlSource'), 1);
|
36 |
}
|
37 |
|
38 |
-
/**
|
39 |
-
*
|
40 |
-
*/
|
41 |
-
public function whatToOptimize()
|
42 |
-
{
|
43 |
-
if (MinifyJs::isMinifyJsEnabled()) {
|
44 |
-
$this->optimizeList[] = 'minify_js';
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
/**
|
49 |
*
|
50 |
*/
|
51 |
public function prepareOptimizeList()
|
52 |
{
|
53 |
// At this time, the only optimization for JS files is minification
|
54 |
-
if (!
|
55 |
return;
|
56 |
}
|
57 |
|
@@ -63,13 +47,13 @@ class OptimizeJs
|
|
63 |
|
64 |
// [Start] Collect for caching
|
65 |
foreach ($wpScriptsList as $handle) {
|
66 |
-
if (isset($wp_scripts->registered[$handle])) {
|
67 |
-
$value = $wp_scripts->registered[$handle];
|
68 |
-
$optimizeValues = $this->maybeOptimizeIt($value);
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
73 |
}
|
74 |
}
|
75 |
|
@@ -92,6 +76,8 @@ class OptimizeJs
|
|
92 |
return array();
|
93 |
}
|
94 |
|
|
|
|
|
95 |
$handleDbStr = md5($value->handle);
|
96 |
|
97 |
$transientName = 'wpacu_js_optimize_'.$handleDbStr;
|
@@ -101,7 +87,7 @@ class OptimizeJs
|
|
101 |
if ( $savedValues ) {
|
102 |
$savedValuesArray = json_decode( $savedValues, ARRAY_A );
|
103 |
|
104 |
-
if ( $savedValuesArray['ver'] !== $
|
105 |
// New File Version? Delete transient as it will be re-added to the database with the new version
|
106 |
delete_transient( $transientName );
|
107 |
} else {
|
@@ -112,13 +98,13 @@ class OptimizeJs
|
|
112 |
if ( isset( $savedValuesArray['source_uri'] ) && file_exists( $localPathToJsOptimized ) ) {
|
113 |
return array(
|
114 |
$savedValuesArray['source_uri'],
|
115 |
-
$savedValuesArray['optimize_uri']
|
116 |
-
|
117 |
}
|
118 |
}
|
119 |
}
|
120 |
|
121 |
-
|
122 |
$src = site_url() . $src;
|
123 |
}
|
124 |
|
@@ -150,15 +136,18 @@ class OptimizeJs
|
|
150 |
}
|
151 |
|
152 |
$jsContent = FileSystem::file_get_contents($localAssetPath);
|
153 |
-
$jsContent =
|
154 |
|
155 |
$jsContent = MinifyJs::applyMinification($jsContent);
|
156 |
|
157 |
// Relative path to the new file
|
158 |
-
$ver = (isset($value->ver) && $value->ver) ? $value->ver : $wp_version;
|
159 |
-
|
160 |
// Save it to /wp-content/cache/js/{OptimizeCommon::$optimizedSingleFilesDir}/
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
$sha1File = @sha1_file($localAssetPath);
|
164 |
|
@@ -172,7 +161,7 @@ class OptimizeJs
|
|
172 |
$newLocalPathUrl = WP_CONTENT_URL . $newFilePathUri; // Full URL path
|
173 |
|
174 |
if ($jsContent) {
|
175 |
-
$jsContent = '/*** Source (before
|
176 |
}
|
177 |
|
178 |
$saveFile = @file_put_contents($newLocalPath, $jsContent);
|
@@ -185,7 +174,7 @@ class OptimizeJs
|
|
185 |
$saveValues = array(
|
186 |
'source_uri' => OptimizeCommon::getHrefRelPath($value->src),
|
187 |
'optimize_uri' => OptimizeCommon::getHrefRelPath($newLocalPathUrl),
|
188 |
-
'ver' => $
|
189 |
);
|
190 |
|
191 |
// Add / Re-add (with new version) transient
|
@@ -193,8 +182,8 @@ class OptimizeJs
|
|
193 |
|
194 |
return array(
|
195 |
OptimizeCommon::getHrefRelPath($value->src),
|
196 |
-
OptimizeCommon::getHrefRelPath($newLocalPathUrl)
|
197 |
-
|
198 |
}
|
199 |
|
200 |
/**
|
@@ -210,9 +199,7 @@ class OptimizeJs
|
|
210 |
return $htmlSource;
|
211 |
}
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
preg_match_all($regExpPattern, OptimizeCommon::cleanerHtmlSource($htmlSource), $matchesSourcesFromTags, PREG_SET_ORDER);
|
216 |
|
217 |
foreach ($matchesSourcesFromTags as $matches) {
|
218 |
$scriptSourceTag = $matches[0];
|
@@ -238,7 +225,7 @@ class OptimizeJs
|
|
238 |
break;
|
239 |
}
|
240 |
}
|
241 |
-
|
242 |
|
243 |
return $htmlSource;
|
244 |
}
|
@@ -284,7 +271,7 @@ class OptimizeJs
|
|
284 |
return;
|
285 |
}
|
286 |
|
287 |
-
ob_start(function($htmlSource) {
|
288 |
// Do not do any optimization if "Test Mode" is Enabled
|
289 |
if (! Menu::userCanManageAssets() && Main::instance()->settings['test_mode']) {
|
290 |
return $htmlSource;
|
@@ -308,6 +295,7 @@ class OptimizeJs
|
|
308 |
}
|
309 |
|
310 |
/*
|
|
|
311 |
* #minifying
|
312 |
* STEP 2: Load minify-able caching list and replace the original source URLs with the new cached ones
|
313 |
*/
|
@@ -326,6 +314,8 @@ class OptimizeJs
|
|
326 |
$htmlSource = str_replace(Preloads::DEL_SCRIPTS_PRELOADS, '', $htmlSource);
|
327 |
}
|
328 |
|
|
|
|
|
329 |
// If "Do not combine JS on this page" is checked in "Asset CleanUp Options" side meta box
|
330 |
// Works for posts, pages and custom post types
|
331 |
if (defined('WPACU_CURRENT_PAGE_ID') && WPACU_CURRENT_PAGE_ID > 0) {
|
@@ -333,11 +323,21 @@ class OptimizeJs
|
|
333 |
|
334 |
// 'no_js_optimize' refers to avoid the combination of JS files
|
335 |
if ( isset( $pageOptions['no_js_optimize'] ) && $pageOptions['no_js_optimize'] ) {
|
336 |
-
|
337 |
}
|
338 |
}
|
339 |
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
return $htmlSource;
|
343 |
});
|
@@ -352,89 +352,28 @@ class OptimizeJs
|
|
352 |
}
|
353 |
|
354 |
/**
|
355 |
-
* @param $
|
356 |
-
*
|
357 |
-
* @return mixed
|
358 |
-
*/
|
359 |
-
public static function clearInlineScriptTags($matchesSourcesFromTags)
|
360 |
-
{
|
361 |
-
$domTag = new \DOMDocument();
|
362 |
-
|
363 |
-
libxml_use_internal_errors( true );
|
364 |
-
|
365 |
-
foreach ($matchesSourcesFromTags as $scriptTagIndex => $matchSourceFromTag) {
|
366 |
-
$matchedSourceFromTag = trim( $matchSourceFromTag[0] );
|
367 |
-
|
368 |
-
$domTag->loadHTML( $matchedSourceFromTag );
|
369 |
-
|
370 |
-
foreach ( $domTag->getElementsByTagName( 'script' ) as $tagObject ) {
|
371 |
-
$hasSrc = false;
|
372 |
-
|
373 |
-
if ( ! $tagObject->hasAttributes() ) {
|
374 |
-
$hasSrc = false;
|
375 |
-
} else {
|
376 |
-
// Has attributes? Check them
|
377 |
-
foreach ( $tagObject->attributes as $attrObj ) {
|
378 |
-
if ( $attrObj->nodeName === 'src' && $attrObj->nodeValue ) {
|
379 |
-
$hasSrc = true;
|
380 |
-
}
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
if (! $hasSrc) {
|
385 |
-
unset($matchesSourcesFromTags[$scriptTagIndex]);
|
386 |
-
}
|
387 |
-
}
|
388 |
-
}
|
389 |
-
|
390 |
-
libxml_clear_errors();
|
391 |
-
|
392 |
-
return $matchesSourcesFromTags;
|
393 |
-
}
|
394 |
-
|
395 |
-
/**
|
396 |
* @param $htmlSource
|
397 |
*
|
398 |
-
* @return
|
399 |
*/
|
400 |
-
public static function
|
401 |
{
|
402 |
-
|
403 |
-
$htmlSource = OptimizeCommon::cleanerHtmlSource($htmlSource);
|
404 |
-
|
405 |
-
$bodyHtml = Misc::extractBetween( $htmlSource, '<head', '</head>' );
|
406 |
-
|
407 |
-
$regExpPattern = '#<script[^>]*>.*?</script>#is';
|
408 |
-
|
409 |
-
preg_match_all( $regExpPattern, $bodyHtml, $matchesSourcesFromTags, PREG_SET_ORDER );
|
410 |
-
|
411 |
-
$domTag = new \DOMDocument();
|
412 |
|
413 |
-
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
$matchedSourceFromTag = trim( $matchSourceFromTag[0] );
|
418 |
|
419 |
-
$
|
420 |
|
421 |
-
|
422 |
-
|
423 |
-
continue;
|
424 |
-
}
|
425 |
-
|
426 |
-
foreach ( $tagObject->attributes as $attrObj ) {
|
427 |
-
if ( $attrObj->nodeName === 'src' && $attrObj->nodeValue ) {
|
428 |
-
return (string) $attrObj->nodeValue;
|
429 |
-
break;
|
430 |
-
}
|
431 |
-
}
|
432 |
}
|
433 |
}
|
434 |
|
435 |
-
|
436 |
-
|
437 |
-
return '';
|
438 |
}
|
439 |
|
440 |
/**
|
@@ -476,6 +415,7 @@ class OptimizeJs
|
|
476 |
if (substr($jsContent, -1) !== ';') {
|
477 |
$jsContent .= "\n" . ';'; // add semicolon as the last character
|
478 |
}
|
|
|
479 |
return $jsContent;
|
480 |
}
|
481 |
|
10 |
use WpAssetCleanUp\Preloads;
|
11 |
|
12 |
/**
|
13 |
+
* Class OptimizeJs
|
14 |
* @package WpAssetCleanUp
|
15 |
*/
|
16 |
class OptimizeJs
|
17 |
{
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* @var float|int
|
20 |
*/
|
25 |
*/
|
26 |
public function init()
|
27 |
{
|
|
|
28 |
add_action('wp_print_footer_scripts', array($this, 'prepareOptimizeList'), PHP_INT_MAX);
|
29 |
add_action('wp_loaded', array($this, 'alterHtmlSource'), 1);
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
*
|
34 |
*/
|
35 |
public function prepareOptimizeList()
|
36 |
{
|
37 |
// At this time, the only optimization for JS files is minification
|
38 |
+
if (! MinifyJs::isMinifyJsEnabled()) {
|
39 |
return;
|
40 |
}
|
41 |
|
47 |
|
48 |
// [Start] Collect for caching
|
49 |
foreach ($wpScriptsList as $handle) {
|
50 |
+
if (! isset($wp_scripts->registered[$handle])) { continue; }
|
|
|
|
|
51 |
|
52 |
+
$value = $wp_scripts->registered[$handle];
|
53 |
+
$optimizeValues = $this->maybeOptimizeIt($value);
|
54 |
+
|
55 |
+
if ( ! empty( $optimizeValues ) ) {
|
56 |
+
$jsOptimizeList[] = $optimizeValues;
|
57 |
}
|
58 |
}
|
59 |
|
76 |
return array();
|
77 |
}
|
78 |
|
79 |
+
$fileVer = $dbVer = (isset($value->ver) && $value->ver) ? $value->ver : $wp_version;
|
80 |
+
|
81 |
$handleDbStr = md5($value->handle);
|
82 |
|
83 |
$transientName = 'wpacu_js_optimize_'.$handleDbStr;
|
87 |
if ( $savedValues ) {
|
88 |
$savedValuesArray = json_decode( $savedValues, ARRAY_A );
|
89 |
|
90 |
+
if ( $savedValuesArray['ver'] !== $dbVer ) {
|
91 |
// New File Version? Delete transient as it will be re-added to the database with the new version
|
92 |
delete_transient( $transientName );
|
93 |
} else {
|
98 |
if ( isset( $savedValuesArray['source_uri'] ) && file_exists( $localPathToJsOptimized ) ) {
|
99 |
return array(
|
100 |
$savedValuesArray['source_uri'],
|
101 |
+
$savedValuesArray['optimize_uri']
|
102 |
+
);
|
103 |
}
|
104 |
}
|
105 |
}
|
106 |
|
107 |
+
if (strpos($src, '/wp-includes/') === 0) {
|
108 |
$src = site_url() . $src;
|
109 |
}
|
110 |
|
136 |
}
|
137 |
|
138 |
$jsContent = FileSystem::file_get_contents($localAssetPath);
|
139 |
+
$jsContent = self::maybeDoJsFixes($jsContent, $pathToAssetDir . '/'); // Minify it and save it to /wp-content/cache/js/min/
|
140 |
|
141 |
$jsContent = MinifyJs::applyMinification($jsContent);
|
142 |
|
143 |
// Relative path to the new file
|
|
|
|
|
144 |
// Save it to /wp-content/cache/js/{OptimizeCommon::$optimizedSingleFilesDir}/
|
145 |
+
if ($fileVer !== $wp_version) {
|
146 |
+
$fileVer = trim(str_replace(' ', '_', preg_replace('/\s+/', ' ', $fileVer)));
|
147 |
+
$fileVer = (strlen($fileVer) > 50) ? substr(md5($fileVer), 0, 20) : $fileVer; // don't end up with too long filenames
|
148 |
+
}
|
149 |
+
|
150 |
+
$newFilePathUri = self::getRelPathJsCacheDir() . OptimizeCommon::$optimizedSingleFilesDir . '/' . $value->handle . '-v' . $fileVer;
|
151 |
|
152 |
$sha1File = @sha1_file($localAssetPath);
|
153 |
|
161 |
$newLocalPathUrl = WP_CONTENT_URL . $newFilePathUri; // Full URL path
|
162 |
|
163 |
if ($jsContent) {
|
164 |
+
$jsContent = '/*** Source (before optimization): ' . str_replace(ABSPATH, '/', $localAssetPath) . ' ***/' . "\n" . $jsContent;
|
165 |
}
|
166 |
|
167 |
$saveFile = @file_put_contents($newLocalPath, $jsContent);
|
174 |
$saveValues = array(
|
175 |
'source_uri' => OptimizeCommon::getHrefRelPath($value->src),
|
176 |
'optimize_uri' => OptimizeCommon::getHrefRelPath($newLocalPathUrl),
|
177 |
+
'ver' => $dbVer
|
178 |
);
|
179 |
|
180 |
// Add / Re-add (with new version) transient
|
182 |
|
183 |
return array(
|
184 |
OptimizeCommon::getHrefRelPath($value->src),
|
185 |
+
OptimizeCommon::getHrefRelPath($newLocalPathUrl)
|
186 |
+
);
|
187 |
}
|
188 |
|
189 |
/**
|
199 |
return $htmlSource;
|
200 |
}
|
201 |
|
202 |
+
preg_match_all('#<script[^>]*src(|\s+)=(|\s+)[^>]*(>)#Usmi', OptimizeCommon::cleanerHtmlSource($htmlSource), $matchesSourcesFromTags, PREG_SET_ORDER);
|
|
|
|
|
203 |
|
204 |
foreach ($matchesSourcesFromTags as $matches) {
|
205 |
$scriptSourceTag = $matches[0];
|
225 |
break;
|
226 |
}
|
227 |
}
|
228 |
+
}
|
229 |
|
230 |
return $htmlSource;
|
231 |
}
|
271 |
return;
|
272 |
}
|
273 |
|
274 |
+
ob_start(static function($htmlSource) {
|
275 |
// Do not do any optimization if "Test Mode" is Enabled
|
276 |
if (! Menu::userCanManageAssets() && Main::instance()->settings['test_mode']) {
|
277 |
return $htmlSource;
|
295 |
}
|
296 |
|
297 |
/*
|
298 |
+
* The JavaScript files only get cached if they are minified
|
299 |
* #minifying
|
300 |
* STEP 2: Load minify-able caching list and replace the original source URLs with the new cached ones
|
301 |
*/
|
314 |
$htmlSource = str_replace(Preloads::DEL_SCRIPTS_PRELOADS, '', $htmlSource);
|
315 |
}
|
316 |
|
317 |
+
$proceedWithCombineOnThisPage = true;
|
318 |
+
|
319 |
// If "Do not combine JS on this page" is checked in "Asset CleanUp Options" side meta box
|
320 |
// Works for posts, pages and custom post types
|
321 |
if (defined('WPACU_CURRENT_PAGE_ID') && WPACU_CURRENT_PAGE_ID > 0) {
|
323 |
|
324 |
// 'no_js_optimize' refers to avoid the combination of JS files
|
325 |
if ( isset( $pageOptions['no_js_optimize'] ) && $pageOptions['no_js_optimize'] ) {
|
326 |
+
$proceedWithCombineOnThisPage = false;
|
327 |
}
|
328 |
}
|
329 |
|
330 |
+
if ($proceedWithCombineOnThisPage) {
|
331 |
+
$htmlSource = CombineJs::doCombine($htmlSource);
|
332 |
+
}
|
333 |
+
|
334 |
+
if (! Main::instance()->preventAssetsSettings() && Main::instance()->settings['minify_loaded_js'] && Main::instance()->settings['minify_loaded_js_inline']) {
|
335 |
+
$htmlSource = MinifyJs::minifyInlineScriptTags($htmlSource);
|
336 |
+
}
|
337 |
+
|
338 |
+
// Final cleanups
|
339 |
+
$htmlSource = preg_replace('#<script(\s+|)data-wpacu-script-src-before=(["\'])' . '(.*)' . '(\1)#Usmi', '<script ', $htmlSource);
|
340 |
+
$htmlSource = preg_replace('#<script(\s+|)data-wpacu-script-handle=(["\'])' . '(.*)' . '(\1)#Usmi', '<script ', $htmlSource);
|
341 |
|
342 |
return $htmlSource;
|
343 |
});
|
352 |
}
|
353 |
|
354 |
/**
|
355 |
+
* @param $scriptSrcs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
* @param $htmlSource
|
357 |
*
|
358 |
+
* @return array
|
359 |
*/
|
360 |
+
public static function getScriptTagsFromSrcs($scriptSrcs, $htmlSource)
|
361 |
{
|
362 |
+
$scriptTags = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
+
$cleanerHtmlSource = OptimizeCommon::cleanerHtmlSource($htmlSource);
|
365 |
|
366 |
+
foreach ($scriptSrcs as $scriptSrc) {
|
367 |
+
$scriptSrc = str_replace('{site_url}', '', $scriptSrc);
|
|
|
368 |
|
369 |
+
preg_match_all('#<script[^>]*src(|\s+)=(|\s+)[^>]*'. preg_quote($scriptSrc, '/'). '.*(>)(.*|)</script>#Usmi', $cleanerHtmlSource, $matchesFromSrc, PREG_SET_ORDER);
|
370 |
|
371 |
+
if (isset($matchesFromSrc[0][0]) && strip_tags($matchesFromSrc[0][0]) === '') {
|
372 |
+
$scriptTags[] = trim($matchesFromSrc[0][0]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
}
|
374 |
}
|
375 |
|
376 |
+
return $scriptTags;
|
|
|
|
|
377 |
}
|
378 |
|
379 |
/**
|
415 |
if (substr($jsContent, -1) !== ';') {
|
416 |
$jsContent .= "\n" . ';'; // add semicolon as the last character
|
417 |
}
|
418 |
+
|
419 |
return $jsContent;
|
420 |
}
|
421 |
|
classes/OwnAssets.php
CHANGED
@@ -24,18 +24,20 @@ class OwnAssets
|
|
24 |
add_action('wp_enqueue_scripts', array($this, 'stylesAndScriptsForPublic'));
|
25 |
|
26 |
// Code only for the Dashboard
|
27 |
-
add_action('admin_head',
|
28 |
|
29 |
// Code for both the Dashboard and the Front-end view
|
30 |
-
add_action('admin_head',
|
31 |
-
add_action('wp_head',
|
32 |
|
33 |
add_action('admin_footer', array($this, 'inlineFooterCode'));
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -316,7 +318,7 @@ HTML;
|
|
316 |
);
|
317 |
|
318 |
$chosenStyleInline = <<<CSS
|
319 |
-
#wpacu_hide_meta_boxes_for_post_types_chosen { margin-top: 5px; }
|
320 |
CSS;
|
321 |
wp_add_inline_style(WPACU_PLUGIN_ID . '-chosen-style', $chosenStyleInline);
|
322 |
// [End] Chosen Style
|
@@ -360,17 +362,11 @@ JS;
|
|
360 |
/**
|
361 |
* @param $relativePath
|
362 |
*
|
363 |
-
* @return
|
364 |
*/
|
365 |
private function _assetVer($relativePath)
|
366 |
{
|
367 |
-
|
368 |
-
|
369 |
-
if (! $assetVer) {
|
370 |
-
$assetVer = date('dmYHi');
|
371 |
-
}
|
372 |
-
|
373 |
-
return $assetVer;
|
374 |
}
|
375 |
|
376 |
/**
|
@@ -404,7 +400,7 @@ JS;
|
|
404 |
{
|
405 |
// Useful in case jQuery library is deferred too (rare situations)
|
406 |
if ($handle === WPACU_PLUGIN_ID . '-script' && ! is_admin()) {
|
407 |
-
$tag = str_replace(' src=', ' defer=\'defer\' src=', $tag);
|
408 |
}
|
409 |
|
410 |
return $tag;
|
24 |
add_action('wp_enqueue_scripts', array($this, 'stylesAndScriptsForPublic'));
|
25 |
|
26 |
// Code only for the Dashboard
|
27 |
+
add_action('admin_head', array($this, 'inlineAdminCode'));
|
28 |
|
29 |
// Code for both the Dashboard and the Front-end view
|
30 |
+
add_action('admin_head', array($this, 'inlineCode'));
|
31 |
+
add_action('wp_head', array($this, 'inlineCode'));
|
32 |
|
33 |
add_action('admin_footer', array($this, 'inlineFooterCode'));
|
34 |
|
35 |
+
if (! is_admin()) {
|
36 |
+
// Rename ?ver= to ?wpacuversion to prevent other plugins from stripping "ver"
|
37 |
+
add_filter('script_loader_src', array($this, 'ownAssetLoaderSrc'));
|
38 |
+
add_filter('style_loader_src', array($this, 'ownAssetLoaderSrc'));
|
39 |
+
add_filter('script_loader_tag', array($this, 'ownAssetLoaderTag'), 10, 2);
|
40 |
+
}
|
41 |
}
|
42 |
|
43 |
/**
|
318 |
);
|
319 |
|
320 |
$chosenStyleInline = <<<CSS
|
321 |
+
#wpacu_hide_meta_boxes_for_post_types_chosen { margin-top: 5px; min-width: 320px; }
|
322 |
CSS;
|
323 |
wp_add_inline_style(WPACU_PLUGIN_ID . '-chosen-style', $chosenStyleInline);
|
324 |
// [End] Chosen Style
|
362 |
/**
|
363 |
* @param $relativePath
|
364 |
*
|
365 |
+
* @return false|string
|
366 |
*/
|
367 |
private function _assetVer($relativePath)
|
368 |
{
|
369 |
+
return @filemtime(dirname(WPACU_PLUGIN_FILE) . $relativePath) ?: date('dmYHi');
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
}
|
371 |
|
372 |
/**
|
400 |
{
|
401 |
// Useful in case jQuery library is deferred too (rare situations)
|
402 |
if ($handle === WPACU_PLUGIN_ID . '-script' && ! is_admin()) {
|
403 |
+
$tag = str_replace(' src=', ' data-wpacu-plugin-script defer=\'defer\' src=', $tag);
|
404 |
}
|
405 |
|
406 |
return $tag;
|
classes/PluginTracking.php
CHANGED
@@ -19,7 +19,7 @@ class PluginTracking
|
|
19 |
*
|
20 |
* @var Settings
|
21 |
*/
|
22 |
-
public $
|
23 |
|
24 |
/**
|
25 |
* @var bool
|
@@ -338,10 +338,9 @@ class PluginTracking
|
|
338 |
return false;
|
339 |
}
|
340 |
|
341 |
-
if (
|
342 |
-
|
343 |
-
|
344 |
-
stristr( network_site_url( '/' ), ':8888' ) !== false // This is common with MAMP on OS X
|
345 |
) {
|
346 |
update_option(WPACU_PLUGIN_ID . '_tracking_notice', '1');
|
347 |
return false;
|
19 |
*
|
20 |
* @var Settings
|
21 |
*/
|
22 |
+
public $settings;
|
23 |
|
24 |
/**
|
25 |
* @var bool
|
338 |
return false;
|
339 |
}
|
340 |
|
341 |
+
if (false !== stripos(network_site_url('/'), 'dev') ||
|
342 |
+
false !== stripos(network_site_url('/'), 'localhost') ||
|
343 |
+
false !== strpos(network_site_url('/'), ':8888') // This is common with MAMP on OS X
|
|
|
344 |
) {
|
345 |
update_option(WPACU_PLUGIN_ID . '_tracking_notice', '1');
|
346 |
return false;
|
classes/Preloads.php
CHANGED
@@ -46,6 +46,10 @@ class Preloads
|
|
46 |
*/
|
47 |
public function __construct()
|
48 |
{
|
|
|
|
|
|
|
|
|
49 |
$this->preloads = $this->getPreloads();
|
50 |
|
51 |
add_filter('wpfc_buffer_callback_filter', static function ($buffer) {
|
@@ -250,14 +254,9 @@ class Preloads
|
|
250 |
*/
|
251 |
public static function appendPreloadsForStylesToHead($htmlSource)
|
252 |
{
|
253 |
-
|
254 |
-
|
255 |
-
&& class_exists('DOMDocument');
|
256 |
-
|
257 |
-
// Highest accuracy
|
258 |
-
if ($useDom) {
|
259 |
$documentForCSS = new \DOMDocument();
|
260 |
-
|
261 |
libxml_use_internal_errors( true );
|
262 |
|
263 |
$documentForCSS->loadHTML($htmlSource);
|
@@ -284,9 +283,7 @@ class Preloads
|
|
284 |
libxml_clear_errors();
|
285 |
} else { // RegExp Fallback
|
286 |
$strContainsFormat = preg_quote('data-wpacu-to-be-preloaded-basic=\'1\'', '/');
|
287 |
-
|
288 |
-
|
289 |
-
preg_match_all($regExpPattern, $htmlSource, $matchesSourcesFromLinkTags, PREG_SET_ORDER);
|
290 |
}
|
291 |
|
292 |
foreach ($matchesSourcesFromLinkTags as $linkTagArray) {
|
@@ -328,9 +325,8 @@ class Preloads
|
|
328 |
public static function appendPreloadsForScriptsToHead($htmlSource)
|
329 |
{
|
330 |
$strContainsFormat = preg_quote('data-wpacu-to-be-preloaded-basic=\'1\'', '/');
|
331 |
-
$regExpPattern = $regExpPattern = '#<script[^>]*'.$strContainsFormat.'[^>]*' . 'src=(\'|")(.*)(\'|")' . '.*(>)#Usmi';
|
332 |
|
333 |
-
preg_match_all(
|
334 |
|
335 |
if (empty($matchesSourcesFromScriptTags)) {
|
336 |
return $htmlSource;
|
46 |
*/
|
47 |
public function __construct()
|
48 |
{
|
49 |
+
if (is_admin()) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
$this->preloads = $this->getPreloads();
|
54 |
|
55 |
add_filter('wpfc_buffer_callback_filter', static function ($buffer) {
|
254 |
*/
|
255 |
public static function appendPreloadsForStylesToHead($htmlSource)
|
256 |
{
|
257 |
+
// Highest accuracy via DOMDocument
|
258 |
+
if (function_exists('libxml_use_internal_errors') && function_exists('libxml_clear_errors') && class_exists('DOMDocument')) {
|
|
|
|
|
|
|
|
|
259 |
$documentForCSS = new \DOMDocument();
|
|
|
260 |
libxml_use_internal_errors( true );
|
261 |
|
262 |
$documentForCSS->loadHTML($htmlSource);
|
283 |
libxml_clear_errors();
|
284 |
} else { // RegExp Fallback
|
285 |
$strContainsFormat = preg_quote('data-wpacu-to-be-preloaded-basic=\'1\'', '/');
|
286 |
+
preg_match_all('#<link[^>]'.$strContainsFormat.'[^>]*' . 'href=([\'"])(.*)([\'"])' . '.*(>)#Usmi', $htmlSource, $matchesSourcesFromLinkTags, PREG_SET_ORDER);
|
|
|
|
|
287 |
}
|
288 |
|
289 |
foreach ($matchesSourcesFromLinkTags as $linkTagArray) {
|
325 |
public static function appendPreloadsForScriptsToHead($htmlSource)
|
326 |
{
|
327 |
$strContainsFormat = preg_quote('data-wpacu-to-be-preloaded-basic=\'1\'', '/');
|
|
|
328 |
|
329 |
+
preg_match_all('#<script[^>]*'.$strContainsFormat.'[^>]*' . 'src=([\'"])(.*)([\'"])' . '.*(>)#Usmi', $htmlSource, $matchesSourcesFromScriptTags, PREG_SET_ORDER);
|
330 |
|
331 |
if (empty($matchesSourcesFromScriptTags)) {
|
332 |
return $htmlSource;
|
classes/Settings.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
namespace WpAssetCleanUp;
|
3 |
|
4 |
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
|
|
|
|
|
5 |
|
6 |
/**
|
7 |
* Class Settings
|
@@ -53,10 +55,12 @@ class Settings
|
|
53 |
|
54 |
// Minify each loaded CSS (remaining ones after unloading the useless ones)
|
55 |
'minify_loaded_css',
|
|
|
56 |
'minify_loaded_css_exceptions',
|
57 |
|
58 |
// Minify each loaded JS (remaining ones after unloading the useless ones)
|
59 |
'minify_loaded_js',
|
|
|
60 |
'minify_loaded_js_exceptions',
|
61 |
|
62 |
'disable_emojis',
|
@@ -103,15 +107,21 @@ class Settings
|
|
103 |
|
104 |
// Google Fonts: Combine Into One Request
|
105 |
'google_fonts_combine',
|
|
|
106 |
|
107 |
-
// Google Fonts: "font-display" CSS property
|
108 |
'google_fonts_display',
|
109 |
|
110 |
// Google Fonts: preconnect hint
|
111 |
'google_fonts_preconnect',
|
112 |
|
113 |
// Google Fonts: Preload Files
|
114 |
-
'google_fonts_preload_files'
|
|
|
|
|
|
|
|
|
|
|
115 |
);
|
116 |
|
117 |
/**
|
@@ -152,13 +162,16 @@ class Settings
|
|
152 |
|
153 |
'assets_list_layout_plugin_area_status' => 'expanded', // Go Pro for 'contracted'
|
154 |
|
155 |
-
'assets_list_inline_code_status'
|
156 |
|
157 |
'minify_loaded_css_exceptions' => '(.*?)\.min.css'. "\n". '/plugins/wd-instagram-feed/(.*?).css',
|
158 |
'minify_loaded_js_exceptions' => '(.*?)\.min.js' . "\n". '/plugins/wd-instagram-feed/(.*?).js',
|
159 |
|
160 |
'combine_loaded_css_exceptions' => '/plugins/wd-instagram-feed/(.*?).css',
|
161 |
-
|
|
|
|
|
|
|
162 |
|
163 |
'input_style' => 'enhanced',
|
164 |
|
@@ -258,7 +271,10 @@ class Settings
|
|
258 |
$data['disable_comment_reply'] = 1;
|
259 |
}
|
260 |
|
261 |
-
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
/**
|
@@ -351,7 +367,8 @@ class Settings
|
|
351 |
}
|
352 |
|
353 |
/**
|
354 |
-
* @param $
|
|
|
355 |
*/
|
356 |
public function updateOption($key, $value)
|
357 |
{
|
@@ -361,7 +378,7 @@ class Settings
|
|
361 |
}
|
362 |
|
363 |
/**
|
364 |
-
* @param $
|
365 |
*/
|
366 |
public function deleteOption($key)
|
367 |
{
|
@@ -461,7 +478,7 @@ class Settings
|
|
461 |
* Add element(s) to the global unload rules
|
462 |
*/
|
463 |
if ($disableGutenbergCssBlockLibrary) {
|
464 |
-
$wpacuUpdate->saveToEverywhereUnloads(array('wp-block-library')
|
465 |
}
|
466 |
|
467 |
if ($disableJQueryMigrate || $disableCommentReply) {
|
@@ -484,7 +501,7 @@ class Settings
|
|
484 |
* Remove element(s) from the global unload rules
|
485 |
*/
|
486 |
if (! $disableGutenbergCssBlockLibrary) {
|
487 |
-
$wpacuUpdate->removeEverywhereUnloads(array('wp-block-library')
|
488 |
}
|
489 |
|
490 |
if (! $disableJQueryMigrate || ! $disableCommentReply) {
|
2 |
namespace WpAssetCleanUp;
|
3 |
|
4 |
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
|
5 |
+
use WpAssetCleanUp\OptimiseAssets\OptimizeCss;
|
6 |
+
use WpAssetCleanUp\OptimiseAssets\OptimizeJs;
|
7 |
|
8 |
/**
|
9 |
* Class Settings
|
55 |
|
56 |
// Minify each loaded CSS (remaining ones after unloading the useless ones)
|
57 |
'minify_loaded_css',
|
58 |
+
'minify_loaded_css_inline',
|
59 |
'minify_loaded_css_exceptions',
|
60 |
|
61 |
// Minify each loaded JS (remaining ones after unloading the useless ones)
|
62 |
'minify_loaded_js',
|
63 |
+
'minify_loaded_js_inline',
|
64 |
'minify_loaded_js_exceptions',
|
65 |
|
66 |
'disable_emojis',
|
107 |
|
108 |
// Google Fonts: Combine Into One Request
|
109 |
'google_fonts_combine',
|
110 |
+
'google_fonts_combine_type',
|
111 |
|
112 |
+
// Google Fonts: "font-display" CSS property: LINK & STYLE tags, @import in CSS files
|
113 |
'google_fonts_display',
|
114 |
|
115 |
// Google Fonts: preconnect hint
|
116 |
'google_fonts_preconnect',
|
117 |
|
118 |
// Google Fonts: Preload Files
|
119 |
+
'google_fonts_preload_files',
|
120 |
+
|
121 |
+
// [wpacu_lite]
|
122 |
+
// Do not trigger Freemius Popup on Deactivation
|
123 |
+
'disable_freemius'
|
124 |
+
// [/wpacu_lite]
|
125 |
);
|
126 |
|
127 |
/**
|
162 |
|
163 |
'assets_list_layout_plugin_area_status' => 'expanded', // Go Pro for 'contracted'
|
164 |
|
165 |
+
'assets_list_inline_code_status' => 'contracted', // takes less space overall
|
166 |
|
167 |
'minify_loaded_css_exceptions' => '(.*?)\.min.css'. "\n". '/plugins/wd-instagram-feed/(.*?).css',
|
168 |
'minify_loaded_js_exceptions' => '(.*?)\.min.js' . "\n". '/plugins/wd-instagram-feed/(.*?).js',
|
169 |
|
170 |
'combine_loaded_css_exceptions' => '/plugins/wd-instagram-feed/(.*?).css',
|
171 |
+
'combine_loaded_css_append_handle_extra' => '1',
|
172 |
+
|
173 |
+
'combine_loaded_js_exceptions' => '/plugins/wd-instagram-feed/(.*?).js',
|
174 |
+
'combine_loaded_js_append_handle_extra' => '1',
|
175 |
|
176 |
'input_style' => 'enhanced',
|
177 |
|
271 |
$data['disable_comment_reply'] = 1;
|
272 |
}
|
273 |
|
274 |
+
$data['is_optimize_css_enabled_by_other_party'] = OptimizeCss::isOptimizeCssEnabledByOtherParty();
|
275 |
+
$data['is_optimize_js_enabled_by_other_party'] = OptimizeJs::isOptimizeJsEnabledByOtherParty();
|
276 |
+
|
277 |
+
Main::instance()->parseTemplate('admin-page-settings-plugin', $data, true);
|
278 |
}
|
279 |
|
280 |
/**
|
367 |
}
|
368 |
|
369 |
/**
|
370 |
+
* @param $key
|
371 |
+
* @param $value
|
372 |
*/
|
373 |
public function updateOption($key, $value)
|
374 |
{
|
378 |
}
|
379 |
|
380 |
/**
|
381 |
+
* @param $key
|
382 |
*/
|
383 |
public function deleteOption($key)
|
384 |
{
|
478 |
* Add element(s) to the global unload rules
|
479 |
*/
|
480 |
if ($disableGutenbergCssBlockLibrary) {
|
481 |
+
$wpacuUpdate->saveToEverywhereUnloads(array('wp-block-library'));
|
482 |
}
|
483 |
|
484 |
if ($disableJQueryMigrate || $disableCommentReply) {
|
501 |
* Remove element(s) from the global unload rules
|
502 |
*/
|
503 |
if (! $disableGutenbergCssBlockLibrary) {
|
504 |
+
$wpacuUpdate->removeEverywhereUnloads(array('wp-block-library'));
|
505 |
}
|
506 |
|
507 |
if (! $disableJQueryMigrate || ! $disableCommentReply) {
|
classes/ThirdParty/Browser.php
CHANGED
@@ -142,10 +142,12 @@ class Browser
|
|
142 |
|
143 |
const OPERATING_SYSTEM_UNKNOWN = 'unknown';
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
149 |
{
|
150 |
if ($userAgent != '') {
|
151 |
$this->setUserAgent($userAgent);
|
142 |
|
143 |
const OPERATING_SYSTEM_UNKNOWN = 'unknown';
|
144 |
|
145 |
+
/**
|
146 |
+
* Browser constructor.
|
147 |
+
*
|
148 |
+
* @param string $userAgent
|
149 |
+
*/
|
150 |
+
public function __construct($userAgent = '')
|
151 |
{
|
152 |
if ($userAgent != '') {
|
153 |
$this->setUserAgent($userAgent);
|
classes/Tools.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
namespace WpAssetCleanUp;
|
3 |
|
4 |
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
|
|
|
5 |
|
6 |
/**
|
7 |
* Class Tools
|
@@ -127,9 +128,9 @@ class Tools
|
|
127 |
$host = 'WP Engine';
|
128 |
} elseif( defined( 'PAGELYBIN' ) ) {
|
129 |
$host = 'Pagely';
|
130 |
-
} elseif( DB_HOST
|
131 |
$host = 'ICDSoft';
|
132 |
-
} elseif( DB_HOST
|
133 |
$host = 'NetworkSolutions';
|
134 |
} elseif( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
|
135 |
$host = 'iPage';
|
@@ -168,7 +169,7 @@ class Tools
|
|
168 |
$return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
|
169 |
|
170 |
$host = $this->maybeGetHost();
|
171 |
-
$browser = new
|
172 |
|
173 |
if ($host) {
|
174 |
$return .= "\n" . '# Hosting Provider' . "\n";
|
@@ -310,7 +311,7 @@ class Tools
|
|
310 |
$return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n";
|
311 |
}
|
312 |
|
313 |
-
$return .= "\n" . '#
|
314 |
|
315 |
$settingsClass = new Settings();
|
316 |
$settings = $settingsClass->getAll();
|
@@ -374,7 +375,7 @@ class Tools
|
|
374 |
|
375 |
$return .= "\n" . 'XML-RPC protocol: '. $xmlProtocolStatus . "\n";
|
376 |
|
377 |
-
$return .= "\n" . '#
|
378 |
|
379 |
$storageStats = OptimizeCommon::getStorageStats();
|
380 |
|
@@ -384,7 +385,7 @@ class Tools
|
|
384 |
$return .= 'Not used';
|
385 |
}
|
386 |
|
387 |
-
$return .= "\n\n" . '#
|
388 |
|
389 |
$wpacuPluginId = WPACU_PLUGIN_ID;
|
390 |
|
@@ -404,7 +405,7 @@ SQL;
|
|
404 |
|
405 |
if (! empty($wpacuOptions)) {
|
406 |
foreach ($wpacuOptions as $wpacuOption) {
|
407 |
-
$return .= '-- Option Name: ' . $wpacuOption['option_name'] . ' / Option Value: ' . $wpacuOption['option_value'] . "\n";
|
408 |
}
|
409 |
} else {
|
410 |
$return .= 'No records'."\n";
|
@@ -412,7 +413,7 @@ SQL;
|
|
412 |
|
413 |
// `usermeta` and `termmeta` might have traces from the Pro version (if ever used)
|
414 |
foreach (array('postmeta', 'usermeta', 'termmeta') as $tableBaseName) {
|
415 |
-
// Get all Asset CleanUp meta keys from all WordPress meta tables where it can be possibly used
|
416 |
$wpacuGetMetaKeysQuery = <<<SQL
|
417 |
SELECT * FROM `{$wpdb->prefix}{$tableBaseName}` WHERE meta_key LIKE '_{$wpacuPluginId}_%'
|
418 |
SQL;
|
@@ -433,7 +434,13 @@ SQL;
|
|
433 |
$rowIdVal = 'Taxonomy Name: '.$term->taxonomy.'; Taxonomy ID: '.$metaResult['term_id'];
|
434 |
}
|
435 |
|
436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
}
|
438 |
} else {
|
439 |
$return .= 'No records'."\n";
|
@@ -445,6 +452,30 @@ SQL;
|
|
445 |
return $return;
|
446 |
}
|
447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
/**
|
449 |
*
|
450 |
*/
|
@@ -464,7 +495,7 @@ SQL;
|
|
464 |
$host = parse_url(site_url(), PHP_URL_HOST);
|
465 |
|
466 |
header('Content-type: text/plain');
|
467 |
-
header('Content-Disposition: attachment; filename="
|
468 |
|
469 |
echo $this->getSystemInfo();
|
470 |
exit();
|
@@ -510,7 +541,7 @@ SQL;
|
|
510 |
} elseif (in_array($wpacuResetValue, array('reset_everything', 'reset_everything_except_settings'))) {
|
511 |
// `usermeta` and `termmeta` might have traces from the Pro version (if ever used)
|
512 |
foreach (array('postmeta', 'usermeta', 'termmeta') as $tableBaseName) {
|
513 |
-
// Get all Asset CleanUp meta keys from all WordPress meta tables where it can be possibly used
|
514 |
$wpacuGetMetaKeysQuery = <<<SQL
|
515 |
SELECT meta_key FROM `{$wpdb->prefix}{$tableBaseName}` WHERE meta_key LIKE '_{$wpacuPluginId}_%'
|
516 |
SQL;
|
@@ -543,7 +574,7 @@ SQL;
|
|
543 |
|
544 |
$wpacuSqlPartOptionExceptions = implode(',', $wpacuOptionNamesExceptions);
|
545 |
|
546 |
-
// Fetch all Asset CleanUp options except the license key related ones
|
547 |
$sqlQueryGetOptions = <<<SQL
|
548 |
SELECT option_name FROM `{$wpdb->prefix}options`
|
549 |
WHERE option_name LIKE '{$wpacuPluginId}_%' AND option_name NOT IN ({$wpacuSqlPartOptionExceptions})
|
@@ -574,7 +605,7 @@ SQL;
|
|
574 |
$this->licenseDataRemoved = true;
|
575 |
}
|
576 |
|
577 |
-
// Remove Asset CleanUp's cache transients
|
578 |
$this->clearAllCacheTransients();
|
579 |
}
|
580 |
|
@@ -599,13 +630,13 @@ SQL;
|
|
599 |
}
|
600 |
|
601 |
/**
|
602 |
-
* Remove Asset CleanUp's Cache Transients
|
603 |
*/
|
604 |
public function clearAllCacheTransients()
|
605 |
{
|
606 |
global $wpdb;
|
607 |
|
608 |
-
// Remove Asset CleanUp's cache transients
|
609 |
$transientLikes = array(
|
610 |
'_transient_wpacu_css_',
|
611 |
'_transient_wpacu_js_'
|
2 |
namespace WpAssetCleanUp;
|
3 |
|
4 |
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
|
5 |
+
use WpAssetCleanUp\ThirdParty\Browser;
|
6 |
|
7 |
/**
|
8 |
* Class Tools
|
128 |
$host = 'WP Engine';
|
129 |
} elseif( defined( 'PAGELYBIN' ) ) {
|
130 |
$host = 'Pagely';
|
131 |
+
} elseif( DB_HOST === 'localhost:/tmp/mysql5.sock' ) {
|
132 |
$host = 'ICDSoft';
|
133 |
+
} elseif( DB_HOST === 'mysqlv5' ) {
|
134 |
$host = 'NetworkSolutions';
|
135 |
} elseif( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
|
136 |
$host = 'iPage';
|
169 |
$return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
|
170 |
|
171 |
$host = $this->maybeGetHost();
|
172 |
+
$browser = new Browser();
|
173 |
|
174 |
if ($host) {
|
175 |
$return .= "\n" . '# Hosting Provider' . "\n";
|
311 |
$return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n";
|
312 |
}
|
313 |
|
314 |
+
$return .= "\n" . '# '.WPACU_PLUGIN_TITLE.' Configuration '. "\n";
|
315 |
|
316 |
$settingsClass = new Settings();
|
317 |
$settings = $settingsClass->getAll();
|
375 |
|
376 |
$return .= "\n" . 'XML-RPC protocol: '. $xmlProtocolStatus . "\n";
|
377 |
|
378 |
+
$return .= "\n" . '# '.WPACU_PLUGIN_TITLE.': CSS/JS Caching Storage'. "\n";
|
379 |
|
380 |
$storageStats = OptimizeCommon::getStorageStats();
|
381 |
|
385 |
$return .= 'Not used';
|
386 |
}
|
387 |
|
388 |
+
$return .= "\n\n" . '# '.WPACU_PLUGIN_TITLE.': Database Storage';
|
389 |
|
390 |
$wpacuPluginId = WPACU_PLUGIN_ID;
|
391 |
|
405 |
|
406 |
if (! empty($wpacuOptions)) {
|
407 |
foreach ($wpacuOptions as $wpacuOption) {
|
408 |
+
$return .= '-- Option Name: ' . $wpacuOption['option_name'] . ' / Option Value: ' . self::stripKeysWithNoValues($wpacuOption['option_value']) . "\n";
|
409 |
}
|
410 |
} else {
|
411 |
$return .= 'No records'."\n";
|
413 |
|
414 |
// `usermeta` and `termmeta` might have traces from the Pro version (if ever used)
|
415 |
foreach (array('postmeta', 'usermeta', 'termmeta') as $tableBaseName) {
|
416 |
+
// Get all Asset CleanUp (Pro) meta keys from all WordPress meta tables where it can be possibly used
|
417 |
$wpacuGetMetaKeysQuery = <<<SQL
|
418 |
SELECT * FROM `{$wpdb->prefix}{$tableBaseName}` WHERE meta_key LIKE '_{$wpacuPluginId}_%'
|
419 |
SQL;
|
434 |
$rowIdVal = 'Taxonomy Name: '.$term->taxonomy.'; Taxonomy ID: '.$metaResult['term_id'];
|
435 |
}
|
436 |
|
437 |
+
$metaValue = $metaResult['meta_value'];
|
438 |
+
|
439 |
+
if (trim($metaValue) === '[]') { // empty, not relevant
|
440 |
+
continue;
|
441 |
+
}
|
442 |
+
|
443 |
+
$return .= '-- ' . $rowIdVal . ' / Meta Key: ' . $metaResult['meta_key'] . ' / Meta Value: ' . $metaValue . "\n";
|
444 |
}
|
445 |
} else {
|
446 |
$return .= 'No records'."\n";
|
452 |
return $return;
|
453 |
}
|
454 |
|
455 |
+
/**
|
456 |
+
* @param $maybeJsonValue
|
457 |
+
*
|
458 |
+
* @return false|mixed|string|void
|
459 |
+
*/
|
460 |
+
public static function stripKeysWithNoValues($maybeJsonValue)
|
461 |
+
{
|
462 |
+
$arrayFromJson = @json_decode($maybeJsonValue, true);
|
463 |
+
|
464 |
+
if (Misc::jsonLastError() !== JSON_ERROR_NONE) {
|
465 |
+
return $maybeJsonValue;
|
466 |
+
}
|
467 |
+
|
468 |
+
if (is_array($arrayFromJson) && ! empty($arrayFromJson)) {
|
469 |
+
foreach ($arrayFromJson as $key => $value) {
|
470 |
+
if (! $value && empty($value)) {
|
471 |
+
unset($arrayFromJson[$key]);
|
472 |
+
}
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
return json_encode($arrayFromJson);
|
477 |
+
}
|
478 |
+
|
479 |
/**
|
480 |
*
|
481 |
*/
|
495 |
$host = parse_url(site_url(), PHP_URL_HOST);
|
496 |
|
497 |
header('Content-type: text/plain');
|
498 |
+
header('Content-Disposition: attachment; filename="'.str_replace(' ', '-', strtolower(WPACU_PLUGIN_TITLE)).'-system-info-'.$host.'-'.$date.'.txt"');
|
499 |
|
500 |
echo $this->getSystemInfo();
|
501 |
exit();
|
541 |
} elseif (in_array($wpacuResetValue, array('reset_everything', 'reset_everything_except_settings'))) {
|
542 |
// `usermeta` and `termmeta` might have traces from the Pro version (if ever used)
|
543 |
foreach (array('postmeta', 'usermeta', 'termmeta') as $tableBaseName) {
|
544 |
+
// Get all Asset CleanUp (Pro) meta keys from all WordPress meta tables where it can be possibly used
|
545 |
$wpacuGetMetaKeysQuery = <<<SQL
|
546 |
SELECT meta_key FROM `{$wpdb->prefix}{$tableBaseName}` WHERE meta_key LIKE '_{$wpacuPluginId}_%'
|
547 |
SQL;
|
574 |
|
575 |
$wpacuSqlPartOptionExceptions = implode(',', $wpacuOptionNamesExceptions);
|
576 |
|
577 |
+
// Fetch all Asset CleanUp (Pro) options except the license key related ones
|
578 |
$sqlQueryGetOptions = <<<SQL
|
579 |
SELECT option_name FROM `{$wpdb->prefix}options`
|
580 |
WHERE option_name LIKE '{$wpacuPluginId}_%' AND option_name NOT IN ({$wpacuSqlPartOptionExceptions})
|
605 |
$this->licenseDataRemoved = true;
|
606 |
}
|
607 |
|
608 |
+
// Remove Asset CleanUp (Pro)'s cache transients
|
609 |
$this->clearAllCacheTransients();
|
610 |
}
|
611 |
|
630 |
}
|
631 |
|
632 |
/**
|
633 |
+
* Remove Asset CleanUp (Pro)'s Cache Transients
|
634 |
*/
|
635 |
public function clearAllCacheTransients()
|
636 |
{
|
637 |
global $wpdb;
|
638 |
|
639 |
+
// Remove Asset CleanUp (Pro)'s cache transients
|
640 |
$transientLikes = array(
|
641 |
'_transient_wpacu_css_',
|
642 |
'_transient_wpacu_js_'
|
classes/Update.php
CHANGED
@@ -226,7 +226,7 @@ HTML;
|
|
226 |
global $post;
|
227 |
}
|
228 |
|
229 |
-
if (! isset($post->ID
|
230 |
return;
|
231 |
}
|
232 |
|
226 |
global $post;
|
227 |
}
|
228 |
|
229 |
+
if (! isset($post->ID, $post->post_type)) {
|
230 |
return;
|
231 |
}
|
232 |
|
composer.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "wp-asset-clean-up",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Front-end optimization plugin for WordPress",
|
5 |
+
"keywords": ["minify", "minifier", "css", "js", "javascript", "dequeue", "speed"],
|
6 |
+
"homepage": "https://wordpress.org/plugins/wp-asset-clean-up/",
|
7 |
+
"license": "GPL-2.0+",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Gabriel Livan",
|
11 |
+
"homepage": "https://wordpress.org/plugins/wp-asset-clean-up/",
|
12 |
+
"role": "WordPress Developer"
|
13 |
+
}
|
14 |
+
],
|
15 |
+
"require": {
|
16 |
+
"php": ">=5.4.0",
|
17 |
+
"ext-pcre": "*",
|
18 |
+
"psr/cache": "*",
|
19 |
+
"matthiasmullie/minify": "^1.3"
|
20 |
+
},
|
21 |
+
"suggest": {
|
22 |
+
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
23 |
+
},
|
24 |
+
"autoload": {
|
25 |
+
"psr-4": {
|
26 |
+
"MatthiasMullie\\Minify\\": "src/"
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
composer.lock
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"content-hash": "050322f72136b2be9f6dfed6a8a90f11",
|
8 |
+
"packages": [
|
9 |
+
{
|
10 |
+
"name": "matthiasmullie/minify",
|
11 |
+
"version": "1.3.61",
|
12 |
+
"source": {
|
13 |
+
"type": "git",
|
14 |
+
"url": "https://github.com/matthiasmullie/minify.git",
|
15 |
+
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751"
|
16 |
+
},
|
17 |
+
"dist": {
|
18 |
+
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
|
20 |
+
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
|
21 |
+
"shasum": ""
|
22 |
+
},
|
23 |
+
"require": {
|
24 |
+
"ext-pcre": "*",
|
25 |
+
"matthiasmullie/path-converter": "~1.1",
|
26 |
+
"php": ">=5.3.0"
|
27 |
+
},
|
28 |
+
"require-dev": {
|
29 |
+
"friendsofphp/php-cs-fixer": "~2.0",
|
30 |
+
"matthiasmullie/scrapbook": "~1.0",
|
31 |
+
"phpunit/phpunit": "~4.8"
|
32 |
+
},
|
33 |
+
"suggest": {
|
34 |
+
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
35 |
+
},
|
36 |
+
"bin": [
|
37 |
+
"bin/minifycss",
|
38 |
+
"bin/minifyjs"
|
39 |
+
],
|
40 |
+
"type": "library",
|
41 |
+
"autoload": {
|
42 |
+
"psr-4": {
|
43 |
+
"MatthiasMullie\\Minify\\": "src/"
|
44 |
+
}
|
45 |
+
},
|
46 |
+
"notification-url": "https://packagist.org/downloads/",
|
47 |
+
"license": [
|
48 |
+
"MIT"
|
49 |
+
],
|
50 |
+
"authors": [
|
51 |
+
{
|
52 |
+
"name": "Matthias Mullie",
|
53 |
+
"role": "Developer",
|
54 |
+
"email": "minify@mullie.eu",
|
55 |
+
"homepage": "http://www.mullie.eu"
|
56 |
+
}
|
57 |
+
],
|
58 |
+
"description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.",
|
59 |
+
"homepage": "http://www.minifier.org",
|
60 |
+
"keywords": [
|
61 |
+
"JS",
|
62 |
+
"css",
|
63 |
+
"javascript",
|
64 |
+
"minifier",
|
65 |
+
"minify"
|
66 |
+
],
|
67 |
+
"time": "2018-11-26T23:10:39+00:00"
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"name": "matthiasmullie/path-converter",
|
71 |
+
"version": "1.1.2",
|
72 |
+
"source": {
|
73 |
+
"type": "git",
|
74 |
+
"url": "https://github.com/matthiasmullie/path-converter.git",
|
75 |
+
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9"
|
76 |
+
},
|
77 |
+
"dist": {
|
78 |
+
"type": "zip",
|
79 |
+
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
|
80 |
+
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
|
81 |
+
"shasum": ""
|
82 |
+
},
|
83 |
+
"require": {
|
84 |
+
"ext-pcre": "*",
|
85 |
+
"php": ">=5.3.0"
|
86 |
+
},
|
87 |
+
"require-dev": {
|
88 |
+
"phpunit/phpunit": "~4.8"
|
89 |
+
},
|
90 |
+
"type": "library",
|
91 |
+
"autoload": {
|
92 |
+
"psr-4": {
|
93 |
+
"MatthiasMullie\\PathConverter\\": "src/"
|
94 |
+
}
|
95 |
+
},
|
96 |
+
"notification-url": "https://packagist.org/downloads/",
|
97 |
+
"license": [
|
98 |
+
"MIT"
|
99 |
+
],
|
100 |
+
"authors": [
|
101 |
+
{
|
102 |
+
"name": "Matthias Mullie",
|
103 |
+
"role": "Developer",
|
104 |
+
"email": "pathconverter@mullie.eu",
|
105 |
+
"homepage": "http://www.mullie.eu"
|
106 |
+
}
|
107 |
+
],
|
108 |
+
"description": "Relative path converter",
|
109 |
+
"homepage": "http://github.com/matthiasmullie/path-converter",
|
110 |
+
"keywords": [
|
111 |
+
"converter",
|
112 |
+
"path",
|
113 |
+
"paths",
|
114 |
+
"relative"
|
115 |
+
],
|
116 |
+
"time": "2018-10-25T15:19:41+00:00"
|
117 |
+
},
|
118 |
+
{
|
119 |
+
"name": "psr/cache",
|
120 |
+
"version": "1.0.1",
|
121 |
+
"source": {
|
122 |
+
"type": "git",
|
123 |
+
"url": "https://github.com/php-fig/cache.git",
|
124 |
+
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
|
125 |
+
},
|
126 |
+
"dist": {
|
127 |
+
"type": "zip",
|
128 |
+
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
|
129 |
+
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
|
130 |
+
"shasum": ""
|
131 |
+
},
|
132 |
+
"require": {
|
133 |
+
"php": ">=5.3.0"
|
134 |
+
},
|
135 |
+
"type": "library",
|
136 |
+
"extra": {
|
137 |
+
"branch-alias": {
|
138 |
+
"dev-master": "1.0.x-dev"
|
139 |
+
}
|
140 |
+
},
|
141 |
+
"autoload": {
|
142 |
+
"psr-4": {
|
143 |
+
"Psr\\Cache\\": "src/"
|
144 |
+
}
|
145 |
+
},
|
146 |
+
"notification-url": "https://packagist.org/downloads/",
|
147 |
+
"license": [
|
148 |
+
"MIT"
|
149 |
+
],
|
150 |
+
"authors": [
|
151 |
+
{
|
152 |
+
"name": "PHP-FIG",
|
153 |
+
"homepage": "http://www.php-fig.org/"
|
154 |
+
}
|
155 |
+
],
|
156 |
+
"description": "Common interface for caching libraries",
|
157 |
+
"keywords": [
|
158 |
+
"cache",
|
159 |
+
"psr",
|
160 |
+
"psr-6"
|
161 |
+
],
|
162 |
+
"time": "2016-08-06T20:24:11+00:00"
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"packages-dev": [],
|
166 |
+
"aliases": [],
|
167 |
+
"minimum-stability": "stable",
|
168 |
+
"stability-flags": [],
|
169 |
+
"prefer-stable": false,
|
170 |
+
"prefer-lowest": false,
|
171 |
+
"platform": {
|
172 |
+
"php": ">=5.4.0",
|
173 |
+
"ext-pcre": "*"
|
174 |
+
},
|
175 |
+
"platform-dev": []
|
176 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: pagespeed, page speed, dequeue, minify css, performance
|
|
4 |
Donate link: https://gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=wp_org_lite&utm_medium=donate
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.2.2
|
7 |
-
Stable tag: 1.3.3.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -164,6 +164,15 @@ With the recently released "Test Mode" feature, you can safely unload assets on
|
|
164 |
4. Homepage CSS & JS Management (List sorted by location)
|
165 |
|
166 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
= 1.3.3.8 =
|
168 |
* Option to hide all meta boxes for specific post types (e.g. not queryable or do not have a public URL, making the assets list irrelevant)
|
169 |
* Bug Fix: In some servers, when preload feature is used and the HTML is not fully valid for DOMDocument, PHP errors were printing
|
4 |
Donate link: https://gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=wp_org_lite&utm_medium=donate
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.2.2
|
7 |
+
Stable tag: 1.3.3.9
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
164 |
4. Homepage CSS & JS Management (List sorted by location)
|
165 |
|
166 |
== Changelog ==
|
167 |
+
= 1.3.3.9 =
|
168 |
+
* Option to disable "Freemius Analytics & Insights?" in "Settings" -> "Plugin Usage Preferences" (good if you do debugging & often deactivate the plugin or you just don't like plugin feedback popups)
|
169 |
+
* Changed the vertical "Settings" menu by renaming "Minify CSS & JS Files" & "Combine CSS & JS Files" to "Optimize CSS" & Optimize JavaScript; Added the status of the minify/combine below the menu titles to easily check what optimizations were done
|
170 |
+
* Improved the way JS files are combined; If "Defer loading JavaScript combined files" is enabled in "Optimize JavaScript", make sure that any external script between the first and last combined JS tags has "defer" attribute applied to it to avoid any JS errors in case a "child" JS file is loaded before a combined "parent" one.
|
171 |
+
* Option to minify inline content between from STYLE and SCRIPT (without any "src" attribute) tags
|
172 |
+
* Optimize minify CSS/JS feature to use less resource when dinamicaly generating the optimized (cached) files; Minification is performed via a new library (ref: https://www.minifier.org/)
|
173 |
+
* Option to choose between "Render-blocking" and "Asynchronous via Web Font Loader (webfont.js)" when loading the combined Google Font requests
|
174 |
+
* Bug Fix: Sometimes the dynamically created drop-down from "Hide all meta boxes for the following public post types" (in "Settings" -> "Plugin Usage Preferences") via jQuery Chosen plugin was returning an empty (0px in width) selector
|
175 |
+
|
176 |
= 1.3.3.8 =
|
177 |
* Option to hide all meta boxes for specific post types (e.g. not queryable or do not have a public URL, making the assets list irrelevant)
|
178 |
* Bug Fix: In some servers, when preload feature is used and the HTML is not fully valid for DOMDocument, PHP errors were printing
|
templates/_admin-page-settings-plugin-areas/_fonts-google.php
CHANGED
@@ -6,10 +6,6 @@ if (! isset($data)) {
|
|
6 |
exit;
|
7 |
}
|
8 |
|
9 |
-
if (! defined('WPACU_USE_MODAL_BOX')) {
|
10 |
-
define('WPACU_USE_MODAL_BOX', true);
|
11 |
-
}
|
12 |
-
|
13 |
$tabIdArea = 'wpacu-setting-google-fonts';
|
14 |
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
|
15 |
|
@@ -27,29 +23,78 @@ $ddOptions = array(
|
|
27 |
<tr valign="top">
|
28 |
<th scope="row" class="setting_title">
|
29 |
<label for="wpacu_google_fonts_combine"><?php _e('Combine Multiple Requests Into Fewer Ones', 'wp-asset-clean-up'); ?></label>
|
|
|
30 |
</th>
|
31 |
<td>
|
32 |
<label class="wpacu_switch">
|
33 |
<input id="wpacu_google_fonts_combine"
|
34 |
type="checkbox"
|
|
|
35 |
<?php echo (($data['google_fonts_combine'] == 1) ? 'checked="checked"' : ''); ?>
|
36 |
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine]"
|
37 |
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
38 |
|
39 |
-
|
40 |
-
<p><strong>Example</strong> The following LINK tags will be merged into one tag:</p>
|
41 |
|
42 |
-
<
|
43 |
-
<
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
</td>
|
54 |
</tr>
|
55 |
<tr valign="top">
|
@@ -74,7 +119,7 @@ $ddOptions = array(
|
|
74 |
<hr />
|
75 |
<ul>
|
76 |
<li><code><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono<strong>&display=swap</strong>"></code></li>
|
77 |
-
<li><code><link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=
|
78 |
</ul>
|
79 |
<hr />
|
80 |
|
@@ -97,13 +142,16 @@ $ddOptions = array(
|
|
97 |
<label class="wpacu_switch">
|
98 |
<input id="wpacu_google_fonts_preconnect"
|
99 |
type="checkbox"
|
|
|
100 |
<?php echo (($data['google_fonts_preconnect'] == 1) ? 'checked="checked"' : ''); ?>
|
101 |
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_preconnect]"
|
102 |
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
103 |
If you know your website requests resources from Google Fonts (fonts.gstatic.com), then adding the preconnect resource hint will instruct the browser to preconnect to Google Fonts while it is loading the CSS, saving load time.
|
104 |
<hr />
|
105 |
-
<
|
106 |
-
|
|
|
|
|
107 |
</td>
|
108 |
</tr>
|
109 |
<tr valign="top">
|
@@ -127,7 +175,7 @@ $ddOptions = array(
|
|
127 |
<strong>Generated Output</strong>, printed within <code><HEAD></code> and <code></HEAD></code>
|
128 |
<div style="margin-top: 5px;">
|
129 |
<div style="margin-bottom: 8px;"><code><link rel="preload" as="font" href="https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2" data-wpacu-preload-font="1" crossorigin></code></div>
|
130 |
-
<div style="margin-bottom: 8px;"><code><link rel="preload" as="font" href="https://fonts.gstatic.com/
|
131 |
</div>
|
132 |
</td>
|
133 |
</tr>
|
6 |
exit;
|
7 |
}
|
8 |
|
|
|
|
|
|
|
|
|
9 |
$tabIdArea = 'wpacu-setting-google-fonts';
|
10 |
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
|
11 |
|
23 |
<tr valign="top">
|
24 |
<th scope="row" class="setting_title">
|
25 |
<label for="wpacu_google_fonts_combine"><?php _e('Combine Multiple Requests Into Fewer Ones', 'wp-asset-clean-up'); ?></label>
|
26 |
+
<p class="wpacu_subtitle"><small><em>And choose the loading option</em></small></p>
|
27 |
</th>
|
28 |
<td>
|
29 |
<label class="wpacu_switch">
|
30 |
<input id="wpacu_google_fonts_combine"
|
31 |
type="checkbox"
|
32 |
+
data-target-opacity="google_fonts_combine_wrap"
|
33 |
<?php echo (($data['google_fonts_combine'] == 1) ? 'checked="checked"' : ''); ?>
|
34 |
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine]"
|
35 |
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
36 |
|
37 |
+
<?php _e('This option combines multiple font requests into fewer requests', 'wp-asset-clean-up'); ?>. Once it's active, you can choose how the load takes place, depending on your website, by choosing one of the radio options below. You can enable this even if you know you have one LINK request. If no combination will take place, the loading type will be applied. Note that the asynchronous loading could cause a <strong>FOUT</strong> (flash of unstyled text) until the Google fonts get loaded, so it's recommended to test it out after the change.
|
|
|
38 |
|
39 |
+
<div id="google_fonts_combine_wrap">
|
40 |
+
<div class="google_fonts_load_types">
|
41 |
+
<ul>
|
42 |
+
<li style="margin-right: 20px;"><strong>Loading Type:</strong></li>
|
43 |
+
<li style="margin-right: 24px;"><label for="google_fonts_combine_type_rb"><input id="google_fonts_combine_type_rb" class="google_fonts_combine_type" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine_type]" <?php if (! $data['google_fonts_combine_type']) { ?>checked="checked"<?php } ?> value="" />Render-blocking (default)</label></li>
|
44 |
+
<li><label for="google_fonts_combine_type_async"><input id="google_fonts_combine_type_async" class="google_fonts_combine_type" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine_type]" <?php if ($data['google_fonts_combine_type'] === 'async') { ?>checked="checked"<?php } ?> value="async" />Asynchronous via Web Font Loader (webfont.js)</label></li>
|
45 |
+
</ul>
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div id="wpacu_google_fonts_combine_type_rb_info_area" class="wpacu_google_fonts_combine_type_area" <?php if ($data['google_fonts_combine_type'] === 'async') { echo 'style="display: none;"'; } ?>>
|
49 |
+
<p><strong>Example</strong> The following LINK tags will be merged into one tag:</p>
|
50 |
|
51 |
+
<ul>
|
52 |
+
<li><code><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans"></code></li>
|
53 |
+
<li><code><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:bold"></code></li>
|
54 |
+
</ul>
|
55 |
+
<hr />
|
56 |
+
<ul>
|
57 |
+
<li><code><link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold"></code></li>
|
58 |
+
</ul>
|
59 |
+
|
60 |
+
<p><strong>Result:</strong> This simple feature saves one round trip to the server for each additional font requested (reducing the number of HTTP requests), and also protects against blocking on older browsers which only have 2 connections open per domain at a time.</p>
|
61 |
+
</div>
|
62 |
+
|
63 |
+
<div id="wpacu_google_fonts_combine_type_async_info_area" class="wpacu_google_fonts_combine_type_area" <?php if ($data['google_fonts_combine_type'] !== 'async') { echo 'style="display: none;"'; } ?>>
|
64 |
+
<p><strong>Example</strong> The following LINK tags will be converted into an inline JavaScript tag place:</p>
|
65 |
+
|
66 |
+
<ul>
|
67 |
+
<li><code><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans"></code></li>
|
68 |
+
<li><code><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:bold"></code></li>
|
69 |
+
</ul>
|
70 |
+
<hr />
|
71 |
+
<ul>
|
72 |
+
<li>
|
73 |
+
<code>
|
74 |
+
<?php
|
75 |
+
$asyncWebFontLoaderSnippet = <<<HTML
|
76 |
+
<script id='wpacu-google-fonts-async-load' type='text/javascript'>
|
77 |
+
WebFontConfig = { google: { families: ['Droid+Sans', 'Inconsolata:bold'] } };
|
78 |
+
(function(wpacuD) {
|
79 |
+
var wpacuWf = wpacuD.createElement('script'), wpacuS = wpacuD.scripts[0];
|
80 |
+
wpacuWf.src = ('https:' === document.location.protocol ? 'https' : 'http')
|
81 |
+
+ '://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
|
82 |
+
wpacuWf.async = true;
|
83 |
+
wpacuS.parentNode.insertBefore(wpacuWf, wpacuS);
|
84 |
+
})(document);
|
85 |
+
</script><noscript><link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold"></noscript>
|
86 |
+
HTML;
|
87 |
+
|
88 |
+
echo nl2br($asyncWebFontLoaderSnippet);
|
89 |
+
?>
|
90 |
+
</code>
|
91 |
+
<p style="margin-top: 5px;"><small><strong>Note:</strong> The inline tag's contents will be minified in the resulting HTML code. A NOSCRIPT tag is appended to the SCRIPT tag as a fallback in case JavaScript is disabled for any reason.</small></p>
|
92 |
+
</li>
|
93 |
+
</ul>
|
94 |
+
|
95 |
+
<p>Using the Web Font Loader asynchronously avoids blocking your page while loading the JavaScript. A <strong>disadvantage</strong> is that the rest of the page might render before the Web Font Loader is loaded and executed, which can cause a <strong>Flash of Unstyled Text (FOUT)</strong>.</p>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
</td>
|
99 |
</tr>
|
100 |
<tr valign="top">
|
119 |
<hr />
|
120 |
<ul>
|
121 |
<li><code><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono<strong>&display=swap</strong>"></code></li>
|
122 |
+
<li><code><link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold<strong>&display=swap</strong>"></code></li>
|
123 |
</ul>
|
124 |
<hr />
|
125 |
|
142 |
<label class="wpacu_switch">
|
143 |
<input id="wpacu_google_fonts_preconnect"
|
144 |
type="checkbox"
|
145 |
+
data-target-opacity="google_fonts_preconnect_wrap"
|
146 |
<?php echo (($data['google_fonts_preconnect'] == 1) ? 'checked="checked"' : ''); ?>
|
147 |
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_preconnect]"
|
148 |
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
149 |
If you know your website requests resources from Google Fonts (fonts.gstatic.com), then adding the preconnect resource hint will instruct the browser to preconnect to Google Fonts while it is loading the CSS, saving load time.
|
150 |
<hr />
|
151 |
+
<div id="google_fonts_preconnect_wrap">
|
152 |
+
<p style="margin-bottom: 5px;">This will generate the following output within <code><HEAD></code> and <code></HEAD></code>:</p>
|
153 |
+
<code><link href='https://fonts.gstatic.com' crossorigin rel='preconnect' /></code>
|
154 |
+
</div>
|
155 |
</td>
|
156 |
</tr>
|
157 |
<tr valign="top">
|
175 |
<strong>Generated Output</strong>, printed within <code><HEAD></code> and <code></HEAD></code>
|
176 |
<div style="margin-top: 5px;">
|
177 |
<div style="margin-bottom: 8px;"><code><link rel="preload" as="font" href="https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2" data-wpacu-preload-font="1" crossorigin></code></div>
|
178 |
+
<div style="margin-bottom: 8px;"><code><link rel="preload" as="font" href="https://fonts.gstatic.com/s/robotomono/v7/L0x5DF4xlVMF-BfR8bXMIjhFq3-cXbKDO1w.woff2" data-wpacu-preload-font="1" crossorigin></code></div>
|
179 |
</div>
|
180 |
</td>
|
181 |
</tr>
|
templates/_admin-page-settings-plugin-areas/_fonts-local.php
CHANGED
@@ -18,7 +18,7 @@ $ddOptions = array(
|
|
18 |
);
|
19 |
|
20 |
// [wpacu_lite]
|
21 |
-
$availableForPro = '<a class="go-pro-link-no-style" target="_blank" href="' . WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_usage_settings&utm_medium=
|
22 |
// [/wpacu_lite]
|
23 |
?>
|
24 |
<div id="<?php echo $tabIdArea; ?>" class="wpacu-settings-tab-content" <?php echo $styleTabContent; ?>>
|
18 |
);
|
19 |
|
20 |
// [wpacu_lite]
|
21 |
+
$availableForPro = '<a class="go-pro-link-no-style" target="_blank" href="' . WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_usage_settings&utm_medium=local_fonts_optimization"><span class="wpacu-tooltip" style="width: 186px;">'.__('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up').'</span> <img style="opacity: 0.6;" width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" /></a>';
|
22 |
// [/wpacu_lite]
|
23 |
?>
|
24 |
<div id="<?php echo $tabIdArea; ?>" class="wpacu-settings-tab-content" <?php echo $styleTabContent; ?>>
|
templates/_admin-page-settings-plugin-areas/_minify-loaded-files.php
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* No direct access to this file
|
4 |
-
*/
|
5 |
-
if (! isset($data)) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
|
9 |
-
$tabIdArea = 'wpacu-setting-minify-loaded-files';
|
10 |
-
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
|
11 |
-
|
12 |
-
$isOptimizeCssEnabledByOtherParty = \WpAssetCleanUp\OptimiseAssets\OptimizeCss::isOptimizeCssEnabledByOtherParty();
|
13 |
-
$isOptimizeJsEnabledByOtherParty = \WpAssetCleanUp\OptimiseAssets\OptimizeJs::isOptimizeJsEnabledByOtherParty();
|
14 |
-
?>
|
15 |
-
<div id="<?php echo $tabIdArea; ?>" class="wpacu-settings-tab-content" <?php echo $styleTabContent; ?>>
|
16 |
-
<h2 class="wpacu-settings-area-title"><?php _e('Minify loaded CSS & JavaScript files to reduce total page size', 'wp-asset-clean-up'); ?></h2>
|
17 |
-
<table class="wpacu-form-table">
|
18 |
-
<tr valign="top">
|
19 |
-
<th scope="row" class="setting_title">
|
20 |
-
<label for="wpacu_minify_css_enable"><?php _e('CSS Files Minification', 'wp-asset-clean-up'); ?></label>
|
21 |
-
<p class="wpacu_subtitle"><small><em><?php _e('Helps decrease the total page size even further', 'wp-asset-clean-up'); ?></em></small></p>
|
22 |
-
</th>
|
23 |
-
<td>
|
24 |
-
<label class="wpacu_switch <?php if (! empty($isOptimizeCssEnabledByOtherParty)) { echo 'wpacu_disabled'; } ?>">
|
25 |
-
<input id="wpacu_minify_css_enable"
|
26 |
-
data-target-opacity="wpacu_minify_css_exceptions_area"
|
27 |
-
type="checkbox"
|
28 |
-
<?php
|
29 |
-
if (! empty($isOptimizeCssEnabledByOtherParty)) {
|
30 |
-
echo 'disabled="disabled"';
|
31 |
-
} else {
|
32 |
-
echo (($data['minify_loaded_css'] == 1) ? 'checked="checked"' : '');
|
33 |
-
}
|
34 |
-
?>
|
35 |
-
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css]"
|
36 |
-
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
37 |
-
|
38 |
-
<?php _e('This will take the remaining enqueued CSS files, minify them and load them from the cache.', 'wp-asset-clean-up'); ?>
|
39 |
-
|
40 |
-
<?php
|
41 |
-
if (! empty($isOptimizeCssEnabledByOtherParty)) {
|
42 |
-
?>
|
43 |
-
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
44 |
-
<ul style="margin: 0;">
|
45 |
-
<li>This option is not available as optimize/minify stylesheets (CSS) is already enabled in the following plugins: <strong><?php echo implode(', ', $isOptimizeCssEnabledByOtherParty); ?></strong>. <?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s).</li>
|
46 |
-
<li>Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then minify the remaining CSS with any plugin you prefer.</li>
|
47 |
-
</ul>
|
48 |
-
</div>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
-
?>
|
52 |
-
|
53 |
-
<?php
|
54 |
-
$minifyCssExceptionsAreaStyle = empty($isOptimizeCssEnabledByOtherParty) && ($data['minify_loaded_css'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
|
55 |
-
?>
|
56 |
-
|
57 |
-
<div id="wpacu_minify_css_exceptions_area" style="<?php echo $minifyCssExceptionsAreaStyle; ?>">
|
58 |
-
<div style="margin: 0 0 6px;"><?php _e('Do not minify the CSS files matching the patterns below (one per line)', 'wp-asset-clean-up'); ?>:</div>
|
59 |
-
<label for="wpacu_minify_css_exceptions">
|
60 |
-
<textarea style="width: 100%;"
|
61 |
-
rows="4"
|
62 |
-
id="wpacu_minify_css_exceptions"
|
63 |
-
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_exceptions]"><?php echo $data['minify_loaded_css_exceptions']; ?></textarea>
|
64 |
-
</label>
|
65 |
-
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
|
66 |
-
</div>
|
67 |
-
</td>
|
68 |
-
</tr>
|
69 |
-
|
70 |
-
<tr valign="top">
|
71 |
-
<th scope="row" class="setting_title">
|
72 |
-
<label for="wpacu_minify_js_enable"><?php _e('JavaScript Files Minification', 'wp-asset-clean-up'); ?></label>
|
73 |
-
<p class="wpacu_subtitle"><small><em><?php _e('Helps decrease the total page size even further', 'wp-asset-clean-up'); ?></em></small></p>
|
74 |
-
</th>
|
75 |
-
<td>
|
76 |
-
<label class="wpacu_switch <?php if (! empty($isOptimizeJsEnabledByOtherParty)) { echo 'wpacu_disabled'; } ?>">
|
77 |
-
<input id="wpacu_minify_js_enable"
|
78 |
-
data-target-opacity="wpacu_minify_js_exceptions_area"
|
79 |
-
type="checkbox"
|
80 |
-
<?php
|
81 |
-
if (! empty($isOptimizeJsEnabledByOtherParty)) {
|
82 |
-
echo 'disabled="disabled"';
|
83 |
-
} else {
|
84 |
-
echo (($data['minify_loaded_js'] == 1) ? 'checked="checked"' : '');
|
85 |
-
}
|
86 |
-
?>
|
87 |
-
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js]"
|
88 |
-
value="1" /> <span class="wpacu_slider wpacu_round"></span></label>
|
89 |
-
<?php _e('This will take the remaining enqueued JavaScript files, minify them and load them from the cache.', 'wp-asset-clean-up'); ?>
|
90 |
-
|
91 |
-
<?php
|
92 |
-
if (! empty($isOptimizeJsEnabledByOtherParty)) {
|
93 |
-
?>
|
94 |
-
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
95 |
-
<ul style="margin: 0;">
|
96 |
-
<li>This option is not available as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $isOptimizeJsEnabledByOtherParty); ?></strong>. <?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s).</li>
|
97 |
-
<li>Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then minify the remaining JS with any plugin you prefer.</li>
|
98 |
-
</ul>
|
99 |
-
</div>
|
100 |
-
<?php
|
101 |
-
}
|
102 |
-
?>
|
103 |
-
|
104 |
-
<?php
|
105 |
-
$minifyJsExceptionsAreaStyle = empty($isOptimizeJsEnabledByOtherParty) && ($data['minify_loaded_js'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
|
106 |
-
?>
|
107 |
-
<div id="wpacu_minify_js_exceptions_area" style="<?php echo $minifyJsExceptionsAreaStyle; ?>">
|
108 |
-
<div style="margin: 0 0 6px;"><?php _e('Do not minify the JavaScript files matching the patterns below (one per line)', 'wp-asset-clean-up'); ?>:</div>
|
109 |
-
<label for="wpacu_minify_js_exceptions">
|
110 |
-
<textarea style="width: 100%;"
|
111 |
-
rows="4"
|
112 |
-
id="wpacu_minify_js_exceptions"
|
113 |
-
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_exceptions]"><?php echo $data['minify_loaded_js_exceptions']; ?></textarea>
|
114 |
-
</label>
|
115 |
-
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
|
116 |
-
</div>
|
117 |
-
</td>
|
118 |
-
</tr>
|
119 |
-
</table>
|
120 |
-
|
121 |
-
<hr />
|
122 |
-
|
123 |
-
<ul style="list-style: none; margin-left: 18px;">
|
124 |
-
<li style="margin-bottom: 18px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> The CSS/JS cached files will be re-generated once the file version changes (the value from <code>?ver=</code>). In addition, the versioning value from the source will be appended to the new cached CSS/JS file name (e.g. new-file-name-here-ver-1.2).</li>
|
125 |
-
<li><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> <?php _e('For maximum performance and to reduce server resources, the following CSS/JS files will not be minified, but kept as they are, since they are already optimised and minified by the WordPress core contributors & developers', 'wp-asset-clean-up'); ?>:
|
126 |
-
<div style="margin: 15px 0 0 28px;">
|
127 |
-
<ul style="list-style: circle;">
|
128 |
-
<li>CSS/JS WordPress core files that end up in .min.css and .min.js (e.g. <code>/wp-includes/css/dashicons.min.css</code>, <code>/wp-includes/css/admin-bar.min.css</code>, <code>/wp-includes/js/jquery/jquery-migrate.min.js</code>, <code>/wp-includes/js/jquery/ui/datepicker.min.js</code> etc.)</li>
|
129 |
-
<li><?php echo sprintf(__('jQuery library from %s', 'wp-asset-clean-up'), '<code>/wp-includes/js/jquery/jquery.js</code>'); ?></li>
|
130 |
-
</ul>
|
131 |
-
</div>
|
132 |
-
</li>
|
133 |
-
</ul>
|
134 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/_admin-page-settings-plugin-areas/_optimize-css.php
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* No direct access to this file
|
4 |
+
*/
|
5 |
+
if (! isset($data)) {
|
6 |
+
exit;
|
7 |
+
}
|
8 |
+
|
9 |
+
$tabIdArea = 'wpacu-setting-optimize-css';
|
10 |
+
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
|
11 |
+
|
12 |
+
// [wpacu_lite]
|
13 |
+
$availableForPro = '<a class="go-pro-link-no-style" target="_blank" href="' . WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_usage_settings&utm_medium=local_fonts_optimization"><span class="wpacu-tooltip" style="width: 186px;">'.__('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up').'</span> <img style="opacity: 0.6;" width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" /></a>';
|
14 |
+
// [/wpacu_lite]
|
15 |
+
?>
|
16 |
+
<div id="<?php echo $tabIdArea; ?>" class="wpacu-settings-tab-content" <?php echo $styleTabContent; ?>>
|
17 |
+
<h2 class="wpacu-settings-area-title"><?php _e('Minify / Combine loaded CSS files to reduce total page size and the number of HTTP requests', 'wp-asset-clean-up'); ?></h2>
|
18 |
+
|
19 |
+
<table class="wpacu-form-table">
|
20 |
+
<tr valign="top">
|
21 |
+
<th scope="row" class="setting_title">
|
22 |
+
<label for="wpacu_minify_css_enable"><?php _e('CSS Files Minification', 'wp-asset-clean-up'); ?></label>
|
23 |
+
<p class="wpacu_subtitle"><small><em><?php _e('Helps decrease the total page size even further', 'wp-asset-clean-up'); ?></em></small></p>
|
24 |
+
</th>
|
25 |
+
<td>
|
26 |
+
<label class="wpacu_switch <?php if (! empty($data['is_optimize_css_enabled_by_other_party'])) { echo 'wpacu_disabled'; } ?>">
|
27 |
+
<input id="wpacu_minify_css_enable"
|
28 |
+
data-target-opacity="wpacu_minify_css_area"
|
29 |
+
type="checkbox"
|
30 |
+
<?php
|
31 |
+
if (! empty($data['is_optimize_css_enabled_by_other_party'])) {
|
32 |
+
echo 'disabled="disabled"';
|
33 |
+
} else {
|
34 |
+
echo (($data['minify_loaded_css'] == 1) ? 'checked="checked"' : '');
|
35 |
+
}
|
36 |
+
?>
|
37 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css]"
|
38 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
39 |
+
|
40 |
+
<?php _e('This will take the remaining enqueued CSS files, minify them and load them from the cache.', 'wp-asset-clean-up'); ?>
|
41 |
+
|
42 |
+
<?php
|
43 |
+
if (! empty($data['is_optimize_css_enabled_by_other_party'])) {
|
44 |
+
?>
|
45 |
+
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
46 |
+
<ul style="margin: 0;">
|
47 |
+
<li>This option is not available as optimize/minify stylesheets (CSS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_css_enabled_by_other_party']); ?></strong>. <?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s).</li>
|
48 |
+
<li>Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then minify the remaining CSS with any plugin you prefer.</li>
|
49 |
+
</ul>
|
50 |
+
</div>
|
51 |
+
<?php
|
52 |
+
}
|
53 |
+
|
54 |
+
$minifyCssExceptionsAreaStyle = empty($data['is_optimize_css_enabled_by_other_party']) && ($data['minify_loaded_css'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
|
55 |
+
?>
|
56 |
+
<div id="wpacu_minify_css_area" style="<?php echo $minifyCssExceptionsAreaStyle; ?>">
|
57 |
+
<div style="padding: 10px; background: #f2faf2;" class="wpacu-fancy-checkbox">
|
58 |
+
<input id="minify_loaded_css_inline_checkbox"
|
59 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_inline]"
|
60 |
+
<?php echo (($data['minify_loaded_css_inline'] == 1) ? 'checked="checked"' : ''); ?>
|
61 |
+
type="checkbox"
|
62 |
+
value="1" />
|
63 |
+
<label for="minify_loaded_css_inline_checkbox"> Minify inline CSS content within STYLE tags</label>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<div id="wpacu_minify_css_exceptions_area">
|
67 |
+
<div style="margin: 0 0 6px;"><?php _e('Do not minify the CSS files matching the patterns below (one per line)', 'wp-asset-clean-up'); ?>:</div>
|
68 |
+
<label for="wpacu_minify_css_exceptions">
|
69 |
+
<textarea style="width: 100%;"
|
70 |
+
rows="4"
|
71 |
+
id="wpacu_minify_css_exceptions"
|
72 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_exceptions]"><?php echo $data['minify_loaded_css_exceptions']; ?></textarea>
|
73 |
+
</label>
|
74 |
+
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<ul style="list-style: none; margin-left: 18px;">
|
78 |
+
<li style="margin-bottom: 18px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> The CSS/JS cached files will be re-generated once the file version changes (the value from <code>?ver=</code>). In addition, the versioning value from the source will be appended to the new cached CSS/JS file name (e.g. new-file-name-here-ver-1.2).</li>
|
79 |
+
<li><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> <?php _e('For maximum performance and to reduce server resources, the following CSS/JS files will not be minified, but kept as they are, since they are already optimised and minified by the WordPress core contributors & developers', 'wp-asset-clean-up'); ?>:
|
80 |
+
<div style="margin: 15px 0 0 28px;">
|
81 |
+
<ul style="list-style: circle;">
|
82 |
+
<li>CSS/JS WordPress core files that end up in .min.css and .min.js (e.g. <code>/wp-includes/css/dashicons.min.css</code>, <code>/wp-includes/css/admin-bar.min.css</code>, <code>/wp-includes/js/jquery/jquery-migrate.min.js</code>, <code>/wp-includes/js/jquery/ui/datepicker.min.js</code> etc.)</li>
|
83 |
+
<li><?php echo sprintf(__('jQuery library from %s', 'wp-asset-clean-up'), '<code>/wp-includes/js/jquery/jquery.js</code>'); ?></li>
|
84 |
+
</ul>
|
85 |
+
</div>
|
86 |
+
</li>
|
87 |
+
</ul>
|
88 |
+
</td>
|
89 |
+
</tr>
|
90 |
+
|
91 |
+
<tr>
|
92 |
+
<td colspan="2" style="padding: 0;">
|
93 |
+
<div style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
|
94 |
+
<strong><?php _e('NOTE', 'wp-asset-clean-up'); ?>:</strong> <?php echo __('Concatenating assets is no longer a recommended practice in HTTP/2', 'wp-asset-clean-up'); ?>. <span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-http2-info-css-target" href="#wpacu-http2-info-css"><?php _e('Read more', 'wp-asset-clean-up'); ?></a> | <a target="_blank" href="https://tools.keycdn.com/http2-test"><?php _e('Verify if your server has HTTP/2 support', 'wp-asset-clean-up'); ?></a>
|
95 |
+
</div>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
|
99 |
+
<tr valign="top">
|
100 |
+
<th scope="row" class="setting_title">
|
101 |
+
<label for="wpacu_combine_loaded_css_enable"><?php _e('Combine loaded CSS (Stylesheets) into fewer files', 'wp-asset-clean-up'); ?></label>
|
102 |
+
<p class="wpacu_subtitle"><small><em><?php _e('Helps reducing the number of HTTP Requests even further', 'wp-asset-clean-up'); ?></em></small></p>
|
103 |
+
</th>
|
104 |
+
<td>
|
105 |
+
<label class="wpacu_switch <?php if (! empty($data['is_optimize_css_enabled_by_other_party'])) { echo 'wpacu_disabled'; } ?>">
|
106 |
+
<input id="wpacu_combine_loaded_css_enable"
|
107 |
+
data-target-opacity="wpacu_combine_loaded_css_info_area"
|
108 |
+
type="checkbox"
|
109 |
+
<?php
|
110 |
+
if (! empty($data['is_optimize_css_enabled_by_other_party'])) {
|
111 |
+
echo 'disabled="disabled"';
|
112 |
+
} else {
|
113 |
+
echo (in_array($data['combine_loaded_css'], array('for_admin', 'for_all', 1)) ? 'checked="checked"' : '');
|
114 |
+
}
|
115 |
+
?>
|
116 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css]"
|
117 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
118 |
+
|
119 |
+
<small>* if <code style="font-size: inherit;"><?php echo '/'.str_replace(ABSPATH, '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
|
120 |
+
|
121 |
+
<?php
|
122 |
+
if (! empty($data['is_optimize_css_enabled_by_other_party'])) {
|
123 |
+
?>
|
124 |
+
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
125 |
+
<ul style="margin: 0;">
|
126 |
+
<li>This option is not available as optimize/minify stylesheets (CSS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_css_enabled_by_other_party']); ?></strong></li>
|
127 |
+
<li><?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s). Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then concatenate (if necessary) the remaining CSS with any plugin you prefer.</li>
|
128 |
+
</ul>
|
129 |
+
</div>
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
?>
|
133 |
+
|
134 |
+
<div id="wpacu_combine_loaded_css_info_area" <?php if (empty($data['is_optimize_css_enabled_by_other_party']) && in_array($data['combine_loaded_css'], array('for_admin', 'for_all', 1))) { ?> style="opacity: 1;" <?php } else { ?>style="opacity: 0.4;"<?php } ?>>
|
135 |
+
<p style="margin-top: 8px; padding: 10px; background: #f2faf2;">
|
136 |
+
<label for="combine_loaded_css_for_admin_only_checkbox">
|
137 |
+
<input id="combine_loaded_css_for_admin_only_checkbox"
|
138 |
+
<?php echo ((in_array($data['combine_loaded_css_for_admin_only'], array('for_admin', 1))
|
139 |
+
|| $data['combine_loaded_css'] === 'for_admin')
|
140 |
+
? 'checked="checked"' : ''); ?>
|
141 |
+
type="checkbox"
|
142 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css_for_admin_only]"
|
143 |
+
value="1" />
|
144 |
+
<?php _e('Apply combination only for logged-in administrator (for debugging purposes)', 'wp-asset-clean-up'); ?>
|
145 |
+
</label>
|
146 |
+
</p>
|
147 |
+
|
148 |
+
<!-- [wpacu_lite] -->
|
149 |
+
<div style="padding: 10px; background: #f2faf2;" class="wpacu-fancy-checkbox">
|
150 |
+
<?php echo $availableForPro; ?>
|
151 |
+
<input id="combine_loaded_css_append_handle_extra_checkbox"
|
152 |
+
disabled="disabled"
|
153 |
+
type="checkbox" />
|
154 |
+
<label for="combine_loaded_css_append_handle_extra_checkbox">Add inline tag contents associated with a style (handle) to the combined group of files before/after the main script's contents</label>
|
155 |
+
<p style="margin-top: 10px;"><small>When a file is added to a combined group of files, any other inline content (e.g. added via <code style="font-size: inherit;">wp_add_inline_style()</code>) associated with it, will also be added to the combined files. This reduces the number of DOM elements as well makes sure the CSS code will load in the right (set) order.</small></p>
|
156 |
+
</div>
|
157 |
+
<!-- [/wpacu_lite] -->
|
158 |
+
|
159 |
+
<div id="wpacu_combine_loaded_css_exceptions_area">
|
160 |
+
<div style="margin: 0 0 6px;"><?php _e('Do not combine the CSS files matching the patterns below', 'wp-asset-clean-up'); ?> (<?php _e('one per line', 'wp-asset-clean-up'); ?>):</div>
|
161 |
+
<label for="combine_loaded_css_exceptions">
|
162 |
+
<textarea style="width: 100%;"
|
163 |
+
rows="4"
|
164 |
+
id="combine_loaded_css_exceptions"
|
165 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css_exceptions]"><?php echo $data['combine_loaded_css_exceptions']; ?></textarea>
|
166 |
+
</label>
|
167 |
+
|
168 |
+
<p>Pattern Examples (you don't have to add the full URL, as it's recommended to use relative paths):</p>
|
169 |
+
<code>/wp-includes/css/dashicons.min.css<br />/wp-includes/css/admin-bar.min.css<br />/wp-content/plugins/plugin-title/css/(.*?).css</code>
|
170 |
+
|
171 |
+
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
|
172 |
+
</div>
|
173 |
+
|
174 |
+
<p>This scans the remaining CSS files (left after cleaning up the unnecessary ones) from the <code><head></code> and <code><body></code> locations and combines them into ~2 files (one in each location). To be 100% sure everything works fine after activation, consider enabling this feature only for logged-in administrator, so only you can see the updated page. If all looks good, you can later uncheck the option to apply the feature to everyone else.</p>
|
175 |
+
<p style="margin-bottom: -7px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> The following stylesheets are not included in the combined CSS file for maximum performance:</p>
|
176 |
+
<ul style="list-style: disc; margin-left: 35px; margin-bottom: 0;">
|
177 |
+
<li>Have any <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content">preloading added to them</a> via <code>rel="preload"</code> will not be combined as they have priority in loading and shouldn't be mixed with the rest of the CSS.</li>
|
178 |
+
<li style="margin-bottom: 0;">Have a different media attribute that is different than "all". If, for instance, the "print" attribute is there, it is for a reason and it's not added together with the "all" ones.</li>
|
179 |
+
</ul>
|
180 |
+
<p style="margin-bottom: -7px; margin-top: 20px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> This feature will not work <strong>IF</strong>:</p>
|
181 |
+
<ul style="margin-left: 35px; list-style: disc;">
|
182 |
+
<li>"Test Mode" is enabled, this feature will not work for the guest users, even if "Yes, for everyone" is chosen as "Test Mode" purpose is to make the plugin as inactive for non logged-in administrators for ultimate debugging.</li>
|
183 |
+
<li>The URL has query strings (e.g. an URL such as //www.yourdomain.com/product/title-here/?param=1&param_two=value_here)</li>
|
184 |
+
</ul>
|
185 |
+
</div>
|
186 |
+
</td>
|
187 |
+
</tr>
|
188 |
+
</table>
|
189 |
+
</div>
|
190 |
+
|
191 |
+
<div id="wpacu-http2-info-css" class="wpacu-modal" style="padding-top: 100px;">
|
192 |
+
<div class="wpacu-modal-content" style="max-width: 800px;">
|
193 |
+
<span class="wpacu-close">×</span>
|
194 |
+
<h2 style="margin-top: 5px;"><?php _e('Combining CSS files in HTTP/2 protocol', 'wp-asset-clean-up'); ?></h2>
|
195 |
+
<p><?php _e('While it\'s still a good idea to combine assets into fewer (or only one) files in HTTP/1 (since you are restricted to the number of open connections), doing the same in HTTP/2 is no longer a performance optimization due to the ability to transfer multiple small files simultaneously without much overhead.', 'wp-asset-clean-up'); ?></p>
|
196 |
+
|
197 |
+
<hr />
|
198 |
+
|
199 |
+
<p><?php _e('In HTTP/2 some of the issues that were addressed are', 'wp-asset-clean-up'); ?>:</p>
|
200 |
+
<ul>
|
201 |
+
|
202 |
+
<li><strong>Multiplexing</strong>: <?php _e('allows concurrent requests across a single TCP connection', 'wp-asset-clean-up'); ?></li>
|
203 |
+
<li><strong>Server Push</strong>: <?php _e('whereby a server can push vital resources to the browser before being asked for them.', 'wp-asset-clean-up'); ?></li>
|
204 |
+
</ul>
|
205 |
+
|
206 |
+
<hr />
|
207 |
+
|
208 |
+
<p><?php _e('Since HTTP requests are loaded concurrently in HTTP/2, it\'s better to only serve the files that your visitors need and don\'t worry much about concatenation.', 'wp-asset-clean-up'); ?></p>
|
209 |
+
<p><?php _e('Note that page speed testing tools such as PageSpeed Insights, YSlow, Pingdom Tools or GTMetrix still recommend combining CSS/JS files because they haven\'t updated their recommendations based on HTTP/1 or HTTP/2 protocols so you should take into account the actual load time, not the performance grade.', 'wp-asset-clean-up'); ?></p>
|
210 |
+
|
211 |
+
<hr />
|
212 |
+
|
213 |
+
<p style="margin-bottom: 12px;"><?php _e('If you do decide to move on with the concatenation (which at least would improve the GTMetrix performance grade from a cosmetic point of view), please remember to <strong>test thoroughly</strong> the pages that have the assets combined (pay attention to any JavaScript errors in the browser\'s console which is accessed via right click & "Inspect") as, in rare cases, due to the order in which the scripts were loaded and the way their code was written, it could break some functionality.', 'wp-asset-clean-up'); ?></p>
|
214 |
+
</div>
|
215 |
+
</div>
|
templates/_admin-page-settings-plugin-areas/{_combine-loaded-files.php → _optimize-js.php}
RENAMED
@@ -6,102 +6,81 @@ if (! isset($data)) {
|
|
6 |
exit;
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
define('WPACU_USE_MODAL_BOX', true);
|
11 |
-
}
|
12 |
-
|
13 |
-
$tabIdArea = 'wpacu-setting-combine-loaded-files';
|
14 |
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
|
15 |
|
16 |
-
|
17 |
-
$
|
|
|
18 |
?>
|
19 |
<div id="<?php echo $tabIdArea; ?>" class="wpacu-settings-tab-content" <?php echo $styleTabContent; ?>>
|
20 |
-
|
21 |
-
|
22 |
-
<div style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
|
23 |
-
<strong><?php _e('NOTE', 'wp-asset-clean-up'); ?>:</strong> <?php echo __('Concatenating assets is no longer a recommended practice in HTTP/2', 'wp-asset-clean-up'); ?>. <span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-http2-info-target" href="#wpacu-http2-info"><?php _e('Read more', 'wp-asset-clean-up'); ?></a> | <a target="_blank" href="https://tools.keycdn.com/http2-test"><?php _e('Verify if your server has HTTP/2 support', 'wp-asset-clean-up'); ?></a>
|
24 |
-
</div>
|
25 |
-
|
26 |
<table class="wpacu-form-table">
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
data-target-opacity="
|
36 |
-
|
37 |
<?php
|
38 |
-
if (! empty($
|
39 |
echo 'disabled="disabled"';
|
40 |
} else {
|
41 |
-
|
42 |
}
|
43 |
?>
|
44 |
-
|
45 |
-
|
|
|
46 |
|
47 |
-
<small>* if <code style="font-size: inherit;"><?php echo '/'.str_replace(ABSPATH, '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
|
48 |
-
|
49 |
<?php
|
50 |
-
if (! empty($
|
51 |
?>
|
52 |
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
53 |
<ul style="margin: 0;">
|
54 |
-
<li>This option is not available as optimize/minify
|
55 |
-
<li
|
56 |
</ul>
|
57 |
</div>
|
58 |
<?php
|
59 |
}
|
60 |
-
?>
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
rows="4"
|
81 |
-
id="combine_loaded_css_exceptions"
|
82 |
-
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css_exceptions]"><?php echo $data['combine_loaded_css_exceptions']; ?></textarea>
|
83 |
</label>
|
84 |
-
|
85 |
-
<p>Pattern Examples (you don't have to add the full URL, as it's recommended to use relative paths):</p>
|
86 |
-
<code>/wp-includes/css/dashicons.min.css<br />/wp-includes/css/admin-bar.min.css<br />/wp-content/plugins/plugin-title/css/(.*?).css</code>
|
87 |
-
|
88 |
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
|
89 |
</div>
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
<li style="margin-bottom: 0;">Have a different media attribute value than "screen" and "all". If the "print" attribute is there, it is for a reason and it's not added together with "all".</li>
|
96 |
-
</ul>
|
97 |
-
<p style="margin-bottom: -7px; margin-top: 20px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> This feature will not work <strong>IF</strong>:</p>
|
98 |
-
<ul style="margin-left: 35px; list-style: disc;">
|
99 |
-
<li>"Test Mode" is enabled, this feature will not work for the guest users, even if "Yes, for everyone" is chosen as "Test Mode" purpose is to make the plugin as inactive for non logged-in administrators for ultimate debugging.</li>
|
100 |
-
<li>The URL has query strings (e.g. an URL such as //www.yourdomain.com/product/title-here/?param=1&param_two=value_here)</li>
|
101 |
-
</ul>
|
102 |
</div>
|
103 |
</td>
|
104 |
-
|
105 |
|
106 |
<tr valign="top">
|
107 |
<th scope="row" class="setting_title">
|
@@ -109,12 +88,12 @@ $isOptimizeJsEnabledByOtherParty = \WpAssetCleanUp\OptimiseAssets\OptimizeJs::i
|
|
109 |
<p class="wpacu_subtitle"><small><em><?php _e('Helps reducing the number of HTTP Requests even further', 'wp-asset-clean-up'); ?></em></small></p>
|
110 |
</th>
|
111 |
<td>
|
112 |
-
<label class="wpacu_switch <?php if (! empty($
|
113 |
<input id="wpacu_combine_loaded_js_enable"
|
114 |
data-target-opacity="wpacu_combine_loaded_js_info_area"
|
115 |
type="checkbox"
|
116 |
<?php
|
117 |
-
if (! empty($
|
118 |
echo 'disabled="disabled"';
|
119 |
} else {
|
120 |
echo (in_array($data['combine_loaded_js'], array('for_admin', 'for_all', 1)) ? 'checked="checked"' : '');
|
@@ -126,11 +105,11 @@ $isOptimizeJsEnabledByOtherParty = \WpAssetCleanUp\OptimiseAssets\OptimizeJs::i
|
|
126 |
<small>* if <code style="font-size: inherit;"><?php echo '/'.str_replace(ABSPATH, '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
|
127 |
|
128 |
<?php
|
129 |
-
if (! empty($
|
130 |
?>
|
131 |
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
132 |
<ul style="margin: 0;">
|
133 |
-
<li>This option is not available as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $
|
134 |
<li><?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s). Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then concatenate (if necessary) the JS using any plugin you prefer.</li>
|
135 |
</ul>
|
136 |
</div>
|
@@ -138,35 +117,44 @@ $isOptimizeJsEnabledByOtherParty = \WpAssetCleanUp\OptimiseAssets\OptimizeJs::i
|
|
138 |
}
|
139 |
?>
|
140 |
|
141 |
-
<div id="wpacu_combine_loaded_js_info_area" <?php if (empty($
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
<?php echo ((in_array($data['combine_loaded_js_for_admin_only'], array('for_admin', 1))
|
146 |
|| $data['combine_loaded_js'] === 'for_admin')
|
147 |
? 'checked="checked"' : ''); ?>
|
148 |
-
|
149 |
<?php
|
150 |
-
if (! empty($
|
151 |
echo 'disabled="disabled"';
|
152 |
}
|
153 |
?>
|
154 |
-
|
155 |
-
|
156 |
<?php _e('Apply combination only for logged-in administrator', 'wp-asset-clean-up'); ?> (<?php _e('for debugging purposes', 'wp-asset-clean-up'); ?>)
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
<p style="padding: 10px; background: #f2faf2;">
|
161 |
<label for="wpacu_combine_loaded_js_defer_body_checkbox">
|
162 |
<input id="wpacu_combine_loaded_js_defer_body_checkbox"
|
163 |
<?php echo (($data['combine_loaded_js_defer_body'] == 1) ? 'checked="checked"' : ''); ?>
|
164 |
type="checkbox"
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_defer_body]"
|
171 |
value="1" />
|
172 |
Defer loading JavaScript combined files from <code><body></code> (applies <code>defer="defer"</code> attribute to the combined script tags)
|
@@ -229,10 +217,10 @@ $isOptimizeJsEnabledByOtherParty = \WpAssetCleanUp\OptimiseAssets\OptimizeJs::i
|
|
229 |
</table>
|
230 |
</div>
|
231 |
|
232 |
-
<div id="wpacu-http2-info" class="wpacu-modal" style="padding-top: 100px;">
|
233 |
<div class="wpacu-modal-content" style="max-width: 800px;">
|
234 |
<span class="wpacu-close">×</span>
|
235 |
-
<h2 style="margin-top: 5px;"><?php _e('Combining
|
236 |
<p><?php _e('While it\'s still a good idea to combine assets into fewer (or only one) files in HTTP/1 (since you are restricted to the number of open connections), doing the same in HTTP/2 is no longer a performance optimization due to the ability to transfer multiple small files simultaneously without much overhead.', 'wp-asset-clean-up'); ?></p>
|
237 |
|
238 |
<hr />
|
6 |
exit;
|
7 |
}
|
8 |
|
9 |
+
$tabIdArea = 'wpacu-setting-optimize-js';
|
|
|
|
|
|
|
|
|
10 |
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
|
11 |
|
12 |
+
// [wpacu_lite]
|
13 |
+
$availableForPro = '<a class="go-pro-link-no-style" target="_blank" href="' . WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_usage_settings&utm_medium=local_fonts_optimization"><span class="wpacu-tooltip" style="width: 186px;">'.__('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up').'</span> <img style="opacity: 0.6;" width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" /></a>';
|
14 |
+
// [/wpacu_lite]
|
15 |
?>
|
16 |
<div id="<?php echo $tabIdArea; ?>" class="wpacu-settings-tab-content" <?php echo $styleTabContent; ?>>
|
17 |
+
<h2 class="wpacu-settings-area-title"><?php _e('Minify / Combine loaded JavaScript files to reduce total page size and the number of HTTP requests', 'wp-asset-clean-up'); ?></h2>
|
|
|
|
|
|
|
|
|
|
|
18 |
<table class="wpacu-form-table">
|
19 |
+
<tr valign="top">
|
20 |
+
<th scope="row" class="setting_title">
|
21 |
+
<label for="wpacu_minify_js_enable"><?php _e('JavaScript Files Minification', 'wp-asset-clean-up'); ?></label>
|
22 |
+
<p class="wpacu_subtitle"><small><em><?php _e('Helps decrease the total page size even further', 'wp-asset-clean-up'); ?></em></small></p>
|
23 |
+
</th>
|
24 |
+
<td>
|
25 |
+
<label class="wpacu_switch <?php if (! empty($data['is_optimize_js_enabled_by_other_party'])) { echo 'wpacu_disabled'; } ?>">
|
26 |
+
<input id="wpacu_minify_js_enable"
|
27 |
+
data-target-opacity="wpacu_minify_js_area"
|
28 |
+
type="checkbox"
|
29 |
<?php
|
30 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
31 |
echo 'disabled="disabled"';
|
32 |
} else {
|
33 |
+
echo (($data['minify_loaded_js'] == 1) ? 'checked="checked"' : '');
|
34 |
}
|
35 |
?>
|
36 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js]"
|
37 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span></label>
|
38 |
+
<?php _e('This will take the remaining enqueued JavaScript files, minify them and load them from the cache.', 'wp-asset-clean-up'); ?>
|
39 |
|
|
|
|
|
40 |
<?php
|
41 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
42 |
?>
|
43 |
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
44 |
<ul style="margin: 0;">
|
45 |
+
<li>This option is not available as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_js_enabled_by_other_party']); ?></strong>. <?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s).</li>
|
46 |
+
<li>Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then minify the remaining JS with any plugin you prefer.</li>
|
47 |
</ul>
|
48 |
</div>
|
49 |
<?php
|
50 |
}
|
|
|
51 |
|
52 |
+
$minifyJsExceptionsAreaStyle = empty($data['is_optimize_js_enabled_by_other_party']) && ($data['minify_loaded_js'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
|
53 |
+
?>
|
54 |
+
<div id="wpacu_minify_js_area" style="<?php echo $minifyJsExceptionsAreaStyle; ?>">
|
55 |
+
<div style="padding: 10px; background: #f2faf2;" class="wpacu-fancy-checkbox">
|
56 |
+
<input id="minify_loaded_js_inline_checkbox"
|
57 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_inline]"
|
58 |
+
<?php echo (($data['minify_loaded_js_inline'] == 1) ? 'checked="checked"' : ''); ?>
|
59 |
+
type="checkbox"
|
60 |
+
value="1" />
|
61 |
+
<label for="minify_loaded_js_inline_checkbox"> Minify inline JavaScript content within SCRIPT tags</label>
|
62 |
+
</div>
|
63 |
+
<div id="wpacu_minify_js_exceptions_area">
|
64 |
+
<div style="margin: 0 0 6px;"><?php _e('Do not minify the JavaScript files matching the patterns below (one per line)', 'wp-asset-clean-up'); ?>:</div>
|
65 |
+
<label for="wpacu_minify_js_exceptions">
|
66 |
+
<textarea style="width: 100%;"
|
67 |
+
rows="4"
|
68 |
+
id="wpacu_minify_js_exceptions"
|
69 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_exceptions]"><?php echo $data['minify_loaded_js_exceptions']; ?></textarea>
|
|
|
|
|
|
|
70 |
</label>
|
|
|
|
|
|
|
|
|
71 |
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
|
72 |
</div>
|
73 |
+
</div>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
|
77 |
+
<tr>
|
78 |
+
<td colspan="2" style="padding: 0;">
|
79 |
+
<div style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
|
80 |
+
<strong><?php _e('NOTE', 'wp-asset-clean-up'); ?>:</strong> <?php echo __('Concatenating assets is no longer a recommended practice in HTTP/2', 'wp-asset-clean-up'); ?>. <span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-http2-info-js-target" href="#wpacu-http2-info-js"><?php _e('Read more', 'wp-asset-clean-up'); ?></a> | <a target="_blank" href="https://tools.keycdn.com/http2-test"><?php _e('Verify if your server has HTTP/2 support', 'wp-asset-clean-up'); ?></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</div>
|
82 |
</td>
|
83 |
+
</tr>
|
84 |
|
85 |
<tr valign="top">
|
86 |
<th scope="row" class="setting_title">
|
88 |
<p class="wpacu_subtitle"><small><em><?php _e('Helps reducing the number of HTTP Requests even further', 'wp-asset-clean-up'); ?></em></small></p>
|
89 |
</th>
|
90 |
<td>
|
91 |
+
<label class="wpacu_switch <?php if (! empty($data['is_optimize_js_enabled_by_other_party'])) { echo 'wpacu_disabled'; } ?>">
|
92 |
<input id="wpacu_combine_loaded_js_enable"
|
93 |
data-target-opacity="wpacu_combine_loaded_js_info_area"
|
94 |
type="checkbox"
|
95 |
<?php
|
96 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
97 |
echo 'disabled="disabled"';
|
98 |
} else {
|
99 |
echo (in_array($data['combine_loaded_js'], array('for_admin', 'for_all', 1)) ? 'checked="checked"' : '');
|
105 |
<small>* if <code style="font-size: inherit;"><?php echo '/'.str_replace(ABSPATH, '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
|
106 |
|
107 |
<?php
|
108 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
109 |
?>
|
110 |
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
|
111 |
<ul style="margin: 0;">
|
112 |
+
<li>This option is not available as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_js_enabled_by_other_party']); ?></strong>.</li>
|
113 |
<li><?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s). Eliminate the bloat first via <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_assets_manager'); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then concatenate (if necessary) the JS using any plugin you prefer.</li>
|
114 |
</ul>
|
115 |
</div>
|
117 |
}
|
118 |
?>
|
119 |
|
120 |
+
<div id="wpacu_combine_loaded_js_info_area" <?php if (empty($data['is_optimize_js_enabled_by_other_party']) && in_array($data['combine_loaded_js'], array('for_admin', 'for_all', 1))) { ?> style="opacity: 1;" <?php } else { ?>style="opacity: 0.4;"<?php } ?>>
|
121 |
+
<p style="margin-top: 8px; padding: 10px; background: #f2faf2;">
|
122 |
+
<label for="combine_loaded_js_for_admin_only_checkbox">
|
123 |
+
<input id="combine_loaded_js_for_admin_only_checkbox"
|
124 |
<?php echo ((in_array($data['combine_loaded_js_for_admin_only'], array('for_admin', 1))
|
125 |
|| $data['combine_loaded_js'] === 'for_admin')
|
126 |
? 'checked="checked"' : ''); ?>
|
127 |
+
type="checkbox"
|
128 |
<?php
|
129 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
130 |
echo 'disabled="disabled"';
|
131 |
}
|
132 |
?>
|
133 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_for_admin_only]"
|
134 |
+
value="1" />
|
135 |
<?php _e('Apply combination only for logged-in administrator', 'wp-asset-clean-up'); ?> (<?php _e('for debugging purposes', 'wp-asset-clean-up'); ?>)
|
136 |
+
</label>
|
137 |
+
</p>
|
138 |
+
|
139 |
+
<div style="padding: 10px; background: #f2faf2;" class="wpacu-fancy-checkbox">
|
140 |
+
<?php echo $availableForPro; ?>
|
141 |
+
<input id="combine_loaded_js_append_handle_extra_checkbox"
|
142 |
+
type="checkbox"
|
143 |
+
disabled="disabled" />
|
144 |
+
<label for="combine_loaded_js_append_handle_extra_checkbox">Add inline tag contents associated with a script (handle) to the combined group of files before/after the main script's contents</label>
|
145 |
+
<p style="margin-top: 10px;"><small>When a file is added to a combined group of files, the CDATA as well as any other inline content (e.g. added via <code style="font-size: inherit;">wp_add_inline_script()</code>) associated with it will also be added to the combined files. This reduces the number of DOM elements as well makes sure that, in case, the combined file is deferred, the code from the inline tags is triggered at the same time as the one from the file</small></p>
|
146 |
+
</div>
|
147 |
|
148 |
<p style="padding: 10px; background: #f2faf2;">
|
149 |
<label for="wpacu_combine_loaded_js_defer_body_checkbox">
|
150 |
<input id="wpacu_combine_loaded_js_defer_body_checkbox"
|
151 |
<?php echo (($data['combine_loaded_js_defer_body'] == 1) ? 'checked="checked"' : ''); ?>
|
152 |
type="checkbox"
|
153 |
+
<?php
|
154 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
155 |
+
echo 'disabled="disabled"';
|
156 |
+
}
|
157 |
+
?>
|
158 |
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_defer_body]"
|
159 |
value="1" />
|
160 |
Defer loading JavaScript combined files from <code><body></code> (applies <code>defer="defer"</code> attribute to the combined script tags)
|
217 |
</table>
|
218 |
</div>
|
219 |
|
220 |
+
<div id="wpacu-http2-info-js" class="wpacu-modal" style="padding-top: 100px;">
|
221 |
<div class="wpacu-modal-content" style="max-width: 800px;">
|
222 |
<span class="wpacu-close">×</span>
|
223 |
+
<h2 style="margin-top: 5px;"><?php _e('Combining JavaScript files in HTTP/2 protocol', 'wp-asset-clean-up'); ?></h2>
|
224 |
<p><?php _e('While it\'s still a good idea to combine assets into fewer (or only one) files in HTTP/1 (since you are restricted to the number of open connections), doing the same in HTTP/2 is no longer a performance optimization due to the ability to transfer multiple small files simultaneously without much overhead.', 'wp-asset-clean-up'); ?></p>
|
225 |
|
226 |
<hr />
|
templates/_admin-page-settings-plugin-areas/_plugin-usage-settings.php
CHANGED
@@ -342,6 +342,22 @@ foreach (\WpAssetCleanUp\MetaBoxes::$noMetaBoxesForPostTypes as $noMetaBoxesForP
|
|
342 |
<br />This is relevant only if any of the options from the following tabs are enabled: "Minify CSS & JS Files" & "Combine CSS & JS Files"). When the caching is cleared, the previously cached CSS/JS files stored in <code><?php echo \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> that are older than (X) days will be deleted as they are outdated and likely not referenced anymore in any source code (e.g. old cached pages, Google Search cached version etc.). <span style="color: #004567;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=237" target="_blank">Read more</a>
|
343 |
</td>
|
344 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
</table>
|
346 |
</div>
|
347 |
|
@@ -375,4 +391,15 @@ foreach (\WpAssetCleanUp\MetaBoxes::$noMetaBoxesForPostTypes as $noMetaBoxesForP
|
|
375 |
$pluginTrackingClass::showSentInfoDataTable($pluginTrackingClass->data);
|
376 |
?>
|
377 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
</div>
|
342 |
<br />This is relevant only if any of the options from the following tabs are enabled: "Minify CSS & JS Files" & "Combine CSS & JS Files"). When the caching is cleared, the previously cached CSS/JS files stored in <code><?php echo \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> that are older than (X) days will be deleted as they are outdated and likely not referenced anymore in any source code (e.g. old cached pages, Google Search cached version etc.). <span style="color: #004567;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=237" target="_blank">Read more</a>
|
343 |
</td>
|
344 |
</tr>
|
345 |
+
<!-- [wpacu_lite] -->
|
346 |
+
<tr valign="top">
|
347 |
+
<th scope="row">
|
348 |
+
<label for="wpacu_disable_freemius"><?php _e('Disable Freemius Analytics & Insights?', 'wp-asset-clean-up'); ?></label>
|
349 |
+
</th>
|
350 |
+
<td>
|
351 |
+
<label class="wpacu_switch">
|
352 |
+
<input id="wpacu_disable_freemius"
|
353 |
+
type="checkbox"
|
354 |
+
<?php echo (($data['disable_freemius'] == 1) ? 'checked="checked"' : ''); ?>
|
355 |
+
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[disable_freemius]"
|
356 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
357 |
+
If enabled, it will not trigger any popup asking you about the reason why you decided to deactivate the plugin (from <em>"Plugins" -> "Installed Plugins"</em> page). It's good if you do debugging and often deactivate the plugin or you just don't like plugin feedback popups. <span style="color: #004567;" class="dashicons dashicons-info"></span> <a id="wpacu-deactivate-modal-info-target" href="#wpacu-deactivate-modal-info"><?php _e('Read more', 'wp-asset-clean-up'); ?></a>
|
358 |
+
</td>
|
359 |
+
</tr>
|
360 |
+
<!-- [/wpacu_lite] -->
|
361 |
</table>
|
362 |
</div>
|
363 |
|
391 |
$pluginTrackingClass::showSentInfoDataTable($pluginTrackingClass->data);
|
392 |
?>
|
393 |
</div>
|
394 |
+
</div>
|
395 |
+
|
396 |
+
<div id="wpacu-deactivate-modal-info" class="wpacu-modal" style="padding-top: 60px;">
|
397 |
+
<div class="wpacu-modal-content" style="max-width: 650px;">
|
398 |
+
<span class="wpacu-close">×</span>
|
399 |
+
<h2 style="margin-top: 5px;"><?php _e('Asset CleanUp: Deactivation Modal', 'wp-asset-clean-up'); ?></h2>
|
400 |
+
<p>When you use the "Deactivate" link for "Asset CleanUp: Page Speed Booster" plugin from "Plugins" -> "Installed Plugins", a popup like the one in the below example shows up allowing you the option to <em>Skip & Deactivate</em> or select an uninstall reason, sending your feedback and deactivate it. Collecting feedback is very useful to understand why you decided to deactivate the plugin so we can further improve it based on the overall feedback.</p>
|
401 |
+
<p>However, there are times when you might do debugging on your website and you have to often deactivate the plugin. You can disable the feedback modal and you will not be asked for any uninstall reason anytime you use the "Deactivate" link.</p>
|
402 |
+
<hr />
|
403 |
+
<img style="margin: 0 auto; width: 100%; max-width: 500px; display: table;" src="<?php echo WPACU_PLUGIN_URL. '/assets/images/wpacu-deactivate-modal.jpg'; ?>" alt="" />
|
404 |
+
</div>
|
405 |
</div>
|
templates/admin-page-settings-plugin.php
CHANGED
@@ -8,6 +8,10 @@ if (! isset($data)) {
|
|
8 |
|
9 |
include_once '_top-area.php';
|
10 |
|
|
|
|
|
|
|
|
|
11 |
// [wpacu_lite]
|
12 |
$availableForPro = '<a href="'.WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_settings" class="go-pro-link-no-style"><span class="wpacu-tooltip">'.__('Available for Pro users', 'wp-asset-clean-up').'<br />'.__('Buy now to unlock all features!', 'wp-asset-clean-up').'</span> <img width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" /></a> ';
|
13 |
$settingsWithLock = '<em><strong>'.__('Note', 'wp-asset-clean-up').':</strong> '.__('The settings that have a lock are available to Pro users.', 'wp-asset-clean-up').' <a href="' . WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_settings">'.__('Click here to upgrade!', 'wp-asset-clean-up').'</a></em>';
|
@@ -26,8 +30,8 @@ if ($showSettingsType === 'tabs') {
|
|
26 |
'wpacu-setting-strip-the-fat' => __( 'Stripping the "fat"', 'wp-asset-clean-up' ) . ' ' . $wikiStatus,
|
27 |
'wpacu-setting-plugin-usage-settings' => __( 'Plugin Usage Preferences', 'wp-asset-clean-up' ),
|
28 |
'wpacu-setting-test-mode' => __( 'Test Mode', 'wp-asset-clean-up' ),
|
29 |
-
'wpacu-setting-
|
30 |
-
'wpacu-setting-
|
31 |
'wpacu-setting-common-files-unload' => __( 'Site-Wide Common Unloads', 'wp-asset-clean-up' ),
|
32 |
'wpacu-setting-html-source-cleanup' => __( 'HTML Source CleanUp', 'wp-asset-clean-up' ),
|
33 |
'wpacu-setting-local-fonts' => __( 'Local Fonts', 'wp-asset-clean-up' ),
|
@@ -58,10 +62,36 @@ if ($showSettingsType === 'tabs') {
|
|
58 |
<?php if ($showSettingsType === 'tabs') { ?>
|
59 |
<div class="wpacu-settings-tab">
|
60 |
<?php
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
?>
|
64 |
-
<a href="#<?php echo $
|
|
|
|
|
65 |
<?php
|
66 |
}
|
67 |
?>
|
@@ -72,8 +102,8 @@ if ($showSettingsType === 'tabs') {
|
|
72 |
include_once '_admin-page-settings-plugin-areas/_strip-the-fat.php';
|
73 |
include_once '_admin-page-settings-plugin-areas/_plugin-usage-settings.php';
|
74 |
include_once '_admin-page-settings-plugin-areas/_test-mode.php';
|
75 |
-
include_once '_admin-page-settings-plugin-areas/
|
76 |
-
include_once '_admin-page-settings-plugin-areas/
|
77 |
include_once '_admin-page-settings-plugin-areas/_common-files-unload.php';
|
78 |
include_once '_admin-page-settings-plugin-areas/_html-source-cleanup.php';
|
79 |
include_once '_admin-page-settings-plugin-areas/_fonts-local.php';
|
@@ -85,10 +115,10 @@ if ($showSettingsType === 'tabs') {
|
|
85 |
</div>
|
86 |
|
87 |
<div id="wpacu-update-button-area">
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
<div id="wpacu-updating-settings">
|
93 |
<img src="<?php echo admin_url(); ?>/images/spinner.gif" align="top" width="20" height="20" alt="" />
|
94 |
</div>
|
8 |
|
9 |
include_once '_top-area.php';
|
10 |
|
11 |
+
if (! defined('WPACU_USE_MODAL_BOX')) {
|
12 |
+
define('WPACU_USE_MODAL_BOX', true);
|
13 |
+
}
|
14 |
+
|
15 |
// [wpacu_lite]
|
16 |
$availableForPro = '<a href="'.WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_settings" class="go-pro-link-no-style"><span class="wpacu-tooltip">'.__('Available for Pro users', 'wp-asset-clean-up').'<br />'.__('Buy now to unlock all features!', 'wp-asset-clean-up').'</span> <img width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" /></a> ';
|
17 |
$settingsWithLock = '<em><strong>'.__('Note', 'wp-asset-clean-up').':</strong> '.__('The settings that have a lock are available to Pro users.', 'wp-asset-clean-up').' <a href="' . WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_settings">'.__('Click here to upgrade!', 'wp-asset-clean-up').'</a></em>';
|
30 |
'wpacu-setting-strip-the-fat' => __( 'Stripping the "fat"', 'wp-asset-clean-up' ) . ' ' . $wikiStatus,
|
31 |
'wpacu-setting-plugin-usage-settings' => __( 'Plugin Usage Preferences', 'wp-asset-clean-up' ),
|
32 |
'wpacu-setting-test-mode' => __( 'Test Mode', 'wp-asset-clean-up' ),
|
33 |
+
'wpacu-setting-optimize-css' => __( 'Optimize CSS', 'wp-asset-clean-up' ),
|
34 |
+
'wpacu-setting-optimize-js' => __( 'Optimize JavaScript', 'wp-asset-clean-up' ),
|
35 |
'wpacu-setting-common-files-unload' => __( 'Site-Wide Common Unloads', 'wp-asset-clean-up' ),
|
36 |
'wpacu-setting-html-source-cleanup' => __( 'HTML Source CleanUp', 'wp-asset-clean-up' ),
|
37 |
'wpacu-setting-local-fonts' => __( 'Local Fonts', 'wp-asset-clean-up' ),
|
62 |
<?php if ($showSettingsType === 'tabs') { ?>
|
63 |
<div class="wpacu-settings-tab">
|
64 |
<?php
|
65 |
+
$wpacuOptionOn = '<span class="wpacu-circle-status wpacu-on"></span>';
|
66 |
+
$wpacuOptionOff = '<span class="wpacu-circle-status wpacu-off"></span>';
|
67 |
+
|
68 |
+
foreach ($settingsTabs as $settingsTabKey => $settingsTabText) {
|
69 |
+
$wpacuActiveTab = ($settingsTabActive === $settingsTabKey) ? 'active' : '';
|
70 |
+
$wpacuNavTextSub = '';
|
71 |
+
|
72 |
+
if ($settingsTabKey === 'wpacu-setting-optimize-css') {
|
73 |
+
$cssMinifyStatus = ($data['minify_loaded_css'] == 1 && empty($data['is_optimize_css_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
|
74 |
+
$cssCombineStatus = ($data['combine_loaded_css'] == 1 && empty($data['is_optimize_css_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
|
75 |
+
$wpacuNavTextSub = '<div class="wpacu-tab-extra-text"><small><span class="wpacu-status-wrap" data-linked-to="wpacu_minify_css_enable">' . $cssMinifyStatus . ' '.__('Minify', 'wp-asset-clean-up').'</span> <span class="wpacu-status-wrap" data-linked-to="wpacu_combine_loaded_css_enable">' . $cssCombineStatus . ' '.__('Combine', 'wp-asset-clean-up').'</span></small></div>';
|
76 |
+
|
77 |
+
if (! empty($data['is_optimize_css_enabled_by_other_party'])) {
|
78 |
+
$wpacuNavTextSub .= '<div style="margin-top: 3px;"><small style="font-weight: lighter; color: gray;"><strong>Status:</strong> Locked, already enabled in other plugin(s)</small></div>';
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
if ($settingsTabKey === 'wpacu-setting-optimize-js') {
|
83 |
+
$jsMinifyStatus = ($data['minify_loaded_js'] == 1 && empty($data['is_optimize_js_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
|
84 |
+
$jsCombineStatus = ($data['combine_loaded_js'] == 1 && empty($data['is_optimize_js_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
|
85 |
+
$wpacuNavTextSub = '<div class="wpacu-tab-extra-text"><small><span class="wpacu-status-wrap" data-linked-to="wpacu_minify_js_enable">' . $jsMinifyStatus . ' '.__('Minify', 'wp-asset-clean-up').'</span> <span class="wpacu-status-wrap" data-linked-to="wpacu_combine_loaded_js_enable">' . $jsCombineStatus . ' '.__('Combine', 'wp-asset-clean-up').'</span></small></div>';
|
86 |
+
|
87 |
+
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
|
88 |
+
$wpacuNavTextSub .= '<div style="margin-top: 3px;"><small style="font-weight: lighter; color: gray;"><strong>Status:</strong> Locked, already enabled in other plugin(s)</small></div>';
|
89 |
+
}
|
90 |
+
}
|
91 |
?>
|
92 |
+
<a href="#<?php echo $settingsTabKey; ?>"
|
93 |
+
class="wpacu-settings-tab-link <?php echo $wpacuActiveTab; ?>"
|
94 |
+
onclick="wpacuTabOpenSettingsArea(event, '<?php echo $settingsTabKey; ?>');"><?php echo $settingsTabText . $wpacuNavTextSub; ?></a>
|
95 |
<?php
|
96 |
}
|
97 |
?>
|
102 |
include_once '_admin-page-settings-plugin-areas/_strip-the-fat.php';
|
103 |
include_once '_admin-page-settings-plugin-areas/_plugin-usage-settings.php';
|
104 |
include_once '_admin-page-settings-plugin-areas/_test-mode.php';
|
105 |
+
include_once '_admin-page-settings-plugin-areas/_optimize-css.php';
|
106 |
+
include_once '_admin-page-settings-plugin-areas/_optimize-js.php';
|
107 |
include_once '_admin-page-settings-plugin-areas/_common-files-unload.php';
|
108 |
include_once '_admin-page-settings-plugin-areas/_html-source-cleanup.php';
|
109 |
include_once '_admin-page-settings-plugin-areas/_fonts-local.php';
|
115 |
</div>
|
116 |
|
117 |
<div id="wpacu-update-button-area">
|
118 |
+
<?php
|
119 |
+
wp_nonce_field('wpacu_settings_update', 'wpacu_settings_nonce');
|
120 |
+
submit_button(__('Update All Settings', 'wp-asset-clean-up'));
|
121 |
+
?>
|
122 |
<div id="wpacu-updating-settings">
|
123 |
<img src="<?php echo admin_url(); ?>/images/spinner.gif" align="top" width="20" height="20" alt="" />
|
124 |
</div>
|
vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit2aa81088f2917c34e131d918b4bea540::getLoader();
|
vendor/bin/minifycss
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
use MatthiasMullie\Minify;
|
4 |
+
|
5 |
+
// command line utility to minify CSS
|
6 |
+
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
7 |
+
// if composer install
|
8 |
+
require_once __DIR__ . '/../../../autoload.php';
|
9 |
+
} else {
|
10 |
+
require_once __DIR__ . '/../src/Minify.php';
|
11 |
+
require_once __DIR__ . '/../src/CSS.php';
|
12 |
+
require_once __DIR__ . '/../src/Exception.php';
|
13 |
+
}
|
14 |
+
|
15 |
+
error_reporting(E_ALL);
|
16 |
+
// check PHP setup for cli arguments
|
17 |
+
if (!isset($_SERVER['argv']) && !isset($argv)) {
|
18 |
+
fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
|
19 |
+
exit(1);
|
20 |
+
} elseif (!isset($argv)) {
|
21 |
+
$argv = $_SERVER['argv'];
|
22 |
+
}
|
23 |
+
// check if path to file given
|
24 |
+
if (!isset($argv[1])) {
|
25 |
+
fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
|
26 |
+
exit(1);
|
27 |
+
}
|
28 |
+
// check if script run in cli environment
|
29 |
+
if ('cli' !== php_sapi_name()) {
|
30 |
+
fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
|
31 |
+
exit(1);
|
32 |
+
}
|
33 |
+
// check if source file exists
|
34 |
+
if (!file_exists($argv[1])) {
|
35 |
+
fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
|
36 |
+
exit(1);
|
37 |
+
}
|
38 |
+
|
39 |
+
try {
|
40 |
+
$minifier = new Minify\CSS($argv[1]);
|
41 |
+
echo $minifier->minify();
|
42 |
+
} catch (Exception $e) {
|
43 |
+
fwrite(STDERR, $e->getMessage(), PHP_EOL);
|
44 |
+
exit(1);
|
45 |
+
}
|
vendor/bin/minifyjs
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
use MatthiasMullie\Minify;
|
4 |
+
|
5 |
+
// command line utility to minify JS
|
6 |
+
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
7 |
+
// if composer install
|
8 |
+
require_once __DIR__ . '/../../../autoload.php';
|
9 |
+
} else {
|
10 |
+
require_once __DIR__ . '/../src/Minify.php';
|
11 |
+
require_once __DIR__ . '/../src/JS.php';
|
12 |
+
require_once __DIR__ . '/../src/Exception.php';
|
13 |
+
}
|
14 |
+
|
15 |
+
error_reporting(E_ALL);
|
16 |
+
// check PHP setup for cli arguments
|
17 |
+
if (!isset($_SERVER['argv']) && !isset($argv)) {
|
18 |
+
fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
|
19 |
+
exit(1);
|
20 |
+
} elseif (!isset($argv)) {
|
21 |
+
$argv = $_SERVER['argv'];
|
22 |
+
}
|
23 |
+
// check if path to file given
|
24 |
+
if (!isset($argv[1])) {
|
25 |
+
fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
|
26 |
+
exit(1);
|
27 |
+
}
|
28 |
+
// check if script run in cli environment
|
29 |
+
if ('cli' !== php_sapi_name()) {
|
30 |
+
fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
|
31 |
+
exit(1);
|
32 |
+
}
|
33 |
+
// check if source file exists
|
34 |
+
if (!file_exists($argv[1])) {
|
35 |
+
fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
|
36 |
+
exit(1);
|
37 |
+
}
|
38 |
+
|
39 |
+
try {
|
40 |
+
$minifier = new Minify\JS($argv[1]);
|
41 |
+
echo $minifier->minify();
|
42 |
+
} catch (Exception $e) {
|
43 |
+
fwrite(STDERR, $e->getMessage(), PHP_EOL);
|
44 |
+
exit(1);
|
45 |
+
}
|
vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
private $classMapAuthoritative = false;
|
57 |
+
private $missingClasses = array();
|
58 |
+
private $apcuPrefix;
|
59 |
+
|
60 |
+
public function getPrefixes()
|
61 |
+
{
|
62 |
+
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
+
}
|
65 |
+
|
66 |
+
return array();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixesPsr4()
|
70 |
+
{
|
71 |
+
return $this->prefixDirsPsr4;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFallbackDirs()
|
75 |
+
{
|
76 |
+
return $this->fallbackDirsPsr0;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getFallbackDirsPsr4()
|
80 |
+
{
|
81 |
+
return $this->fallbackDirsPsr4;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getClassMap()
|
85 |
+
{
|
86 |
+
return $this->classMap;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $classMap Class to filename map
|
91 |
+
*/
|
92 |
+
public function addClassMap(array $classMap)
|
93 |
+
{
|
94 |
+
if ($this->classMap) {
|
95 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
+
} else {
|
97 |
+
$this->classMap = $classMap;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
+
* appending or prepending to the ones previously set for this prefix.
|
104 |
+
*
|
105 |
+
* @param string $prefix The prefix
|
106 |
+
* @param array|string $paths The PSR-0 root directories
|
107 |
+
* @param bool $prepend Whether to prepend the directories
|
108 |
+
*/
|
109 |
+
public function add($prefix, $paths, $prepend = false)
|
110 |
+
{
|
111 |
+
if (!$prefix) {
|
112 |
+
if ($prepend) {
|
113 |
+
$this->fallbackDirsPsr0 = array_merge(
|
114 |
+
(array) $paths,
|
115 |
+
$this->fallbackDirsPsr0
|
116 |
+
);
|
117 |
+
} else {
|
118 |
+
$this->fallbackDirsPsr0 = array_merge(
|
119 |
+
$this->fallbackDirsPsr0,
|
120 |
+
(array) $paths
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$first = $prefix[0];
|
128 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
+
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
if ($prepend) {
|
134 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
+
(array) $paths,
|
136 |
+
$this->prefixesPsr0[$first][$prefix]
|
137 |
+
);
|
138 |
+
} else {
|
139 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
+
$this->prefixesPsr0[$first][$prefix],
|
141 |
+
(array) $paths
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
+
* appending or prepending to the ones previously set for this namespace.
|
149 |
+
*
|
150 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
+
* @param array|string $paths The PSR-4 base directories
|
152 |
+
* @param bool $prepend Whether to prepend the directories
|
153 |
+
*
|
154 |
+
* @throws \InvalidArgumentException
|
155 |
+
*/
|
156 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
+
{
|
158 |
+
if (!$prefix) {
|
159 |
+
// Register directories for the root namespace.
|
160 |
+
if ($prepend) {
|
161 |
+
$this->fallbackDirsPsr4 = array_merge(
|
162 |
+
(array) $paths,
|
163 |
+
$this->fallbackDirsPsr4
|
164 |
+
);
|
165 |
+
} else {
|
166 |
+
$this->fallbackDirsPsr4 = array_merge(
|
167 |
+
$this->fallbackDirsPsr4,
|
168 |
+
(array) $paths
|
169 |
+
);
|
170 |
+
}
|
171 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
+
// Register directories for a new namespace.
|
173 |
+
$length = strlen($prefix);
|
174 |
+
if ('\\' !== $prefix[$length - 1]) {
|
175 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
+
}
|
177 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
+
} elseif ($prepend) {
|
180 |
+
// Prepend directories for an already registered namespace.
|
181 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
+
(array) $paths,
|
183 |
+
$this->prefixDirsPsr4[$prefix]
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
// Append directories for an already registered namespace.
|
187 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
+
$this->prefixDirsPsr4[$prefix],
|
189 |
+
(array) $paths
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
+
* replacing any others previously set for this prefix.
|
197 |
+
*
|
198 |
+
* @param string $prefix The prefix
|
199 |
+
* @param array|string $paths The PSR-0 base directories
|
200 |
+
*/
|
201 |
+
public function set($prefix, $paths)
|
202 |
+
{
|
203 |
+
if (!$prefix) {
|
204 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
+
} else {
|
206 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
+
* replacing any others previously set for this namespace.
|
213 |
+
*
|
214 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
+
* @param array|string $paths The PSR-4 base directories
|
216 |
+
*
|
217 |
+
* @throws \InvalidArgumentException
|
218 |
+
*/
|
219 |
+
public function setPsr4($prefix, $paths)
|
220 |
+
{
|
221 |
+
if (!$prefix) {
|
222 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
+
} else {
|
224 |
+
$length = strlen($prefix);
|
225 |
+
if ('\\' !== $prefix[$length - 1]) {
|
226 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
+
}
|
228 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Turns on searching the include path for class files.
|
235 |
+
*
|
236 |
+
* @param bool $useIncludePath
|
237 |
+
*/
|
238 |
+
public function setUseIncludePath($useIncludePath)
|
239 |
+
{
|
240 |
+
$this->useIncludePath = $useIncludePath;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Can be used to check if the autoloader uses the include path to check
|
245 |
+
* for classes.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function getUseIncludePath()
|
250 |
+
{
|
251 |
+
return $this->useIncludePath;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Turns off searching the prefix and fallback directories for classes
|
256 |
+
* that have not been registered with the class map.
|
257 |
+
*
|
258 |
+
* @param bool $classMapAuthoritative
|
259 |
+
*/
|
260 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
+
{
|
262 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Should class lookup fail if not found in the current class map?
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
public function isClassMapAuthoritative()
|
271 |
+
{
|
272 |
+
return $this->classMapAuthoritative;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
+
*
|
278 |
+
* @param string|null $apcuPrefix
|
279 |
+
*/
|
280 |
+
public function setApcuPrefix($apcuPrefix)
|
281 |
+
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
+
*
|
288 |
+
* @return string|null
|
289 |
+
*/
|
290 |
+
public function getApcuPrefix()
|
291 |
+
{
|
292 |
+
return $this->apcuPrefix;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Registers this instance as an autoloader.
|
297 |
+
*
|
298 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
+
*/
|
300 |
+
public function register($prepend = false)
|
301 |
+
{
|
302 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Unregisters this instance as an autoloader.
|
307 |
+
*/
|
308 |
+
public function unregister()
|
309 |
+
{
|
310 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads the given class or interface.
|
315 |
+
*
|
316 |
+
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
+
*/
|
319 |
+
public function loadClass($class)
|
320 |
+
{
|
321 |
+
if ($file = $this->findFile($class)) {
|
322 |
+
includeFile($file);
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Finds the path to the file where the class is defined.
|
330 |
+
*
|
331 |
+
* @param string $class The name of the class
|
332 |
+
*
|
333 |
+
* @return string|false The path if found, false otherwise
|
334 |
+
*/
|
335 |
+
public function findFile($class)
|
336 |
+
{
|
337 |
+
// class map lookup
|
338 |
+
if (isset($this->classMap[$class])) {
|
339 |
+
return $this->classMap[$class];
|
340 |
+
}
|
341 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (null !== $this->apcuPrefix) {
|
345 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
+
if ($hit) {
|
347 |
+
return $file;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
$file = $this->findFileWithExtension($class, '.php');
|
352 |
+
|
353 |
+
// Search for Hack files if we are running on HHVM
|
354 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
+
}
|
357 |
+
|
358 |
+
if (null !== $this->apcuPrefix) {
|
359 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
+
}
|
361 |
+
|
362 |
+
if (false === $file) {
|
363 |
+
// Remember that this class does not exist.
|
364 |
+
$this->missingClasses[$class] = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
return $file;
|
368 |
+
}
|
369 |
+
|
370 |
+
private function findFileWithExtension($class, $ext)
|
371 |
+
{
|
372 |
+
// PSR-4 lookup
|
373 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
+
|
375 |
+
$first = $class[0];
|
376 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
+
$subPath = $class;
|
378 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
+
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath.'\\';
|
381 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
383 |
+
$length = $this->prefixLengthsPsr4[$first][$search];
|
384 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
385 |
+
return $file;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// PSR-4 fallback dirs
|
393 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
+
return $file;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// PSR-0 lookup
|
400 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
+
// namespaced class name
|
402 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
+
} else {
|
405 |
+
// PEAR-like class name
|
406 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (isset($this->prefixesPsr0[$first])) {
|
410 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
+
if (0 === strpos($class, $prefix)) {
|
412 |
+
foreach ($dirs as $dir) {
|
413 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
+
return $file;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
// PSR-0 fallback dirs
|
422 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
+
return $file;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-0 include paths.
|
429 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
+
return $file;
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Scope isolated include.
|
439 |
+
*
|
440 |
+
* Prevents access to $this/self from included files.
|
441 |
+
*/
|
442 |
+
function includeFile($file)
|
443 |
+
{
|
444 |
+
include $file;
|
445 |
+
}
|
vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
10 |
+
'MatthiasMullie\\PathConverter\\' => array($vendorDir . '/matthiasmullie/path-converter/src'),
|
11 |
+
'MatthiasMullie\\Minify\\' => array($baseDir . '/src', $vendorDir . '/matthiasmullie/minify/src'),
|
12 |
+
);
|
vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit2aa81088f2917c34e131d918b4bea540
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit2aa81088f2917c34e131d918b4bea540', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit2aa81088f2917c34e131d918b4bea540', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
+
if ($useStaticLoader) {
|
28 |
+
require_once __DIR__ . '/autoload_static.php';
|
29 |
+
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit2aa81088f2917c34e131d918b4bea540::getInitializer($loader));
|
31 |
+
} else {
|
32 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
+
foreach ($map as $namespace => $path) {
|
34 |
+
$loader->set($namespace, $path);
|
35 |
+
}
|
36 |
+
|
37 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
+
foreach ($map as $namespace => $path) {
|
39 |
+
$loader->setPsr4($namespace, $path);
|
40 |
+
}
|
41 |
+
|
42 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
+
if ($classMap) {
|
44 |
+
$loader->addClassMap($classMap);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$loader->register(true);
|
49 |
+
|
50 |
+
return $loader;
|
51 |
+
}
|
52 |
+
}
|
vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInit2aa81088f2917c34e131d918b4bea540
|
8 |
+
{
|
9 |
+
public static $prefixLengthsPsr4 = array (
|
10 |
+
'P' =>
|
11 |
+
array (
|
12 |
+
'Psr\\Cache\\' => 10,
|
13 |
+
),
|
14 |
+
'M' =>
|
15 |
+
array (
|
16 |
+
'MatthiasMullie\\PathConverter\\' => 29,
|
17 |
+
'MatthiasMullie\\Minify\\' => 22,
|
18 |
+
),
|
19 |
+
);
|
20 |
+
|
21 |
+
public static $prefixDirsPsr4 = array (
|
22 |
+
'Psr\\Cache\\' =>
|
23 |
+
array (
|
24 |
+
0 => __DIR__ . '/..' . '/psr/cache/src',
|
25 |
+
),
|
26 |
+
'MatthiasMullie\\PathConverter\\' =>
|
27 |
+
array (
|
28 |
+
0 => __DIR__ . '/..' . '/matthiasmullie/path-converter/src',
|
29 |
+
),
|
30 |
+
'MatthiasMullie\\Minify\\' =>
|
31 |
+
array (
|
32 |
+
0 => __DIR__ . '/../..' . '/src',
|
33 |
+
1 => __DIR__ . '/..' . '/matthiasmullie/minify/src',
|
34 |
+
),
|
35 |
+
);
|
36 |
+
|
37 |
+
public static function getInitializer(ClassLoader $loader)
|
38 |
+
{
|
39 |
+
return \Closure::bind(function () use ($loader) {
|
40 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit2aa81088f2917c34e131d918b4bea540::$prefixLengthsPsr4;
|
41 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit2aa81088f2917c34e131d918b4bea540::$prefixDirsPsr4;
|
42 |
+
|
43 |
+
}, null, ClassLoader::class);
|
44 |
+
}
|
45 |
+
}
|
vendor/composer/installed.json
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "matthiasmullie/path-converter",
|
4 |
+
"version": "1.1.2",
|
5 |
+
"version_normalized": "1.1.2.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/matthiasmullie/path-converter.git",
|
9 |
+
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
|
14 |
+
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"ext-pcre": "*",
|
19 |
+
"php": ">=5.3.0"
|
20 |
+
},
|
21 |
+
"require-dev": {
|
22 |
+
"phpunit/phpunit": "~4.8"
|
23 |
+
},
|
24 |
+
"time": "2018-10-25T15:19:41+00:00",
|
25 |
+
"type": "library",
|
26 |
+
"installation-source": "dist",
|
27 |
+
"autoload": {
|
28 |
+
"psr-4": {
|
29 |
+
"MatthiasMullie\\PathConverter\\": "src/"
|
30 |
+
}
|
31 |
+
},
|
32 |
+
"notification-url": "https://packagist.org/downloads/",
|
33 |
+
"license": [
|
34 |
+
"MIT"
|
35 |
+
],
|
36 |
+
"authors": [
|
37 |
+
{
|
38 |
+
"name": "Matthias Mullie",
|
39 |
+
"role": "Developer",
|
40 |
+
"email": "pathconverter@mullie.eu",
|
41 |
+
"homepage": "http://www.mullie.eu"
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"description": "Relative path converter",
|
45 |
+
"homepage": "http://github.com/matthiasmullie/path-converter",
|
46 |
+
"keywords": [
|
47 |
+
"converter",
|
48 |
+
"path",
|
49 |
+
"paths",
|
50 |
+
"relative"
|
51 |
+
]
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"name": "matthiasmullie/minify",
|
55 |
+
"version": "1.3.61",
|
56 |
+
"version_normalized": "1.3.61.0",
|
57 |
+
"source": {
|
58 |
+
"type": "git",
|
59 |
+
"url": "https://github.com/matthiasmullie/minify.git",
|
60 |
+
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751"
|
61 |
+
},
|
62 |
+
"dist": {
|
63 |
+
"type": "zip",
|
64 |
+
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
|
65 |
+
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
|
66 |
+
"shasum": ""
|
67 |
+
},
|
68 |
+
"require": {
|
69 |
+
"ext-pcre": "*",
|
70 |
+
"matthiasmullie/path-converter": "~1.1",
|
71 |
+
"php": ">=5.3.0"
|
72 |
+
},
|
73 |
+
"require-dev": {
|
74 |
+
"friendsofphp/php-cs-fixer": "~2.0",
|
75 |
+
"matthiasmullie/scrapbook": "~1.0",
|
76 |
+
"phpunit/phpunit": "~4.8"
|
77 |
+
},
|
78 |
+
"suggest": {
|
79 |
+
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
80 |
+
},
|
81 |
+
"time": "2018-11-26T23:10:39+00:00",
|
82 |
+
"bin": [
|
83 |
+
"bin/minifycss",
|
84 |
+
"bin/minifyjs"
|
85 |
+
],
|
86 |
+
"type": "library",
|
87 |
+
"installation-source": "dist",
|
88 |
+
"autoload": {
|
89 |
+
"psr-4": {
|
90 |
+
"MatthiasMullie\\Minify\\": "src/"
|
91 |
+
}
|
92 |
+
},
|
93 |
+
"notification-url": "https://packagist.org/downloads/",
|
94 |
+
"license": [
|
95 |
+
"MIT"
|
96 |
+
],
|
97 |
+
"authors": [
|
98 |
+
{
|
99 |
+
"name": "Matthias Mullie",
|
100 |
+
"role": "Developer",
|
101 |
+
"email": "minify@mullie.eu",
|
102 |
+
"homepage": "http://www.mullie.eu"
|
103 |
+
}
|
104 |
+
],
|
105 |
+
"description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.",
|
106 |
+
"homepage": "http://www.minifier.org",
|
107 |
+
"keywords": [
|
108 |
+
"JS",
|
109 |
+
"css",
|
110 |
+
"javascript",
|
111 |
+
"minifier",
|
112 |
+
"minify"
|
113 |
+
]
|
114 |
+
},
|
115 |
+
{
|
116 |
+
"name": "psr/cache",
|
117 |
+
"version": "1.0.1",
|
118 |
+
"version_normalized": "1.0.1.0",
|
119 |
+
"source": {
|
120 |
+
"type": "git",
|
121 |
+
"url": "https://github.com/php-fig/cache.git",
|
122 |
+
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
|
123 |
+
},
|
124 |
+
"dist": {
|
125 |
+
"type": "zip",
|
126 |
+
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
|
127 |
+
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
|
128 |
+
"shasum": ""
|
129 |
+
},
|
130 |
+
"require": {
|
131 |
+
"php": ">=5.3.0"
|
132 |
+
},
|
133 |
+
"time": "2016-08-06T20:24:11+00:00",
|
134 |
+
"type": "library",
|
135 |
+
"extra": {
|
136 |
+
"branch-alias": {
|
137 |
+
"dev-master": "1.0.x-dev"
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"installation-source": "dist",
|
141 |
+
"autoload": {
|
142 |
+
"psr-4": {
|
143 |
+
"Psr\\Cache\\": "src/"
|
144 |
+
}
|
145 |
+
},
|
146 |
+
"notification-url": "https://packagist.org/downloads/",
|
147 |
+
"license": [
|
148 |
+
"MIT"
|
149 |
+
],
|
150 |
+
"authors": [
|
151 |
+
{
|
152 |
+
"name": "PHP-FIG",
|
153 |
+
"homepage": "http://www.php-fig.org/"
|
154 |
+
}
|
155 |
+
],
|
156 |
+
"description": "Common interface for caching libraries",
|
157 |
+
"keywords": [
|
158 |
+
"cache",
|
159 |
+
"psr",
|
160 |
+
"psr-6"
|
161 |
+
]
|
162 |
+
}
|
163 |
+
]
|
vendor/matthiasmullie/minify/CONTRIBUTING.md
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# How to contribute
|
2 |
+
|
3 |
+
|
4 |
+
## Issues
|
5 |
+
|
6 |
+
When [filing bugs](https://github.com/matthiasmullie/minify/issues/new),
|
7 |
+
try to be as thorough as possible:
|
8 |
+
* What version did you use?
|
9 |
+
* What did you try to do? ***Please post the relevant parts of your code.***
|
10 |
+
* What went wrong? ***Please include error messages, if any.***
|
11 |
+
* What was the expected result?
|
12 |
+
|
13 |
+
|
14 |
+
## Pull requests
|
15 |
+
|
16 |
+
Bug fixes and general improvements to the existing codebase are always welcome.
|
17 |
+
New features are also welcome, but will be judged on an individual basis. If
|
18 |
+
you'd rather not risk wasting your time implementing a new feature only to see
|
19 |
+
it turned down, please start the discussion by
|
20 |
+
[opening an issue](https://github.com/matthiasmullie/minify/issues/new).
|
21 |
+
|
22 |
+
Don't forget to add your changes to the [changelog](CHANGELOG.md).
|
23 |
+
|
24 |
+
|
25 |
+
### Testing
|
26 |
+
|
27 |
+
Please include tests for every change or addition to the code.
|
28 |
+
To run the complete test suite:
|
29 |
+
|
30 |
+
```sh
|
31 |
+
vendor/bin/phpunit
|
32 |
+
```
|
33 |
+
|
34 |
+
When submitting a new pull request, please make sure that that the test suite
|
35 |
+
passes (Travis CI will run it & report back on your pull request.)
|
36 |
+
|
37 |
+
To run the tests on Windows, run `tests/convert_symlinks_to_windows_style.sh`
|
38 |
+
from the command line in order to convert Linux-style test symlinks to
|
39 |
+
Windows-style.
|
40 |
+
|
41 |
+
|
42 |
+
### Coding standards
|
43 |
+
|
44 |
+
All code must follow [PSR-2](http://www.php-fig.org/psr/psr-2/). Just make sure
|
45 |
+
to run php-cs-fixer before submitting the code, it'll take care of the
|
46 |
+
formatting for you:
|
47 |
+
|
48 |
+
```sh
|
49 |
+
vendor/bin/php-cs-fixer fix src
|
50 |
+
vendor/bin/php-cs-fixer fix tests
|
51 |
+
```
|
52 |
+
|
53 |
+
Document the code thoroughly!
|
54 |
+
|
55 |
+
|
56 |
+
## License
|
57 |
+
|
58 |
+
Note that minify is MIT-licensed, which basically allows anyone to do
|
59 |
+
anything they like with it, without restriction.
|
vendor/matthiasmullie/minify/Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ARG version=cli
|
2 |
+
FROM php:$version
|
3 |
+
|
4 |
+
COPY . /var/www
|
5 |
+
WORKDIR /var/www
|
6 |
+
|
7 |
+
RUN apt-get update
|
8 |
+
RUN apt-get install -y zip unzip zlib1g-dev
|
9 |
+
RUN docker-php-ext-install zip
|
10 |
+
RUN docker-php-ext-install pcntl
|
11 |
+
RUN curl -sS https://getcomposer.org/installer | php
|
12 |
+
RUN mv composer.phar /usr/local/bin/composer
|
13 |
+
RUN composer install
|
vendor/matthiasmullie/minify/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2012 Matthias Mullie
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4 |
+
this software and associated documentation files (the "Software"), to deal in
|
5 |
+
the Software without restriction, including without limitation the rights to
|
6 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8 |
+
subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
vendor/matthiasmullie/minify/bin/minifycss
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
use MatthiasMullie\Minify;
|
4 |
+
|
5 |
+
// command line utility to minify CSS
|
6 |
+
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
7 |
+
// if composer install
|
8 |
+
require_once __DIR__ . '/../../../autoload.php';
|
9 |
+
} else {
|
10 |
+
require_once __DIR__ . '/../src/Minify.php';
|
11 |
+
require_once __DIR__ . '/../src/CSS.php';
|
12 |
+
require_once __DIR__ . '/../src/Exception.php';
|
13 |
+
}
|
14 |
+
|
15 |
+
error_reporting(E_ALL);
|
16 |
+
// check PHP setup for cli arguments
|
17 |
+
if (!isset($_SERVER['argv']) && !isset($argv)) {
|
18 |
+
fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
|
19 |
+
exit(1);
|
20 |
+
} elseif (!isset($argv)) {
|
21 |
+
$argv = $_SERVER['argv'];
|
22 |
+
}
|
23 |
+
// check if path to file given
|
24 |
+
if (!isset($argv[1])) {
|
25 |
+
fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
|
26 |
+
exit(1);
|
27 |
+
}
|
28 |
+
// check if script run in cli environment
|
29 |
+
if ('cli' !== php_sapi_name()) {
|
30 |
+
fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
|
31 |
+
exit(1);
|
32 |
+
}
|
33 |
+
// check if source file exists
|
34 |
+
if (!file_exists($argv[1])) {
|
35 |
+
fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
|
36 |
+
exit(1);
|
37 |
+
}
|
38 |
+
|
39 |
+
try {
|
40 |
+
$minifier = new Minify\CSS($argv[1]);
|
41 |
+
echo $minifier->minify();
|
42 |
+
} catch (Exception $e) {
|
43 |
+
fwrite(STDERR, $e->getMessage(), PHP_EOL);
|
44 |
+
exit(1);
|
45 |
+
}
|
vendor/matthiasmullie/minify/bin/minifyjs
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
use MatthiasMullie\Minify;
|
4 |
+
|
5 |
+
// command line utility to minify JS
|
6 |
+
if (file_exists(__DIR__ . '/../../../autoload.php')) {
|
7 |
+
// if composer install
|
8 |
+
require_once __DIR__ . '/../../../autoload.php';
|
9 |
+
} else {
|
10 |
+
require_once __DIR__ . '/../src/Minify.php';
|
11 |
+
require_once __DIR__ . '/../src/JS.php';
|
12 |
+
require_once __DIR__ . '/../src/Exception.php';
|
13 |
+
}
|
14 |
+
|
15 |
+
error_reporting(E_ALL);
|
16 |
+
// check PHP setup for cli arguments
|
17 |
+
if (!isset($_SERVER['argv']) && !isset($argv)) {
|
18 |
+
fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
|
19 |
+
exit(1);
|
20 |
+
} elseif (!isset($argv)) {
|
21 |
+
$argv = $_SERVER['argv'];
|
22 |
+
}
|
23 |
+
// check if path to file given
|
24 |
+
if (!isset($argv[1])) {
|
25 |
+
fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
|
26 |
+
exit(1);
|
27 |
+
}
|
28 |
+
// check if script run in cli environment
|
29 |
+
if ('cli' !== php_sapi_name()) {
|
30 |
+
fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
|
31 |
+
exit(1);
|
32 |
+
}
|
33 |
+
// check if source file exists
|
34 |
+
if (!file_exists($argv[1])) {
|
35 |
+
fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
|
36 |
+
exit(1);
|
37 |
+
}
|
38 |
+
|
39 |
+
try {
|
40 |
+
$minifier = new Minify\JS($argv[1]);
|
41 |
+
echo $minifier->minify();
|
42 |
+
} catch (Exception $e) {
|
43 |
+
fwrite(STDERR, $e->getMessage(), PHP_EOL);
|
44 |
+
exit(1);
|
45 |
+
}
|
vendor/matthiasmullie/minify/composer.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "matthiasmullie/minify",
|
3 |
+
"type": "library",
|
4 |
+
"description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.",
|
5 |
+
"keywords": ["minify", "minifier", "css", "js", "javascript"],
|
6 |
+
"homepage": "http://www.minifier.org",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Matthias Mullie",
|
11 |
+
"homepage": "http://www.mullie.eu",
|
12 |
+
"email": "minify@mullie.eu",
|
13 |
+
"role": "Developer"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"require": {
|
17 |
+
"php": ">=5.3.0",
|
18 |
+
"ext-pcre": "*",
|
19 |
+
"matthiasmullie/path-converter": "~1.1"
|
20 |
+
},
|
21 |
+
"require-dev": {
|
22 |
+
"matthiasmullie/scrapbook": "~1.0",
|
23 |
+
"phpunit/phpunit": "~4.8",
|
24 |
+
"friendsofphp/php-cs-fixer": "~2.0"
|
25 |
+
},
|
26 |
+
"suggest": {
|
27 |
+
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
28 |
+
},
|
29 |
+
"autoload": {
|
30 |
+
"psr-4": {
|
31 |
+
"MatthiasMullie\\Minify\\": "src/"
|
32 |
+
}
|
33 |
+
},
|
34 |
+
"bin": [
|
35 |
+
"bin/minifycss",
|
36 |
+
"bin/minifyjs"
|
37 |
+
]
|
38 |
+
}
|
vendor/matthiasmullie/minify/data/js/keywords_after.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
in
|
2 |
+
public
|
3 |
+
extends
|
4 |
+
private
|
5 |
+
protected
|
6 |
+
implements
|
7 |
+
instanceof
|
vendor/matthiasmullie/minify/data/js/keywords_before.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
do
|
2 |
+
in
|
3 |
+
let
|
4 |
+
new
|
5 |
+
var
|
6 |
+
case
|
7 |
+
else
|
8 |
+
enum
|
9 |
+
void
|
10 |
+
with
|
11 |
+
class
|
12 |
+
const
|
13 |
+
yield
|
14 |
+
delete
|
15 |
+
export
|
16 |
+
import
|
17 |
+
public
|
18 |
+
static
|
19 |
+
typeof
|
20 |
+
extends
|
21 |
+
package
|
22 |
+
private
|
23 |
+
function
|
24 |
+
protected
|
25 |
+
implements
|
26 |
+
instanceof
|
vendor/matthiasmullie/minify/data/js/keywords_reserved.txt
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
do
|
2 |
+
if
|
3 |
+
in
|
4 |
+
for
|
5 |
+
let
|
6 |
+
new
|
7 |
+
try
|
8 |
+
var
|
9 |
+
case
|
10 |
+
else
|
11 |
+
enum
|
12 |
+
eval
|
13 |
+
null
|
14 |
+
this
|
15 |
+
true
|
16 |
+
void
|
17 |
+
with
|
18 |
+
break
|
19 |
+
catch
|
20 |
+
class
|
21 |
+
const
|
22 |
+
false
|
23 |
+
super
|
24 |
+
throw
|
25 |
+
while
|
26 |
+
yield
|
27 |
+
delete
|
28 |
+
export
|
29 |
+
import
|
30 |
+
public
|
31 |
+
return
|
32 |
+
static
|
33 |
+
switch
|
34 |
+
typeof
|
35 |
+
default
|
36 |
+
extends
|
37 |
+
finally
|
38 |
+
package
|
39 |
+
private
|
40 |
+
continue
|
41 |
+
debugger
|
42 |
+
function
|
43 |
+
arguments
|
44 |
+
interface
|
45 |
+
protected
|
46 |
+
implements
|
47 |
+
instanceof
|
48 |
+
abstract
|
49 |
+
boolean
|
50 |
+
byte
|
51 |
+
char
|
52 |
+
double
|
53 |
+
final
|
54 |
+
float
|
55 |
+
goto
|
56 |
+
int
|
57 |
+
long
|
58 |
+
native
|
59 |
+
short
|
60 |
+
synchronized
|
61 |
+
throws
|
62 |
+
transient
|
63 |
+
volatile
|
vendor/matthiasmullie/minify/data/js/operators.txt
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
+
|
2 |
+
-
|
3 |
+
*
|
4 |
+
/
|
5 |
+
%
|
6 |
+
=
|
7 |
+
+=
|
8 |
+
-=
|
9 |
+
*=
|
10 |
+
/=
|
11 |
+
%=
|
12 |
+
<<=
|
13 |
+
>>=
|
14 |
+
>>>=
|
15 |
+
&=
|
16 |
+
^=
|
17 |
+
|=
|
18 |
+
&
|
19 |
+
|
|
20 |
+
^
|
21 |
+
~
|
22 |
+
<<
|
23 |
+
>>
|
24 |
+
>>>
|
25 |
+
==
|
26 |
+
===
|
27 |
+
!=
|
28 |
+
!==
|
29 |
+
>
|
30 |
+
<
|
31 |
+
>=
|
32 |
+
<=
|
33 |
+
&&
|
34 |
+
||
|
35 |
+
!
|
36 |
+
.
|
37 |
+
[
|
38 |
+
]
|
39 |
+
?
|
40 |
+
:
|
41 |
+
,
|
42 |
+
;
|
43 |
+
(
|
44 |
+
)
|
45 |
+
{
|
46 |
+
}
|
vendor/matthiasmullie/minify/data/js/operators_after.txt
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
+
|
2 |
+
-
|
3 |
+
*
|
4 |
+
/
|
5 |
+
%
|
6 |
+
=
|
7 |
+
+=
|
8 |
+
-=
|
9 |
+
*=
|
10 |
+
/=
|
11 |
+
%=
|
12 |
+
<<=
|
13 |
+
>>=
|
14 |
+
>>>=
|
15 |
+
&=
|
16 |
+
^=
|
17 |
+
|=
|
18 |
+
&
|
19 |
+
|
|
20 |
+
^
|
21 |
+
<<
|
22 |
+
>>
|
23 |
+
>>>
|
24 |
+
==
|
25 |
+
===
|
26 |
+
!=
|
27 |
+
!==
|
28 |
+
>
|
29 |
+
<
|
30 |
+
>=
|
31 |
+
<=
|
32 |
+
&&
|
33 |
+
||
|
34 |
+
.
|
35 |
+
[
|
36 |
+
]
|
37 |
+
?
|
38 |
+
:
|
39 |
+
,
|
40 |
+
;
|
41 |
+
(
|
42 |
+
)
|
43 |
+
}
|
vendor/matthiasmullie/minify/data/js/operators_before.txt
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
+
|
2 |
+
-
|
3 |
+
*
|
4 |
+
/
|
5 |
+
%
|
6 |
+
=
|
7 |
+
+=
|
8 |
+
-=
|
9 |
+
*=
|
10 |
+
/=
|
11 |
+
%=
|
12 |
+
<<=
|
13 |
+
>>=
|
14 |
+
>>>=
|
15 |
+
&=
|
16 |
+
^=
|
17 |
+
|=
|
18 |
+
&
|
19 |
+
|
|
20 |
+
^
|
21 |
+
~
|
22 |
+
<<
|
23 |
+
>>
|
24 |
+
>>>
|
25 |
+
==
|
26 |
+
===
|
27 |
+
!=
|
28 |
+
!==
|
29 |
+
>
|
30 |
+
<
|
31 |
+
>=
|
32 |
+
<=
|
33 |
+
&&
|
34 |
+
||
|
35 |
+
!
|
36 |
+
.
|
37 |
+
[
|
38 |
+
?
|
39 |
+
:
|
40 |
+
,
|
41 |
+
;
|
42 |
+
(
|
43 |
+
{
|
vendor/matthiasmullie/minify/docker-compose.yml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '2.1'
|
2 |
+
services:
|
3 |
+
php:
|
4 |
+
build:
|
5 |
+
context: .
|
6 |
+
dockerfile: Dockerfile
|
7 |
+
volumes:
|
8 |
+
- ./src:/var/www/src
|
9 |
+
- ./data:/var/www/data
|
10 |
+
- ./tests:/var/www/tests
|
11 |
+
- ./phpunit.xml.dist:/var/www/phpunit.xml.dist
|
12 |
+
'7.2':
|
13 |
+
extends: php
|
14 |
+
build:
|
15 |
+
args:
|
16 |
+
version: 7.2-cli
|
17 |
+
'7.1':
|
18 |
+
extends: php
|
19 |
+
build:
|
20 |
+
args:
|
21 |
+
version: 7.1-cli
|
22 |
+
'7.0':
|
23 |
+
extends: php
|
24 |
+
build:
|
25 |
+
args:
|
26 |
+
version: 7.0-cli
|
27 |
+
'5.6':
|
28 |
+
extends: php
|
29 |
+
build:
|
30 |
+
args:
|
31 |
+
version: 5.6-cli
|
vendor/matthiasmullie/minify/src/CSS.php
ADDED
@@ -0,0 +1,751 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CSS Minifier
|
4 |
+
*
|
5 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
9 |
+
* @license MIT License
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace MatthiasMullie\Minify;
|
13 |
+
|
14 |
+
use MatthiasMullie\Minify\Exceptions\FileImportException;
|
15 |
+
use MatthiasMullie\PathConverter\ConverterInterface;
|
16 |
+
use MatthiasMullie\PathConverter\Converter;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* CSS minifier
|
20 |
+
*
|
21 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
22 |
+
*
|
23 |
+
* @package Minify
|
24 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
25 |
+
* @author Tijs Verkoyen <minify@verkoyen.eu>
|
26 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
27 |
+
* @license MIT License
|
28 |
+
*/
|
29 |
+
class CSS extends Minify
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @var int maximum inport size in kB
|
33 |
+
*/
|
34 |
+
protected $maxImportSize = 5;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var string[] valid import extensions
|
38 |
+
*/
|
39 |
+
protected $importExtensions = array(
|
40 |
+
'gif' => 'data:image/gif',
|
41 |
+
'png' => 'data:image/png',
|
42 |
+
'jpe' => 'data:image/jpeg',
|
43 |
+
'jpg' => 'data:image/jpeg',
|
44 |
+
'jpeg' => 'data:image/jpeg',
|
45 |
+
'svg' => 'data:image/svg+xml',
|
46 |
+
'woff' => 'data:application/x-font-woff',
|
47 |
+
'tif' => 'image/tiff',
|
48 |
+
'tiff' => 'image/tiff',
|
49 |
+
'xbm' => 'image/x-xbitmap',
|
50 |
+
);
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Set the maximum size if files to be imported.
|
54 |
+
*
|
55 |
+
* Files larger than this size (in kB) will not be imported into the CSS.
|
56 |
+
* Importing files into the CSS as data-uri will save you some connections,
|
57 |
+
* but we should only import relatively small decorative images so that our
|
58 |
+
* CSS file doesn't get too bulky.
|
59 |
+
*
|
60 |
+
* @param int $size Size in kB
|
61 |
+
*/
|
62 |
+
public function setMaxImportSize($size)
|
63 |
+
{
|
64 |
+
$this->maxImportSize = $size;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Set the type of extensions to be imported into the CSS (to save network
|
69 |
+
* connections).
|
70 |
+
* Keys of the array should be the file extensions & respective values
|
71 |
+
* should be the data type.
|
72 |
+
*
|
73 |
+
* @param string[] $extensions Array of file extensions
|
74 |
+
*/
|
75 |
+
public function setImportExtensions(array $extensions)
|
76 |
+
{
|
77 |
+
$this->importExtensions = $extensions;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Move any import statements to the top.
|
82 |
+
*
|
83 |
+
* @param string $content Nearly finished CSS content
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
protected function moveImportsToTop($content)
|
88 |
+
{
|
89 |
+
if (preg_match_all('/(;?)(@import (?<url>url\()?(?P<quotes>["\']?).+?(?P=quotes)(?(url)\)));?/', $content, $matches)) {
|
90 |
+
// remove from content
|
91 |
+
foreach ($matches[0] as $import) {
|
92 |
+
$content = str_replace($import, '', $content);
|
93 |
+
}
|
94 |
+
|
95 |
+
// add to top
|
96 |
+
$content = implode(';', $matches[2]).';'.trim($content, ';');
|
97 |
+
}
|
98 |
+
|
99 |
+
return $content;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Combine CSS from import statements.
|
104 |
+
*
|
105 |
+
* @import's will be loaded and their content merged into the original file,
|
106 |
+
* to save HTTP requests.
|
107 |
+
*
|
108 |
+
* @param string $source The file to combine imports for
|
109 |
+
* @param string $content The CSS content to combine imports for
|
110 |
+
* @param string[] $parents Parent paths, for circular reference checks
|
111 |
+
*
|
112 |
+
* @return string
|
113 |
+
*
|
114 |
+
* @throws FileImportException
|
115 |
+
*/
|
116 |
+
protected function combineImports($source, $content, $parents)
|
117 |
+
{
|
118 |
+
$importRegexes = array(
|
119 |
+
// @import url(xxx)
|
120 |
+
'/
|
121 |
+
# import statement
|
122 |
+
@import
|
123 |
+
|
124 |
+
# whitespace
|
125 |
+
\s+
|
126 |
+
|
127 |
+
# open url()
|
128 |
+
url\(
|
129 |
+
|
130 |
+
# (optional) open path enclosure
|
131 |
+
(?P<quotes>["\']?)
|
132 |
+
|
133 |
+
# fetch path
|
134 |
+
(?P<path>.+?)
|
135 |
+
|
136 |
+
# (optional) close path enclosure
|
137 |
+
(?P=quotes)
|
138 |
+
|
139 |
+
# close url()
|
140 |
+
\)
|
141 |
+
|
142 |
+
# (optional) trailing whitespace
|
143 |
+
\s*
|
144 |
+
|
145 |
+
# (optional) media statement(s)
|
146 |
+
(?P<media>[^;]*)
|
147 |
+
|
148 |
+
# (optional) trailing whitespace
|
149 |
+
\s*
|
150 |
+
|
151 |
+
# (optional) closing semi-colon
|
152 |
+
;?
|
153 |
+
|
154 |
+
/ix',
|
155 |
+
|
156 |
+
// @import 'xxx'
|
157 |
+
'/
|
158 |
+
|
159 |
+
# import statement
|
160 |
+
@import
|
161 |
+
|
162 |
+
# whitespace
|
163 |
+
\s+
|
164 |
+
|
165 |
+
# open path enclosure
|
166 |
+
(?P<quotes>["\'])
|
167 |
+
|
168 |
+
# fetch path
|
169 |
+
(?P<path>.+?)
|
170 |
+
|
171 |
+
# close path enclosure
|
172 |
+
(?P=quotes)
|
173 |
+
|
174 |
+
# (optional) trailing whitespace
|
175 |
+
\s*
|
176 |
+
|
177 |
+
# (optional) media statement(s)
|
178 |
+
(?P<media>[^;]*)
|
179 |
+
|
180 |
+
# (optional) trailing whitespace
|
181 |
+
\s*
|
182 |
+
|
183 |
+
# (optional) closing semi-colon
|
184 |
+
;?
|
185 |
+
|
186 |
+
/ix',
|
187 |
+
);
|
188 |
+
|
189 |
+
// find all relative imports in css
|
190 |
+
$matches = array();
|
191 |
+
foreach ($importRegexes as $importRegex) {
|
192 |
+
if (preg_match_all($importRegex, $content, $regexMatches, PREG_SET_ORDER)) {
|
193 |
+
$matches = array_merge($matches, $regexMatches);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
$search = array();
|
198 |
+
$replace = array();
|
199 |
+
|
200 |
+
// loop the matches
|
201 |
+
foreach ($matches as $match) {
|
202 |
+
// get the path for the file that will be imported
|
203 |
+
$importPath = dirname($source).'/'.$match['path'];
|
204 |
+
|
205 |
+
// only replace the import with the content if we can grab the
|
206 |
+
// content of the file
|
207 |
+
if (!$this->canImportByPath($match['path']) || !$this->canImportFile($importPath)) {
|
208 |
+
continue;
|
209 |
+
}
|
210 |
+
|
211 |
+
// check if current file was not imported previously in the same
|
212 |
+
// import chain.
|
213 |
+
if (in_array($importPath, $parents)) {
|
214 |
+
throw new FileImportException('Failed to import file "'.$importPath.'": circular reference detected.');
|
215 |
+
}
|
216 |
+
|
217 |
+
// grab referenced file & minify it (which may include importing
|
218 |
+
// yet other @import statements recursively)
|
219 |
+
$minifier = new static($importPath);
|
220 |
+
$minifier->setMaxImportSize($this->maxImportSize);
|
221 |
+
$minifier->setImportExtensions($this->importExtensions);
|
222 |
+
$importContent = $minifier->execute($source, $parents);
|
223 |
+
|
224 |
+
// check if this is only valid for certain media
|
225 |
+
if (!empty($match['media'])) {
|
226 |
+
$importContent = '@media '.$match['media'].'{'.$importContent.'}';
|
227 |
+
}
|
228 |
+
|
229 |
+
// add to replacement array
|
230 |
+
$search[] = $match[0];
|
231 |
+
$replace[] = $importContent;
|
232 |
+
}
|
233 |
+
|
234 |
+
// replace the import statements
|
235 |
+
return str_replace($search, $replace, $content);
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Import files into the CSS, base64-ized.
|
240 |
+
*
|
241 |
+
* @url(image.jpg) images will be loaded and their content merged into the
|
242 |
+
* original file, to save HTTP requests.
|
243 |
+
*
|
244 |
+
* @param string $source The file to import files for
|
245 |
+
* @param string $content The CSS content to import files for
|
246 |
+
*
|
247 |
+
* @return string
|
248 |
+
*/
|
249 |
+
protected function importFiles($source, $content)
|
250 |
+
{
|
251 |
+
$regex = '/url\((["\']?)(.+?)\\1\)/i';
|
252 |
+
if ($this->importExtensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
|
253 |
+
$search = array();
|
254 |
+
$replace = array();
|
255 |
+
|
256 |
+
// loop the matches
|
257 |
+
foreach ($matches as $match) {
|
258 |
+
$extension = substr(strrchr($match[2], '.'), 1);
|
259 |
+
if ($extension && !array_key_exists($extension, $this->importExtensions)) {
|
260 |
+
continue;
|
261 |
+
}
|
262 |
+
|
263 |
+
// get the path for the file that will be imported
|
264 |
+
$path = $match[2];
|
265 |
+
$path = dirname($source).'/'.$path;
|
266 |
+
|
267 |
+
// only replace the import with the content if we're able to get
|
268 |
+
// the content of the file, and it's relatively small
|
269 |
+
if ($this->canImportFile($path) && $this->canImportBySize($path)) {
|
270 |
+
// grab content && base64-ize
|
271 |
+
$importContent = $this->load($path);
|
272 |
+
$importContent = base64_encode($importContent);
|
273 |
+
|
274 |
+
// build replacement
|
275 |
+
$search[] = $match[0];
|
276 |
+
$replace[] = 'url('.$this->importExtensions[$extension].';base64,'.$importContent.')';
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
// replace the import statements
|
281 |
+
$content = str_replace($search, $replace, $content);
|
282 |
+
}
|
283 |
+
|
284 |
+
return $content;
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Minify the data.
|
289 |
+
* Perform CSS optimizations.
|
290 |
+
*
|
291 |
+
* @param string[optional] $path Path to write the data to
|
292 |
+
* @param string[] $parents Parent paths, for circular reference checks
|
293 |
+
*
|
294 |
+
* @return string The minified data
|
295 |
+
*/
|
296 |
+
public function execute($path = null, $parents = array())
|
297 |
+
{
|
298 |
+
$content = '';
|
299 |
+
|
300 |
+
// loop CSS data (raw data and files)
|
301 |
+
foreach ($this->data as $source => $css) {
|
302 |
+
/*
|
303 |
+
* Let's first take out strings & comments, since we can't just
|
304 |
+
* remove whitespace anywhere. If whitespace occurs inside a string,
|
305 |
+
* we should leave it alone. E.g.:
|
306 |
+
* p { content: "a test" }
|
307 |
+
*/
|
308 |
+
$this->extractStrings();
|
309 |
+
$this->stripComments();
|
310 |
+
$this->extractCalcs();
|
311 |
+
$css = $this->replace($css);
|
312 |
+
|
313 |
+
$css = $this->stripWhitespace($css);
|
314 |
+
$css = $this->shortenColors($css);
|
315 |
+
$css = $this->shortenZeroes($css);
|
316 |
+
$css = $this->shortenFontWeights($css);
|
317 |
+
$css = $this->stripEmptyTags($css);
|
318 |
+
|
319 |
+
// restore the string we've extracted earlier
|
320 |
+
$css = $this->restoreExtractedData($css);
|
321 |
+
|
322 |
+
$source = is_int($source) ? '' : $source;
|
323 |
+
$parents = $source ? array_merge($parents, array($source)) : $parents;
|
324 |
+
$css = $this->combineImports($source, $css, $parents);
|
325 |
+
$css = $this->importFiles($source, $css);
|
326 |
+
|
327 |
+
/*
|
328 |
+
* If we'll save to a new path, we'll have to fix the relative paths
|
329 |
+
* to be relative no longer to the source file, but to the new path.
|
330 |
+
* If we don't write to a file, fall back to same path so no
|
331 |
+
* conversion happens (because we still want it to go through most
|
332 |
+
* of the move code, which also addresses url() & @import syntax...)
|
333 |
+
*/
|
334 |
+
$converter = $this->getPathConverter($source, $path ?: $source);
|
335 |
+
$css = $this->move($converter, $css);
|
336 |
+
|
337 |
+
// combine css
|
338 |
+
$content .= $css;
|
339 |
+
}
|
340 |
+
|
341 |
+
$content = $this->moveImportsToTop($content);
|
342 |
+
|
343 |
+
return $content;
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Moving a css file should update all relative urls.
|
348 |
+
* Relative references (e.g. ../images/image.gif) in a certain css file,
|
349 |
+
* will have to be updated when a file is being saved at another location
|
350 |
+
* (e.g. ../../images/image.gif, if the new CSS file is 1 folder deeper).
|
351 |
+
*
|
352 |
+
* @param ConverterInterface $converter Relative path converter
|
353 |
+
* @param string $content The CSS content to update relative urls for
|
354 |
+
*
|
355 |
+
* @return string
|
356 |
+
*/
|
357 |
+
protected function move(ConverterInterface $converter, $content)
|
358 |
+
{
|
359 |
+
/*
|
360 |
+
* Relative path references will usually be enclosed by url(). @import
|
361 |
+
* is an exception, where url() is not necessary around the path (but is
|
362 |
+
* allowed).
|
363 |
+
* This *could* be 1 regular expression, where both regular expressions
|
364 |
+
* in this array are on different sides of a |. But we're using named
|
365 |
+
* patterns in both regexes, the same name on both regexes. This is only
|
366 |
+
* possible with a (?J) modifier, but that only works after a fairly
|
367 |
+
* recent PCRE version. That's why I'm doing 2 separate regular
|
368 |
+
* expressions & combining the matches after executing of both.
|
369 |
+
*/
|
370 |
+
$relativeRegexes = array(
|
371 |
+
// url(xxx)
|
372 |
+
'/
|
373 |
+
# open url()
|
374 |
+
url\(
|
375 |
+
|
376 |
+
\s*
|
377 |
+
|
378 |
+
# open path enclosure
|
379 |
+
(?P<quotes>["\'])?
|
380 |
+
|
381 |
+
# fetch path
|
382 |
+
(?P<path>.+?)
|
383 |
+
|
384 |
+
# close path enclosure
|
385 |
+
(?(quotes)(?P=quotes))
|
386 |
+
|
387 |
+
\s*
|
388 |
+
|
389 |
+
# close url()
|
390 |
+
\)
|
391 |
+
|
392 |
+
/ix',
|
393 |
+
|
394 |
+
// @import "xxx"
|
395 |
+
'/
|
396 |
+
# import statement
|
397 |
+
@import
|
398 |
+
|
399 |
+
# whitespace
|
400 |
+
\s+
|
401 |
+
|
402 |
+
# we don\'t have to check for @import url(), because the
|
403 |
+
# condition above will already catch these
|
404 |
+
|
405 |
+
# open path enclosure
|
406 |
+
(?P<quotes>["\'])
|
407 |
+
|
408 |
+
# fetch path
|
409 |
+
(?P<path>.+?)
|
410 |
+
|
411 |
+
# close path enclosure
|
412 |
+
(?P=quotes)
|
413 |
+
|
414 |
+
/ix',
|
415 |
+
);
|
416 |
+
|
417 |
+
// find all relative urls in css
|
418 |
+
$matches = array();
|
419 |
+
foreach ($relativeRegexes as $relativeRegex) {
|
420 |
+
if (preg_match_all($relativeRegex, $content, $regexMatches, PREG_SET_ORDER)) {
|
421 |
+
$matches = array_merge($matches, $regexMatches);
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
$search = array();
|
426 |
+
$replace = array();
|
427 |
+
|
428 |
+
// loop all urls
|
429 |
+
foreach ($matches as $match) {
|
430 |
+
// determine if it's a url() or an @import match
|
431 |
+
$type = (strpos($match[0], '@import') === 0 ? 'import' : 'url');
|
432 |
+
|
433 |
+
$url = $match['path'];
|
434 |
+
if ($this->canImportByPath($url)) {
|
435 |
+
// attempting to interpret GET-params makes no sense, so let's discard them for awhile
|
436 |
+
$params = strrchr($url, '?');
|
437 |
+
$url = $params ? substr($url, 0, -strlen($params)) : $url;
|
438 |
+
|
439 |
+
// fix relative url
|
440 |
+
$url = $converter->convert($url);
|
441 |
+
|
442 |
+
// now that the path has been converted, re-apply GET-params
|
443 |
+
$url .= $params;
|
444 |
+
}
|
445 |
+
|
446 |
+
/*
|
447 |
+
* Urls with control characters above 0x7e should be quoted.
|
448 |
+
* According to Mozilla's parser, whitespace is only allowed at the
|
449 |
+
* end of unquoted urls.
|
450 |
+
* Urls with `)` (as could happen with data: uris) should also be
|
451 |
+
* quoted to avoid being confused for the url() closing parentheses.
|
452 |
+
* And urls with a # have also been reported to cause issues.
|
453 |
+
* Urls with quotes inside should also remain escaped.
|
454 |
+
*
|
455 |
+
* @see https://developer.mozilla.org/nl/docs/Web/CSS/url#The_url()_functional_notation
|
456 |
+
* @see https://hg.mozilla.org/mozilla-central/rev/14abca4e7378
|
457 |
+
* @see https://github.com/matthiasmullie/minify/issues/193
|
458 |
+
*/
|
459 |
+
$url = trim($url);
|
460 |
+
if (preg_match('/[\s\)\'"#\x{7f}-\x{9f}]/u', $url)) {
|
461 |
+
$url = $match['quotes'] . $url . $match['quotes'];
|
462 |
+
}
|
463 |
+
|
464 |
+
// build replacement
|
465 |
+
$search[] = $match[0];
|
466 |
+
if ($type === 'url') {
|
467 |
+
$replace[] = 'url('.$url.')';
|
468 |
+
} elseif ($type === 'import') {
|
469 |
+
$replace[] = '@import "'.$url.'"';
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
// replace urls
|
474 |
+
return str_replace($search, $replace, $content);
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Shorthand hex color codes.
|
479 |
+
* #FF0000 -> #F00.
|
480 |
+
*
|
481 |
+
* @param string $content The CSS content to shorten the hex color codes for
|
482 |
+
*
|
483 |
+
* @return string
|
484 |
+
*/
|
485 |
+
protected function shortenColors($content)
|
486 |
+
{
|
487 |
+
$content = preg_replace('/(?<=[: ])#([0-9a-z])\\1([0-9a-z])\\2([0-9a-z])\\3(?:([0-9a-z])\\4)?(?=[; }])/i', '#$1$2$3$4', $content);
|
488 |
+
|
489 |
+
// remove alpha channel if it's pointless...
|
490 |
+
$content = preg_replace('/(?<=[: ])#([0-9a-z]{6})ff?(?=[; }])/i', '#$1', $content);
|
491 |
+
$content = preg_replace('/(?<=[: ])#([0-9a-z]{3})f?(?=[; }])/i', '#$1', $content);
|
492 |
+
|
493 |
+
$colors = array(
|
494 |
+
// we can shorten some even more by replacing them with their color name
|
495 |
+
'#F0FFFF' => 'azure',
|
496 |
+
'#F5F5DC' => 'beige',
|
497 |
+
'#A52A2A' => 'brown',
|
498 |
+
'#FF7F50' => 'coral',
|
499 |
+
'#FFD700' => 'gold',
|
500 |
+
'#808080' => 'gray',
|
501 |
+
'#008000' => 'green',
|
502 |
+
'#4B0082' => 'indigo',
|
503 |
+
'#FFFFF0' => 'ivory',
|
504 |
+
'#F0E68C' => 'khaki',
|
505 |
+
'#FAF0E6' => 'linen',
|
506 |
+
'#800000' => 'maroon',
|
507 |
+
'#000080' => 'navy',
|
508 |
+
'#808000' => 'olive',
|
509 |
+
'#CD853F' => 'peru',
|
510 |
+
'#FFC0CB' => 'pink',
|
511 |
+
'#DDA0DD' => 'plum',
|
512 |
+
'#800080' => 'purple',
|
513 |
+
'#F00' => 'red',
|
514 |
+
'#FA8072' => 'salmon',
|
515 |
+
'#A0522D' => 'sienna',
|
516 |
+
'#C0C0C0' => 'silver',
|
517 |
+
'#FFFAFA' => 'snow',
|
518 |
+
'#D2B48C' => 'tan',
|
519 |
+
'#FF6347' => 'tomato',
|
520 |
+
'#EE82EE' => 'violet',
|
521 |
+
'#F5DEB3' => 'wheat',
|
522 |
+
// or the other way around
|
523 |
+
'WHITE' => '#fff',
|
524 |
+
'BLACK' => '#000',
|
525 |
+
);
|
526 |
+
|
527 |
+
return preg_replace_callback(
|
528 |
+
'/(?<=[: ])('.implode(array_keys($colors), '|').')(?=[; }])/i',
|
529 |
+
function ($match) use ($colors) {
|
530 |
+
return $colors[strtoupper($match[0])];
|
531 |
+
},
|
532 |
+
$content
|
533 |
+
);
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Shorten CSS font weights.
|
538 |
+
*
|
539 |
+
* @param string $content The CSS content to shorten the font weights for
|
540 |
+
*
|
541 |
+
* @return string
|
542 |
+
*/
|
543 |
+
protected function shortenFontWeights($content)
|
544 |
+
{
|
545 |
+
$weights = array(
|
546 |
+
'normal' => 400,
|
547 |
+
'bold' => 700,
|
548 |
+
);
|
549 |
+
|
550 |
+
$callback = function ($match) use ($weights) {
|
551 |
+
return $match[1].$weights[$match[2]];
|
552 |
+
};
|
553 |
+
|
554 |
+
return preg_replace_callback('/(font-weight\s*:\s*)('.implode('|', array_keys($weights)).')(?=[;}])/', $callback, $content);
|
555 |
+
}
|
556 |
+
|
557 |
+
/**
|
558 |
+
* Shorthand 0 values to plain 0, instead of e.g. -0em.
|
559 |
+
*
|
560 |
+
* @param string $content The CSS content to shorten the zero values for
|
561 |
+
*
|
562 |
+
* @return string
|
563 |
+
*/
|
564 |
+
protected function shortenZeroes($content)
|
565 |
+
{
|
566 |
+
// we don't want to strip units in `calc()` expressions:
|
567 |
+
// `5px - 0px` is valid, but `5px - 0` is not
|
568 |
+
// `10px * 0` is valid (equates to 0), and so is `10 * 0px`, but
|
569 |
+
// `10 * 0` is invalid
|
570 |
+
// we've extracted calcs earlier, so we don't need to worry about this
|
571 |
+
|
572 |
+
// reusable bits of code throughout these regexes:
|
573 |
+
// before & after are used to make sure we don't match lose unintended
|
574 |
+
// 0-like values (e.g. in #000, or in http://url/1.0)
|
575 |
+
// units can be stripped from 0 values, or used to recognize non 0
|
576 |
+
// values (where wa may be able to strip a .0 suffix)
|
577 |
+
$before = '(?<=[:(, ])';
|
578 |
+
$after = '(?=[ ,);}])';
|
579 |
+
$units = '(em|ex|%|px|cm|mm|in|pt|pc|ch|rem|vh|vw|vmin|vmax|vm)';
|
580 |
+
|
581 |
+
// strip units after zeroes (0px -> 0)
|
582 |
+
// NOTE: it should be safe to remove all units for a 0 value, but in
|
583 |
+
// practice, Webkit (especially Safari) seems to stumble over at least
|
584 |
+
// 0%, potentially other units as well. Only stripping 'px' for now.
|
585 |
+
// @see https://github.com/matthiasmullie/minify/issues/60
|
586 |
+
$content = preg_replace('/'.$before.'(-?0*(\.0+)?)(?<=0)px'.$after.'/', '\\1', $content);
|
587 |
+
|
588 |
+
// strip 0-digits (.0 -> 0)
|
589 |
+
$content = preg_replace('/'.$before.'\.0+'.$units.'?'.$after.'/', '0\\1', $content);
|
590 |
+
// strip trailing 0: 50.10 -> 50.1, 50.10px -> 50.1px
|
591 |
+
$content = preg_replace('/'.$before.'(-?[0-9]+\.[0-9]+)0+'.$units.'?'.$after.'/', '\\1\\2', $content);
|
592 |
+
// strip trailing 0: 50.00 -> 50, 50.00px -> 50px
|
593 |
+
$content = preg_replace('/'.$before.'(-?[0-9]+)\.0+'.$units.'?'.$after.'/', '\\1\\2', $content);
|
594 |
+
// strip leading 0: 0.1 -> .1, 01.1 -> 1.1
|
595 |
+
$content = preg_replace('/'.$before.'(-?)0+([0-9]*\.[0-9]+)'.$units.'?'.$after.'/', '\\1\\2\\3', $content);
|
596 |
+
|
597 |
+
// strip negative zeroes (-0 -> 0) & truncate zeroes (00 -> 0)
|
598 |
+
$content = preg_replace('/'.$before.'-?0+'.$units.'?'.$after.'/', '0\\1', $content);
|
599 |
+
|
600 |
+
// IE doesn't seem to understand a unitless flex-basis value (correct -
|
601 |
+
// it goes against the spec), so let's add it in again (make it `%`,
|
602 |
+
// which is only 1 char: 0%, 0px, 0 anything, it's all just the same)
|
603 |
+
// @see https://developer.mozilla.org/nl/docs/Web/CSS/flex
|
604 |
+
$content = preg_replace('/flex:([0-9]+\s[0-9]+\s)0([;\}])/', 'flex:${1}0%${2}', $content);
|
605 |
+
$content = preg_replace('/flex-basis:0([;\}])/', 'flex-basis:0%${1}', $content);
|
606 |
+
|
607 |
+
return $content;
|
608 |
+
}
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Strip empty tags from source code.
|
612 |
+
*
|
613 |
+
* @param string $content
|
614 |
+
*
|
615 |
+
* @return string
|
616 |
+
*/
|
617 |
+
protected function stripEmptyTags($content)
|
618 |
+
{
|
619 |
+
$content = preg_replace('/(?<=^)[^\{\};]+\{\s*\}/', '', $content);
|
620 |
+
$content = preg_replace('/(?<=(\}|;))[^\{\};]+\{\s*\}/', '', $content);
|
621 |
+
|
622 |
+
return $content;
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Strip comments from source code.
|
627 |
+
*/
|
628 |
+
protected function stripComments()
|
629 |
+
{
|
630 |
+
// PHP only supports $this inside anonymous functions since 5.4
|
631 |
+
$minifier = $this;
|
632 |
+
$callback = function ($match) use ($minifier) {
|
633 |
+
$count = count($minifier->extracted);
|
634 |
+
$placeholder = '/*'.$count.'*/';
|
635 |
+
$minifier->extracted[$placeholder] = $match[0];
|
636 |
+
|
637 |
+
return $placeholder;
|
638 |
+
};
|
639 |
+
$this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback);
|
640 |
+
|
641 |
+
$this->registerPattern('/\/\*.*?\*\//s', '');
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Strip whitespace.
|
646 |
+
*
|
647 |
+
* @param string $content The CSS content to strip the whitespace for
|
648 |
+
*
|
649 |
+
* @return string
|
650 |
+
*/
|
651 |
+
protected function stripWhitespace($content)
|
652 |
+
{
|
653 |
+
// remove leading & trailing whitespace
|
654 |
+
$content = preg_replace('/^\s*/m', '', $content);
|
655 |
+
$content = preg_replace('/\s*$/m', '', $content);
|
656 |
+
|
657 |
+
// replace newlines with a single space
|
658 |
+
$content = preg_replace('/\s+/', ' ', $content);
|
659 |
+
|
660 |
+
// remove whitespace around meta characters
|
661 |
+
// inspired by stackoverflow.com/questions/15195750/minify-compress-css-with-regex
|
662 |
+
$content = preg_replace('/\s*([\*$~^|]?+=|[{};,>~]|!important\b)\s*/', '$1', $content);
|
663 |
+
$content = preg_replace('/([\[(:>\+])\s+/', '$1', $content);
|
664 |
+
$content = preg_replace('/\s+([\]\)>\+])/', '$1', $content);
|
665 |
+
$content = preg_replace('/\s+(:)(?![^\}]*\{)/', '$1', $content);
|
666 |
+
|
667 |
+
// whitespace around + and - can only be stripped inside some pseudo-
|
668 |
+
// classes, like `:nth-child(3+2n)`
|
669 |
+
// not in things like `calc(3px + 2px)`, shorthands like `3px -2px`, or
|
670 |
+
// selectors like `div.weird- p`
|
671 |
+
$pseudos = array('nth-child', 'nth-last-child', 'nth-last-of-type', 'nth-of-type');
|
672 |
+
$content = preg_replace('/:('.implode('|', $pseudos).')\(\s*([+-]?)\s*(.+?)\s*([+-]?)\s*(.*?)\s*\)/', ':$1($2$3$4$5)', $content);
|
673 |
+
|
674 |
+
// remove semicolon/whitespace followed by closing bracket
|
675 |
+
$content = str_replace(';}', '}', $content);
|
676 |
+
|
677 |
+
return trim($content);
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Replace all `calc()` occurrences.
|
682 |
+
*/
|
683 |
+
protected function extractCalcs()
|
684 |
+
{
|
685 |
+
// PHP only supports $this inside anonymous functions since 5.4
|
686 |
+
$minifier = $this;
|
687 |
+
$callback = function ($match) use ($minifier) {
|
688 |
+
$length = strlen($match[1]);
|
689 |
+
$expr = '';
|
690 |
+
$opened = 0;
|
691 |
+
|
692 |
+
for ($i = 0; $i < $length; $i++) {
|
693 |
+
$char = $match[1][$i];
|
694 |
+
$expr .= $char;
|
695 |
+
if ($char === '(') {
|
696 |
+
$opened++;
|
697 |
+
} elseif ($char === ')' && --$opened === 0) {
|
698 |
+
break;
|
699 |
+
}
|
700 |
+
}
|
701 |
+
$rest = str_replace($expr, '', $match[1]);
|
702 |
+
$expr = trim(substr($expr, 1, -1));
|
703 |
+
|
704 |
+
$count = count($minifier->extracted);
|
705 |
+
$placeholder = 'calc('.$count.')';
|
706 |
+
$minifier->extracted[$placeholder] = 'calc('.$expr.')';
|
707 |
+
|
708 |
+
return $placeholder.$rest;
|
709 |
+
};
|
710 |
+
|
711 |
+
$this->registerPattern('/calc(\(.+?)(?=$|;|calc\()/', $callback);
|
712 |
+
}
|
713 |
+
|
714 |
+
/**
|
715 |
+
* Check if file is small enough to be imported.
|
716 |
+
*
|
717 |
+
* @param string $path The path to the file
|
718 |
+
*
|
719 |
+
* @return bool
|
720 |
+
*/
|
721 |
+
protected function canImportBySize($path)
|
722 |
+
{
|
723 |
+
return ($size = @filesize($path)) && $size <= $this->maxImportSize * 1024;
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Check if file a file can be imported, going by the path.
|
728 |
+
*
|
729 |
+
* @param string $path
|
730 |
+
*
|
731 |
+
* @return bool
|
732 |
+
*/
|
733 |
+
protected function canImportByPath($path)
|
734 |
+
{
|
735 |
+
return preg_match('/^(data:|https?:|\\/)/', $path) === 0;
|
736 |
+
}
|
737 |
+
|
738 |
+
/**
|
739 |
+
* Return a converter to update relative paths to be relative to the new
|
740 |
+
* destination.
|
741 |
+
*
|
742 |
+
* @param string $source
|
743 |
+
* @param string $target
|
744 |
+
*
|
745 |
+
* @return ConverterInterface
|
746 |
+
*/
|
747 |
+
protected function getPathConverter($source, $target)
|
748 |
+
{
|
749 |
+
return new Converter($source, $target);
|
750 |
+
}
|
751 |
+
}
|
vendor/matthiasmullie/minify/src/Exception.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Base Exception
|
4 |
+
*
|
5 |
+
* @deprecated Use Exceptions\BasicException instead
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
*/
|
9 |
+
namespace MatthiasMullie\Minify;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Base Exception Class
|
13 |
+
* @deprecated Use Exceptions\BasicException instead
|
14 |
+
*
|
15 |
+
* @package Minify
|
16 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
17 |
+
*/
|
18 |
+
abstract class Exception extends \Exception
|
19 |
+
{
|
20 |
+
}
|
vendor/matthiasmullie/minify/src/Exceptions/BasicException.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Basic exception
|
4 |
+
*
|
5 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
9 |
+
* @license MIT License
|
10 |
+
*/
|
11 |
+
namespace MatthiasMullie\Minify\Exceptions;
|
12 |
+
|
13 |
+
use MatthiasMullie\Minify\Exception;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Basic Exception Class
|
17 |
+
*
|
18 |
+
* @package Minify\Exception
|
19 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
20 |
+
*/
|
21 |
+
abstract class BasicException extends Exception
|
22 |
+
{
|
23 |
+
}
|
vendor/matthiasmullie/minify/src/Exceptions/FileImportException.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File Import Exception
|
4 |
+
*
|
5 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
9 |
+
* @license MIT License
|
10 |
+
*/
|
11 |
+
namespace MatthiasMullie\Minify\Exceptions;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* File Import Exception Class
|
15 |
+
*
|
16 |
+
* @package Minify\Exception
|
17 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
18 |
+
*/
|
19 |
+
class FileImportException extends BasicException
|
20 |
+
{
|
21 |
+
}
|
vendor/matthiasmullie/minify/src/Exceptions/IOException.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IO Exception
|
4 |
+
*
|
5 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
9 |
+
* @license MIT License
|
10 |
+
*/
|
11 |
+
namespace MatthiasMullie\Minify\Exceptions;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* IO Exception Class
|
15 |
+
*
|
16 |
+
* @package Minify\Exception
|
17 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
18 |
+
*/
|
19 |
+
class IOException extends BasicException
|
20 |
+
{
|
21 |
+
}
|
vendor/matthiasmullie/minify/src/JS.php
ADDED
@@ -0,0 +1,612 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* JavaScript minifier
|
4 |
+
*
|
5 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
9 |
+
* @license MIT License
|
10 |
+
*/
|
11 |
+
namespace MatthiasMullie\Minify;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* JavaScript Minifier Class
|
15 |
+
*
|
16 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
17 |
+
*
|
18 |
+
* @package Minify
|
19 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
20 |
+
* @author Tijs Verkoyen <minify@verkoyen.eu>
|
21 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
22 |
+
* @license MIT License
|
23 |
+
*/
|
24 |
+
class JS extends Minify
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Var-matching regex based on http://stackoverflow.com/a/9337047/802993.
|
28 |
+
*
|
29 |
+
* Note that regular expressions using that bit must have the PCRE_UTF8
|
30 |
+
* pattern modifier (/u) set.
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
const REGEX_VARIABLE = '\b[$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\x{02c1}\x{02c6}-\x{02d1}\x{02e0}-\x{02e4}\x{02ec}\x{02ee}\x{0370}-\x{0374}\x{0376}\x{0377}\x{037a}-\x{037d}\x{0386}\x{0388}-\x{038a}\x{038c}\x{038e}-\x{03a1}\x{03a3}-\x{03f5}\x{03f7}-\x{0481}\x{048a}-\x{0527}\x{0531}-\x{0556}\x{0559}\x{0561}-\x{0587}\x{05d0}-\x{05ea}\x{05f0}-\x{05f2}\x{0620}-\x{064a}\x{066e}\x{066f}\x{0671}-\x{06d3}\x{06d5}\x{06e5}\x{06e6}\x{06ee}\x{06ef}\x{06fa}-\x{06fc}\x{06ff}\x{0710}\x{0712}-\x{072f}\x{074d}-\x{07a5}\x{07b1}\x{07ca}-\x{07ea}\x{07f4}\x{07f5}\x{07fa}\x{0800}-\x{0815}\x{081a}\x{0824}\x{0828}\x{0840}-\x{0858}\x{08a0}\x{08a2}-\x{08ac}\x{0904}-\x{0939}\x{093d}\x{0950}\x{0958}-\x{0961}\x{0971}-\x{0977}\x{0979}-\x{097f}\x{0985}-\x{098c}\x{098f}\x{0990}\x{0993}-\x{09a8}\x{09aa}-\x{09b0}\x{09b2}\x{09b6}-\x{09b9}\x{09bd}\x{09ce}\x{09dc}\x{09dd}\x{09df}-\x{09e1}\x{09f0}\x{09f1}\x{0a05}-\x{0a0a}\x{0a0f}\x{0a10}\x{0a13}-\x{0a28}\x{0a2a}-\x{0a30}\x{0a32}\x{0a33}\x{0a35}\x{0a36}\x{0a38}\x{0a39}\x{0a59}-\x{0a5c}\x{0a5e}\x{0a72}-\x{0a74}\x{0a85}-\x{0a8d}\x{0a8f}-\x{0a91}\x{0a93}-\x{0aa8}\x{0aaa}-\x{0ab0}\x{0ab2}\x{0ab3}\x{0ab5}-\x{0ab9}\x{0abd}\x{0ad0}\x{0ae0}\x{0ae1}\x{0b05}-\x{0b0c}\x{0b0f}\x{0b10}\x{0b13}-\x{0b28}\x{0b2a}-\x{0b30}\x{0b32}\x{0b33}\x{0b35}-\x{0b39}\x{0b3d}\x{0b5c}\x{0b5d}\x{0b5f}-\x{0b61}\x{0b71}\x{0b83}\x{0b85}-\x{0b8a}\x{0b8e}-\x{0b90}\x{0b92}-\x{0b95}\x{0b99}\x{0b9a}\x{0b9c}\x{0b9e}\x{0b9f}\x{0ba3}\x{0ba4}\x{0ba8}-\x{0baa}\x{0bae}-\x{0bb9}\x{0bd0}\x{0c05}-\x{0c0c}\x{0c0e}-\x{0c10}\x{0c12}-\x{0c28}\x{0c2a}-\x{0c33}\x{0c35}-\x{0c39}\x{0c3d}\x{0c58}\x{0c59}\x{0c60}\x{0c61}\x{0c85}-\x{0c8c}\x{0c8e}-\x{0c90}\x{0c92}-\x{0ca8}\x{0caa}-\x{0cb3}\x{0cb5}-\x{0cb9}\x{0cbd}\x{0cde}\x{0ce0}\x{0ce1}\x{0cf1}\x{0cf2}\x{0d05}-\x{0d0c}\x{0d0e}-\x{0d10}\x{0d12}-\x{0d3a}\x{0d3d}\x{0d4e}\x{0d60}\x{0d61}\x{0d7a}-\x{0d7f}\x{0d85}-\x{0d96}\x{0d9a}-\x{0db1}\x{0db3}-\x{0dbb}\x{0dbd}\x{0dc0}-\x{0dc6}\x{0e01}-\x{0e30}\x{0e32}\x{0e33}\x{0e40}-\x{0e46}\x{0e81}\x{0e82}\x{0e84}\x{0e87}\x{0e88}\x{0e8a}\x{0e8d}\x{0e94}-\x{0e97}\x{0e99}-\x{0e9f}\x{0ea1}-\x{0ea3}\x{0ea5}\x{0ea7}\x{0eaa}\x{0eab}\x{0ead}-\x{0eb0}\x{0eb2}\x{0eb3}\x{0ebd}\x{0ec0}-\x{0ec4}\x{0ec6}\x{0edc}-\x{0edf}\x{0f00}\x{0f40}-\x{0f47}\x{0f49}-\x{0f6c}\x{0f88}-\x{0f8c}\x{1000}-\x{102a}\x{103f}\x{1050}-\x{1055}\x{105a}-\x{105d}\x{1061}\x{1065}\x{1066}\x{106e}-\x{1070}\x{1075}-\x{1081}\x{108e}\x{10a0}-\x{10c5}\x{10c7}\x{10cd}\x{10d0}-\x{10fa}\x{10fc}-\x{1248}\x{124a}-\x{124d}\x{1250}-\x{1256}\x{1258}\x{125a}-\x{125d}\x{1260}-\x{1288}\x{128a}-\x{128d}\x{1290}-\x{12b0}\x{12b2}-\x{12b5}\x{12b8}-\x{12be}\x{12c0}\x{12c2}-\x{12c5}\x{12c8}-\x{12d6}\x{12d8}-\x{1310}\x{1312}-\x{1315}\x{1318}-\x{135a}\x{1380}-\x{138f}\x{13a0}-\x{13f4}\x{1401}-\x{166c}\x{166f}-\x{167f}\x{1681}-\x{169a}\x{16a0}-\x{16ea}\x{16ee}-\x{16f0}\x{1700}-\x{170c}\x{170e}-\x{1711}\x{1720}-\x{1731}\x{1740}-\x{1751}\x{1760}-\x{176c}\x{176e}-\x{1770}\x{1780}-\x{17b3}\x{17d7}\x{17dc}\x{1820}-\x{1877}\x{1880}-\x{18a8}\x{18aa}\x{18b0}-\x{18f5}\x{1900}-\x{191c}\x{1950}-\x{196d}\x{1970}-\x{1974}\x{1980}-\x{19ab}\x{19c1}-\x{19c7}\x{1a00}-\x{1a16}\x{1a20}-\x{1a54}\x{1aa7}\x{1b05}-\x{1b33}\x{1b45}-\x{1b4b}\x{1b83}-\x{1ba0}\x{1bae}\x{1baf}\x{1bba}-\x{1be5}\x{1c00}-\x{1c23}\x{1c4d}-\x{1c4f}\x{1c5a}-\x{1c7d}\x{1ce9}-\x{1cec}\x{1cee}-\x{1cf1}\x{1cf5}\x{1cf6}\x{1d00}-\x{1dbf}\x{1e00}-\x{1f15}\x{1f18}-\x{1f1d}\x{1f20}-\x{1f45}\x{1f48}-\x{1f4d}\x{1f50}-\x{1f57}\x{1f59}\x{1f5b}\x{1f5d}\x{1f5f}-\x{1f7d}\x{1f80}-\x{1fb4}\x{1fb6}-\x{1fbc}\x{1fbe}\x{1fc2}-\x{1fc4}\x{1fc6}-\x{1fcc}\x{1fd0}-\x{1fd3}\x{1fd6}-\x{1fdb}\x{1fe0}-\x{1fec}\x{1ff2}-\x{1ff4}\x{1ff6}-\x{1ffc}\x{2071}\x{207f}\x{2090}-\x{209c}\x{2102}\x{2107}\x{210a}-\x{2113}\x{2115}\x{2119}-\x{211d}\x{2124}\x{2126}\x{2128}\x{212a}-\x{212d}\x{212f}-\x{2139}\x{213c}-\x{213f}\x{2145}-\x{2149}\x{214e}\x{2160}-\x{2188}\x{2c00}-\x{2c2e}\x{2c30}-\x{2c5e}\x{2c60}-\x{2ce4}\x{2ceb}-\x{2cee}\x{2cf2}\x{2cf3}\x{2d00}-\x{2d25}\x{2d27}\x{2d2d}\x{2d30}-\x{2d67}\x{2d6f}\x{2d80}-\x{2d96}\x{2da0}-\x{2da6}\x{2da8}-\x{2dae}\x{2db0}-\x{2db6}\x{2db8}-\x{2dbe}\x{2dc0}-\x{2dc6}\x{2dc8}-\x{2dce}\x{2dd0}-\x{2dd6}\x{2dd8}-\x{2dde}\x{2e2f}\x{3005}-\x{3007}\x{3021}-\x{3029}\x{3031}-\x{3035}\x{3038}-\x{303c}\x{3041}-\x{3096}\x{309d}-\x{309f}\x{30a1}-\x{30fa}\x{30fc}-\x{30ff}\x{3105}-\x{312d}\x{3131}-\x{318e}\x{31a0}-\x{31ba}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{4e00}-\x{9fcc}\x{a000}-\x{a48c}\x{a4d0}-\x{a4fd}\x{a500}-\x{a60c}\x{a610}-\x{a61f}\x{a62a}\x{a62b}\x{a640}-\x{a66e}\x{a67f}-\x{a697}\x{a6a0}-\x{a6ef}\x{a717}-\x{a71f}\x{a722}-\x{a788}\x{a78b}-\x{a78e}\x{a790}-\x{a793}\x{a7a0}-\x{a7aa}\x{a7f8}-\x{a801}\x{a803}-\x{a805}\x{a807}-\x{a80a}\x{a80c}-\x{a822}\x{a840}-\x{a873}\x{a882}-\x{a8b3}\x{a8f2}-\x{a8f7}\x{a8fb}\x{a90a}-\x{a925}\x{a930}-\x{a946}\x{a960}-\x{a97c}\x{a984}-\x{a9b2}\x{a9cf}\x{aa00}-\x{aa28}\x{aa40}-\x{aa42}\x{aa44}-\x{aa4b}\x{aa60}-\x{aa76}\x{aa7a}\x{aa80}-\x{aaaf}\x{aab1}\x{aab5}\x{aab6}\x{aab9}-\x{aabd}\x{aac0}\x{aac2}\x{aadb}-\x{aadd}\x{aae0}-\x{aaea}\x{aaf2}-\x{aaf4}\x{ab01}-\x{ab06}\x{ab09}-\x{ab0e}\x{ab11}-\x{ab16}\x{ab20}-\x{ab26}\x{ab28}-\x{ab2e}\x{abc0}-\x{abe2}\x{ac00}-\x{d7a3}\x{d7b0}-\x{d7c6}\x{d7cb}-\x{d7fb}\x{f900}-\x{fa6d}\x{fa70}-\x{fad9}\x{fb00}-\x{fb06}\x{fb13}-\x{fb17}\x{fb1d}\x{fb1f}-\x{fb28}\x{fb2a}-\x{fb36}\x{fb38}-\x{fb3c}\x{fb3e}\x{fb40}\x{fb41}\x{fb43}\x{fb44}\x{fb46}-\x{fbb1}\x{fbd3}-\x{fd3d}\x{fd50}-\x{fd8f}\x{fd92}-\x{fdc7}\x{fdf0}-\x{fdfb}\x{fe70}-\x{fe74}\x{fe76}-\x{fefc}\x{ff21}-\x{ff3a}\x{ff41}-\x{ff5a}\x{ff66}-\x{ffbe}\x{ffc2}-\x{ffc7}\x{ffca}-\x{ffcf}\x{ffd2}-\x{ffd7}\x{ffda}-\x{ffdc}][$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\x{02c1}\x{02c6}-\x{02d1}\x{02e0}-\x{02e4}\x{02ec}\x{02ee}\x{0370}-\x{0374}\x{0376}\x{0377}\x{037a}-\x{037d}\x{0386}\x{0388}-\x{038a}\x{038c}\x{038e}-\x{03a1}\x{03a3}-\x{03f5}\x{03f7}-\x{0481}\x{048a}-\x{0527}\x{0531}-\x{0556}\x{0559}\x{0561}-\x{0587}\x{05d0}-\x{05ea}\x{05f0}-\x{05f2}\x{0620}-\x{064a}\x{066e}\x{066f}\x{0671}-\x{06d3}\x{06d5}\x{06e5}\x{06e6}\x{06ee}\x{06ef}\x{06fa}-\x{06fc}\x{06ff}\x{0710}\x{0712}-\x{072f}\x{074d}-\x{07a5}\x{07b1}\x{07ca}-\x{07ea}\x{07f4}\x{07f5}\x{07fa}\x{0800}-\x{0815}\x{081a}\x{0824}\x{0828}\x{0840}-\x{0858}\x{08a0}\x{08a2}-\x{08ac}\x{0904}-\x{0939}\x{093d}\x{0950}\x{0958}-\x{0961}\x{0971}-\x{0977}\x{0979}-\x{097f}\x{0985}-\x{098c}\x{098f}\x{0990}\x{0993}-\x{09a8}\x{09aa}-\x{09b0}\x{09b2}\x{09b6}-\x{09b9}\x{09bd}\x{09ce}\x{09dc}\x{09dd}\x{09df}-\x{09e1}\x{09f0}\x{09f1}\x{0a05}-\x{0a0a}\x{0a0f}\x{0a10}\x{0a13}-\x{0a28}\x{0a2a}-\x{0a30}\x{0a32}\x{0a33}\x{0a35}\x{0a36}\x{0a38}\x{0a39}\x{0a59}-\x{0a5c}\x{0a5e}\x{0a72}-\x{0a74}\x{0a85}-\x{0a8d}\x{0a8f}-\x{0a91}\x{0a93}-\x{0aa8}\x{0aaa}-\x{0ab0}\x{0ab2}\x{0ab3}\x{0ab5}-\x{0ab9}\x{0abd}\x{0ad0}\x{0ae0}\x{0ae1}\x{0b05}-\x{0b0c}\x{0b0f}\x{0b10}\x{0b13}-\x{0b28}\x{0b2a}-\x{0b30}\x{0b32}\x{0b33}\x{0b35}-\x{0b39}\x{0b3d}\x{0b5c}\x{0b5d}\x{0b5f}-\x{0b61}\x{0b71}\x{0b83}\x{0b85}-\x{0b8a}\x{0b8e}-\x{0b90}\x{0b92}-\x{0b95}\x{0b99}\x{0b9a}\x{0b9c}\x{0b9e}\x{0b9f}\x{0ba3}\x{0ba4}\x{0ba8}-\x{0baa}\x{0bae}-\x{0bb9}\x{0bd0}\x{0c05}-\x{0c0c}\x{0c0e}-\x{0c10}\x{0c12}-\x{0c28}\x{0c2a}-\x{0c33}\x{0c35}-\x{0c39}\x{0c3d}\x{0c58}\x{0c59}\x{0c60}\x{0c61}\x{0c85}-\x{0c8c}\x{0c8e}-\x{0c90}\x{0c92}-\x{0ca8}\x{0caa}-\x{0cb3}\x{0cb5}-\x{0cb9}\x{0cbd}\x{0cde}\x{0ce0}\x{0ce1}\x{0cf1}\x{0cf2}\x{0d05}-\x{0d0c}\x{0d0e}-\x{0d10}\x{0d12}-\x{0d3a}\x{0d3d}\x{0d4e}\x{0d60}\x{0d61}\x{0d7a}-\x{0d7f}\x{0d85}-\x{0d96}\x{0d9a}-\x{0db1}\x{0db3}-\x{0dbb}\x{0dbd}\x{0dc0}-\x{0dc6}\x{0e01}-\x{0e30}\x{0e32}\x{0e33}\x{0e40}-\x{0e46}\x{0e81}\x{0e82}\x{0e84}\x{0e87}\x{0e88}\x{0e8a}\x{0e8d}\x{0e94}-\x{0e97}\x{0e99}-\x{0e9f}\x{0ea1}-\x{0ea3}\x{0ea5}\x{0ea7}\x{0eaa}\x{0eab}\x{0ead}-\x{0eb0}\x{0eb2}\x{0eb3}\x{0ebd}\x{0ec0}-\x{0ec4}\x{0ec6}\x{0edc}-\x{0edf}\x{0f00}\x{0f40}-\x{0f47}\x{0f49}-\x{0f6c}\x{0f88}-\x{0f8c}\x{1000}-\x{102a}\x{103f}\x{1050}-\x{1055}\x{105a}-\x{105d}\x{1061}\x{1065}\x{1066}\x{106e}-\x{1070}\x{1075}-\x{1081}\x{108e}\x{10a0}-\x{10c5}\x{10c7}\x{10cd}\x{10d0}-\x{10fa}\x{10fc}-\x{1248}\x{124a}-\x{124d}\x{1250}-\x{1256}\x{1258}\x{125a}-\x{125d}\x{1260}-\x{1288}\x{128a}-\x{128d}\x{1290}-\x{12b0}\x{12b2}-\x{12b5}\x{12b8}-\x{12be}\x{12c0}\x{12c2}-\x{12c5}\x{12c8}-\x{12d6}\x{12d8}-\x{1310}\x{1312}-\x{1315}\x{1318}-\x{135a}\x{1380}-\x{138f}\x{13a0}-\x{13f4}\x{1401}-\x{166c}\x{166f}-\x{167f}\x{1681}-\x{169a}\x{16a0}-\x{16ea}\x{16ee}-\x{16f0}\x{1700}-\x{170c}\x{170e}-\x{1711}\x{1720}-\x{1731}\x{1740}-\x{1751}\x{1760}-\x{176c}\x{176e}-\x{1770}\x{1780}-\x{17b3}\x{17d7}\x{17dc}\x{1820}-\x{1877}\x{1880}-\x{18a8}\x{18aa}\x{18b0}-\x{18f5}\x{1900}-\x{191c}\x{1950}-\x{196d}\x{1970}-\x{1974}\x{1980}-\x{19ab}\x{19c1}-\x{19c7}\x{1a00}-\x{1a16}\x{1a20}-\x{1a54}\x{1aa7}\x{1b05}-\x{1b33}\x{1b45}-\x{1b4b}\x{1b83}-\x{1ba0}\x{1bae}\x{1baf}\x{1bba}-\x{1be5}\x{1c00}-\x{1c23}\x{1c4d}-\x{1c4f}\x{1c5a}-\x{1c7d}\x{1ce9}-\x{1cec}\x{1cee}-\x{1cf1}\x{1cf5}\x{1cf6}\x{1d00}-\x{1dbf}\x{1e00}-\x{1f15}\x{1f18}-\x{1f1d}\x{1f20}-\x{1f45}\x{1f48}-\x{1f4d}\x{1f50}-\x{1f57}\x{1f59}\x{1f5b}\x{1f5d}\x{1f5f}-\x{1f7d}\x{1f80}-\x{1fb4}\x{1fb6}-\x{1fbc}\x{1fbe}\x{1fc2}-\x{1fc4}\x{1fc6}-\x{1fcc}\x{1fd0}-\x{1fd3}\x{1fd6}-\x{1fdb}\x{1fe0}-\x{1fec}\x{1ff2}-\x{1ff4}\x{1ff6}-\x{1ffc}\x{2071}\x{207f}\x{2090}-\x{209c}\x{2102}\x{2107}\x{210a}-\x{2113}\x{2115}\x{2119}-\x{211d}\x{2124}\x{2126}\x{2128}\x{212a}-\x{212d}\x{212f}-\x{2139}\x{213c}-\x{213f}\x{2145}-\x{2149}\x{214e}\x{2160}-\x{2188}\x{2c00}-\x{2c2e}\x{2c30}-\x{2c5e}\x{2c60}-\x{2ce4}\x{2ceb}-\x{2cee}\x{2cf2}\x{2cf3}\x{2d00}-\x{2d25}\x{2d27}\x{2d2d}\x{2d30}-\x{2d67}\x{2d6f}\x{2d80}-\x{2d96}\x{2da0}-\x{2da6}\x{2da8}-\x{2dae}\x{2db0}-\x{2db6}\x{2db8}-\x{2dbe}\x{2dc0}-\x{2dc6}\x{2dc8}-\x{2dce}\x{2dd0}-\x{2dd6}\x{2dd8}-\x{2dde}\x{2e2f}\x{3005}-\x{3007}\x{3021}-\x{3029}\x{3031}-\x{3035}\x{3038}-\x{303c}\x{3041}-\x{3096}\x{309d}-\x{309f}\x{30a1}-\x{30fa}\x{30fc}-\x{30ff}\x{3105}-\x{312d}\x{3131}-\x{318e}\x{31a0}-\x{31ba}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{4e00}-\x{9fcc}\x{a000}-\x{a48c}\x{a4d0}-\x{a4fd}\x{a500}-\x{a60c}\x{a610}-\x{a61f}\x{a62a}\x{a62b}\x{a640}-\x{a66e}\x{a67f}-\x{a697}\x{a6a0}-\x{a6ef}\x{a717}-\x{a71f}\x{a722}-\x{a788}\x{a78b}-\x{a78e}\x{a790}-\x{a793}\x{a7a0}-\x{a7aa}\x{a7f8}-\x{a801}\x{a803}-\x{a805}\x{a807}-\x{a80a}\x{a80c}-\x{a822}\x{a840}-\x{a873}\x{a882}-\x{a8b3}\x{a8f2}-\x{a8f7}\x{a8fb}\x{a90a}-\x{a925}\x{a930}-\x{a946}\x{a960}-\x{a97c}\x{a984}-\x{a9b2}\x{a9cf}\x{aa00}-\x{aa28}\x{aa40}-\x{aa42}\x{aa44}-\x{aa4b}\x{aa60}-\x{aa76}\x{aa7a}\x{aa80}-\x{aaaf}\x{aab1}\x{aab5}\x{aab6}\x{aab9}-\x{aabd}\x{aac0}\x{aac2}\x{aadb}-\x{aadd}\x{aae0}-\x{aaea}\x{aaf2}-\x{aaf4}\x{ab01}-\x{ab06}\x{ab09}-\x{ab0e}\x{ab11}-\x{ab16}\x{ab20}-\x{ab26}\x{ab28}-\x{ab2e}\x{abc0}-\x{abe2}\x{ac00}-\x{d7a3}\x{d7b0}-\x{d7c6}\x{d7cb}-\x{d7fb}\x{f900}-\x{fa6d}\x{fa70}-\x{fad9}\x{fb00}-\x{fb06}\x{fb13}-\x{fb17}\x{fb1d}\x{fb1f}-\x{fb28}\x{fb2a}-\x{fb36}\x{fb38}-\x{fb3c}\x{fb3e}\x{fb40}\x{fb41}\x{fb43}\x{fb44}\x{fb46}-\x{fbb1}\x{fbd3}-\x{fd3d}\x{fd50}-\x{fd8f}\x{fd92}-\x{fdc7}\x{fdf0}-\x{fdfb}\x{fe70}-\x{fe74}\x{fe76}-\x{fefc}\x{ff21}-\x{ff3a}\x{ff41}-\x{ff5a}\x{ff66}-\x{ffbe}\x{ffc2}-\x{ffc7}\x{ffca}-\x{ffcf}\x{ffd2}-\x{ffd7}\x{ffda}-\x{ffdc}0-9\x{0300}-\x{036f}\x{0483}-\x{0487}\x{0591}-\x{05bd}\x{05bf}\x{05c1}\x{05c2}\x{05c4}\x{05c5}\x{05c7}\x{0610}-\x{061a}\x{064b}-\x{0669}\x{0670}\x{06d6}-\x{06dc}\x{06df}-\x{06e4}\x{06e7}\x{06e8}\x{06ea}-\x{06ed}\x{06f0}-\x{06f9}\x{0711}\x{0730}-\x{074a}\x{07a6}-\x{07b0}\x{07c0}-\x{07c9}\x{07eb}-\x{07f3}\x{0816}-\x{0819}\x{081b}-\x{0823}\x{0825}-\x{0827}\x{0829}-\x{082d}\x{0859}-\x{085b}\x{08e4}-\x{08fe}\x{0900}-\x{0903}\x{093a}-\x{093c}\x{093e}-\x{094f}\x{0951}-\x{0957}\x{0962}\x{0963}\x{0966}-\x{096f}\x{0981}-\x{0983}\x{09bc}\x{09be}-\x{09c4}\x{09c7}\x{09c8}\x{09cb}-\x{09cd}\x{09d7}\x{09e2}\x{09e3}\x{09e6}-\x{09ef}\x{0a01}-\x{0a03}\x{0a3c}\x{0a3e}-\x{0a42}\x{0a47}\x{0a48}\x{0a4b}-\x{0a4d}\x{0a51}\x{0a66}-\x{0a71}\x{0a75}\x{0a81}-\x{0a83}\x{0abc}\x{0abe}-\x{0ac5}\x{0ac7}-\x{0ac9}\x{0acb}-\x{0acd}\x{0ae2}\x{0ae3}\x{0ae6}-\x{0aef}\x{0b01}-\x{0b03}\x{0b3c}\x{0b3e}-\x{0b44}\x{0b47}\x{0b48}\x{0b4b}-\x{0b4d}\x{0b56}\x{0b57}\x{0b62}\x{0b63}\x{0b66}-\x{0b6f}\x{0b82}\x{0bbe}-\x{0bc2}\x{0bc6}-\x{0bc8}\x{0bca}-\x{0bcd}\x{0bd7}\x{0be6}-\x{0bef}\x{0c01}-\x{0c03}\x{0c3e}-\x{0c44}\x{0c46}-\x{0c48}\x{0c4a}-\x{0c4d}\x{0c55}\x{0c56}\x{0c62}\x{0c63}\x{0c66}-\x{0c6f}\x{0c82}\x{0c83}\x{0cbc}\x{0cbe}-\x{0cc4}\x{0cc6}-\x{0cc8}\x{0cca}-\x{0ccd}\x{0cd5}\x{0cd6}\x{0ce2}\x{0ce3}\x{0ce6}-\x{0cef}\x{0d02}\x{0d03}\x{0d3e}-\x{0d44}\x{0d46}-\x{0d48}\x{0d4a}-\x{0d4d}\x{0d57}\x{0d62}\x{0d63}\x{0d66}-\x{0d6f}\x{0d82}\x{0d83}\x{0dca}\x{0dcf}-\x{0dd4}\x{0dd6}\x{0dd8}-\x{0ddf}\x{0df2}\x{0df3}\x{0e31}\x{0e34}-\x{0e3a}\x{0e47}-\x{0e4e}\x{0e50}-\x{0e59}\x{0eb1}\x{0eb4}-\x{0eb9}\x{0ebb}\x{0ebc}\x{0ec8}-\x{0ecd}\x{0ed0}-\x{0ed9}\x{0f18}\x{0f19}\x{0f20}-\x{0f29}\x{0f35}\x{0f37}\x{0f39}\x{0f3e}\x{0f3f}\x{0f71}-\x{0f84}\x{0f86}\x{0f87}\x{0f8d}-\x{0f97}\x{0f99}-\x{0fbc}\x{0fc6}\x{102b}-\x{103e}\x{1040}-\x{1049}\x{1056}-\x{1059}\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}-\x{109d}\x{135d}-\x{135f}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}\x{1753}\x{1772}\x{1773}\x{17b4}-\x{17d3}\x{17dd}\x{17e0}-\x{17e9}\x{180b}-\x{180d}\x{1810}-\x{1819}\x{18a9}\x{1920}-\x{192b}\x{1930}-\x{193b}\x{1946}-\x{194f}\x{19b0}-\x{19c0}\x{19c8}\x{19c9}\x{19d0}-\x{19d9}\x{1a17}-\x{1a1b}\x{1a55}-\x{1a5e}\x{1a60}-\x{1a7c}\x{1a7f}-\x{1a89}\x{1a90}-\x{1a99}\x{1b00}-\x{1b04}\x{1b34}-\x{1b44}\x{1b50}-\x{1b59}\x{1b6b}-\x{1b73}\x{1b80}-\x{1b82}\x{1ba1}-\x{1bad}\x{1bb0}-\x{1bb9}\x{1be6}-\x{1bf3}\x{1c24}-\x{1c37}\x{1c40}-\x{1c49}\x{1c50}-\x{1c59}\x{1cd0}-\x{1cd2}\x{1cd4}-\x{1ce8}\x{1ced}\x{1cf2}-\x{1cf4}\x{1dc0}-\x{1de6}\x{1dfc}-\x{1dff}\x{200c}\x{200d}\x{203f}\x{2040}\x{2054}\x{20d0}-\x{20dc}\x{20e1}\x{20e5}-\x{20f0}\x{2cef}-\x{2cf1}\x{2d7f}\x{2de0}-\x{2dff}\x{302a}-\x{302f}\x{3099}\x{309a}\x{a620}-\x{a629}\x{a66f}\x{a674}-\x{a67d}\x{a69f}\x{a6f0}\x{a6f1}\x{a802}\x{a806}\x{a80b}\x{a823}-\x{a827}\x{a880}\x{a881}\x{a8b4}-\x{a8c4}\x{a8d0}-\x{a8d9}\x{a8e0}-\x{a8f1}\x{a900}-\x{a909}\x{a926}-\x{a92d}\x{a947}-\x{a953}\x{a980}-\x{a983}\x{a9b3}-\x{a9c0}\x{a9d0}-\x{a9d9}\x{aa29}-\x{aa36}\x{aa43}\x{aa4c}\x{aa4d}\x{aa50}-\x{aa59}\x{aa7b}\x{aab0}\x{aab2}-\x{aab4}\x{aab7}\x{aab8}\x{aabe}\x{aabf}\x{aac1}\x{aaeb}-\x{aaef}\x{aaf5}\x{aaf6}\x{abe3}-\x{abea}\x{abec}\x{abed}\x{abf0}-\x{abf9}\x{fb1e}\x{fe00}-\x{fe0f}\x{fe20}-\x{fe26}\x{fe33}\x{fe34}\x{fe4d}-\x{fe4f}\x{ff10}-\x{ff19}\x{ff3f}]*\b';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Full list of JavaScript reserved words.
|
38 |
+
* Will be loaded from /data/js/keywords_reserved.txt.
|
39 |
+
*
|
40 |
+
* @see https://mathiasbynens.be/notes/reserved-keywords
|
41 |
+
*
|
42 |
+
* @var string[]
|
43 |
+
*/
|
44 |
+
protected $keywordsReserved = array();
|
45 |
+
|
46 |
+
/**
|
47 |
+
* List of JavaScript reserved words that accept a <variable, value, ...>
|
48 |
+
* after them. Some end of lines are not the end of a statement, like with
|
49 |
+
* these keywords.
|
50 |
+
*
|
51 |
+
* E.g.: we shouldn't insert a ; after this else
|
52 |
+
* else
|
53 |
+
* console.log('this is quite fine')
|
54 |
+
*
|
55 |
+
* Will be loaded from /data/js/keywords_before.txt
|
56 |
+
*
|
57 |
+
* @var string[]
|
58 |
+
*/
|
59 |
+
protected $keywordsBefore = array();
|
60 |
+
|
61 |
+
/**
|
62 |
+
* List of JavaScript reserved words that accept a <variable, value, ...>
|
63 |
+
* before them. Some end of lines are not the end of a statement, like when
|
64 |
+
* continued by one of these keywords on the newline.
|
65 |
+
*
|
66 |
+
* E.g.: we shouldn't insert a ; before this instanceof
|
67 |
+
* variable
|
68 |
+
* instanceof String
|
69 |
+
*
|
70 |
+
* Will be loaded from /data/js/keywords_after.txt
|
71 |
+
*
|
72 |
+
* @var string[]
|
73 |
+
*/
|
74 |
+
protected $keywordsAfter = array();
|
75 |
+
|
76 |
+
/**
|
77 |
+
* List of all JavaScript operators.
|
78 |
+
*
|
79 |
+
* Will be loaded from /data/js/operators.txt
|
80 |
+
*
|
81 |
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
|
82 |
+
*
|
83 |
+
* @var string[]
|
84 |
+
*/
|
85 |
+
protected $operators = array();
|
86 |
+
|
87 |
+
/**
|
88 |
+
* List of JavaScript operators that accept a <variable, value, ...> after
|
89 |
+
* them. Some end of lines are not the end of a statement, like with these
|
90 |
+
* operators.
|
91 |
+
*
|
92 |
+
* Note: Most operators are fine, we've only removed ++ and --.
|
93 |
+
* ++ & -- have to be joined with the value they're in-/decrementing.
|
94 |
+
*
|
95 |
+
* Will be loaded from /data/js/operators_before.txt
|
96 |
+
*
|
97 |
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
|
98 |
+
*
|
99 |
+
* @var string[]
|
100 |
+
*/
|
101 |
+
protected $operatorsBefore = array();
|
102 |
+
|
103 |
+
/**
|
104 |
+
* List of JavaScript operators that accept a <variable, value, ...> before
|
105 |
+
* them. Some end of lines are not the end of a statement, like when
|
106 |
+
* continued by one of these operators on the newline.
|
107 |
+
*
|
108 |
+
* Note: Most operators are fine, we've only removed ), ], ++, --, ! and ~.
|
109 |
+
* There can't be a newline separating ! or ~ and whatever it is negating.
|
110 |
+
* ++ & -- have to be joined with the value they're in-/decrementing.
|
111 |
+
* ) & ] are "special" in that they have lots or usecases. () for example
|
112 |
+
* is used for function calls, for grouping, in if () and for (), ...
|
113 |
+
*
|
114 |
+
* Will be loaded from /data/js/operators_after.txt
|
115 |
+
*
|
116 |
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
|
117 |
+
*
|
118 |
+
* @var string[]
|
119 |
+
*/
|
120 |
+
protected $operatorsAfter = array();
|
121 |
+
|
122 |
+
/**
|
123 |
+
* {@inheritdoc}
|
124 |
+
*/
|
125 |
+
public function __construct()
|
126 |
+
{
|
127 |
+
call_user_func_array(array('parent', '__construct'), func_get_args());
|
128 |
+
|
129 |
+
$dataDir = __DIR__.'/../data/js/';
|
130 |
+
$options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES;
|
131 |
+
$this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options);
|
132 |
+
$this->keywordsBefore = file($dataDir.'keywords_before.txt', $options);
|
133 |
+
$this->keywordsAfter = file($dataDir.'keywords_after.txt', $options);
|
134 |
+
$this->operators = file($dataDir.'operators.txt', $options);
|
135 |
+
$this->operatorsBefore = file($dataDir.'operators_before.txt', $options);
|
136 |
+
$this->operatorsAfter = file($dataDir.'operators_after.txt', $options);
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Minify the data.
|
141 |
+
* Perform JS optimizations.
|
142 |
+
*
|
143 |
+
* @param string[optional] $path Path to write the data to
|
144 |
+
*
|
145 |
+
* @return string The minified data
|
146 |
+
*/
|
147 |
+
public function execute($path = null)
|
148 |
+
{
|
149 |
+
$content = '';
|
150 |
+
|
151 |
+
/*
|
152 |
+
* Let's first take out strings, comments and regular expressions.
|
153 |
+
* All of these can contain JS code-like characters, and we should make
|
154 |
+
* sure any further magic ignores anything inside of these.
|
155 |
+
*
|
156 |
+
* Consider this example, where we should not strip any whitespace:
|
157 |
+
* var str = "a test";
|
158 |
+
*
|
159 |
+
* Comments will be removed altogether, strings and regular expressions
|
160 |
+
* will be replaced by placeholder text, which we'll restore later.
|
161 |
+
*/
|
162 |
+
$this->extractStrings('\'"`');
|
163 |
+
$this->stripComments();
|
164 |
+
$this->extractRegex();
|
165 |
+
|
166 |
+
// loop files
|
167 |
+
foreach ($this->data as $source => $js) {
|
168 |
+
// take out strings, comments & regex (for which we've registered
|
169 |
+
// the regexes just a few lines earlier)
|
170 |
+
$js = $this->replace($js);
|
171 |
+
|
172 |
+
$js = $this->propertyNotation($js);
|
173 |
+
$js = $this->shortenBools($js);
|
174 |
+
$js = $this->stripWhitespace($js);
|
175 |
+
|
176 |
+
// combine js: separating the scripts by a ;
|
177 |
+
$content .= $js.";";
|
178 |
+
}
|
179 |
+
|
180 |
+
// clean up leftover `;`s from the combination of multiple scripts
|
181 |
+
$content = ltrim($content, ';');
|
182 |
+
$content = (string) substr($content, 0, -1);
|
183 |
+
|
184 |
+
/*
|
185 |
+
* Earlier, we extracted strings & regular expressions and replaced them
|
186 |
+
* with placeholder text. This will restore them.
|
187 |
+
*/
|
188 |
+
$content = $this->restoreExtractedData($content);
|
189 |
+
|
190 |
+
return $content;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Strip comments from source code.
|
195 |
+
*/
|
196 |
+
protected function stripComments()
|
197 |
+
{
|
198 |
+
// PHP only supports $this inside anonymous functions since 5.4
|
199 |
+
$minifier = $this;
|
200 |
+
$callback = function ($match) use ($minifier) {
|
201 |
+
$count = count($minifier->extracted);
|
202 |
+
$placeholder = '/*'.$count.'*/';
|
203 |
+
$minifier->extracted[$placeholder] = $match[0];
|
204 |
+
|
205 |
+
return $placeholder;
|
206 |
+
};
|
207 |
+
// multi-line comments
|
208 |
+
$this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback);
|
209 |
+
$this->registerPattern('/\/\*.*?\*\//s', '');
|
210 |
+
|
211 |
+
// single-line comments
|
212 |
+
$this->registerPattern('/\/\/.*$/m', '');
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* JS can have /-delimited regular expressions, like: /ab+c/.match(string).
|
217 |
+
*
|
218 |
+
* The content inside the regex can contain characters that may be confused
|
219 |
+
* for JS code: e.g. it could contain whitespace it needs to match & we
|
220 |
+
* don't want to strip whitespace in there.
|
221 |
+
*
|
222 |
+
* The regex can be pretty simple: we don't have to care about comments,
|
223 |
+
* (which also use slashes) because stripComments() will have stripped those
|
224 |
+
* already.
|
225 |
+
*
|
226 |
+
* This method will replace all string content with simple REGEX#
|
227 |
+
* placeholder text, so we've rid all regular expressions from characters
|
228 |
+
* that may be misinterpreted. Original regex content will be saved in
|
229 |
+
* $this->extracted and after doing all other minifying, we can restore the
|
230 |
+
* original content via restoreRegex()
|
231 |
+
*/
|
232 |
+
protected function extractRegex()
|
233 |
+
{
|
234 |
+
// PHP only supports $this inside anonymous functions since 5.4
|
235 |
+
$minifier = $this;
|
236 |
+
$callback = function ($match) use ($minifier) {
|
237 |
+
$count = count($minifier->extracted);
|
238 |
+
$placeholder = '"'.$count.'"';
|
239 |
+
$minifier->extracted[$placeholder] = $match[0];
|
240 |
+
|
241 |
+
return $placeholder;
|
242 |
+
};
|
243 |
+
|
244 |
+
// match all chars except `/` and `\`
|
245 |
+
// `\` is allowed though, along with whatever char follows (which is the
|
246 |
+
// one being escaped)
|
247 |
+
// this should allow all chars, except for an unescaped `/` (= the one
|
248 |
+
// closing the regex)
|
249 |
+
// then also ignore bare `/` inside `[]`, where they don't need to be
|
250 |
+
// escaped: anything inside `[]` can be ignored safely
|
251 |
+
$pattern = '\\/(?!\*)(?:[^\\[\\/\\\\\n\r]++|(?:\\\\.)++|(?:\\[(?:[^\\]\\\\\n\r]++|(?:\\\\.)++)++\\])++)++\\/[gimuy]*';
|
252 |
+
|
253 |
+
// a regular expression can only be followed by a few operators or some
|
254 |
+
// of the RegExp methods (a `\` followed by a variable or value is
|
255 |
+
// likely part of a division, not a regex)
|
256 |
+
$keywords = array('do', 'in', 'new', 'else', 'throw', 'yield', 'delete', 'return', 'typeof');
|
257 |
+
$before = '([=:,;\+\-\*\/\}\(\{\[&\|!]|^|'.implode('|', $keywords).')\s*';
|
258 |
+
$propertiesAndMethods = array(
|
259 |
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Properties_2
|
260 |
+
'constructor',
|
261 |
+
'flags',
|
262 |
+
'global',
|
263 |
+
'ignoreCase',
|
264 |
+
'multiline',
|
265 |
+
'source',
|
266 |
+
'sticky',
|
267 |
+
'unicode',
|
268 |
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Methods_2
|
269 |
+
'compile(',
|
270 |
+
'exec(',
|
271 |
+
'test(',
|
272 |
+
'toSource(',
|
273 |
+
'toString(',
|
274 |
+
);
|
275 |
+
$delimiters = array_fill(0, count($propertiesAndMethods), '/');
|
276 |
+
$propertiesAndMethods = array_map('preg_quote', $propertiesAndMethods, $delimiters);
|
277 |
+
$after = '(?=\s*([\.,;\)\}&\|+]|\/\/|$|\.('.implode('|', $propertiesAndMethods).')))';
|
278 |
+
$this->registerPattern('/'.$before.'\K'.$pattern.$after.'/', $callback);
|
279 |
+
|
280 |
+
// regular expressions following a `)` are rather annoying to detect...
|
281 |
+
// quite often, `/` after `)` is a division operator & if it happens to
|
282 |
+
// be followed by another one (or a comment), it is likely to be
|
283 |
+
// confused for a regular expression
|
284 |
+
// however, it's perfectly possible for a regex to follow a `)`: after
|
285 |
+
// a single-line `if()`, `while()`, ... statement, for example
|
286 |
+
// since, when they occur like that, they're always the start of a
|
287 |
+
// statement, there's only a limited amount of ways they can be useful:
|
288 |
+
// by calling the regex methods directly
|
289 |
+
// if a regex following `)` is not followed by `.<property or method>`,
|
290 |
+
// it's quite likely not a regex
|
291 |
+
$before = '\)\s*';
|
292 |
+
$after = '(?=\s*\.('.implode('|', $propertiesAndMethods).'))';
|
293 |
+
$this->registerPattern('/'.$before.'\K'.$pattern.$after.'/', $callback);
|
294 |
+
|
295 |
+
// 1 more edge case: a regex can be followed by a lot more operators or
|
296 |
+
// keywords if there's a newline (ASI) in between, where the operator
|
297 |
+
// actually starts a new statement
|
298 |
+
// (https://github.com/matthiasmullie/minify/issues/56)
|
299 |
+
$operators = $this->getOperatorsForRegex($this->operatorsBefore, '/');
|
300 |
+
$operators += $this->getOperatorsForRegex($this->keywordsReserved, '/');
|
301 |
+
$after = '(?=\s*\n\s*('.implode('|', $operators).'))';
|
302 |
+
$this->registerPattern('/'.$pattern.$after.'/', $callback);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Strip whitespace.
|
307 |
+
*
|
308 |
+
* We won't strip *all* whitespace, but as much as possible. The thing that
|
309 |
+
* we'll preserve are newlines we're unsure about.
|
310 |
+
* JavaScript doesn't require statements to be terminated with a semicolon.
|
311 |
+
* It will automatically fix missing semicolons with ASI (automatic semi-
|
312 |
+
* colon insertion) at the end of line causing errors (without semicolon.)
|
313 |
+
*
|
314 |
+
* Because it's sometimes hard to tell if a newline is part of a statement
|
315 |
+
* that should be terminated or not, we'll just leave some of them alone.
|
316 |
+
*
|
317 |
+
* @param string $content The content to strip the whitespace for
|
318 |
+
*
|
319 |
+
* @return string
|
320 |
+
*/
|
321 |
+
protected function stripWhitespace($content)
|
322 |
+
{
|
323 |
+
// uniform line endings, make them all line feed
|
324 |
+
$content = str_replace(array("\r\n", "\r"), "\n", $content);
|
325 |
+
|
326 |
+
// collapse all non-line feed whitespace into a single space
|
327 |
+
$content = preg_replace('/[^\S\n]+/', ' ', $content);
|
328 |
+
|
329 |
+
// strip leading & trailing whitespace
|
330 |
+
$content = str_replace(array(" \n", "\n "), "\n", $content);
|
331 |
+
|
332 |
+
// collapse consecutive line feeds into just 1
|
333 |
+
$content = preg_replace('/\n+/', "\n", $content);
|
334 |
+
|
335 |
+
$operatorsBefore = $this->getOperatorsForRegex($this->operatorsBefore, '/');
|
336 |
+
$operatorsAfter = $this->getOperatorsForRegex($this->operatorsAfter, '/');
|
337 |
+
$operators = $this->getOperatorsForRegex($this->operators, '/');
|
338 |
+
$keywordsBefore = $this->getKeywordsForRegex($this->keywordsBefore, '/');
|
339 |
+
$keywordsAfter = $this->getKeywordsForRegex($this->keywordsAfter, '/');
|
340 |
+
|
341 |
+
// strip whitespace that ends in (or next line begin with) an operator
|
342 |
+
// that allows statements to be broken up over multiple lines
|
343 |
+
unset($operatorsBefore['+'], $operatorsBefore['-'], $operatorsAfter['+'], $operatorsAfter['-']);
|
344 |
+
$content = preg_replace(
|
345 |
+
array(
|
346 |
+
'/('.implode('|', $operatorsBefore).')\s+/',
|
347 |
+
'/\s+('.implode('|', $operatorsAfter).')/',
|
348 |
+
),
|
349 |
+
'\\1',
|
350 |
+
$content
|
351 |
+
);
|
352 |
+
|
353 |
+
// make sure + and - can't be mistaken for, or joined into ++ and --
|
354 |
+
$content = preg_replace(
|
355 |
+
array(
|
356 |
+
'/(?<![\+\-])\s*([\+\-])(?![\+\-])/',
|
357 |
+
'/(?<![\+\-])([\+\-])\s*(?![\+\-])/',
|
358 |
+
),
|
359 |
+
'\\1',
|
360 |
+
$content
|
361 |
+
);
|
362 |
+
|
363 |
+
// collapse whitespace around reserved words into single space
|
364 |
+
$content = preg_replace('/(^|[;\}\s])\K('.implode('|', $keywordsBefore).')\s+/', '\\2 ', $content);
|
365 |
+
$content = preg_replace('/\s+('.implode('|', $keywordsAfter).')(?=([;\{\s]|$))/', ' \\1', $content);
|
366 |
+
|
367 |
+
/*
|
368 |
+
* We didn't strip whitespace after a couple of operators because they
|
369 |
+
* could be used in different contexts and we can't be sure it's ok to
|
370 |
+
* strip the newlines. However, we can safely strip any non-line feed
|
371 |
+
* whitespace that follows them.
|
372 |
+
*/
|
373 |
+
$operatorsDiffBefore = array_diff($operators, $operatorsBefore);
|
374 |
+
$operatorsDiffAfter = array_diff($operators, $operatorsAfter);
|
375 |
+
$content = preg_replace('/('.implode('|', $operatorsDiffBefore).')[^\S\n]+/', '\\1', $content);
|
376 |
+
$content = preg_replace('/[^\S\n]+('.implode('|', $operatorsDiffAfter).')/', '\\1', $content);
|
377 |
+
|
378 |
+
/*
|
379 |
+
* Whitespace after `return` can be omitted in a few occasions
|
380 |
+
* (such as when followed by a string or regex)
|
381 |
+
* Same for whitespace in between `)` and `{`, or between `{` and some
|
382 |
+
* keywords.
|
383 |
+
*/
|
384 |
+
$content = preg_replace('/\breturn\s+(["\'\/\+\-])/', 'return$1', $content);
|
385 |
+
$content = preg_replace('/\)\s+\{/', '){', $content);
|
386 |
+
$content = preg_replace('/}\n(else|catch|finally)\b/', '}$1', $content);
|
387 |
+
|
388 |
+
/*
|
389 |
+
* Get rid of double semicolons, except where they can be used like:
|
390 |
+
* "for(v=1,_=b;;)", "for(v=1;;v++)" or "for(;;ja||(ja=true))".
|
391 |
+
* I'll safeguard these double semicolons inside for-loops by
|
392 |
+
* temporarily replacing them with an invalid condition: they won't have
|
393 |
+
* a double semicolon and will be easy to spot to restore afterwards.
|
394 |
+
*/
|
395 |
+
$content = preg_replace('/\bfor\(([^;]*);;([^;]*)\)/', 'for(\\1;-;\\2)', $content);
|
396 |
+
$content = preg_replace('/;+/', ';', $content);
|
397 |
+
$content = preg_replace('/\bfor\(([^;]*);-;([^;]*)\)/', 'for(\\1;;\\2)', $content);
|
398 |
+
|
399 |
+
/*
|
400 |
+
* Next, we'll be removing all semicolons where ASI kicks in.
|
401 |
+
* for-loops however, can have an empty body (ending in only a
|
402 |
+
* semicolon), like: `for(i=1;i<3;i++);`, of `for(i in list);`
|
403 |
+
* Here, nothing happens during the loop; it's just used to keep
|
404 |
+
* increasing `i`. With that ; omitted, the next line would be expected
|
405 |
+
* to be the for-loop's body... Same goes for while loops.
|
406 |
+
* I'm going to double that semicolon (if any) so after the next line,
|
407 |
+
* which strips semicolons here & there, we're still left with this one.
|
408 |
+
*/
|
409 |
+
$content = preg_replace('/(for\([^;\{]*;[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\2', $content);
|
410 |
+
$content = preg_replace('/(for\([^;\{]+\s+in\s+[^;\{]+\));(\}|$)/s', '\\1;;\\2', $content);
|
411 |
+
/*
|
412 |
+
* Below will also keep `;` after a `do{}while();` along with `while();`
|
413 |
+
* While these could be stripped after do-while, detecting this
|
414 |
+
* distinction is cumbersome, so I'll play it safe and make sure `;`
|
415 |
+
* after any kind of `while` is kept.
|
416 |
+
*/
|
417 |
+
$content = preg_replace('/(while\([^;\{]+\));(\}|$)/s', '\\1;;\\2', $content);
|
418 |
+
|
419 |
+
/*
|
420 |
+
* We also can't strip empty else-statements. Even though they're
|
421 |
+
* useless and probably shouldn't be in the code in the first place, we
|
422 |
+
* shouldn't be stripping the `;` that follows it as it breaks the code.
|
423 |
+
* We can just remove those useless else-statements completely.
|
424 |
+
*
|
425 |
+
* @see https://github.com/matthiasmullie/minify/issues/91
|
426 |
+
*/
|
427 |
+
$content = preg_replace('/else;/s', '', $content);
|
428 |
+
|
429 |
+
/*
|
430 |
+
* We also don't really want to terminate statements followed by closing
|
431 |
+
* curly braces (which we've ignored completely up until now) or end-of-
|
432 |
+
* script: ASI will kick in here & we're all about minifying.
|
433 |
+
* Semicolons at beginning of the file don't make any sense either.
|
434 |
+
*/
|
435 |
+
$content = preg_replace('/;(\}|$)/s', '\\1', $content);
|
436 |
+
$content = ltrim($content, ';');
|
437 |
+
|
438 |
+
// get rid of remaining whitespace af beginning/end
|
439 |
+
return trim($content);
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* We'll strip whitespace around certain operators with regular expressions.
|
444 |
+
* This will prepare the given array by escaping all characters.
|
445 |
+
*
|
446 |
+
* @param string[] $operators
|
447 |
+
* @param string $delimiter
|
448 |
+
*
|
449 |
+
* @return string[]
|
450 |
+
*/
|
451 |
+
protected function getOperatorsForRegex(array $operators, $delimiter = '/')
|
452 |
+
{
|
453 |
+
// escape operators for use in regex
|
454 |
+
$delimiters = array_fill(0, count($operators), $delimiter);
|
455 |
+
$escaped = array_map('preg_quote', $operators, $delimiters);
|
456 |
+
|
457 |
+
$operators = array_combine($operators, $escaped);
|
458 |
+
|
459 |
+
// ignore + & - for now, they'll get special treatment
|
460 |
+
unset($operators['+'], $operators['-']);
|
461 |
+
|
462 |
+
// dot can not just immediately follow a number; it can be confused for
|
463 |
+
// decimal point, or calling a method on it, e.g. 42 .toString()
|
464 |
+
$operators['.'] = '(?<![0-9]\s)\.';
|
465 |
+
|
466 |
+
// don't confuse = with other assignment shortcuts (e.g. +=)
|
467 |
+
$chars = preg_quote('+-*\=<>%&|', $delimiter);
|
468 |
+
$operators['='] = '(?<!['.$chars.'])\=';
|
469 |
+
|
470 |
+
return $operators;
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* We'll strip whitespace around certain keywords with regular expressions.
|
475 |
+
* This will prepare the given array by escaping all characters.
|
476 |
+
*
|
477 |
+
* @param string[] $keywords
|
478 |
+
* @param string $delimiter
|
479 |
+
*
|
480 |
+
* @return string[]
|
481 |
+
*/
|
482 |
+
protected function getKeywordsForRegex(array $keywords, $delimiter = '/')
|
483 |
+
{
|
484 |
+
// escape keywords for use in regex
|
485 |
+
$delimiter = array_fill(0, count($keywords), $delimiter);
|
486 |
+
$escaped = array_map('preg_quote', $keywords, $delimiter);
|
487 |
+
|
488 |
+
// add word boundaries
|
489 |
+
array_walk($keywords, function ($value) {
|
490 |
+
return '\b'.$value.'\b';
|
491 |
+
});
|
492 |
+
|
493 |
+
$keywords = array_combine($keywords, $escaped);
|
494 |
+
|
495 |
+
return $keywords;
|
496 |
+
}
|
497 |
+
|
498 |
+
/**
|
499 |
+
* Replaces all occurrences of array['key'] by array.key.
|
500 |
+
*
|
501 |
+
* @param string $content
|
502 |
+
*
|
503 |
+
* @return string
|
504 |
+
*/
|
505 |
+
protected function propertyNotation($content)
|
506 |
+
{
|
507 |
+
// PHP only supports $this inside anonymous functions since 5.4
|
508 |
+
$minifier = $this;
|
509 |
+
$keywords = $this->keywordsReserved;
|
510 |
+
$callback = function ($match) use ($minifier, $keywords) {
|
511 |
+
$property = trim($minifier->extracted[$match[1]], '\'"');
|
512 |
+
|
513 |
+
/*
|
514 |
+
* Check if the property is a reserved keyword. In this context (as
|
515 |
+
* property of an object literal/array) it shouldn't matter, but IE8
|
516 |
+
* freaks out with "Expected identifier".
|
517 |
+
*/
|
518 |
+
if (in_array($property, $keywords)) {
|
519 |
+
return $match[0];
|
520 |
+
}
|
521 |
+
|
522 |
+
/*
|
523 |
+
* See if the property is in a variable-like format (e.g.
|
524 |
+
* array['key-here'] can't be replaced by array.key-here since '-'
|
525 |
+
* is not a valid character there.
|
526 |
+
*/
|
527 |
+
if (!preg_match('/^'.$minifier::REGEX_VARIABLE.'$/u', $property)) {
|
528 |
+
return $match[0];
|
529 |
+
}
|
530 |
+
|
531 |
+
return '.'.$property;
|
532 |
+
};
|
533 |
+
|
534 |
+
/*
|
535 |
+
* Figure out if previous character is a variable name (of the array
|
536 |
+
* we want to use property notation on) - this is to make sure
|
537 |
+
* standalone ['value'] arrays aren't confused for keys-of-an-array.
|
538 |
+
* We can (and only have to) check the last character, because PHP's
|
539 |
+
* regex implementation doesn't allow unfixed-length look-behind
|
540 |
+
* assertions.
|
541 |
+
*/
|
542 |
+
preg_match('/(\[[^\]]+\])[^\]]*$/', static::REGEX_VARIABLE, $previousChar);
|
543 |
+
$previousChar = $previousChar[1];
|
544 |
+
|
545 |
+
/*
|
546 |
+
* Make sure word preceding the ['value'] is not a keyword, e.g.
|
547 |
+
* return['x']. Because -again- PHP's regex implementation doesn't allow
|
548 |
+
* unfixed-length look-behind assertions, I'm just going to do a lot of
|
549 |
+
* separate look-behind assertions, one for each keyword.
|
550 |
+
*/
|
551 |
+
$keywords = $this->getKeywordsForRegex($keywords);
|
552 |
+
$keywords = '(?<!'.implode(')(?<!', $keywords).')';
|
553 |
+
|
554 |
+
return preg_replace_callback('/(?<='.$previousChar.'|\])'.$keywords.'\[\s*(([\'"])[0-9]+\\2)\s*\]/u', $callback, $content);
|
555 |
+
}
|
556 |
+
|
557 |
+
/**
|
558 |
+
* Replaces true & false by !0 and !1.
|
559 |
+
*
|
560 |
+
* @param string $content
|
561 |
+
*
|
562 |
+
* @return string
|
563 |
+
*/
|
564 |
+
protected function shortenBools($content)
|
565 |
+
{
|
566 |
+
/*
|
567 |
+
* 'true' or 'false' could be used as property names (which may be
|
568 |
+
* followed by whitespace) - we must not replace those!
|
569 |
+
* Since PHP doesn't allow variable-length (to account for the
|
570 |
+
* whitespace) lookbehind assertions, I need to capture the leading
|
571 |
+
* character and check if it's a `.`
|
572 |
+
*/
|
573 |
+
$callback = function ($match) {
|
574 |
+
if (trim($match[1]) === '.') {
|
575 |
+
return $match[0];
|
576 |
+
}
|
577 |
+
|
578 |
+
return $match[1].($match[2] === 'true' ? '!0' : '!1');
|
579 |
+
};
|
580 |
+
$content = preg_replace_callback('/(^|.\s*)\b(true|false)\b(?!:)/', $callback, $content);
|
581 |
+
|
582 |
+
// for(;;) is exactly the same as while(true), but shorter :)
|
583 |
+
$content = preg_replace('/\bwhile\(!0\){/', 'for(;;){', $content);
|
584 |
+
|
585 |
+
// now make sure we didn't turn any do ... while(true) into do ... for(;;)
|
586 |
+
preg_match_all('/\bdo\b/', $content, $dos, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
|
587 |
+
|
588 |
+
// go backward to make sure positional offsets aren't altered when $content changes
|
589 |
+
$dos = array_reverse($dos);
|
590 |
+
foreach ($dos as $do) {
|
591 |
+
$offsetDo = $do[0][1];
|
592 |
+
|
593 |
+
// find all `while` (now `for`) following `do`: one of those must be
|
594 |
+
// associated with the `do` and be turned back into `while`
|
595 |
+
preg_match_all('/\bfor\(;;\)/', $content, $whiles, PREG_OFFSET_CAPTURE | PREG_SET_ORDER, $offsetDo);
|
596 |
+
foreach ($whiles as $while) {
|
597 |
+
$offsetWhile = $while[0][1];
|
598 |
+
|
599 |
+
$open = substr_count($content, '{', $offsetDo, $offsetWhile - $offsetDo);
|
600 |
+
$close = substr_count($content, '}', $offsetDo, $offsetWhile - $offsetDo);
|
601 |
+
if ($open === $close) {
|
602 |
+
// only restore `while` if amount of `{` and `}` are the same;
|
603 |
+
// otherwise, that `for` isn't associated with this `do`
|
604 |
+
$content = substr_replace($content, 'while(!0)', $offsetWhile, strlen('for(;;)'));
|
605 |
+
break;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
|
610 |
+
return $content;
|
611 |
+
}
|
612 |
+
}
|
vendor/matthiasmullie/minify/src/Minify.php
ADDED
@@ -0,0 +1,459 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Abstract minifier class
|
4 |
+
*
|
5 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
6 |
+
*
|
7 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
8 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
9 |
+
* @license MIT License
|
10 |
+
*/
|
11 |
+
namespace MatthiasMullie\Minify;
|
12 |
+
|
13 |
+
use MatthiasMullie\Minify\Exceptions\IOException;
|
14 |
+
use Psr\Cache\CacheItemInterface;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Abstract minifier class.
|
18 |
+
*
|
19 |
+
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
20 |
+
*
|
21 |
+
* @package Minify
|
22 |
+
* @author Matthias Mullie <minify@mullie.eu>
|
23 |
+
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
24 |
+
* @license MIT License
|
25 |
+
*/
|
26 |
+
abstract class Minify
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* The data to be minified.
|
30 |
+
*
|
31 |
+
* @var string[]
|
32 |
+
*/
|
33 |
+
protected $data = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Array of patterns to match.
|
37 |
+
*
|
38 |
+
* @var string[]
|
39 |
+
*/
|
40 |
+
protected $patterns = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* This array will hold content of strings and regular expressions that have
|
44 |
+
* been extracted from the JS source code, so we can reliably match "code",
|
45 |
+
* without having to worry about potential "code-like" characters inside.
|
46 |
+
*
|
47 |
+
* @var string[]
|
48 |
+
*/
|
49 |
+
public $extracted = array();
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Init the minify class - optionally, code may be passed along already.
|
53 |
+
*/
|
54 |
+
public function __construct(/* $data = null, ... */)
|
55 |
+
{
|
56 |
+
// it's possible to add the source through the constructor as well ;)
|
57 |
+
if (func_num_args()) {
|
58 |
+
call_user_func_array(array($this, 'add'), func_get_args());
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Add a file or straight-up code to be minified.
|
64 |
+
*
|
65 |
+
* @param string|string[] $data
|
66 |
+
*
|
67 |
+
* @return static
|
68 |
+
*/
|
69 |
+
public function add($data /* $data = null, ... */)
|
70 |
+
{
|
71 |
+
// bogus "usage" of parameter $data: scrutinizer warns this variable is
|
72 |
+
// not used (we're using func_get_args instead to support overloading),
|
73 |
+
// but it still needs to be defined because it makes no sense to have
|
74 |
+
// this function without argument :)
|
75 |
+
$args = array($data) + func_get_args();
|
76 |
+
|
77 |
+
// this method can be overloaded
|
78 |
+
foreach ($args as $data) {
|
79 |
+
if (is_array($data)) {
|
80 |
+
call_user_func_array(array($this, 'add'), $data);
|
81 |
+
continue;
|
82 |
+
}
|
83 |
+
|
84 |
+
// redefine var
|
85 |
+
$data = (string) $data;
|
86 |
+
|
87 |
+
// load data
|
88 |
+
$value = $this->load($data);
|
89 |
+
$key = ($data != $value) ? $data : count($this->data);
|
90 |
+
|
91 |
+
// replace CR linefeeds etc.
|
92 |
+
// @see https://github.com/matthiasmullie/minify/pull/139
|
93 |
+
$value = str_replace(array("\r\n", "\r"), "\n", $value);
|
94 |
+
|
95 |
+
// store data
|
96 |
+
$this->data[$key] = $value;
|
97 |
+
}
|
98 |
+
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Minify the data & (optionally) saves it to a file.
|
104 |
+
*
|
105 |
+
* @param string[optional] $path Path to write the data to
|
106 |
+
*
|
107 |
+
* @return string The minified data
|
108 |
+
*/
|
109 |
+
public function minify($path = null)
|
110 |
+
{
|
111 |
+
$content = $this->execute($path);
|
112 |
+
|
113 |
+
// save to path
|
114 |
+
if ($path !== null) {
|
115 |
+
$this->save($content, $path);
|
116 |
+
}
|
117 |
+
|
118 |
+
return $content;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Minify & gzip the data & (optionally) saves it to a file.
|
123 |
+
*
|
124 |
+
* @param string[optional] $path Path to write the data to
|
125 |
+
* @param int[optional] $level Compression level, from 0 to 9
|
126 |
+
*
|
127 |
+
* @return string The minified & gzipped data
|
128 |
+
*/
|
129 |
+
public function gzip($path = null, $level = 9)
|
130 |
+
{
|
131 |
+
$content = $this->execute($path);
|
132 |
+
$content = gzencode($content, $level, FORCE_GZIP);
|
133 |
+
|
134 |
+
// save to path
|
135 |
+
if ($path !== null) {
|
136 |
+
$this->save($content, $path);
|
137 |
+
}
|
138 |
+
|
139 |
+
return $content;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Minify the data & write it to a CacheItemInterface object.
|
144 |
+
*
|
145 |
+
* @param CacheItemInterface $item Cache item to write the data to
|
146 |
+
*
|
147 |
+
* @return CacheItemInterface Cache item with the minifier data
|
148 |
+
*/
|
149 |
+
public function cache(CacheItemInterface $item)
|
150 |
+
{
|
151 |
+
$content = $this->execute();
|
152 |
+
$item->set($content);
|
153 |
+
|
154 |
+
return $item;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Minify the data.
|
159 |
+
*
|
160 |
+
* @param string[optional] $path Path to write the data to
|
161 |
+
*
|
162 |
+
* @return string The minified data
|
163 |
+
*/
|
164 |
+
abstract public function execute($path = null);
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Load data.
|
168 |
+
*
|
169 |
+
* @param string $data Either a path to a file or the content itself
|
170 |
+
*
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
protected function load($data)
|
174 |
+
{
|
175 |
+
// check if the data is a file
|
176 |
+
if ($this->canImportFile($data)) {
|
177 |
+
$data = file_get_contents($data);
|
178 |
+
|
179 |
+
// strip BOM, if any
|
180 |
+
if (substr($data, 0, 3) == "\xef\xbb\xbf") {
|
181 |
+
$data = substr($data, 3);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
return $data;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Save to file.
|
190 |
+
*
|
191 |
+
* @param string $content The minified data
|
192 |
+
* @param string $path The path to save the minified data to
|
193 |
+
*
|
194 |
+
* @throws IOException
|
195 |
+
*/
|
196 |
+
protected function save($content, $path)
|
197 |
+
{
|
198 |
+
$handler = $this->openFileForWriting($path);
|
199 |
+
|
200 |
+
$this->writeToFile($handler, $content);
|
201 |
+
|
202 |
+
@fclose($handler);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Register a pattern to execute against the source content.
|
207 |
+
*
|
208 |
+
* @param string $pattern PCRE pattern
|
209 |
+
* @param string|callable $replacement Replacement value for matched pattern
|
210 |
+
*/
|
211 |
+
protected function registerPattern($pattern, $replacement = '')
|
212 |
+
{
|
213 |
+
// study the pattern, we'll execute it more than once
|
214 |
+
$pattern .= 'S';
|
215 |
+
|
216 |
+
$this->patterns[] = array($pattern, $replacement);
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* We can't "just" run some regular expressions against JavaScript: it's a
|
221 |
+
* complex language. E.g. having an occurrence of // xyz would be a comment,
|
222 |
+
* unless it's used within a string. Of you could have something that looks
|
223 |
+
* like a 'string', but inside a comment.
|
224 |
+
* The only way to accurately replace these pieces is to traverse the JS one
|
225 |
+
* character at a time and try to find whatever starts first.
|
226 |
+
*
|
227 |
+
* @param string $content The content to replace patterns in
|
228 |
+
*
|
229 |
+
* @return string The (manipulated) content
|
230 |
+
*/
|
231 |
+
protected function replace($content)
|
232 |
+
{
|
233 |
+
$processed = '';
|
234 |
+
$positions = array_fill(0, count($this->patterns), -1);
|
235 |
+
$matches = array();
|
236 |
+
|
237 |
+
while ($content) {
|
238 |
+
// find first match for all patterns
|
239 |
+
foreach ($this->patterns as $i => $pattern) {
|
240 |
+
list($pattern, $replacement) = $pattern;
|
241 |
+
|
242 |
+
// we can safely ignore patterns for positions we've unset earlier,
|
243 |
+
// because we know these won't show up anymore
|
244 |
+
if (array_key_exists($i, $positions) == false) {
|
245 |
+
continue;
|
246 |
+
}
|
247 |
+
|
248 |
+
// no need to re-run matches that are still in the part of the
|
249 |
+
// content that hasn't been processed
|
250 |
+
if ($positions[$i] >= 0) {
|
251 |
+
continue;
|
252 |
+
}
|
253 |
+
|
254 |
+
$match = null;
|
255 |
+
if (preg_match($pattern, $content, $match, PREG_OFFSET_CAPTURE)) {
|
256 |
+
$matches[$i] = $match;
|
257 |
+
|
258 |
+
// we'll store the match position as well; that way, we
|
259 |
+
// don't have to redo all preg_matches after changing only
|
260 |
+
// the first (we'll still know where those others are)
|
261 |
+
$positions[$i] = $match[0][1];
|
262 |
+
} else {
|
263 |
+
// if the pattern couldn't be matched, there's no point in
|
264 |
+
// executing it again in later runs on this same content;
|
265 |
+
// ignore this one until we reach end of content
|
266 |
+
unset($matches[$i], $positions[$i]);
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
// no more matches to find: everything's been processed, break out
|
271 |
+
if (!$matches) {
|
272 |
+
$processed .= $content;
|
273 |
+
break;
|
274 |
+
}
|
275 |
+
|
276 |
+
// see which of the patterns actually found the first thing (we'll
|
277 |
+
// only want to execute that one, since we're unsure if what the
|
278 |
+
// other found was not inside what the first found)
|
279 |
+
$discardLength = min($positions);
|
280 |
+
$firstPattern = array_search($discardLength, $positions);
|
281 |
+
$match = $matches[$firstPattern][0][0];
|
282 |
+
|
283 |
+
// execute the pattern that matches earliest in the content string
|
284 |
+
list($pattern, $replacement) = $this->patterns[$firstPattern];
|
285 |
+
$replacement = $this->replacePattern($pattern, $replacement, $content);
|
286 |
+
|
287 |
+
// figure out which part of the string was unmatched; that's the
|
288 |
+
// part we'll execute the patterns on again next
|
289 |
+
$content = (string) substr($content, $discardLength);
|
290 |
+
$unmatched = (string) substr($content, strpos($content, $match) + strlen($match));
|
291 |
+
|
292 |
+
// move the replaced part to $processed and prepare $content to
|
293 |
+
// again match batch of patterns against
|
294 |
+
$processed .= substr($replacement, 0, strlen($replacement) - strlen($unmatched));
|
295 |
+
$content = $unmatched;
|
296 |
+
|
297 |
+
// first match has been replaced & that content is to be left alone,
|
298 |
+
// the next matches will start after this replacement, so we should
|
299 |
+
// fix their offsets
|
300 |
+
foreach ($positions as $i => $position) {
|
301 |
+
$positions[$i] -= $discardLength + strlen($match);
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
return $processed;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* This is where a pattern is matched against $content and the matches
|
310 |
+
* are replaced by their respective value.
|
311 |
+
* This function will be called plenty of times, where $content will always
|
312 |
+
* move up 1 character.
|
313 |
+
*
|
314 |
+
* @param string $pattern Pattern to match
|
315 |
+
* @param string|callable $replacement Replacement value
|
316 |
+
* @param string $content Content to match pattern against
|
317 |
+
*
|
318 |
+
* @return string
|
319 |
+
*/
|
320 |
+
protected function replacePattern($pattern, $replacement, $content)
|
321 |
+
{
|
322 |
+
if (is_callable($replacement)) {
|
323 |
+
return preg_replace_callback($pattern, $replacement, $content, 1, $count);
|
324 |
+
} else {
|
325 |
+
return preg_replace($pattern, $replacement, $content, 1, $count);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Strings are a pattern we need to match, in order to ignore potential
|
331 |
+
* code-like content inside them, but we just want all of the string
|
332 |
+
* content to remain untouched.
|
333 |
+
*
|
334 |
+
* This method will replace all string content with simple STRING#
|
335 |
+
* placeholder text, so we've rid all strings from characters that may be
|
336 |
+
* misinterpreted. Original string content will be saved in $this->extracted
|
337 |
+
* and after doing all other minifying, we can restore the original content
|
338 |
+
* via restoreStrings().
|
339 |
+
*
|
340 |
+
* @param string[optional] $chars
|
341 |
+
* @param string[optional] $placeholderPrefix
|
342 |
+
*/
|
343 |
+
protected function extractStrings($chars = '\'"', $placeholderPrefix = '')
|
344 |
+
{
|
345 |
+
// PHP only supports $this inside anonymous functions since 5.4
|
346 |
+
$minifier = $this;
|
347 |
+
$callback = function ($match) use ($minifier, $placeholderPrefix) {
|
348 |
+
// check the second index here, because the first always contains a quote
|
349 |
+
if ($match[2] === '') {
|
350 |
+
/*
|
351 |
+
* Empty strings need no placeholder; they can't be confused for
|
352 |
+
* anything else anyway.
|
353 |
+
* But we still needed to match them, for the extraction routine
|
354 |
+
* to skip over this particular string.
|
355 |
+
*/
|
356 |
+
return $match[0];
|
357 |
+
}
|
358 |
+
|
359 |
+
$count = count($minifier->extracted);
|
360 |
+
$placeholder = $match[1].$placeholderPrefix.$count.$match[1];
|
361 |
+
$minifier->extracted[$placeholder] = $match[1].$match[2].$match[1];
|
362 |
+
|
363 |
+
return $placeholder;
|
364 |
+
};
|
365 |
+
|
366 |
+
/*
|
367 |
+
* The \\ messiness explained:
|
368 |
+
* * Don't count ' or " as end-of-string if it's escaped (has backslash
|
369 |
+
* in front of it)
|
370 |
+
* * Unless... that backslash itself is escaped (another leading slash),
|
371 |
+
* in which case it's no longer escaping the ' or "
|
372 |
+
* * So there can be either no backslash, or an even number
|
373 |
+
* * multiply all of that times 4, to account for the escaping that has
|
374 |
+
* to be done to pass the backslash into the PHP string without it being
|
375 |
+
* considered as escape-char (times 2) and to get it in the regex,
|
376 |
+
* escaped (times 2)
|
377 |
+
*/
|
378 |
+
$this->registerPattern('/(['.$chars.'])(.*?(?<!\\\\)(\\\\\\\\)*+)\\1/s', $callback);
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* This method will restore all extracted data (strings, regexes) that were
|
383 |
+
* replaced with placeholder text in extract*(). The original content was
|
384 |
+
* saved in $this->extracted.
|
385 |
+
*
|
386 |
+
* @param string $content
|
387 |
+
*
|
388 |
+
* @return string
|
389 |
+
*/
|
390 |
+
protected function restoreExtractedData($content)
|
391 |
+
{
|
392 |
+
if (!$this->extracted) {
|
393 |
+
// nothing was extracted, nothing to restore
|
394 |
+
return $content;
|
395 |
+
}
|
396 |
+
|
397 |
+
$content = strtr($content, $this->extracted);
|
398 |
+
|
399 |
+
$this->extracted = array();
|
400 |
+
|
401 |
+
return $content;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Check if the path is a regular file and can be read.
|
406 |
+
*
|
407 |
+
* @param string $path
|
408 |
+
*
|
409 |
+
* @return bool
|
410 |
+
*/
|
411 |
+
protected function canImportFile($path)
|
412 |
+
{
|
413 |
+
$parsed = parse_url($path);
|
414 |
+
if (
|
415 |
+
// file is elsewhere
|
416 |
+
isset($parsed['host']) ||
|
417 |
+
// file responds to queries (may change, or need to bypass cache)
|
418 |
+
isset($parsed['query'])
|
419 |
+
) {
|
420 |
+
return false;
|
421 |
+
}
|
422 |
+
|
423 |
+
return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path);
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Attempts to open file specified by $path for writing.
|
428 |
+
*
|
429 |
+
* @param string $path The path to the file
|
430 |
+
*
|
431 |
+
* @return resource Specifier for the target file
|
432 |
+
*
|
433 |
+
* @throws IOException
|
434 |
+
*/
|
435 |
+
protected function openFileForWriting($path)
|
436 |
+
{
|
437 |
+
if (($handler = @fopen($path, 'w')) === false) {
|
438 |
+
throw new IOException('The file "'.$path.'" could not be opened for writing. Check if PHP has enough permissions.');
|
439 |
+
}
|
440 |
+
|
441 |
+
return $handler;
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Attempts to write $content to the file specified by $handler. $path is used for printing exceptions.
|
446 |
+
*
|
447 |
+
* @param resource $handler The resource to write to
|
448 |
+
* @param string $content The content to write
|
449 |
+
* @param string $path The path to the file (for exception printing only)
|
450 |
+
*
|
451 |
+
* @throws IOException
|
452 |
+
*/
|
453 |
+
protected function writeToFile($handler, $content, $path = '')
|
454 |
+
{
|
455 |
+
if (($result = @fwrite($handler, $content)) === false || ($result < strlen($content))) {
|
456 |
+
throw new IOException('The file "'.$path.'" could not be written to. Check your disk space and file permissions.');
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
vendor/matthiasmullie/path-converter/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2015 Matthias Mullie
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4 |
+
this software and associated documentation files (the "Software"), to deal in
|
5 |
+
the Software without restriction, including without limitation the rights to
|
6 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8 |
+
subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
vendor/matthiasmullie/path-converter/composer.json
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "matthiasmullie/path-converter",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Relative path converter",
|
5 |
+
"keywords": ["relative", "path", "converter", "paths"],
|
6 |
+
"homepage": "http://github.com/matthiasmullie/path-converter",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Matthias Mullie",
|
11 |
+
"homepage": "http://www.mullie.eu",
|
12 |
+
"email": "pathconverter@mullie.eu",
|
13 |
+
"role": "Developer"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"require": {
|
17 |
+
"php": ">=5.3.0",
|
18 |
+
"ext-pcre": "*"
|
19 |
+
},
|
20 |
+
"require-dev": {
|
21 |
+
"phpunit/phpunit": "~4.8"
|
22 |
+
},
|
23 |
+
"autoload": {
|
24 |
+
"psr-4": {
|
25 |
+
"MatthiasMullie\\PathConverter\\": "src/"
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
vendor/matthiasmullie/path-converter/src/Converter.php
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace MatthiasMullie\PathConverter;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Convert paths relative from 1 file to another.
|
7 |
+
*
|
8 |
+
* E.g.
|
9 |
+
* ../../images/icon.jpg relative to /css/imports/icons.css
|
10 |
+
* becomes
|
11 |
+
* ../images/icon.jpg relative to /css/minified.css
|
12 |
+
*
|
13 |
+
* Please report bugs on https://github.com/matthiasmullie/path-converter/issues
|
14 |
+
*
|
15 |
+
* @author Matthias Mullie <pathconverter@mullie.eu>
|
16 |
+
* @copyright Copyright (c) 2015, Matthias Mullie. All rights reserved
|
17 |
+
* @license MIT License
|
18 |
+
*/
|
19 |
+
class Converter implements ConverterInterface
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
protected $from;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
protected $to;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param string $from The original base path (directory, not file!)
|
33 |
+
* @param string $to The new base path (directory, not file!)
|
34 |
+
* @param string $root Root directory (defaults to `getcwd`)
|
35 |
+
*/
|
36 |
+
public function __construct($from, $to, $root = '')
|
37 |
+
{
|
38 |
+
$shared = $this->shared($from, $to);
|
39 |
+
if ($shared === '') {
|
40 |
+
// when both paths have nothing in common, one of them is probably
|
41 |
+
// absolute while the other is relative
|
42 |
+
$root = $root ?: getcwd();
|
43 |
+
$from = strpos($from, $root) === 0 ? $from : preg_replace('/\/+/', '/', $root.'/'.$from);
|
44 |
+
$to = strpos($to, $root) === 0 ? $to : preg_replace('/\/+/', '/', $root.'/'.$to);
|
45 |
+
|
46 |
+
// or traveling the tree via `..`
|
47 |
+
// attempt to resolve path, or assume it's fine if it doesn't exist
|
48 |
+
$from = @realpath($from) ?: $from;
|
49 |
+
$to = @realpath($to) ?: $to;
|
50 |
+
}
|
51 |
+
|
52 |
+
$from = $this->dirname($from);
|
53 |
+
$to = $this->dirname($to);
|
54 |
+
|
55 |
+
$from = $this->normalize($from);
|
56 |
+
$to = $this->normalize($to);
|
57 |
+
|
58 |
+
$this->from = $from;
|
59 |
+
$this->to = $to;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Normalize path.
|
64 |
+
*
|
65 |
+
* @param string $path
|
66 |
+
*
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
protected function normalize($path)
|
70 |
+
{
|
71 |
+
// deal with different operating systems' directory structure
|
72 |
+
$path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $path), '/');
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Example:
|
76 |
+
* /home/forkcms/frontend/cache/compiled_templates/../../core/layout/css/../images/img.gif
|
77 |
+
* to
|
78 |
+
* /home/forkcms/frontend/core/layout/images/img.gif
|
79 |
+
*/
|
80 |
+
do {
|
81 |
+
$path = preg_replace('/[^\/]+(?<!\.\.)\/\.\.\//', '', $path, -1, $count);
|
82 |
+
} while ($count);
|
83 |
+
|
84 |
+
return $path;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Figure out the shared path of 2 locations.
|
89 |
+
*
|
90 |
+
* Example:
|
91 |
+
* /home/forkcms/frontend/core/layout/images/img.gif
|
92 |
+
* and
|
93 |
+
* /home/forkcms/frontend/cache/minified_css
|
94 |
+
* share
|
95 |
+
* /home/forkcms/frontend
|
96 |
+
*
|
97 |
+
* @param string $path1
|
98 |
+
* @param string $path2
|
99 |
+
*
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
protected function shared($path1, $path2)
|
103 |
+
{
|
104 |
+
// $path could theoretically be empty (e.g. no path is given), in which
|
105 |
+
// case it shouldn't expand to array(''), which would compare to one's
|
106 |
+
// root /
|
107 |
+
$path1 = $path1 ? explode('/', $path1) : array();
|
108 |
+
$path2 = $path2 ? explode('/', $path2) : array();
|
109 |
+
|
110 |
+
$shared = array();
|
111 |
+
|
112 |
+
// compare paths & strip identical ancestors
|
113 |
+
foreach ($path1 as $i => $chunk) {
|
114 |
+
if (isset($path2[$i]) && $path1[$i] == $path2[$i]) {
|
115 |
+
$shared[] = $chunk;
|
116 |
+
} else {
|
117 |
+
break;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
return implode('/', $shared);
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Convert paths relative from 1 file to another.
|
126 |
+
*
|
127 |
+
* E.g.
|
128 |
+
* ../images/img.gif relative to /home/forkcms/frontend/core/layout/css
|
129 |
+
* should become:
|
130 |
+
* ../../core/layout/images/img.gif relative to
|
131 |
+
* /home/forkcms/frontend/cache/minified_css
|
132 |
+
*
|
133 |
+
* @param string $path The relative path that needs to be converted
|
134 |
+
*
|
135 |
+
* @return string The new relative path
|
136 |
+
*/
|
137 |
+
public function convert($path)
|
138 |
+
{
|
139 |
+
// quit early if conversion makes no sense
|
140 |
+
if ($this->from === $this->to) {
|
141 |
+
return $path;
|
142 |
+
}
|
143 |
+
|
144 |
+
$path = $this->normalize($path);
|
145 |
+
// if we're not dealing with a relative path, just return absolute
|
146 |
+
if (strpos($path, '/') === 0) {
|
147 |
+
return $path;
|
148 |
+
}
|
149 |
+
|
150 |
+
// normalize paths
|
151 |
+
$path = $this->normalize($this->from.'/'.$path);
|
152 |
+
|
153 |
+
// strip shared ancestor paths
|
154 |
+
$shared = $this->shared($path, $this->to);
|
155 |
+
$path = mb_substr($path, mb_strlen($shared));
|
156 |
+
$to = mb_substr($this->to, mb_strlen($shared));
|
157 |
+
|
158 |
+
// add .. for every directory that needs to be traversed to new path
|
159 |
+
$to = str_repeat('../', count(array_filter(explode('/', $to))));
|
160 |
+
|
161 |
+
return $to.ltrim($path, '/');
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Attempt to get the directory name from a path.
|
166 |
+
*
|
167 |
+
* @param string $path
|
168 |
+
*
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
protected function dirname($path)
|
172 |
+
{
|
173 |
+
if (@is_file($path)) {
|
174 |
+
return dirname($path);
|
175 |
+
}
|
176 |
+
|
177 |
+
if (@is_dir($path)) {
|
178 |
+
return rtrim($path, '/');
|
179 |
+
}
|
180 |
+
|
181 |
+
// no known file/dir, start making assumptions
|
182 |
+
|
183 |
+
// ends in / = dir
|
184 |
+
if (mb_substr($path, -1) === '/') {
|
185 |
+
return rtrim($path, '/');
|
186 |
+
}
|
187 |
+
|
188 |
+
// has a dot in the name, likely a file
|
189 |
+
if (preg_match('/.*\..*$/', basename($path)) !== 0) {
|
190 |
+
return dirname($path);
|
191 |
+
}
|
192 |
+
|
193 |
+
// you're on your own here!
|
194 |
+
return $path;
|
195 |
+
}
|
196 |
+
}
|
vendor/matthiasmullie/path-converter/src/ConverterInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace MatthiasMullie\PathConverter;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Convert file paths.
|
7 |
+
*
|
8 |
+
* Please report bugs on https://github.com/matthiasmullie/path-converter/issues
|
9 |
+
*
|
10 |
+
* @author Matthias Mullie <pathconverter@mullie.eu>
|
11 |
+
* @copyright Copyright (c) 2015, Matthias Mullie. All rights reserved
|
12 |
+
* @license MIT License
|
13 |
+
*/
|
14 |
+
interface ConverterInterface
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Convert file paths.
|
18 |
+
*
|
19 |
+
* @param string $path The path to be converted
|
20 |
+
*
|
21 |
+
* @return string The new path
|
22 |
+
*/
|
23 |
+
public function convert($path);
|
24 |
+
}
|
vendor/matthiasmullie/path-converter/src/NoConverter.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace MatthiasMullie\PathConverter;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Don't convert paths.
|
7 |
+
*
|
8 |
+
* Please report bugs on https://github.com/matthiasmullie/path-converter/issues
|
9 |
+
*
|
10 |
+
* @author Matthias Mullie <pathconverter@mullie.eu>
|
11 |
+
* @copyright Copyright (c) 2015, Matthias Mullie. All rights reserved
|
12 |
+
* @license MIT License
|
13 |
+
*/
|
14 |
+
class NoConverter implements ConverterInterface
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* {@inheritdoc}
|
18 |
+
*/
|
19 |
+
public function convert($path)
|
20 |
+
{
|
21 |
+
return $path;
|
22 |
+
}
|
23 |
+
}
|
vendor/psr/cache/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Changelog
|
2 |
+
|
3 |
+
All notable changes to this project will be documented in this file, in reverse chronological order by release.
|
4 |
+
|
5 |
+
## 1.0.1 - 2016-08-06
|
6 |
+
|
7 |
+
### Fixed
|
8 |
+
|
9 |
+
- Make spacing consistent in phpdoc annotations php-fig/cache#9 - chalasr
|
10 |
+
- Fix grammar in phpdoc annotations php-fig/cache#10 - chalasr
|
11 |
+
- Be more specific in docblocks that `getItems()` and `deleteItems()` take an array of strings (`string[]`) compared to just `array` php-fig/cache#8 - GrahamCampbell
|
12 |
+
- For `expiresAt()` and `expiresAfter()` in CacheItemInterface fix docblock to specify null as a valid parameters as well as an implementation of DateTimeInterface php-fig/cache#7 - GrahamCampbell
|
13 |
+
|
14 |
+
## 1.0.0 - 2015-12-11
|
15 |
+
|
16 |
+
Initial stable release; reflects accepted PSR-6 specification
|
vendor/psr/cache/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2015 PHP Framework Interoperability Group
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is
|
8 |
+
furnished to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in
|
11 |
+
all copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
vendor/psr/cache/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PSR Cache
|
2 |
+
=========
|
3 |
+
|
4 |
+
This repository holds all interfaces defined by
|
5 |
+
[PSR-6](http://www.php-fig.org/psr/psr-6/).
|
6 |
+
|
7 |
+
Note that this is not a Cache implementation of its own. It is merely an
|
8 |
+
interface that describes a Cache implementation. See the specification for more
|
9 |
+
details.
|
vendor/psr/cache/composer.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "psr/cache",
|
3 |
+
"description": "Common interface for caching libraries",
|
4 |
+
"keywords": ["psr", "psr-6", "cache"],
|
5 |
+
"license": "MIT",
|
6 |
+
"authors": [
|
7 |
+
{
|
8 |
+
"name": "PHP-FIG",
|
9 |
+
"homepage": "http://www.php-fig.org/"
|
10 |
+
}
|
11 |
+
],
|
12 |
+
"require": {
|
13 |
+
"php": ">=5.3.0"
|
14 |
+
},
|
15 |
+
"autoload": {
|
16 |
+
"psr-4": {
|
17 |
+
"Psr\\Cache\\": "src/"
|
18 |
+
}
|
19 |
+
},
|
20 |
+
"extra": {
|
21 |
+
"branch-alias": {
|
22 |
+
"dev-master": "1.0.x-dev"
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
vendor/psr/cache/src/CacheException.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Psr\Cache;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Exception interface for all exceptions thrown by an Implementing Library.
|
7 |
+
*/
|
8 |
+
interface CacheException
|
9 |
+
{
|
10 |
+
}
|
vendor/psr/cache/src/CacheItemInterface.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Psr\Cache;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* CacheItemInterface defines an interface for interacting with objects inside a cache.
|
7 |
+
*
|
8 |
+
* Each Item object MUST be associated with a specific key, which can be set
|
9 |
+
* according to the implementing system and is typically passed by the
|
10 |
+
* Cache\CacheItemPoolInterface object.
|
11 |
+
*
|
12 |
+
* The Cache\CacheItemInterface object encapsulates the storage and retrieval of
|
13 |
+
* cache items. Each Cache\CacheItemInterface is generated by a
|
14 |
+
* Cache\CacheItemPoolInterface object, which is responsible for any required
|
15 |
+
* setup as well as associating the object with a unique Key.
|
16 |
+
* Cache\CacheItemInterface objects MUST be able to store and retrieve any type
|
17 |
+
* of PHP value defined in the Data section of the specification.
|
18 |
+
*
|
19 |
+
* Calling Libraries MUST NOT instantiate Item objects themselves. They may only
|
20 |
+
* be requested from a Pool object via the getItem() method. Calling Libraries
|
21 |
+
* SHOULD NOT assume that an Item created by one Implementing Library is
|
22 |
+
* compatible with a Pool from another Implementing Library.
|
23 |
+
*/
|
24 |
+
interface CacheItemInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Returns the key for the current cache item.
|
28 |
+
*
|
29 |
+
* The key is loaded by the Implementing Library, but should be available to
|
30 |
+
* the higher level callers when needed.
|
31 |
+
*
|
32 |
+
* @return string
|
33 |
+
* The key string for this cache item.
|
34 |
+
*/
|
35 |
+
public function getKey();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Retrieves the value of the item from the cache associated with this object's key.
|
39 |
+
*
|
40 |
+
* The value returned must be identical to the value originally stored by set().
|
41 |
+
*
|
42 |
+
* If isHit() returns false, this method MUST return null. Note that null
|
43 |
+
* is a legitimate cached value, so the isHit() method SHOULD be used to
|
44 |
+
* differentiate between "null value was found" and "no value was found."
|
45 |
+
*
|
46 |
+
* @return mixed
|
47 |
+
* The value corresponding to this cache item's key, or null if not found.
|
48 |
+
*/
|
49 |
+
public function get();
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Confirms if the cache item lookup resulted in a cache hit.
|
53 |
+
*
|
54 |
+
* Note: This method MUST NOT have a race condition between calling isHit()
|
55 |
+
* and calling get().
|
56 |
+
*
|
57 |
+
* @return bool
|
58 |
+
* True if the request resulted in a cache hit. False otherwise.
|
59 |
+
*/
|
60 |
+
public function isHit();
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Sets the value represented by this cache item.
|
64 |
+
*
|
65 |
+
* The $value argument may be any item that can be serialized by PHP,
|
66 |
+
* although the method of serialization is left up to the Implementing
|
67 |
+
* Library.
|
68 |
+
*
|
69 |
+
* @param mixed $value
|
70 |
+
* The serializable value to be stored.
|
71 |
+
*
|
72 |
+
* @return static
|
73 |
+
* The invoked object.
|
74 |
+
*/
|
75 |
+
public function set($value);
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Sets the expiration time for this cache item.
|
79 |
+
*
|
80 |
+
* @param \DateTimeInterface|null $expiration
|
81 |
+
* The point in time after which the item MUST be considered expired.
|
82 |
+
* If null is passed explicitly, a default value MAY be used. If none is set,
|
83 |
+
* the value should be stored permanently or for as long as the
|
84 |
+
* implementation allows.
|
85 |
+
*
|
86 |
+
* @return static
|
87 |
+
* The called object.
|
88 |
+
*/
|
89 |
+
public function expiresAt($expiration);
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Sets the expiration time for this cache item.
|
93 |
+
*
|
94 |
+
* @param int|\DateInterval|null $time
|
95 |
+
* The period of time from the present after which the item MUST be considered
|
96 |
+
* expired. An integer parameter is understood to be the time in seconds until
|
97 |
+
* expiration. If null is passed explicitly, a default value MAY be used.
|
98 |
+
* If none is set, the value should be stored permanently or for as long as the
|
99 |
+
* implementation allows.
|
100 |
+
*
|
101 |
+
* @return static
|
102 |
+
* The called object.
|
103 |
+
*/
|
104 |
+
public function expiresAfter($time);
|
105 |
+
}
|
vendor/psr/cache/src/CacheItemPoolInterface.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Psr\Cache;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* CacheItemPoolInterface generates CacheItemInterface objects.
|
7 |
+
*
|
8 |
+
* The primary purpose of Cache\CacheItemPoolInterface is to accept a key from
|
9 |
+
* the Calling Library and return the associated Cache\CacheItemInterface object.
|
10 |
+
* It is also the primary point of interaction with the entire cache collection.
|
11 |
+
* All configuration and initialization of the Pool is left up to an
|
12 |
+
* Implementing Library.
|
13 |
+
*/
|
14 |
+
interface CacheItemPoolInterface
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Returns a Cache Item representing the specified key.
|
18 |
+
*
|
19 |
+
* This method must always return a CacheItemInterface object, even in case of
|
20 |
+
* a cache miss. It MUST NOT return null.
|
21 |
+
*
|
22 |
+
* @param string $key
|
23 |
+
* The key for which to return the corresponding Cache Item.
|
24 |
+
*
|
25 |
+
* @throws InvalidArgumentException
|
26 |
+
* If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
|
27 |
+
* MUST be thrown.
|
28 |
+
*
|
29 |
+
* @return CacheItemInterface
|
30 |
+
* The corresponding Cache Item.
|
31 |
+
*/
|
32 |
+
public function getItem($key);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Returns a traversable set of cache items.
|
36 |
+
*
|
37 |
+
* @param string[] $keys
|
38 |
+
* An indexed array of keys of items to retrieve.
|
39 |
+
*
|
40 |
+
* @throws InvalidArgumentException
|
41 |
+
* If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
|
42 |
+
* MUST be thrown.
|
43 |
+
*
|
44 |
+
* @return array|\Traversable
|
45 |
+
* A traversable collection of Cache Items keyed by the cache keys of
|
46 |
+
* each item. A Cache item will be returned for each key, even if that
|
47 |
+
* key is not found. However, if no keys are specified then an empty
|
48 |
+
* traversable MUST be returned instead.
|
49 |
+
*/
|
50 |
+
public function getItems(array $keys = array());
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Confirms if the cache contains specified cache item.
|
54 |
+
*
|
55 |
+
* Note: This method MAY avoid retrieving the cached value for performance reasons.
|
56 |
+
* This could result in a race condition with CacheItemInterface::get(). To avoid
|
57 |
+
* such situation use CacheItemInterface::isHit() instead.
|
58 |
+
*
|
59 |
+
* @param string $key
|
60 |
+
* The key for which to check existence.
|
61 |
+
*
|
62 |
+
* @throws InvalidArgumentException
|
63 |
+
* If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
|
64 |
+
* MUST be thrown.
|
65 |
+
*
|
66 |
+
* @return bool
|
67 |
+
* True if item exists in the cache, false otherwise.
|
68 |
+
*/
|
69 |
+
public function hasItem($key);
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Deletes all items in the pool.
|
73 |
+
*
|
74 |
+
* @return bool
|
75 |
+
* True if the pool was successfully cleared. False if there was an error.
|
76 |
+
*/
|
77 |
+
public function clear();
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Removes the item from the pool.
|
81 |
+
*
|
82 |
+
* @param string $key
|
83 |
+
* The key to delete.
|
84 |
+
*
|
85 |
+
* @throws InvalidArgumentException
|
86 |
+
* If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
|
87 |
+
* MUST be thrown.
|
88 |
+
*
|
89 |
+
* @return bool
|
90 |
+
* True if the item was successfully removed. False if there was an error.
|
91 |
+
*/
|
92 |
+
public function deleteItem($key);
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Removes multiple items from the pool.
|
96 |
+
*
|
97 |
+
* @param string[] $keys
|
98 |
+
* An array of keys that should be removed from the pool.
|
99 |
+
|
100 |
+
* @throws InvalidArgumentException
|
101 |
+
* If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
|
102 |
+
* MUST be thrown.
|
103 |
+
*
|
104 |
+
* @return bool
|
105 |
+
* True if the items were successfully removed. False if there was an error.
|
106 |
+
*/
|
107 |
+
public function deleteItems(array $keys);
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Persists a cache item immediately.
|
111 |
+
*
|
112 |
+
* @param CacheItemInterface $item
|
113 |
+
* The cache item to save.
|
114 |
+
*
|
115 |
+
* @return bool
|
116 |
+
* True if the item was successfully persisted. False if there was an error.
|
117 |
+
*/
|
118 |
+
public function save(CacheItemInterface $item);
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Sets a cache item to be persisted later.
|
122 |
+
*
|
123 |
+
* @param CacheItemInterface $item
|
124 |
+
* The cache item to save.
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
* False if the item could not be queued or if a commit was attempted and failed. True otherwise.
|
128 |
+
*/
|
129 |
+
public function saveDeferred(CacheItemInterface $item);
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Persists any deferred cache items.
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
* True if all not-yet-saved items were successfully saved or there were none. False otherwise.
|
136 |
+
*/
|
137 |
+
public function commit();
|
138 |
+
}
|
vendor/psr/cache/src/InvalidArgumentException.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Psr\Cache;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Exception interface for invalid cache arguments.
|
7 |
+
*
|
8 |
+
* Any time an invalid argument is passed into a method it must throw an
|
9 |
+
* exception class which implements Psr\Cache\InvalidArgumentException.
|
10 |
+
*/
|
11 |
+
interface InvalidArgumentException extends CacheException
|
12 |
+
{
|
13 |
+
}
|
wpacu.php
CHANGED
@@ -2,17 +2,16 @@
|
|
2 |
/*
|
3 |
* Plugin Name: Asset CleanUp: Page Speed Booster
|
4 |
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
|
5 |
-
* Version: 1.3.3.
|
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/
|
9 |
* Text Domain: wp-asset-clean-up
|
10 |
* Domain Path: /languages
|
11 |
*/
|
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.3.
|
16 |
}
|
17 |
|
18 |
// Exit if accessed directly
|
@@ -101,6 +100,14 @@ define('WPACU_PLUGIN_GO_PRO_URL', 'https://gabelivan.com/items/wp-asset-cleanu
|
|
101 |
// Global Values
|
102 |
define('WPACU_LOAD_ASSETS_REQ_KEY', WPACU_PLUGIN_ID . '_load');
|
103 |
|
104 |
-
require_once WPACU_PLUGIN_DIR.'/
|
105 |
require_once WPACU_PLUGIN_DIR.'/wpacu-load.php';
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/*
|
3 |
* Plugin Name: Asset CleanUp: Page Speed Booster
|
4 |
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
|
5 |
+
* Version: 1.3.3.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/
|
9 |
* Text Domain: wp-asset-clean-up
|
10 |
* Domain Path: /languages
|
11 |
*/
|
|
|
12 |
// Is the Pro version triggered before the Lite one and are both plugins active?
|
13 |
if (! defined('WPACU_PLUGIN_VERSION')) {
|
14 |
+
define('WPACU_PLUGIN_VERSION', '1.3.3.9');
|
15 |
}
|
16 |
|
17 |
// Exit if accessed directly
|
100 |
// Global Values
|
101 |
define('WPACU_LOAD_ASSETS_REQ_KEY', WPACU_PLUGIN_ID . '_load');
|
102 |
|
103 |
+
require_once WPACU_PLUGIN_DIR.'/vendor/autoload.php';
|
104 |
require_once WPACU_PLUGIN_DIR.'/wpacu-load.php';
|
105 |
|
106 |
+
// [wpacu_lite]
|
107 |
+
$wpacuSettingsList = $wpacuSettings->getAll();
|
108 |
+
|
109 |
+
if (! $wpacuSettingsList['disable_freemius']) {
|
110 |
+
require_once WPACU_PLUGIN_DIR . '/freemius-load.php';
|
111 |
+
}
|
112 |
+
// [/wpacu_lite]
|
113 |
+
|