mirror of
https://github.com/smarty-php/smarty.git
synced 2025-09-25 20:00:54 +02:00
whitespace
This commit is contained in:
@@ -19,7 +19,7 @@ const SMARTY_HELPER_FUNCTIONS_LOADED = true;
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_ucfirst_ascii($string): string {
|
function smarty_ucfirst_ascii($string): string {
|
||||||
return smarty_strtoupper_ascii(substr($string, 0, 1)) . substr($string, 1);
|
return smarty_strtoupper_ascii(substr($string, 0, 1)) . substr($string, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@ function smarty_ucfirst_ascii($string): string {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_strtolower_ascii($string): string {
|
function smarty_strtolower_ascii($string): string {
|
||||||
return strtr($string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
|
return strtr($string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,5 +41,5 @@ function smarty_strtolower_ascii($string): string {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_strtoupper_ascii($string): string {
|
function smarty_strtoupper_ascii($string): string {
|
||||||
return strtr($string, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
return strtr($string, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
||||||
}
|
}
|
@@ -213,12 +213,12 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
|
|||||||
*/
|
*/
|
||||||
public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
|
public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
|
||||||
{
|
{
|
||||||
$tag = smarty_strtolower_ascii(trim($parameter[ 0 ], '"\''));
|
$tag = smarty_strtolower_ascii(trim($parameter[ 0 ], '"\''));
|
||||||
$name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false;
|
$name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false;
|
||||||
if (!$name) {
|
if (!$name) {
|
||||||
$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
|
$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
|
||||||
}
|
}
|
||||||
$property = isset($parameter[ 2 ]) ? smarty_strtolower_ascii($compiler->getId($parameter[ 2 ])) : false;
|
$property = isset($parameter[ 2 ]) ? smarty_strtolower_ascii($compiler->getId($parameter[ 2 ])) : false;
|
||||||
if (!$property || !in_array($property, $this->nameProperties)) {
|
if (!$property || !in_array($property, $this->nameProperties)) {
|
||||||
$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
|
$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
|
||||||
}
|
}
|
||||||
|
@@ -89,17 +89,17 @@ class Smarty_Internal_Extension_Handler
|
|||||||
$propertyType = false;
|
$propertyType = false;
|
||||||
if (!isset($this->resolvedProperties[ $match[ 0 ] ][ $objType ])) {
|
if (!isset($this->resolvedProperties[ $match[ 0 ] ][ $objType ])) {
|
||||||
$property = $this->resolvedProperties['property'][$basename] ??
|
$property = $this->resolvedProperties['property'][$basename] ??
|
||||||
$this->resolvedProperties['property'][$basename] = smarty_strtolower_ascii(
|
$this->resolvedProperties['property'][$basename] = smarty_strtolower_ascii(
|
||||||
join(
|
join(
|
||||||
'_',
|
'_',
|
||||||
preg_split(
|
preg_split(
|
||||||
'/([A-Z][^A-Z]*)/',
|
'/([A-Z][^A-Z]*)/',
|
||||||
$basename,
|
$basename,
|
||||||
-1,
|
-1,
|
||||||
PREG_SPLIT_NO_EMPTY |
|
PREG_SPLIT_NO_EMPTY |
|
||||||
PREG_SPLIT_DELIM_CAPTURE
|
PREG_SPLIT_DELIM_CAPTURE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($property !== false) {
|
if ($property !== false) {
|
||||||
if (property_exists($data, $property)) {
|
if (property_exists($data, $property)) {
|
||||||
@@ -144,7 +144,7 @@ class Smarty_Internal_Extension_Handler
|
|||||||
public function upperCase($name)
|
public function upperCase($name)
|
||||||
{
|
{
|
||||||
$_name = explode('_', $name);
|
$_name = explode('_', $name);
|
||||||
$_name = array_map('smarty_ucfirst_ascii', $_name);
|
$_name = array_map('smarty_ucfirst_ascii', $_name);
|
||||||
return implode('_', $_name);
|
return implode('_', $_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ class Smarty_Internal_Method_LoadPlugin
|
|||||||
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
||||||
}
|
}
|
||||||
if (!empty($match[ 2 ])) {
|
if (!empty($match[ 2 ])) {
|
||||||
$file = SMARTY_SYSPLUGINS_DIR . smarty_strtolower_ascii($plugin_name) . '.php';
|
$file = SMARTY_SYSPLUGINS_DIR . smarty_strtolower_ascii($plugin_name) . '.php';
|
||||||
if (isset($this->plugin_files[ $file ])) {
|
if (isset($this->plugin_files[ $file ])) {
|
||||||
if ($this->plugin_files[ $file ] !== false) {
|
if ($this->plugin_files[ $file ] !== false) {
|
||||||
return $this->plugin_files[ $file ];
|
return $this->plugin_files[ $file ];
|
||||||
@@ -60,7 +60,7 @@ class Smarty_Internal_Method_LoadPlugin
|
|||||||
}
|
}
|
||||||
// plugin filename is expected to be: [type].[name].php
|
// plugin filename is expected to be: [type].[name].php
|
||||||
$_plugin_filename = "{$match[1]}.{$match[4]}.php";
|
$_plugin_filename = "{$match[1]}.{$match[4]}.php";
|
||||||
$_lower_filename = smarty_strtolower_ascii($_plugin_filename);
|
$_lower_filename = smarty_strtolower_ascii($_plugin_filename);
|
||||||
if (isset($this->plugin_files)) {
|
if (isset($this->plugin_files)) {
|
||||||
if (isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
|
if (isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
|
||||||
if (!$smarty->use_include_path || $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] !== false) {
|
if (!$smarty->use_include_path || $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] !== false) {
|
||||||
|
@@ -605,7 +605,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0
|
if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0
|
||||||
|| strcasecmp($name, 'array') === 0 || is_callable($name)
|
|| strcasecmp($name, 'array') === 0 || is_callable($name)
|
||||||
) {
|
) {
|
||||||
$func_name = smarty_strtolower_ascii($name);
|
$func_name = smarty_strtolower_ascii($name);
|
||||||
|
|
||||||
if ($func_name === 'isset') {
|
if ($func_name === 'isset') {
|
||||||
if (count($parameter) === 0) {
|
if (count($parameter) === 0) {
|
||||||
@@ -765,7 +765,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if (!isset(self::$_tag_objects[ $tag ])) {
|
if (!isset(self::$_tag_objects[ $tag ])) {
|
||||||
// lazy load internal compiler plugin
|
// lazy load internal compiler plugin
|
||||||
$_tag = explode('_', $tag);
|
$_tag = explode('_', $tag);
|
||||||
$_tag = array_map('smarty_ucfirst_ascii', $_tag);
|
$_tag = array_map('smarty_ucfirst_ascii', $_tag);
|
||||||
$class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag);
|
$class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag);
|
||||||
if (class_exists($class_name)
|
if (class_exists($class_name)
|
||||||
&& (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))
|
&& (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))
|
||||||
|
@@ -76,11 +76,11 @@ abstract class Smarty_Resource
|
|||||||
}
|
}
|
||||||
// try sysplugins dir
|
// try sysplugins dir
|
||||||
if (isset(self::$sysplugins[ $type ])) {
|
if (isset(self::$sysplugins[ $type ])) {
|
||||||
$_resource_class = 'Smarty_Internal_Resource_' . smarty_ucfirst_ascii($type);
|
$_resource_class = 'Smarty_Internal_Resource_' . smarty_ucfirst_ascii($type);
|
||||||
return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class();
|
return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class();
|
||||||
}
|
}
|
||||||
// try plugins dir
|
// try plugins dir
|
||||||
$_resource_class = 'Smarty_Resource_' . smarty_ucfirst_ascii($type);
|
$_resource_class = 'Smarty_Resource_' . smarty_ucfirst_ascii($type);
|
||||||
if ($smarty->loadPlugin($_resource_class)) {
|
if ($smarty->loadPlugin($_resource_class)) {
|
||||||
if (class_exists($_resource_class, false)) {
|
if (class_exists($_resource_class, false)) {
|
||||||
return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class();
|
return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class();
|
||||||
|
Reference in New Issue
Block a user