]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
move EndScriptMessages event into if block
authorEvan Prodromou <evan@status.net>
Wed, 17 Nov 2010 17:19:01 +0000 (12:19 -0500)
committerEvan Prodromou <evan@status.net>
Wed, 17 Nov 2010 17:19:01 +0000 (12:19 -0500)
lib/action.php

index 17d3e2311aa9a81f945572a638c48ad0b603ad23..c2285894ea4dde8810842020dea2a54b4d1c8f70 100644 (file)
@@ -300,9 +300,11 @@ class Action extends HTMLOutputter // lawsuit
      * events and appending to the array. Try to avoid adding strings that won't be used, as
      * they'll be added to HTML output.
      */
+    
     function showScriptMessages()
     {
         $messages = array();
+       
         if (Event::handle('StartScriptMessages', array($this, &$messages))) {
             // Common messages needed for timeline views etc...
 
@@ -310,11 +312,14 @@ class Action extends HTMLOutputter // lawsuit
             $messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more');
 
             $messages = array_merge($messages, $this->getScriptMessages());
+           
+           Event::handle('EndScriptMessages', array($this, &$messages));
         }
-        Event::handle('EndScriptMessages', array($this, &$messages));
-        if ($messages) {
+       
+        if (!empty($messages)) {
             $this->inlineScript('SN.messages=' . json_encode($messages));
         }
+       
         return $messages;
     }