From e9638b69801cee3e74a97825f9af3749c9322c53 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Tue, 27 Sep 2011 09:32:20 +0200 Subject: [PATCH] Adds theme info file to define 'parent' theme from where load tpl files --- include/text.php | 4 +- index.php | 7 ++++ view/theme/clean/nav.tpl | 51 ----------------------- view/theme/clean/theme.php | 4 ++ view/theme/darkness/nav.tpl | 51 ----------------------- view/theme/darkness/theme.php | 4 ++ view/theme/darkzero/nav.tpl | 51 ----------------------- view/theme/darkzero/theme.php | 4 ++ view/theme/duepuntozero/profile_vcard.tpl | 47 +++++++++++++++++++++ view/theme/duepuntozero/theme.php | 2 + view/theme/easterbunny/nav.tpl | 51 ----------------------- view/theme/easterbunny/theme.php | 4 ++ view/theme/goldenrod/nav.tpl | 51 ----------------------- view/theme/goldenrod/theme.php | 4 ++ view/theme/greenzero/nav.tpl | 51 ----------------------- view/theme/greenzero/theme.php | 4 ++ view/theme/loozah/profile_vcard.tpl | 47 +++++++++++++++++++++ view/theme/purplezero/nav.tpl | 51 ----------------------- view/theme/purplezero/theme.php | 4 ++ view/theme/shady/nav.tpl | 51 ----------------------- view/theme/shady/theme.php | 4 ++ view/theme/three-d/nav.tpl | 51 ----------------------- view/theme/three-d/theme.php | 4 ++ 23 files changed, 142 insertions(+), 460 deletions(-) delete mode 100644 view/theme/clean/nav.tpl create mode 100644 view/theme/clean/theme.php delete mode 100644 view/theme/darkness/nav.tpl create mode 100644 view/theme/darkness/theme.php delete mode 100644 view/theme/darkzero/nav.tpl create mode 100644 view/theme/darkzero/theme.php create mode 100644 view/theme/duepuntozero/profile_vcard.tpl create mode 100644 view/theme/duepuntozero/theme.php delete mode 100644 view/theme/easterbunny/nav.tpl create mode 100644 view/theme/easterbunny/theme.php delete mode 100644 view/theme/goldenrod/nav.tpl create mode 100644 view/theme/goldenrod/theme.php delete mode 100644 view/theme/greenzero/nav.tpl create mode 100644 view/theme/greenzero/theme.php create mode 100644 view/theme/loozah/profile_vcard.tpl delete mode 100644 view/theme/purplezero/nav.tpl create mode 100644 view/theme/purplezero/theme.php delete mode 100644 view/theme/shady/nav.tpl create mode 100644 view/theme/shady/theme.php delete mode 100644 view/theme/three-d/nav.tpl create mode 100644 view/theme/three-d/theme.php diff --git a/include/text.php b/include/text.php index ea64a3d282..656cd8809c 100644 --- a/include/text.php +++ b/include/text.php @@ -388,11 +388,13 @@ function get_intltext_template($s) { if(! function_exists('get_markup_template')) { function get_markup_template($s) { - + $a=get_app(); $theme = current_theme(); if(file_exists("view/theme/$theme/$s")) return file_get_contents("view/theme/$theme/$s"); + elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/$s")) + return file_get_contents("view/theme/".$a->theme_info["extends"]."/$s"); else return file_get_contents("view/$s"); diff --git a/index.php b/index.php index 98733c4c82..25fdb4f8c3 100644 --- a/index.php +++ b/index.php @@ -218,6 +218,13 @@ if(strlen($a->module)) { } } +/** + * load current theme info + */ +$theme_info_file = "view/theme/".current_theme()."/theme.php"; +if (file_exists($theme_info_file)){ + require_once($theme_info_file); +} /* initialise content region */ diff --git a/view/theme/clean/nav.tpl b/view/theme/clean/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/clean/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/clean/theme.php b/view/theme/clean/theme.php new file mode 100644 index 0000000000..47b43cf131 --- /dev/null +++ b/view/theme/clean/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'loozah', +); diff --git a/view/theme/darkness/nav.tpl b/view/theme/darkness/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/darkness/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/darkness/theme.php b/view/theme/darkness/theme.php new file mode 100644 index 0000000000..47b43cf131 --- /dev/null +++ b/view/theme/darkness/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'loozah', +); diff --git a/view/theme/darkzero/nav.tpl b/view/theme/darkzero/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/darkzero/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/darkzero/theme.php b/view/theme/darkzero/theme.php new file mode 100644 index 0000000000..338f40cbfb --- /dev/null +++ b/view/theme/darkzero/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'duepuntozero', +); diff --git a/view/theme/duepuntozero/profile_vcard.tpl b/view/theme/duepuntozero/profile_vcard.tpl new file mode 100644 index 0000000000..b3f5cc50d6 --- /dev/null +++ b/view/theme/duepuntozero/profile_vcard.tpl @@ -0,0 +1,47 @@ +
+ +
$profile.name
+ + + + {{ if $pdesc }}
$profile.pdesc
{{ endif }} +
$profile.name
+ + + + {{ if $location }} +
$location
+
+ {{ if $profile.address }}
$profile.address
{{ endif }} + + $profile.locality{{ if $profile.locality }}, {{ endif }} + $profile.region + $profile.postal-code + + {{ if $profile.country-name }}$profile.country-name{{ endif }} +
+
+ {{ endif }} + + {{ if $gender }}
$gender
$profile.gender
{{ endif }} + + {{ if $profile.pubkey }}{{ endif }} + + {{ if $marital }}
$marital
$profile.marital
{{ endif }} + + {{ if $homepage }}
$homepage
$profile.homepage
{{ endif }} + + {{ inc diaspora_vcard.tpl }}{{ endinc }} + + +
+ +$contact_block + + diff --git a/view/theme/duepuntozero/theme.php b/view/theme/duepuntozero/theme.php new file mode 100644 index 0000000000..ebced7b9b8 --- /dev/null +++ b/view/theme/duepuntozero/theme.php @@ -0,0 +1,2 @@ +theme_info = array(); diff --git a/view/theme/easterbunny/nav.tpl b/view/theme/easterbunny/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/easterbunny/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/easterbunny/theme.php b/view/theme/easterbunny/theme.php new file mode 100644 index 0000000000..47b43cf131 --- /dev/null +++ b/view/theme/easterbunny/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'loozah', +); diff --git a/view/theme/goldenrod/nav.tpl b/view/theme/goldenrod/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/goldenrod/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/goldenrod/theme.php b/view/theme/goldenrod/theme.php new file mode 100644 index 0000000000..47b43cf131 --- /dev/null +++ b/view/theme/goldenrod/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'loozah', +); diff --git a/view/theme/greenzero/nav.tpl b/view/theme/greenzero/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/greenzero/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/greenzero/theme.php b/view/theme/greenzero/theme.php new file mode 100644 index 0000000000..338f40cbfb --- /dev/null +++ b/view/theme/greenzero/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'duepuntozero', +); diff --git a/view/theme/loozah/profile_vcard.tpl b/view/theme/loozah/profile_vcard.tpl new file mode 100644 index 0000000000..b3f5cc50d6 --- /dev/null +++ b/view/theme/loozah/profile_vcard.tpl @@ -0,0 +1,47 @@ +
+ +
$profile.name
+ + + + {{ if $pdesc }}
$profile.pdesc
{{ endif }} +
$profile.name
+ + + + {{ if $location }} +
$location
+
+ {{ if $profile.address }}
$profile.address
{{ endif }} + + $profile.locality{{ if $profile.locality }}, {{ endif }} + $profile.region + $profile.postal-code + + {{ if $profile.country-name }}$profile.country-name{{ endif }} +
+
+ {{ endif }} + + {{ if $gender }}
$gender
$profile.gender
{{ endif }} + + {{ if $profile.pubkey }}{{ endif }} + + {{ if $marital }}
$marital
$profile.marital
{{ endif }} + + {{ if $homepage }}
$homepage
$profile.homepage
{{ endif }} + + {{ inc diaspora_vcard.tpl }}{{ endinc }} + + +
+ +$contact_block + + diff --git a/view/theme/purplezero/nav.tpl b/view/theme/purplezero/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/purplezero/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/purplezero/theme.php b/view/theme/purplezero/theme.php new file mode 100644 index 0000000000..338f40cbfb --- /dev/null +++ b/view/theme/purplezero/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'duepuntozero', +); diff --git a/view/theme/shady/nav.tpl b/view/theme/shady/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/shady/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/shady/theme.php b/view/theme/shady/theme.php new file mode 100644 index 0000000000..47b43cf131 --- /dev/null +++ b/view/theme/shady/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'loozah', +); diff --git a/view/theme/three-d/nav.tpl b/view/theme/three-d/nav.tpl deleted file mode 100644 index 2cd29a7c29..0000000000 --- a/view/theme/three-d/nav.tpl +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/view/theme/three-d/theme.php b/view/theme/three-d/theme.php new file mode 100644 index 0000000000..47b43cf131 --- /dev/null +++ b/view/theme/three-d/theme.php @@ -0,0 +1,4 @@ +theme_info = array( + 'extends' => 'loozah', +);