[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
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 |
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.compress( $raw, $level = 9, $supports = null ) X-Ref |
Compress raw string using the deflate format. Supports the RFC 1951 standard. 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. since: 2.8.0 |
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. 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. since: 2.8.0 |
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 param: string $gz_data String to decompress. return: string|false Decompressed string on success, false on failure. since: 2.8.1 |
accept_encoding( $url, $args ) X-Ref |
What encoding types to accept and their priority values. param: string $url param: array $args return: string Types of encoding to accept. since: 2.8.0 |
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. since: 2.8.0 |
should_decode( $headers ) X-Ref |
Whether the content be decoded based on the headers. param: array|string $headers All of the available headers. return: bool since: 2.8.0 |
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 since: 2.8.0 |
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |