diff --git a/.gitattributes b/.gitattributes index be1b039..02c94b5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,6 +22,7 @@ # Server config files. *.admins text *.cfg text +*.cnf text *.conf text *.htaccess text *.htaccess-apache text @@ -31,8 +32,14 @@ # CSS/JavaScript files. *.css text *.js text +*.css.map text +*.js.map text *.json text +# Applescript files. +*.applescript text +*.scpt binary + # PHP scripts/files. *.inc text *.php text @@ -140,4 +147,4 @@ *.dll binary *.exe binary *.sh text -*.so binary \ No newline at end of file +*.so binary diff --git a/.gitignore b/.gitignore index 2b70c04..12e3bd4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,15 @@ *~ *.bak +# Node +node_modules/ +npm-debug.log + +# SASS +.sass-cache/ + # IntelliJ .idea/ -*.iml *.ipr *.iws @@ -49,10 +55,13 @@ Icon? # Amazon Web Services .elasticbeanstalk/ -# For shell glob patterns. This includes GIT files too. We simply maintain this list together with `.gitignore`. -# .~*;*~;*.bak;.idea;*.iml;*.ipr;*.iws;*.sublime-workspace;*.sublime-project;.git;.gitignore;.gitattributes;CVS;.cvsignore;.svn;_svn;.bzr;.bzrignore;.hg;.hgignore;SCCS;RCS;$RECYCLE.BIN;Desktop.ini;Thumbs.db;ehthumbs.db;.Spotlight-V100;.AppleDouble;.LSOverride;.DS_Store;.Trashes;.elasticbeanstalk +# Vagrant +.vagrant/ + +# For shell glob patterns. This includes Git files too. We simply maintain this list together with `.gitignore`. +# .~*;*~;*.bak;node_modules;npm-debug.log;.idea;*.ipr;*.iws;*.sublime-workspace;*.sublime-project;.git;.gitignore;.gitattributes;CVS;.cvsignore;.svn;_svn;.bzr;.bzrignore;.hg;.hgignore;SCCS;RCS;$RECYCLE.BIN;Desktop.ini;Thumbs.db;ehthumbs.db;.Spotlight-V100;.AppleDouble;.LSOverride;.DS_Store;.Trashes;._*;.elasticbeanstalk;.vagrant # This list is for IntelliJ IDEA / PhpStorm `File Types` configuration. Some files we actually WANT to work with as part of a project. -# .idea;*.iml;*.ipr;*.iws;*.sublime-workspace;*.sublime-project;.git;CVS;.svn;_svn;.bzr;.hg;SCCS;RCS;$RECYCLE.BIN;Desktop.ini;Thumbs.db;ehthumbs.db;.Spotlight-V100;.AppleDouble;.LSOverride;.DS_Store;.Trashes;._* +# .sass-cache;.idea;*.ipr;*.iws;*.sublime-workspace;*.sublime-project;.git;CVS;.svn;_svn;.bzr;.hg;SCCS;RCS;$RECYCLE.BIN;Desktop.ini;Thumbs.db;ehthumbs.db;.Spotlight-V100;.AppleDouble;.LSOverride;.DS_Store;.Trashes;._*;.vagrant -# We also need to update the WebSharks™ Core `dirs_files::ignore()` method if this changes. \ No newline at end of file +# We also need to update the WebSharks™ Core `dirs_files::ignore()` method if this changes. diff --git a/zencache/includes/advanced-cache.tpl.php b/zencache/includes/advanced-cache.tpl.php index 308743f..5283421 100644 --- a/zencache/includes/advanced-cache.tpl.php +++ b/zencache/includes/advanced-cache.tpl.php @@ -679,8 +679,9 @@ public function maybe_start_output_buffering() if($this->is_uncacheable_request_method()) return $this->maybe_set_debug_info($this::NC_DEBUG_UNCACHEABLE_REQUEST); - if(isset($_SERVER['REMOTE_ADDR'], $_SERVER['SERVER_ADDR']) && $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']) - if(!$this->is_localhost()) return $this->maybe_set_debug_info($this::NC_DEBUG_SELF_SERVE_REQUEST); + if(isset($_SERVER['SERVER_ADDR']) && $this->current_ip() === $_SERVER['SERVER_ADDR']) + if(!$this->is_localhost()) // Allow for a localhost scenario; i.e., a developer testing. + return $this->maybe_set_debug_info($this::NC_DEBUG_SELF_SERVE_REQUEST); if(!ZENCACHE_FEEDS_ENABLE && $this->is_feed()) return $this->maybe_set_debug_info($this::NC_DEBUG_FEED_REQUEST); @@ -1053,7 +1054,7 @@ public function maybe_get_nc_debug_info($reason_code = '', $reason = '') break; // Break switch handler. case $this::NC_DEBUG_SELF_SERVE_REQUEST: - $reason = __('because `$_SERVER[\'REMOTE_ADDR\']` === `$_SERVER[\'SERVER_ADDR\']`; i.e. a self-serve request. DEVELOPER TIP: if you are testing on a localhost installation, please add `define(\'LOCALHOST\', TRUE);` to your `/wp-config.php` file while you run tests :-) Remove it (or set it to a `FALSE` value) once you go live on the web.', $this->text_domain); + $reason = __('because `[current IP address]` === `$_SERVER[\'SERVER_ADDR\']`; i.e. a self-serve request. DEVELOPER TIP: if you are testing on a localhost installation, please add `define(\'LOCALHOST\', TRUE);` to your `/wp-config.php` file while you run tests :-) Remove it (or set it to a `FALSE` value) once you go live on the web.', $this->text_domain); break; // Break switch handler. case $this::NC_DEBUG_FEED_REQUEST: diff --git a/zencache/includes/menu-pages.php b/zencache/includes/menu-pages.php index 53dc914..8bce4fc 100644 --- a/zencache/includes/menu-pages.php +++ b/zencache/includes/menu-pages.php @@ -531,7 +531,7 @@ public function options() echo ' '."\n"; echo ' '."\n"; echo '

'."\n"; - echo '

'.__('Note: This is experimental. Please report issues here.', $this->plugin->text_domain).'

'."\n"; + echo '

'.__('Note: This is experimental. Please report issues here.', $this->plugin->text_domain).'

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

'.__('HTML Compression Options', $this->plugin->text_domain).'

