| Server IP : 156.67.83.116 / Your IP : 216.73.216.38 Web Server : Apache System : Linux vmi1896282.contaboserver.net 5.10.0-33-amd64 #1 SMP Debian 5.10.226-1 (2024-10-03) x86_64 User : maltem.ma ( 10009) PHP Version : 8.3.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/maltem.ma/preprodonhym.maltem.ma/wp-content/ |
Upload File : |
<?php
/**
* File: advanced-cache.php
*
* W3 Total Cache advanced cache module.
*
* @package W3TC
*/
defined( 'ABSPATH' ) || die();
global $w3tc_start_microtime;
$w3tc_start_microtime = microtime( true );
/*
* Fast Page Cache — lecture Redis ultra-rapide AVANT WordPress.
* Sert le HTML mis en cache en quelques ms si disponible.
*/
if ( ! defined( 'WP_INSTALLING' ) && ! defined( 'WP_ADMIN' )
&& ! defined( 'DOING_CRON' ) && ! defined( 'DOING_AJAX' )
&& extension_loaded( 'redis' )
&& ( $_SERVER['REQUEST_METHOD'] ?? 'GET' ) === 'GET' ) {
$fpc_qs = $_SERVER['QUERY_STRING'] ?? '';
$fpc_bypass = false;
if ( $fpc_qs !== '' ) {
parse_str( $fpc_qs, $fpc_params );
foreach ( array_keys( $fpc_params ) as $fpc_k ) {
if ( ! in_array( $fpc_k, [ 'aaeid', 'lang' ], true ) ) { $fpc_bypass = true; break; }
}
}
if ( ! $fpc_bypass ) {
foreach ( array_keys( $_COOKIE ) as $fpc_c ) {
if ( str_starts_with( $fpc_c, 'wordpress_logged_in' ) ) { $fpc_bypass = true; break; }
}
}
$fpc_uri = $_SERVER['REQUEST_URI'] ?? '/';
if ( str_contains( $fpc_uri, 'wp-admin' ) || isset( $_GET['preview'] ) || isset( $_GET['elementor-preview'] ) ) {
$fpc_bypass = true;
}
if ( ! $fpc_bypass ) {
try {
$fpc_r = new Redis();
if ( $fpc_r->connect( '127.0.0.1', 6379, 1.0 ) ) {
$fpc_r->select( 1 );
$fpc_scheme = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) ? 'https' : 'http';
$fpc_key = 'fpc:' . md5( $fpc_scheme . '://' . ( $_SERVER['HTTP_HOST'] ?? '' ) . strtok( $fpc_uri, '?' ) );
$fpc_html = $fpc_r->get( $fpc_key );
if ( $fpc_html !== false ) {
header( 'Content-Type: text/html; charset=UTF-8' );
header( 'X-FPC-Cache: HIT' );
echo $fpc_html;
exit;
}
}
} catch ( Exception $fpc_e ) { /* silent */ }
}
unset( $fpc_r, $fpc_html, $fpc_key, $fpc_bypass, $fpc_c, $fpc_k, $fpc_params, $fpc_qs, $fpc_uri, $fpc_scheme );
}
/**
* Abort W3TC loading if WordPress is upgrading.
*/
if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
return;
}
if ( ! defined( 'W3TC_IN_MINIFY' ) ) {
if ( ! defined( 'W3TC_DIR' ) ) {
define( 'W3TC_DIR', ( defined( 'WP_PLUGIN_DIR' ) ? WP_PLUGIN_DIR : WP_CONTENT_DIR . '/plugins' ) . '/w3-total-cache' );
}
if ( ! @is_dir( W3TC_DIR ) || ! file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
if ( defined( 'WP_ADMIN' ) ) {
// Only display errors in wp-admin.
printf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>. <br />', __FILE__ );
}
} else {
require_once W3TC_DIR . '/w3-total-cache-api.php';
if ( class_exists( '\W3TC\Dispatcher' ) ) {
$w3tc_redirect = \W3TC\Dispatcher::component( 'Mobile_Redirect' );
$w3tc_redirect->process();
$w3tc_config = \W3TC\Dispatcher::config();
if ( $w3tc_config->get_boolean( 'pgcache.enabled' ) ) {
$o = \W3TC\Dispatcher::component( 'PgCache_ContentGrabber' );
$o->process();
}
}
}
}