diff options
author | patdenice <patdenice@piwigo.org> | 2009-10-01 15:11:58 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2009-10-01 15:11:58 +0000 |
commit | 9e1b5427963ce7350ccac91bbb9da0e508920903 (patch) | |
tree | 46c77c7c8d75bac6b3a171524d39f9b6fea7cbfd /include | |
parent | 162a4d1b78544a33cb04919b7214c26245c470bc (diff) |
Simplification of commit 3951.
git-svn-id: http://piwigo.org/svn/trunk@3953 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/template.class.php | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/include/template.class.php b/include/template.class.php index 15d7bc3fa..d71b23263 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -431,19 +431,19 @@ class Template { */ function set_prefilter($handle, $callback, $weight=50) { - $this->external_filters[$handle][$weight][] = array('pre', $callback); + $this->external_filters[$handle][$weight][] = array('prefilter', $callback); ksort($this->external_filters[$handle]); } function set_postfilter($handle, $callback, $weight=50) { - $this->external_filters[$handle][$weight][] = array('post', $callback); + $this->external_filters[$handle][$weight][] = array('postfilter', $callback); ksort($this->external_filters[$handle]); } function set_outputfilter($handle, $callback, $weight=50) { - $this->external_filters[$handle][$weight][] = array('output', $callback); + $this->external_filters[$handle][$weight][] = array('outputfilter', $callback); ksort($this->external_filters[$handle]); } @@ -463,18 +463,7 @@ class Template { { list($type, $callback) = $filter; $compile_id .= $type.( is_array($callback) ? implode('', $callback) : $callback ); - switch ($type) - { - case 'pre': - $this->smarty->register_prefilter($callback); - break; - case 'post': - $this->smarty->register_postfilter($callback); - break; - case 'output': - $this->smarty->register_outputfilter($callback); - break; - } + call_user_func(array($this->smarty, 'register_'.$type), $callback); } } $this->smarty->compile_id .= '.'.base_convert(crc32($compile_id), 10, 36); @@ -490,18 +479,7 @@ class Template { foreach ($filters as $filter) { list($type, $callback) = $filter; - switch ($type) - { - case 'pre': - $this->smarty->unregister_prefilter($callback); - break; - case 'post': - $this->smarty->unregister_postfilter($callback); - break; - case 'output': - $this->smarty->unregister_outputfilter($callback); - break; - } + call_user_func(array($this->smarty, 'unregister_'.$type), $callback); } } } |