• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_current_url_supercache_dir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_current_url_supercache_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_url_supercache_dir函数的具体用法?PHP get_current_url_supercache_dir怎么用?PHP get_current_url_supercache_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_current_url_supercache_dir函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: super_cache_invalidate

 function super_cache_invalidate()
 {
     //Now, we are actually using the referrer and not the request, with some precautions
     $GLOBALS['wp_cache_request_uri'] = substr($_SERVER['HTTP_REFERER'], stripos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) + strlen($_SERVER[''] . $_SERVER['HTTP_HOST']));
     $GLOBALS['wp_cache_request_uri'] = preg_replace('/[ <>\'\\"\\r\\n\\t\\(\\)]/', '', str_replace('/index.php', '/', str_replace('..', '', preg_replace("/(\\?.*)?\$/", '', $GLOBALS['wp_cache_request_uri']))));
     // get some supercache variables
     extract(wp_super_cache_init());
     tp_logger(wp_super_cache_init());
     // this is hackery for logged in users, a cookie is added to the request somehow and gzip is not correctly set, so we forcefully fix this
     if (!$cache_file) {
         $GLOBALS['wp_cache_gzip_encoding'] = gzip_accepted();
         unset($_COOKIE[key($_COOKIE)]);
         extract(wp_super_cache_init());
         tp_logger(wp_super_cache_init());
     }
     $dir = get_current_url_supercache_dir();
     // delete possible files that we can figure out, not deleting files for other cookies for example, but will do the trick in most cases
     $cache_fname = "{$dir}index.html";
     tp_logger("attempting delete of supercache: {$cache_fname}");
     @unlink($cache_fname);
     $cache_fname = "{$dir}index.html.gz";
     tp_logger("attempting delete of supercache: {$cache_fname}");
     @unlink($cache_fname);
     tp_logger("attempting delete of wp_cache: {$cache_file}");
     @unlink($cache_file);
     tp_logger("attempting delete of wp_cache_meta: {$meta_pathname}");
     @unlink($meta_pathname);
     // go at edit pages too
     $GLOBALS['wp_cache_request_uri'] .= "?edit=1";
     extract(wp_super_cache_init());
     tp_logger(wp_super_cache_init());
     tp_logger("attempting delete of edit_wp_cache: {$cache_file}");
     @unlink($cache_file);
     tp_logger("attempting delete of edit_wp_cache_meta: {$meta_pathname}");
     @unlink($meta_pathname);
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:36,代码来源:transposh_3rdparty.php


示例2: wp_cache_get_ob

