extension/ezjscore/classes/ezjscjavascriptoptimizer.php
public static function optimize( $script, $packLevel = 2 )
    {
        // Normalize line feeds
        $script = str_replace( array( "\r\n", "\r" ), "\n", $script );

        // Remove whitespace from start & end of line + singelline comment + multiple linefeeds
        $script = preg_replace( array( '/\n\s+/', '/\s+\n/', '#\n\s*//.*#', '/\n+/' ), "\n", $script );

        // Remove multiline comments
        $script = preg_replace( '!(?:\n|\s|^)/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $script );
        $script = preg_replace( '!(?:;)/\*[^*]*\*+([^/][^*]*\*+)*/!', ';', $script );

        return $script;
    }
public static function optimize( $script, $packLevel = 2 )
    {
        // Normalize line feeds
        $script = str_replace( array( "\r\n", "\r" ), "\n", $script );

        // Remove whitespace from start & end of line + singelline comment + multiple linefeeds
        $script = preg_replace( array( '/\n\s+/', '/\s+\n/', '#\n\s*//.*#', '/\n+/' ), "\n", $script );

        // Remove multiline comments
        $script = preg_replace( '!(?:\n|\s|^)/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $script );
        $script = preg_replace( '!(?:;)/\*[^*]*\*+([^/][^*]*\*+)*/!', ';', $script );

        return $script;
    }
public static function optimize ( $ script , $ packLevel = 2 ) { // Normalize line feeds $ script = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ script ) ; // Remove whitespace from start & end of line + singelline comment + multiple linefeeds $ script = preg_replace ( array ( '/\n\s+/' , '/\s+\n/' , '#\n\s*//.*#' , '/\n+/' ) , "\n" , $ script ) ; // Remove multiline comments $ script = preg_replace ( '!(?:\n|\s|^)/\*[^*]*\*+([^/][^*]*\*+)*/!' , '' , $ script ) ; $ script = preg_replace ( '!(?:;)/\*[^*]*\*+([^/][^*]*\*+)*/!' , ';' , $ script ) ; return $ script ; }
'compress' javascript code by removing whitespace

@param string $script Concated JavaScript string
@param int $packLevel Level of packing, values: 2-3
@return string
compress javascript code by removing whitespace