From 2c07d4a530e2e8ea6a48f08806f5026df1132152 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 4 Dec 2009 13:39:51 -0500 Subject: [PATCH] utility function to output inline JavaScript --- lib/htmloutputter.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index d267526c88..3fabc4037a 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -360,6 +360,25 @@ class HTMLOutputter extends XMLOutputter ' '); } + /** + * output a script (almost always javascript) tag with inline + * code. + * + * @param string $code relative or absolute script path + * @param string $type 'type' attribute value of the tag + * + * @return void + */ + + function inlineScript($code, $type='text/javascript') + { + $this->elementStart('script', array('type' => $type)); + $this->raw('/*raw($code); + $this->raw(' /*]]>*/'); // XHTML compat for Safari + $this->elementEnd('script'); + } + /** * output a css link * @@ -414,7 +433,6 @@ class HTMLOutputter extends XMLOutputter } } - /** * Internal script to autofocus the given element on page onload. * -- 2.39.5