Ignore:
Timestamp:
2007/08/31 23:39:46 (17 years ago)
Author:
nanasess
Message:

svn:mime-type 修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/convert.php

    • Property svn:mime-type changed from application/x-httpd-php; charset=EUC-JP to text/x-httpd-php; charset=UTF-8
    r15081 r15532  
    22<?php 
    33/** 
    4  * ファイルのエンコーディングを $fromEncoding から $toEncoding へ変換します. 
     4 * ¥Õ¥¡¥¤¥ë¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ò $fromEncoding ¤«¤é $toEncoding ¤ØÊÑ´¹¤·¤Þ¤¹. 
    55 * 
    66 * @author  Kentaro Ohkouchi<ohkouchi@loop-az.jp> 
     
    1010 
    1111/** 
    12  * 変換したいファイルの拡張子をカンマ区切りで羅列. 
     12 * ÊÑ´¹¤·¤¿¤¤¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò¤ò¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÍåÎó. 
    1313 */ 
    1414$includes = "php,inc,tpl,css,sql,js"; 
    1515 
    1616/** 
    17  * 除外するファイル名をカンマ区切りで羅列. 
     17 * ½ü³°¤¹¤ë¥Õ¥¡¥¤¥ë̾¤ò¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÍåÎó. 
    1818 */ 
    1919$excludes = "convert.php"; 
    2020 
    2121/** 
    22  * 変換元エンコーディング. 
     22 * ÊÑ´¹¸µ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°. 
    2323 */ 
    2424$fromEncoding = "EUC-JP"; 
    2525 
    2626/** 
    27  * 変換先エンコーディング. 
     27 * ÊÑ´¹À襨¥ó¥³¡¼¥Ç¥£¥ó¥°. 
    2828 */ 
    2929$toEncoding = "UTF-8"; 
     
    3636    if (is_file($path)) { 
    3737 
    38         // ファイル名を取得 
     38        // ¥Õ¥¡¥¤¥ë̾¤ò¼èÆÀ 
    3939        $fileName = pathinfo($path, PATHINFO_BASENAME); 
    4040         
    41         // 拡張子を取得 
     41        // ³ÈÄ¥»Ò¤ò¼èÆÀ 
    4242        $suffix = pathinfo($path, PATHINFO_EXTENSION); 
    4343 
    44         // 除外ファイルをスキップ 
     44        // ½ü³°¥Õ¥¡¥¤¥ë¤ò¥¹¥­¥Ã¥× 
    4545        if (in_array($fileName, $excludeArray)) { 
    4646            echo "excludes by " . $path . "\n"; 
     
    4848        } 
    4949 
    50         // 変換対象を順に処理 
     50        // ÊÑ´¹Âоݤò½ç¤Ë½èÍý 
    5151        foreach ($includeArray as $include) { 
    5252            if ($suffix == $include) { 
    5353                 
    54                 // ファイル内容を取得し, エンコーディング変換 
     54                // ¥Õ¥¡¥¤¥ëÆâÍƤò¼èÆÀ¤·, ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹ 
    5555                $contents = file_get_contents($path); 
    5656                $convertedContents = mb_convert_encoding($contents, 
     
    5858                                                         $fromEncoding); 
    5959 
    60                 // 書き込みできるか? 
     60                // ½ñ¤­¹þ¤ß¤Ç¤­¤ë¤«¡© 
    6161                if (is_writable($path)) { 
    6262 
    63                     // ファイルを書き出しモードで開く 
     63                    // ¥Õ¥¡¥¤¥ë¤ò½ñ¤­½Ð¤·¥â¡¼¥É¤Ç³«¤¯ 
    6464                    $handle = fopen($path, "w"); 
    6565                    if (!$handle) { 
     
    6868                    } 
    6969 
    70                     // コード変換した内容を書き込む  
     70                    // ¥³¡¼¥ÉÊÑ´¹¤·¤¿ÆâÍƤò½ñ¤­¹þ¤à  
    7171                    if (fwrite($handle, $convertedContents) === false) { 
    7272                        echo "Cannot write to file (" . $path . ")"; 
     
    7575 
    7676                    echo "converted " . $path . "\n"; 
    77                     // ファイルを閉じる 
     77                    // ¥Õ¥¡¥¤¥ë¤òÊĤ¸¤ë 
    7878                    fclose($handle); 
    7979                } else { 
     
    8787 
    8888/** 
    89  * $dir を再帰的に辿ってパス名を配列で返す. 
     89 * $dir ¤òºÆµ¢Åª¤Ëé¤Ã¤Æ¥Ñ¥¹Ì¾¤òÇÛÎó¤ÇÊÖ¤¹. 
    9090 *  
    91  * @param string 任意のパス名 
    92  * @return array $dir より下層に存在するパス名の配列 
     91 * @param string Ǥ°Õ¤Î¥Ñ¥¹Ì¾ 
     92 * @return array $dir ¤è¤ê²¼Áؤ˸ºß¤¹¤ë¥Ñ¥¹Ì¾¤ÎÇÛÎó 
    9393 * @see http://www.php.net/glob 
    9494 */ 
Note: See TracChangeset for help on using the changeset viewer.