Skip to content

Commit

Permalink
Releasing Comet Cache v160412-RC
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Apr 12, 2016
1 parent 743b3d4 commit bbe0274
Show file tree
Hide file tree
Showing 187 changed files with 12,345 additions and 10,247 deletions.
4 changes: 2 additions & 2 deletions comet-cache.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
Version: 160227
Version: 160412-RC
Text Domain: comet-cache
Plugin Name: Comet Cache
Network: true
Expand All @@ -14,4 +14,4 @@
if (!defined('WPINC')) {
exit('Do NOT access this file directly: '.basename(__FILE__));
}
require_once dirname(__FILE__).'/plugin.php';
require_once __DIR__.'/plugin.php';
28 changes: 17 additions & 11 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
}
$GLOBALS['wp_php_rv'] = '5.3.2'; //php-required-version// // Leaving this at v5.3.2 so that we can have more control over Dashboard messages below.

if (require(dirname(__FILE__).'/src/vendor/websharks/wp-php-rv/src/includes/check.php')) {
if (require(__DIR__.'/src/vendor/websharks/wp-php-rv/src/includes/check.php')) {
if (!empty($_REQUEST['comet_cache_mbstring_deprecated_warning_bypass']) && is_admin()) {
update_site_option('comet_cache_mbstring_deprecated_warning_bypass', time());
}

${__FILE__}['apc_enabled'] = (extension_loaded('apc') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN) && stripos((string)ini_get('apc.filters'), 'comet-cache') === false) ? true : false;
${__FILE__}['apc_enabled'] = (extension_loaded('apc') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN) && stripos((string) ini_get('apc.filters'), 'comet-cache') === false) ? true : false;

if ((!version_compare(PHP_VERSION, '5.4', '>=') || ${__FILE__}['apc_enabled'])) { // If PHP <= 5.4 or APC is enabled

Expand All @@ -22,8 +22,10 @@
}

