Revision: 52437
Author:   siebrand
Date:     2009-06-26 07:19:40 +0000 (Fri, 26 Jun 2009)

Log Message:
-----------
* remove period from description message
* update indentation, remove trailing whitespace, stylize.php (except for 
jsmin.php)
* use a variable instead of dirname( __FILE__ ) multiple times.
* bumped version

Modified Paths:
--------------
    trunk/extensions/Minify/COPYING
    trunk/extensions/Minify/Minify.i18n.php
    trunk/extensions/Minify/Minify.php
    trunk/extensions/Minify/Minify_body.php

Modified: trunk/extensions/Minify/COPYING
===================================================================
--- trunk/extensions/Minify/COPYING     2009-06-26 07:07:00 UTC (rev 52436)
+++ trunk/extensions/Minify/COPYING     2009-06-26 07:19:40 UTC (rev 52437)
@@ -4,7 +4,7 @@
 The CSS compressor is a Java to PHP port of code by Julien Lecomte and Isaac 
Schlueter
 which was released in the BSD license.
 
-The JSMin module contained in jsmin.php was written by Ryan Grove under the 
MIT License 
+The JSMin module contained in jsmin.php was written by Ryan Grove under the 
MIT License
 and is ported from code by Daniel Crockford, see jsmin.php for details.
 
 -------------------------------------------------------------------------------
@@ -13,20 +13,20 @@
 
 Copyright (c) 2009 Robert Rohde
 
-Redistribution and use of this software in source and binary forms, with or 
without modification, are permitted 
+Redistribution and use of this software in source and binary forms, with or 
without modification, are permitted
 provided that the following conditions are met:
 
     * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the
       following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
notice, this list of conditions and the 
+    * Redistributions in binary form must reproduce the above copyright 
notice, this list of conditions and the
 following disclaimer in the documentation and/or other materials provided with 
the distribution.
-    * Neither the name of the software nor the names of its contributors may 
be used to endorse or promote products 
+    * Neither the name of the software nor the names of its contributors may 
be used to endorse or promote products
 derived from this software without specific prior written permission of the 
copyright holder.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, 
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR 
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, 
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Modified: trunk/extensions/Minify/Minify.i18n.php
===================================================================
--- trunk/extensions/Minify/Minify.i18n.php     2009-06-26 07:07:00 UTC (rev 
52436)
+++ trunk/extensions/Minify/Minify.i18n.php     2009-06-26 07:19:40 UTC (rev 
52437)
@@ -12,7 +12,7 @@
  * @author Robert Rohde
  */
 $messages['en'] = array(
-       'minify-desc' => 'Shrinks CSS and Javascript output from action=raw.',
+       'minify-desc' => 'Shrinks CSS and Javascript output from action=raw',
 );
 
 /** Message documentation (Message documentation)

Modified: trunk/extensions/Minify/Minify.php
===================================================================
--- trunk/extensions/Minify/Minify.php  2009-06-26 07:07:00 UTC (rev 52436)
+++ trunk/extensions/Minify/Minify.php  2009-06-26 07:19:40 UTC (rev 52437)
@@ -1,33 +1,32 @@
 <?php
-
 /*
  * Minify bundles the YUI CSS compressor by Julien Lecomte and Isaac Schlueter 
with
  * the JSMin Javascript compressor by Douglass Crockford and Ryan Grove.
  *
  * When installed it automatically catches calls to RawPage.php and 
pre-compresses the
- * CSS and Javascript output generated there.  This can significantly reduce 
the size of 
+ * CSS and Javascript output generated there.  This can significantly reduce 
the size of
  * CSS and Javascript files that are dynamically returned by Mediawiki, such as
  * Mediawiki:Common.css and Mediawiki:Common.js.  However, it does not affect 
the static
- * files living in /skins/, etc.  
+ * files living in /skins/, etc.
  */
 
 $wgExtensionCredits['other'][] = array(
        'name'            => 'Minify',
-       'version'         => '0.8.0', // June 22, 2009
+       'version'         => '0.8.1', // June 26, 2009
        'description'     => 'Compresses CSS and JS from action=raw',
        'descriptionmsg'  => 'minify-desc',
        'author'          => 'Robert Rohde',
-       'url'             => 'http://www.mediawiki.org/wiki/Extension:Minify',
-       'path'            => __FILE__,
+       'url'             => 'http://www.mediawiki.org/wiki/Extension:Minify',
+       'path'            => __FILE__,
 );
 
-$wgAutoloadClasses['Minify'] = 
-       dirname( __FILE__ ) . '/Minify_body.php';
-$wgAutoloadClasses['JSMin'] = 
-       dirname( __FILE__ ) . '/jsmin.php';
+$dir = dirname( __FILE__ ) . '/';
 
