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

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

Files:
1 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.