cvs: smarty / NEWS /libs/plugins function.html_radios.php

From: Date: Wed, 19 Mar 2003 22:52:22 +0000
Subject: cvs: smarty / NEWS /libs/plugins function.html_radios.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-479@lists.php.net to get a copy of this message
mohrt Wed Mar 19 17:52:22 2003 EDT Modified files: /smarty NEWS /smarty/libs/plugins function.html_radios.php Log: add a warning when an array is passed as the 'checked' value of html_radios Index: smarty/NEWS diff -u smarty/NEWS:1.320 smarty/NEWS:1.321 --- smarty/NEWS:1.320 Wed Mar 19 07:51:34 2003 +++ smarty/NEWS Wed Mar 19 17:52:22 2003 @@ -1,3 +1,5 @@ + - added warning message when an array is passed as + the "checked" value of html_radios (Monte) - fixed errormessage in _compile_smarty_ref() (messju) - updated docs for html_image "name" -> "file" (messju) - fixed bug with html_options-optgroups (Nichlas Löfdahl, messju) Index: smarty/libs/plugins/function.html_radios.php diff -u smarty/libs/plugins/function.html_radios.php:1.8 smarty/libs/plugins/function.html_radios.php:1.9 --- smarty/libs/plugins/function.html_radios.php:1.8 Tue Mar 18 03:59:00 2003 +++ smarty/libs/plugins/function.html_radios.php Wed Mar 19 17:52:22 2003 @@ -25,7 +25,7 @@ function smarty_function_html_radios($params, &$smarty) { require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); - + $name = 'radio'; $values = null; $options = null; @@ -35,32 +35,36 @@ $extra = ''; foreach($params as $_key => $_val) { - switch($_key) { - case 'name': - case 'separator': - case 'checked': - $$_key = (string)$_val; - break; - - case 'options': - $$_key = (array)$_val; - break; - - case 'values': - case 'output': - $$_key = array_values((array)$_val); - break; - - case 'radios': - $smarty->trigger_error('the use of the "radios"-attribute is deprecated. use "options" instead', E_USER_WARNING); - $options = (array)$_val; - break; - - - default: - $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars((string)$_val).'"'; - break; - } + switch($_key) { + case 'name': + case 'separator': + case 'checked': + if(is_array($_val)) { + $smarty->trigger_error('the "checked"-attribute cannot be an array.', E_USER_WARNING); + } else { + $$_key = (string)$_val; + } + break; + + case 'options': + $$_key = (array)$_val; + break; + + case 'values': + case 'output': + $$_key = array_values((array)$_val); + break; + + case 'radios': + $smarty->trigger_error('the use of the "radios"-attribute is deprecated. use "options" instead', E_USER_WARNING); + $options = (array)$_val; + break; + + + default: + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars((string)$_val).'"'; + break; + } } if (!isset($options) && !isset($values))

« previous php.smarty.cvs (#479) next »