[ Index ]

PHP Cross Reference of WordPress




/wp-includes/ -> class-wp-http-encoding.php (summary)

HTTP API: WP_Http_Encoding class

File Size: 233 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Http_Encoding:: (7 methods):

Class: WP_Http_Encoding  - X-Ref

Core class used to implement deflate and gzip transfer encoding support for HTTP requests.

Includes RFC 1950, RFC 1951, and RFC 1952.

compress( $raw, $level = 9, $supports = null )   X-Ref
Compress raw string using the deflate format.

Supports the RFC 1951 standard.

since: 2.8.0
param: string $raw      String to compress.
param: int    $level    Optional. Compression level, 9 is highest. Default 9.
param: string $supports Optional, not used. When implemented it will choose
return: string|false Compressed string on success, false on failure.

decompress( $compressed, $length = null )   X-Ref
Decompression of deflated string.

Will attempt to decompress using the RFC 1950 standard, and if that fails
then the RFC 1951 standard deflate will be attempted. Finally, the RFC
1952 standard gzip decode will be attempted. If all fail, then the
original compressed string will be returned.

since: 2.8.0
param: string $compressed String to decompress.
param: int    $length     The optional length of the compressed data.
return: string|false Decompressed string on success, false on failure.

compatible_gzinflate( $gzData )   X-Ref
Decompression of deflated string while staying compatible with the majority of servers.

Certain Servers will return deflated data with headers which PHP's gzinflate()
function cannot handle out of the box. The following function has been created from
various snippets on the gzinflate() PHP documentation.

Warning: Magic numbers within. Due to the potential different formats that the compressed
data may be returned in, some "magic offsets" are needed to ensure proper decompression
takes place. For a simple progmatic way to determine the magic offset in use, see:

since: 2.8.1
param: string $gzData String to decompress.
return: string|false Decompressed string on success, false on failure.

accept_encoding( $url, $args )   X-Ref
What encoding types to accept and their priority values.

since: 2.8.0
param: string $url
param: array  $args
return: string Types of encoding to accept.

content_encoding()   X-Ref
What encoding the content used when it was compressed to send in the headers.

since: 2.8.0
return: string Content-Encoding string to send in the header.

should_decode( $headers )   X-Ref
Whether the content be decoded based on the headers.

since: 2.8.0
param: array|string $headers All of the available headers.
return: bool

is_available()   X-Ref
Whether decompression and compression are supported by the PHP version.

Each function is tested instead of checking for the zlib extension, to
ensure that the functions all exist in the PHP version and aren't

since: 2.8.0
return: bool

Generated: Fri May 14 01:00:04 2021 Cross-referenced by PHPXref 0.7.1