forked from Automattic/wp-super-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-cache-base.php
31 lines (28 loc) · 1.18 KB
/
wp-cache-base.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$known_headers = array("Last-Modified", "Expires", "Content-Type", "Content-type", "X-Pingback", "ETag", "Cache-Control", "Pragma");
$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
// We want to be able to identify each blog in a WordPress MU install
$blogcacheid = '';
if ( defined( 'VHOST' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) {
$blogcacheid = 'blog'; // main blog
if( defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == true ) {
$blogcacheid = $WPSC_HTTP_HOST;
} else {
if ( isset( $base ) == false )
$base = '';
$request_uri = str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER['REQUEST_URI'] ) );
if( strpos( $request_uri, '/', 1 ) ) {
if( $base == '/' ) {
$blogcacheid = substr( $request_uri, 1, strpos( $request_uri, '/', 1 ) - 1 );
} else {
$blogcacheid = str_replace( $base, '', $request_uri );
if ( $blogcacheid != '' )
$blogcacheid = substr( $blogcacheid, 0, strpos( $blogcacheid, '/', 1 ) );
}
if ( '/' == substr($blogcacheid, -1))
$blogcacheid = substr($blogcacheid, 0, -1);
}
$blogcacheid = str_replace( '/', '', $blogcacheid );
}
}
?>