summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-06-17 13:34:18 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-06-17 13:34:18 -0700
commita6a9b256ae7ac686ed1f53c05275ae702fb37aad (patch)
tree1e47dbd3939c83d5e582debc9a9e4be0f2a0ecdc /modules
parent5b767b6443011031190ce2d7580dca2d6dc33e19 (diff)
Correct the "inappropriate intimacy" smell that bharat's refined senses pick up
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/Admin_View.php15
-rw-r--r--modules/gallery/libraries/Menu.php12
-rw-r--r--modules/gallery/libraries/Theme_View.php15
3 files changed, 14 insertions, 28 deletions
diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php
index 11a96d75..7a7396eb 100644
--- a/modules/gallery/libraries/Admin_View.php
+++ b/modules/gallery/libraries/Admin_View.php
@@ -69,23 +69,10 @@ class Admin_View_Core extends View {
}
}
- $this->_remove_empty_items($menu);
+ $menu->compact();
print $menu;
}
- private function _remove_empty_items($menu) {
- foreach ($menu->elements as $target_id => $element) {
- if ($element->type == "submenu") {
- if (empty($element->elements)) {
- $menu->remove($target_id);
- } else {
- $this->_remove_empty_items($element);
- }
- }
- }
- }
-
-
/**
* Print out any site wide status information.
*/
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();
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 904a3c07..7b2ca840 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -103,25 +103,12 @@ class Theme_View_Core extends View {
call_user_func_array(array($class, "site"), array(&$menu, $this));
}
}
-
- $this->_remove_empty_items($menu);
}
+ $menu->compact();
print $menu;
}
- private function _remove_empty_items($menu) {
- foreach ($menu->elements as $target_id => $element) {
- if ($element->type == "submenu") {
- if (empty($element->elements)) {
- $menu->remove($target_id);
- } else {
- $this->_remove_empty_items($element);
- }
- }
- }
- }
-
public function album_menu() {
$this->_menu("album");
}