Ejemplo n.º 1
0
 * @since 150422 Rewrite.
 *
 * @param string $buffer The buffer from {@link \ob_start()}.
 * @param int    $phase  A set of bitmask flags.
 *
 * @throws \Exception If unable to handle output buffering for any reason.
 *
 * @return string|bool The output buffer, or `FALSE` to indicate no change.
 *
 * @attaches-to {@link \ob_start()}
 */
$self->outputBufferCallbackHandler = function ($buffer, $phase) use($self) {
    if (!($phase & PHP_OUTPUT_HANDLER_END)) {
        throw new \Exception(sprintf(__('Unexpected OB phase: `%1$s`.', 'zencache'), $phase));
    }
    AdvCacheBackCompat::quickCacheConstants();
    $cache = trim((string) $buffer);
    if (!isset($cache[0])) {
        return false;
        // Don't cache an empty buffer.
    }
    if (!isset($GLOBALS[GLOBAL_NS . '_shutdown_flag'])) {
        return (bool) $self->maybeSetDebugInfo(NC_DEBUG_EARLY_BUFFER_TERMINATION);
    }
    if (defined('ZENCACHE_ALLOWED') && !ZENCACHE_ALLOWED) {
        return (bool) $self->maybeSetDebugInfo(NC_DEBUG_ZENCACHE_ALLOWED_CONSTANT);
    }
    if (isset($_SERVER['ZENCACHE_ALLOWED']) && !$_SERVER['ZENCACHE_ALLOWED']) {
        return (bool) $self->maybeSetDebugInfo(NC_DEBUG_ZENCACHE_ALLOWED_SERVER_VAR);
    }
    if (defined('DONOTCACHEPAGE')) {
Ejemplo n.º 2
0
    }
} 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.
}
AdvCacheBackCompat::zenCacheConstants();
AdvCacheBackCompat::zcRequestVars();
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.