PluginProbe ʕ •ᴥ•ʔ
WP Super Cache / 3.1.1
WP Super Cache v3.1.1
3.1.1 trunk 0.1 0.2 0.3 0.3.1 0.4 0.5 0.5.1 0.5.2 0.5.3 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.6.7 0.6.8 0.7 0.7.1 0.8 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.8.8 0.8.9 0.9 0.9.1 0.9.2 0.9.3 0.9.3.1 0.9.4 0.9.4.1 0.9.4.2 0.9.4.3 0.9.5 0.9.6 0.9.6.1 0.9.7 0.9.8 0.9.9 0.9.9.1 0.9.9.2 0.9.9.3 0.9.9.4 0.9.9.5 0.9.9.6 0.9.9.7 0.9.9.8 0.9.9.9 1.0 1.0.1 1.1 1.1.1 1.10.0 1.11.0 1.12.0 1.12.1 1.12.2 1.12.3 1.12.4 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.7.1 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8 1.9 1.9.1 1.9.2 1.9.3 1.9.4 2.0.0 2.0.1 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0
wp-super-cache / wp-cache-base.php
wp-super-cache Last commit date
assets 1 year ago docs 1 week ago inc 1 month ago js 1 month ago languages 2 years ago partials 9 months ago plugins 1 month ago rest 6 months ago src 1 month ago styling 9 months ago AGENTS.md 1 week ago CLAUDE.md 1 week ago LICENSE.txt 1 month ago SECURITY.md 2 years ago advanced-cache.php 2 years ago ossdl-cdn.php 2 years ago readme.txt 1 week ago wp-cache-base.php 2 years ago wp-cache-config-sample.php 4 years ago wp-cache-phase1.php 9 months ago wp-cache-phase2.php 1 week ago wp-cache.php 1 week ago
wp-cache-base.php
52 lines
1 <?php
2 global $WPSC_HTTP_HOST, $cache_enabled, $cache_path, $blogcacheid, $blog_cache_dir;
3
4 // we need to backup HTTP_HOST early in the PHP process, and if running in command line set it to something useful.
5 if ( ! empty( $_SERVER['HTTP_HOST'] ) ) {
6 $WPSC_HTTP_HOST = function_exists( 'mb_strtolower' ) ? mb_strtolower( $_SERVER['HTTP_HOST'] ) : strtolower( $_SERVER['HTTP_HOST'] );
7 // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
8 $WPSC_HTTP_HOST = htmlentities( $WPSC_HTTP_HOST, ENT_COMPAT );
9 } elseif ( PHP_SAPI === 'cli' && function_exists( 'get_option' ) ) {
10 $WPSC_HTTP_HOST = (string) parse_url( get_option( 'home' ), PHP_URL_HOST );
11 } else {
12 $cache_enabled = false;
13 $WPSC_HTTP_HOST = '';
14 }
15
16 // We want to be able to identify each blog in a WordPress MU install
17 $blogcacheid = '';
18 $blog_cache_dir = $cache_path;
19
20 // we might be able to simplify this. I run a multisite and the blogs directory isn't used any more.
21 // $blogcacheid is set to the domain or prefix path of your site, and all files are put in $cache_path/supercache/$blogcacheid/[REQUEST_URI path]/
22 if ( is_multisite() ) {
23 global $current_blog;
24
25 if ( is_object( $current_blog ) && function_exists( 'is_subdomain_install' ) ) {
26 $blogcacheid = is_subdomain_install() ? $current_blog->domain : trim( $current_blog->path, '/' );
27 } elseif ( ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) || ( defined( 'VHOST' ) && VHOST === 'yes' ) ) {
28 $blogcacheid = $WPSC_HTTP_HOST;
29 } else {
30 $request_uri = str_replace( '..', '', preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER['REQUEST_URI'] ) );
31 $request_uri = str_replace( '//', '/', $request_uri );
32
33 $wpsc_path_segs = array_filter( explode( '/', trim( $request_uri, '/' ) ) );
34 $wpsc_base_count = defined( 'PATH_CURRENT_SITE' ) ? count( array_filter( explode( '/', trim( PATH_CURRENT_SITE, '/' ) ) ) ) : 0;
35 if ( ! str_ends_with( $request_uri, '/' ) ) {
36 $wpsc_path_segs = array_slice( $wpsc_path_segs, 0, -1 );
37 }
38
39 if ( count( $wpsc_path_segs ) > $wpsc_base_count &&
40 ( ! defined( 'PATH_CURRENT_SITE' ) || str_starts_with( $request_uri, PATH_CURRENT_SITE ) )
41 ) {
42 $blogcacheid = $wpsc_path_segs[ $wpsc_base_count ];
43 }
44 }
45
46 // If blogcacheid is empty then set it to main blog.
47 if ( empty( $blogcacheid ) ) {
48 $blogcacheid = 'blog';
49 }
50 $blog_cache_dir = str_replace( '//', '/', $cache_path . 'blogs/' . $blogcacheid . '/' );
51 }
52