mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
- bugfix {make_nocache} failed when using composer autoloader https://github.com/smarty-php/smarty/issues/275
This commit is contained in:
@@ -67,7 +67,7 @@ class Smarty_Internal_Extension_Handler
|
||||
/* @var Smarty $data ->smarty */
|
||||
$smarty = isset($data->smarty) ? $data->smarty : $data;
|
||||
if (!isset($smarty->ext->$name)) {
|
||||
$class = 'Smarty_Internal_Method_' . ucfirst($name);
|
||||
$class = 'Smarty_Internal_Method_' . $this->upperCase($name);
|
||||
if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
|
||||
$pn = '';
|
||||
if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
|
||||
@@ -104,6 +104,19 @@ class Smarty_Internal_Extension_Handler
|
||||
return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make first character of name parts upper case
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function upperCase($name) {
|
||||
$_name = explode('_', $name);
|
||||
$_name = array_map('ucfirst', $_name);
|
||||
return implode('_', $_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* set extension property
|
||||
*
|
||||
@@ -129,9 +142,9 @@ class Smarty_Internal_Extension_Handler
|
||||
{
|
||||
// object properties of runtime template extensions will start with '_'
|
||||
if ($property_name[ 0 ] == '_') {
|
||||
$class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1));
|
||||
$class = 'Smarty_Internal_Runtime' . $this->upperCase($property_name);
|
||||
} else {
|
||||
$class = 'Smarty_Internal_Method_' . ucfirst($property_name);
|
||||
$class = 'Smarty_Internal_Method_' . $this->upperCase($property_name);
|
||||
}
|
||||
if (!class_exists($class)) {
|
||||
return $this->$property_name = new Smarty_Internal_Undefined($class);
|
||||
|
||||
Reference in New Issue
Block a user