]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/menu.php
Merge branch 'master' of git.gnu.io:Quix0r/gnu-social
[quix0rs-gnu-social.git] / lib / menu.php
index 236e99263d0bc418b18cb063f56c7b7eed938196..f0f797fe3257b609fa771d630667624b5b2e5989 100644 (file)
@@ -94,16 +94,20 @@ class Menu extends Widget
             $this->out->elementStart('ul', $attrs);
 
             foreach ($items as $item) {
+                assert(is_array($item));
+                assert(count($item) == 5);
+
                 list($actionName, $args, $label, $description, $id) = $item;
+
                 $this->item($actionName, $args, $label, $description, $id);
             }
-        
+
             $this->out->elementEnd('ul');
-            
+
             Event::handle('EndNav', array($this, $tag, $items));
         }
     }
-    
+
     function item($actionName, array $args, $label, $description, $id=null, $cls=null)
     {
         if (empty($id)) {
@@ -124,6 +128,12 @@ class Menu extends Widget
     {
         if ($actionName != $this->actionName) {
             return false;
+        } elseif (!is_array($args)) {
+            /*
+             * No array, then the below loop doesn't need to run and
+             * 'return false' will never be reached.
+             */
+            return true;
         }
 
         foreach ($this->actionArgs as $k => $v) {
@@ -134,11 +144,11 @@ class Menu extends Widget
 
         return true;
     }
-    
+
     function menuItemID($actionName, $args = null)
     {
         $id = sprintf('nav_%s', $actionName);
-        
+
         if (!is_null($args)) {
             foreach ($args as $key => $value) {
                 $id .= '_' . $key . '_' . $value;