batcache::is_ssl PHP Method

is_ssl() public method

public is_ssl ( )
    function is_ssl()
    {
        if (isset($_SERVER['HTTPS'])) {
            if ('on' == strtolower($_SERVER['HTTPS'])) {
                return true;
            }
            if ('1' == $_SERVER['HTTPS']) {
                return true;
            }
        } elseif (isset($_SERVER['SERVER_PORT']) && '443' == $_SERVER['SERVER_PORT']) {
            return true;
        }
        return false;
    }

Usage Example

Exemplo n.º 1
0
// Disabled
if ($batcache->max_age < 1) {
    return;
}
// Make sure we can increment. If not, turn off the traffic sensor.
if (!method_exists($GLOBALS['wp_object_cache'], 'incr')) {
    $batcache->times = 0;
}
// Necessary to prevent clients using cached version after login cookies set. If this is a problem, comment it out and remove all Last-Modified headers.
header('Vary: Cookie', false);
// Things that define a unique page.
if (isset($_SERVER['QUERY_STRING'])) {
    parse_str($_SERVER['QUERY_STRING'], $batcache->query);
}
$batcache->keys = array('host' => $_SERVER['HTTP_HOST'], 'method' => $_SERVER['REQUEST_METHOD'], 'path' => ($batcache->pos = strpos($_SERVER['REQUEST_URI'], '?')) ? substr($_SERVER['REQUEST_URI'], 0, $batcache->pos) : $_SERVER['REQUEST_URI'], 'query' => $batcache->query, 'extra' => $batcache->unique);
if ($batcache->is_ssl()) {
    $batcache->keys['ssl'] = true;
}
// Recreate the permalink from the URL
$batcache->permalink = 'http://' . $batcache->keys['host'] . $batcache->keys['path'] . (isset($batcache->keys['query']['p']) ? "?p=" . $batcache->keys['query']['p'] : '');
$batcache->url_key = md5($batcache->permalink);
$batcache->url_version = (int) wp_cache_get("{$batcache->url_key}_version", $batcache->group);
$batcache->configure_groups();
$batcache->do_variants();
$batcache->generate_keys();
// Get the batcache
$batcache->cache = wp_cache_get($batcache->key, $batcache->group);
// Are we only caching frequently-requested pages?
if ($batcache->seconds < 1 || $batcache->times < 2) {
    $batcache->do = true;
} else {