Skip to content

Commit

Permalink
-Issue #2 fixed (problem with mime_content_type function).
Browse files Browse the repository at this point in the history
-gzip compression level can be set in config file.
-Content-Type of js files was changed for compatibility with all of browsers. (from application/x-javascript to text/javascript).
  • Loading branch information
farhadi committed Dec 6, 2008
1 parent 94630f8 commit 35e5af9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,3 +1,9 @@
-------------------- 1.7 beta [2008-12-06] ---------------------
2008-12-06 Ali Farhadi <ali@farhadi.ir>
* minifiers/css.php: Issue #2 fixed (problem with mime_content_type function).
* config.php: gzip compression level can be set in config file.
* index.php: Content-Type of js files was changed for compatibility with all of browsers. (from application/x-javascript to text/javascript).

-------------------- 1.6 beta [2008-06-13] ---------------------
2008-06-13 Ali Farhadi <ali@farhadi.ir>
Change log and brief documentation added.
Expand Down
2 changes: 1 addition & 1 deletion README
@@ -1,4 +1,4 @@
SmartOptimizer v1.6 beta
SmartOptimizer v1.7 beta
------------------------
Author: Ali Farhadi (http://farhadi.ir/)
Released under the terms of the GNU Public License.
Expand Down
9 changes: 6 additions & 3 deletions smartoptimizer/config.php
Expand Up @@ -13,16 +13,19 @@
//Show error messages if any error occurs (true or false)
$settings['debug'] = true;

//use it to set gzip compression On or Off
//use this to set gzip compression On or Off
$settings['gzip'] = true;

//use this to set gzip compression level (an integer between 1 and 9)
$settings['compressionLevel'] = 9;

//these types of files will not be gzipped nor minified
$settings['gzipExceptions'] = array('gif','jpeg','jpg','png','swf');

//use it to set Minifier On or Off
//use this to set Minifier On or Off
$settings['minify'] = true;

//use it to set file concatenation On or Off
//use this to set file concatenation On or Off
$settings['concatenate'] = true;

//separator for files to be concatenated
Expand Down
9 changes: 5 additions & 4 deletions smartoptimizer/index.php
@@ -1,5 +1,5 @@
<?php
/* SmartOptimizer v1.6 beta
/* SmartOptimizer v1.7 beta
* SmartOptimizer enhances your website performance using techniques
* such as compression, concatenation, minifying, caching, and embedding on demand.
*
Expand All @@ -16,7 +16,8 @@
'baseDir' => '../',
'charSet' => 'utf-8',
'debug' => true,
'gzip' => true,
'gzip' => true,
'compressionLevel' => 9,
'gzipExceptions' => array('gif','jpeg','jpg','png','swf'),
'minify' => true,
'concatenate' => true,
Expand All @@ -33,7 +34,7 @@

//mime types
$mimeTypes = array(
"js" => "application/x-javascript",
"js" => "text/javascript",
"css" => "text/css",
"htm" => "text/html",
"html" => "text/html",
Expand Down Expand Up @@ -179,7 +180,7 @@ function_exists('gzencode'));
foreach ($files as $file) (($content[] = @file_get_contents($file)) !== false) || debugExit("File not found ($file).");
$content = implode("\n", $content);
if ($settings['minify']) $content = call_user_func('minify_' . $fileType, $content);
if ($settings['gzip']) $content = gzencode($content, 9);
if ($settings['gzip']) $content = gzencode($content, $settings['compressionLevel']);
if ($settings['serverCache']) {
$handle = @fopen($cachedFile, 'w') or debugExit("Could not create cache file($cachedFile).");
fwrite($handle, $content);
Expand Down

0 comments on commit 35e5af9

Please sign in to comment.