From aa41944f233cf4efd2c261122e06de0d5a6f0d7a Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 19 Sep 2008 13:37:33 +0000 Subject: [PATCH] Commit the print_js_config, so people can see it as the read http://moodle.org/mod/forum/discuss.php?d=106312 --- lib/weblib.php | 55 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index d95dd75fb2..1d1884d342 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2737,15 +2737,12 @@ function get_require_js_code($loadlibs) { * @param string $function the name of the JavaScript function to call. * @param array $args an optional list of arguments to the function call. * @param boolean $return if true, return the HTML code, otherwise output it. + * @return mixed string if $return is true, otherwise nothing. */ function print_js_call($function, $args = array(), $return = false) { $quotedargs = array(); foreach ($args as $arg) { - if (is_number($arg)) { - $quotedargs[] = $arg; - } else { - $quotedargs[] = "'" . addslashes_js($arg) . "'"; - } + $quotedargs[] = "'" . addslashes_js($arg) . "'"; } $html = ''; $html .= '\n"; + if ($return) { + return $html; + } else { + echo $html; + } +} + /** * Debugging aid: serve page as 'application/xhtml+xml' where possible, * and substitute the XHTML strict document type. -- 2.39.5