function wp_cache_get_ob(&$buffer)
{
    global $cache_path, $cache_filename, $meta_file, $wp_start_time, $supercachedir;
    global $new_cache, $wp_cache_meta, $file_expired, $blog_id, $cache_compression;
    global $wp_cache_gzip_encoding, $super_cache_enabled, $cached_direct_pages;
    global $wp_cache_404, $gzsize, $supercacheonly, $wp_cache_gzip_first, $wp_cache_gmt_offset;
    global $blog_cache_dir, $wp_cache_request_uri, $wp_supercache_cache_list;
    $new_cache = true;
    $wp_cache_meta = '';
    /* Mode paranoic, check for closing tags 
     * we avoid caching incomplete files */
    if ($buffer == '') {
        $new_cache = false;
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Buffer is blank. Output buffer may have been corrupted by another plugin or this is a redirected URL. Look for text 'ob_start' in the files of your plugins directory.", 2);
            $buffer .= "\n<!-- Page not cached by WP Super Cache. Blank Page. Check output buffer usage by plugins. -->\n";
        }
    }
    if ($wp_cache_404 && false == apply_filters('wpsupercache_404', false)) {
        $new_cache = false;
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("404 file not found not cached", 2);
            $buffer .= "\n<!-- Page not cached by WP Super Cache. 404. -->\n";
        }
    }
    if (!preg_match('/(<\\/html>|<\\/rss>|<\\/feed>)/i', $buffer)) {
        $new_cache = false;
        if (false === strpos($_SERVER['REQUEST_URI'], 'robots.txt')) {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("No closing html tag. Not caching.", 2);
                $buffer .= "\n<!-- Page not cached by WP Super Cache. No closing HTML tag. Check your theme. -->\n";
            }
        } else {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("robots.txt detected. Not caching.", 2);
            }
        }
    }
    if (!$new_cache) {
        return $buffer;
    }
    $duration = wp_cache_microtime_diff($wp_start_time, microtime());
    $duration = sprintf("%0.3f", $duration);
    $buffer .= "\n<!-- Dynamic page generated in {$duration} seconds. -->\n";
    if (!wp_cache_writers_entry()) {
        $buffer .= "\n<!-- Page not cached by WP Super Cache. Could not get mutex lock. -->\n";
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Could not get mutex lock. Not caching.", 1);
        }
        return $buffer;
    }
    $dir = get_current_url_supercache_dir();
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (!empty($_GET) || is_feed() || $super_cache_enabled == true && is_dir(substr($supercachedir, 0, -1) . '.disabled')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Supercache disabled: GET or feed detected or disabled by config.", 2);
        }
        $super_cache_enabled = false;
    }
    $tmp_wpcache_filename = $cache_path . uniqid(mt_rand(), true) . '.tmp';
    // Don't create wp-cache files for anon users
    $supercacheonly = false;
    if ($super_cache_enabled && wp_cache_get_cookies_values() == '') {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Anonymous user detected. Only creating Supercache file.", 3);
        }
        $supercacheonly = true;
    }
    if (!$supercacheonly) {
        if (!@file_exists($blog_cache_dir . $cache_filename) || @file_exists($blog_cache_dir . $cache_filename) && time() - @filemtime($blog_cache_dir . $cache_filename) > 5) {
            $fr = @fopen($tmp_wpcache_filename, 'w');
            if (!$fr) {
                if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                    wp_cache_debug("Error. Supercache could not write to " . str_replace(ABSPATH, '', $cache_path) . $cache_filename, 1);
                }
                $buffer .= "<!-- File not cached! Super Cache Couldn't write to: " . str_replace(ABSPATH, '', $cache_path) . $cache_filename . " -->\n";
                return $buffer;
            }
        }
    }
    if ($super_cache_enabled) {
        $user_info = wp_cache_get_cookies_values();
        $do_cache = apply_filters('do_createsupercache', $user_info);
        if ($user_info == '' || $do_cache === true) {
            if (@is_dir($dir) == false) {
                @wp_mkdir_p($dir);
            }
            $cache_fname = "{$dir}index.html";
            $tmp_cache_filename = $dir . uniqid(mt_rand(), true) . '.tmp';
            if (!@file_exists($cache_fname) || @file_exists($cache_fname) && time() - @filemtime($cache_fname) > 5) {
                $fr2 = @fopen($tmp_cache_filename, 'w');
                if (!$fr2) {
                    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                        wp_cache_debug("Error. Supercache could not write to " . str_replace(ABSPATH, '', $tmp_cache_filename), 1);
                    }
                    $buffer .= "<!-- File not cached! Super Cache Couldn't write to: " . str_replace(ABSPATH, '', $tmp_cache_filename) . " -->\n";
                    @fclose($fr);
                    @unlink($tmp_wpcache_filename);
                    return $buffer;
                } elseif ($cache_compression) {
//.........这里部分代码省略.........
开发者ID:jeremylightsmith,项目名称:blog,代码行数:101,代码来源:wp-cache-phase2.php


示例3: wp_cache_get_ob

function wp_cache_get_ob(&$buffer)
{
    global $cache_path, $cache_filename, $meta_file, $wp_start_time, $supercachedir;
    global $new_cache, $wp_cache_meta, $file_expired, $blog_id, $cache_compression;
    global $wp_cache_gzip_encoding, $super_cache_enabled, $cached_direct_pages;
    global $wp_cache_404, $gzsize, $supercacheonly, $wp_cache_gzip_first, $wp_cache_gmt_offset;
    global $blog_cache_dir;
    $new_cache = true;
    $wp_cache_meta = '';
    /* Mode paranoic, check for closing tags 
     * we avoid caching incomplete files */
    if ($wp_cache_404) {
        $new_cache = false;
        $buffer .= "\n<!-- Page not cached by WP Super Cache. 404. -->\n";
    }
    if (!preg_match('/(<\\/html>|<\\/rss>|<\\/feed>)/i', $buffer)) {
        $new_cache = false;
        if (false === strpos($_SERVER['REQUEST_URI'], 'robots.txt')) {
            $buffer .= "\n<!-- Page not cached by WP Super Cache. No closing HTML tag. Check your theme. -->\n";
        }
    }
    if (!$new_cache) {
        return $buffer;
    }
    $duration = wp_cache_microtime_diff($wp_start_time, microtime());
    $duration = sprintf("%0.3f", $duration);
    $buffer .= "\n<!-- Dynamic page generated in {$duration} seconds. -->\n";
    if (!wp_cache_writers_entry()) {
        $buffer .= "\n<!-- Page not cached by WP Super Cache. Could not get mutex lock. -->\n";
        return $buffer;
    }
    $mtime = @filemtime($blog_cache_dir . $cache_filename);
    /* Return if:
    		the file didn't exist before but it does exist now (another connection created)
    		OR
    		the file was expired and its mtime is less than 5 seconds
    	*/
    if (!(!$file_expired && $mtime || $mtime && $file_expired && time() - $mtime < 5)) {
        $dir = get_current_url_supercache_dir();
        $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
        if (!empty($_GET) || is_feed() || $super_cache_enabled == true && is_dir(substr($supercachedir, 0, -1) . '.disabled')) {
            $super_cache_enabled = false;
        }
        $tmp_wpcache_filename = $cache_path . uniqid(mt_rand(), true) . '.tmp';
        // Don't create wp-cache files for anon users
        $supercacheonly = false;
        if ($super_cache_enabled && wp_cache_get_cookies_values() == '') {
            $supercacheonly = true;
        }
        if (!$supercacheonly) {
            $fr = @fopen($tmp_wpcache_filename, 'w');
            if (!$fr) {
                $buffer .= "<!-- File not cached! Super Cache Couldn't write to: " . str_replace(ABSPATH, '', $cache_path) . $cache_filename . " -->\n";
                return $buffer;
            }
        }
        if ($super_cache_enabled) {
            $user_info = wp_cache_get_cookies_values();
            $do_cache = apply_filters('do_createsupercache', $user_info);
            if ($user_info == '' || $do_cache === true) {
                if (@is_dir($dir) == false) {
                    @wp_mkdir_p($dir);
                }
                $cache_fname = "{$dir}index.html";
                $tmp_cache_filename = $dir . uniqid(mt_rand(), true) . '.tmp';
                $fr2 = @fopen($tmp_cache_filename, 'w');
                if (!$fr2) {
                    $buffer .= "<!-- File not cached! Super Cache Couldn't write to: " . str_replace(ABSPATH, '', $tmp_cache_filename) . " -->\n";
                    @fclose($fr);
                    @nlink($tmp_wpcache_filename);
                    return $buffer;
                }
                if ($cache_compression) {
                    $gz = @fopen($tmp_cache_filename . ".gz", 'w');
                    if (!$gz) {
                        $buffer .= "<!-- File not cached! Super Cache Couldn't write to: " . str_replace(ABSPATH, '', $tmp_cache_filename) . ".gz -->\n";
                        @close($fr);
                        @nlink($tmp_wpcache_filename);
                        @close($fr2);
                        @nlink($tmp_cache_filename);
                        return $buffer;
                    }
                }
            }
        }
        if (preg_match('/<!--mclude|<!--mfunc/', $buffer)) {
            //Dynamic content
            $store = preg_replace('|<!--mclude (.*?)-->(.*?)<!--/mclude-->|is', "<!--mclude-->\n<?php include_once('" . ABSPATH . "\$1'); ?>\n<!--/mclude-->", $buffer);
            $store = preg_replace('|<!--mfunc (.*?)-->(.*?)<!--/mfunc-->|is', "<!--mfunc-->\n<?php \$1 ;?>\n<!--/mfunc-->", $store);
            $store = apply_filters('wpsupercache_buffer', $store);
            $wp_cache_meta['dynamic'] = true;
            /* Clean function calls in tag */
            $buffer = preg_replace('|<!--mclude (.*?)-->|is', '<!--mclude-->', $buffer);
            $buffer = preg_replace('|<!--mfunc (.*?)-->|is', '<!--mfunc-->', $buffer);
            if ($fr) {
                fputs($fr, $store);
            }
            if ($fr2) {
                fputs($fr2, $store . '<!-- super cache -->');
            }
//.........这里部分代码省略.........
开发者ID:emoksha,项目名称:freefairelections,代码行数:101,代码来源:wp-cache-phase2.php


示例4: clear_post_supercache

function clear_post_supercache($post_id)
{
    $dir = get_current_url_supercache_dir($post_id);
    if (false == @is_dir($dir)) {
        return false;
    }
    if (!function_exists('prune_super_cache')) {
        include_once 'wp-cache-phase2.php';
    }
    prune_super_cache($dir, true);
}
开发者ID:popovdenis,项目名称:kmst,代码行数:11,代码来源:wp-cache.php


示例5: get_oc_key

function get_oc_key($url = false)
{
    global $wp_cache_gzip_encoding, $WPSC_HTTP_HOST;
    if ($url) {
        $key = intval($_SERVER['SERVER_PORT']) . strtolower(preg_replace('/:.*$/', '', $WPSC_HTTP_HOST)) . $url;
    } else {
        $key = get_current_url_supercache_dir();
    }
    return $key . $wp_cache_gzip_encoding . get_oc_version();
}
开发者ID:JuiceCrawl,项目名称:juicecrawldev,代码行数:10,代码来源:wp-cache-phase1.php


示例6: clear_post_supercache

function clear_post_supercache($post_id)
{
    $dir = get_current_url_supercache_dir($post_id);
    if (file_exists($dir . 'index.html')) {
        unlink($dir . 'index.html');
    }
    if (file_exists($dir . 'index.html.gz')) {
        unlink($dir . 'index.html.gz');
    }
}
开发者ID:hoonio,项目名称:wordpress,代码行数:10,代码来源:wp-cache.php


示例7: clear_post_supercache

function clear_post_supercache($post_id)
{
    $dir = get_current_url_supercache_dir($post_id);
    if (false == @is_dir($dir)) {
        return false;
    }
    if (!function_exists('prune_super_cache')) {
        include_once 'wp-cache-phase2.php';
    }
    wp_cache_debug("clear_post_supercache: deleting {$dir}/index*.html files", 2);
    $files_to_check = get_all_supercache_filenames($dir);
    foreach ($files_to_check as $cache_file) {
        prune_super_cache($dir . $cache_file, true);
    }
}
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:15,代码来源:wp-cache.php


示例8: wp_cache_post_id_gc

function wp_cache_post_id_gc($siteurl, $post_id, $all = 'all')
{
    global $cache_path, $wp_cache_object_cache;
    if ($wp_cache_object_cache) {
        reset_oc_version();
    }
    $post_id = intval($post_id);
    if ($post_id == 0) {
        return;
    }
    $permalink = trailingslashit(str_replace(get_option('home'), '', post_permalink($post_id)));
    $dir = get_current_url_supercache_dir($post_id);
    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug("wp_cache_post_id_gc post_id: {$post_id} " . post_permalink($post_id) . " clearing cache in {$dir}.", 4);
    }
    if ($all == 'all') {
        prune_super_cache($dir, true, true);
        do_action('gc_cache', 'prune', $permalink);
        @rmdir($dir);
    } else {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("wp_cache_post_id_gc clearing cached index files in {$dir}.", 4);
        }
        prune_super_cache($dir, true, true);
        do_action('gc_cache', 'prune', $permalink);
    }
    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug("wp_cache_post_id_gc clearing cache in {$dir}page/.", 4);
    }
    prune_super_cache($dir . 'page/', true);
    do_action('gc_cache', 'prune', '/page/');
}
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:32,代码来源:wp-cache-phase2.php


示例9: wp_cache_get_ob

function wp_cache_get_ob(&$buffer)
{
    global $wpsc_settings;
    global $cache_enabled, $cache_path, $cache_filename, $meta_file, $wp_start_time, $supercachedir;
    global $new_cache, $wp_cache_meta, $file_expired, $blog_id, $cache_compression;
    global $wp_cache_gzip_encoding, $super_cache_enabled, $cached_direct_pages;
    global $wp_cache_404, $gzsize, $supercacheonly;
    global $blog_cache_dir, $wp_cache_request_uri, $wp_supercache_cache_list;
    global $wp_cache_not_logged_in, $wp_cache_object_cache, $cache_max_time;
    global $wp_cache_is_home, $wp_cache_front_page_checks;
    $new_cache = true;
    $wp_cache_meta = '';
    /* Mode paranoic, check for closing tags 
     * we avoid caching incomplete files */
    if ($buffer == '') {
        $new_cache = false;
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Buffer is blank. Output buffer may have been corrupted by another plugin or this is a redirected URL. Look for text 'ob_start' in the files of your plugins directory.", 2);
            $buffer .= "\n<!-- Page not cached by WP Super Cache. Blank Page. Check output buffer usage by plugins. -->\n";
        }
    }
    if ($wp_cache_404 && false == apply_filters('wpsupercache_404', false)) {
        $new_cache = false;
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("404 file not found not cached", 2);
            $buffer .= "\n<!-- Page not cached by WP Super Cache. 404. -->\n";
        }
    }
    if (!preg_match('/(<\\/html>|<\\/rss>|<\\/feed>|<\\/urlset)/i', $buffer)) {
        $new_cache = false;
        if (false === strpos($_SERVER['REQUEST_URI'], 'robots.txt')) {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("No closing html tag. Not caching.", 2);
                $buffer .= "\n<!-- Page not cached by WP Super Cache. No closing HTML tag. Check your theme. -->\n";
            }
        } else {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("robots.txt detected. Not caching.", 2);
            }
        }
    }
    if (!$new_cache) {
        return $buffer;
    }
    $duration = wp_cache_microtime_diff($wp_start_time, microtime());
    $duration = sprintf("%0.3f", $duration);
    $buffer .= "\n<!-- Dynamic page generated in {$duration} seconds. -->\n";
    if (!wp_cache_writers_entry()) {
        $buffer .= "\n<!-- Page not cached by WP Super Cache. Could not get mutex lock. -->\n";
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Could not get mutex lock. Not caching.", 1);
        }
        return $buffer;
    }
    if ($wp_cache_not_logged_in && is_feed()) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Feed detected. Writing legacy cache files.", 5);
        }
        $wp_cache_not_logged_in = false;
    }
    $home_url = parse_url(trailingslashit(get_bloginfo('url')));
    $dir = get_current_url_supercache_dir();
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $home_url['host']);
    if (!empty($_GET) || is_feed() || $super_cache_enabled == true && is_dir(substr($supercachedir, 0, -1) . '.disabled')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Supercache disabled: GET or feed detected or disabled by config.", 2);
        }
        $super_cache_enabled = false;
    }
    $tmp_wpcache_filename = $cache_path . uniqid(mt_rand(), true) . '.tmp';
    $supercacheonly = false;
    if ($super_cache_enabled) {
        if (wp_cache_get_cookies_values() == '') {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("Anonymous user detected. Only creating Supercache file.", 3);
            }
            $supercacheonly = true;
        }
    }
    if ($wp_cache_not_logged_in && wp_cache_get_cookies_values() != '') {
        $super_cache_enabled = false;
        $cache_enabled = false;
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching for known user.', 5);
        }
    }
    if ($wp_cache_object_cache) {
        // half on mode when using the object cache
        if (wp_cache_get_cookies_values() != '') {
            $cache_enabled = false;
        }
        $super_cache_enabled = false;
        $supercacheonly = false;
        wp_cache_init();
        // PHP5 destroys objects during shutdown
    }
    if (!$cache_enabled) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('', 5);
        }
