includes/clientside/jsres.php
changeset 1301 bd9e124f5904
parent 1295 3c9c1b18567b
equal deleted inserted replaced
1300:1f97ee3ec614 1301:bd9e124f5904
    93 	'flyin.js',
    93 	'flyin.js',
    94 	'rank-manager.js',
    94 	'rank-manager.js',
    95 	'userpage.js',
    95 	'userpage.js',
    96 	'template-compiler.js',
    96 	'template-compiler.js',
    97 	'toolbar.js',
    97 	'toolbar.js',
       
    98 	'upload.js'
    98 );
    99 );
    99 
   100 
   100 // Files that should NOT be compressed due to already being compressed, licensing, or invalid produced code
   101 // Files that should NOT be compressed due to already being compressed, licensing, or invalid produced code
   101 $compress_unsafe = array('json.js', 'fat.js', 'admin-menu.js', 'autofill.js', 'jquery.js', 'jquery-ui.js');
   102 $compress_unsafe = array('json.js', 'fat.js', 'admin-menu.js', 'autofill.js', 'jquery.js', 'jquery-ui.js');
   102 
   103 
   103 require_once('includes/js-compressor.php');
   104 require_once('includes/js-compressor.php');
   104 
   105 
   105 // try to gzip the output
   106 // try to gzip the output
   106 if ( !defined('ENANO_JSRES_SETUP_ONLY') ):
   107 if ( !defined('ENANO_JSRES_SETUP_ONLY') ):
   107 $do_gzip = false;
   108 $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 
   109 
   119 // Output format will always be JS
   110 // Output format will always be JS
   120 header('Content-type: text/javascript');
   111 header('Content-type: text/javascript');
   121 
   112 
   122 endif; // ENANO_JSRES_SETUP_ONLY
   113 endif; // ENANO_JSRES_SETUP_ONLY
   269 
   260 
   270 $local_end = microtime_float();
   261 $local_end = microtime_float();
   271 $local_gentime = $local_end - $local_start;
   262 $local_gentime = $local_end - $local_start;
   272 $local_gentime = round($local_gentime, 5);
   263 $local_gentime = round($local_gentime, 5);
   273 header("X-Performance: generated in $local_gentime seconds");
   264 header("X-Performance: generated in $local_gentime seconds");
       
   265 
       
   266 if ( $do_gzip )
       
   267 	ob_start();
   274 
   268 
   275 echo $everything;
   269 echo $everything;
   276 
   270 
   277 if ( $do_gzip )
   271 if ( $do_gzip )
   278 {
   272 {