From: Andrey Kutejko Date: Fri, 13 May 2011 14:31:26 +0000 (+0300) Subject: fix deprecated call. valueFromFormData X-Git-Tag: 0.5~341 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=5e094dd9ac156e5a2da586b5ec7aad14bd4fecf0;p=ipf.git fix deprecated call. valueFromFormData --- diff --git a/ipf/form.php b/ipf/form.php index 29f9f61..ee23ca7 100644 --- a/ipf/form.php +++ b/ipf/form.php @@ -62,7 +62,7 @@ class IPF_Form implements Iterator $form_methods = get_class_methods($this); foreach ($this->fields as $name=>$field) { - $value = $field->widget->valueFromFormData($this->addPrefix($name), &$this->data); + $value = $field->widget->valueFromFormData($this->addPrefix($name), $this->data); try { $value = $field->clean($value); $this->cleaned_data[$name] = $value; diff --git a/ipf/form/extra/widget/checkboxinput.php b/ipf/form/extra/widget/checkboxinput.php index 79a0a26..7ecd19f 100644 --- a/ipf/form/extra/widget/checkboxinput.php +++ b/ipf/form/extra/widget/checkboxinput.php @@ -11,8 +11,8 @@ class IPF_Form_Extra_Widget_CheckboxInput extends IPF_Form_Widget_Input return parent::render($name, '', $extra_attrs); } - public function valueFromFormData($name, $data) + public function valueFromFormData($name, &$data) { return (!isset($data[$name]) || false === $data[$name] || (string)$data[$name] === '0' || (string)$data[$name] === 'off') ? false : true; } -} \ No newline at end of file +} diff --git a/ipf/form/widget.php b/ipf/form/widget.php index aff7a07..5870938 100644 --- a/ipf/form/widget.php +++ b/ipf/form/widget.php @@ -22,7 +22,7 @@ class IPF_Form_Widget return array_merge($this->attrs, $attrs, $extra_attrs); } - public function valueFromFormData($name, $data) + public function valueFromFormData($name, &$data) { if (isset($data[$name])) { return $data[$name]; @@ -51,4 +51,4 @@ function IPF_Form_Widget_Attrs($attrs) $_tmp[] = $attr.'="'.$val.'"'; } return ' '.implode(' ', $_tmp); -} \ No newline at end of file +} diff --git a/ipf/form/widget/checkboxinput.php b/ipf/form/widget/checkboxinput.php index 3905ba2..4b55f2c 100644 --- a/ipf/form/widget/checkboxinput.php +++ b/ipf/form/widget/checkboxinput.php @@ -13,11 +13,11 @@ class IPF_Form_Widget_CheckboxInput extends IPF_Form_Widget_Input return parent::render($name, '', $extra_attrs); } - public function valueFromFormData($name, $data) + public function valueFromFormData($name, &$data) { if (!isset($data[$name]) or false === $data[$name] or (string)$data[$name] === '0' or (string)$data[$name] === 'off') { return false; } return true; } -} \ No newline at end of file +} diff --git a/ipf/form/widget/fileinput.php b/ipf/form/widget/fileinput.php index edecf4c..f3e54de 100644 --- a/ipf/form/widget/fileinput.php +++ b/ipf/form/widget/fileinput.php @@ -29,7 +29,7 @@ class IPF_Form_Widget_FileInput extends IPF_Form_Widget_Input return $sim.parent::render($name, $value, $extra_attrs); } - public function valueFromFormData($name, $data){ + public function valueFromFormData($name, &$data){ if (isset($data[$name])) { $remove = false; if (isset($data[$name.'_remove'])) @@ -56,4 +56,4 @@ class IPF_Form_Widget_FileInput extends IPF_Form_Widget_Input } return null; } -} \ No newline at end of file +} diff --git a/ipf/form/widget/selectmultipleinput.php b/ipf/form/widget/selectmultipleinput.php index 35e38fd..86b39b0 100644 --- a/ipf/form/widget/selectmultipleinput.php +++ b/ipf/form/widget/selectmultipleinput.php @@ -38,7 +38,7 @@ class IPF_Form_Widget_SelectMultipleInput extends IPF_Form_Widget return new IPF_Template_SafeString(implode("\n", $output), true); } - public function valueFromFormData($name, $data) + public function valueFromFormData($name, &$data) { if (isset($data[$name]) and is_array($data[$name])) { return $data[$name]; @@ -46,4 +46,4 @@ class IPF_Form_Widget_SelectMultipleInput extends IPF_Form_Widget return null; } -} \ No newline at end of file +} diff --git a/ipf/form/widget/treeselectinput.php b/ipf/form/widget/treeselectinput.php index 3991303..a04438a 100644 --- a/ipf/form/widget/treeselectinput.php +++ b/ipf/form/widget/treeselectinput.php @@ -2,41 +2,41 @@ class IPF_Form_Widget_TreeSelectInput extends IPF_Form_Widget_SelectInput { - protected $_levels = null; + protected $_levels = null; - public function setLevels($levels){ - $this->_levels = $levels; - } + public function setLevels($levels){ + $this->_levels = $levels; + } public function valueToFormData($name, $data) { - $val = null; - foreach($this->_levels as $l){ - if ( (!isset($data[$l])) || ($data[$l]=='')){ - return $val; - } - if ($val==null) - $val = ''; - else - $val .= '.'; - $val .= $data[$l]; - } + $val = null; + foreach($this->_levels as $l){ + if ( (!isset($data[$l])) || ($data[$l]=='')){ + return $val; + } + if ($val==null) + $val = ''; + else + $val .= '.'; + $val .= $data[$l]; + } return $val; } - public function valueFromFormData($name, $data) + public function valueFromFormData($name, &$data) { if (isset($data[$name])) { - $vals = explode(".",(string)$data[$name]); - for($i=0; $i_levels); $i++){ - if ( ($i_levels[$i]] = $vals[$i]; - } - else - $data[$this->_levels[$i]] = null; - } + $vals = explode(".",(string)$data[$name]); + for($i=0; $i_levels); $i++){ + if ( ($i_levels[$i]] = $vals[$i]; + else + $data[$this->_levels[$i]] = null; + } return $data[$name]; } return null; } -} \ No newline at end of file +} + diff --git a/ipf/form/widget/tupleinput.php b/ipf/form/widget/tupleinput.php index e82e484..2c13aab 100644 --- a/ipf/form/widget/tupleinput.php +++ b/ipf/form/widget/tupleinput.php @@ -52,7 +52,7 @@ class IPF_Form_Widget_TupleInput extends IPF_Form_Widget return new IPF_Template_SafeString($s,true); } - public function valueFromFormData($name, $data) + public function valueFromFormData($name, &$data) { $s = ''; for ($i=0; $i<$this->rows; $i++){