Changeset 226 for FCKreleaser/trunk

Show
Ignore:
Timestamp:
2007-03-27 17:58:03 (21 months ago)
Author:
fredck
Message:

Fixed #279 : Corrected the releaser to include the UTF-8 BOM only in the necessary files.

Location:
FCKreleaser/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • FCKreleaser/trunk/fckreleaser.php

    r165 r226  
    349349function StrEndsWith( $str, $sub ) 
    350350{ 
    351    return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ; 
     351        return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ; 
    352352} 
    353353 
     
    363363{ 
    364364        $dirParts = explode( '/', $path ) ; 
    365          
     365 
    366366        $currentDir = '' ; 
    367367 
     
    369369        { 
    370370                $currentDir .= $dirPart . '/' ; 
    371                  
     371 
    372372                if ( strlen( $dirPart ) > 0 && !is_dir( $currentDir ) ) 
    373373                        mkdir( $currentDir, $rights ) ; 
     
    385385                fwrite( $f, "\xEF\xBB\xBF" ) ;  // BOM 
    386386 
    387         fwrite( $f, $strData ) ; 
    388         fclose( $f ) ; 
    389  
    390         return TRUE ; 
    391 } 
    392  
    393 function SaveStringToUtf8File( $strData, $filePath, $includeBom = TRUE ) 
    394 { 
    395         $f = @fopen( $filePath, 'wb' ) ; 
    396  
    397         if ( !$f ) 
    398                 return FALSE ; 
    399  
    400         if ( $includeBom ) 
    401                 fwrite( $f, "\xEF\xBB\xBF" ) ;  // BOM 
    402  
    403         fwrite( $f, ( $strData ) ) ; 
    404  
     387        fwrite( $f, StripUtf8Bom( $strData ) ) ; 
    405388        fclose( $f ) ; 
    406389 
     
    954937        function ProcessFile( $sourceFilePath, $destinationFilePath, $onlyHeader = FALSE ) 
    955938        { 
    956                 SaveStringToUtf8File( 
     939                SaveStringToFile( 
    957940                        FCKPreProcessor::Process( file_get_contents( $sourceFilePath ), $onlyHeader ), 
    958941                        $destinationFilePath, 
    959                         ( !StrEndsWith( $sourceFilePath, '.asp' ) && !StrEndsWith( $sourceFilePath, '.js' ) ) ) ;       // Only ASP and JavaScript files require the BOM. 
     942                        ( StrEndsWith( $sourceFilePath, '.asp' ) || StrEndsWith( $sourceFilePath, '.js' ) ) ) ; // Only ASP and JavaScript files require the BOM. 
    960943 
    961944                // Set the destination file Last Access and Last Write times. 
  • FCKreleaser/trunk/_source/includes/fckpackager/common.inc

    r159 r226  
    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 
     
    4343{ 
    4444        $dirParts = explode( '/', $path ) ; 
    45          
     45 
    4646        $currentDir = '' ; 
    4747 
     
    4949        { 
    5050                $currentDir .= $dirPart . '/' ; 
    51                  
     51 
    5252                if ( strlen( $dirPart ) > 0 && !is_dir( $currentDir ) ) 
    5353                        mkdir( $currentDir, $rights ) ; 
     
    6565                fwrite( $f, "\xEF\xBB\xBF" ) ;  // BOM 
    6666 
    67         fwrite( $f, $strData ) ; 
    68         fclose( $f ) ; 
    69  
    70         return TRUE ; 
    71 } 
    72  
    73 function SaveStringToUtf8File( $strData, $filePath, $includeBom = TRUE ) 
    74 { 
    75         $f = @fopen( $filePath, 'wb' ) ; 
    76  
    77         if ( !$f ) 
    78                 return FALSE ; 
    79  
    80         if ( $includeBom ) 
    81                 fwrite( $f, "\xEF\xBB\xBF" ) ;  // BOM 
    82  
    83         fwrite( $f, ( $strData ) ) ; 
    84  
     67        fwrite( $f, StripUtf8Bom( $strData ) ) ; 
    8568        fclose( $f ) ; 
    8669 
  • FCKreleaser/trunk/_source/includes/fckpackager/fckpreprocessor.inc

    r159 r226  
    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.