summaryrefslogtreecommitdiff
path: root/lib/htmloutputter.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-04 13:39:51 -0500
committerEvan Prodromou <evan@status.net>2009-12-04 13:39:51 -0500
commit2c07d4a530e2e8ea6a48f08806f5026df1132152 (patch)
treee698741b08a06ac0263f476827d1ed5be11c2c54 /lib/htmloutputter.php
parentd2b42577de54204d83eb8eac565c25edd4205542 (diff)
utility function to output inline JavaScript
Diffstat (limited to 'lib/htmloutputter.php')
-rw-r--r--lib/htmloutputter.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index d267526c8..3fabc4037 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -361,6 +361,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('/*<![CDATA[*/ '); // XHTML compat for Safari
+ $this->raw($code);
+ $this->raw(' /*]]>*/'); // XHTML compat for Safari
+ $this->elementEnd('script');
+ }
+
+ /**
* output a css link
*
* @param string $src relative path within the theme directory, or an absolute path
@@ -414,7 +433,6 @@ class HTMLOutputter extends XMLOutputter
}
}
-
/**
* Internal script to autofocus the given element on page onload.
*