Commit 944178c2 by pupi1985

Added support for boolean values to the qa_js function

parent 7ccba454
......@@ -844,10 +844,14 @@
function qa_js($value, $forcequotes=false)
/*
Return JavaScript representation of $value, putting in quotes if non-numeric or if $forcequotes is true
Return JavaScript representation of $value, putting in quotes if non-numeric or if $forcequotes is true. In the
case of boolean values they are returned as the appropriate true or false string
*/
{
if (is_numeric($value) && !$forcequotes)
$boolean = is_bool($value);
if ($boolean)
$value = $value ? 'true' : 'false';
if ((is_numeric($value) || $boolean) && !$forcequotes)
return $value;
else
return "'".strtr($value, array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment