From a179d6bdf87dc654d7afc903b48def3562a73af0 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 18 Jun 2009 04:34:18 +0800 Subject: Correct the "inappropriate intimacy" smell that bharat's refined senses pick up Signed-off-by: --- modules/gallery/libraries/Menu.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/gallery/libraries/Menu.php') diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 79274057..6d0881ce 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -146,6 +146,18 @@ class Menu_Core extends Menu_Element { } } + public function compact() { + foreach ($this->elements as $target_id => $element) { + if ($element->type == "submenu") { + if (empty($element->elements)) { + $this->remove($target_id); + } else { + $element->compact(); + } + } + } + } + public function __construct($type) { parent::__construct($type); $this->elements = array(); -- cgit v1.2.3