includes/clientside/jsres.php
changeset 1290 27ab1b13a783
parent 1281 36c389769d88
child 1295 3c9c1b18567b
equal deleted inserted replaced
1289:541bb25d0b22 1290:27ab1b13a783
   102 
   102 
   103 require_once('includes/js-compressor.php');
   103 require_once('includes/js-compressor.php');
   104 
   104 
   105 // try to gzip the output
   105 // try to gzip the output
   106 if ( !defined('ENANO_JSRES_SETUP_ONLY') ):
   106 if ( !defined('ENANO_JSRES_SETUP_ONLY') ):
   107 $do_gzip = false;
   107 $do_gzip = true;
   108 if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) && getConfig('gzip_output', false) == 1 )
       
   109 {
       
   110 	$acceptenc = str_replace(' ', '', strtolower($_SERVER['HTTP_ACCEPT_ENCODING']));
       
   111 	$acceptenc = explode(',', $acceptenc);
       
   112 	if ( in_array('gzip', $acceptenc) )
       
   113 	{
       
   114 		$do_gzip = true;
       
   115 		ob_start();
       
   116 	}
       
   117 }
       
   118 
   108 
   119 // Output format will always be JS
   109 // Output format will always be JS
   120 header('Content-type: text/javascript');
   110 header('Content-type: text/javascript');
   121 
   111 
   122 endif; // ENANO_JSRES_SETUP_ONLY
   112 endif; // ENANO_JSRES_SETUP_ONLY
   269 
   259 
   270 $local_end = microtime_float();
   260 $local_end = microtime_float();
   271 $local_gentime = $local_end - $local_start;
   261 $local_gentime = $local_end - $local_start;
   272 $local_gentime = round($local_gentime, 5);
   262 $local_gentime = round($local_gentime, 5);
   273 header("X-Performance: generated in $local_gentime seconds");
   263 header("X-Performance: generated in $local_gentime seconds");
       
   264 
       
   265 if ( $do_gzip )
       
   266 	ob_start();
   274 
   267 
   275 echo $everything;
   268 echo $everything;
   276 
   269 
   277 if ( $do_gzip )
   270 if ( $do_gzip )
   278 {
   271 {