Source code for file /pattemplate/patTemplate/OutputFilter/Gzip.php
Documentation is available at Gzip.php
* patTemplate GZip output filter
* $Id: Gzip.php 359 2005-02-18 19:01:54Z schst $
* Checks the accept encoding of the browser and
* compresses the data before sending it to the client.
// Check to ensure this file is within the rest of the framework
* patTemplate GZip output filter
* $Id: Gzip.php 359 2005-02-18 19:01:54Z schst $
* Checks the accept encoding of the browser and
* compresses the data before sending it to the client.
* This has to be set in the final
* @return string compressed data
if (!$this->_clientSupportsGzip()) {
$data .=
$this->_gfc( $crc );
$data .=
$this->_gfc( $size );
header( 'Content-Encoding: gzip' );
$data =
"\x1f\x8b\x08\x00\x00\x00\x00\x00" .
$data;
* check, whether client supports compressed data
function _clientSupportsGzip()
if (!isset
($_SERVER['HTTP_ACCEPT_ENCODING'])) {
if (false !==
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
* get value as hex-string
* @param integer $value value to convert
* @return string $string converted string
for ($i =
0; $i <
4; $i ++
) {
$str .=
chr( $value %
256 );
$value =
floor( $value /
256 );