From: Craig Andrews Date: Sat, 5 Dec 2009 01:19:55 +0000 (-0500) Subject: Add style function to output style() tags X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b3086d3c68ed2d3ceff3ce8fc91a867fc07c441a;p=quix0rs-gnu-social.git Add style function to output style() tags Add 2 new events: StartStyleElement and EndStyleElement --- diff --git a/EVENTS.txt b/EVENTS.txt index 678df8b0ae..a056aa0a1e 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -586,6 +586,18 @@ EndCssLinkElement: After a element is written - $theme - $media +StartStyleElement: Before a element is written +- $action +- &$code +- &$type +- &$media + +EndStyleElement: After a element is written +- $action +- $code +- $type +- $media + StartScriptElement: Before a element is written - $action - &$src diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 0c2d18da32..a88a5b82c5 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -418,6 +418,27 @@ class HTMLOutputter extends XMLOutputter } } + /** + * output a style (almost always css) tag with inline + * code. + * + * @param string $code code to put in the style tag + * @param string $type 'type' attribute value of the tag + * @param string $media 'media' attribute value of the tag + * + * @return void + */ + + function style($code, $type = 'text/css', $media = null) + { + if(Event::handle('StartStyleElement', array($this,&$code,&$type,&$media))) { + $this->elementStart('style', array('type' => $type, 'media' => $media)); + $this->raw($code); + $this->elementEnd('style'); + Event::handle('EndStyleElement', array($this,$code,$type,$media)); + } + } + /** * output an HTML textarea and associated elements *