Feed the to-be-escaped variable to escape_js_var
So it won't return an empty string anymore. The signature of escape_js_var is: mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) So we have to give at least three parameters. I wonder why it doesn't complain right now...
This commit is contained in:
parent
f3b14cd472
commit
b2727e6e9b
1 changed files with 3 additions and 3 deletions
|
@ -108,9 +108,9 @@ cursor: pointer;
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function escape_js_var($var) {
|
function escape_js_var($var) {
|
||||||
$var = preg_replace("([\\\'\"\/])", "\\$1");
|
$var = preg_replace("([\\\'\"\/])", "\\$1", $var);
|
||||||
$var = str_replace("\n", "\\n");
|
$var = str_replace("\n", "\\n", $var);
|
||||||
$var = str_replace("\r", "\\r");
|
$var = str_replace("\r", "\\r", $var);
|
||||||
|
|
||||||
return $var;
|
return $var;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue