Ignore:
Timestamp:
2012/02/06 11:05:15 (12 years ago)
Author:
Seasoft
Message:

#1613 (ソース整形・ソースコメントの改善)

  • Zend Framework PHP 標準コーディング規約への準拠を高めた
File:
1 edited

Legend:

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

    r21420 r21441  
    8383        $ret = $objThumb->Main($src_file, $width, $height, $dst_file); 
    8484 
    85         if($ret[0] != 1) { 
     85        if ($ret[0] != 1) { 
    8686            // エラーメッセージの表示 
    8787            echo $ret[1]; 
     
    9898        $arrKeyname = array_flip($this->keyname); 
    9999 
    100         if(!($_FILES[$keyname]['size'] > 0)) { 
     100        if (!($_FILES[$keyname]['size'] > 0)) { 
    101101            $objErr->arrErr[$keyname] = "※ " . $this->disp_name[$arrKeyname[$keyname]] . "がアップロードされていません。<br />"; 
    102102        } else { 
    103             foreach($this->keyname as $val) { 
     103            foreach ($this->keyname as $val) { 
    104104                // 一致したキーのファイルに情報を保存する。 
    105105                if ($val == $keyname) { 
     
    109109                    $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK")); 
    110110                    // エラーがない場合 
    111                     if(!isset($objErr->arrErr[$keyname])) { 
     111                    if (!isset($objErr->arrErr[$keyname])) { 
    112112                        // 画像ファイルの場合 
    113                         if($this->image[$cnt]) { 
     113                        if ($this->image[$cnt]) { 
    114114                            // 保存用の画像名を取得する 
    115115                            $dst_file = $this->lfGetTmpImageName($rename, $keyname); 
     
    118118                        } else { 
    119119                            // 一意なファイル名を作成する。 
    120                             if($rename) { 
     120                            if ($rename) { 
    121121                                $uniqname = date('mdHi') . "_" . uniqid("")."."; 
    122122                                $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']); 
     
    144144        $cnt = 0; 
    145145        $arrKeyname = array_flip($this->keyname); 
    146         if(!($_FILES[$keyname]['size'] > 0)) { 
     146        if (!($_FILES[$keyname]['size'] > 0)) { 
    147147            $objErr->arrErr[$keyname] = "※ " . $this->disp_name[$arrKeyname[$keyname]] . "がアップロードされていません。(ファイルがアップロードできない場合は、.htaccessファイルのphp_value upload_max_filesizeを調整してください)<br />"; 
    148148        } else { 
    149             foreach($this->keyname as $val) { 
     149            foreach ($this->keyname as $val) { 
    150150               // 一致したキーのファイルに情報を保存する。 
    151151                if ($val == $keyname) { 
     
    155155                    $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK")); 
    156156                    // エラーがない場合 
    157                    if(!isset($objErr->arrErr[$keyname])) { 
     157                   if (!isset($objErr->arrErr[$keyname])) { 
    158158                        // 一意なファイル名を作成する。 
    159159                        $uniqname = date('mdHi') . "_" . uniqid("")."."; 
     
    174174        $objImage = new SC_Image_Ex($this->temp_dir); 
    175175        $cnt = 0; 
    176         foreach($this->keyname as $val) { 
     176        foreach ($this->keyname as $val) { 
    177177            if ($val == $keyname) { 
    178178                // 一時ファイルの場合削除する。 
    179                 if($this->temp_file[$cnt] != "") { 
     179                if ($this->temp_file[$cnt] != "") { 
    180180                    $objImage->deleteImage($this->temp_file[$cnt], $this->temp_dir); 
    181181                } 
     
    191191        $objImage = new SC_Image_Ex($this->temp_dir); 
    192192        $cnt = 0; 
    193         foreach($this->keyname as $val) { 
     193        foreach ($this->keyname as $val) { 
    194194            if ($val == $keyname) { 
    195195                // 一時ファイルの場合削除する。 
    196                 if($this->temp_file[$cnt] != "") { 
     196                if ($this->temp_file[$cnt] != "") { 
    197197                    $objImage->deleteImage($this->temp_file[$cnt], $this->temp_dir); 
    198198                } 
     
    208208        $cnt = 0; 
    209209        $filepath = ""; 
    210         foreach($this->keyname as $val) { 
     210        foreach ($this->keyname as $val) { 
    211211            if ($val == $keyname) { 
    212                 if($this->temp_file[$cnt] != "") { 
     212                if ($this->temp_file[$cnt] != "") { 
    213213                    $filepath = $this->temp_dir . $this->temp_file[$cnt]; 
    214214                } 
     
    224224        $objImage = new SC_Image_Ex($this->temp_dir); 
    225225 
    226         foreach($this->keyname as $val) { 
    227             if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
     226        foreach ($this->keyname as $val) { 
     227            if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
    228228 
    229229                $objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir); 
     
    245245        $cnt = 0; 
    246246        $objImage = new SC_Image_Ex($this->temp_dir); 
    247         foreach($this->keyname as $val) { 
    248             if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
     247        foreach ($this->keyname as $val) { 
     248            if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
    249249                $objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir); 
    250250                // すでに保存ファイルがあった場合は削除する。 
     
    264264        $cnt = 0; 
    265265        $arrRet = array(); 
    266         foreach($this->keyname as $val) { 
    267             if(isset($this->temp_file[$cnt])) { 
     266        foreach ($this->keyname as $val) { 
     267            if (isset($this->temp_file[$cnt])) { 
    268268                $arrRet["temp_" . $val] = $this->temp_file[$cnt]; 
    269269            } 
    270             if(isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 
     270            if (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 
    271271                $arrRet["save_" . $val] = $this->save_file[$cnt]; 
    272272            } 
     
    279279    function setHiddenFileList($arrPOST) { 
    280280        $cnt = 0; 
    281         foreach($this->keyname as $val) { 
     281        foreach ($this->keyname as $val) { 
    282282            $key = "temp_" . $val; 
    283             if(isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 
     283            if (isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 
    284284                $this->temp_file[$cnt] = $arrPOST[$key]; 
    285285            } 
    286286            $key = "save_" . $val; 
    287             if(isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 
     287            if (isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 
    288288                $this->save_file[$cnt] = $arrPOST[$key]; 
    289289            } 
     
    294294    function setHiddenKikakuFileList($arrPOST) { 
    295295        $cnt = 0; 
    296         foreach($this->keyname as $val) { 
     296        foreach ($this->keyname as $val) { 
    297297            $key = "temp_" . $val; 
    298             if(isset($arrPOST[$key])) { 
     298            if (isset($arrPOST[$key])) { 
    299299                $this->temp_file[$cnt] = $arrPOST[$key]; 
    300300            } 
    301301            $key = "save_" . $val; 
    302             if(isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 
     302            if (isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 
    303303                $this->save_file[$cnt] = $arrPOST[$key]; 
    304304            } 
     
    311311        $arrRet = array(); 
    312312        $cnt = 0; 
    313         foreach($this->keyname as $val) { 
    314             if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
     313        foreach ($this->keyname as $val) { 
     314            if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
    315315                // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 
    316                 if(ereg("/$", $temp_url)) { 
     316                if (ereg("/$", $temp_url)) { 
    317317                    $arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt]; 
    318318                } else { 
     
    322322            } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 
    323323                // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 
    324                 if(ereg("/$", $save_url)) { 
     324                if (ereg("/$", $save_url)) { 
    325325                    $arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt]; 
    326326                } else { 
     
    329329                $arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt]; 
    330330            } 
    331             if(isset($arrRet[$val]['filepath']) && !empty($arrRet[$val]['filepath'])) { 
    332                 if($real_size){ 
    333                     if(is_file($arrRet[$val]['real_filepath'])) { 
     331            if (isset($arrRet[$val]['filepath']) && !empty($arrRet[$val]['filepath'])) { 
     332                if ($real_size) { 
     333                    if (is_file($arrRet[$val]['real_filepath'])) { 
    334334                        list($width, $height) = getimagesize($arrRet[$val]['real_filepath']); 
    335335                    } 
     
    338338                    // ファイル縦幅 
    339339                    $arrRet[$val]['height'] = $height; 
    340                 }else{ 
     340                } else { 
    341341                    // ファイル横幅 
    342342                    $arrRet[$val]['width'] = $this->width[$cnt]; 
     
    356356        $arrRet = ""; 
    357357        $cnt = 0; 
    358         foreach($this->keyname as $val) { 
    359             if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
     358        foreach ($this->keyname as $val) { 
     359            if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
    360360                $arrRet = $this->temp_file[$cnt]; 
    361361            } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 
     
    369369        $arrRet = array(); 
    370370        $cnt = 0; 
    371         foreach($this->keyname as $val) { 
    372             if(isset($this->temp_file[$cnt])) { 
     371        foreach ($this->keyname as $val) { 
     372            if (isset($this->temp_file[$cnt])) { 
    373373                $arrRet[$val] = $this->temp_file[$cnt]; 
    374374            } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 
     
    383383    function getDBFileList() { 
    384384        $cnt = 0; 
    385         foreach($this->keyname as $val) { 
    386             if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
     385        foreach ($this->keyname as $val) { 
     386            if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 
    387387                $arrRet[$val] = $this->temp_file[$cnt]; 
    388             } else  { 
     388            } else { 
    389389                $arrRet[$val] = isset($this->save_file[$cnt]) ? $this->save_file[$cnt] : ""; 
    390390            } 
     
    397397    function setDBFileList($arrVal) { 
    398398        $cnt = 0; 
    399         foreach($this->keyname as $val) { 
    400             if(isset($arrVal[$val]) && $arrVal[$val] != "") { 
     399        foreach ($this->keyname as $val) { 
     400            if (isset($arrVal[$val]) && $arrVal[$val] != "") { 
    401401                $this->save_file[$cnt] = $arrVal[$val]; 
    402402            } 
     
    407407    // DBで保存されたダウンロードファイル名をセットする 
    408408    function setDBDownFile($arrVal) { 
    409         if(isset($arrVal['down_realfilename']) && $arrVal['down_realfilename'] != "") { 
     409        if (isset($arrVal['down_realfilename']) && $arrVal['down_realfilename'] != "") { 
    410410            $this->save_file[0] = $arrVal['down_realfilename']; 
    411411        } 
     
    415415    function setPostFileList($arrPost,$arrVal) { 
    416416        $cnt = 0; 
    417         foreach($this->keyname as $val) { 
    418             if(isset($arrPost['temp_down_realfilename:' . ($cnt+1)])) { 
     417        foreach ($this->keyname as $val) { 
     418            if (isset($arrPost['temp_down_realfilename:' . ($cnt+1)])) { 
    419419                $this->temp_file[$cnt] = $arrPost['temp_down_realfilename:' . ($cnt+1)]; 
    420420            } 
     
    426426    function setDBImageList($arrVal) { 
    427427        $cnt = 0; 
    428         foreach($this->keyname as $val) { 
    429             if($arrVal[$val] != "" && $val == 'tv_products_image') { 
     428        foreach ($this->keyname as $val) { 
     429            if ($arrVal[$val] != "" && $val == 'tv_products_image') { 
    430430                $this->save_file[$cnt] = $arrVal[$val]; 
    431431            } 
     
    438438        $objImage = new SC_Image_Ex($this->temp_dir); 
    439439        $cnt = 0; 
    440         foreach($this->keyname as $val) { 
    441             if($arrVal[$val] != "") { 
    442                 if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) { 
     440        foreach ($this->keyname as $val) { 
     441            if ($arrVal[$val] != "") { 
     442                if ($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) { 
    443443                    $objImage->deleteImage($arrVal[$val], $this->save_dir); 
    444444                } 
     
    452452        $objImage = new SC_Image_Ex($this->temp_dir); 
    453453        $cnt = 0; 
    454         if($arrVal['down_realfilename'] != "") { 
    455             if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal['down_realfilename'])) { 
     454        if ($arrVal['down_realfilename'] != "") { 
     455            if ($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal['down_realfilename'])) { 
    456456                $objImage->deleteImage($arrVal['down_realfilename'], $this->save_dir); 
    457457            } 
     
    463463        $cnt = 0; 
    464464        $arrRet = array(); 
    465         foreach($this->keyname as $val) { 
    466             if($val == $keyname || $keyname == "") { 
     465        foreach ($this->keyname as $val) { 
     466            if ($val == $keyname || $keyname == "") { 
    467467                // 必須であればエラーチェック 
    468468                if ($this->necessary[$cnt] == true) { 
     
    504504    function lfGetTmpImageName($rename, $keyname = "", $uploadfile = ""){ 
    505505 
    506         if( $rename === true ){ 
     506        if ($rename === true ) { 
    507507            // 一意なIDを取得し、画像名をリネームし保存 
    508508            $uniqname = date('mdHi') . "_" . uniqid(""); 
Note: See TracChangeset for help on using the changeset viewer.