From 22149b52c309152b3e0e186159df9e80ae5c28f8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 27 Nov 2009 17:12:13 -0800 Subject: Move the theme fallback checking into theme::load_themes() so that we're calling it once per request. --- modules/gallery/libraries/Theme_View.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index b64deab9..817a46ad 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -29,12 +29,6 @@ class Theme_View_Core extends Gallery_View { * @return void */ public function __construct($name, $page_type, $page_subtype) { - $theme_name = module::get_var("gallery", "active_site_theme"); - if (!file_exists(THEMEPATH . $theme_name)) { - module::set_var("gallery", "active_site_theme", "wind"); - theme::load_themes(); - Kohana::log("error", "Unable to locate theme '$theme_name', switching to default theme."); - } parent::__construct($name); $this->theme_name = module::get_var("gallery", "active_site_theme"); -- cgit v1.2.3 From 3d4672ba88e2ef8cb47a9769e94fb3a45bdb3882 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 28 Nov 2009 23:48:38 -0800 Subject: Give the theme a chance to handle theme function callbacks as well. --- modules/gallery/libraries/Theme_View.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 817a46ad..f78a7018 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -265,6 +265,13 @@ class Theme_View_Core extends Gallery_View { } } + $helper_class = theme::$site_theme_name . "_theme"; + if (method_exists($helper_class, $function)) { + $blocks[] = call_user_func_array( + array($helper_class, $function), + array_merge(array($this), $args)); + } + if ($function == "head") { array_unshift($blocks, $this->combine_files($this->css, "css")); array_unshift($blocks, $this->combine_files($this->scripts, "javascript")); -- cgit v1.2.3