]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add 4 new events: StartCssLinkElement, EndCssLinkElement, StartScriptElement, EndScri...
authorCraig Andrews <candrews@integralblue.com>
Fri, 4 Dec 2009 06:57:14 +0000 (01:57 -0500)
committerCraig Andrews <candrews@integralblue.com>
Fri, 4 Dec 2009 06:57:14 +0000 (01:57 -0500)
EVENTS.txt
lib/htmloutputter.php

index 34a222e8f3cf0d900ce3bd884c841fd6e328807d..f4ec620338c7be2d1a642231aad90b443a58f7e9 100644 (file)
@@ -574,3 +574,24 @@ EndShortenUrl: After a URL has been shortened
 - $shortenerName: name of the requested shortener
 - $shortenedUrl: short version of the url
 
+StartCssLinkElement: Before a <link rel="stylesheet"..> element is written
+- $action
+- &$src
+- &$theme
+- &$media
+
+EndCssLinkElement: After a <link rel="stylesheet"..> element is written
+- $action
+- $src
+- $theme
+- $media
+
+StartScriptElement: Before a <script...> element is written
+- $action
+- &$src
+- &$type
+
+EndScriptElement: After a <script...> element is written
+- $action
+- $src
+- $type
index d267526c8894f4063b3e8d620383a8591a14887a..a7c596917cefc0697c64426e8efe23411bf0ea88 100644 (file)
@@ -350,14 +350,17 @@ class HTMLOutputter extends XMLOutputter
      */
     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),
-                               ' ');
     }
 
     /**
@@ -371,19 +374,22 @@ class HTMLOutputter extends XMLOutputter
      */
     function cssLink($src,$theme=null,$media=null)
     {
-        $url = parse_url($src);
-        if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
-        {
-            if(file_exists(Theme::file($src,$theme))){
-               $src = Theme::path($src, $theme) . '?version=' . STATUSNET_VERSION;
-            }else{
-               $src = common_path($src);
+        if(Event::handle('StartCssLinkElement', array($this,&$src,&$theme,&$media))) {
+            $url = parse_url($src);
+            if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
+            {
+                if(file_exists(Theme::file($src,$theme))){
+                   $src = Theme::path($src, $theme) . '?version=' . STATUSNET_VERSION;
+                }else{
+                   $src = common_path($src);
+                }
             }
+            $this->element('link', array('rel' => 'stylesheet',
+                                    'type' => 'text/css',
+                                    'href' => $src,
+                                    'media' => $media));
+            Event::handle('EndCssLinkElement', array($this,$src,$theme,$media));
         }
-        $this->element('link', array('rel' => 'stylesheet',
-                                'type' => 'text/css',
-                                'href' => $src,
-                                'media' => $media));
     }
 
     /**