Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-super...
File: wp-cache-phase1.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if ( ! function_exists( 'wp_cache_phase2' ) ) {
[2] Fix | Delete
require_once __DIR__. '/wp-cache-phase2.php';
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
// error_reporting(E_ERROR | E_PARSE); // uncomment to debug this file!
[6] Fix | Delete
// directory where the configuration file lives.
[7] Fix | Delete
if ( !defined( 'WPCACHECONFIGPATH' ) ) {
[8] Fix | Delete
define( 'WPCACHECONFIGPATH', WP_CONTENT_DIR );
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
if ( ! @include WPCACHECONFIGPATH . '/wp-cache-config.php' ) {
[12] Fix | Delete
return false;
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
// points at the wp-super-cache plugin directory because sometimes file paths are weird. Edge cases,
[16] Fix | Delete
if ( ! defined( 'WPCACHEHOME' ) ) {
[17] Fix | Delete
define( 'WPCACHEHOME', __DIR__ . '/' );
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
if ( defined( 'DISABLE_SUPERCACHE' ) ) {
[21] Fix | Delete
wp_cache_debug( 'DISABLE_SUPERCACHE set, super_cache disabled.' );
[22] Fix | Delete
$super_cache_enabled = 0;
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
require WPCACHEHOME . 'wp-cache-base.php';
[26] Fix | Delete
[27] Fix | Delete
if ( '/' === $cache_path || empty( $cache_path ) ) {
[28] Fix | Delete
define( 'WPSCSHUTDOWNMESSAGE', 'WARNING! Caching disabled. Configuration corrupted. Reset configuration on Advanced Settings page.' );
[29] Fix | Delete
add_action( 'wp_footer', 'wpsc_shutdown_message' );
[30] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[31] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[32] Fix | Delete
}
[33] Fix | Delete
return;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
// $blog_cache_dir is used all over the code alongside the supercache directory but at least with multisite installs it appears to do nothing.
[37] Fix | Delete
// I started putting everything in cache/supercache/blogname/path/ a long time ago but never got around to removing the code that used the blogs directory.
[38] Fix | Delete
if ( $blogcacheid != '' ) {
[39] Fix | Delete
$blog_cache_dir = str_replace( '//', '/', $cache_path . 'blogs/' . $blogcacheid . '/' );
[40] Fix | Delete
} else {
[41] Fix | Delete
$blog_cache_dir = $cache_path;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
$wp_cache_phase1_loaded = true;
[45] Fix | Delete
[46] Fix | Delete
// part of the coarse file locking which should really be removed, but there are edge cases where semaphores didn't work in the past.
[47] Fix | Delete
$mutex_filename = 'wp_cache_mutex.lock';
[48] Fix | Delete
$new_cache = false;
[49] Fix | Delete
[50] Fix | Delete
// write a plugin to extend wp-super-cache!
[51] Fix | Delete
if ( ! isset( $wp_cache_plugins_dir ) ) {
[52] Fix | Delete
$wp_cache_plugins_dir = WPCACHEHOME . 'plugins';
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
// from the secret shown on the Advanced settings page.
[56] Fix | Delete
if ( isset( $_GET['donotcachepage'] ) && isset( $cache_page_secret ) && $_GET['donotcachepage'] == $cache_page_secret ) {
[57] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[58] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[59] Fix | Delete
}
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
// Load wp-super-cache plugins
[63] Fix | Delete
$plugins = glob( $wp_cache_plugins_dir . '/*.php' );
[64] Fix | Delete
if ( is_array( $plugins ) ) {
[65] Fix | Delete
foreach ( $plugins as $plugin ) {
[66] Fix | Delete
if ( is_file( $plugin ) ) {
[67] Fix | Delete
require_once $plugin;
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
// Load plugins from an array of php scripts. This needs to be documented.
[73] Fix | Delete
if ( isset( $wpsc_plugins ) && is_array( $wpsc_plugins ) ) {
[74] Fix | Delete
foreach( $wpsc_plugins as $plugin_file ) {
[75] Fix | Delete
if ( file_exists( ABSPATH . $plugin_file ) ) {
[76] Fix | Delete
include_once( ABSPATH . $plugin_file );
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
// also look for plugins in wp-content/wp-super-cache-plugins/
[82] Fix | Delete
if (
[83] Fix | Delete
file_exists( WPCACHEHOME . '../wp-super-cache-plugins/' ) &&
[84] Fix | Delete
is_dir( WPCACHEHOME . '../wp-super-cache-plugins/' )
[85] Fix | Delete
) {
[86] Fix | Delete
$plugins = glob( WPCACHEHOME . '../wp-super-cache-plugins/*.php' );
[87] Fix | Delete
if ( is_array( $plugins ) ) {
[88] Fix | Delete
foreach ( $plugins as $plugin ) {
[89] Fix | Delete
if ( is_file( $plugin ) ) {
[90] Fix | Delete
require_once $plugin;
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
}
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
// for timing purposes for the html comments
[97] Fix | Delete
$wp_start_time = microtime();
[98] Fix | Delete
[99] Fix | Delete
if ( isset( $_SERVER['REQUEST_URI'] ) ) { // Cache this in case any plugin modifies it and filter out tracking parameters.
[100] Fix | Delete
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- none available before WordPress is loaded. Sanitized in wp_cache_postload().
[101] Fix | Delete
$wp_cache_request_uri = wpsc_remove_tracking_params_from_uri( $_SERVER['REQUEST_URI'] ); // phpcs:ignore
[102] Fix | Delete
[103] Fix | Delete
// $wp_cache_request_uri is expected to be a string. If running from wp-cli it will be null.
[104] Fix | Delete
if ( $wp_cache_request_uri === null ) {
[105] Fix | Delete
$wp_cache_request_uri = '';
[106] Fix | Delete
}
[107] Fix | Delete
} else {
[108] Fix | Delete
$wp_cache_request_uri = '';
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
// don't cache in wp-admin
[112] Fix | Delete
if ( wpsc_is_backend() ) {
[113] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[114] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[115] Fix | Delete
}
[116] Fix | Delete
return true;
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
// if a cookie is found that we don't like then don't serve/cache the page
[120] Fix | Delete
if ( wpsc_is_rejected_cookie() ) {
[121] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[122] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[123] Fix | Delete
}
[124] Fix | Delete
wp_cache_debug( 'Caching disabled because rejected cookie found.' );
[125] Fix | Delete
return true;
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
if ( wpsc_is_caching_user_disabled() ) {
[129] Fix | Delete
wp_cache_debug( 'Caching disabled for logged in users on settings page.' );
[130] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[131] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[132] Fix | Delete
}
[133] Fix | Delete
return true;
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
// make logged in users anonymous so they are shown logged out pages.
[137] Fix | Delete
if ( isset( $wp_cache_make_known_anon ) && $wp_cache_make_known_anon ) {
[138] Fix | Delete
wp_supercache_cache_for_admins();
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
// an init action wpsc plugins can hook on to.
[142] Fix | Delete
do_cacheaction( 'cache_init' );
[143] Fix | Delete
[144] Fix | Delete
if ( ! $cache_enabled ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- set by configuration or cache_init action
[145] Fix | Delete
return true;
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
// don't cache or serve cached files for various URLs, including the Customizer.
[149] Fix | Delete
if ( isset( $_SERVER['REQUEST_METHOD'] ) && in_array( $_SERVER['REQUEST_METHOD'], array( 'POST', 'PUT', 'DELETE' ), true ) ) {
[150] Fix | Delete
wp_cache_debug( 'Caching disabled for non GET request.' );
[151] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[152] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[153] Fix | Delete
}
[154] Fix | Delete
return true;
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
if ( isset( $_GET['customize_changeset_uuid'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[158] Fix | Delete
wp_cache_debug( 'Caching disabled for customizer.' );
[159] Fix | Delete
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
[160] Fix | Delete
define( 'DONOTCACHEPAGE', 1 );
[161] Fix | Delete
}
[162] Fix | Delete
return true;
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
$file_expired = false;
[166] Fix | Delete
$cache_filename = '';
[167] Fix | Delete
$meta_file = '';
[168] Fix | Delete
$wp_cache_gzip_encoding = '';
[169] Fix | Delete
[170] Fix | Delete
$gzipped = 0;
[171] Fix | Delete
$gzsize = 0;
[172] Fix | Delete
[173] Fix | Delete
if ( $cache_compression ) {
[174] Fix | Delete
$wp_cache_gzip_encoding = gzip_accepted(); // false or 'gzip'
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
// The wp_cache_check_mobile function appends "-mobile" to the cache filename if it detects a mobile visitor.
[178] Fix | Delete
add_cacheaction( 'supercache_filename_str', 'wp_cache_check_mobile' );
[179] Fix | Delete
if ( function_exists( 'add_filter' ) ) { // loaded since WordPress 4.6
[180] Fix | Delete
add_filter( 'supercache_filename_str', 'wp_cache_check_mobile' );
[181] Fix | Delete
}
[182] Fix | Delete
[183] Fix | Delete
if ( defined( 'DOING_CRON' ) ) {
[184] Fix | Delete
// this is required for scheduled CRON jobs.
[185] Fix | Delete
extract( wp_super_cache_init() ); // $key, $cache_filename, $meta_file, $cache_file, $meta_pathname
[186] Fix | Delete
return true;
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
// late init delays serving a cache file until after the WordPress init actin has fired and (most of?) WordPress has loaded.
[190] Fix | Delete
// If it's not enabled then serve a cache file now if possible.
[191] Fix | Delete
if ( ! isset( $wp_super_cache_late_init ) || ( isset( $wp_super_cache_late_init ) && false == $wp_super_cache_late_init ) ) {
[192] Fix | Delete
wp_cache_serve_cache_file();
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function