Create a helper to load the theme information from theme.info

This commit is contained in:
Tim Almdal
2009-11-18 08:38:11 -08:00
parent 9d45cc040d
commit 4d4e81ca26
2 changed files with 17 additions and 16 deletions
+11 -1
View File
@@ -29,8 +29,8 @@ class theme_Core {
* active for any given request.
*/
static function load_themes() {
$path = Input::instance()->server("PATH_INFO");
$input = Input::instance();
$path = $input->server("PATH_INFO");
if (empty($path)) {
$path = "/" . $input->get("kohana_uri");
}
@@ -67,5 +67,15 @@ class theme_Core {
$group->submit("")->value(t("Save"));
return $form;
}
static function get_info($theme_name) {
$theme_name = preg_replace("/[^\w]/", "", $theme_name);
$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);
return $theme_info;
}
}