add_action(
'all_admin_notices', create_function(
'', 'if(!current_user_can(\'activate_plugins\'))'.
'all_admin_notices',
create_function(
'',
'if(!current_user_can(\'activate_plugins\'))'.
' return;'."\n".// User missing capability.

'echo \''.// Wrap `$notice` inside a WordPress error.
Expand All @@ -33,7 +35,7 @@
'</div>'.

'\';'
)
)
);
} elseif (${__FILE__}['apc_enabled'] && is_admin()) {
${__FILE__}['apc_deprecated_notice'] = '<h3 style="margin:.5em 0 .25em 0;">'.__('<strong>NOTICE: Comet Cache + PHP APC Extension</strong></h3>', 'comet-cache');
Expand All @@ -46,8 +48,10 @@
${__FILE__}['apc_deprecated_notice'] .= '<p style="margin-top:0;">'.__('To learn more about this change, please see the announcement: <a href="http://cometcache.com/r/php-apc-extension-no-longer-supported/" target="_blank">PHP APC Extension No Longer Supported</a>', 'comet-cache').'</p>';

add_action(
'all_admin_notices', create_function(
'', 'if(!current_user_can(\'activate_plugins\'))'.
'all_admin_notices',
create_function(
'',
'if(!current_user_can(\'activate_plugins\'))'.
' return;'."\n".// User missing capability.

'echo \''.// Wrap `$notice` inside a WordPress error.
Expand All @@ -57,7 +61,7 @@
'</div>'.

'\';'
)
)
);
}
} else { // Load the plugin
Expand All @@ -68,8 +72,10 @@
${__FILE__}['mbstring_deprecated_warning'] .= '<p style="margin-top:0;">'.__('The <code>mbstring</code> extension provides Multibyte String support to PHP and is required to properly handle UTF-8 characters, which many sites now use. Without Multibyte String support, Comet Cache will be unstable. For that reason we are requiring the <code>mbstring</code> extension to improve reliablity when caching and to prevent your site from experiencing unforeseen issues in the future.', 'comet-cache').'</p>';
${__FILE__}['mbstring_deprecated_warning'] .= '<p style="margin-bottom:.5em;">'.__('<a href="'.esc_attr(add_query_arg('comet_cache_mbstring_deprecated_warning_bypass', '1')).'" onclick="if(!confirm(\'Are you sure? Press OK to continue, or Cancel to stop and read carefully.\')) return false;">Dismiss this notice.</a>', 'comet-cache').'</p>';
add_action(
'all_admin_notices', create_function(
'', 'if(!current_user_can(\'activate_plugins\'))'.
'all_admin_notices',
create_function(
'',
'if(!current_user_can(\'activate_plugins\'))'.
' return;'."\n".// User missing capability.
'echo \''.// Wrap `$notice` inside a WordPress error.
'<div class="notice notice-warning">'.
Expand All @@ -80,7 +86,7 @@
);
}

require_once dirname(__FILE__).'/src/includes/plugin.php';
require_once __DIR__.'/src/includes/plugin.php';
}
} else {
wp_php_rv_notice('Comet Cache');
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Comet Cache ===

Stable tag: 160227
Stable tag: 160412-RC
Requires at least: 4.1
Tested up to: 4.5-alpha
Text Domain: comet-cache
Expand Down
2 changes: 1 addition & 1 deletion src/client-s/css/admin-bar.min.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

/*# sourceMappingURL=admin-bar.min.css.map */

2 changes: 1 addition & 1 deletion src/client-s/css/menu-pages.min.css

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/includes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
*/
namespace WebSharks\CometCache;

use WebSharks\CometCache\Classes;

if (!defined('WPINC')) {
exit('Do NOT access this file directly: '.basename(__FILE__));
}
class_alias(__NAMESPACE__.'\\ApiBase', GLOBAL_NS);
class_alias(__NAMESPACE__.'\\Classes\\ApiBase', GLOBAL_NS);

if (!class_exists('zencache')) {
class_alias(__NAMESPACE__.'\\ApiBase', 'zencache');
class_alias(__NAMESPACE__.'\\Classes\\ApiBase', 'zencache');
}
18 changes: 10 additions & 8 deletions src/includes/classes/AbsBase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace WebSharks\CometCache;
namespace WebSharks\CometCache\Classes;

/**
* Abstract Base.
Expand All @@ -20,21 +20,21 @@ abstract class AbsBase
*
* @since 150422 Rewrite.
*/
protected $cache = array();
protected $cache = [];

/**
* @type array Global static cache ref.
*
* @since 150422 Rewrite.
*/
protected $static = array();
protected $static = [];

/**
* @type array Global static cache.
*
* @since 150422 Rewrite.
*/
protected static $global_static = array();
protected static $global_static = [];

/**
* @type \stdClass Overload properties.
Expand All @@ -55,7 +55,7 @@ public function __construct()
$class = get_called_class();

if (empty(static::$global_static[$class])) {
static::$global_static[$class] = array();
static::$global_static[$class] = [];
}
$this->static = &static::$global_static[$class];

Expand All @@ -76,7 +76,8 @@ public static function instance()
if (isset($instance)) {
return $instance;
}
return ($instance = new static());

return $instance = new static();
}

/**
Expand Down Expand Up @@ -167,7 +168,7 @@ public function __unset($property)
* @note This function returns by reference. The use of `&` is highly recommended when calling this utility.
* See also: <http://php.net/manual/en/language.references.return.php>
*/
public function &cacheKey($function, $args = array(), $___prop = 'cache')
public function &cacheKey($function, $args = [], $___prop = 'cache')
{
$function = (string) $function;
$args = (array) $args;
Expand Down Expand Up @@ -210,6 +211,7 @@ public function &cacheKey($function, $args = array(), $___prop = 'cache')
}
$cache_key = &$cache_key[$_key];
}

return $cache_key;
}

