diff options
-rw-r--r-- | system/helpers/url_helper.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index a9790e5c4..5f11a42ca 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -342,23 +342,24 @@ if ( ! function_exists('safe_mailto')) $x[] = '<'; $x[] = '/'; $x[] = 'a'; $x[] = '>'; $x = array_reverse($x); - ob_start(); - - ?><script type="text/javascript"> - //<![CDATA[ - var l=new Array(); - <?php - for ($i = 0, $c = count($x); $i < $c; $i++) { ?>l[<?php echo $i; ?>]='<?php echo $x[$i]; ?>';<?php } ?> - - for (var i = l.length-1; i >= 0; i=i-1){ - if (l[i].substring(0, 1) === '|') document.write("&#"+unescape(l[i].substring(1))+";"); - else document.write(unescape(l[i]));} - //]]> - </script><?php - - $buffer = ob_get_contents(); - ob_end_clean(); - return $buffer; + + $output = "<script type=\"text/javascript\">\n" + ."\t//<![CDATA[\n" + ."\tvar l=new Array();\n"; + + for ($i = 0, $c = count($x); $i < $c; $i++) + { + $output .= "\tl[".$i."] = '".$x[$i]."';\n"; + } + + $output .= "\n\tfor (var i = l.length-1; i >= 0; i=i-1) {\n" + ."\t\tif (l[i].substring(0, 1) === '|') document.write(\"&#\"+unescape(l[i].substring(1))+\";\");\n" + ."\t\telse document.write(unescape(l[i]));\n" + ."\t}\n" + ."\t//]]>\n" + .'</script>'; + + return $output; } } |