Changeset 20180 for branches/version-2_5-dev/data/class/SC_FormParam.php
- Timestamp:
- 2011/02/17 19:40:06 (15 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:20179
- bzr:committer:
- Kentaro Ohkouchi <[email protected]>
- bzr:file-ids:
data/Smarty/templates/admin/order/edit.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fadmin%2Forder%2Fedit.tpl
data/Smarty/templates/admin/order/multiple.tpl multiple.tpl-20110116173102-7dtlp9lt15miha2l-1
data/class/SC_FormParam.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_FormParam.php
data/class/helper/SC_Helper_DB.php 15176@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_DB.php
data/class/helper/SC_Helper_Purchase.php sc_helper_purchase.p-20101020100530-jyaoa7ch9pdfjqzp-1
data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php 15594@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Forder%2FLC_Page_Admin_Order_Edit.php
data/class/pages/admin/order/LC_Page_Admin_Order_Status.php 15596@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Forder%2FLC_Page_Admin_Order_Status.php- bzr:mapping-version:
- v4
- bzr:merge:
[email protected]- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- [email protected]
- bzr:revno:
- 2908
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:text-revisions:
data/Smarty/templates/admin/order/edit.tpl [email protected]
data/Smarty/templates/admin/order/multiple.tpl [email protected]
data/class/SC_FormParam.php [email protected]
data/class/helper/SC_Helper_Purchase.php [email protected]
data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php [email protected]
data/class/pages/admin/order/LC_Page_Admin_Order_Status.php [email protected]- bzr:timestamp:
- 2011-02-17 19:40:03.388000011 +0900
- bzr:user-agent:
- bzr2.2.1+bzr-svn1.0.4
- svn:original-date:
- 2011-02-17T10:40:03.388000Z
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_FormParam.php
r20160 r20180 242 242 * SC_CheckError::doFunc() を再帰的に実行する. 243 243 * 244 * 再帰実行した場合は, エラーメッセージを多次元配列で格納する 245 * 246 * TODO 二次元以上のエラーメッセージへの対応 247 * 244 248 * @param string $disp_name 表示名 245 249 * @param string $func チェック種別 … … 248 252 * @param string $error_key エラーメッセージを格納する配列のキー 249 253 * @param integer $length チェック対象の値の長さ 254 * @param integer $depth 再帰実行した場合の深度 255 * @param integer $recursion_count 再帰実行した回数 250 256 * @return void 251 257 */ 252 258 function recursionCheck($disp_name, $func, $value, &$arrErr, $error_key, 253 $length = 0 ) {259 $length = 0, $depth = 0, $recursion_count = 0) { 254 260 if (is_array($value)) { 261 $depth++; 262 $recursion_count = 0; 255 263 foreach ($value as $in) { 256 264 $this->recursionCheck($disp_name, $func, $in, $arrErr, $error_key, 257 $length); 265 $length, $depth, $recursion_count); 266 $recursion_count++; 258 267 } 259 268 } else { 260 $objSubErr = new SC_CheckError(array(0 => $value)); 261 $objSubErr->doFunc(array($disp_name, 0, $length), array($func)); 262 if(count($objSubErr->arrErr) > 0) { 263 foreach($objSubErr->arrErr as $mess) { 264 if($mess != "") { 265 $arrErr[$error_key] .= $mess; 269 $objErr = new SC_CheckError(array(0 => $value)); 270 $objErr->doFunc(array($disp_name, 0, $length), array($func)); 271 if (!SC_Utils_Ex::isBlank($objErr->arrErr)) { 272 foreach($objErr->arrErr as $message) { 273 274 if(!SC_Utils_Ex::isBlank($message)) { 275 // 再帰した場合は多次元配列のエラーメッセージを生成 276 $error_var = '$arrErr[$error_key]'; 277 for ($i = 0; $i < $depth; $i++) { 278 // FIXME 二次元以上の対応 279 $error_var .= '[' . $recursion_count . ']'; 280 } 281 eval($error_var . ' = $message;'); 266 282 } 267 283 } … … 270 286 } 271 287 272 // 入力文字の変換 288 /** 289 * フォームの入力パラメータに応じて, 再帰的に mb_convert_kana 関数を実行する. 290 * 291 * @return voi 292 * @see mb_convert_kana 293 */ 273 294 function convParam() { 274 /*275 * 文字列の変換276 * K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換277 * C : 「全角ひら仮名」を「全角かた仮名」に変換278 * V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します279 * n : 「全角」数字を「半角(ハンカク)」に変換280 * a : 「全角」英字を「半角」英字に変換281 */282 295 $cnt = 0; 283 296 foreach ($this->keyname as $val) { 284 297 if (!isset($this->param[$cnt])) $this->param[$cnt] = ""; 285 286 if(!is_array($this->param[$cnt])) { 287 if($this->convert[$cnt] != "") { 288 $this->param[$cnt] = mb_convert_kana($this->param[$cnt] ,$this->convert[$cnt]); 289 } 290 } else { 291 $max = count($this->param[$cnt]); 292 for($i = 0; $i < $max; $i++) { 293 if($this->convert[$cnt] != "") { 294 $this->param[$cnt][$i] = mb_convert_kana($this->param[$cnt][$i] ,$this->convert[$cnt]); 295 } 296 } 297 } 298 $cnt++; 298 $this->recursionConvParam($this->param[$cnt], $this->convert[$cnt]); 299 $cnt++; 300 } 301 } 302 303 /** 304 * 再帰的に mb_convert_kana を実行する. 305 * 306 * @param mixed $value 変換する値. 配列の場合は再帰的に実行する. 307 * @param string $convert mb_convert_kana の変換オプション 308 */ 309 function recursionConvParam(&$value, $convert) { 310 if (is_array($value)) { 311 foreach (array_keys($value) as $key) { 312 $this->recursionConvParam($value[$key], $convert); 313 } 314 } else { 315 if (!SC_Utils_Ex::isBlank($value)) { 316 $value = mb_convert_kana($value, $convert); 317 } 299 318 } 300 319 } … … 417 436 function trimParam($has_wide_space = true) { 418 437 $cnt = 0; 419 $pattern = '/^[ \r\n\t]*(.*?)[ \r\n\t]*$/u';420 438 foreach ($this->keyname as $val) { 421 439 if (!isset($this->param[$cnt])) $this->param[$cnt] = ""; 422 423 if (!is_array($this->param[$cnt])) { 440 $this->recursionTrim($this->param[$cnt], $has_wide_space); 441 $cnt++; 442 } 443 } 444 445 /** 446 * 再帰的に入力パラメータの先頭及び末尾にある空白文字を削除する. 447 * 448 * @param mixed $value 変換する値. 配列の場合は再帰的に実行する. 449 * @param boolean $has_wide_space 全角空白も削除する場合 true 450 * @return void 451 */ 452 function recursionTrim(&$value, $has_wide_space = true) { 453 $pattern = '/^[ \r\n\t]*(.*?)[ \r\n\t]*$/u'; 454 if (is_array($value)) { 455 foreach (array_keys($value) as $key) { 456 $this->recursionTrim($value[$key], $convert); 457 } 458 } else { 459 if (!SC_Utils_Ex::isBlank($value)) { 424 460 if ($has_wide_space) { 425 $this->param[$cnt] = preg_replace($pattern, '$1', $this->param[$cnt]); 426 } 427 $this->param[$cnt] = trim($this->param[$cnt]); 428 } else { 429 $max = count($this->param[$cnt]); 430 // XXX foreach の方が良い? 431 for ($i = 0; $i < $max; $i++) { 432 if ($has_wide_space) { 433 $this->param[$cnt][$i] = preg_replace($pattern, '$1', $this->param[$cnt][$i]); 434 } 435 $this->param[$cnt][$i] = trim($this->param[$cnt][$i]); 436 } 437 } 438 $cnt++; 461 $value = preg_replace($pattern, '$1', $value); 462 } 463 $value = trim($value); 464 } 439 465 } 440 466 }
Note: See TracChangeset
for help on using the changeset viewer.
