web/wp-content/plugins/wp-super-cache/wp-cache-base.php
author Anthony Ly <anthonyly.com@gmail.com>
Mon, 19 Nov 2012 18:26:13 +0100
changeset 194 32102edaa81b
parent 136 bde1974c263b
permissions -rw-r--r--
MAJ wordpress et ajout de plugin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     1
<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     2
$known_headers = array("Last-Modified", "Expires", "Content-Type", "Content-type", "X-Pingback", "ETag", "Cache-Control", "Pragma");
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     3
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     4
if (!class_exists('CacheMeta')) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     5
	class CacheMeta {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     6
		var $dynamic = false;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     7
		var $headers = array();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     8
		var $uri = '';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     9
		var $post = 0;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    10
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    11
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    12
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    13
$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    14
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    15
// We want to be able to identify each blog in a WordPress MU install
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    16
$blogcacheid = '';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    17
if ( defined( 'VHOST' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    18
	$blogcacheid = 'blog'; // main blog
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    19
	if( defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == true ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    20
		$blogcacheid = $WPSC_HTTP_HOST;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    21
	} else {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    22
		$request_uri = preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', str_replace( '..', '', $_SERVER['REQUEST_URI'] ) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    23
		if( strpos( $request_uri, '/', 1 ) ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    24
			if( $base == '/' ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    25
				$blogcacheid = substr( $request_uri, 1, strpos( $request_uri, '/', 1 ) - 1 );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    26
			} else {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    27
				$blogcacheid = str_replace( $base, '', $request_uri );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    28
				if ( $blogcacheid != '' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    29
					$blogcacheid = substr( $blogcacheid, 0, strpos( $blogcacheid, '/', 1 ) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    30
			}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    31
			if ( '/' == substr($blogcacheid, -1))
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    32
				$blogcacheid = substr($blogcacheid, 0, -1);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    33
		}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    34
		$blogcacheid = str_replace( '/', '', $blogcacheid );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    35
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    36
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    37
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    38
?>