Documentation TYPO3 par Ameos |
00001 <?php 00002 00003 00004 /* 00005 V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved. 00006 Contributed by Ross Smith (adodb@netebb.com). 00007 Released under both BSD license and Lesser GPL library license. 00008 Whenever there is any discrepancy between the two licenses, 00009 the BSD license will take precedence. 00010 Set tabs to 4 for best viewing. 00011 00012 */ 00013 00014 if (!function_exists('gzcompress')) { 00015 trigger_error('gzip functions are not available', E_USER_ERROR); 00016 return 0; 00017 } 00018 00019 /* 00020 */ 00021 class ADODB_Compress_Gzip { 00024 var $_level = null; 00025 00028 var $_min_length = 1; 00029 00032 function getLevel() { 00033 return $this->_level; 00034 } 00035 00038 function setLevel($level) { 00039 assert('$level >= 0'); 00040 assert('$level <= 9'); 00041 $this->_level = (int) $level; 00042 } 00043 00046 function getMinLength() { 00047 return $this->_min_length; 00048 } 00049 00052 function setMinLength($min_length) { 00053 assert('$min_length >= 0'); 00054 $this->_min_length = (int) $min_length; 00055 } 00056 00059 function ADODB_Compress_Gzip($level = null, $min_length = null) { 00060 if (!is_null($level)) { 00061 $this->setLevel($level); 00062 } 00063 00064 if (!is_null($min_length)) { 00065 $this->setMinLength($min_length); 00066 } 00067 } 00068 00071 function write($data, $key) { 00072 if (strlen($data) < $this->_min_length) { 00073 return $data; 00074 } 00075 00076 if (!is_null($this->_level)) { 00077 return gzcompress($data, $this->_level); 00078 } else { 00079 return gzcompress($data); 00080 } 00081 } 00082 00085 function read($data, $key) { 00086 return $data ? gzuncompress($data) : $data; 00087 } 00088 00089 } 00090 00091 return 1; 00092 00093 ?>