]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fixes Ticket #1607 - empty 'page-notice' definition lists were
authorZach Copley <zach@controlyourself.ca>
Sat, 13 Jun 2009 00:06:42 +0000 (17:06 -0700)
committerZach Copley <zach@controlyourself.ca>
Sat, 13 Jun 2009 00:06:42 +0000 (17:06 -0700)
being output in a bunch of places.

lib/action.php

index 7643e5afb872907ba41b798b629611bbc4255f60..89a8c8f4d3aa1c5af24440a528f865db5287c6f9 100644 (file)
@@ -575,20 +575,32 @@ class Action extends HTMLOutputter // lawsuit
     /**
      * Show page notice block.
      *
+     * Only show the block if a subclassed action has overrided
+     * Action::showPageNotice(), or an event handler is registered for
+     * the StartShowPageNotice event, in which case we assume the
+     * 'page_notice' definition list is desired.  This is to prevent
+     * empty 'page_notice' definition lists from being output everywhere.
+     *
      * @return nothing
      */
     function showPageNoticeBlock()
     {
-        $this->elementStart('dl', array('id' => 'page_notice',
-                                        'class' => 'system_notice'));
-        $this->element('dt', null, _('Page notice'));
-        $this->elementStart('dd');
-        if (Event::handle('StartShowPageNotice', array($this))) {
-            $this->showPageNotice();
-            Event::handle('EndShowPageNotice', array($this));
+        $rmethod = new ReflectionMethod($this, 'showPageNotice');
+        $dclass = $rmethod->getDeclaringClass()->getName();
+
+        if ($dclass != 'Action' || Event::hasHandler('StartShowPageNotice')) {
+
+            $this->elementStart('dl', array('id' => 'page_notice',
+                                            'class' => 'system_notice'));
+            $this->element('dt', null, _('Page notice'));
+            $this->elementStart('dd');
+            if (Event::handle('StartShowPageNotice', array($this))) {
+                $this->showPageNotice();
+                Event::handle('EndShowPageNotice', array($this));
+            }
+            $this->elementEnd('dd');
+            $this->elementEnd('dl');
         }
-        $this->elementEnd('dd');
-        $this->elementEnd('dl');
     }
 
     /**