From: Craig Andrews Date: Sat, 5 Dec 2009 00:51:44 +0000 (-0500) Subject: Add 2 new events: StartInlineScriptElement and EndInlineScriptElement X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7ddf911f5d54ba4997b3d237ae7cd1effb74a120;p=quix0rs-gnu-social.git Add 2 new events: StartInlineScriptElement and EndInlineScriptElement --- diff --git a/EVENTS.txt b/EVENTS.txt index f4ec620338..678df8b0ae 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -595,3 +595,13 @@ EndScriptElement: After a element is written - $action - $src - $type + +StartInlineScriptElement: Before a element is written +- $action +- &$code +- &$type + +EndInlineScriptElement: After a element is written +- $action +- $code +- $type diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 539e356e82..0c2d18da32 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -375,15 +375,18 @@ class HTMLOutputter extends XMLOutputter function inlineScript($code, $type='text/javascript') { - $this->elementStart('script', array('type' => $type)); - if($type == 'text/javascript') { - $this->raw('/*raw($code); - if($type == 'text/javascript') { - $this->raw(' /*]]>*/'); // XHTML compat + if(Event::handle('StartInlineScriptElement', array($this,&$code,&$type))) { + $this->elementStart('script', array('type' => $type)); + if($type == 'text/javascript') { + $this->raw('/*raw($code); + if($type == 'text/javascript') { + $this->raw(' /*]]>*/'); // XHTML compat + } + $this->elementEnd('script'); + Event::handle('EndInlineScriptElement', array($this,$code,$type)); } - $this->elementEnd('script'); } /**