Ignore:
Timestamp:
2012/03/01 10:06:28 (14 years ago)
Author:
Seasoft
Message:

#1670 (「文字列を区切り文字を挟み反復する」ユーティリティ関数を追加)
#1613 (typo修正・ソース整形・ソースコメントの改善)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/util/SC_Utils.php

    r21563 r21564  
    21922192    /** 
    21932193     * 指定されたパスの配下を再帰的にコピーします. 
    2194      * @param string $imageDir コピー元ディレクトリのパス  
    2195      * @param string $destDir コピー先ディレクトリのパス  
     2194     * @param string $imageDir コピー元ディレクトリのパス 
     2195     * @param string $destDir コピー先ディレクトリのパス 
     2196     * @return void 
    21962197     */ 
    21972198    function copyDirectory($source_path, $dest_path) { 
     
    21992200        $handle=opendir($source_path);   
    22002201        while ($filename = readdir($handle)) { 
    2201             if($filename === '.' || $filename === '..') continue; 
     2202            if ($filename === '.' || $filename === '..') continue; 
    22022203            $cur_path = $source_path . $filename; 
    22032204            $dest_file_path = $dest_path . $filename; 
     
    22052206                // ディレクトリの場合 
    22062207                // コピー先に無いディレクトリの場合、ディレクトリ作成. 
    2207                 if(!empty($filename) && !file_exists($dest_file_path)) mkdir($dest_file_path); 
     2208                if (!empty($filename) && !file_exists($dest_file_path)) mkdir($dest_file_path); 
    22082209                SC_Utils_EX::copyDirectory($cur_path . '/', $dest_file_path . '/'); 
    22092210            } else { 
    2210                 if(file_exists($dest_file_path)) unlink($dest_file_path); 
     2211                if (file_exists($dest_file_path)) unlink($dest_file_path); 
    22112212                copy($cur_path, $dest_file_path); 
    22122213            } 
     
    22142215    } 
    22152216 
     2217    /** 
     2218     * 文字列を区切り文字を挟み反復する 
     2219     * @param string $input 繰り返す文字列。 
     2220     * @param string $multiplier input を繰り返す回数。 
     2221     * @param string $separator 区切り文字 
     2222     * @return string 
     2223     */ 
     2224    function repeatStrWithSeparator($input, $multiplier, $separator = ',') { 
     2225        return implode($separator, array_fill(0, $multiplier, $input)); 
     2226    } 
    22162227} 
Note: See TracChangeset for help on using the changeset viewer.