[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

HTTP API: WP_Http_Encoding class

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

Defines 1 class

WP_Http_Encoding:: (7 methods):
  compress()
  decompress()
  compatible_gzinflate()
  accept_encoding()
  content_encoding()
  should_decode()
  is_available()


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.

return: string|false Compressed string on success, false on failure.
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

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.

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

compatible_gzinflate( $gz_data )   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 pragmatic way to determine the magic offset in use, see:
https://core.trac.wordpress.org/ticket/18273

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

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

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

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

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

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

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

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
disabled.

return: bool



Generated : Sat Nov 23 08:20:01 2024 Cross-referenced by PHPXref