'."\n"; diff --git a/zencache/includes/share.php b/zencache/includes/share.php index 8ab2411..f5c0101 100644 --- a/zencache/includes/share.php +++ b/zencache/includes/share.php @@ -61,7 +61,7 @@ abstract class share // Shared between {@link advanced_cache} and {@link plugin} * * @var string Current version of the software. */ - public $version = '150314'; + public $version = '150409'; /** * Plugin slug; based on `__NAMESPACE__`. @@ -979,6 +979,83 @@ public function has_a_cacheable_status() return (static::$static[__FUNCTION__] = TRUE); // Assume that it is by default. } + /* -------------------------------------------------------------------------------------- + * IP address utilities. + -------------------------------------------------------------------------------------- */ + + /** + * Get the current visitor's real IP address. + * + * @return string Real IP address, else `unknown` on failure. + * + * @note This supports both IPv4 and IPv6 addresses. + * @note See my tests against this here: http://3v4l.org/fVWUp + */ + public function current_ip() + { + if(isset(static::$static[__FUNCTION__])) + return static::$static[__FUNCTION__]; + + static::$static[__FUNCTION__] = ''; // Initialize. + $ip = &static::$static[__FUNCTION__]; + + if(!empty($_SERVER['REMOTE_ADDR']) && $this->apply_filters(__METHOD__.'_prioritize_remote_addr', FALSE)) + if(($_valid_public_ip = $this->valid_public_ip($_SERVER['REMOTE_ADDR']))) + return ($ip = $_valid_public_ip); + + $sources = array( + 'HTTP_CF_CONNECTING_IP', + 'HTTP_CLIENT_IP', + 'HTTP_X_FORWARDED_FOR', + 'HTTP_X_FORWARDED', + 'HTTP_X_CLUSTER_CLIENT_IP', + 'HTTP_FORWARDED_FOR', + 'HTTP_FORWARDED', + 'HTTP_VIA', + 'REMOTE_ADDR', + ); + $sources = $this->apply_filters(__METHOD__.'_sources', $sources); + + foreach($sources as $_source) // Try each of these; in order. + { + if(!empty($_SERVER[$_source])) // Does the source key exist at all? + if(($_valid_public_ip = $this->valid_public_ip($_SERVER[$_source]))) + return ($ip = $_valid_public_ip); // A valid public IPv4 or IPv6 address. + } + unset($_source, $_valid_public_ip); // Housekeeping. + + if(!empty($_SERVER['REMOTE_ADDR']) && is_string($_SERVER['REMOTE_ADDR'])) + return ($ip = strtolower($_SERVER['REMOTE_ADDR'])); + + return ($ip = 'unknown'); // Not possible. + } + + /** + * Gets a valid/public IP address. + * + * @param string $list_of_possible_ips A single IP, or a comma-delimited list of IPs. + * + * @return string A valid/public IP address (if one is found), else an empty string. + * + * @note This supports both IPv4 and IPv6 addresses. + * @note See my tests against this here: http://3v4l.org/fVWUp + */ + public function valid_public_ip($list_of_possible_ips) + { + if(!$list_of_possible_ips || !is_string($list_of_possible_ips)) + return ''; // Empty or invalid data. + + if(!($list_of_possible_ips = trim($list_of_possible_ips))) + return ''; // Not possible; i.e., empty string. + + foreach(preg_split('/[\s;,]+/', $list_of_possible_ips, NULL, PREG_SPLIT_NO_EMPTY) as $_possible_ip) + if(($_valid_public_ip = filter_var(strtolower($_possible_ip), FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) + return $_valid_public_ip; // A valid public IPv4 or IPv6 address. + unset($_possible_ip, $_valid_public_ip); // Housekeeping. + + return ''; // Default return value. + } + /* -------------------------------------------------------------------------------------- * Function/extension utilities. -------------------------------------------------------------------------------------- */ @@ -1369,7 +1446,7 @@ public function get_tmp_dir() $possible_tmp_dirs[] = WP_CONTENT_DIR; if(!empty($possible_tmp_dirs)) foreach($possible_tmp_dirs as $_tmp_dir) - if(($_tmp_dir = trim((string)$_tmp_dir)) && is_dir($_tmp_dir) && is_writable($_tmp_dir)) + if(($_tmp_dir = trim((string)$_tmp_dir)) && @is_dir($_tmp_dir) && @is_writable($_tmp_dir)) return ($tmp_dir = $this->n_dir_seps($_tmp_dir)); unset($_tmp_dir); // Housekeeping. diff --git a/zencache/includes/translations/zencache.pot b/zencache/includes/translations/zencache.pot index 5926a58..f76ef9a 100644 --- a/zencache/includes/translations/zencache.pot +++ b/zencache/includes/translations/zencache.pot @@ -2,9 +2,9 @@ # This file is distributed under the same license as the ZenCache package. msgid "" msgstr "" -"Project-Id-Version: ZenCache 150314\n" +"Project-Id-Version: ZenCache 150409\n" "Report-Msgid-Bugs-To: http://wordpress.org/tag/zencache\n" -"POT-Creation-Date: 2015-03-15 00:20:02+00:00\n" +"POT-Creation-Date: 2015-04-09 23:12:44+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -14,139 +14,139 @@ msgstr "" #. translators: This string is actually NOT translatable because the `__()` #. function is not available at this point in the processing. -#: includes/advanced-cache.tpl.php:725 +#: includes/advanced-cache.tpl.php:726 msgid "%1$s fully functional :-) Cache file served for (%2$s) in %3$s seconds, on: %4$s." msgstr "" -#: includes/advanced-cache.tpl.php:857 +#: includes/advanced-cache.tpl.php:858 msgid "Unexpected OB phase: `%1$s`." msgstr "" -#: includes/advanced-cache.tpl.php:929 +#: includes/advanced-cache.tpl.php:930 msgid "Cache directory not writable. %1$s needs this directory please: `%2$s`. Set permissions to `755` or higher; `777` might be needed in some cases." msgstr "" -#: includes/advanced-cache.tpl.php:936 includes/advanced-cache.tpl.php:959 +#: includes/advanced-cache.tpl.php:937 includes/advanced-cache.tpl.php:960 msgid "Unable to create symlink: `%1$s` » `%2$s`. Possible permissions issue (or race condition), please check your cache directory: `%3$s`." msgstr "" -#: includes/advanced-cache.tpl.php:947 +#: includes/advanced-cache.tpl.php:948 msgid "%1$s file path: %2$s" msgstr "" -#: includes/advanced-cache.tpl.php:948 +#: includes/advanced-cache.tpl.php:949 msgid "%1$s file built for (%2$s) in %3$s seconds, on: %4$s." msgstr "" -#: includes/advanced-cache.tpl.php:950 +#: includes/advanced-cache.tpl.php:951 msgid "This %1$s file will auto-expire (and be rebuilt) on: %2$s (based on your configured expiration time)." msgstr "" -#: includes/advanced-cache.tpl.php:974 +#: includes/advanced-cache.tpl.php:975 msgid "%1$s: failed to write cache file for: `%2$s`; possible permissions issue (or race condition), please check your cache directory: `%3$s`." msgstr "" -#: includes/advanced-cache.tpl.php:1020 +#: includes/advanced-cache.tpl.php:1021 msgid "because `PHP_SAPI` reports that you are currently running from the command line." msgstr "" -#: includes/advanced-cache.tpl.php:1024 +#: includes/advanced-cache.tpl.php:1025 msgid "because `$_GET['zcAC']` is set to a boolean-ish FALSE value." msgstr "" -#: includes/advanced-cache.tpl.php:1028 +#: includes/advanced-cache.tpl.php:1029 msgid "because `$_SERVER['HTTP_HOST']` is missing from your server configuration." msgstr "" -#: includes/advanced-cache.tpl.php:1032 +#: includes/advanced-cache.tpl.php:1033 msgid "because `$_SERVER['REQUEST_URI']` is missing from your server configuration." msgstr "" -#: includes/advanced-cache.tpl.php:1036 +#: includes/advanced-cache.tpl.php:1037 msgid "because the PHP constant `ZENCACHE_ALLOWED` has been set to a boolean-ish `FALSE` value at runtime. Perhaps by WordPress itself, or by one of your themes/plugins. This usually means that you have a theme/plugin intentionally disabling the cache on this page; and it's usually for a very good reason." msgstr "" -#: includes/advanced-cache.tpl.php:1040 +#: includes/advanced-cache.tpl.php:1041 msgid "because the environment variable `$_SERVER['ZENCACHE_ALLOWED']` has been set to a boolean-ish `FALSE` value at runtime. Perhaps by WordPress itself, or by one of your themes/plugins. This usually means that you have a theme/plugin intentionally disabling the cache on this page; and it's usually for a very good reason." msgstr "" -#: includes/advanced-cache.tpl.php:1044 +#: includes/advanced-cache.tpl.php:1045 msgid "because the PHP constant `DONOTCACHEPAGE` has been set at runtime. Perhaps by WordPress itself, or by one of your themes/plugins. This usually means that you have a theme/plugin intentionally disabling the cache on this page; and it's usually for a very good reason." msgstr "" -#: includes/advanced-cache.tpl.php:1048 +#: includes/advanced-cache.tpl.php:1049 msgid "because the environment variable `$_SERVER['DONOTCACHEPAGE']` has been set at runtime. Perhaps by WordPress itself, or by one of your themes/plugins. This usually means that you have a theme/plugin intentionally disabling the cache on this page; and it's usually for a very good reason." msgstr "" -#: includes/advanced-cache.tpl.php:1052 +#: includes/advanced-cache.tpl.php:1053 msgid "because `$_SERVER['REQUEST_METHOD']` is `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `TRACE` or `CONNECT`. These request methods should never (ever) be cached in any way." msgstr "" -#: includes/advanced-cache.tpl.php:1056 -msgid "because `$_SERVER['REMOTE_ADDR']` === `$_SERVER['SERVER_ADDR']`; i.e. a self-serve request. DEVELOPER TIP: if you are testing on a localhost installation, please add `define('LOCALHOST', TRUE);` to your `/wp-config.php` file while you run tests :-) Remove it (or set it to a `FALSE` value) once you go live on the web." +#: includes/advanced-cache.tpl.php:1057 +msgid "because `[current IP address]` === `$_SERVER['SERVER_ADDR']`; i.e. a self-serve request. DEVELOPER TIP: if you are testing on a localhost installation, please add `define('LOCALHOST', TRUE);` to your `/wp-config.php` file while you run tests :-) Remove it (or set it to a `FALSE` value) once you go live on the web." msgstr "" -#: includes/advanced-cache.tpl.php:1060 +#: includes/advanced-cache.tpl.php:1061 msgid "because `$_SERVER['REQUEST_URI']` indicates this is a `/feed`; and the configuration of this site says not to cache XML-based feeds." msgstr "" -#: includes/advanced-cache.tpl.php:1064 +#: includes/advanced-cache.tpl.php:1065 msgid "because `$_SERVER['REQUEST_URI']` indicates this is a `wp-` or `xmlrpc` file; i.e. a WordPress systematic file. WordPress systematics are never (ever) cached in any way." msgstr "" -#: includes/advanced-cache.tpl.php:1068 +#: includes/advanced-cache.tpl.php:1069 msgid "because `$_SERVER['REQUEST_URI']` or the `is_admin()` function indicates this is an administrative area of the site." msgstr "" -#: includes/advanced-cache.tpl.php:1072 +#: includes/advanced-cache.tpl.php:1073 msgid "because `$_SERVER['REQUEST_URI']` indicates this is a Multisite Network; and this was a request for `/files/*`, not a page." msgstr "" -#: includes/advanced-cache.tpl.php:1077 +#: includes/advanced-cache.tpl.php:1078 msgid "because the current user visiting this page (usually YOU), appears to be logged-in. The current configuration says NOT to cache pages for logged-in visitors. This message may also appear if you have an active PHP session on this site, or if you've left (or replied to) a comment recently. If this message continues, please clear your cookies and try again." msgstr "" -#: includes/advanced-cache.tpl.php:1081 +#: includes/advanced-cache.tpl.php:1082 msgid "because `$_GET` contains query string data. The current configuration says NOT to cache GET requests with a query string." msgstr "" -#: includes/advanced-cache.tpl.php:1085 +#: includes/advanced-cache.tpl.php:1086 msgid "because the WordPress `is_404()` Conditional Tag says the current page is a 404 error. The current configuration says NOT to cache 404 errors." msgstr "" -#: includes/advanced-cache.tpl.php:1089 +#: includes/advanced-cache.tpl.php:1090 msgid "because a plugin running on this installation says this page is in Maintenance Mode; i.e. is not available publicly at this time." msgstr "" -#: includes/advanced-cache.tpl.php:1093 +#: includes/advanced-cache.tpl.php:1094 msgid "because %1$s is unable to cache already-compressed output. Please use `mod_deflate` w/ Apache; or use `zlib.output_compression` in your `php.ini` file. %1$s is NOT compatible with `ob_gzhandler()` and others like this." msgstr "" -#: includes/advanced-cache.tpl.php:1097 +#: includes/advanced-cache.tpl.php:1098 msgid "because the contents of this document contain ``, which indicates this is an auto-generated WordPress error message." msgstr "" -#: includes/advanced-cache.tpl.php:1101 +#: includes/advanced-cache.tpl.php:1102 msgid "because a `Content-Type:` header was set via PHP at runtime. The header contains a MIME type which is NOT a variation of HTML or XML. This header might have been set by your hosting company, by WordPress itself; or by one of your themes/plugins." msgstr "" -#: includes/advanced-cache.tpl.php:1105 +#: includes/advanced-cache.tpl.php:1106 msgid "because a `Status:` header (or an `HTTP/` header) was set via PHP at runtime. The header contains a non-`2xx` status code. This indicates the current page was not loaded successfully. This header might have been set by your hosting company, by WordPress itself; or by one of your themes/plugins." msgstr "" -#: includes/advanced-cache.tpl.php:1109 +#: includes/advanced-cache.tpl.php:1110 msgid "because the WordPress `is_404()` Conditional Tag says the current page is a 404 error; and this is the first time it's happened on this page. Your current configuration says that 404 errors SHOULD be cached, so %1$s built a cached symlink which points future requests for this location to your already-cached 404 error document. If you reload this page (assuming you don't clear the cache before you do so); you should get a cached version of your 404 error document. This message occurs ONCE for each new/unique 404 error request." msgstr "" -#: includes/advanced-cache.tpl.php:1113 +#: includes/advanced-cache.tpl.php:1114 msgid "because %1$s detected an early output buffer termination. This may happen when a theme/plugin ends, cleans, or flushes all output buffers before reaching the PHP shutdown phase. It's not always a bad thing. Sometimes it is necessary for a theme/plugin to do this. However, in this scenario it is NOT possible to cache the output; since %1$s is effectively disabled at runtime when this occurs." msgstr "" -#: includes/advanced-cache.tpl.php:1117 +#: includes/advanced-cache.tpl.php:1118 msgid "due to an unexpected behavior in the application. Please report this as a bug!" msgstr "" -#: includes/advanced-cache.tpl.php:1120 +#: includes/advanced-cache.tpl.php:1121 msgid "%1$s is NOT caching this page, %2$s" msgstr "" @@ -833,7 +833,7 @@ msgid "Yes, I want to compress HTML/CSS/JS for blazing fast speeds." msgstr "" #: includes/menu-pages.php:534 -msgid "Note: This is experimental. Please report issues here." +msgid "Note: This is experimental. Please report issues here." msgstr "" #: includes/menu-pages.php:537 @@ -1156,73 +1156,73 @@ msgstr "" msgid "Unable to determine cache directory location." msgstr "" -#: includes/share.php:1534 includes/share.php:1676 +#: includes/share.php:1611 includes/share.php:1753 msgid "The `options` property w/ a `cache_max_age` key is not defined in this class." msgstr "" -#: includes/share.php:1560 +#: includes/share.php:1637 msgid "Unable to delete files. Rename failure on directory: `%1$s`." msgstr "" -#: includes/share.php:1583 includes/share.php:1744 includes/share.php:1850 +#: includes/share.php:1660 includes/share.php:1821 includes/share.php:1927 msgid "Unable to delete symlink: `%1$s`." msgstr "" -#: includes/share.php:1595 includes/share.php:1756 includes/share.php:1858 +#: includes/share.php:1672 includes/share.php:1833 includes/share.php:1935 msgid "Unable to delete file: `%1$s`." msgstr "" -#: includes/share.php:1609 includes/share.php:1770 includes/share.php:1866 +#: includes/share.php:1686 includes/share.php:1847 includes/share.php:1943 msgid "Unable to delete dir: `%1$s`." msgstr "" -#: includes/share.php:1615 includes/share.php:1776 includes/share.php:1872 +#: includes/share.php:1692 includes/share.php:1853 includes/share.php:1949 msgid "Unexpected resource type: `%1$s`." msgstr "" -#: includes/share.php:1621 includes/share.php:1721 includes/share.php:1782 +#: includes/share.php:1698 includes/share.php:1798 includes/share.php:1859 msgid "Unable to delete files. Rename failure on tmp directory: `%1$s`." msgstr "" -#: includes/share.php:1836 includes/share.php:1878 +#: includes/share.php:1913 includes/share.php:1955 msgid "Unable to delete all files/dirs. Rename failure on tmp directory: `%1$s`." msgstr "" -#: includes/share.php:1883 +#: includes/share.php:1960 msgid "Unable to delete directory: `%1$s`." msgstr "" -#: includes/share.php:1918 +#: includes/share.php:1995 msgid "Unable to find the wp-config.php file." msgstr "" -#: includes/share.php:1934 +#: includes/share.php:2011 msgid "No writable tmp directory." msgstr "" -#: includes/share.php:1939 +#: includes/share.php:2016 msgid "Unable to obtain an exclusive lock." msgstr "" -#: includes/share.php:1992 +#: includes/share.php:2069 msgid "%1$s file" msgid_plural "%1$s files" msgstr[0] "" msgstr[1] "" -#: includes/share.php:2008 +#: includes/share.php:2085 msgid "%1$s directory" msgid_plural "%1$s directories" msgstr[0] "" msgstr[1] "" -#: includes/share.php:2024 +#: includes/share.php:2101 msgid "%1$s file/directory" msgid_plural "%1$s files/directories" msgstr[0] "" msgstr[1] "" -#: includes/share.php:2057 +#: includes/share.php:2134 msgid "Invalid hook." msgstr "" @@ -1250,91 +1250,130 @@ msgstr "" msgid "Woohoo! %1$s activated. :-)" msgstr "" -#: zencache.inc.php:369 +#: submodules/wp-php-rv/wp-php-rv.php:124 +msgid "extension" +msgid_plural "extensions" +msgstr[0] "" +msgstr[1] "" + +#: submodules/wp-php-rv/wp-php-rv.php:132 +msgid "%1$s is NOT active. It requires PHP v%2$s+." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:133 +msgid "↳ You're currently running an older copy of PHP v%1$s." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:136 +msgid "↳ You are also missing the following required PHP %1$s: %2$s." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:138 +#: submodules/wp-php-rv/wp-php-rv.php:146 +msgid "A simple update is necessary. Please ask your hosting company to help resolve this quickly." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:139 +msgid "To remove this message, please upgrade PHP. Or, remove %1$s from WordPress." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:144 +msgid "%1$s is NOT active. PHP %2$s missing." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:145 +msgid "↳ You are missing the following required PHP %1$s: %2$s." +msgstr "" + +#: submodules/wp-php-rv/wp-php-rv.php:147 +msgid "To remove this message, please install the required PHP %1$s. Or, remove %2$s from WordPress." +msgstr "" + +#: zencache.inc.php:382 msgid "%1$s: detected a new version of itself. Recompiling w/ latest version... wiping the cache... all done :-)" msgstr "" -#: zencache.inc.php:565 +#: zencache.inc.php:578 msgid "Settings" msgstr "" -#: zencache.inc.php:566 +#: zencache.inc.php:579 msgid "Preview Pro Features" msgstr "" -#: zencache.inc.php:567 +#: zencache.inc.php:580 msgid "Upgrade" msgstr "" -#: zencache.inc.php:613 zencache.inc.php:690 +#: zencache.inc.php:676 zencache.inc.php:753 msgid "dismiss ×" msgstr "" -#: zencache.inc.php:748 +#: zencache.inc.php:811 msgid "Every 15 Minutes" msgstr "" -#: zencache.inc.php:875 +#: zencache.inc.php:938 msgid "%1$s: detected significant changes. Found %2$s in the cache; auto-wiping." msgstr "" -#: zencache.inc.php:919 +#: zencache.inc.php:982 msgid "%1$s: detected important site changes. Found %2$s in the cache for this site; auto-clearing." msgstr "" -#: zencache.inc.php:998 +#: zencache.inc.php:1063 msgid "Post" msgstr "" -#: zencache.inc.php:1006 +#: zencache.inc.php:1071 msgid "%1$s: detected changes. Found %2$s in the cache for %3$s ID: %4$s; auto-clearing." msgstr "" -#: zencache.inc.php:1169 +#: zencache.inc.php:1245 msgid "%1$s: detected changes. Found %2$s in the cache, for XML feeds of type: %3$s; auto-clearing." msgstr "" -#: zencache.inc.php:1212 +#: zencache.inc.php:1288 msgid "%1$s: detected changes. Found %2$s in the cache for XML sitemaps; auto-clearing." msgstr "" -#: zencache.inc.php:1255 +#: zencache.inc.php:1331 msgid "%1$s: detected changes. Found %2$s in the cache for the designated \"Home Page\"; auto-clearing." msgstr "" -#: zencache.inc.php:1313 +#: zencache.inc.php:1389 msgid "%1$s: detected changes. Found %2$s in the cache for the designated \"Posts Page\"; auto-clearing." msgstr "" -#: zencache.inc.php:1368 +#: zencache.inc.php:1444 msgid "Untitled" msgstr "" -#: zencache.inc.php:1379 +#: zencache.inc.php:1455 msgid "%1$s: detected changes. Found %2$s in the cache for Custom Post Type: %3$s; auto-clearing." msgstr "" -#: zencache.inc.php:1469 +#: zencache.inc.php:1545 msgid "%1$s: detected changes. Found %2$s in the cache for Author Page: %3$s; auto-clearing." msgstr "" -#: zencache.inc.php:1621 +#: zencache.inc.php:1697 msgid "%1$s: detected changes. Found %2$s in the cache for %3$s: %4$s; auto-clearing." msgstr "" -#: zencache.inc.php:1910 zencache.inc.php:1938 +#: zencache.inc.php:1986 zencache.inc.php:2014 msgid "Doing it wrong! Missing `base_dir` option value. MUST call this method after `setup()`." msgstr "" -#: zencache.inc.php:2371 +#: zencache.inc.php:2453 msgid "Lite" msgstr "" -#: zencache.inc.php:2372 +#: zencache.inc.php:2454 msgid "Pro" msgstr "" -#: zencache.inc.php:2378 +#: zencache.inc.php:2460 msgid "%1$s is NOT running. A conflicting plugin, %2$s, is currently active. Please deactivate the %2$s plugin to clear this message." msgstr "" @@ -1343,17 +1382,17 @@ msgid "ZenCache" msgstr "" #. Plugin URI of the plugin/theme -msgid "http://www.websharks-inc.com/product/zencache/" +msgid "http://zencache.com/" msgstr "" #. Description of the plugin/theme -msgid "WordPress advanced cache plugin; speed without compromise!" +msgid "ZenCache is an advanced WordPress caching plugin inspired by simplicity. Speed up your site (BIG time!) with a reliable and fast WordPress cache." msgstr "" #. Author of the plugin/theme -msgid "s2Member® / WebSharks, Inc." +msgid "WebSharks, Inc." msgstr "" #. Author URI of the plugin/theme -msgid "http://www.s2member.com" +msgid "http://www.websharks-inc.com/" msgstr "" diff --git a/zencache/readme.txt b/zencache/readme.txt index 057a784..0b7df08 100644 --- a/zencache/readme.txt +++ b/zencache/readme.txt @@ -1,6 +1,6 @@ === ZenCache === -Stable tag: 150314 +Stable tag: 150409 Requires at least: 3.7 Tested up to: 4.1.1 Text Domain: zencache @@ -296,7 +296,7 @@ Also, to stay updated with the latest version of ZenCache Pro, be sure to also c In addition to the [WordPress Requirements](http://wordpress.org/about/requirements/), ZenCache requires the following minimum versions: -- PHP 5.3+ +- PHP 5.3.2+ - Apache 2.1+ == License == @@ -324,10 +324,26 @@ Released under the terms of the [GNU General Public License](http://www.gnu.org/ = v140104 = -Requires PHP v5.3+. The latest version of ZenCache is a complete rewrite (OOP design). Faster! and even more dependable. NOTE: the free version of Quick Cache (this new LITE version); while it remains fully functional and is more-than-adequate for most sites; is now limited in some ways. The following advanced features from the previous release are no longer available in the lite version: a custom MD5 Version Salt, custom Exclusion Patterns, a Clear Cache button in admin bar. These, and other features; are now available only in the pro version of the plugin. For further details, please see: . +Requires PHP v5.3.2+. The latest version of ZenCache is a complete rewrite (OOP design). Faster! and even more dependable. NOTE: the free version of Quick Cache (this new LITE version); while it remains fully functional and is more-than-adequate for most sites; is now limited in some ways. The following advanced features from the previous release are no longer available in the lite version: a custom MD5 Version Salt, custom Exclusion Patterns, a Clear Cache button in admin bar. These, and other features; are now available only in the pro version of the plugin. For further details, please see: . == Changelog == += v150409 = + +- **Enhancement (includes improved CloudFlare support)**: Improvements to IP address detection, including added support for CloudFlare IP forwarding, multiple IPs in a single header, and the ability to customize the lookup order and/or add/remove sources that are searched when looking for the current IP address. It's also possible to revert to the old IP address detection behavior (see [How do I customize remote IP detection?](http://zencache.com/kb-article/how-do-i-customize-ip-address-detection/)). Props @jaswsinc. [Issue #449](https://github.com/websharks/zencache/pull/449) +- **Enhancement** (Pro): Files being served by the HTML Compressor were being sent without a `Vary: Accept-Encoding` header, which caused some page speed testing services to give a lower rating to sites using ZenCache. ZenCache now ensures this header is sent via an `.htaccess` file inside the HTML Compressor cache directory (requires Apache 2.1+). Props @jaswsinc. [Issue #436](https://github.com/websharks/zencache/issues/436). +- **Enhancement** (Pro): Static CDN Filters now also filter any static resources inside Text Widgets, so that those resources can be cached by your CDN. Props @jaswsinc. [Issue #430](https://github.com/websharks/zencache/issues/430) +- **Enhancement** (Pro): Static CDN Filters now apply to minified and compressed CSS/JS files generated by the HTML Compressor; these files will now be cached by your CDN. Props @jaswsinc. [Issue #429](https://github.com/websharks/zencache/issues/429) +- **Bug Fix**: Fixed a bug related to the Quick Cache migration that resulted in caching being disabled despite ZenCache being enabled. Uninstalling Quick Cache was removing `define('WP_CACHE', TRUE);` from the `wp-config.php` file. ZenCache now makes sure that caching remains enabled after uninstalling Quick Cache during the ZenCache migration process. [Issue #450](https://github.com/websharks/zencache/issues/450). +- **Bug Fix**: Fixed a minor UI issue where the ZenCache Dashboard icon would occasionally flash to a black color when refreshing the Dashboard. Props @jaswsinc. [Issue #453](https://github.com/websharks/zencache/issues/453). +- **Bug Fix**: When ZenCache was running on an installation of PHP with `open_basedir` restrictions applied, calls to `is_dir()` were triggering a PHP Warning while looking for a writable temporary directory. This bug has been fixed. [Issue #456](https://github.com/websharks/zencache/issues/456). +- **Bug Fix**: Fixed a bug where changing the permalink for a published post would result in the cache file for the old permalink being left behind and as a result both the old and the new permalink would be accessible, instead of WordPress redirecting the old permalink to the new one. This has been fixed and ZenCache now properly clears the old cache file when changing the permalink on a published post. [Issue #359](https://github.com/websharks/zencache/issues/359). +- **Bug Fix**: Fixed a bug where transitioning a Published post back to Pending or Draft would not automatically clear the cache file. This resulted in the post remaining accessible on the frontend despite being set as Pending or Draft. ZenCache now properly clears the cache file automatically when transitioning from Published to Pending or Draft, which prevents access to the post as expected. [Issue #441](https://github.com/websharks/zencache/issues/441). +- **Bug Fix** (Pro): Some users reported seeing `Warning: trim() expects parameter 1 to be string`. This was produced by a low-impact bug that has been fixed in this release. [Issue #455](https://github.com/websharks/zencache/issues/455). +- **Bug Fix** (Pro): Some users running the HTML Compressor reported seeing 403 Forbidden errors related to loading the compressed/minified files. This was a permissions-related issue that has been resolved in this release. Props @superian and @jaswsinc. See [Issue #50](https://github.com/websharks/html-compressor/issues/50). +- **Bug Fix** (Pro): Some HTTP requests made by the HTML Compressor to servers configured to reject HTTP requests that don't include a User-Agent were failing. A User-Agent is now always used in all requests. Props @jaswsinc. See [Issue #49](https://github.com/websharks/html-compressor/issues/49). +- **Minimum Required PHP Version Bumped to PHP v5.3.2+:** The minimum PHP version required for ZenCache has been bumped up to PHP v5.3.2+ (from PHP v5.3+). The ZenCache cache locking mechanism, specifically the use of `flock()`, requires behavior introduced in PHP v5.3.2. [Issue #444](https://github.com/websharks/zencache/issues/444). + = v150314 = - **Bug Fix**: Fixed a bug in the Quick Cache back compat. method `\zencache\share\apply_wp_filters()`. It was not passing the ZenCache-filtered value through the Quick Cache back compat. routine. This bug affected sites that had disabled automatic cache clearing routines via a filter. @@ -403,66 +419,4 @@ ZenCache is an evolution of Quick Cache. It comes with a completely refactored c - **Bug Fix (Pro)**: Fixed a bug with the HTML Compressor where `style`, `link` and/or `script` tags could end up out of order in certain scenarios. See [#45](https://github.com/websharks/html-compressor/issues/45). - **Bug Fix (Pro)**: Fixed a bug in the HTML Compressor related to JavaScript compression routines. See [#38](https://github.com/websharks/html-compressor/issues/38). -= v140829 = - -- **SECURITY FIX - Please upgrade immediately**: Fixes a security related to cached cookies sent in the header of a request. This only affects sites running plugins that might send cookie data via the header. See [#253](https://github.com/websharks/quick-cache/issues/253) -- **Enhancement**: Auto-Purge RSS Feeds. Quick Cache will now automatically purge the cache for RSS/RDF/Atom Feeds when Feed Caching is enabled. This new option will purge the cache for the master feed, the master comments feed, feeds associated with comments on a Post/Page, term-related feeds (including mixed term-related feeds), and author-related feeds when you update a Post/Page, approve a Comment, or make other changes where Quick Cache can detect that certain types of Feeds should be purged. See [#182](https://github.com/websharks/quick-cache/issues/182) -- **Enhancement**: Improve handling of symlink creation for 404 cache files by using atomic symlink creation to decrease the possibility of encountering a race condition. See [#242](https://github.com/websharks/quick-cache/issues/242). -- **Enhancement**: Improved portability of `advanced-cache.php`. This will help reduce configuration overhead for site owners when migrating a WordPress installation from one server to another. See [#258](https://github.com/websharks/quick-cache/issues/258). -- **Enhancement**: Option Panels now have proper HTML anchor tags so that they work better with browser extensions that rely on anchor tags being available. See [#260.](https://github.com/websharks/quick-cache/issues/260) -- **Enhancement**: The Plugin Deactivation Safeguards option has been renamed to Plugin Deletion Safeguards. When Plugin Deletion Safeguards are disabled, deactivating and deleting the plugin will now erase your options for the plugin, erase directories/files created by the plugin, remove the advanced-cache.php file, terminate CRON jobs, etc. It completely erases itself, but only when you disable Plugin Deletion Safeguards (enabled by default to prevent accidental loss of data). See [#261](https://github.com/websharks/quick-cache/issues/261). -- **Enhancement (Pro)**: HTML Compressor now includes FOPEN as transport layer fallback in case cURL is not available. See [#15](https://github.com/websharks/html-compressor/issues/15) -- **Enhancement (Pro)**: HTML Compressor now writes files atomically; this will help avoid race conditions when writing cache files. See [#273](https://github.com/websharks/quick-cache/issues/273) -- **Enhancement (Pro)**: Improved error handling for the Auto-Cache Engine. There were some scenarios where `XMLReader()` would fail with a PHP Warning notice when it was unable to properly parse the sitemap. See [#250](https://github.com/websharks/quick-cache/issues/250). -- **Bug Fix**: The cache directory is now properly removed when deleting the plugin from the WordPress Dashboard plugins list. See [#261](https://github.com/websharks/quick-cache/issues/261). -- **Bug Fix**: WooCommerce compatibility fix for a bug where cart session data appeared to get cached across sessions. See [#253](https://github.com/websharks/quick-cache/issues/253) -- **Bug Fix (Pro)**: The plugin upgrade notice no longer appears on Child Blogs in a Multisite Network. There was no security risk here; while the upgrade notice was shown, Child Blog admins who did not have permission to upgrade Network-activated plugins were unable to do anything with the message. See [#259](https://github.com/websharks/quick-cache/issues/259). -- **Bug Fix (Pro)**: Fixed a bug where, in certain scenarios, a WordPress Plugin may break the JavaScript that controls the Clear Cache button on the Dashboard. See [#272](https://github.com/websharks/quick-cache/issues/259). -- **Bug Fix (Pro)**: CSS files are now excluded from compression by the HTML Compressor when included inside conditional comments. See [#35](https://github.com/websharks/html-compressor/issues/35) -- **Bug Fix (Pro)**: HTML Compressor now preserves whitespace inside CSS `calc()` statements. See [#286](https://github.com/websharks/quick-cache/issues/286). - -= v140725 = - -- **Enhancement**: Improved overall performance by optimizing the auto-purge routines. See also: [#130](https://github.com/websharks/quick-cache/issues/130) -- **Enhancement**: The "GET Requests" UI Panel now explains that you can use `?qcAC=0` to disable caching when you ARE caching GET Requests. See also: [#210](https://github.com/websharks/quick-cache/issues/210). -- **New Pro Feature: Auto-Purge XML Sitemaps**. If you're generating XML Sitemaps with a plugin like Google XML Sitemaps, you can now tell Quick Cache to automatically purge any cached sitemap files whenever it purges a Post/Page cache. You may also specify a list of XML Sitemap patterns to clear, if you have multiple sitemap files. See also: [#169](https://github.com/websharks/quick-cache/issues/169) -- **Enhancement (Pro)**: The Quick Cache Pro Updater now accepts a License Key in place of the WebSharks password. -- **Enhancement (Pro)**: In a Multisite Network, the Auto-Cache Engine will now also auto-cache each child blog. See also: [#169](https://github.com/websharks/quick-cache/issues/169) -- **Bug Fix**: Fixed a bug that was causing unapproved, spam, and trash comments to unnecessarily purge the cache. See also: [#159](https://github.com/websharks/quick-cache/issues/159) -- **Bug Fix**: A custom `WP_CONTENT_DIR` is now obeyed in the scenario where it's set to a path outside of `ABSPATH`. See also: [#95](https://github.com/websharks/quick-cache/issues/95) -- **Bug Fix**: The UI now correctly displays custom `WP_CONTENT_DIR` in the "Directory/Expiration Time" options panel. See also: [#206](https://github.com/websharks/quick-cache/issues/206) -- **Bug Fix**: Quick Cache LITE now correctly sets the `QUICK_CACHE_PRO` constant to false. See also: [#229](https://github.com/websharks/quick-cache/issues/229) -- **Bug Fix**: Workaround for broken page navigation on the front page of some sites. This is a WordPress `redirect_canonical()` bug workaround. See also: [#209](https://github.com/websharks/quick-cache/issues/209) -- **Bug Fix (Pro)**: 404 Caching now properly returns a 404 HTTP Status code when serving a cached 404 page. See also: [#197](https://github.com/websharks/quick-cache/issues/197) -- **Bug Fix (Pro)**: The HTML Compressor now properly preserves `[]` character whitespace during CSS compression. See also: [#25](https://github.com/websharks/html-compressor/issues/25) -- **Bug Fix (Pro)**: The Pro Updater upgrade link now points to the correction location when displayed from a Child Blog in a Multisite Network. See also: [#205](https://github.com/websharks/quick-cache/issues/205) -- **Bug Fix (Pro)**: The Auto-Cache Engine now correctly handles the sitemap when `home_url()` differs from `site_url()`. -- **Bug Fix (Pro)**: The "Dynamic Version Salt" options panel now correctly displays the last saved value. See also: [#231](https://github.com/websharks/quick-cache/issues/231) - -= v140605 = - -- **New Feature**: Branched Cache Structure. Cache files are now written to the cache directory using a more intuitive format of `PROTOCOL`/`HOSTNAME`/`PERMALINK` (e.g., `http/example-com/sample-page.html`). For more details, please see -- **New Feature**: 404 Page caching. It's now possible to enable/disable the caching of 404 requests. Enabling this feature generates a single cache file for your 404 Page and then symlinks future 404 requests to that cache file. See *Dashboard -> Quick Cache -> Plugin Options -> 404 Requests*. -- **New Feature (Pro)**: HTML Compressor (experimental). This new experimental feature automatically combines and compresses CSS/JS/HTML code. See *Dashboard -> Quick Cache -> Plugin Options -> HTML Compressor*. For more details about how this feature works, please see -- **New Feature (Pro)**: Auto-Cache Engine. When enabled, the Auto-Cache Engine will pre-cache your site at 15-minute intervals, rebuilding cache files when necessary (it will not rebuild cache files until they have expired). This helps eliminate the slowness a user may experience when visiting a page on your site that has not yet been cached. See *Dashboard -> Quick Cache -> Plugin Options -> Auto-Cache Engine*. -- **New Feature**: Auto-Purge "Author Page". When a single Post/Page is changed in some way, Quick Cache can also purge any existing cache files for the associated Author Page. See *Dashboard -> Quick Cache -> Plugin Options -> Clearing the Cache*. (This option is enabled by default; disabling this requires Quick Cache Pro.) -- **New Feature**: Auto-Purge "Category Archives". When a single Post/Page is changed in some way, Quick Cache can also purge any existing cache files for the associated Category archive views. See *Dashboard -> Quick Cache -> Plugin Options -> Clearing the Cache*. (This option is enabled by default; disabling this requires Quick Cache Pro.) -- **New Feature**: Auto-Purge "Tag Archives". When a single Post/Page is changed in some way, Quick Cache can also purge any existing cache files for the associated Tag archive views. See *Dashboard -> Quick Cache -> Plugin Options -> Clearing the Cache*. (This option is enabled by default; disabling this requires Quick Cache Pro.) -- **New Feature**: Auto-Purge "Custom Term Archives". When a single Post/Page is changed in some way, Quick Cache can also purge any custom Terms that may have their own Term archive views. See *Dashboard -> Quick Cache -> Plugin Options -> Clearing the Cache*. (This option is enabled by default; disabling this requires Quick Cache Pro.) -- **Enhancement**: Improved conflict handling of other plugins using `ob_start()`. See -- **Enhancement**: Added a postload filter for `status_header` so that Quick Cache can properly detect calls to the WP core function `status_header()` -- **Enhancement**: The Quick Cache cache directory has been changed to `wp-content/cache/quick-cache/` to provide better organization of cache files and avoid interfering with another plugin that may also be writing to the `wp-content/cache/` directory. See -- **Enhancement**: New detailed debugging notes (see *Dashboard -> Quick Cache -> Plugin Options -> Enable/Disable*). There is now an extra option to show detailed debugging information in addition to the Quick Cache notes in the HTML source. For now, this feature only applies when the HTML Compressor is enabled. -- **Enhancement**: Better Debugging Notices. If Quick Cache is not caching a particular page (such as when a logged-in user visits the site and logged-in user caching is not enabled), Quick Cache will now report why that page is not being cached in the HTML notes. -- **Enhancement**: Improved compatibility with the Nav Menu Roles plugin. See -- **Bug Fix**: Obey custom content directories. If you have customized your `WP_CONTENT_DIR` and `WP_CONTENT_URL` constants to point somewhere other than the default, Quick Cache will now obey those and use your custom directory for storing cache files. See -- **Bug Fix**: Scheduled posts now trigger the clearing of any associated archive views when those posts go live (assuming you have those archive views set to Auto-Purge in *Dashboard -> Quick Cache -> Plugin Options -> Clearing the Cache*). See -- **Bug Fix**: Fixed a bug where saving a post as `draft` would trigger the Auto-Purge Post routine and clear the cache for that post. Now only purges post status `publish` and `private` and when transitioning from `publish` or `private` post status to `draft`, `future`, or `private`. See -- **Bug Fix**: Split/paginated comments and multi-page Posts/Page cache files are now purged properly when the post cache is purged. See - -= v140104 = - -* **New Options for Feed Caching**. It's now possible to control RSS, RDF, and Atom Feed caching. The new default is for feed caching to be disabled, which resolves an issue where new posts don't show up in the feed until the cache is cleared. This version of Quick Cache disables feed caching to prevent this from happening. If you wish to cache feeds, you can enable feed caching in the options. See: -* **New Automatic Updater for Quick Cache Pro**. Quick Cache Pro now includes an automatic updater which lets you to keep Quick Cache Pro updated right from within your WordPress Dashboard. To upgrade to a new version of Quick Cache Pro using the Automatic Updater, simply fill in your WebSharks-Inc.com credentials in the new Plugin Updater sub-panel (**Quick Cache Pro -› Plugin Updater**). See: - For older Changelog entries, please see the `CHANGELOG` file. \ No newline at end of file diff --git a/zencache/uninstall.php b/zencache/uninstall.php index 5287135..44c7436 100644 --- a/zencache/uninstall.php +++ b/zencache/uninstall.php @@ -10,6 +10,6 @@ if(!defined('WPINC')) // MUST have WordPress. exit('Do NOT access this file directly: '.basename(__FILE__)); -$GLOBALS['wp_php_rv'] = '5.3'; // Require PHP v5.3+. +$GLOBALS['wp_php_rv'] = '5.3.2'; // Require PHP v5.3.2+. if(require(dirname(__FILE__).'/submodules/wp-php-rv/wp-php-rv.php')) require_once dirname(__FILE__).'/uninstall.inc.php'; \ No newline at end of file diff --git a/zencache/zencache.inc.php b/zencache/zencache.inc.php index 734764e..a9ad4f3 100644 --- a/zencache/zencache.inc.php +++ b/zencache/zencache.inc.php @@ -102,6 +102,19 @@ class plugin extends share */ public $cache = array(); + /** + * Used for temporarily storing the permalink for posts transitioning from + * `publish` or `private` post status to `pending` or `draft` post status. + * + * @since 150409 + * + * @var array An associative array with the Post ID as the named key containing the post permalink before the post has been transitioned + * + * @see auto_clear_post_cache() + * @see auto_clear_post_cache_transition() + */ + protected $pre_post_update_post_permalink = array(); + /** * Used by the plugin's uninstall handler. * @@ -263,7 +276,7 @@ public function setup() add_action('delete_post', array($this, 'auto_clear_post_cache')); add_action('clean_post_cache', array($this, 'auto_clear_post_cache')); add_action('post_updated', array($this, 'auto_clear_author_page_cache'), 10, 3); - add_action('transition_post_status', array($this, 'auto_clear_post_cache_transition'), 10, 3); + add_action('pre_post_update', array($this, 'auto_clear_post_cache_transition'), 10, 2); add_action('added_term_relationship', array($this, 'auto_clear_post_terms_cache'), 10, 1); add_action('delete_term_relationships', array($this, 'auto_clear_post_terms_cache'), 10, 1); @@ -526,8 +539,8 @@ public function enqueue_admin_scripts() */ public function add_network_menu_pages() { - $icon = 'data:image/svg+xml;base64,'. // Base64-encoded inline SVG icon. - base64_encode(file_get_contents(dirname(__FILE__).'/client-s/images/inline-icon.svg')); + $icon = file_get_contents(dirname(__FILE__).'/client-s/images/inline-icon.svg'); + $icon = 'data:image/svg+xml;base64,'.base64_encode($this->color_svg_menu_icon($icon)); add_menu_page($this->name, $this->name, $this->network_cap, __NAMESPACE__, array($this, 'menu_page_options'), $icon); } @@ -543,8 +556,8 @@ public function add_menu_pages() { if(is_multisite()) return; // Multisite networks MUST use network admin area. - $icon = 'data:image/svg+xml;base64,'. // Base64-encoded inline SVG icon. - base64_encode(file_get_contents(dirname(__FILE__).'/client-s/images/inline-icon.svg')); + $icon = file_get_contents(dirname(__FILE__).'/client-s/images/inline-icon.svg'); + $icon = 'data:image/svg+xml;base64,'.base64_encode($this->color_svg_menu_icon($icon)); add_menu_page($this->name, $this->name, $this->cap, __NAMESPACE__, array($this, 'menu_page_options'), $icon); } @@ -569,6 +582,56 @@ public function add_settings_link($links) return $this->apply_wp_filters(__METHOD__, $links, get_defined_vars()); } + /** + * Fills menu page inline SVG icon color. + * + * @since 150409 Fixing bug in SVG icons. + * + * @param string $svg Inline SVG icon markup. + * + * @return string Inline SVG icon markup. + */ + public function color_svg_menu_icon($svg) + { + if(!($color = get_user_option('admin_color'))) + $color = 'fresh'; // Default color scheme. + + if(empty($this->wp_admin_icon_colors[$color])) + return $svg; // Not possible. + + $icon_colors = $this->wp_admin_icon_colors[$color]; + $use_icon_fill_color = $icon_colors['base']; // Default base. + + $current_pagenow = !empty($GLOBALS['pagenow']) ? $GLOBALS['pagenow'] : ''; + $current_page = !empty($_REQUEST['page']) ? $_REQUEST['page'] : ''; + + if(strpos($current_pagenow, __NAMESPACE__) === 0 || strpos($current_page, __NAMESPACE__) === 0) + $use_icon_fill_color = $icon_colors['current']; + + return str_replace(' fill="currentColor"', ' fill="'.esc_attr($use_icon_fill_color).'"', $svg); + } + + /** + * WordPress admin icon color schemes. + * + * @since 150409 Fixing bug in SVG icons. + * + * @var 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`. + */ + public $wp_admin_icon_colors = array( + 'fresh' => array('base' => '#999999', 'focus' => '#2EA2CC', 'current' => '#FFFFFF'), + 'light' => array('base' => '#999999', 'focus' => '#CCCCCC', 'current' => '#CCCCCC'), + 'blue' => array('base' => '#E5F8FF', 'focus' => '#FFFFFF', 'current' => '#FFFFFF'), + 'midnight' => array('base' => '#F1F2F3', 'focus' => '#FFFFFF', 'current' => '#FFFFFF'), + 'sunrise' => array('base' => '#F3F1F1', 'focus' => '#FFFFFF', 'current' => '#FFFFFF'), + 'ectoplasm' => array('base' => '#ECE6F6', 'focus' => '#FFFFFF', 'current' => '#FFFFFF'), + 'ocean' => array('base' => '#F2FCFF', 'focus' => '#FFFFFF', 'current' => '#FFFFFF'), + 'coffee' => array('base' => '#F3F2F1', 'focus' => '#FFFFFF', 'current' => '#FFFFFF'), + ); + /** * Loads the admin menu page options. * @@ -972,7 +1035,9 @@ public function auto_clear_post_cache($post_id, $force = FALSE) if(!is_dir($cache_dir = $this->cache_dir())) return $counter; // Nothing to do. - if(!($permalink = get_permalink($post_id))) + if(!empty($this->pre_post_update_post_permalink[$post_id]) && ($permalink = $this->pre_post_update_post_permalink[$post_id])) + $this->pre_post_update_post_permalink[$post_id] = ''; // Reset; only used for post status transitions + elseif(!($permalink = get_permalink($post_id))) return $counter; // Nothing we can do. if(!($post_status = get_post_status($post_id))) @@ -1025,13 +1090,12 @@ public function auto_clear_post_cache($post_id, $force = FALSE) * Automatically clears cache files for a particular post when transitioning * from `publish` or `private` post status to `draft`, `future`, `private`, or `trash`. * - * @attaches-to `transition_post_status` hook. + * @attaches-to `pre_post_update` hook. * * @since 140605 First documented version. * - * @param string $new_status New post status. - * @param string $old_status Old post status. - * @param \WP_Post $post Post object. + * @param int $post_ID Post ID. + * @param array $data Array of unslashed post data. * * @return integer Total files cleared by this routine (if any). * @@ -1042,16 +1106,28 @@ public function auto_clear_post_cache($post_id, $force = FALSE) * * @see auto_clear_post_cache() */ - public function auto_clear_post_cache_transition($new_status, $old_status, \WP_Post $post) + public function auto_clear_post_cache_transition($post_ID, $data) { - $new_status = (string)$new_status; - $old_status = (string)$old_status; + $old_status = (string)get_post_status($post_ID); + $new_status = (string)$data['post_status']; + + /* + * When a post has a status of `pending` or `draft`, the `get_permalink()` function + * does not return a friendly permalink and therefore `auto_clear_post_cache()` will + * have no way of building a path to the cache file that should be cleared as part of + * this post status transition. To get around this, we temporarily store the permalink + * in $this->pre_post_update_post_permalink for `auto_clear_post_cache()` to use. + * + * See also: https://github.com/websharks/zencache/issues/441 + */ + if($old_status === 'publish' && in_array($data['post_status'], array('pending', 'draft', TRUE))) + $this->pre_post_update_post_permalink[$post_ID] = get_permalink($post_ID); $counter = 0; // Initialize. - if(isset($this->cache[__FUNCTION__][$new_status][$old_status][$post->ID])) + if(isset($this->cache[__FUNCTION__][$new_status][$old_status][$post_ID])) return $counter; // Already did this. - $this->cache[__FUNCTION__][$new_status][$old_status][$post->ID] = -1; + $this->cache[__FUNCTION__][$new_status][$old_status][$post_ID] = -1; if(!$this->options['enable']) return $counter; // Nothing to do. @@ -1059,8 +1135,8 @@ public function auto_clear_post_cache_transition($new_status, $old_status, \WP_P if($old_status !== 'publish' && $old_status !== 'private') return $counter; // Nothing to do. We MUST be transitioning FROM one of these statuses. - if($new_status === 'draft' || $new_status === 'future' || $new_status === 'private' || $new_status === 'trash') - $counter = $this->auto_clear_post_cache($post->ID, TRUE); + if(in_array($new_status, array('draft', 'future', 'pending', 'private', 'trash'), TRUE)) + $counter = $this->auto_clear_post_cache($post_ID, TRUE); return $this->apply_wp_filters(__METHOD__, $counter, get_defined_vars()); } @@ -2056,9 +2132,15 @@ public function check_advanced_cache() // Fixes zero-byte advanced-cache.php bug related to migrating from Quick Cache // See https://github.com/websharks/zencache/issues/432 + // Also fixes a missing define('WP_CACHE', TRUE) bug related to migrating from Quick Cache + // See https://github.com/websharks/zencache/issues/450 if(!is_file($cache_dir.'/zc-advanced-cache') || !is_file($advanced_cache_file) || filesize($advanced_cache_file) === 0 - ) $this->add_advanced_cache(); + ) + { + $this->add_advanced_cache(); + $this->add_wp_cache_to_wp_config(); + } } /** diff --git a/zencache/zencache.php b/zencache/zencache.php index b680ff3..42638e0 100644 --- a/zencache/zencache.php +++ b/zencache/zencache.php @@ -1,6 +1,6 @@