Advertisement
Guest User

Untitled

a guest
Sep 12th, 2013
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <?php
  2. //
  3. //  FPDM - Filter Flate
  4. //  NOTE: requires ZLIB >= 1.0.9!
  5. //
  6.  
  7. $__tmp = version_compare(phpversion(), "5") == -1 ? array('FilterFlateDecode') : array('FilterFlateDecode', false);
  8. if (!call_user_func_array('class_exists', $__tmp)) {
  9.  
  10.  
  11.     if(isset($FPDM_FILTERS)) array_push($FPDM_FILTERS,"FlateDecode");
  12.  
  13.     class FilterFlate {
  14.        
  15.         var $data = null;
  16.         var $dataLength = 0;
  17.    
  18.         function error($msg) {
  19.             die($msg);
  20.         }
  21.        
  22.         /**
  23.          * Method to decode GZIP compressed data.
  24.          *
  25.          * @param string data    The compressed data.
  26.          * @return uncompressed data
  27.          */
  28.         function decode($data) {
  29.    
  30.             $this->data = $data;
  31.             $this->dataLength = strlen($data);
  32.    
  33.             // uncompress
  34.             $data=gzuncompress($data);
  35.            
  36.             if(!$data) $this->error("FilterFlateDecode: invalid stream data.");
  37.              
  38.             return $data;
  39.         }
  40.        
  41.        
  42.         function encode($in) {
  43.             return gzcompress($in, 9);
  44.         }
  45.    }
  46.  
  47. }
  48. //unset $__tmp;
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement