=== Asset CleanUp Pro: Page Speed Booster === Contributors: gabelivan Tags: minify css, minify javascript, defer css javascript, page speed, dequeue, performance Requires at least: 4.6 Tested up to: 6.0.2 Stable tag: 1.2.2.2 License: Commercial There are often times when you are using a theme and a number of plugins which are enabled and run on the same page. However, you don't need to use all of them and to improve the speed of your website and make the HTML source code cleaner (convenient for debugging purposes), it's better to prevent those styles and scripts from loading. == Changelog == = 1.2.2.2 - 30 September 2022 * "CSS & JS Manager" -- ("Posts" | "Pages") -- Notify the admin if there aren't any posts/pages where assets could be managed - e.g. in fresh WordPress installations or when a website just doesn't have articles ("posts") * Make sure Asset CleanUp Pro is not loading by default when DIVI builder previews are triggered (e.g. when the "et_pb_preview" query string is in the URI) * Fix: Make sure the hardcoded assets are printed when managing the assets in the front-end view ("Settings" -- "Plugin Usage Preferences" -- "Manage in the Front-end") * Fix: Added missing link to the special settings documentation post = 1.2.2.1 - 26 September 2022 * Show any special settings in "Overview" -- read more: https://www.assetcleanup.com/docs/?p=1495 * Make sure the plugin unload rules for REST API calls (read more: https://www.assetcleanup.com/docs/?p=1469) apply on AJAX calls as well (e.g. when a plugin uses jQuery AJAX code to fetch information from a REST API call) * Notify the admin when the tracking notice is shown that he/she can manage this option in the "Settings" area (e.g. in case closing the notice box doesn't work because of some JavaScript errors on that page, coming from a different plugin or the theme) * Make sure the user is redirected only once to the "Getting Started" page after the plugin is activated the first time (not after every re-activation as many developers are doing debugging) * Reduce the number of DB calls when visiting the "Plugins" page within the Dashboard and the "License" page from Asset CleanUp Pro's menu = 1.2.2.0 - 17 September 2022 * Option to unload plugins via "Plugins Manager" when REST API calls are made via define('WPACU_LOAD_ON_REST_CALLS', true); that can be set in wp-config.php / read more: https://www.assetcleanup.com/docs/?p=1469 * "Test Mode" now applies within the Dashboard as well (if there are unloading rules in 'PLUGINS MANAGER' -- 'IN THE DASHBOARD /wp-admin/') in case the logged-in user is NOT an administrator * Do extra checks to avoid calling get_transient() when it's not needed on specific pages (to reduce the number of DB calls) * Code that triggered anywhere now gets triggered on the front-end view as it's only needed there * DB calls related only to the "Overview" page were triggered on all plugin's pages (avoid that) = 1.2.1.9 - 10 September 2022 * On pages without any unloading rules, do not make any DB calls or trigger extra PHP code to retrieve any load exceptions as they are irrelevant in this situation since the assets are loaded anyway * Optimised the code to avoid triggering DB calls to the "options" table to check specific transient values * Remove extra DB queries related to "post_format" as this taxonomy is irrelevant for managing in Asset CleanUp Pro * When Asset CleanUp Pro is prevented from loading via the rules from "Settings" -- "Plugin Usage Preferences" -- "Do not load the plugin on certain pages" OR from "Do not load Asset CleanUp Pro on this page (this will disable any functionality of the plugin)" within "Page Options" area (when managing assets for a specific page), make sure the checking is done earlier to avoid an extra DB query that would become irrelevant if the plugin would not be loaded on that page = 1.2.1.8 - 5 September 2022 * Optimisation: Reduce the number of queries made to the database & trigger fewer code during early code loaded in Asset CleanUp Pro's MU plugin (e.g. to determine if the URI is a homepage, to determine the page type based on the URI) * "Plugins Manager": Make sure the green font shows for any load exception rule that is chosen * "Plugins Manager" Fix: When non-Latin characters were used in the URI, some plugin unload/load exception rules were not working such as the ones based on the post type (e.g. post, page, product, tag) and taxonomy (e.g. category, tag, product category, product tag) * "Plugins Manager" Fix: The load exception rule was not applied for plugins on taxonomy pages ('category', 'post_tag', 'product_cat', 'product_tag') when set using the following option: "On the following taxonomy pages:" = 1.2.1.7 - 2 September 2022 * Bricks builder edit mode: Allow Asset CleanUp Pro to trigger plugin & CSS/JS unload rules when the page editor is in use to make the editor load faster via define('WPACU_LOAD_ON_BRICKS_BUILDER', true); that can be set in wp-config.php / read more: https://www.assetcleanup.com/docs/?p=1450 * Compatibility with the "WordPress Popular Posts" plugin & other plugins (when optimizing the JavaScript code) that change the type of inline script tags to "application/json" (having a JSON string that is later read by the plugin's script) * Fix: "Plugins Manager" -- The unload rule wasn't working for built-in "category" pages = 1.2.1.6 - 19 August 2022 * Updated T-Regx PHP library (for handling specific regular expressions) to v0.34.2 * Escaped PHP-echoed variables/constants by using functions such as esc_attr() or esc_html_e() * Minify CSS Fix: If there are new lines within calc(), the content minified ends up without spaces between the operators (e.g. the plus sign), which breaks the CSS code * Fix: On some servers, PHP warning are shown on all taxonomy pages (e.g. 'Undefined array key "unload_via_tax"', 'Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given') = 1.2.1.5 - 4 August 2022 * Flush "W3 Total Cache" (if the plugin is activated) object cache whenever the list of CSS/JS files is fetched by Asset CleanUp Pro to avoid retrieving the previous configuration after changes are made to the CSS/JS manager * Improvement: Add more uniqueness to the plugin's JS code deferring the CSS to avoid any conflicts with other similar codes * Fix: The requested URI was sometimes wrongly detected as the homepage, if some common query strings (e.g. "utm_source") were in the URI = 1.2.1.4 - 18 June 2022 * "Plugins Manager": Ability to unload plugins (and load them as an exception from any unload rule) on any taxonomy page * "Bricks – Visual Site Builder for WordPress": Do not trigger Asset CleanUp Pro whenever the page builder is used * Fix: Better RegEx for detecting "@import" within CSS comments when optimizing the CSS, thus avoiding useless attempts to fetch the information from the @import locations, since they are commented and not needed in the final CSS version = 1.2.1.3 - 28 May 2022 * "Plugins Manager": Ability to unload plugins (and load them as an exception from any unload rule) on the homepage (no more complex RegEx required) & on all "Category" and "Tag" pages (the default WordPress taxonomies) * Fix: "Google Fonts" -- "Apply font-display: CSS property value" was not applying for hardcoded LINK tags when the Google fonts were not combined * Fix: "Plugin Usage Preferences" -- "Manage in the Dashboard" -- "Fetch the assets on a button click": if the user updates a post (when Gutenberg editor is used), the CSS/JS manager loads, when it shouldn't as the admin never used the button to fetch the CSS/JS list in the first place = 1.2.1.2 - 3 May 2022 * "Plugins Manager": Ability to unload plugins (and load them as an exception from any unload rule) in the front-end view on all pages belonging to specific post types * New option in the settings' vertical menu: "Disable RSS Feed" * Fix: Improved the quality of the code behind the snippet for the "wpacu_critical_css" filter; Show all the code without the need to scroll the textarea = 1.2.1.1 - 20 April 2022 * Fix: 'PHP Warning: Undefined array key "site_url" in [...]/templates/_admin-pages-critical-css/common/_applies-to.php on line 11' * Fix: Load exceptions via RegEx for CSS/JS weren't always matched in PHP 7.1+ = 1.2.1.0 - 18 April 2022 * PHP (up to) 8.0.17 compatibility: Make sure no deprecated notices are shown when WP_DEBUG is ON due to older PHP code that is still compatible with PHP 5.6 * Make sure the list of unloaded assets/plugins from the top admin bar is not broken due to the theme used that might have CSS interfering with Asset CleanUp Pro's one * Reduce the total plugin's size by compressing some of its images * "Transliterator - WordPress Transliteration" compatibility: Avoid breaking the HTML content in Asset CleanUp's admin pages = 1.2.0.9 - 17 March 2022 * Added "wpacu_print_info_comments_in_cached_assets" filter hook for the option to avoid printing by default of plugin's comments in the CSS/JS files (e.g. the relative path to the file) * Fix: Make sure that jQuery Chosen (the nice looking drop-down) is loaded and applied to elements (e.g. taxonomies list) within the CSS/JS manager if loaded from the Dashboard via "WP Remote Post" * Fix: Preloading (basic/async) stopped working in the previous version * Fix: Premium unload/load exceptions rules were not always applying if there were no basic ("Lite" version related) rules applied (which is irrelevant as the user can only apply premium rules if he/she prefers) * UI fix: Async/Defer on this page was not taken into consideration as an applied rule when using the following layout: "Grouped by having at least one rule & no rules" = 1.2.0.8 - 24 February 2022 * Fix: When a static page is set as a homepage in "Settings" - "Reading", any load exceptions set as "On this page" would not take effect for the homepage = 1.2.0.7 - 23 February 2022 * Reduced the total number of template files (e.g. some were redundant) * Reduced the size of plugin's images * Higher accuracy in detecting Zion Page Builder to prevent Asset CleanUp Pro from triggering when the page builder is used * "Overview" improvement: Make sure the unloaded CSS/JS from inactive themes is highlighted to alert the admin that the rules might never be needed and can be safely removed * "Overview" fix: The confirmation for clearing rules belonging to inactive CSS/JS wasn't always showing the right handle, thus confusing the admin when confirming the action * Fix: When CSS content gets cached, make sure to avoid altering incorrectly the "url" value when it starts with # - e.g. clip-path: url(#elementIdHere); * Fix: Sometimes when a static page was set as the homepage in "Settings" - "Reading" and then unset, the CSS/JS manager was not showing up and the "Page Options" was shown instead = 1.2.0.6 - 1 February 2022 * Fix: Make sure all load exceptions for any unload rule are included in "Tools" -> "Import & Export" * Fix: PHP Warning: in_array() expects parameter 2 to be array, null given in /classes/Main.php on line 931 * Fix: Whenever unloading on all [taxonomy type] pages was enabled the following type of message wasn't showing in the CSS/JS manager: "This stylesheet is unloaded on all category taxonomy pages." * Avoid notice errors regarding taxonomies that do not exist anymore when having WP_DEBUG turned on by using term_exists() = 1.2.0.5 - 28 January 2022 * New Feature: Unload (or load as an exception) CSS/JS on all pages of a post type (posts, pages, WooCommerce products, etc.) when specific taxonomies (categories, tags, etc.) are set (read more: https://www.assetcleanup.com/docs/?p=1415) * Fix: The list "Grouped by loaded or unloaded status" was sometimes showing unloaded assets as "loaded", confusing the admin = 1.2.0.4 - 11 January 2022 * Improvement: Load jQuery UI files locally, thus removing any unnecessary dependency on another site (e.g. not from "ajax.googleapis.com") * Improvement: Escape as late as possible all variables when echoed * Improvement: Replaced json_encode() with wp_json_encode() for better security * Fix: When a word containing "calc" (e.g. calculation) was included in CSS comments, sometimes, the code following the comment was stripped = 1.2.0.3 - 30 November 2021 * PHP 8 Fix: 'PHP Warning: Undefined array key "critical_css_disabled"' in /templates/admin-page-overview.php * Fix: 'Error: The security check has failed.0' when loading the CSS/JS list via the 'Direct' method within the Dashboard = 1.2.0.2 - 23 November 2021 * Added the "wpacu_settings" filter - add_filter() - so the plugin's "Settings" can be altered via code (e.g. adding if clauses programmatically to alter the value of a certain textarea or have an option disabled on specific pages) when necessary * Prevent the following option from being accidentally disabled: 'Ignore dependency rule and keep the "children" loaded' (e.g. in rare cases, some CSS/JS have dependencies on certain pages only) * Fix: Added nonce checks for every WordPress AJAX call to improve security = 1.2.0.1 - 14 September 2021 * Automatically preload any combined JS files within the BODY tag (that do not have any "defer" or "async" attribute) to improve the Google PageSpeed Insights score for the following: "Preload key requests" * Reorganised the layout for "Manage in the Dashboard" from "Settings" -> "Plugin Usage Preferences" * Fix: When minifying CSS content, do not strip the extra calc() when something like the following is used: "calc( 50% - 22px ) calc( 50% - 22px )" * Fix: When Gutenberg editor is used and the post is updated, sometimes the CSS/JS manager is reloaded BEFORE the changes are saved showing the same state as it used to be confusing the admin that the changes weren't applied = 1.2.0.0 - 29 August 2021 * If the security nonce is expired or not sent when certain forms are submitted, show an error message about the potential problems and how to fix them without showing the standard "Link has expired" error * Added the plugin version under the "Pro" text next to the logo * WPML Fix: Load the combined CSS/JS files from the right domain to avoid any CORS policy issues (in case there are multiple domains for each language) * Fix: The CSS/JS manager form wasn't submitting when "Do not load Asset CleanUp Pro on this page (this will disable any functionality of the plugin)" was enabled * Fix: Make sure the loading exception rule if the user is logged-in is saving correctly * Fix: Do not show the "loading based on screen size" area if there is no SRC attached to the handle (e.g. "woocommerce-inline" handle) * Fix: Do not print anything whenever a cron job is triggered (this is only for debugging) * Fix: Assets' position was not shown correctly within the Dashboard (HEAD instead of BODY) * Fix: Do not trigger any cache clearing and page preloading if the post status is "draft" (after the post is saved) * Fix: Avoid changing the update plugin link as "Plugin failed" should not be a problem anymore = 1.1.9.9 - 31 July 2021 * Compatibility with FlyWheel hosting accounts (and other hosting accounts using the same pattern): The WordPress root directory is different than the ABSPATH one in relation to the "wp-content" directory where all or most of the CSS/JS files are located (e.g. the file size wasn't calculated for the static files before this change, which is needed for certain plugin functionality such as calculating small files for inlining) * Compatibility fix: Whenever the 'active_plugins' option is updated incorrectly by another plugin, it might contain the filtered list done via "option_active_plugins" and not the original list; Put back the missing plugins to avoid ending up with site-wide deactivated plugins (the ones with unloading rules in "Plugins Manager") * Avoid the same database query to be called more than once within the assetCleanUpHasNoLoadMatches() function * Limit the number of fields that are submitted whenever CSS/JS manager is used by re-organizing the fields' structure; Disable certain inputs that are at the time irrelevant for submitting (it helps if max_input_vars from php.ini is set to the default 1000 which is a low number for large forms) * "Overview" page change: Highlight posts that are not "publish" or "private" within the "Page Options" area * Do not add any CSS/JS manager link to the post's actions if the post is not "publish" or "private" (within "All Posts" page - /wp-admin/edit.php) * Order in alphabetical order the unloaded plugins from the top admin bar "Asset CleanUp Pro" menu = 1.1.9.8 - 25 July 2021 * Cached the plugin filtering (in case there are plugin unload rules) to decrease the total page loading time whenever a non-cached page is visited * Limit the number of fields that are submitted whenever CSS/JS manager is used (it helps if max_input_vars from php.ini is set to the default 1000 which is a low number for large forms): Whenever "+" or "-" is used to change the state of the asset row, the change is done asynchronously via an AJAX call * Avoid any errors related to parse_str() (e.g. when the string is too long) * Whenever plugin filtering from the Dashboard is used ("Plugin Manager" -> "IN THE DASHBOARD /wp-admin/"), do not trigger any plugin unload rules in Asset CleanUp's pages (e.g. to avoid showing incomplete custom post types) and in the following admin pages: /plugins.php, /plugin-install.php, /plugin-editor.php, /update-core.php = 1.1.9.7 - 15 July 2021 * "Plugins Manager" Multisite compatibility: Make sure network-activated plugins are fully manageable (e.g. only plugins activated per site were showing) * If "Contract All Groups" & "Expand All Groups" buttons are used, make sure the state (contracted or expanded) whenever the admin manages the assets again (the following option is updated in the background: "Settings" -> "Plugin Usage Preferences" -> "On Assets List Layout Load, keep the groups:") * Fix: "Uncaught ReferenceError: wpacuLoadCSS is not defined" was sometimes showing. It's been fixed by updating the fallback script needed for CSS async preloading (e.g. for browsers that do not support it by default) * Fix: "Warning: Constant WPACU_PREVENT_ANY_FRONTEND_OPTIMIZATION already defined" = 1.1.9.6 - 3 July 2021 * The meta box "Asset CleanUp Pro: Page Options" has had its contents moved to the "Page Options" area from the CSS/JS manager in any location the assets are managed * Added "Page Options" for the homepage as well (e.g. latest posts) besides posts, pages, and any public custom post types (e.g. WooCommerce product pages) * Prevent the plugin from triggering when WooCommerce API calls are made * Make no PHP errors are logged due to $allEnabledLocations not being initially declared as an empty array * When checking if critical CSS is enabled for any custom taxonomy/post type, make sure to ignore the inactive ones (e.g. a taxonomy that is not used anymore) * Make sure the following option works well when non-Latin characters are in the URI: "Do not load the plugin on certain page" * Fix: When hovering over the post's title in the Dashboard's posts list (either post, page, or custom post type), make sure "Manage CSS & JS" is only shown to the right admins to avoid any confusion * Fix: When assets' list is fetched, WP Rocket was disabled which made some plugins/themes that are directly calling WP Rocket functions to generate fatal errors * Fix: Make sure the handles with the following option always get unloaded: 'Ignore dependency rule and keep the "children" loaded' * Fix: Fatal error: Cannot redeclare assetCleanUpClearAutoptimizeCache() - if both plugins (Lite & Pro) are activated = 1.1.9.5 - 26 May 2021 * Make sure the plugin can be updated via WP CLI (so far, the update was visible within the Dashboard in /wp-admin/) * Option to skip Autoptimize cache clearing via using the "WPACU_DO_NOT_ALSO_CLEAR_AUTOPTIMIZE_CACHE" constant (e.g. set to 'true' in wp-config.php) * Fix: Make sure that applying to unload on all pages of a certain post type works from "CSS & JS MANAGER" (which is the new place for managing CSS/JS files within the Dashboard, outside the edit post/page area) * Fix: Manage assets didn't work on "CSS & JS MANAGER" -> "Homepage" tab if the actual page was a static one set in "Settings" -> "Reading" = 1.1.9.4 - 16 May 2021 * New Option: Manage assets loading for posts, pages, and custom post types within "CSS & JS MANAGER" -> "MANAGE CSS/JS" without the need to go to edit post/page area which is often bulky and could have too many fields from the theme & other plugins leading to a higher number than the one set in php.ini for "max_input_vars" * Higher accuracy in preventing the plugin from triggering when there are REST requests * Fix: Make sure RegEx rules for unloading plugins/assets are working well when non-latin characters are in the URI * Fix: Make sure the plugin works well (e.g. without any PHP errors) if the plugins' directory is changed (e.g. from "plugins" to "plugins-custom-name") * Fix: Critical CSS was not showing in the front-end view for all page type * Debugging purposes: Prevent CSS/JS from loading based on the media query via /?wpacu_no_media_query_load_for_css & /?wpacu_no_media_query_load_for_js = 1.1.9.3 - 25 April 2021 * Option to manage critical CSS (in "CSS & JS Manager" » "Manage Critical CSS") from the Dashboard (add/update/delete), while keeping the option to use the "wpacu_critical_css" hook for custom/singular pages * Improvement: Make sure "&display=" is added (if enabled) to Google Fonts links if their URL is changed to fit in JSON formats or JavaScript variables * Fix: Make sure managing CSS/JS for taxonomies from the Dashboard (e.g. when editing a category) works 100% * Fix: Clearing load exceptions from "Overview" didn't work for all pages of a certain post type = 1.1.9.2 - 16 April 2021 * Divi builder edit mode: Allow Asset CleanUp Pro to trigger plugin & CSS/JS unload rules when the page editor is on to make the editor load faster via define('WPACU_LOAD_ON_DIVI_BUILDER_EDIT', true); that can be set in wp-config.php / read more: https://www.assetcleanup.com/docs/?p=1260 * Cache Enabler (compatibility with older versions): Make sure the deprecated "cache_enabler_before_store" hook is in use * Unload "photoswipe" fix: If WooCommerce's PhotoSwipe was unloaded, empty dots were printed at the bottom of the page from unused/unneeded HTML (hide it by marking the DIV with the "pswp" class as hidden) * Improvement: Only use 'type="text/css"' when it's needed (e.g. an older theme is used that doesn't support HTML5) * Improvement: Make SweetAlert2 independent (styling, functionality) from other SweetAlert scripts that might be loaded from other plugins/themes (e.g. "WooCommerce Quickbooks Connector" export in an edit product page was not working) * Fix: Better detection for the homepage (e.g. the latest posts page was mistaken with the homepage in the front-end view of the CSS/JS manager) * Fix: Better detection for the singular page; Make sure the latest posts page such as the "Blog" one is also checked) * Fix: Make sure the license deactivation works even if the license is not valid so that it could be replaced with a valid one (e.g. a null version was initially used) = 1.1.9.1 - 1 April 2021 * Minify CSS/JS improvement: From now on, the minification can be either applied to files, inline JS code, or both (before, the files minification had to be enabled to files first and then to inline JS code; sometimes, users just wanted to minify inline code and leave the files untouched) * Fix: On some WordPress installations, the plugin's menu icon from the Dashboard's sidebar was not showing properly (the height was too large) * Fix: If there are too many assets/plugins unloaded, when showing up in the top admin bar menu, the list was not scrollable (e.g. only 20 out of 40 assets were shown because the height of the browser's window wasn't large enough which can not be expanded on smaller devices) * Fix: If the current theme supports HTML5, the 'type="text/javascript"' attribute is not added any more to altered SCRIPT tags by Asset CleanUp, thus avoiding any errors from W3C validators * Fix: When "Move All