[ Index ] |
PHP Cross Reference of Unnamed Project |
[Source view] [Print] [Project Stats]
Class HTTP_Encoder
File Size: | 335 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
HTTP_Encoder:: (9 methods):
__construct()
getContent()
getHeaders()
sendHeaders()
sendAll()
getAcceptedEncoding()
encode()
output()
isBuggyIe()
Class: HTTP_Encoder - X-Ref
Encode and send gzipped/deflated content__construct($spec) X-Ref |
Get an HTTP Encoder object param: array $spec options |
getContent() X-Ref |
Get content in current form Call after encode() for encoded content. return: string |
getHeaders() X-Ref |
Get array of output headers to be sent E.g. <code> array( 'Content-Length' => '615' ,'Content-Encoding' => 'x-gzip' ,'Vary' => 'Accept-Encoding' ) </code> return: array |
sendHeaders() X-Ref |
Send output headers You must call this before headers are sent and it probably cannot be used in conjunction with zlib output buffering / mod_gzip. Errors are not handled purposefully. |
sendAll() X-Ref |
Send output headers and content A shortcut for sendHeaders() and echo getContent() You must call this before headers are sent and it probably cannot be used in conjunction with zlib output buffering / mod_gzip. Errors are not handled purposefully. |
getAcceptedEncoding($allowCompress = true, $allowDeflate = true) X-Ref |
Determine the client's best encoding method from the HTTP Accept-Encoding header. If no Accept-Encoding header is set, or the browser is IE before v6 SP2, this will return ('', ''), the "identity" encoding. A syntax-aware scan is done of the Accept-Encoding, so the method must be non 0. The methods are favored in order of gzip, deflate, then compress. Deflate is always smallest and generally faster, but is rarely sent by servers, so client support could be buggier. param: bool $allowCompress allow the older compress encoding param: bool $allowDeflate allow the more recent deflate encoding return: array two values, 1st is the actual encoding method, 2nd is the |
encode($compressionLevel = null) X-Ref |
Encode (compress) the content If the encode method is '' (none) or compression level is 0, or the 'zlib' extension isn't loaded, we return false. Then the appropriate gz_* function is called to compress the content. If this fails, false is returned. The header "Vary: Accept-Encoding" is added. If encoding is successful, the Content-Length header is updated, and Content-Encoding is also added. param: int $compressionLevel given to zlib functions. If not given, the return: bool success true if the content was actually compressed |
output($content, $compressionLevel = null) X-Ref |
Encode and send appropriate headers and content This is a convenience method for common use of the class param: string $content param: int $compressionLevel given to zlib functions. If not given, the return: bool success true if the content was actually compressed |
isBuggyIe() X-Ref |
Is the browser an IE version earlier than 6 SP2? return: bool |
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |