1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Corrected toAttribute method. <select> item was not respecting attributes when using renderElement().

This commit is contained in:
Cameron
2016-04-14 16:32:48 -07:00
parent 04f7244f63
commit e4b9db6307
2 changed files with 23 additions and 5 deletions

View File

@@ -1984,7 +1984,6 @@ class e_parse extends e_parser
// Xhtml compliance. // Xhtml compliance.
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
if(!preg_match('/&#|\'|"|<|>/s', $text)) if(!preg_match('/&#|\'|"|<|>/s', $text))
{ {
$text = $this->replaceConstants($text); $text = $this->replaceConstants($text);
@@ -1992,7 +1991,7 @@ class e_parse extends e_parser
} }
else else
{ {
return ''; return $text;
} }
} }

View File

@@ -1938,6 +1938,8 @@ class e_form
function select_open($name, $options = array()) function select_open($name, $options = array())
{ {
if(!is_array($options)) parse_str($options, $options); if(!is_array($options)) parse_str($options, $options);
if(vartrue($options['size']) && !is_numeric($options['size'])) if(vartrue($options['size']) && !is_numeric($options['size']))
{ {
@@ -1952,6 +1954,8 @@ class e_form
unset($options['size']); // don't include in html 'size='. unset($options['size']); // don't include in html 'size='.
} }
$options = $this->format_options('select', $name, $options); $options = $this->format_options('select', $name, $options);
return "<select name='{$name}'".$this->get_attributes($options, $name).">"; return "<select name='{$name}'".$this->get_attributes($options, $name).">";
@@ -1962,7 +1966,7 @@ class e_form
* @DEPRECATED - use select() instead. * @DEPRECATED - use select() instead.
*/ */
function selectbox($name, $option_array, $selected = false, $options = array(), $defaultBlank= false) function selectbox($name, $option_array, $selected = false, $options = array(), $defaultBlank= false)
{ {
return $this->select($name, $option_array, $selected, $options, $defaultBlank); return $this->select($name, $option_array, $selected, $options, $defaultBlank);
} }
@@ -4309,6 +4313,8 @@ class e_form
} }
} }
// XXX Fixes For the above. - use optArray variable. eg. $field['key']['writeParms']['optArray'] = array('one','two','three'); // XXX Fixes For the above. - use optArray variable. eg. $field['key']['writeParms']['optArray'] = array('one','two','three');
if(($attributes['type'] == 'dropdown' || $attributes['type'] == 'radio' || $attributes['type'] == 'checkboxes') && !empty($parms['optArray'])) if(($attributes['type'] == 'dropdown' || $attributes['type'] == 'radio' || $attributes['type'] == 'checkboxes') && !empty($parms['optArray']))
{ {
@@ -4576,13 +4582,25 @@ class e_form
case 'dropdown': case 'dropdown':
case 'comma': case 'comma':
$eloptions = vartrue($parms['__options'], array());
if(!empty($attributes['writeParms']['optArray']))
{
$eloptions = $attributes['writeParms'];
unset($eloptions['optArray']);
}
else
{
$eloptions = vartrue($parms['__options'], array());
}
if(is_string($eloptions)) parse_str($eloptions, $eloptions); if(is_string($eloptions)) parse_str($eloptions, $eloptions);
if($attributes['type'] === 'comma') $eloptions['multiple'] = true; if($attributes['type'] === 'comma') $eloptions['multiple'] = true;
unset($parms['__options']); unset($parms['__options']);
if(vartrue($eloptions['multiple']) && !is_array($value)) $value = explode(',', $value); if(vartrue($eloptions['multiple']) && !is_array($value)) $value = explode(',', $value);
// Allow Ajax API. // Allow Ajax API.
if(!empty($ajaxParms)) if(!empty($ajaxParms))
{ {
@@ -4590,6 +4608,7 @@ class e_form
$eloptions['class'] = 'e-ajax ' . varset($eloptions['class']); $eloptions['class'] = 'e-ajax ' . varset($eloptions['class']);
} }
$ret = vartrue($eloptions['pre']).$this->selectbox($key, $parms, $value, $eloptions).vartrue($eloptions['post']); $ret = vartrue($eloptions['pre']).$this->selectbox($key, $parms, $value, $eloptions).vartrue($eloptions['post']);
break; break;