page.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return bool
*/
public function is_search() {
if ( function_exists( 'is_search' ) && ! is_search() ) {
return false;
}
/**
* At this point we’re in the WP’s search page.
* This filter allows to cache search results.
*
* @since 2.3.8
*
* @param bool $cache_search True will force caching search results.
*/
return ! apply_filters( 'rocket_cache_search', false );
}
/** ----------------------------------------------------------------------------------------- */
/** $_SERVER ================================================================================ */
/** ----------------------------------------------------------------------------------------- */
/**
* Get the IP address from which the user is viewing the current page.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*/
public function get_ip() {
if ( self::is_memoized( __FUNCTION__ ) ) {
return self::get_memoized( __FUNCTION__ );
}
$keys = [
'HTTP_CF_CONNECTING_IP', // CF = CloudFlare.
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_X_CLUSTER_CLIENT_IP',
'HTTP_X_REAL_IP',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR',
];
foreach ( $keys as $key ) {
if ( ! $this->config->get_server_input( $key ) ) {
continue;
}
$ip = explode( ',', $this->config->get_server_input( $key ) );
$ip = end( $ip );
if ( false !== filter_var( $ip, FILTER_VALIDATE_IP ) ) {
return self::memoize( __FUNCTION__, [], $ip );
}
}
return self::memoize( __FUNCTION__, [], '0.0.0.0' );
}
/**
* Tell if the request comes from a speed test tool.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return bool
*/
public function is_speed_tool() {
if ( self::is_memoized( __FUNCTION__ ) ) {
return self::get_memoized( __FUNCTION__ );
}
$ips = [
'208.70.247.157' => '', // GT Metrix - Vancouver 1.
'204.187.14.70' => '', // GT Metrix - Vancouver 2.
'204.187.14.71' => '', // GT Metrix - Vancouver 3.
'204.187.14.72' => '', // GT Metrix - Vancouver 4.
'204.187.14.73' => '', // GT Metrix - Vancouver 5.
'204.187.14.74' => '', // GT Metrix - Vancouver 6.
'204.187.14.75' => '', // GT Metrix - Vancouver 7.
'204.187.14.76' => '', // GT Metrix - Vancouver 8.
'204.187.14.77' => '', // GT Metrix - Vancouver 9.
'204.187.14.78' => '', // GT Metrix - Vancouver 10.
'199.10.31.194' => '', // GT Metrix - Vancouver 11.
'13.85.80.124' => '', // GT Metrix - Dallas 1.
'13.84.146.132' => '', // GT Metrix - Dallas 2.
'13.84.146.226' => '', // GT Metrix - Dallas 3.
'40.74.254.217' => '', // GT Metrix - Dallas 4.
'13.84.43.227' => '', // GT Metrix - Dallas 5.
'172.255.61.34' => '', // GT Metrix - London 1.
'172.255.61.35' => '', // GT Metrix - London 2.
'172.255.61.36' => '', // GT Metrix - London 3.
'172.255.61.37' => '', // GT Metrix - London 4.
'172.255.61.38' => '', // GT Metrix - London 5.
'172.255.61.39' => '', // GT Metrix - London 6.
'172.255.61.40' => '', // GT Metrix - London 7.
'13.70.66.20' => '', // GT Metrix - Sydney.
'191.235.85.154' => '', // GT Metrix - São Paulo 1.
'191.235.86.0' => '', // GT Metrix - São Paulo 2.
'52.66.75.147' => '', // GT Metrix - Mumbai.
'52.175.28.116' => '', // GT Metrix - Hong Kong.
];
if ( isset( $ips[ $this->get_ip() ] ) ) {
return self::memoize( __FUNCTION__, [], true );
}
if ( ! $this->config->get_server_input( 'HTTP_USER_AGENT' ) ) {
return self::memoize( __FUNCTION__, [], false );
}
$user_agent = preg_match( '#PingdomPageSpeed|DareBoost|Google|PTST|Chrome-Lighthouse|WP Rocket#i', $this->config->get_server_input( 'HTTP_USER_AGENT' ) );
return self::memoize( __FUNCTION__, [], (bool) $user_agent );
}
/**
* Determines if SSL is used.
* This is basically a copy of the WP function, where $_SERVER is not used directly.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return bool True if SSL, otherwise false.
*/
public function is_ssl() {
if ( null !== $this->config->get_server_input( 'HTTPS' ) ) {
if ( 'on' === strtolower( $this->config->get_server_input( 'HTTPS' ) ) ) {
return true;
}
if ( '1' === (string) $this->config->get_server_input( 'HTTPS' ) ) {
return true;
}
} elseif ( '443' === (string) $this->config->get_server_input( 'SERVER_PORT' ) ) {
return true;
}
return false;
}
/** ----------------------------------------------------------------------------------------- */
/** REQUEST URI AND METHOD ================================================================== */
/** ----------------------------------------------------------------------------------------- */
/**
* Get the request URI.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return string
*/
public function get_raw_request_uri() {
if ( '' === $this->config->get_server_input( 'REQUEST_URI', '' ) ) {
return '';
}
return '/' . ltrim( $this->config->get_server_input( 'REQUEST_URI' ), '/' );
}
/**
* Get the request URI without the query strings.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return string
*/
public function get_request_uri_base() {
$request_uri = $this->get_raw_request_uri();
if ( ! $request_uri ) {
return '';
}
$request_uri = explode( '?', $request_uri );
return reset( $request_uri );
}
/**
* Get the request URI. The query string is sorted and some parameters are removed.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return string
*/
public function get_clean_request_uri() {
$request_uri = $this->get_request_uri_base();
if ( ! $request_uri ) {
return '';
}
$query_string = $this->get_query_string();
if ( ! $query_string ) {
return $request_uri;
}
return $request_uri . '?' . $query_string;
}
/**
* Get the request method.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return string
*/
public function get_request_method() {
if ( '' === $this->config->get_server_input( 'REQUEST_METHOD', '' ) ) {
return '';
}
return strtoupper( $this->config->get_server_input( 'REQUEST_METHOD' ) );
}
/** ----------------------------------------------------------------------------------------- */
/** QUERY STRING ============================================================================ */
/** ----------------------------------------------------------------------------------------- */
/**
* Get the query string as an array. Parameters are sorted and some are removed.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return array
*/
public function get_query_params() {
if ( ! self::$get ) {
return [];
}
// Remove some parameters.
$params = array_diff_key(
self::$get,
$this->config->get_config( 'cache_ignored_parameters' )
);
if ( $params ) {
ksort( $params );
}
return $params;
}
/**
* Get the query string with sorted parameters, and some other removed.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return string
*/
public function get_query_string() {
return http_build_query( $this->get_query_params() );
}
/** ----------------------------------------------------------------------------------------- */
/** PROPERTY GETTERS ======================================================================== */
/** ----------------------------------------------------------------------------------------- */
/**
* Get the `cookies` property.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return array
*/
public function get_cookies() {
return self::$cookies;
}
/**
* Get the `post` property.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return array
*/
public function get_post() {
return self::$post;
}
/**
* Get the `get` property.
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return array
*/
public function get_get() {
return self::$get;
}
/** ----------------------------------------------------------------------------------------- */
/** ERRORS ================================================================================== */
/** ----------------------------------------------------------------------------------------- */
/**
* Set an "error".
*
* @since 3.3
* @access protected
* @author Grégory Viguier
*
* @param string $message A message.
* @param array $data Related data.
*/
protected function set_error( $message, $data = [] ) {
$this->last_error = [
'message' => $message,
'data' => (array) $data,
];
}
/**
* Get the last "error".
*
* @since 3.3
* @access public
* @author Grégory Viguier
*
* @return array
*/
public function get_last_error() {
return array_merge(
[
'message' => '',
'data' => [],
],
(array) $this->last_error
);
}
}
Fatal error: Uncaught Error: Class 'WP_Rocket\Buffer\Tests' not found in /home/payon/public_html/wp-content/advanced-cache.php:56
Stack trace:
#0 /home/payon/public_html/wp-settings.php(95): include()
#1 /home/payon/public_html/wp-config.php(92): require_once('/home/payon/pub...')
#2 /home/payon/public_html/wp-load.php(50): require_once('/home/payon/pub...')
#3 /home/payon/public_html/wp-blog-header.php(13): require_once('/home/payon/pub...')
#4 /home/payon/public_html/index.php(17): require('/home/payon/pub...')
#5 {main}
thrown in /home/payon/public_html/wp-content/advanced-cache.php on line 56