//.........这里部分代码省略.........
开发者ID:besimhu,项目名称:legacy,代码行数:101,代码来源:wp-cache-phase2.php


示例10: wp_cache_ob_callback

function wp_cache_ob_callback($buffer)
{
    global $cache_path, $cache_filename, $meta_file, $wp_start_time, $supercachedir;
    global $new_cache, $wp_cache_meta_object, $file_expired, $blog_id, $cache_compression;
    global $wp_cache_gzip_encoding, $super_cache_enabled, $cached_direct_pages;
    global $wp_cache_404, $gzsize;
    $new_cache = true;
    /* Mode paranoic, check for closing tags 
     * we avoid caching incomplete files */
    if ($wp_cache_404) {
        $new_cache = false;
        $buffer .= "\n<!-- Page not cached by WP Super Cache. 404. -->\n";
    }
    if (!preg_match('/(<\\/html>|<\\/rss>|<\\/feed>)/i', $buffer)) {
        $new_cache = false;
        $buffer .= "\n<!-- Page not cached by WP Super Cache. No closing HTML tag. Check your theme. -->\n";
    }
    if (!$new_cache) {
        return $buffer;
    }
    $duration = wp_cache_microtime_diff($wp_start_time, microtime());
    $duration = sprintf("%0.3f", $duration);
    $buffer .= "\n<!-- Dynamic Page Served (once) in {$duration} seconds -->\n";
    if (!wp_cache_writers_entry()) {
        $buffer .= "\n<!-- Page not cached by WP Super Cache. Could not get mutex lock. -->\n";
        return $buffer;
    }
    $mtime = @filemtime($cache_path . $cache_filename);
    /* Return if:
    		the file didn't exist before but it does exist now (another connection created)
    		OR
    		the file was expired and its mtime is less than 5 seconds
    	*/
    if (!(!$file_expired && $mtime || $mtime && $file_expired && time() - $mtime < 5)) {
        $dir = get_current_url_supercache_dir();
        $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
        if (!empty($_GET) || is_feed() || $super_cache_enabled == true && is_dir(substr($supercachedir, 0, -1) . '.disabled')) {
            $super_cache_enabled = false;
        }
        $tmp_wpcache_filename = tempnam($cache_path, "wp-cache");
        $fr = @fopen($tmp_wpcache_filename, 'w');
        if (!$fr) {
            $buffer .= "<!-- File not cached! Super Cache Couldn't write to: " . str_replace(ABSPATH, '', $cache_path) . $cache_filename . " -->\n";
            return $buffer;
        }
        if ($super_cache_enabled) {
            if (@is_dir($dir) == false) {
                @wp_mkdir_p($dir);
            }
            $user_info = wp_cache_get_cookies_values();
            $do_cache = apply_filters('do_createsupercache', $user_info);
            if ($user_info == '' || $do_cache === true) {
                $cache_fname = "{$dir}index.html";
                $tmp_cache_filename = tempnam($dir, "wpsupercache");
                $fr2 = @fopen($tmp_cache_filename, 'w');
                if ($cache_compression) {
                    $gz = @fopen($tmp_cache_filename . ".gz", 'w');
                }
            }
        }
        if (preg_match('/<!--mclude|<!--mfunc/', $buffer)) {
            //Dynamic content
            $store = preg_replace('|<!--mclude (.*?)-->(.*?)<!--/mclude-->|is', "<!--mclude-->\n<?php include_once('" . ABSPATH . "\$1'); ?>\n<!--/mclude-->", $buffer);
            $store = preg_replace('|<!--mfunc (.*?)-->(.*?)<!--/mfunc-->|is', "<!--mfunc-->\n<?php \$1 ;?>\n<!--/mfunc-->", $store);
            $store = apply_filters('wpsupercache_buffer', $store);
            $wp_cache_meta_object->dynamic = true;
            /* Clean function calls in tag */
            $buffer = preg_replace('|<!--mclude (.*?)-->|is', '<!--mclude-->', $buffer);
            $buffer = preg_replace('|<!--mfunc (.*?)-->|is', '<!--mfunc-->', $buffer);
            fputs($fr, $store);
            if ($fr2) {
                fputs($fr2, $store . '<!-- super cache -->');
            }
            if ($gz) {
                fputs($gz, gzencode($store . '<!-- super cache gz -->', 1, FORCE_GZIP));
            }
        } else {
            $buffer = apply_filters('wpsupercache_buffer', $buffer);
            $log = "<!-- Cached page served by WP-Super-Cache -->\n";
            if ($gz || $wp_cache_gzip_encoding) {
                $gzdata = gzencode($buffer . $log . "<!-- Compression = gzip -->", 3, FORCE_GZIP);
                $gzsize = strlen($gzdata);
            }
            if ($wp_cache_gzip_encoding) {
                array_push($wp_cache_meta_object->headers, 'Content-Encoding: ' . $wp_cache_gzip_encoding);
                array_push($wp_cache_meta_object->headers, 'Vary: Accept-Encoding, Cookie');
                array_push($wp_cache_meta_object->headers, 'Content-Length: ' . strlen($gzdata));
                // Return uncompressed data & store compressed for later use
                fputs($fr, $gzdata);
            } else {
                // no compression
                array_push($wp_cache_meta_object->headers, 'Vary: Cookie');
                fputs($fr, $buffer . $log);
            }
            if ($fr2) {
                fputs($fr2, $buffer . '<!-- super cache -->');
            }
            if ($gz) {
                fwrite($gz, $gzdata);
            }
//.........这里部分代码省略.........
开发者ID:alx,项目名称:barceloneta,代码行数:101,代码来源:wp-cache-phase2.php


示例11: get_oc_key

function get_oc_key($url = false)
{
    global $wp_cache_gzip_encoding;
    if ($url) {
        $key = strtolower(preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"])) . $url;
    } else {
        $key = get_current_url_supercache_dir();
    }
    return $key . $wp_cache_gzip_encoding . get_oc_version();
}
开发者ID:simpsonjulian,项目名称:puppet-wordpress,代码行数:10,代码来源:wp-cache-phase1.php


示例12: wp_cache_post_id_gc

function wp_cache_post_id_gc($siteurl, $post_id, $all = 'all')
{
    global $cache_path, $wp_cache_object_cache, $wp_cache_refresh_single_only;
    if ($wp_cache_object_cache) {
        reset_oc_version();
    }
    $post_id = intval($post_id);
    if ($post_id == 0) {
        return;
    }
    $permalink = trailingslashit(str_replace(get_option('home'), '', get_permalink($post_id)));
    $dir = get_current_url_supercache_dir($post_id);
    wp_cache_debug("wp_cache_post_id_gc post_id: {$post_id} " . get_permalink($post_id) . " clearing cache in {$dir}.", 4);
    if ($all == 'all') {
        prune_super_cache($dir, true, true);
        do_action('gc_cache', 'prune', $permalink);
        @rmdir($dir);
    } else {
        wp_cache_debug("wp_cache_post_id_gc clearing cached index files in {$dir}.", 4);
        prune_super_cache($dir, true, true);
        do_action('gc_cache', 'prune', $permalink);
    }
    wp_cache_debug("wp_cache_post_id_gc clearing cache in {$dir}/page/.", 4);
    prune_super_cache($dir . '/page/', true);
    $supercache_home = get_supercache_dir();
    wp_cache_debug("wp_cache_post_id_gc clearing cache in {$supercache_home}/page/.", 4);
    prune_super_cache($supercache_home . '/page/', true);
    do_action('gc_cache', 'prune', '/page/');
}
开发者ID:Ramoonus,项目名称:wp-super-cache,代码行数:29,代码来源:wp-cache-phase2.php



注:本文中的get_current_url_supercache_dir函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_current_user函数代码示例发布时间:2022-05-15
下一篇:
PHP get_current_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap