ig->get_server_input( 'REQUEST_URI' ), '/' );
}
/**
* Get the request URI without the query strings.
*
* @since 3.3
* @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
* @author Grégory Viguier
*
* @return string
*/
public function get_clean_request_uri() {
$request_uri = $this->get_request_uri_base();
$request_uri = $this->remove_dot_segments( $request_uri );
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
* @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' ) );
}
/**
* Remove dot segments from a path
*
* @param string $input Path to process.
*
* @return string
*/
private function remove_dot_segments( string $input ) {
$output = '';
while ( strpos( $input, './' ) !== false || strpos( $input, '/.' ) !== false || '.' === $input || '..' === $input ) {
/**
* A: If the input buffer begins with a prefix of "../" or "./",
* then remove that prefix from the input buffer; otherwise,
*/
if ( strpos( $input, '../' ) === 0 ) {
$input = substr( $input, 3 );
}
elseif ( strpos( $input, './' ) === 0 ) {
$input = substr( $input, 2 );
}
/**
* B: if the input buffer begins with a prefix of "/./" or "/.",
* where "." is a complete path segment, then replace that prefix
* with "/" in the input buffer; otherwise,
*/
elseif ( strpos( $input, '/./' ) === 0 ) {
$input = substr( $input, 2 );
}
elseif ( '/.' === $input ) {
$input = '/';
}
/**
* C: if the input buffer begins with a prefix of "/../" or "/..",
* where ".." is a complete path segment, then replace that prefix
* with "/" in the input buffer and remove the last segment and its
* preceding "/" (if any) from the output buffer; otherwise,
*/
elseif ( strpos( $input, '/../' ) === 0 ) {
$input = substr( $input, 3 );
$output = substr_replace( $output, '', strrpos( $output, '/' ) );
}
elseif ( '/..' === $input ) {
$input = '/';
$output = substr_replace( $output, '', strrpos( $output, '/' ) );
}
/**
* D: if the input buffer consists only of "." or "..", then remove
* that from the input buffer; otherwise,
*/
elseif ( '.' === $input || '..' === $input ) {
$input = '';
}
/**
* E: move the first path segment in the input buffer to the end of
* the output buffer, including the initial "/" character (if any)
* and any subsequent characters up to, but not including, the next
* "/" character or the end of the input buffer
*/
elseif ( strpos( $input, '/', 1 ) !== false ) {
$pos = strpos( $input, '/', 1 );
$output .= substr( $input, 0, $pos );
$input = substr_replace( $input, '', 0, $pos );
}
else {
$output .= $input;
$input = '';
}
}
return $output . $input;
}
/** ----------------------------------------------------------------------------------------- */
/** QUERY STRING ============================================================================ */
/** ----------------------------------------------------------------------------------------- */
/**
* Get the query string as an array. Parameters are sorted and some are removed.
*
* @since 3.3
* @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
* @author Grégory Viguier
*
* @return string
*/
public function get_query_string() {
return http_build_query( $this->get_query_params() );
}
/**
* Get the original query string
*
* @since 3.11.4
*
* @return string
*/
public function get_original_query_string() {
return http_build_query( $this->get_get() );
}
/** ----------------------------------------------------------------------------------------- */
/** PROPERTY GETTERS ======================================================================== */
/** ----------------------------------------------------------------------------------------- */
/**
* Get the `cookies` property.
*
* @since 3.3
* @author Grégory Viguier
*
* @return array
*/
public function get_cookies() {
return self::$cookies;
}
/**
* Get the `post` property.
*
* @since 3.3
* @author Grégory Viguier
*
* @return array
*/
public function get_post() {
return self::$post;
}
/**
* Get the `get` property.
*
* @since 3.3
* @author Grégory Viguier
*
* @return array
*/
public function get_get() {
return self::$get;
}
/** ----------------------------------------------------------------------------------------- */
/** ERRORS ================================================================================== */
/** ----------------------------------------------------------------------------------------- */
/**
* Set an "error".
*
* @since 3.3
* @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
* @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/merciket/public_html/wp-content/advanced-cache.php:97
Stack trace:
#0 /home/merciket/public_html/wp-settings.php(96): include()
#1 /home/merciket/public_html/wp-config.php(92): require_once('/home/merciket/...')
#2 /home/merciket/public_html/wp-load.php(50): require_once('/home/merciket/...')
#3 /home/merciket/public_html/wp-blog-header.php(13): require_once('/home/merciket/...')
#4 /home/merciket/public_html/index.php(17): require('/home/merciket/...')
#5 {main}
thrown in /home/merciket/public_html/wp-content/advanced-cache.php on line 97