made plugin-names case-insensitive. this affects

compiler/block/custom-functions and modifers.
This commit is contained in:
messju
2003-04-27 18:04:33 +00:00
parent f3dfdc5ec1
commit 86aff4030b
3 changed files with 12 additions and 9 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- made plugin-names case-insensitive. this affects compiler/block/custom-
functions and modifers. (messju)
- remove unnecessary close/open tags from compiled templates - remove unnecessary close/open tags from compiled templates
(Monte) (Monte)
- fixed errornous creation of '//' in image_path in html_image (messju) - fixed errornous creation of '//' in image_path in html_image (messju)

View File

@@ -683,7 +683,7 @@ class Smarty
*/ */
function register_function($function, $function_impl) function register_function($function, $function_impl)
{ {
$this->_plugins['function'][$function] = $this->_plugins['function'][strtolower($function)] =
array($function_impl, null, null, false); array($function_impl, null, null, false);
} }
@@ -694,7 +694,7 @@ class Smarty
*/ */
function unregister_function($function) function unregister_function($function)
{ {
unset($this->_plugins['function'][$function]); unset($this->_plugins['function'][strtolower($function)]);
} }
/** /**
@@ -732,7 +732,7 @@ class Smarty
*/ */
function register_block($block, $block_impl) function register_block($block, $block_impl)
{ {
$this->_plugins['block'][$block] = $this->_plugins['block'][strtolower($block)] =
array($block_impl, null, null, false); array($block_impl, null, null, false);
} }
@@ -743,7 +743,7 @@ class Smarty
*/ */
function unregister_block($block) function unregister_block($block)
{ {
unset($this->_plugins['block'][$block]); unset($this->_plugins['block'][strtolower($block)]);
} }
/** /**
@@ -754,7 +754,7 @@ class Smarty
*/ */
function register_compiler_function($function, $function_impl) function register_compiler_function($function, $function_impl)
{ {
$this->_plugins['compiler'][$function] = $this->_plugins['compiler'][strtolower($function)] =
array($function_impl, null, null, false); array($function_impl, null, null, false);
} }
@@ -765,7 +765,7 @@ class Smarty
*/ */
function unregister_compiler_function($function) function unregister_compiler_function($function)
{ {
unset($this->_plugins['compiler'][$function]); unset($this->_plugins['compiler'][strtolower($function)]);
} }
/** /**
@@ -776,7 +776,7 @@ class Smarty
*/ */
function register_modifier($modifier, $modifier_impl) function register_modifier($modifier, $modifier_impl)
{ {
$this->_plugins['modifier'][$modifier] = $this->_plugins['modifier'][strtolower($modifier)] =
array($modifier_impl, null, null, false); array($modifier_impl, null, null, false);
} }
@@ -787,7 +787,7 @@ class Smarty
*/ */
function unregister_modifier($modifier) function unregister_modifier($modifier)
{ {
unset($this->_plugins['modifier'][$modifier]); unset($this->_plugins['modifier'][strtolower($modifier)]);
} }
/** /**

View File

@@ -402,6 +402,7 @@ class Smarty_Compiler extends Smarty {
return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier); return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier);
} }
$tag_command = strtolower($tag_command);
switch ($tag_command) { switch ($tag_command) {
case 'include': case 'include':
return $this->_compile_include_tag($tag_args); return $this->_compile_include_tag($tag_args);
@@ -1598,7 +1599,7 @@ class Smarty_Compiler extends Smarty {
list(, $_modifiers, $modifier_arg_strings) = $_match; list(, $_modifiers, $modifier_arg_strings) = $_match;
for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) { for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) {
$_modifier_name = $_modifiers[$_i]; $_modifier_name = strtolower($_modifiers[$_i]);
if($_modifier_name == 'smarty') { if($_modifier_name == 'smarty') {
// skip smarty modifier // skip smarty modifier