diff options
author | Urban Müller | 2010-09-20 15:01:13 +0000 |
---|---|---|
committer | Urban Müller | 2010-09-20 15:01:13 +0000 |
commit | 0061f849fb1b36953be7f13413984043e55d388b (patch) | |
tree | 073a3b80108d9d8f4449c18f03bcc405076c160a /it_html.class | |
parent | f0969501a889abc254fdc7c8323f63053761fff3 (diff) | |
download | itools-0061f849fb1b36953be7f13413984043e55d388b.tar.gz itools-0061f849fb1b36953be7f13413984043e55d388b.tar.bz2 itools-0061f849fb1b36953be7f13413984043e55d388b.zip |
bugfixes
Diffstat (limited to 'it_html.class')
-rw-r--r-- | it_html.class | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/it_html.class b/it_html.class index 4c1fbae..a0211f8 100644 --- a/it_html.class +++ b/it_html.class @@ -76,7 +76,8 @@ function it_html($p = array()) if (!$this->p['prettyprint'] && $this->p['charset'] == "iso-8859-1" && $this->p['htmltype'] == "html" && !$GLOBALS['debug_srclines']) { $emptycloser = preg_match('/^(a|div|iframe|pre|script|span|td|textarea)$/i', $func) ? "</$func>" : ""; - $code[$func] = "function $func() { \$args = func_get_args(); return \$GLOBALS['{$this->p['name']}']->_tag_fast('$func', \$args, '$emptycloser'); }"; + $newline = isset($this->hasnonewline[$func]) ? '' : "\\n"; + $code[$func] = "function $func() { \$args = func_get_args(); return \$GLOBALS['{$this->p['name']}']->_tag_fast('$func', \$args, \"$newline\", '$emptycloser'); }"; } else $code[$func] = "function $func() { \$args = func_get_args(); return \$GLOBALS['{$this->p['name']}']->_tag('$func', \$args); }"; @@ -258,7 +259,7 @@ function _parse_args($args) /** * INTERNAL: Create html tag from name and args array (the arguments of the parent function) */ -function _tag_fast($name, $args, $emptycloser) +function _tag_fast($name, $args, $newline, $emptycloser) { foreach ($args as $arg) { @@ -266,10 +267,12 @@ function _tag_fast($name, $args, $emptycloser) { foreach ($arg as $key => $value) { - if (is_string($value)) + if (is_numeric($key)) + $content .= $value; + else if (is_string($value) || is_numeric($value)) { if (preg_match('/[<>&"\x00-\x08\x0a-\x0c\x0e-\x1f\x80-\x9f]/', $value)) # WARNING: copy/pasted from Q() - $attrs .= " $key=\"" . str_replace("\n", " ", it_html::latinize($value)) . '"'; + $attrs .= " $key=\"" . str_replace("\n", " ", htmlspecialchars(it_html::latinize($value))) . '"'; else $attrs .= " $key=\"$value\""; } @@ -281,7 +284,7 @@ function _tag_fast($name, $args, $emptycloser) $content .= $arg; } - return isset($content) ? "<$name$attrs>$content</$name>" : "<$name$attrs>$content$emptycloser"; + return isset($content) ? "<$name$attrs>$content</$name>$newline" : "<$name$attrs>$emptycloser$newline"; } function _tag($name, $args) |