summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/admin_themes.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-18 08:38:11 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-18 08:38:11 -0800
commit4d4e81ca267cf6dd4fd48c2185d6e24949e0568f (patch)
tree935ca8d4f4d834fb8fc0de22a708227806107206 /modules/gallery/controllers/admin_themes.php
parent9d45cc040d76f86fe990e4c759fdd863c382ec87 (diff)
Create a helper to load the theme information from theme.info
Diffstat (limited to 'modules/gallery/controllers/admin_themes.php')
-rw-r--r--modules/gallery/controllers/admin_themes.php21
1 files changed, 6 insertions, 15 deletions
diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php
index 24f91aba..23685c90 100644
--- a/modules/gallery/controllers/admin_themes.php
+++ b/modules/gallery/controllers/admin_themes.php
@@ -34,22 +34,15 @@ class Admin_Themes_Controller extends Admin_Controller {
continue;
}
- $file = THEMEPATH . "$theme_name/theme.info";
- $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
- $theme_info->description = t($theme_info->description);
- $theme_info->name = t($theme_info->name);
-
- $themes[$theme_name] = $theme_info;
+ $themes[$theme_name] = theme::get_info($theme_name);
}
return $themes;
}
public function preview($type, $theme_name) {
$view = new View("admin_themes_preview.html");
- $theme_name = preg_replace("/[^\w]/", "", $theme_name);
- $view->info = new ArrayObject(
- parse_ini_file(THEMEPATH . "$theme_name/theme.info"), ArrayObject::ARRAY_AS_PROPS);
- $view->theme_name = $theme_name;
+ $view->info = theme::get_info($theme_name);
+ $view->theme_name = t($theme_name);
$view->type = $type;
if ($type == "admin") {
$view->url = url::site("admin?theme=$theme_name");
@@ -62,18 +55,16 @@ class Admin_Themes_Controller extends Admin_Controller {
public function choose($type, $theme_name) {
access::verify_csrf();
- $theme_name = preg_replace("/[^\w]/", "", $theme_name);
- $info = new ArrayObject(
- parse_ini_file(THEMEPATH . "$theme_name/theme.info"), ArrayObject::ARRAY_AS_PROPS);
+ $info = theme::get_info($theme_name);
if ($type == "admin" && $info->admin) {
module::set_var("gallery", "active_admin_theme", $theme_name);
message::success(t("Successfully changed your admin theme to <b>%theme_name</b>",
- array("theme_name" => t($info->name))));
+ array("theme_name" => $info->name)));
} else if ($type == "site" && $info->site) {
module::set_var("gallery", "active_site_theme", $theme_name);
message::success(t("Successfully changed your Gallery theme to <b>%theme_name</b>",
- array("theme_name" => t($info->name))));
+ array("theme_name" => $info->name)));
}
url::redirect("admin/themes");