Expand All @@ -224,7 +226,7 @@ public function &cacheKey($function, $args = array(), $___prop = 'cache')
* @note This function returns by reference. The use of `&` is highly recommended when calling this utility.
* See also: <http://php.net/manual/en/language.references.return.php>
*/
public function &staticKey($function, $args = array())
public function &staticKey($function, $args = [])
{
$key = &$this->cacheKey($function, $args, 'static');

Expand Down
40 changes: 28 additions & 12 deletions src/includes/classes/AbsBaseAp.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
<?php
namespace WebSharks\CometCache;
namespace WebSharks\CometCache\Classes;

use WebSharks\CometCache\Traits;
use WebSharks\CometCache\Interfaces;

/**
* Abstract Base for Advanced Cache and Plugin.
*
* @since 150422 Rewrite.
*/
abstract class AbsBaseAp extends AbsBase
abstract class AbsBaseAp extends AbsBase implements Interfaces\Shared\NcDebugConsts, Interfaces\Shared\CachePathConsts
{
/*[.build.php-auto-generate-use-Traits]*/
use Traits\Shared\BlogUtils;
use Traits\Shared\CacheDirUtils;
use Traits\Shared\CacheLockUtils;
use Traits\Shared\CachePathUtils;
use Traits\Shared\ConditionalUtils;
use Traits\Shared\DomainMappingUtils;
use Traits\Shared\EscapeUtils;
use Traits\Shared\FsUtils;
use Traits\Shared\HookUtils;
use Traits\Shared\HttpUtils;
use Traits\Shared\I18nUtils;
use Traits\Shared\IpAddrUtils;
use Traits\Shared\PatternUtils;
use Traits\Shared\ReplaceUtils;
use Traits\Shared\ServerUtils;
use Traits\Shared\StringUtils;
use Traits\Shared\SysUtils;
use Traits\Shared\TokenUtils;
use Traits\Shared\TrimUtils;
use Traits\Shared\UrlUtils;
/*[/.build.php-auto-generate-use-Traits]*/

/**
* Class constructor.
*
Expand All @@ -16,16 +42,6 @@ abstract class AbsBaseAp extends AbsBase
public function __construct()
{
parent::__construct();

$closures_dir = dirname(dirname(__FILE__)).'/closures/Shared';
$self = $this; // Reference for closures.

foreach (scandir($closures_dir) as $_closure) {
if (substr($_closure, -4) === '.php') {
require $closures_dir.'/'.$_closure;
}
}
unset($_closure); // Housekeeping.
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/includes/classes/Actions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace WebSharks\CometCache;
namespace WebSharks\CometCache\Classes;

/**
* Actions.
Expand All @@ -13,7 +13,7 @@ class Actions extends AbsBase
*
* @since 150422 Rewrite.
*/
protected $allowed_actions = array(
protected $allowed_actions = [
'wipeCache',
'clearCache',

Expand All @@ -37,7 +37,7 @@ class Actions extends AbsBase


'dismissNotice',
);
];

/**
* Class constructor.
Expand Down Expand Up @@ -81,7 +81,7 @@ protected function wipeCache($args)


$redirect_to = self_admin_url('/admin.php');
$query_args = array('page' => GLOBAL_NS, GLOBAL_NS.'_cache_wiped' => '1');
$query_args = ['page' => GLOBAL_NS, GLOBAL_NS.'_cache_wiped' => '1'];
$redirect_to = add_query_arg(urlencode_deep($query_args), $redirect_to);

wp_redirect($redirect_to).exit();
Expand All @@ -107,7 +107,7 @@ protected function clearCache($args)


$redirect_to = self_admin_url('/admin.php'); // Redirect preparations.
$query_args = array('page' => GLOBAL_NS, GLOBAL_NS.'_cache_cleared' => '1');
$query_args = ['page' => GLOBAL_NS, GLOBAL_NS.'_cache_cleared' => '1'];
$redirect_to = add_query_arg(urlencode_deep($query_args), $redirect_to);

wp_redirect($redirect_to).exit();
Expand Down Expand Up @@ -167,7 +167,7 @@ protected function saveOptions($args)
delete_transient(GLOBAL_NS.'-'.md5($this->plugin->options['auto_cache_sitemap_url']));

$redirect_to = self_admin_url('/admin.php'); // Redirect preparations.
$query_args = array('page' => GLOBAL_NS, GLOBAL_NS.'_updated' => '1');
$query_args = ['page' => GLOBAL_NS, GLOBAL_NS.'_updated' => '1'];

$this->plugin->autoWipeCache(); // May produce a notice.

Expand Down Expand Up @@ -232,7 +232,7 @@ protected function restoreDefaultOptions($args)
$this->plugin->restoreDefaultOptions(); // Restore defaults.

$redirect_to = self_admin_url('/admin.php'); // Redirect preparations.
$query_args = array('page' => GLOBAL_NS, GLOBAL_NS.'_restored' => '1');
$query_args = ['page' => GLOBAL_NS, GLOBAL_NS.'_restored' => '1'];

$this->plugin->autoWipeCache(); // May produce a notice.

Expand Down
8 changes: 4 additions & 4 deletions src/includes/classes/AdvCacheBackCompat.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace WebSharks\CometCache;
namespace WebSharks\CometCache\Classes;

/**
* AC back compat.
Expand All @@ -15,11 +15,11 @@ class AdvCacheBackCompat
*/
public static function zcRequestVars()
{
$super_gs = array(
$super_gs = [
'_GET' => &$_GET,
'_REQUEST' => &$_REQUEST,
);
$zc_suffixes = array('AC', 'ABC');
];
$zc_suffixes = ['AC', 'ABC'];

foreach ($super_gs as $_super_g_key => &$_super_g_value) {
foreach ($zc_suffixes as $_zc_suffix) {
Expand Down
24 changes: 13 additions & 11 deletions src/includes/classes/AdvancedCache.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
namespace WebSharks\CometCache;
namespace WebSharks\CometCache\Classes;

use WebSharks\CometCache\Traits;

/**
* Advanced cache.
Expand All @@ -8,6 +10,16 @@
*/
class AdvancedCache extends AbsBaseAp
{
/*[.build.php-auto-generate-use-Traits]*/
use Traits\Ac\AbortUtils;
use Traits\Ac\AcPluginUtils;
use Traits\Ac\BrowserUtils;
use Traits\Ac\NcDebugUtils;
use Traits\Ac\ObUtils;
use Traits\Ac\PostloadUtils;
use Traits\Ac\ShutdownUtils;
/*[/.build.php-auto-generate-use-Traits]*/

/**
* Flagged as `TRUE` if running.
*
Expand Down Expand Up @@ -35,16 +47,6 @@ public function __construct()
{
parent::__construct();

$closures_dir = dirname(dirname(__FILE__)).'/closures/Ac';
$self = $this; // Reference for closures.

foreach (scandir($closures_dir) as $_closure) {
if (substr($_closure, -4) === '.php') {
require $closures_dir.'/'.$_closure;
}
}
unset($_closure); // Housekeeping.

if (!defined('WP_CACHE') || !WP_CACHE || !COMET_CACHE_ENABLE) {
return; // Not enabled.
}
Expand Down
3 changes: 2 additions & 1 deletion src/includes/classes/ApiBase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace WebSharks\CometCache;
namespace WebSharks\CometCache\Classes;

/**
* API Base Class.
Expand Down Expand Up @@ -100,6 +100,7 @@ public static function clearPost($post_id)
public static function clearUrl($url)
{
$regex = $GLOBALS[GLOBAL_NS]->buildCachePathRegexFromWcUrl($url);

return $GLOBALS[GLOBAL_NS]->deleteFilesFromCacheDir($regex);
}

Expand Down
Loading

0 comments on commit bbe0274

Please sign in to comment.