WPSCMin/0000755000076500007650000000000011157413040011570 5ustar jhardijhardiWPSCMin/wp-super-cache.diff0000644000076500007650000000441511157412452015257 0ustar jhardijhardidiff -ur tmp/wp-super-cache/wp-cache-phase2.php wp-super-cache/wp-cache-phase2.php --- tmp/wp-super-cache/wp-cache-phase2.php 2009-02-26 13:07:08.000000000 -0800 +++ wp-super-cache/wp-cache-phase2.php 2009-03-16 01:55:13.000000000 -0700 @@ -275,12 +275,20 @@ $buffer = preg_replace('||is', '', $buffer); if( $fr ) fputs($fr, $store); + + // WP Super Cache static files are minified if option is enabled + WPSCMin::getInstance()->minify($store); + if( $fr2 ) fputs($fr2, $store . '' ); if( $gz ) fputs($gz, gzencode( $store . '', 1, FORCE_GZIP ) ); } else { $buffer = apply_filters( 'wpsupercache_buffer', $buffer ); + + // WP Super Cache static files AND wp-cache data are minified if option is enabled + WPSCMin::getInstance()->minify($buffer); + $log = "\n"; if( $gz || $wp_cache_gzip_encoding ) { diff -ur tmp/wp-super-cache/wp-cache.php wp-super-cache/wp-cache.php --- tmp/wp-super-cache/wp-cache.php 2009-02-26 13:07:08.000000000 -0800 +++ wp-super-cache/wp-cache.php 2009-03-16 01:51:06.000000000 -0700 @@ -48,6 +48,8 @@ include(WPCACHEHOME . 'wp-cache-base.php'); +// HTML Minify interface +include(WPCACHEHOME . 'WPSCMin.php'); // from legolas558 d0t users dot sf dot net at http://www.php.net/is_writable function is_writeable_ACLSafe($path) { @@ -307,6 +309,10 @@ $wp_cache_hide_donation = intval( $_POST[ 'wp_cache_hide_donation' ] ); wp_cache_replace_line('^ *\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file); } + + // HTML Minify update option + if (class_exists('WPSCMin') and isset($_POST[WPSCMin::$config_varname])) + WPSCMin::getInstance()->updateOption($_POST[WPSCMin::$config_varname], $wp_cache_config_file); } ?> @@ -431,6 +437,12 @@ echo "\n"; ?> + printOptionsForm($_SERVER['REQUEST_URI']); + ?> +

Mod Rewrite Rules

enabled = TRUE; } public static function getInstance() { if (empty(self::$instance)) self::$instance = new self(); return self::$instance; } // Minifies string referenced by $html, if $this->enabled is TRUE public function minify(& $html) { if (!$this->enabled) return; // Include Minify components unless they have already been required if (!class_exists('Minify_HTML')) { require('min/lib/Minify/HTML.php'); // Add min/lib to include_path for CSS.php to be able to find components ini_set('include_path', ini_get('include_path').':'.dirname(__FILE__).'/min/lib'); require('min/lib/Minify/CSS.php'); require('min/lib/JSMin.php'); } $html = Minify_HTML::minify($html, array('cssMinifier' => array('Minify_CSS', 'minify'), 'jsMinifier' => array('JSMin', 'minify'))); } public function updateOption($value, $config_file) { $enabled = (bool) $value; if ($enabled != $this->enabled) { $this->enabled = $enabled; $this->changed = TRUE; wp_cache_replace_line('^ *\$'.self::$config_varname, "\$".self::$config_varname." = " . var_export($enabled, TRUE) . ";", $config_file); } } public function printOptionsForm($action) { ?>

HTML Minify

Enables or disables Minify (stripping of unnecessary comments and whitespace) of cached HTML output. Disable this if you encounter any problems or need to read your source code.

changed) { echo "

HTML Minify is now "; if ($this->enabled) echo "enabled"; else echo "disabled"; echo ".

"; } echo '
'; wp_nonce_field('wp-cache'); ?>