Skip to content

Commit

Permalink
Releasing ZenCache v160216-RC
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Feb 16, 2016
1 parent d833241 commit 531cc75
Show file tree
Hide file tree
Showing 17 changed files with 518 additions and 388 deletions.
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== ZenCache ===

Stable tag: 160120-RC
Stable tag: 160216-RC
Requires at least: 4.1
Tested up to: 4.5-alpha
Text Domain: zencache
Expand All @@ -10,7 +10,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html

Contributors: WebSharks, JasWSInc, raamdev
Donate link: http://websharks-inc.com/r/wp-theme-plugin-donation/
Tags: cache, quick cache, zencache, zen cache, quickcache, speed, performance, fast, loading, generation, execution, benchmark, benchmarking, debug, debugging, caching, cash, caching, cacheing, super cache, advanced cache, advanced-cache, wp-cache, wp cache, rocket, static, client-side cache, rss cache, feed cache, gzip compression, query string, get request, page cache, options panel included, w3c validated code, highly extensible
Tags: cache, speed, performance, fast, caching, advanced cache, wp cache, static, client-side cache, rss cache, feed cache, gzip compression, page cache

ZenCache is an advanced WordPress caching plugin inspired by simplicity. Speed up your site (BIG time!) with a reliable and fast WordPress cache.

Expand Down
Binary file modified src/client-s/images/options-lite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/includes/classes/MenuPageOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public function __construct()

echo '</div>'."\n";

echo '<div class="plugin-menu-page-notice warning"><p>'.sprintf(__('<strong>Important %1$s Announcement:</strong> %1$s is changing its name to <a href="https://cometcache.com/r/announcing-comet-cache-formerly-zencache/" target="_blank"><strong>Comet Cache</a></strong>! Learn more about this upcoming change <a href="https://cometcache.com/r/announcing-comet-cache-formerly-zencache/" target="_blank">here</a>.', 'zencache'), esc_html(NAME)).'</p></div>'."\n";

/* ----------------------------------------------------------------------------------------- */

