summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-16 13:34:42 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-16 13:34:42 -0700
commitab38c9277154504d321360a8555593696ee202eb (patch)
tree04dd24ba6aaf8e2d49de7b39228eab13e0a7f495
parentf7a4ac2b8fb4457514e48aaf4704d69a7a59e208 (diff)
Refactor common xxx_menu() code into private _menu() helper.
-rw-r--r--modules/gallery/libraries/Theme_View.php41
1 files changed, 9 insertions, 32 deletions
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 484b93b0..31c2faa7 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -109,50 +109,27 @@ class Theme_View_Core extends View {
}
public function album_menu() {
- $menu = Menu::factory("root");
- gallery_menu::album($menu, $this);
-
- foreach (module::active() as $module) {
- if ($module->name == "gallery") {
- continue;
- }
- $class = "{$module->name}_menu";
- if (method_exists($class, "album")) {
- call_user_func_array(array($class, "album"), array(&$menu, $this));
- }
- }
-
- print $menu;
+ $this->_menu("album");
}
public function tag_menu() {
- $menu = Menu::factory("root");
- gallery_menu::tag($menu, $this);
-
- foreach (module::active() as $module) {
- if ($module->name == "gallery") {
- continue;
- }
- $class = "{$module->name}_menu";
- if (method_exists($class, "tag")) {
- call_user_func_array(array($class, "tag"), array(&$menu, $this));
- }
- }
-
- print $menu;
+ $this->_menu("tag");
}
public function photo_menu() {
- $menu = Menu::factory("root");
- gallery_menu::photo($menu, $this);
+ $this->_menu("photo");
+ }
+ private function _menu($type) {
+ $menu = Menu::factory("root");
+ call_user_func_array(array("gallery_menu", $type), array(&$menu, $this));
foreach (module::active() as $module) {
if ($module->name == "gallery") {
continue;
}
$class = "{$module->name}_menu";
- if (method_exists($class, "photo")) {
- call_user_func_array(array($class, "photo"), array(&$menu, $this));
+ if (method_exists($class, $type)) {
+ call_user_func_array(array($class, $type), array(&$menu, $this));
}
}