Changeset 335 for FCKpackager/trunk

Show
Ignore:
Timestamp:
2007-05-30 21:36:32 (20 months ago)
Author:
fredck
Message:

Many fixes:

  • \r\n will always be used for the compressed files generation.
  • applied changes that were wrongly done exclusively on FCKrelease with [226].
  • typos and small layout fixes.
Location:
FCKpackager/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • FCKpackager/trunk/fckpackager.php

    r156 r335  
    3434// Check the number of arguments passed. The first one is the script name. 
    3535if ( count( $argv ) > 2 ) 
    36         ExitError( 'Invalid arguments. Operation aborted' ) ; 
     36        ExitError( 'Invalid arguments. Operation aborted.' ) ; 
    3737 
    3838// Get the package definition file 
     
    4545$packager->LoadDefinitionFile( $xmlFileName ) ; 
    4646$packager->Run() ; 
     47 
    4748?> 
    4849 
     
    499500 
    500501                        // Each file terminates with a CRLF, even if compressed. 
    501                         $outputData .= "\n" ; 
     502                        $outputData .= "\r\n" ; 
    502503                } 
    503504 
  • FCKpackager/trunk/_source/includes/common.inc

    r156 r335  
    1 <?php 
     1<?php 
    22/* 
    33 * FCKpackager - JavaScript Packager and Compressor - http://www.fckeditor.net 
     
    2929function StrEndsWith( $str, $sub ) 
    3030{ 
    31    return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ; 
     31        return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ; 
    3232} 
    3333 
     
    4242function CreateDir($path, $rights = 0777) 
    4343{ 
    44         $folder_path = array( 
    45                 strstr( $path, '.' ) ? dirname( $path ) : $path ) ; 
     44        $dirParts = explode( '/', $path ) ; 
    4645 
    47         while ( !@is_dir( dirname( end( $folder_path ) ) ) 
    48                         && dirname( end( $folder_path ) ) != '/' 
    49                         && dirname( end( $folder_path ) ) != '.' 
    50                         && dirname( end( $folder_path ) ) != '' ) 
     46        $currentDir = '' ; 
     47 
     48        foreach ( $dirParts as $dirPart ) 
    5149        { 
    52                 $folder_path[] = dirname( end( $folder_path ) ) ; 
    53         } 
     50                $currentDir .= $dirPart . '/' ; 
    5451 
    55         while ( $parent_folder_path = array_pop( $folder_path ) ) 
    56         { 
    57                 if ( !@mkdir( $parent_folder_path, $rights ) ) 
    58                         ExitError( "Can't create folder \"$parent_folder_path\"." ) ; 
     52                if ( strlen( $dirPart ) > 0 && !is_dir( $currentDir ) ) 
     53                        mkdir( $currentDir, $rights ) ; 
    5954        } 
    6055} 
     
    7065                fwrite( $f, "\xEF\xBB\xBF" ) ;  // BOM 
    7166 
    72         fwrite( $f, $strData ) ; 
    73         fclose( $f ) ; 
    74  
    75         return TRUE ; 
    76 } 
    77  
    78 function SaveStringToUtf8File( $strData, $filePath, $includeBom = TRUE ) 
    79 { 
    80         $f = @fopen( $filePath, 'wb' ) ; 
    81  
    82         if ( !$f ) 
    83                 return FALSE ; 
    84  
    85         if ( $includeBom ) 
    86                 fwrite( $f, "\xEF\xBB\xBF" ) ;  // BOM 
    87  
    88         fwrite( $f, ( $strData ) ) ; 
    89  
     67        fwrite( $f, StripUtf8Bom( $strData ) ) ; 
    9068        fclose( $f ) ; 
    9169 
  • FCKpackager/trunk/_source/includes/fckpackagefile.inc

    r156 r335  
    8888 
    8989                        // Each file terminates with a CRLF, even if compressed. 
    90                         $outputData .= "\n" ; 
     90                        $outputData .= "\r\n" ; 
    9191                } 
    9292 
  • FCKpackager/trunk/_source/includes/fckpreprocessor.inc

    r156 r335  
    2929        function ProcessFile( $sourceFilePath, $destinationFilePath, $onlyHeader = FALSE ) 
    3030        { 
    31                 SaveStringToUtf8File( 
     31                SaveStringToFile( 
    3232                        FCKPreProcessor::Process( file_get_contents( $sourceFilePath ), $onlyHeader ), 
    3333                        $destinationFilePath, 
    34                         ( !StrEndsWith( $sourceFilePath, '.asp' ) && !StrEndsWith( $sourceFilePath, '.js' ) ) ) ;       // Only ASP and JavaScript files require the BOM. 
     34                        ( StrEndsWith( $sourceFilePath, '.asp' ) || StrEndsWith( $sourceFilePath, '.js' ) ) ) ; // Only ASP and JavaScript files require the BOM. 
    3535 
    3636                // Set the destination file Last Access and Last Write times. 
  • FCKpackager/trunk/web/javascriptcompressor.php

    r156 r335  
    22<?php 
    33 
    4 require_once( '../includes/fckcontantprocessor.inc' ) ; 
    5 require_once( '../includes/fckjavascriptcompressor.inc' ) ; 
     4require_once( '../_source/includes/fckcontantprocessor.inc' ) ; 
     5require_once( '../_source/includes/fckjavascriptcompressor.inc' ) ; 
    66 
    77if ( isset( $_POST['xInputScript'] ) )