<?php
/**
 * Advanced cache stub.
 *
 * @since 150422 Rewrite.
 */
namespace WebSharks\CometCache\Pro;

use WebSharks\CometCache\Pro\Classes;

if (!defined('WPINC')) {
    exit('Do NOT access this file directly: '.basename(__FILE__));
}
if (!defined('COMET_CACHE_PLUGIN_FILE')) {
    /**
     * Plugin file path.
     *
     * @since 140725 Reorganizing class members.
     *
     * @var string Absolute server path to CC plugin file.
     */
    define('COMET_CACHE_PLUGIN_FILE', '%%COMET_CACHE_PLUGIN_FILE%%');
}
if (defined('WP_DEBUG') && WP_DEBUG) {
    if ((include_once(dirname(COMET_CACHE_PLUGIN_FILE).'/src/includes/stub.php')) === false) {
      return; // Unable to find stub. Fail softly w/ PHP warning.
    }
} elseif ((@include_once(dirname(COMET_CACHE_PLUGIN_FILE).'/src/includes/stub.php')) === false) {
    return; // Unable to find stub. Fail softly.
}
if (defined('WP_DEBUG') && WP_DEBUG) {
    if ((@include_once(dirname(COMET_CACHE_PLUGIN_FILE).'/src/includes/functions/wp-cache-postload.php')) === false) {
      return; // Unable to find postload function(s). Fail softly w/ PHP warning.
    }
} elseif ((@include_once(dirname(COMET_CACHE_PLUGIN_FILE).'/src/includes/functions/wp-cache-postload.php')) === false) {
    return; // Unable to find postload function(s). Fail softly.
}
Classes\AdvCacheBackCompat::zenCacheConstants();
Classes\AdvCacheBackCompat::zcRequestVars();
Classes\AdvCacheBackCompat::browserCacheConstant();

