From 756c830acca7236a174d8ee1a923c83dc37d532a Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Tue, 20 Dec 2016 21:43:40 -0500 Subject: [PATCH] Phing release of v161221 with the following changes: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - **Bug Fix:** Improving PHP OPcache detection. Now considering the INI option `opcache.restrict_api`. Comet Cache is now smart enough to avoid generating the PHP Warning: _PHP Warning: Zend OPcache API is restricted by "restrict_api" configuration directive_. See [Issue #733](https://github.com/websharks/comet-cache/issues/733). - **New Feature (Pro): Mobile Mode.** This release adds a new feature that is designed to improve compatibility with Adaptive themes for mobile devices. To learn more, please see: **Dashboard → Comet Cache Pro → Plugin Options → Mobile Mode**. See also: [Issue #471](https://github.com/websharks/comet-cache/issues/471). - **Enhancement: Auto-Clearing Author Page Cache.** This release makes Comet Cache smart enough to detect when a user is deleted (or removed from a child blog in a Network), at which time the Author page for that user will be cleared from the cache so it can be regenerated automatically. See [Issue #304](https://github.com/websharks/comet-cache/issues/304). - **Enhancement: Multibyte Compatibility.** This release improves support for WordPress Permalinks that contain UTF-8 symbols (or emojis) in them. More specifically, this release adds the `/u` flag to all `preg_*()` calls in cache clearing routines that generate cache paths from Watered-Down Regex patterns entered by a site owner. See: [Issue #611](https://github.com/websharks/comet-cache/issues/611). - **Enhancement: Widget Change Detection.** Comet Cache can now detect when **Appearance → Widgets** are added/edited/removed, and Comet Cache will automatically clear the cache so that your site remains up-to-date. See [Issue #411](https://github.com/websharks/comet-cache/issues/411). - **Enhancement (Pro): Static CDN Filters and `srcset`.** This release enhances Static CDN Filters in Comet Cache Pro. Static CDN Filters are now smart enough to filter all image sources included in an `srcset=""` attribute that is generated by WordPress. See [Issue #660](https://github.com/websharks/comet-cache/issues/660). If you'd like to learn more about `srcset=""`, see [this article at WordPress.org](https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/). - **Enhancement (Pro): Automatic Background Updates.** It is now possible to enable automatic background updates that occur quietly in the background whenever new features, bug fixes, or security issues are addressed by our developers. See: **Dashboard → Comet Cache Pro → Config. Options → Update Credentials**. See also: [Issue #827](https://github.com/websharks/comet-cache/issues/827). - **Enhancement (Pro): HTML Compressor + Accelerated Mobile Pages (AMP).** Updated to the latest available release of the HTML Compressor (v161208) with improved support for [Accelerated Mobile Pages](https://www.ampproject.org/). See: [Issue #695](https://github.com/websharks/comet-cache/issues/695). See also: [HTML Compressor v161208 changelog](https://github.com/websharks/html-compressor/releases/tag/161208). - **Enhancement (Pro): HTML Compressor / AMP Compatibility.** Improved compatibility with [Accelerated Mobile Pages](https://www.ampproject.org/). There is a new HTML Compressor option that is enabled by default and it makes Comet Cache smart enough to auto-detect and selectively disable portions of the HTML Compressor that are incompatible with the AMP spec; i.e., routines that are not necessary when serving APMd pages. In short, if the URI being compressed ends with `/amp/`, or the document contains a top-level `` tag (`` is accepted as well), then features which are incompatible with [Accelerated Mobile Pages](https://www.ampproject.org/) will be disabled accordingly. - **Compatibility:** Avoid deprecated `wp_get_sites()` and use `get_sites()` instead. See [Issue #848](https://github.com/websharks/comet-cache/issues/848). - **Documentation:** Added Watered-Down Regex documentation notes to the inline documentation (in the software) about the use of `^` and `$` in some places where these special characters are not fully supported. Also adding the same notes to the [Watered-Down Regex KB Article](https://cometcache.com/r/watered-down-regex-syntax/). See also: [Issue #611](https://github.com/websharks/comet-cache/issues/611). --- .gitchange | 2 +- CHANGELOG.md | 34 +++++++------------ comet-cache.php | 2 +- readme.txt | 30 +++++++++------- src/client-s/js/menu-pages.js | 18 ---------- src/client-s/js/menu-pages.min.js | 6 ++-- src/includes/classes/MenuPageOptions.php | 13 +++---- src/includes/classes/Plugin.php | 7 ++-- src/includes/stub.php | 2 +- src/includes/traits/Plugin/MenuPageUtils.php | 21 ++++++------ src/includes/traits/Plugin/WcpAuthorUtils.php | 2 +- src/includes/traits/Shared/BlogUtils.php | 2 +- .../traits/Shared/ConditionalUtils.php | 6 +++- 13 files changed, 63 insertions(+), 82 deletions(-) diff --git a/.gitchange b/.gitchange index cc2d6f7..41afb13 100644 --- a/.gitchange +++ b/.gitchange @@ -1,4 +1,4 @@ 1460135613 49dd4154d8f5d3b70691c8e3f52a063a49137fb7:57be33556df067.43016776 853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:5849aaa17584a2.95309978 -d0e05c36184f81b133761b71ca6ee0136be67409:58509b56682b37.29646922 +d0e05c36184f81b133761b71ca6ee0136be67409:5859ec5c259619.25971147 diff --git a/CHANGELOG.md b/CHANGELOG.md index 09146bb..26b8980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,26 +1,16 @@ -= [coming soon] = - -- **New Pro Feature (Mobile-Adaptive Mode):** This release adds a new feature that is designed to improve compatibility with Adaptive themes for mobile devices. To learn more, please see: **Dashboard → Comet Cache Pro → Plugin Options → Mobile-Adaptive Mode**. See also: [Issue #471](https://github.com/websharks/comet-cache/issues/471) and the screenshots [here](https://github.com/websharks/comet-cache-pro/pull/303#issuecomment-266230409). - -- **Static CDN Filters (`srcset`):** This release enhances Static CDN Filters in Comet Cache Pro. Static CDN Filters are now smart enough to filter all image sources included in an `srcset=""` attribute that is generated by WordPress. See [Issue #660](https://github.com/websharks/comet-cache/issues/660). If you'd like to learn more about `srcset=""`, see [this article at WordPress.org](https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/). - += v161221 = + +- **Bug Fix:** Improving PHP OPcache detection. Now considering the INI option `opcache.restrict_api`. Comet Cache is now smart enough to avoid generating the PHP Warning: _PHP Warning: Zend OPcache API is restricted by "restrict_api" configuration directive_. See [Issue #733](https://github.com/websharks/comet-cache/issues/733). +- **New Feature (Pro): Mobile Mode.** This release adds a new feature that is designed to improve compatibility with Adaptive themes for mobile devices. To learn more, please see: **Dashboard → Comet Cache Pro → Plugin Options → Mobile Mode**. See also: [Issue #471](https://github.com/websharks/comet-cache/issues/471). +- **Enhancement: Auto-Clearing Author Page Cache.** This release makes Comet Cache smart enough to detect when a user is deleted (or removed from a child blog in a Network), at which time the Author page for that user will be cleared from the cache so it can be regenerated automatically. See [Issue #304](https://github.com/websharks/comet-cache/issues/304). +- **Enhancement: Multibyte Compatibility.** This release improves support for WordPress Permalinks that contain UTF-8 symbols (or emojis) in them. More specifically, this release adds the `/u` flag to all `preg_*()` calls in cache clearing routines that generate cache paths from Watered-Down Regex patterns entered by a site owner. See: [Issue #611](https://github.com/websharks/comet-cache/issues/611). +- **Enhancement: Widget Change Detection.** Comet Cache can now detect when **Appearance → Widgets** are added/edited/removed, and Comet Cache will automatically clear the cache so that your site remains up-to-date. See [Issue #411](https://github.com/websharks/comet-cache/issues/411). +- **Enhancement (Pro): Static CDN Filters and `srcset`.** This release enhances Static CDN Filters in Comet Cache Pro. Static CDN Filters are now smart enough to filter all image sources included in an `srcset=""` attribute that is generated by WordPress. See [Issue #660](https://github.com/websharks/comet-cache/issues/660). If you'd like to learn more about `srcset=""`, see [this article at WordPress.org](https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/). +- **Enhancement (Pro): Automatic Background Updates.** It is now possible to enable automatic background updates that occur quietly in the background whenever new features, bug fixes, or security issues are addressed by our developers. See: **Dashboard → Comet Cache Pro → Config. Options → Update Credentials**. See also: [Issue #827](https://github.com/websharks/comet-cache/issues/827). +- **Enhancement (Pro): HTML Compressor + Accelerated Mobile Pages (AMP).** Updated to the latest available release of the HTML Compressor (v161208) with improved support for [Accelerated Mobile Pages](https://www.ampproject.org/). See: [Issue #695](https://github.com/websharks/comet-cache/issues/695). See also: [HTML Compressor v161208 changelog](https://github.com/websharks/html-compressor/releases/tag/161208). +- **Enhancement (Pro): HTML Compressor / AMP Compatibility.** Improved compatibility with [Accelerated Mobile Pages](https://www.ampproject.org/). There is a new HTML Compressor option that is enabled by default and it makes Comet Cache smart enough to auto-detect and selectively disable portions of the HTML Compressor that are incompatible with the AMP spec; i.e., routines that are not necessary when serving APMd pages. In short, if the URI being compressed ends with `/amp/`, or the document contains a top-level `` tag (`` is accepted as well), then features which are incompatible with [Accelerated Mobile Pages](https://www.ampproject.org/) will be disabled accordingly. - **Compatibility:** Avoid deprecated `wp_get_sites()` and use `get_sites()` instead. See [Issue #848](https://github.com/websharks/comet-cache/issues/848). - -- **Auto-Clearing:** This release makes Comet Cache smart enough to detect when a user is deleted (or removed from a child blog in a Network). At which time the Author page for that user will be cleared from the cache so it can be regenerated automatically. See [Issue #304](https://github.com/websharks/comet-cache/issues/304). - -- **Watered-Down Regex Documentation:** Adding notes to the inline documentation (in the software) about the use of `^` and `$` in some places where these special characters are not fully supported. Also adding the same notes to the [Watered-Down Regex KB Article](https://cometcache.com/kb-article/watered-down-regex-syntax/). See also: [Issue #611](https://github.com/websharks/comet-cache/issues/611). - -- **Multibyte Compatibility:** This release improves support for WordPress Permalinks that contain UTF-8 symbols (or emojis) in them. More specifically, this release adds the `/u` flag to all `preg_*()` calls in cache clearing routines that generate cache paths from Watered-Down Regex patterns entered by a site owner. See: [Issue #611](https://github.com/websharks/comet-cache/issues/611). - -- **Widget Change Detection:** Comet Cache can now detect when **Appearance → Widgets** are added/edited/removed, and Comet Cache will automatically clear the cache so that your site remains up-to-date. See [Issue #411](https://github.com/websharks/comet-cache/issues/411). - -- **Automatic Background Updates:** It is now possible (in Comet Cache Pro) to enable automatic background updates that occur quietly in the background whenever new features, bug fixes, or security issues are addressed by our developers. See: **Dashboard → Comet Cache Pro → Config. Options → Update Credentials**. See also: [Issue #827](https://github.com/websharks/comet-cache/issues/827). - -- **HTML Compressor:** Updated to the latest available release of the HTML Compressor (v161208) with improved support for [Accelerated Mobile Pages](https://www.ampproject.org/). See: [Issue #733](https://github.com/websharks/comet-cache/issues/733). See also: [HTML Compressor v161208 changelog](https://github.com/websharks/html-compressor/releases/tag/161208). - -- **HTML Compressor / AMP Compatibility:** Improved compatibility with [Accelerated Mobile Pages](https://www.ampproject.org/). There is a new HTML Compressor option that is enabled by default and it makes Comet Cache smart enough to auto-detect and selectively disable portions of the HTML Compressor that are incompatible with the AMP spec; i.e., routines that are not necessary when serving APMd pages. In short, if the URI being compressed ends with `/amp/`, or the document contains a top-level `` tag (`` is accepted as well), then features which are incompatible with [Accelerated Mobile Pages](https://www.ampproject.org/) will be disabled accordingly. - -- **Bug Fix:** Improving OPcache detection. Now considering INI option `opcache.restrict_api`. Comet Cache is now smart enough to avoid the error: _PHP Warning: Zend OPcache API is restricted by "restrict_api" configuration directive_. See [Issue #733](https://github.com/websharks/comet-cache/issues/733). +- **Documentation:** Added Watered-Down Regex documentation notes to the inline documentation (in the software) about the use of `^` and `$` in some places where these special characters are not fully supported. Also adding the same notes to the [Watered-Down Regex KB Article](https://cometcache.com/r/watered-down-regex-syntax/). See also: [Issue #611](https://github.com/websharks/comet-cache/issues/611). = v161119 = diff --git a/comet-cache.php b/comet-cache.php index 724e1bc..22bf3f1 100644 --- a/comet-cache.php +++ b/comet-cache.php @@ -1,6 +1,6 @@ ` tag (`` is accepted as well), then features which are incompatible with [Accelerated Mobile Pages](https://www.ampproject.org/) will be disabled accordingly. +- **Compatibility:** Avoid deprecated `wp_get_sites()` and use `get_sites()` instead. See [Issue #848](https://github.com/websharks/comet-cache/issues/848). +- **Documentation:** Added Watered-Down Regex documentation notes to the inline documentation (in the software) about the use of `^` and `$` in some places where these special characters are not fully supported. Also adding the same notes to the [Watered-Down Regex KB Article](https://cometcache.com/r/watered-down-regex-syntax/). See also: [Issue #611](https://github.com/websharks/comet-cache/issues/611). + = v161119 = - **Bug Fix:** Avoid browser autocomplete in configuration fields by adding `autocomplete="off"` to all form tags in Comet Cache menu pages. See [Issue #832](https://github.com/websharks/comet-cache/issues/832). @@ -403,16 +419,4 @@ Requires WordPress v4.2+. - Renamed `COMET_CACHE_ALLOW_BROWSER_CACHE` constant to `COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE`. Backwards compatibility has been maintained. - Renamed `allow_browser_cache` plugin option to `allow_client_side_cache`. -= v160521 = - -- **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752). -- **Bug Fix**: When the PHP OPCache extension is active, the OPCache is now cleared when a WordPress plugin is upgraded, activated, or deactivated. This works around an issue that could produce a fatal error when the PHP OPCache contains cached PHP code that conflicts with new PHP code introduced by an update. See [Issue #740](https://github.com/websharks/comet-cache/issues/740). -- **Enhancement** (Pro): It's now possible to disable the WordPress Admin Toolbar when Logged-In User Caching is enabled with a new option in _Comet Cache → Plugin Options → Logged-In Users → Disable the Admin Toolbar for Logged-In Users & Comment Authors?_ Props @renzms and @KTS915. See [Issue #690](https://github.com/websharks/comet-cache/issues/690). -- **Enhancement**: The the option to automatically clear the cache for Custom Term Archive Views (see _Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Term Archives" Too?_) is now enabled by default. This feature was previously disabled by default, which lead to confusion about why those cache files were not being cleared automatically when a Custom Post Type with a Custom Term Archive View was being used. Props @renzms. See [Issue #693](https://github.com/websharks/comet-cache/issues/693). -- **Enhancement** (Pro): A new filter allows overriding the default behavior to clear the user cache upon login and logout when caching for Logged-In Users is enabled. See [this article](https://cometcache.com/r/kb-article-how-can-i-prevent-the-user-cache-from-being-cleared-upon-login-or-logout/) for details. Props @KTS915. See [Issue #756](https://github.com/websharks/comet-cache/issues/756). - -= v160417 = - -- **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739). - For older changelog history going back more than 7 years, please see [CHANGELOG.md](https://github.com/websharks/comet-cache/blob/master/CHANGELOG.md). diff --git a/src/client-s/js/menu-pages.js b/src/client-s/js/menu-pages.js index 41b394d..0138c83 100644 --- a/src/client-s/js/menu-pages.js +++ b/src/client-s/js/menu-pages.js @@ -117,24 +117,6 @@ $ss.attr('src', $ss.attr('src').replace(/ops[0-9]\-ss\.png$/, 'ops' + val + '-ss.png')); }; - plugin.handleCdnHostsChange = function (event) { - var $cdnHosts = $(this), - $cdnHost = $('input[name$="\[cdn_host\]"]', plugin.$menuPage); - - if ($.trim($cdnHosts.val())) { - if ($cdnHost.val()) { - $cdnHost.data('hiddenValue', $cdnHost.val()); - } - $cdnHost.attr('disabled', 'disabled').val(''); - } else { - if (!$cdnHost.val()) { - $cdnHost.val($cdnHost.data('hiddenValue')); - } - $cdnHost.removeAttr('disabled'); - $cdnHosts.val(''); - } - }; - plugin.bytesToSizeLabel = function (bytes, decimals) { diff --git a/src/client-s/js/menu-pages.min.js b/src/client-s/js/menu-pages.min.js index af2e709..aa52697 100644 --- a/src/client-s/js/menu-pages.min.js +++ b/src/client-s/js/menu-pages.min.js @@ -1,7 +1,7 @@ (function(b){var a={namespace:"comet_cache"},d=b(window),c=b(document);a.onReady=function(){ -;a.$menuPage=b("#plugin-menu-page");a.vars=window[a.namespace+"_menu_page_vars"];b(".plugin-menu-page-panel-heading",a.$menuPage).on("click",a.togglePanel);b(".plugin-menu-page-panels-open",a.$menuPage).on("click",a.toggleAllPanelsOpen);b(".plugin-menu-page-panels-close",a.$menuPage).on("click",a.toggleAllPanelsClose);b("[data-action]",a.$menuPage).on("click",a.doDataAction);b("[data-toggle-target]",a.$menuPage).on("click",a.doDataToggleTarget);b('select[name$="_enable\\]"], select[data-toggle~="enable-disable"]',a.$menuPage).not(".-no-if-enabled").on("change",a.enableDisable).trigger("change"); +a.$menuPage=b("#plugin-menu-page");a.vars=window[a.namespace+"_menu_page_vars"];b(".plugin-menu-page-panel-heading",a.$menuPage).on("click",a.togglePanel);b(".plugin-menu-page-panels-open",a.$menuPage).on("click",a.toggleAllPanelsOpen);b(".plugin-menu-page-panels-close",a.$menuPage).on("click",a.toggleAllPanelsClose);b("[data-action]",a.$menuPage).on("click",a.doDataAction);b("[data-toggle-target]",a.$menuPage).on("click",a.doDataToggleTarget);b('select[name$="_enable\\]"], select[data-toggle~="enable-disable"]',a.$menuPage).not(".-no-if-enabled").on("change",a.enableDisable).trigger("change"); -};a.toggleAllPanelsOpen=function(e){a.preventDefault(e);b(".plugin-menu-page-panel-heading",a.$menuPage).addClass("open").next(".plugin-menu-page-panel-body").addClass("open")};a.toggleAllPanelsClose=function(e){a.preventDefault(e);b(".plugin-menu-page-panel-heading",a.$menuPage).removeClass("open").next(".plugin-menu-page-panel-body").removeClass("open")};a.togglePanel=function(e){a.preventDefault(e);b(this).toggleClass("open").next(".plugin-menu-page-panel-body").toggleClass("open")};a.doDataAction=function(e){a.preventDefault(e);var g=b(this),f=g.data();if(typeof f.confirmation!=="string"||confirm(f.confirmation)){location.href=f.action}};a.enableDisable=function(e){var m=b(this),g=m.val(),f=m.attr("name"),o=String(m.data("enabledStrings")||"1,2,3,4,5").split(/,+/),l=b.inArray(g,o)!==-1,i=m.closest(".plugin-menu-page-panel-body"),n=m.data("target"),h=n?b(n,i).filter(".plugin-menu-page-panel-if-enabled"):null,k=m.closest(".plugin-menu-page-panel-if-enabled"),j=k.find("> .plugin-menu-page-panel-if-enabled"),p=i.find("> .plugin-menu-page-panel-if-enabled");if(l){if(n){h.css("opacity",1).find(":input").removeAttr("readonly")}else{if(k.length){j.css("opacity",1).find(":input").removeAttr("readonly")}else{p.css("opacity",1).find(":input").removeAttr("readonly")}}}else{if(n){h.css("opacity",0.4).find(":input").attr("readonly","readonly")}else{if(k.length){j.css("opacity",0.4).find(":input").attr("readonly","readonly")}else{p.css("opacity",0.4).find(":input").attr("readonly","readonly")}}}};a.doDataToggleTarget=function(f){a.preventDefault(f);var g=b(this),e=b(g.data("toggleTarget"));if(e.is(":visible")){e.hide();g.find(".si").removeClass("si-eye-slash").addClass("si-eye")}else{e.show();g.find(".si").removeClass("si-eye").addClass("si-eye-slash")}};a.handleCacheClearAdminBarOpsChange=function(g){var f=b(this),h=f.val(),e=b(".-clear-cache-ops-ss",a.$menuPage);e.attr("src",e.attr("src").replace(/ops[0-9]\-ss\.png$/,"ops"+h+"-ss.png"))};a.handleCdnHostsChange=function(f){var g=b(this),e=b('input[name$="[cdn_host]"]',a.$menuPage);if(b.trim(g.val())){if(e.val()){e.data("hiddenValue",e.val())}e.attr("disabled","disabled").val("")}else{if(!e.val()){e.val(e.data("hiddenValue"))}e.removeAttr("disabled");g.val("")}}; +}};a.toggleAllPanelsOpen=function(e){a.preventDefault(e);b(".plugin-menu-page-panel-heading",a.$menuPage).addClass("open").next(".plugin-menu-page-panel-body").addClass("open")};a.toggleAllPanelsClose=function(e){a.preventDefault(e);b(".plugin-menu-page-panel-heading",a.$menuPage).removeClass("open").next(".plugin-menu-page-panel-body").removeClass("open")};a.togglePanel=function(e){a.preventDefault(e);b(this).toggleClass("open").next(".plugin-menu-page-panel-body").toggleClass("open")};a.doDataAction=function(e){a.preventDefault(e);var g=b(this),f=g.data();if(typeof f.confirmation!=="string"||confirm(f.confirmation)){location.href=f.action}};a.enableDisable=function(e){var m=b(this),g=m.val(),f=m.attr("name"),o=String(m.data("enabledStrings")||"1,2,3,4,5").split(/,+/),l=b.inArray(g,o)!==-1,i=m.closest(".plugin-menu-page-panel-body"),n=m.data("target"),h=n?b(n,i).filter(".plugin-menu-page-panel-if-enabled"):null,k=m.closest(".plugin-menu-page-panel-if-enabled"),j=k.find("> .plugin-menu-page-panel-if-enabled"),p=i.find("> .plugin-menu-page-panel-if-enabled");if(l){if(n){h.css("opacity",1).find(":input").removeAttr("readonly")}else{if(k.length){j.css("opacity",1).find(":input").removeAttr("readonly")}else{p.css("opacity",1).find(":input").removeAttr("readonly")}}}else{if(n){h.css("opacity",0.4).find(":input").attr("readonly","readonly")}else{if(k.length){j.css("opacity",0.4).find(":input").attr("readonly","readonly")}else{p.css("opacity",0.4).find(":input").attr("readonly","readonly")}}}};a.doDataToggleTarget=function(f){a.preventDefault(f);var g=b(this),e=b(g.data("toggleTarget"));if(e.is(":visible")){e.hide();g.find(".si").removeClass("si-eye-slash").addClass("si-eye")}else{e.show();g.find(".si").removeClass("si-eye").addClass("si-eye-slash")}};a.handleCacheClearAdminBarOpsChange=function(g){var f=b(this),h=f.val(),e=b(".-clear-cache-ops-ss",a.$menuPage);e.attr("src",e.attr("src").replace(/ops[0-9]\-ss\.png$/,"ops"+h+"-ss.png"))}; -;a.bytesToSizeLabel=function(f,e){if(typeof f!=="number"||f<=1){return f===1?"1 byte":"0 bytes"}if(typeof e!=="number"||e<=0){e=0}var i=1024,j=Math.floor(Math.log(f)/Math.log(i)),h=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],g=(f/Math.pow(i,j));return g.toFixed(e)+" "+h[j]};a.numberFormat=function(f,e){if(typeof f!=="number"){return String(f)}if(typeof e!=="number"||e<=0){e=0}return f.toFixed(e).replace(/./g,function(g,i,h){return i&&g!=="."&&((h.length-i)%3===0)?","+g:g})};a.escHtml=function(f){var e={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(f).replace(/[&<>"']/g,function(g){return e[g]})};a.preventDefault=function(f,e){if(!f){return}f.preventDefault();if(e){f.stopImmediatePropagation()}};c.ready(a.onReady)})(jQuery); \ No newline at end of file +a.bytesToSizeLabel=function(f,e){if(typeof f!=="number"||f<=1){return f===1?"1 byte":"0 bytes"}if(typeof e!=="number"||e<=0){e=0}var i=1024,j=Math.floor(Math.log(f)/Math.log(i)),h=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],g=(f/Math.pow(i,j));return g.toFixed(e)+" "+h[j]};a.numberFormat=function(f,e){if(typeof f!=="number"){return String(f)}if(typeof e!=="number"||e<=0){e=0}return f.toFixed(e).replace(/./g,function(g,i,h){return i&&g!=="."&&((h.length-i)%3===0)?","+g:g})};a.escHtml=function(f){var e={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(f).replace(/[&<>"']/g,function(g){return e[g]})};a.preventDefault=function(f,e){if(!f){return}f.preventDefault();if(e){f.stopImmediatePropagation()}};c.ready(a.onReady)})(jQuery); \ No newline at end of file diff --git a/src/includes/classes/MenuPageOptions.php b/src/includes/classes/MenuPageOptions.php index cb944e6..b00000c 100644 --- a/src/includes/classes/MenuPageOptions.php +++ b/src/includes/classes/MenuPageOptions.php @@ -1199,13 +1199,14 @@ public function __construct() echo '

'.sprintf(__('When %1$s runs in Mobile-Adaptive Mode and it detects that a device is Mobile (e.g., a phone, tablet), it needs to know which factors you\'d like to consider. Mobile-Adaptive Tokens make this easy. In the field below, please configure a list of Mobile-Adaptive Tokens that establish the important factors on your site. Each token must be separated by a + sign. You can use just one, or use them all. However, it\'s IMPORTANT to note: With each new token, you add additional permutations that can fragment the cache and eat up a lot of disk space. Enable and monitor Cache Statistics so you can keep an eye on this. See: %1$s → Plugin Options → Cache-Related Statistics', 'comet-cache'), esc_html(NAME)).'

