summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_html.class13
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", "&#10;", it_html::latinize($value)) . '"';
+ $attrs .= " $key=\"" . str_replace("\n", "&#10;", 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)