[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/adodb/session/ -> adodb-compress-gzip.php (source)

   1  <?php
   2  
   3  
   4  /*
   5  V4.94 23 Jan 2007  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
   6           Contributed by Ross Smith (adodb@netebb.com). 
   7    Released under both BSD license and Lesser GPL library license.
   8    Whenever there is any discrepancy between the two licenses,
   9    the BSD license will take precedence.
  10        Set tabs to 4 for best viewing.
  11  
  12  */
  13  
  14  if (!function_exists('gzcompress')) {
  15      trigger_error('gzip functions are not available', E_USER_ERROR);
  16      return 0;
  17  }
  18  
  19  /*
  20  */
  21  class ADODB_Compress_Gzip {
  22      /**
  23       */
  24      var $_level = null;
  25  
  26      /**
  27       */
  28      var $_min_length = 1;
  29  
  30      /**
  31       */
  32  	function getLevel() {
  33          return $this->_level;
  34      }
  35  
  36      /**
  37       */
  38  	function setLevel($level) {
  39          assert('$level >= 0');
  40          assert('$level <= 9');
  41          $this->_level = (int) $level;
  42      }
  43  
  44      /**
  45       */
  46  	function getMinLength() {
  47          return $this->_min_length;
  48      }
  49  
  50      /**
  51       */
  52  	function setMinLength($min_length) {
  53          assert('$min_length >= 0');
  54          $this->_min_length = (int) $min_length;
  55      }
  56  
  57      /**
  58       */
  59  	function ADODB_Compress_Gzip($level = null, $min_length = null) {
  60          if (!is_null($level)) {
  61              $this->setLevel($level);
  62          }
  63  
  64          if (!is_null($min_length)) {
  65              $this->setMinLength($min_length);
  66          }
  67      }
  68  
  69      /**
  70       */
  71  	function write($data, $key) {
  72          if (strlen($data) < $this->_min_length) {
  73              return $data;
  74          }
  75  
  76          if (!is_null($this->_level)) {
  77              return gzcompress($data, $this->_level);
  78          } else {
  79              return gzcompress($data);
  80          }
  81      }
  82  
  83      /**
  84       */
  85  	function read($data, $key) {
  86          return $data ? gzuncompress($data) : $data;
  87      }
  88  
  89  }
  90  
  91  return 1;
  92  
  93  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics