From: Andrey Kutejko Date: Sat, 14 Sep 2013 15:41:46 +0000 (+0300) Subject: cleanup X-Git-Tag: 0.5~39 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=b4f159568077aac3e4c4bbbfc87ab764e83aa01e;p=ipf.git cleanup --- diff --git a/ipf/form/field/choice.php b/ipf/form/field/choice.php index a96babe..2359581 100644 --- a/ipf/form/field/choice.php +++ b/ipf/form/field/choice.php @@ -1,6 +1,7 @@ setChoices($params['choices']); } - public function clean($value){ + public function clean($value) + { parent::clean($value); if (in_array($value, $this->empty_values)) { return ''; @@ -20,15 +22,17 @@ class IPF_Form_Field_Choice extends IPF_Form_Field{ throw new IPF_Exception_Form(__('Invalid choice')); return $value; } - - public function setChoices($choices){ + + public function setChoices($choices) + { $this->_choices = $choices; $this->widget->choices = $choices; } - - public function validValue($value){ - foreach($this->_choices as $name=>$val) - if ($value==$val) + + public function validValue($value) + { + foreach ($this->_choices as $name => $val) + if ($value == $val) return true; return false; } diff --git a/ipf/form/field/multiplechoice.php b/ipf/form/field/multiplechoice.php index b6da5b8..d4900e9 100644 --- a/ipf/form/field/multiplechoice.php +++ b/ipf/form/field/multiplechoice.php @@ -1,13 +1,15 @@ _choices as $name=>$val){ - if ($v==$val){ + foreach ($this->_choices as $name => $val) { + if ($v==$val) { $find = true; break; } @@ -18,7 +20,8 @@ class IPF_Form_Field_MultipleChoice extends IPF_Form_Field_Choice{ return true; } - public function clean($value){ + public function clean($value) + { parent::clean($value); if (in_array($value, $this->empty_values)) { return ''; @@ -27,6 +30,5 @@ class IPF_Form_Field_MultipleChoice extends IPF_Form_Field_Choice{ throw new IPF_Exception_Form(__('Invalid choice')); return $value; } - } diff --git a/ipf/form/widget/selectmultipleinput.php b/ipf/form/widget/selectmultipleinput.php index 43133c2..1ebc46d 100644 --- a/ipf/form/widget/selectmultipleinput.php +++ b/ipf/form/widget/selectmultipleinput.php @@ -13,8 +13,7 @@ class IPF_Form_Widget_SelectMultipleInput extends IPF_Form_Widget parent::__construct($attrs); } - public function render($name, $value, $extra_attrs=array(), - $choices=array()) + public function render($name, $value, $extra_attrs=array(), $choices=array()) { $output = array(); if ($value === null) {