move EndScriptMessages event into if block

This commit is contained in:
Evan Prodromou 2010-11-17 12:19:01 -05:00
parent a81bc5c0fd
commit bacc3d2a74

View 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));
if ($messages) {
}
if (!empty($messages)) {
$this->inlineScript('SN.messages=' . json_encode($messages));
}
return $messages;
}