if (!defined('COMET_CACHE_PRO')) {
    /**
     * Comet Cache Pro flag.
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_PRO', IS_PRO);
}
if (!defined('COMET_CACHE_ENABLE')) {
    /**
     * Is Comet Cache enabled?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_ENABLE', '%%COMET_CACHE_ENABLE%%');
}
if (!defined('COMET_CACHE_DEBUGGING_ENABLE')) {
    /**
     * Is Comet Cache debugging enabled?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_DEBUGGING_ENABLE', '%%COMET_CACHE_DEBUGGING_ENABLE%%');
}
if (!defined('COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE')) {
    /**
     * Allow browsers to cache each document?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     *
     * @note If this is a `FALSE` (or an empty) value; Comet Cache will send no-cache headers.
     *    If `TRUE`, Comet Cache will NOT send no-cache headers.
     */
    define('COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE', '%%COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE%%');
}
if (!defined('COMET_CACHE_GET_REQUESTS')) {
    /**
     * Cache `$_GET` requests w/ a query string?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_GET_REQUESTS', '%%COMET_CACHE_GET_REQUESTS%%');
}
if (!defined('COMET_CACHE_CACHE_404_REQUESTS')) {
    /**
     * Cache 404 errors?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_CACHE_404_REQUESTS', '%%COMET_CACHE_CACHE_404_REQUESTS%%');
}
if (!defined('COMET_CACHE_CACHE_NONCE_VALUES')) {
    /**
     * Cache HTML containing nonce values?
     *
     * @since 160103 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_CACHE_NONCE_VALUES', '%%COMET_CACHE_CACHE_NONCE_VALUES%%');
}
if (!defined('COMET_CACHE_CACHE_NONCE_VALUES_WHEN_LOGGED_IN')) {
    /**
     * Cache HTML containing nonce values for Logged-In Users?
     *
     * @since 160103 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_CACHE_NONCE_VALUES_WHEN_LOGGED_IN', '%%COMET_CACHE_CACHE_NONCE_VALUES_WHEN_LOGGED_IN%%');
}
if (!defined('COMET_CACHE_FEEDS_ENABLE')) {
    /**
     * Cache XML/RSS/Atom feeds?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_FEEDS_ENABLE', '%%COMET_CACHE_FEEDS_ENABLE%%');
}
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_WHEN_LOGGED_IN')) {
    /**
     * Cache logged-in users?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`; or `postload`.
     */
    define('COMET_CACHE_WHEN_LOGGED_IN', '%%COMET_CACHE_WHEN_LOGGED_IN%%');
}
/*[/pro]*/
if (!defined('COMET_CACHE_DIR')) {
    /**
     * Directory used to store cache files; relative to `WP_CONTENT_DIR`.
     *
     * @since 140422 First documented version.
     *
     * @var string Absolute server directory path.
     */
    define('COMET_CACHE_DIR', WP_CONTENT_DIR.'/'.'%%COMET_CACHE_DIR%%');
}
if (!defined('COMET_CACHE_MAX_AGE')) {
    /**
     * Cache expiration time.
     *
     * @since 140422 First documented version.
     *
     * @var string Anything compatible with PHP's {@link \strtotime()}.
     */
    define('COMET_CACHE_MAX_AGE', '%%COMET_CACHE_MAX_AGE%%');
}
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_MAX_AGE_DISABLE_IF_LOAD_AVERAGE_IS_GTE')) {
    /**
     * Cache expiration disabled if load average is >= to this.
     *
     * @since 151002 Adding support for load average check.
     *
     * @var string Cache expiration disabled if load average is >= to this.
     */
    define('COMET_CACHE_MAX_AGE_DISABLE_IF_LOAD_AVERAGE_IS_GTE', '%%COMET_CACHE_MAX_AGE_DISABLE_IF_LOAD_AVERAGE_IS_GTE%%');
}
/*[/pro]*/
if (!defined('COMET_CACHE_EXCLUDE_HOSTS')) {
    /**
     * Host exclusions.
     *
     * @since 160706 Adding host exclusions.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_EXCLUDE_HOSTS', '%%COMET_CACHE_EXCLUDE_HOSTS%%');
}
if (!defined('COMET_CACHE_EXCLUDE_URIS')) {
    /**
     * URI exclusions.
     *
     * @since 140422 First documented version.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_EXCLUDE_URIS', '%%COMET_CACHE_EXCLUDE_URIS%%');
}
if (!defined('COMET_CACHE_EXCLUDE_CLIENT_SIDE_URIS')) {
    /**
     * Client-side URI exclusions.
     *
     * @since 151220 Adding support for client-side URI exclusions.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_EXCLUDE_CLIENT_SIDE_URIS', '%%COMET_CACHE_EXCLUDE_CLIENT_SIDE_URIS%%');
}
if (!defined('COMET_CACHE_EXCLUDE_REFS')) {
    /**
     * HTTP referrer exclusions.
     *
     * @since 140422 First documented version.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_EXCLUDE_REFS', '%%COMET_CACHE_EXCLUDE_REFS%%');
}
if (!defined('COMET_CACHE_EXCLUDE_AGENTS')) {
    /**
     * HTTP user-agent exclusions.
     *
     * @since 140422 First documented version.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_EXCLUDE_AGENTS', '%%COMET_CACHE_EXCLUDE_AGENTS%%');
}
if (!defined('COMET_CACHE_404_CACHE_FILENAME')) {
    /**
     * 404 file name (if applicable).
     *
     * @since 140422 First documented version.
     *
     * @var string A unique file name that will not conflict with real paths.
     *    This should NOT include the extension; basename only please.
     */
    define('COMET_CACHE_404_CACHE_FILENAME', '----404----');
}
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_VERSION_SALT')) {
    /**
     * Version salt.
     *
     * @since 140422 First documented version.
     *
     * @var mixed Any scalar value; e.g. string, integer, boolean;
     *    or a PHP expression that results in a scalar value.
     */
    define('COMET_CACHE_VERSION_SALT', '%%COMET_CACHE_VERSION_SALT%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_ENABLE')) {
    /**
     * Enable HTML compressor?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_ENABLE', '%%COMET_CACHE_HTMLC_ENABLE%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_WHEN_LOGGED_IN')) {
    /**
     * Enable HTML compressor when logged in?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_WHEN_LOGGED_IN', '%%COMET_CACHE_HTMLC_WHEN_LOGGED_IN%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_CSS_EXCLUSIONS')) {
    /**
     * CSS exclusions for the HTML compressor.
     *
     * @since 140422 First documented version.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_HTMLC_CSS_EXCLUSIONS', '%%COMET_CACHE_HTMLC_CSS_EXCLUSIONS%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_JS_EXCLUSIONS')) {
    /**
     * JS exclusions for the HTML compressor.
     *
     * @since 140422 First documented version.
     *
     * @var string A regular expression; else an empty string.
     */
    define('COMET_CACHE_HTMLC_JS_EXCLUSIONS', '%%COMET_CACHE_HTMLC_JS_EXCLUSIONS%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_URI_EXCLUSIONS')) {
/**
 * URI exclusions for the HTML compressor.
 *
 * @since 160222 First documented version.
 *
 * @var string A regular expression; else an empty string.
 */
define('COMET_CACHE_HTMLC_URI_EXCLUSIONS', '%%COMET_CACHE_HTMLC_URI_EXCLUSIONS%%');
}
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_CACHE_EXPIRATION_TIME')) {
    /**
     * Cache expiration time for the HTML compressor.
     *
     * @since 140422 First documented version.
     *
     * @var string Anything compatible with PHP's {@link \strtotime()}.
     */
    define('COMET_CACHE_HTMLC_CACHE_EXPIRATION_TIME', '%%COMET_CACHE_HTMLC_CACHE_EXPIRATION_TIME%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_CACHE_DIR_PUBLIC')) {
    /**
     * Public cache directory for the HTML compressor.
     *
     * @since 140422 First documented version.
     *
     * @var string Absolute server directory path.
     */
    define('COMET_CACHE_HTMLC_CACHE_DIR_PUBLIC', WP_CONTENT_DIR.'/'.'%%COMET_CACHE_HTMLC_CACHE_DIR_PUBLIC%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_CACHE_DIR_PRIVATE')) {
    /**
     * Private cache directory for the HTML compressor.
     *
     * @since 140422 First documented version.
     *
     * @var string Absolute server directory path.
     */
    define('COMET_CACHE_HTMLC_CACHE_DIR_PRIVATE', WP_CONTENT_DIR.'/'.'%%COMET_CACHE_HTMLC_CACHE_DIR_PRIVATE%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_COMBINE_HEAD_BODY_CSS')) {
    /**
     * Compress/combine `<head>` and `<body>` CSS?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_COMBINE_HEAD_BODY_CSS', '%%COMET_CACHE_HTMLC_COMPRESS_COMBINE_HEAD_BODY_CSS%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_COMBINE_HEAD_JS')) {
    /**
     * Compress/combine `<head>` JS?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_COMBINE_HEAD_JS', '%%COMET_CACHE_HTMLC_COMPRESS_COMBINE_HEAD_JS%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_COMBINE_FOOTER_JS')) {
    /**
     * Compress/combine `<!--footer-scripts-->`?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_COMBINE_FOOTER_JS', '%%COMET_CACHE_HTMLC_COMPRESS_COMBINE_FOOTER_JS%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_COMBINE_REMOTE_CSS_JS')) {
    /**
     * Compress/combine remotely hosted CSS/JS files?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_COMBINE_REMOTE_CSS_JS', '%%COMET_CACHE_HTMLC_COMPRESS_COMBINE_REMOTE_CSS_JS%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_INLINE_JS_CODE')) {
    /**
     * Compress inline `<script>` tags?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_INLINE_JS_CODE', '%%COMET_CACHE_HTMLC_COMPRESS_INLINE_JS_CODE%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_CSS_CODE')) {
    /**
     * Compress CSS code after combining files?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_CSS_CODE', '%%COMET_CACHE_HTMLC_COMPRESS_CSS_CODE%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_JS_CODE')) {
    /**
     * Compress JS code after combining files?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_JS_CODE', '%%COMET_CACHE_HTMLC_COMPRESS_JS_CODE%%');
}
/*[/pro]*/
/*[pro strip-from="lite"]*/
if (!defined('COMET_CACHE_HTMLC_COMPRESS_HTML_CODE')) {
    /**
     * Compress the resulting HTML code?
     *
     * @since 140422 First documented version.
     *
     * @var string|integer|boolean A boolean-ish value; e.g. `1` or `0`.
     */
    define('COMET_CACHE_HTMLC_COMPRESS_HTML_CODE', '%%COMET_CACHE_HTMLC_COMPRESS_HTML_CODE%%');
}
/*[/pro]*/
$GLOBALS[GLOBAL_NS.'_advanced_cache']  = new Classes\AdvancedCache();
$GLOBALS[GLOBAL_NS.'__advanced_cache'] = &$GLOBALS[GLOBAL_NS.'_advanced_cache'];
if (!isset($GLOBALS['zencache__advanced_cache'])) {
    $GLOBALS['zencache_advanced_cache'] = &$GLOBALS[GLOBAL_NS.'_advanced_cache'];
    $GLOBALS['zencache__advanced_cache'] = &$GLOBALS[GLOBAL_NS.'_advanced_cache'];
}
if (!isset($GLOBALS['quick_cache__advanced_cache'])) {
    $GLOBALS['quick_cache_advanced_cache'] = &$GLOBALS[GLOBAL_NS.'_advanced_cache'];
    $GLOBALS['quick_cache__advanced_cache'] = &$GLOBALS[GLOBAL_NS.'_advanced_cache'];
}