+$wgAutoloadClasses['Minify'] = $dir . 'Minify_body.php';
+$wgAutoloadClasses['JSMin'] = $dir . 'jsmin.php';
+
 $wgHooks['RawPageViewBeforeOutput'][] = 'wfMinify';
-$wgExtensionMessagesFiles['Minify'] = dirname( __FILE__ ) . '/Minify.i18n.php';
+$wgExtensionMessagesFiles['Minify'] = $dir . 'Minify.i18n.php';
 
 function wfMinify( &$rawPage, &$text ) {
 

Modified: trunk/extensions/Minify/Minify_body.php
===================================================================
--- trunk/extensions/Minify/Minify_body.php     2009-06-26 07:07:00 UTC (rev 
52436)
+++ trunk/extensions/Minify/Minify_body.php     2009-06-26 07:19:40 UTC (rev 
52437)
@@ -5,11 +5,11 @@
        var $mType;
 
        // Initialize
-       function Minify( $text ){
+       function Minify( $text ) {
                global $wgRequest;
 
                $this->mType = $wgRequest->getVal( 'ctype' );
-               if( $this->mType == '' ) {
+               if ( $this->mType == '' ) {
                        $this->mType = $wgRequest->getVal( 'gen' );
                }
                $this->mText = $text;
@@ -17,12 +17,12 @@
 
        // Perform operations
        function run() {
-               if( strlen( $this->mText ) == 0 ) { return; }
+               if ( strlen( $this->mText ) == 0 ) { return; }
 
                switch( $this->mType ) {
 
                case 'text/css':
-               case 'css': 
+               case 'css':
                        $this->runCSS();
                        break;
 
@@ -32,14 +32,14 @@
                        break;
                }
 
-               return $this->mText;            
+               return $this->mText;
        }
 
        /*
         * Port of the Java based YUI CSS compressor written by Julien Lecomte 
<jleco...@yahoo-inc.com>
         * Code under the BSD license
         * http://developer.yahoo.com/yui/compressor/
-        * 
+        *
         * The YUI compressor was in turn a port of cssmin by Isaac Schlueter.
         */
        function runCSS() {
@@ -50,36 +50,36 @@
                $startIndex = 0;
                $iemac = false;
                $preserve = false;
-               while( ( $startIndex = strpos( $text, "/*", $startIndex ) ) !== 
false ) {
-                       $preserve = (strlen($text) > $startIndex + 2);
-                       if( $preserve ) {
-                               $preserve = ($text[$startIndex + 2] == '!'); 
+               while ( ( $startIndex = strpos( $text, "/*", $startIndex ) ) 
!== false ) {
+                       $preserve = ( strlen( $text ) > $startIndex + 2 );
+                       if ( $preserve ) {
+                               $preserve = ( $text[$startIndex + 2] == '!' );
                        }
                        $endIndex = strpos( $text, "*/", $startIndex + 2 );
-                       if( $endIndex === false ) {
-                               if( !$preserve ) {
+                       if ( $endIndex === false ) {
+                               if ( !$preserve ) {
                                        $text = substr_replace( $text, "", 
$startIndex, strlen( $text ) );
                                        break;
                                }
                        } else {
-                               if( $text[$endIndex-1] == "\\" ) {
+                               if ( $text[$endIndex - 1] == "\\" ) {
                                        // Looks for IE Mac style conditional 
CSS.
                                        // If found, leaves the conditional 
"comment" in place
 
                                        $startIndex = $endIndex + 2;
                                        $iemac = true;
-                               } elseif( $iemac ) {
+                               } elseif ( $iemac ) {
                                        $startIndex = $endIndex + 2;
                                        $iemac = false;
-                               } elseif( !$preserve ) {
-                                       $text = substr_replace( $text, "", 
$startIndex, $endIndex+2-$startIndex );
+                               } elseif ( !$preserve ) {
+                                       $text = substr_replace( $text, "", 
$startIndex, $endIndex + 2 - $startIndex );
                                } else {
                                        $startIndex = $endIndex + 2;
                                }
                        }
                }
 
-               // Normalize all consecutive whitespace to single spaces.       
        
+               // Normalize all consecutive whitespace to single spaces.
                $text = preg_replace( "/\\s+/u", " ", $text );
 
                // Make a pseudo class for the Box Model Hack
@@ -88,46 +88,46 @@
                // Munge the special case of psuedo-class colons in CSS 
identifier string.
                // e.g. p :link { ... } != p:link {...}
                $matches = array();
-               preg_match_all("/(^|\\})(([^\\{:])+:)+([^\\{]*\\{)/", $text, 
$matches );
-               foreach( $matches[0] as $m ) {
+               preg_match_all( "/(^|\\})(([^\\{:])+:)+([^\\{]*\\{)/", $text, 
$matches );
+               foreach ( $matches[0] as $m ) {
                        $m2 = str_replace( ":", "___PSEUDOCLASSCOLON___", $m );
                        $text = str_replace( $m, $m2, $text );
                }
 
                // Remove spaces before identifier that don't require them,
                // and restored the munged colons.
-               $text = preg_replace("/\\s+([!{};:>+\\(\\)\\],])/", "\\1", 
$text);
-               $text = str_replace("___PSEUDOCLASSCOLON___", ":", $text);
+               $text = preg_replace( "/\\s+([!{};:>+\\(\\)\\],])/", "\\1", 
$text );
+               $text = str_replace( "___PSEUDOCLASSCOLON___", ":", $text );
 
                // Remove spaces that follow things which don't require them.
-               $text = preg_replace("/([!{}:;>+\\(\\[,])\\s+/", "\\1", $text);
+               $text = preg_replace( "/([!{}:;>+\\(\\[,])\\s+/", "\\1", $text 
);
 
                // Add semicolons at end of statements where missing.
-               $text = preg_replace("/([^;\\}])}/", "\\1;}", $text);
+               $text = preg_replace( "/([^;\\}])}/", "\\1;}", $text );
 
                // Replace "0px" with "0", etc.
-               $text = 
preg_replace("/([\\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)/", "\\1\\2", $text);
+               $text = preg_replace( 
"/([\\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)/", "\\1\\2", $text );
 
                // Collapse redundant zeroes.
-               $text = str_replace(":0 0 0 0;", ":0;", $text);
-               $text = str_replace(":0 0 0;", ":0;", $text);
-               $text = str_replace(":0 0;", ":0;", $text);
+               $text = str_replace( ":0 0 0 0;", ":0;", $text );
+               $text = str_replace( ":0 0 0;", ":0;", $text );
+               $text = str_replace( ":0 0;", ":0;", $text );
 
                // Restore special case of background-position.
-               $text = str_replace("background-position:0;", 
"background-position:0 0;", $text);
+               $text = str_replace( "background-position:0;", 
"background-position:0 0;", $text );
 
                // Replace 0.### with .### where appropriate.
-               $text = preg_replace("/(:|\\s)0+\\.(\\d+)/", "\\1.\\2", $text);
+               $text = preg_replace( "/(:|\\s)0+\\.(\\d+)/", "\\1.\\2", $text 
);
 
                // Rewrite "rgb( x, y, z )" expressions in "#ABCDEF" form.
                $matches = array();
-               preg_match_all("/rgb\\s*\\(\\s*([0-9,\\s]+)\\s*\\)/", $text, 
$matches );
-               foreach( $matches[0] as $k => $m ) {
+               preg_match_all( "/rgb\\s*\\(\\s*([0-9,\\s]+)\\s*\\)/", $text, 
$matches );
+               foreach ( $matches[0] as $k => $m ) {
                        $hex = "#";
                        $rgb = explode( "," , $matches[1][$k] );
-                       foreach( $rgb as $value ) {
-                               $value = intval($value);
-                               if( $value < 16 ) {
+                       foreach ( $rgb as $value ) {
+                               $value = intval( $value );
+                               if ( $value < 16 ) {
                                        $hex .= "0";
                                }
                                $hex .= dechex( $value );
@@ -136,11 +136,11 @@
                }
 
                // Collapse #AABBCC into #ABC.  Prefix codes avoid cases where 
this format is not okay.
-               $text = 
preg_replace("/([^\"'=\\s])(\\s*)#([0-9a-fA-F])\\3([0-9a-fA-F])\\4([0-9a-fA-F])\\5/i",
+               $text = preg_replace( 
"/([^\"'=\\s])(\\s*)#([0-9a-fA-F])\\3([0-9a-fA-F])\\4([0-9a-fA-F])\\5/i",
                                "\\1\\2#\\3\\4\\5", $text );
 
                // Remove empty rules.
-               $text = preg_replace("/[^\\}]+\\{;\\}/", "", $text);
+               $text = preg_replace( "/[^\\}]+\\{;\\}/", "", $text );
 
                // Restore the Box Model Hack
                $text = str_replace( "___PSEUDOCLASSBMH___", 
"\"\\\\\"}\\\\\"\"", $text );
@@ -155,14 +155,14 @@
        }
 
        /*
-        * Calls Ryan Grove's PHP port of 
+        * Calls Ryan Grove's PHP port of
         * Douglas Crockford's JSMin, see jsmin.php for details
         */
        function runJS() {
                try {
                        $this->mText = JSMin::minify( $this->mText );
-               } catch (JSMinException $e) {
+               } catch ( JSMinException $e ) {
                        // Do nothing.  Text will be passed uncompressed.
-               }       
+               }
        }
 }



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to