Ignore:
Timestamp:
2012/04/17 15:53:10 (14 years ago)
Author:
shutta
Message:

#515 PHP 5.3.0対応
PHP5.3以降で、非推奨関数となるereg系関数を書き換えた。

File:
1 edited

Legend:

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

    r21750 r21755  
    503503            } 
    504504            if ($space) { 
    505                 $line = ereg_replace(", $", '', $line); 
     505                $line = preg_replace("/, $/", '', $line); 
    506506            } else { 
    507                 $line = ereg_replace(",$", '', $line); 
     507                $line = preg_replace("/,$/", '', $line); 
    508508            } 
    509509            return $line; 
     
    522522                $line .= '"' .$val. '",'; 
    523523            } 
    524             $line = ereg_replace(",$", "\r\n", $line); 
     524            $line = preg_replace("/,$/", "\r\n", $line); 
    525525        } else { 
    526526            return false; 
     
    714714    /* 文末の「/」をなくす */ 
    715715    function sfTrimURL($url) { 
    716         $ret = ereg_replace("[/]+$", '', $url); 
     716        $ret = rtrim($url, '/'); 
    717717        return $ret; 
    718718    } 
     
    813813    // 二回以上繰り返されているスラッシュ[/]を一つに変換する。 
    814814    function sfRmDupSlash($istr) { 
    815         if (ereg('^http://', $istr)) { 
     815        if (preg_match('|^http://|', $istr)) { 
    816816            $str = substr($istr, 7); 
    817817            $head = 'http://'; 
    818         } else if (ereg('^https://', $istr)) { 
     818        } else if (preg_match('|^https://|', $istr)) { 
    819819            $str = substr($istr, 8); 
    820820            $head = 'https://'; 
     
    822822            $str = $istr; 
    823823        } 
    824         $str = ereg_replace('[/]+', '/', $str); 
     824        $str = preg_replace('|[/]+|', '/', $str); 
    825825        $ret = $head . $str; 
    826826        return $ret; 
     
    985985    // DB取得日時をタイムに変換 
    986986    function sfDBDatetoTime($db_date) { 
    987         $date = ereg_replace("\..*$",'',$db_date); 
     987        $date = preg_replace("|\..*$|",'',$db_date); 
    988988        $time = strtotime($date); 
    989989        return $time; 
     
    10761076        $count++;  // 無限ループ回避 
    10771077        $dir = dirname($path); 
    1078         if (ereg("^[/]$", $dir) || ereg("^[A-Z]:[\\]$", $dir) || $count > 256) { 
     1078        if (preg_match("|^[/]$|", $dir) || preg_match("|^[A-Z]:[\\]$|", $dir) || $count > 256) { 
    10791079            // ルートディレクトリで終了 
    10801080            return; 
     
    11181118            foreach ($fileArray as $key => $data_) { 
    11191119                // CVS管理ファイルはコピーしない 
    1120                 if (ereg('/CVS/Entries', $data_)) { 
     1120                if (strpos($data_, '/CVS/Entries') !== false) { 
    11211121                    break; 
    11221122                } 
    1123                 if (ereg('/CVS/Repository', $data_)) { 
     1123                if (strpos($data_, '/CVS/Repository') !== false) { 
    11241124                    break; 
    11251125                } 
    1126                 if (ereg('/CVS/Root', $data_)) { 
     1126                if (strpos($data_, '/CVS/Root') !== false) { 
    11271127                    break; 
    11281128                } 
     
    12421242                while (!feof($src_fp)) { 
    12431243                    $line = fgets($src_fp); 
    1244                     if (ereg('@version', $line)) { 
     1244                    if (strpos($line, '@version') !== false) { 
    12451245                        $arrLine = explode(' ', $line); 
    12461246                        $version = $arrLine[5]; 
     
    13251325                // 行末の/を取り除く 
    13261326                while (($file = readdir($dh)) !== false) $arrDir[] = $file; 
    1327                 $dir = ereg_replace("/$", '', $dir); 
     1327                $dir = rtrim($dir, '/'); 
    13281328                // アルファベットと数字でソート 
    13291329                natcasesort($arrDir); 
     
    13751375                while ($file = readdir($handle)) { 
    13761376                    // 行末の/を取り除く 
    1377                     $dir = ereg_replace("/$", '', $dir); 
     1377                    $dir = rtrim($dir, '/'); 
    13781378                    $path = $dir.'/'.$file; 
    13791379                    if ($file != '..' && $file != '.' && !is_dir($path)) { 
     
    14101410 
    14111411        // 文末の/を取り除く 
    1412         $dir = ereg_replace("/$", '', $dir); 
     1412        $dir = rtrim($dir, '/'); 
    14131413        // 最上位層を格納(user_data/) 
    14141414        if (sfDirChildExists($dir)) { 
     
    14511451                    if ($item != '.' && $item != '..') { 
    14521452                        // 文末の/を取り除く 
    1453                         $dir = ereg_replace("/$", '', $dir); 
     1453                        $dir = rtrim($dir, '/'); 
    14541454                        $path = $dir.'/'.$item; 
    14551455                        // ディレクトリのみ取得 
     
    14911491                while ($file = readdir($handle)) { 
    14921492                    // 行末の/を取り除く 
    1493                     $dir = ereg_replace("/$", '', $dir); 
     1493                    $dir = rtrim($dir, '/'); 
    14941494                    $path = $dir.'/'.$file; 
    14951495                    if ($file != '..' && $file != '.' && is_dir($path)) { 
Note: See TracChangeset for help on using the changeset viewer.