* @author David Coallier * @author Marek Kuziel * @param string * @access private */ private function compressText($output) { $encoding = false; if (function_exists('crc32') && function_exists('gzcompress')) { if (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) { $encoding = 'x-gzip'; } if (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) { $encoding = 'gzip'; } if ($encoding) { @header('Content-Encoding: ' . $encoding); if (function_exists('gzencode')) { $output = gzencode($output, intval($this->gzip)); } else { $output = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff" . substr(gzcompress($output, $level), 2, -4) . pack('V', crc32($output)) . pack('V', strlen($output)); } } } else { return new XML_Feed_Writer_Exception("Error: compress methods (crc32, gzcompress) are not available!"); } return $output; } // }}} // -- then later.. try { $object->compressText(...); } catch (XML_Feed_Writer_Exception $e) { XML_Feed_Writer_Exception::raiseError($e->getMessage()); } ?>