summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-15 20:58:45 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-15 20:58:45 +0100
commitcfaf8c4ef695f78fffef9b60a05bb89e2270b78b (patch)
tree259ac82b2621afc9e73e1a52dd2310ab7811e29e
parentb951f8bea45c23b9ccd192865c81cf18f13ea08a (diff)
[ci skip] Don't use output buffering in URL helper safe_mailto()
-rw-r--r--system/helpers/url_helper.php35
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;
}
}