From: Brion Vibber Date: Fri, 4 Dec 2009 20:23:33 +0000 (-0800) Subject: Merge commit 'refs/merge-requests/108' of git://gitorious.org/statusnet/mainline... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4afe07f0c3ab20d4007e94f9e4e9b35629b5f63e;p=quix0rs-gnu-social.git Merge commit 'refs/merge-requests/108' of git://gitorious.org/statusnet/mainline into 0.9.x --- 4afe07f0c3ab20d4007e94f9e4e9b35629b5f63e diff --cc lib/htmloutputter.php index 3fabc4037a,a7c596917c..a0066594f2 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@@ -350,35 -350,19 +350,38 @@@ class HTMLOutputter extends XMLOutputte */ function script($src, $type='text/javascript') { - $url = parse_url($src); - if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) - { - $src = common_path($src) . '?version=' . STATUSNET_VERSION; + if(Event::handle('StartScriptElement', array($this,&$src,&$type))) { + $url = parse_url($src); + if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) + { + $src = common_path($src) . '?version=' . STATUSNET_VERSION; + } + $this->element('script', array('type' => $type, + 'src' => $src), + ' '); + Event::handle('EndScriptElement', array($this,$src,$type)); } - $this->element('script', array('type' => $type, - 'src' => $src), - ' '); } + /** + * 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 *