Changeset 2237


Ignore:
Timestamp:
07/21/2008 12:23:35 PM (7 years ago)
Author:
fredck
Message:

Fixed #1242 and #1343 : Comments are now properly stripped from the code but conditional comments, which are now properly preserved.

Location:
FCKpackager/trunk/_source/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • FCKpackager/trunk/_source/includes/fckjavascriptcompressor.inc

    r2202 r2237  
    4444                // Remove "/* */" comments
    4545                $script = preg_replace(
    46                         '/(?m-s:^\s*\/\*).*?\*\//s',
     46                        '/\/\*.*?\*\//s',
    4747                        '', $script ) ;
    4848
  • FCKpackager/trunk/_source/includes/fckstringsprocessor.inc

    r2078 r2237  
    3232        function ProtectStrings( $source )
    3333        {
     34                // Catches string literals, regular expressions and conditional comments.
    3435                return preg_replace_callback(
    35                         '/(?:("|\').*?(?<!\\\\)\1|(?<![\/\\\\])\/[^\/\*].*?(?<!\\\\)\/)/',
     36                        '/(?:("|\').*?(?<!\\\\)\1)|(?:(?<![\*\/\\\\])\/[^\/\*].*?(?<!\\\\)\/(?!\s+[\w\d])(?=.*;))|(?s:\/\*@(?:cc_on|if|elif|else|end).*?@\*\/)/',
    3637                        array( &$this, '_ProtectStringsMatch' ), $source ) ;
    3738        }
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy