diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-06-17 04:34:42 +0800 | 
|---|---|---|
| committer | <unostar@danalan.info> | 2009-06-17 04:56:52 +0800 | 
| commit | 821918cb6545de1d581a48d7c8d639c294ac045f (patch) | |
| tree | 1e6996a5f6cd71eaf5c6b637bc7861517f9c2634 /modules/gallery | |
| parent | a405e69dbbc1060e900d822ccac63ee039b553a9 (diff) | |
Refactor common xxx_menu() code into private _menu() helper.
Signed-off-by:  <unostar@danalan.info>
Diffstat (limited to 'modules/gallery')
| -rw-r--r-- | modules/gallery/libraries/Theme_View.php | 41 | 
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));        }      } | 