'."\n"; echo '

'.__('The available Tokens are as follows:', 'comet-cache').'

'."\n"; echo ' '."\n"; - echo '

'."\n"; - echo '

'.sprintf(__('The suggested default value is: %2$s.
However, just: os.name + device.type is better, if that will do.', 'comet-cache'), esc_html(NAME), esc_html($this->plugin->default_options['mobile_adaptive_salt'])).'

'."\n"; + echo '

'."\n"; + echo '

'.sprintf(__('The suggested default value is: %2$s
However, just: os.name + device.type is better, if that will do.', 'comet-cache'), esc_html(NAME), esc_html($this->plugin->default_options['mobile_adaptive_salt'])).'

'."\n"; echo '

'.__('The special token: device.is_mobile (i.e., any mobile device, including tablets, excluding laptops) can be used by itself. For example, if you simply want to break the cache down into mobile vs. NOT mobile.', 'comet-cache').'

'."\n"; echo '

'.sprintf(__('Note: The underlying logic behind mobile detection is accomplished using a faster, precompiled version of Browscap Lite, and Browcap data is automatically updated (and recompiled) whenever you save %1$s options and/or when upgrading %1$s to a new version.', 'comet-cache'), esc_html(NAME)).'

'."\n"; echo ' '."\n"; diff --git a/src/includes/classes/Plugin.php b/src/includes/classes/Plugin.php index 95154ff..2b50b82 100644 --- a/src/includes/classes/Plugin.php +++ b/src/includes/classes/Plugin.php @@ -345,10 +345,9 @@ public function setup() 'version_salt' => '', // Any string value as a cache path component. - // This should be set to a `+` delimited string containing any of these tokens: - // `os.name + device.type + browser.name + browser.version` (version should be avoided). - // There is one additional token (`device.is_mobile`) that can be used stand-alone. - // i.e., to indicate that being mobile is the only factor worth considering. + // This should be set to a `+` delimited string containing any of these tokens: `os.name + device.type + browser.name + browser.version.major`. + // There is an additional token (`browser.version`) that contains both the major and minor versions, but this token is not recommended due to many permutations. + // There is an additional token (`device.is_mobile`) that can be used stand-alone; i.e., to indicate that being mobile is the only factor worth considering. 'mobile_adaptive_salt' => 'os.name + device.type + browser.name', 'mobile_adaptive_salt_enable' => '0', // `0|1` Enable the mobile adaptive salt? 'ua_info_last_data_update' => '0', // Timestamp. diff --git a/src/includes/stub.php b/src/includes/stub.php index 6a2fa8a..0d818ac 100644 --- a/src/includes/stub.php +++ b/src/includes/stub.php @@ -13,7 +13,7 @@ require_once dirname(__DIR__).'/vendor/autoload.php'; require_once __DIR__.'/functions/i18n-utils.php'; -${__FILE__}['version'] = '161214-RC'; //version// +${__FILE__}['version'] = '161221'; //version// ${__FILE__}['plugin'] = dirname(dirname(__DIR__)); ${__FILE__}['plugin'] .= '/'.basename(${__FILE__}['plugin']).'.php'; ${__FILE__}['ns_path'] = str_replace('\\', '/', __NAMESPACE__); // To dir/path. diff --git a/src/includes/traits/Plugin/MenuPageUtils.php b/src/includes/traits/Plugin/MenuPageUtils.php index 893bb8d..b3d1839 100644 --- a/src/includes/traits/Plugin/MenuPageUtils.php +++ b/src/includes/traits/Plugin/MenuPageUtils.php @@ -54,15 +54,16 @@ public function enqueueAdminScripts() 'emptyStatsCountsImageUrl' => $this->url('/src/client-s/images/stats-fc-empty.png'), 'emptyStatsFilesImageUrl' => $this->url('/src/client-s/images/stats-fs-empty.png'), 'i18n' => [ - 'name' => NAME, - 'perSymbol' => __('%', 'comet-cache'), - 'file' => __('file', 'comet-cache'), - 'files' => __('files', 'comet-cache'), - 'pageCache' => __('Page Cache', 'comet-cache'), - 'htmlCompressor' => __('HTML Compressor', 'comet-cache'), - 'currentTotal' => __('Current Total', 'comet-cache'), - 'currentSite' => __('Current Site', 'comet-cache'), - 'xDayHigh' => __('%s Day High', 'comet-cache'), + 'name' => NAME, + 'perSymbol' => __('%', 'comet-cache'), + 'file' => __('file', 'comet-cache'), + 'files' => __('files', 'comet-cache'), + 'pageCache' => __('Page Cache', 'comet-cache'), + 'htmlCompressor' => __('HTML Compressor', 'comet-cache'), + 'currentTotal' => __('Current Total', 'comet-cache'), + 'currentSite' => __('Current Site', 'comet-cache'), + 'xDayHigh' => __('%s Day High', 'comet-cache'), + 'mobileAdaptiveSaltError' => __('Invalid Mobile-Adaptive Tokens. This field must contain one or more of the listed Tokens (separated by a + sign). Please use Tokens only, NOT string literals.', 'comet-cache'), ], ] ); @@ -181,7 +182,7 @@ public function menuPageOptions() * * @since 150422 Rewrite. * - * @var array WP admin icon colors. + * @type array WP admin icon colors. * * @note These must be hard-coded, because they don't become available * in core until `admin_init`; i.e., too late for `admin_menu`. diff --git a/src/includes/traits/Plugin/WcpAuthorUtils.php b/src/includes/traits/Plugin/WcpAuthorUtils.php index 6b092a4..286cfa7 100644 --- a/src/includes/traits/Plugin/WcpAuthorUtils.php +++ b/src/includes/traits/Plugin/WcpAuthorUtils.php @@ -92,7 +92,7 @@ public function autoClearAuthorPageCache($post_id, \WP_Post $post_after, \WP_Pos * @attaches-to `remove_user_from_blog` hook. * @attaches-to `delete_user` hook. * - * @since 16xxxx Adding support for user deletions. + * @since 161221 Adding support for user deletions. * * @param int $user_id A WordPress user ID. * @param int $rat_user_id User ID (reassign via `delete_user` hook). diff --git a/src/includes/traits/Shared/BlogUtils.php b/src/includes/traits/Shared/BlogUtils.php index 47ef5b1..2f1bb66 100644 --- a/src/includes/traits/Shared/BlogUtils.php +++ b/src/includes/traits/Shared/BlogUtils.php @@ -8,7 +8,7 @@ trait BlogUtils /** * Get child blogs. * - * @since 16xxxx Replacing `wp_get_sites()`. + * @since 161221 Replacing `wp_get_sites()`. * * @return array An array of child blogs (max 100). * diff --git a/src/includes/traits/Shared/ConditionalUtils.php b/src/includes/traits/Shared/ConditionalUtils.php index 07f8870..98285a5 100644 --- a/src/includes/traits/Shared/ConditionalUtils.php +++ b/src/includes/traits/Shared/ConditionalUtils.php @@ -8,7 +8,7 @@ trait ConditionalUtils /** * PHP's language constructs. * - * @var array PHP's language constructs. + * @type array PHP's language constructs. * @note Keys unimportant; subject to change. * * @since 160222 First documented version. @@ -152,6 +152,10 @@ public function isLikeUserLoggedIn() $regex_logged_in_cookies .= '/'; // Close regex. foreach ($_COOKIE as $_key => $_value) { + if (!is_scalar($_value)) { + continue; // See https://git.io/v1dTw + } + $_key = (string) $_key; $_value = (string) $_value;