PHP Classes

File: codeigniter/application/hooks/compress.php

Recommend this page to a friend!
  Classes of Aby Dahana   Dwitri PHP Social Network Platform   codeigniter/application/hooks/compress.php   Download  
File: codeigniter/application/hooks/compress.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Dwitri PHP Social Network Platform
Create a community site like a social network
Author: By
Last change:
Date: 3 years ago
Size: 700 bytes
 

Contents

Class file image Download
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function
compress()
{
   
$CI =& get_instance();
   
$buffer = $CI->output->get_output();

   
$search = array(
       
'/\n/', // replace end of line by a space
       
'/\>[^\S ]+/s', // strip whitespaces after tags, except space
       
'/[^\S ]+\</s', // strip whitespaces before tags, except space
        
'/(\s)+/s' // shorten multiple whitespace sequences
   
);

   
$replace = array(
       
'',
       
'>',
        
'<',
        
'\\1'
   
);

   
$buffer = preg_replace($search, $replace, $buffer);

   
$CI->output->set_output($buffer);
   
$CI->output->_display();
}

/* End of file compress.php */
/* Location: ./system/application/hooks/compress.php */