mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- bugfix look for mixed case plugin file names as in 3.0 if not found try all lowercase
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== Smarty 3.1 trunk =====
|
===== Smarty 3.1 trunk =====
|
||||||
|
21.09.2011
|
||||||
|
- bugfix look for mixed case plugin file names as in 3.0 if not found try all lowercase
|
||||||
|
|
||||||
20.09.2011
|
20.09.2011
|
||||||
- bugfix removed debug echo output while compiling template inheritance
|
- bugfix removed debug echo output while compiling template inheritance
|
||||||
- bugfix relative paths in $template_dir broke relative path resolving in {include "../foo.tpl"}
|
- bugfix relative paths in $template_dir broke relative path resolving in {include "../foo.tpl"}
|
||||||
|
@@ -1176,16 +1176,15 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
|
if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
|
||||||
return true;
|
return true;
|
||||||
// Plugin name is expected to be: Smarty_[Type]_[Name]
|
// Plugin name is expected to be: Smarty_[Type]_[Name]
|
||||||
$_plugin_name = strtolower($plugin_name);
|
$_name_parts = explode('_', $plugin_name, 3);
|
||||||
$_name_parts = explode('_', $_plugin_name, 3);
|
|
||||||
// class name must have three parts to be valid plugin
|
// class name must have three parts to be valid plugin
|
||||||
if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
|
if (count($_name_parts) < 3 || strtolower($_name_parts[0]) !== 'smarty') {
|
||||||
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if type is "internal", get plugin from sysplugins
|
// if type is "internal", get plugin from sysplugins
|
||||||
if ($_name_parts[1] == 'internal') {
|
if (strtolower($_name_parts[1]) == 'internal') {
|
||||||
$file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
|
$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require_once($file);
|
require_once($file);
|
||||||
return $file;
|
return $file;
|
||||||
@@ -1197,17 +1196,21 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
|
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
|
||||||
// loop through plugin dirs and find the plugin
|
// loop through plugin dirs and find the plugin
|
||||||
foreach($this->getPluginsDir() as $_plugin_dir) {
|
foreach($this->getPluginsDir() as $_plugin_dir) {
|
||||||
$file = $_plugin_dir . $_plugin_filename;
|
$names = array();
|
||||||
if (file_exists($file)) {
|
$names[] = $_plugin_dir . $_plugin_filename;
|
||||||
require_once($file);
|
$names[] = $_plugin_dir . strtolower($_plugin_filename);
|
||||||
return $file;
|
foreach ($names as $file) {
|
||||||
}
|
if (file_exists($file)) {
|
||||||
if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
|
|
||||||
// try PHP include_path
|
|
||||||
if (($file = Smarty_Internal_Get_Include_Path::getIncludePath($file)) !== false) {
|
|
||||||
require_once($file);
|
require_once($file);
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
|
||||||
|
// try PHP include_path
|
||||||
|
if (($file = Smarty_Internal_Get_Include_Path::getIncludePath($file)) !== false) {
|
||||||
|
require_once($file);
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no plugin loaded
|
// no plugin loaded
|
||||||
|
Reference in New Issue
Block a user