echo '<hr />'."\n";
Expand Down Expand Up @@ -835,6 +837,11 @@ public function __construct()
echo ' <p>'.__('Sometimes there are special cases when a particular JS file should NOT be consolidated or compressed in any way. This is where you will enter those if you need to (one per line). Searches are performed against the <code>&lt;script src=&quot;&quot;&gt;</code> value, and also against the contents of any inline <code>&lt;script&gt;</code> tags (caSe insensitive). A wildcard <code>*</code> character can also be used when necessary; e.g., <code>xy*-framework</code> (where <code>*</code> = 0 or more characters that are NOT a slash <code>/</code>). Other special characters include: <code>**</code> = 0 or more characters of any kind, including <code>/</code> slashes; <code>^</code> = beginning of the string; <code>$</code> = end of the string. To learn more about this syntax, please see <a href ="http://zencache.com/r/watered-down-regex-syntax/" target="_blank">this KB article</a>.', 'zencache').'</p>'."\n";
echo ' <p><textarea name="'.esc_attr(GLOBAL_NS).'[saveOptions][htmlc_js_exclusions]" rows="5" spellcheck="false" class="monospace">'.format_to_edit($this->plugin->options['htmlc_js_exclusions']).'</textarea></p>'."\n";
echo ' <p class="info" style="display:block;">'.__('<strong>Note:</strong> please remember that your entries here should be formatted as a line-delimited list; e.g., one exclusion pattern per line.', 'zencache').'</p>'."\n";
echo ' <h3>'.__('URI Exclusions for HTML Compressor?', 'zencache').'</h3>'."\n";
echo ' <p>'.__('When you enable HTML Compression above, you may want to prevent certain pages on your site from being cached by the HTML Compressor. This is where you will enter those if you need to (one per line). Searches are performed against the <a href="https://gist.github.com/jaswsinc/338b6eb03a36c048c26f" target="_blank" style="text-decoration:none;"><code>REQUEST_URI</code></a>; i.e., <code>/path/?query</code> (caSe insensitive). So, don\'t put in full URLs here, just word fragments found in the file path (or query string) is all you need, excluding the http:// and domain name. A wildcard <code>*</code> character can also be used when necessary; e.g., <code>/category/abc-followed-by-*</code> (where <code>*</code> = 0 or more characters that are NOT a slash <code>/</code>). Other special characters include: <code>**</code> = 0 or more characters of any kind, including <code>/</code> slashes; <code>^</code> = beginning of the string; <code>$</code> = end of the string. To learn more about this syntax, please see <a href ="http://zencache.com/r/watered-down-regex-syntax/" target="_blank">this KB article</a>.', 'zencache').'</p>'."\n";
echo ' <p><textarea name="'.esc_attr(GLOBAL_NS).'[saveOptions][htmlc_uri_exclusions]" rows="5" spellcheck="false" class="monospace">'.format_to_edit($this->plugin->options['htmlc_uri_exclusions']).'</textarea></p>'."\n";
echo ' <p class="info">'.__('<strong>Tip:</strong> let\'s use this example URL: <code>http://www.example.com/post/example-post-123</code>. To exclude this URL, you would put this line into the field above: <code>/post/example-post-123</code>. Or, you could also just put in a small fragment, like: <code>example</code> or <code>example-*-123</code> and that would exclude any URI containing that word fragment.', 'zencache').'</p>'."\n";
echo ' <p class="info">'.__('<strong>Note:</strong> please remember that your entries here should be formatted as a line-delimited list; e.g., one exclusion pattern per line.', 'zencache').'</p>'."\n";
echo ' <hr />'."\n";
echo ' <h3>'.__('HTML Compression Cache Expiration', 'zencache').'</h3>'."\n";
echo ' <p><input type="text" name="'.esc_attr(GLOBAL_NS).'[saveOptions][htmlc_cache_expiration_time]" value="'.esc_attr($this->plugin->options['htmlc_cache_expiration_time']).'" /></p>'."\n";
Expand Down
7 changes: 5 additions & 2 deletions src/includes/classes/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public function setup()
'htmlc_enable',
'htmlc_css_exclusions',
'htmlc_js_exclusions',
'htmlc_uri_exclusions',
'htmlc_cache_expiration_time',
'htmlc_compress_combine_head_body_css',
'htmlc_compress_combine_head_js',
Expand Down Expand Up @@ -218,8 +219,9 @@ public function setup()
$this->default_options = array(
/* Core/systematic plugin options. */

'version' => VERSION,
'welcomed' => '0', // `0|1` welcomed yet?
'version' => VERSION,
'welcomed' => '0', // `0|1` welcomed yet?
'comet_cache_notice1_enqueued' => '0', // `0|1` announced Comet Cache yet?
'crons_setup' => '0', // A timestamp when last set up.
'crons_setup_on_namespace' => '', // The namespace on which they were set up.
Expand Down Expand Up @@ -299,6 +301,7 @@ public function setup()
'htmlc_enable' => '0', // Enable HTML compression?
'htmlc_css_exclusions' => '', // Empty string or line-delimited patterns.
'htmlc_js_exclusions' => '.php?', // Empty string or line-delimited patterns.
'htmlc_uri_exclusions' => '', // Empty string or line-delimited patterns.
'htmlc_cache_expiration_time' => '14 days', // `strtotime()` compatible.

'htmlc_compress_combine_head_body_css' => '1', // `0|1`.
Expand Down
7 changes: 6 additions & 1 deletion src/includes/closures/Plugin/InstallUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

if (!$self->options['welcomed'] && !$self->options['enable']) {
$settings_url = add_query_arg(urlencode_deep(array('page' => GLOBAL_NS)), network_admin_url('/admin.php'));
$self->enqueueMainNotice(sprintf(__('<strong>%1$s</strong> successfully installed! :-) <strong>Please <a href="%2$s">enable caching and review options</a>.</strong>', 'zencache'), esc_html(NAME), esc_attr($settings_url), array('push_to_top' => true)));
$self->enqueueMainNotice(sprintf(__('<strong>%1$s</strong> successfully installed! :-) <strong>Please <a href="%2$s">enable caching and review options</a>.</strong>', 'zencache'), esc_html(NAME), esc_attr($settings_url)), array('push_to_top' => true));
$self->updateOptions(array('welcomed' => '1'));
}

Expand All @@ -36,6 +36,11 @@
* @attaches-to `admin_init` hook.
*/
$self->checkVersion = function () use ($self) {
if (!$self->options['comet_cache_notice1_enqueued']) {
$self->enqueueMainNotice(sprintf(__('<strong>Important %1$s Announcement:</strong> %1$s is changing its name to <a href="https://cometcache.com/r/announcing-comet-cache-formerly-zencache/" target="_blank"><strong>Comet Cache</a></strong>! Learn more about this upcoming change <a href="https://cometcache.com/r/announcing-comet-cache-formerly-zencache/" target="_blank">here</a>.', 'zencache'), esc_html(NAME)), array('push_to_top' => true, 'class'=>'notice notice-warning', 'persistent_key'=>'comet_cache_notice1'));
$self->updateOptions(array('comet_cache_notice1_enqueued' => '1'));
} // This notice MUST go above the version check to show up on new installs.

$prev_version = $self->options['version'];
if (version_compare($prev_version, VERSION, '>=')) {
return; // Nothing to do; up-to-date.
Expand Down
2 changes: 1 addition & 1 deletion src/includes/closures/Shared/CachePathUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
$host = 'doesnt-matter.foo.bar';
$host_url = rtrim('http://'.$host, '/');
$host_cache_path = $self->buildCachePath($host_url, '', '', $flags);
$uri_patterns = array_unique(preg_split('/['."\r\n".']+/', $uris, null, PREG_SPLIT_NO_EMPTY));
$uri_patterns = array_unique(preg_split('/['."\r\n".']+/', $uris, -1, PREG_SPLIT_NO_EMPTY));

foreach ($uri_patterns as $_key => &$_uri_pattern) {
if (($_uri_pattern = trim($_uri_pattern, '^$'))) {
Expand Down
37 changes: 34 additions & 3 deletions src/includes/closures/Shared/ConditionalUtils.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
<?php
namespace WebSharks\ZenCache;

/**
* PHP's language constructs.
*
* @type array PHP's language constructs.
* Keys are currently unimportant. Subject to change.
*
* @since 16xxxx First documented version.
*/
$self->php_constructs = array(
'die' => 'die',
'echo' => 'echo',
'empty' => 'empty',
'exit' => 'exit',
'eval' => 'eval',
'include' => 'include',
'include_once' => 'include_once',
'isset' => 'isset',
'list' => 'list',
'require' => 'require',
'require_once' => 'require_once',
'return' => 'return',
'print' => 'print',
'unset' => 'unset',
'__halt_compiler' => '__halt_compiler',
);

/*
* Is AdvancedCache class?
*
Expand Down Expand Up @@ -311,14 +337,19 @@
$disabled_functions = array(); // Initialize disabled/blacklisted functions.

if (($disable_functions = trim(ini_get('disable_functions')))) {
$disabled_functions = array_merge($disabled_functions, preg_split('/[\s;,]+/', strtolower($disable_functions), null, PREG_SPLIT_NO_EMPTY));
$disabled_functions = array_merge($disabled_functions, preg_split('/[\s;,]+/', strtolower($disable_functions), -1, PREG_SPLIT_NO_EMPTY));
}
if (($blacklist_functions = trim(ini_get('suhosin.executor.func.blacklist')))) {
$disabled_functions = array_merge($disabled_functions, preg_split('/[\s;,]+/', strtolower($blacklist_functions), null, PREG_SPLIT_NO_EMPTY));
$disabled_functions = array_merge($disabled_functions, preg_split('/[\s;,]+/', strtolower($blacklist_functions), -1, PREG_SPLIT_NO_EMPTY));
}
if(filter_var(ini_get('suhosin.executor.disable_eval'), FILTER_VALIDATE_BOOLEAN)) {
$disabled_functions = array_merge($disabled_functions, array('eval'));
}
}
if (!function_exists($function) || !is_callable($function)) {
return ($is = false); // Not possible.
if(!in_array($function, $self->php_constructs, true)) { // A language construct
return ($is = false); // Not possible.
}
}
if ($disabled_functions && in_array(strtolower($function), $disabled_functions, true)) {
return ($is = false); // Not possible.
Expand Down
2 changes: 1 addition & 1 deletion src/includes/closures/Shared/IpAddrUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
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 $_key => $_possible_ip) {
foreach (preg_split('/[\s;,]+/', $list_of_possible_ips, -1, PREG_SPLIT_NO_EMPTY) as $_key => $_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.
}
Expand Down
2 changes: 1 addition & 1 deletion src/includes/closures/Shared/PatternUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$regex = ''; // Initialize list of regex patterns.
$patterns = (string) $patterns;

if (($patterns = preg_split('/['."\r\n".']+/', $patterns, null, PREG_SPLIT_NO_EMPTY))) {
if (($patterns = preg_split('/['."\r\n".']+/', $patterns, -1, PREG_SPLIT_NO_EMPTY))) {
$regex = '/(?:'.implode('|', array_map($self->wdRegexToActualRegexFrag, $patterns)).')/i';
}
return $regex;
Expand Down
2 changes: 1 addition & 1 deletion src/includes/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
require_once dirname(dirname(__FILE__)).'/vendor/autoload.php';
require_once dirname(__FILE__).'/functions/i18n-utils.php';

${__FILE__}['version'] = '160120-RC'; //version//
${__FILE__}['version'] = '160216-RC'; //version//
${__FILE__}['plugin'] = dirname(dirname(dirname(__FILE__)));
${__FILE__}['plugin'] .= '/'.basename(${__FILE__}['plugin']).'.php';
${__FILE__}['ns_path'] = str_replace('\\', '/', __NAMESPACE__); // To dir/path.
Expand Down
Loading

0 comments on commit 531cc75

Please sign in to comment.