Zikula 1.0.1
[ class tree: Zikula 1.0.1 ] [ index: Zikula 1.0.1 ] [ all elements ]

Source for file adodb-compress-gzip.php

Documentation is available at adodb-compress-gzip.php

  1. <?php
  2.  
  3.  
  4. /*
  5. V4.97 22 Jan 2008  (c) 2000-2008 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.     /**
  22.      */
  23.     var $_level = null;
  24.  
  25.     /**
  26.      */
  27.     var $_min_length = 1;
  28.  
  29.     /**
  30.      */
  31.     function getLevel({
  32.         return $this->_level;
  33.     }
  34.  
  35.     /**
  36.      */
  37.     function setLevel($level{
  38.         assert('$level >= 0');
  39.         assert('$level <= 9');
  40.         $this->_level = (int) $level;
  41.     }
  42.  
  43.     /**
  44.      */
  45.     function getMinLength({
  46.         return $this->_min_length;
  47.     }
  48.  
  49.     /**
  50.      */
  51.     function setMinLength($min_length{
  52.         assert('$min_length >= 0');
  53.         $this->_min_length = (int) $min_length;
  54.     }
  55.  
  56.     /**
  57.      */
  58.     function ADODB_Compress_Gzip($level null$min_length null{
  59.         if (!is_null($level)) {
  60.             $this->setLevel($level);
  61.         }
  62.  
  63.         if (!is_null($min_length)) {
  64.             $this->setMinLength($min_length);
  65.         }
  66.     }
  67.  
  68.     /**
  69.      */
  70.     function write($data$key{
  71.         if (strlen($data$this->_min_length{
  72.             return $data;
  73.         }
  74.  
  75.         if (!is_null($this->_level)) {
  76.             return gzcompress($data$this->_level);
  77.         else {
  78.             return gzcompress($data);
  79.         }
  80.     }
  81.  
  82.     /**
  83.      */
  84.     function read($data$key{
  85.         return $data gzuncompress($data$data;
  86.     }
  87.  
  88. }
  89.  
  90. return 1;
  91.  
  92. ?>

Documentation generated on Fri, 18 Jul 2008 21:39:07 +0200 by phpDocumentor 1.4.1