Changeset 335 for FCKpackager/trunk/_source/includes/common.inc
- Timestamp:
- 2007-05-30 21:36:32 (20 months ago)
- Files:
-
- 1 modified
-
FCKpackager/trunk/_source/includes/common.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKpackager/trunk/_source/includes/common.inc
r156 r335 1 <?php1 <?php 2 2 /* 3 3 * FCKpackager - JavaScript Packager and Compressor - http://www.fckeditor.net … … 29 29 function StrEndsWith( $str, $sub ) 30 30 { 31 return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ;31 return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ; 32 32 } 33 33 … … 42 42 function CreateDir($path, $rights = 0777) 43 43 { 44 $folder_path = array( 45 strstr( $path, '.' ) ? dirname( $path ) : $path ) ; 44 $dirParts = explode( '/', $path ) ; 46 45 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 ) 51 49 { 52 $folder_path[] = dirname( end( $folder_path ) ) ; 53 } 50 $currentDir .= $dirPart . '/' ; 54 51 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 ) ; 59 54 } 60 55 } … … 70 65 fwrite( $f, "\xEF\xBB\xBF" ) ; // BOM 71 66 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 ) ) ; 90 68 fclose( $f ) ; 91 69