Advertisement
joris

Kompres

Jul 19th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class Kompres {
  4.     function compress(){
  5.         $CI =& get_instance();
  6.         $buffer = $CI->output->get_output();
  7.    
  8.     $search = array(
  9.         '/\>[^\S ]+/s',
  10.         '/[^\S ]+\</s',
  11.         '/(\s)+/s',
  12.         '#(?://)?<!\[CDATA\[(.*?)(?://)?\]\]>#s'
  13.     );
  14.    
  15.     $replace = array(
  16.         '>',
  17.         '<',
  18.         '\\1',
  19.         "//<;![CDATA[\n".'\1'."\n//]]>"
  20.     );
  21.    
  22.     $buffer = preg_replace($search, $replace, $buffer);
  23.     $CI->output->set_output($buffer);
  24.     $CI->output->_display();
  25.     }
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement