diff options
author | rvelices <rv-github@modusoptimus.com> | 2010-03-18 18:40:00 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2010-03-18 18:40:00 +0000 |
commit | 4f80b6095c3d44fa82e594d27d89cbf98c3c7042 (patch) | |
tree | e965bd2b3849d08a359ab0cf782e867873d8f856 | |
parent | 15fdea6925f005d057e748707a07bc571685d6e2 (diff) |
- allow template class to be instantiated with an empty theme (in plugins for example)
- local_head must now be defined in the themeconf.inc.php otherwise not taken into account (avoid several calls to file_exists)
- renamed themeconf['theme'] to themeconf['name'] (this is what it is themeconf[theme] is confusing)
git-svn-id: http://piwigo.org/svn/trunk@5177 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/themes/clear/themeconf.inc.php | 2 | ||||
-rw-r--r-- | admin/themes/default/themeconf.inc.php | 3 | ||||
-rw-r--r-- | admin/themes/roma/themeconf.inc.php | 2 | ||||
-rw-r--r-- | include/template.class.php | 32 | ||||
-rw-r--r-- | themes/Sylvia/themeconf.inc.php | 2 | ||||
-rw-r--r-- | themes/clear/themeconf.inc.php | 2 | ||||
-rw-r--r-- | themes/dark/themeconf.inc.php | 2 | ||||
-rw-r--r-- | themes/default/themeconf.inc.php | 3 |
8 files changed, 22 insertions, 26 deletions
diff --git a/admin/themes/clear/themeconf.inc.php b/admin/themes/clear/themeconf.inc.php index e007a971d..a73ebbcec 100644 --- a/admin/themes/clear/themeconf.inc.php +++ b/admin/themes/clear/themeconf.inc.php @@ -1,6 +1,6 @@ <?php
$themeconf = array(
- 'theme' => 'clear',
+ 'name' => 'clear',
'parent' => 'default',
'admin_icon_dir' => 'admin/themes/clear/icon',
);
diff --git a/admin/themes/default/themeconf.inc.php b/admin/themes/default/themeconf.inc.php index 36352b2b2..9a6b8fe42 100644 --- a/admin/themes/default/themeconf.inc.php +++ b/admin/themes/default/themeconf.inc.php @@ -1,8 +1,9 @@ <?php $themeconf = array( - 'theme' => 'default', + 'name' => 'default', 'icon_dir' => 'themes/default/icon', 'admin_icon_dir' => 'admin/themes/default/icon', 'mime_icon_dir' => 'themes/default/icon/mimetypes/', + 'local_head' => 'local_head.tpl', ); ?> diff --git a/admin/themes/roma/themeconf.inc.php b/admin/themes/roma/themeconf.inc.php index 886ed60db..f6ec175e2 100644 --- a/admin/themes/roma/themeconf.inc.php +++ b/admin/themes/roma/themeconf.inc.php @@ -1,6 +1,6 @@ <?php $themeconf = array( - 'theme' => 'roma', + 'name' => 'roma', 'parent' => 'default', ); ?> diff --git a/include/template.class.php b/include/template.class.php index 453266706..86200a978 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -24,15 +24,6 @@ require_once(PHPWG_ROOT_PATH.'include/smarty/libs/Smarty.class.php'); -// migrate lang:XXX -// sed "s/{lang:\([^}]\+\)}/{\'\1\'|@translate}/g" my_template.tpl -// migrate change root level vars {XXX} -// sed "s/{pwg_root}/{ROOT_URL}/g" my_template.tpl -// migrate change root level vars {XXX} -// sed "s/{\([a-zA-Z_]\+\)}/{$\1}/g" my_template.tpl -// migrate all -// cat my_template.tpl | sed "s/{lang:\([^}]\+\)}/{\'\1\'|@translate}/g" | sed "s/{pwg_root}/{ROOT_URL}/g" | sed "s/{\([a-zA-Z_]\+\)}/{$\1}/g" - class Template { @@ -48,7 +39,7 @@ class Template { // Templates prefilter from external sources (plugins) var $external_filters = array(); - + // used by html_head smarty block to add content before </head> var $html_head_elements = array(); @@ -78,7 +69,10 @@ class Template { } $this->smarty->template_dir = array(); - $this->set_theme($root, $theme, $path); + if ( !empty($theme) ) + $this->set_theme($root, $theme, $path); + else + $this->set_template_dir($root); $this->smarty->assign('lang_info', $lang_info); @@ -103,10 +97,10 @@ class Template { $this->set_theme($root, $themeconf['parent'], $path); } - $tpl_var = array('name' => $themeconf['theme']); - if (file_exists($root.'/'.$theme.'/local_head.tpl')) + $tpl_var = array('name' => $themeconf['name']); + if (!empty($themeconf['local_head']) ) { - $tpl_var['local_head'] = realpath($root.'/'.$theme.'/local_head.tpl'); + $tpl_var['local_head'] = realpath($root.'/'.$theme.'/'.$themeconf['local_head'] ); } $this->smarty->append('themes', $tpl_var); $this->smarty->append('themeconf', $themeconf, true); @@ -468,7 +462,7 @@ class Template { $this->external_filters[$handle][$weight][] = array('outputfilter', $callback); ksort($this->external_filters[$handle]); } - + /** * This function actually triggers the filters on the tpl files. * Called in the parse method. @@ -479,9 +473,9 @@ class Template { if (isset($this->external_filters[$handle])) { $compile_id = ''; - foreach ($this->external_filters[$handle] as $filters) + foreach ($this->external_filters[$handle] as $filters) { - foreach ($filters as $filter) + foreach ($filters as $filter) { list($type, $callback) = $filter; $compile_id .= $type.( is_array($callback) ? implode('', $callback) : $callback ); @@ -496,9 +490,9 @@ class Template { { if (isset($this->external_filters[$handle])) { - foreach ($this->external_filters[$handle] as $filters) + foreach ($this->external_filters[$handle] as $filters) { - foreach ($filters as $filter) + foreach ($filters as $filter) { list($type, $callback) = $filter; call_user_func(array($this->smarty, 'unregister_'.$type), $callback); diff --git a/themes/Sylvia/themeconf.inc.php b/themes/Sylvia/themeconf.inc.php index 97af90564..d56f805ba 100644 --- a/themes/Sylvia/themeconf.inc.php +++ b/themes/Sylvia/themeconf.inc.php @@ -1,6 +1,6 @@ <?php $themeconf = array( - 'theme' => 'Sylvia', + 'name' => 'Sylvia', 'parent' => 'default', 'icon_dir' => 'themes/Sylvia/icon', 'mime_icon_dir' => 'themes/Sylvia/icon/mimetypes/', diff --git a/themes/clear/themeconf.inc.php b/themes/clear/themeconf.inc.php index 771a5be7b..1ce4817e9 100644 --- a/themes/clear/themeconf.inc.php +++ b/themes/clear/themeconf.inc.php @@ -1,6 +1,6 @@ <?php $themeconf = array( - 'theme' => 'clear', + 'name' => 'clear', 'parent' => 'default', ); ?> diff --git a/themes/dark/themeconf.inc.php b/themes/dark/themeconf.inc.php index 48ed9577c..018b97338 100644 --- a/themes/dark/themeconf.inc.php +++ b/themes/dark/themeconf.inc.php @@ -1,6 +1,6 @@ <?php $themeconf = array( - 'theme' => 'dark', + 'name' => 'dark', 'parent' => 'default', ); ?> diff --git a/themes/default/themeconf.inc.php b/themes/default/themeconf.inc.php index 0386fc4c6..50ab59819 100644 --- a/themes/default/themeconf.inc.php +++ b/themes/default/themeconf.inc.php @@ -1,7 +1,8 @@ <?php $themeconf = array( - 'theme' => 'default', + 'name' => 'default', 'icon_dir' => 'themes/default/icon', 'mime_icon_dir' => 'themes/default/icon/mimetypes/', + 'local_head' => 'local_head.tpl', ); ?> |