diff options
author | Urban Müller | 2010-05-03 12:52:39 +0000 |
---|---|---|
committer | Urban Müller | 2010-05-03 12:52:39 +0000 |
commit | c45905e16593dbee4f6fb1e5ce94fea39b3304a4 (patch) | |
tree | c95cea86c7272cf4df468fa60c33316356903270 | |
parent | 6c544459fd980f8bbb23c7da63e52039d1af0b9f (diff) | |
download | itools-c45905e16593dbee4f6fb1e5ce94fea39b3304a4.tar.gz itools-c45905e16593dbee4f6fb1e5ce94fea39b3304a4.tar.bz2 itools-c45905e16593dbee4f6fb1e5ce94fea39b3304a4.zip |
avoid trouble with single > in select text
-rw-r--r-- | it_html.class | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index 675e852..50223f4 100644 --- a/it_html.class +++ b/it_html.class @@ -366,16 +366,21 @@ function select($tags, $options, $selected = null) { $grouphtml = ""; foreach($option as $optval => $opt) - $grouphtml .= $this->_tag("option", array(array('value' => $optval, 'selected' => in_array((string)$optval, $selected)), strip_tags(Q(strip_tags($opt))))); + $grouphtml .= $this->_tag("option", array(array('value' => $optval, 'selected' => in_array((string)$optval, $selected)), self::_strip_span(Q(self::_strip_span($opt))))); $html .= $this->_tag("optgroup", array(array('label' => $value, $grouphtml))); } else - $html .= $this->_tag("option", array(array('value' => $value, 'selected' => in_array((string)$value, $selected), 'disabled' => $option === ""), (trim($option) === "") ? " " : strip_tags(Q(strip_tags($option))))); # strip_tags removes .q debug param coloring + $html .= $this->_tag("option", array(array('value' => $value, 'selected' => in_array((string)$value, $selected), 'disabled' => $option === ""), (trim($option) === "") ? " " : self::_strip_span(Q(self::_strip_span($option))))); # self::_strip_span removes .q debug param coloring } return $this->_tag("select", array($tags, $html)); } +# internal: strip spans added by debug params +function _strip_span($html) +{ + return preg_replace('!</?span[^>]*>!', '', $html); +} /** * Return HTML with all evil things stripped. Allowed are a coupld of simple |