Completed
Push — developer ( e7ef61...437bc9 )
by Błażej
353:55 queued 313:46
created
Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_SetDefaultModifiers
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Set default modifiers
23
-     *
24
-     * @api Smarty::setDefaultModifiers()
25
-     *
26
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
27
-     * @param  array|string                                                   $modifiers modifier or list of modifiers
28
-     *                                                                                   to set
29
-     *
30
-     * @return \Smarty|\Smarty_Internal_Template
31
-     */
32
-    public function setDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
33
-    {
34
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
-        $smarty->default_modifiers = (array) $modifiers;
36
-        return $obj;
37
-    }
21
+	/**
22
+	 * Set default modifiers
23
+	 *
24
+	 * @api Smarty::setDefaultModifiers()
25
+	 *
26
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
27
+	 * @param  array|string                                                   $modifiers modifier or list of modifiers
28
+	 *                                                                                   to set
29
+	 *
30
+	 * @return \Smarty|\Smarty_Internal_Template
31
+	 */
32
+	public function setDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
33
+	{
34
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
+		$smarty->default_modifiers = (array) $modifiers;
36
+		return $obj;
37
+	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -11,60 +11,60 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_SetAutoloadFilters
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Valid filter types
23
-     *
24
-     * @var array
25
-     */
26
-    private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
21
+	/**
22
+	 * Valid filter types
23
+	 *
24
+	 * @var array
25
+	 */
26
+	private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
27 27
 
28
-    /**
29
-     * Set autoload filters
30
-     *
31
-     * @api Smarty::setAutoloadFilters()
32
-     *
33
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
34
-     * @param  array                                                          $filters filters to load automatically
35
-     * @param  string                                                         $type    "pre", "output", … specify the
36
-     *                                                                                 filter type to set. Defaults to
37
-     *                                                                                 none treating $filters' keys as
38
-     *                                                                                 the appropriate types
39
-     *
40
-     * @return \Smarty|\Smarty_Internal_Template
41
-     */
42
-    public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
43
-    {
44
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
45
-        if ($type !== null) {
46
-            $this->_checkFilterType($type);
47
-            $smarty->autoload_filters[ $type ] = (array) $filters;
48
-        } else {
49
-            foreach ((array) $filters as $type => $value) {
50
-                $this->_checkFilterType($type);
51
-            }
52
-            $smarty->autoload_filters = (array) $filters;
53
-        }
54
-        return $obj;
55
-    }
28
+	/**
29
+	 * Set autoload filters
30
+	 *
31
+	 * @api Smarty::setAutoloadFilters()
32
+	 *
33
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
34
+	 * @param  array                                                          $filters filters to load automatically
35
+	 * @param  string                                                         $type    "pre", "output", … specify the
36
+	 *                                                                                 filter type to set. Defaults to
37
+	 *                                                                                 none treating $filters' keys as
38
+	 *                                                                                 the appropriate types
39
+	 *
40
+	 * @return \Smarty|\Smarty_Internal_Template
41
+	 */
42
+	public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
43
+	{
44
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
45
+		if ($type !== null) {
46
+			$this->_checkFilterType($type);
47
+			$smarty->autoload_filters[ $type ] = (array) $filters;
48
+		} else {
49
+			foreach ((array) $filters as $type => $value) {
50
+				$this->_checkFilterType($type);
51
+			}
52
+			$smarty->autoload_filters = (array) $filters;
53
+		}
54
+		return $obj;
55
+	}
56 56
 
57
-    /**
58
-     * Check if filter type is valid
59
-     *
60
-     * @param string $type
61
-     *
62
-     * @throws \SmartyException
63
-     */
64
-    public function _checkFilterType($type)
65
-    {
66
-        if (!isset($this->filterTypes[ $type ])) {
67
-            throw new SmartyException("Illegal filter type \"{$type}\"");
68
-        }
69
-    }
57
+	/**
58
+	 * Check if filter type is valid
59
+	 *
60
+	 * @param string $type
61
+	 *
62
+	 * @throws \SmartyException
63
+	 */
64
+	public function _checkFilterType($type)
65
+	{
66
+		if (!isset($this->filterTypes[ $type ])) {
67
+			throw new SmartyException("Illegal filter type \"{$type}\"");
68
+		}
69
+	}
70 70
 }
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
45 45
         if ($type !== null) {
46 46
             $this->_checkFilterType($type);
47
-            $smarty->autoload_filters[ $type ] = (array) $filters;
47
+            $smarty->autoload_filters[$type] = (array) $filters;
48 48
         } else {
49 49
             foreach ((array) $filters as $type => $value) {
50 50
                 $this->_checkFilterType($type);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function _checkFilterType($type)
65 65
     {
66
-        if (!isset($this->filterTypes[ $type ])) {
66
+        if (!isset($this->filterTypes[$type])) {
67 67
             throw new SmartyException("Illegal filter type \"{$type}\"");
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_getglobal.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_GetGlobal
13 13
 {
14
-    /**
15
-     * Valid for all objects
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 7;
14
+	/**
15
+	 * Valid for all objects
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 7;
20 20
 
21
-    /**
22
-     * Returns a single or all global  variables
23
-     *
24
-     * @api  Smarty::getGlobal()
25
-     *
26
-     * @param \Smarty_Internal_Data $data
27
-     * @param  string               $varName variable name or null
28
-     *
29
-     * @return string variable value or or array of variables
30
-     */
31
-    public function getGlobal(Smarty_Internal_Data $data, $varName = null)
32
-    {
33
-        if (isset($varName)) {
34
-            if (isset(Smarty::$global_tpl_vars[ $varName ])) {
35
-                return Smarty::$global_tpl_vars[ $varName ]->value;
36
-            } else {
37
-                return '';
38
-            }
39
-        } else {
40
-            $_result = array();
41
-            foreach (Smarty::$global_tpl_vars AS $key => $var) {
42
-                $_result[ $key ] = $var->value;
43
-            }
44
-            return $_result;
45
-        }
46
-    }
21
+	/**
22
+	 * Returns a single or all global  variables
23
+	 *
24
+	 * @api  Smarty::getGlobal()
25
+	 *
26
+	 * @param \Smarty_Internal_Data $data
27
+	 * @param  string               $varName variable name or null
28
+	 *
29
+	 * @return string variable value or or array of variables
30
+	 */
31
+	public function getGlobal(Smarty_Internal_Data $data, $varName = null)
32
+	{
33
+		if (isset($varName)) {
34
+			if (isset(Smarty::$global_tpl_vars[ $varName ])) {
35
+				return Smarty::$global_tpl_vars[ $varName ]->value;
36
+			} else {
37
+				return '';
38
+			}
39
+		} else {
40
+			$_result = array();
41
+			foreach (Smarty::$global_tpl_vars AS $key => $var) {
42
+				$_result[ $key ] = $var->value;
43
+			}
44
+			return $_result;
45
+		}
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
     public function getGlobal(Smarty_Internal_Data $data, $varName = null)
32 32
     {
33 33
         if (isset($varName)) {
34
-            if (isset(Smarty::$global_tpl_vars[ $varName ])) {
35
-                return Smarty::$global_tpl_vars[ $varName ]->value;
34
+            if (isset(Smarty::$global_tpl_vars[$varName])) {
35
+                return Smarty::$global_tpl_vars[$varName]->value;
36 36
             } else {
37 37
                 return '';
38 38
             }
39 39
         } else {
40 40
             $_result = array();
41 41
             foreach (Smarty::$global_tpl_vars AS $key => $var) {
42
-                $_result[ $key ] = $var->value;
42
+                $_result[$key] = $var->value;
43 43
             }
44 44
             return $_result;
45 45
         }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_resource_uncompiled.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@
 block discarded – undo
16 16
  */
17 17
 abstract class Smarty_Resource_Uncompiled extends Smarty_Resource
18 18
 {
19
-    /**
20
-     * Flag that it's an uncompiled resource
21
-     *
22
-     * @var bool
23
-     */
24
-    public $uncompiled = true;
19
+	/**
20
+	 * Flag that it's an uncompiled resource
21
+	 *
22
+	 * @var bool
23
+	 */
24
+	public $uncompiled = true;
25 25
 
26
-    /**
27
-     * Resource does implement populateCompiledFilepath() method
28
-     *
29
-     * @var bool
30
-     */
31
-    public $hasCompiledHandler = true;
26
+	/**
27
+	 * Resource does implement populateCompiledFilepath() method
28
+	 *
29
+	 * @var bool
30
+	 */
31
+	public $hasCompiledHandler = true;
32 32
     
33
-    /**
34
-     * populate compiled object with compiled filepath
35
-     *
36
-     * @param Smarty_Template_Compiled $compiled  compiled object
37
-     * @param Smarty_Internal_Template $_template template object
38
-     */
39
-    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
40
-    {
41
-        $compiled->filepath = $_template->source->filepath;
42
-        $compiled->timestamp = $_template->source->timestamp;
43
-        $compiled->exists = $_template->source->exists;
44
-        if ($_template->smarty->merge_compiled_includes || $_template->source->handler->checkTimestamps()) {
45
-            $compiled->file_dependency[ $_template->source->uid ] =
46
-                array($compiled->filepath, $compiled->timestamp, $_template->source->type,);
47
-        }
48
-    }
33
+	/**
34
+	 * populate compiled object with compiled filepath
35
+	 *
36
+	 * @param Smarty_Template_Compiled $compiled  compiled object
37
+	 * @param Smarty_Internal_Template $_template template object
38
+	 */
39
+	public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
40
+	{
41
+		$compiled->filepath = $_template->source->filepath;
42
+		$compiled->timestamp = $_template->source->timestamp;
43
+		$compiled->exists = $_template->source->exists;
44
+		if ($_template->smarty->merge_compiled_includes || $_template->source->handler->checkTimestamps()) {
45
+			$compiled->file_dependency[ $_template->source->uid ] =
46
+				array($compiled->filepath, $compiled->timestamp, $_template->source->type,);
47
+		}
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         $compiled->timestamp = $_template->source->timestamp;
43 43
         $compiled->exists = $_template->source->exists;
44 44
         if ($_template->smarty->merge_compiled_includes || $_template->source->handler->checkTimestamps()) {
45
-            $compiled->file_dependency[ $_template->source->uid ] =
45
+            $compiled->file_dependency[$_template->source->uid] =
46 46
                 array($compiled->filepath, $compiled->timestamp, $_template->source->type,);
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_extension_handler.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -33,115 +33,115 @@
 block discarded – undo
33 33
 class Smarty_Internal_Extension_Handler
34 34
 {
35 35
 
36
-    public $objType = null;
36
+	public $objType = null;
37 37
 
38
-    /**
39
-     * Cache for property information from generic getter/setter
40
-     * Preloaded with names which should not use with generic getter/setter
41
-     *
42
-     * @var array
43
-     */
44
-    private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
45
-                                    'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
46
-                                    'TemplateVars' => 0,);#
38
+	/**
39
+	 * Cache for property information from generic getter/setter
40
+	 * Preloaded with names which should not use with generic getter/setter
41
+	 *
42
+	 * @var array
43
+	 */
44
+	private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
45
+									'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
46
+									'TemplateVars' => 0,);#
47 47
 
48
-    private $resolvedProperties = array();
48
+	private $resolvedProperties = array();
49 49
 
50
-    /**
51
-     * Call external Method
52
-     *
53
-     * @param \Smarty_Internal_Data $data
54
-     * @param string                $name external method names
55
-     * @param array                 $args argument array
56
-     *
57
-     * @return mixed
58
-     * @throws SmartyException
59
-     */
60
-    public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
61
-    {
62
-        /* @var Smarty $data ->smarty */
63
-        $smarty = isset($data->smarty) ? $data->smarty : $data;
64
-        if (!isset($smarty->ext->$name)) {
65
-            $class = 'Smarty_Internal_Method_' . ucfirst($name);
66
-            if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
67
-                if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
68
-                    // convert camel case to underscored name
69
-                    $this->resolvedProperties[ $prop ] = $pn = strtolower(join('_',
70
-                                                                               preg_split('/([A-Z][^A-Z]*)/', $prop,
71
-                                                                                          - 1, PREG_SPLIT_NO_EMPTY |
72
-                                                                                               PREG_SPLIT_DELIM_CAPTURE)));
73
-                    $this->_property_info[ $prop ] = property_exists($data, $pn) ? 1 :
74
-                        ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
75
-                }
76
-                if ($this->_property_info[ $prop ]) {
77
-                    $pn = $this->resolvedProperties[ $prop ];
78
-                    if ($match[ 1 ] == 'get') {
79
-                        return $this->_property_info[ $prop ] == 1 ? $data->$pn : $data->smarty->$pn;
80
-                    } else {
81
-                        return $this->_property_info[ $prop ] == 1 ? $data->$pn = $args[ 0 ] :
82
-                            $data->smarty->$pn = $args[ 0 ];
83
-                    }
84
-                } elseif (!class_exists($class)) {
85
-                    throw new SmartyException("property '$pn' does not exist.");
86
-                }
87
-            }
88
-            if (class_exists($class)) {
89
-                $callback = array($smarty->ext->$name = new $class(), $name);
90
-            }
91
-        } else {
92
-            $callback = array($smarty->ext->$name, $name);
93
-        }
94
-        array_unshift($args, $data);
95
-        if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) {
96
-            return call_user_func_array($callback, $args);
97
-        }
98
-        return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
99
-    }
50
+	/**
51
+	 * Call external Method
52
+	 *
53
+	 * @param \Smarty_Internal_Data $data
54
+	 * @param string                $name external method names
55
+	 * @param array                 $args argument array
56
+	 *
57
+	 * @return mixed
58
+	 * @throws SmartyException
59
+	 */
60
+	public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
61
+	{
62
+		/* @var Smarty $data ->smarty */
63
+		$smarty = isset($data->smarty) ? $data->smarty : $data;
64
+		if (!isset($smarty->ext->$name)) {
65
+			$class = 'Smarty_Internal_Method_' . ucfirst($name);
66
+			if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
67
+				if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
68
+					// convert camel case to underscored name
69
+					$this->resolvedProperties[ $prop ] = $pn = strtolower(join('_',
70
+																			   preg_split('/([A-Z][^A-Z]*)/', $prop,
71
+																						  - 1, PREG_SPLIT_NO_EMPTY |
72
+																							   PREG_SPLIT_DELIM_CAPTURE)));
73
+					$this->_property_info[ $prop ] = property_exists($data, $pn) ? 1 :
74
+						($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
75
+				}
76
+				if ($this->_property_info[ $prop ]) {
77
+					$pn = $this->resolvedProperties[ $prop ];
78
+					if ($match[ 1 ] == 'get') {
79
+						return $this->_property_info[ $prop ] == 1 ? $data->$pn : $data->smarty->$pn;
80
+					} else {
81
+						return $this->_property_info[ $prop ] == 1 ? $data->$pn = $args[ 0 ] :
82
+							$data->smarty->$pn = $args[ 0 ];
83
+					}
84
+				} elseif (!class_exists($class)) {
85
+					throw new SmartyException("property '$pn' does not exist.");
86
+				}
87
+			}
88
+			if (class_exists($class)) {
89
+				$callback = array($smarty->ext->$name = new $class(), $name);
90
+			}
91
+		} else {
92
+			$callback = array($smarty->ext->$name, $name);
93
+		}
94
+		array_unshift($args, $data);
95
+		if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) {
96
+			return call_user_func_array($callback, $args);
97
+		}
98
+		return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
99
+	}
100 100
 
101
-    /**
102
-     * set extension property
103
-     *
104
-     * @param string $property_name property name
105
-     * @param mixed  $value         value
106
-     *
107
-     * @throws SmartyException
108
-     */
109
-    public function __set($property_name, $value)
110
-    {
111
-        $this->$property_name = $value;
112
-    }
101
+	/**
102
+	 * set extension property
103
+	 *
104
+	 * @param string $property_name property name
105
+	 * @param mixed  $value         value
106
+	 *
107
+	 * @throws SmartyException
108
+	 */
109
+	public function __set($property_name, $value)
110
+	{
111
+		$this->$property_name = $value;
112
+	}
113 113
 
114
-    /**
115
-     * get extension object
116
-     *
117
-     * @param string $property_name property name
118
-     *
119
-     * @return mixed|Smarty_Template_Cached
120
-     * @throws SmartyException
121
-     */
122
-    public function __get($property_name)
123
-    {
124
-        // object properties of runtime template extensions will start with '_'
125
-        if ($property_name[ 0 ] == '_') {
126
-            $class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1));
127
-        } else {
128
-            $class = 'Smarty_Internal_Method_' . ucfirst($property_name);
129
-        }
130
-        return $this->$property_name = new $class();
131
-    }
114
+	/**
115
+	 * get extension object
116
+	 *
117
+	 * @param string $property_name property name
118
+	 *
119
+	 * @return mixed|Smarty_Template_Cached
120
+	 * @throws SmartyException
121
+	 */
122
+	public function __get($property_name)
123
+	{
124
+		// object properties of runtime template extensions will start with '_'
125
+		if ($property_name[ 0 ] == '_') {
126
+			$class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1));
127
+		} else {
128
+			$class = 'Smarty_Internal_Method_' . ucfirst($property_name);
129
+		}
130
+		return $this->$property_name = new $class();
131
+	}
132 132
 
133
-    /**
134
-     * Call error handler for undefined method
135
-     *
136
-     * @param string $name unknown method-name
137
-     * @param array  $args argument array
138
-     *
139
-     * @return mixed
140
-     * @throws SmartyException
141
-     */
142
-    public function __call($name, $args)
143
-    {
144
-        return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this));
145
-    }
133
+	/**
134
+	 * Call error handler for undefined method
135
+	 *
136
+	 * @param string $name unknown method-name
137
+	 * @param array  $args argument array
138
+	 *
139
+	 * @return mixed
140
+	 * @throws SmartyException
141
+	 */
142
+	public function __call($name, $args)
143
+	{
144
+		return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this));
145
+	}
146 146
 
147 147
 }
148 148
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
45 45
                                     'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
46
-                                    'TemplateVars' => 0,);#
46
+                                    'TemplateVars' => 0,); #
47 47
 
48 48
     private $resolvedProperties = array();
49 49
 
@@ -64,22 +64,20 @@  discard block
 block discarded – undo
64 64
         if (!isset($smarty->ext->$name)) {
65 65
             $class = 'Smarty_Internal_Method_' . ucfirst($name);
66 66
             if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
67
-                if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
67
+                if (!isset($this->_property_info[$prop = $match[2]])) {
68 68
                     // convert camel case to underscored name
69
-                    $this->resolvedProperties[ $prop ] = $pn = strtolower(join('_',
69
+                    $this->resolvedProperties[$prop] = $pn = strtolower(join('_',
70 70
                                                                                preg_split('/([A-Z][^A-Z]*)/', $prop,
71 71
                                                                                           - 1, PREG_SPLIT_NO_EMPTY |
72 72
                                                                                                PREG_SPLIT_DELIM_CAPTURE)));
73
-                    $this->_property_info[ $prop ] = property_exists($data, $pn) ? 1 :
74
-                        ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
73
+                    $this->_property_info[$prop] = property_exists($data, $pn) ? 1 : ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
75 74
                 }
76
-                if ($this->_property_info[ $prop ]) {
77
-                    $pn = $this->resolvedProperties[ $prop ];
78
-                    if ($match[ 1 ] == 'get') {
79
-                        return $this->_property_info[ $prop ] == 1 ? $data->$pn : $data->smarty->$pn;
75
+                if ($this->_property_info[$prop]) {
76
+                    $pn = $this->resolvedProperties[$prop];
77
+                    if ($match[1] == 'get') {
78
+                        return $this->_property_info[$prop] == 1 ? $data->$pn : $data->smarty->$pn;
80 79
                     } else {
81
-                        return $this->_property_info[ $prop ] == 1 ? $data->$pn = $args[ 0 ] :
82
-                            $data->smarty->$pn = $args[ 0 ];
80
+                        return $this->_property_info[$prop] == 1 ? $data->$pn = $args[0] : $data->smarty->$pn = $args[0];
83 81
                     }
84 82
                 } elseif (!class_exists($class)) {
85 83
                     throw new SmartyException("property '$pn' does not exist.");
@@ -92,7 +90,7 @@  discard block
 block discarded – undo
92 90
             $callback = array($smarty->ext->$name, $name);
93 91
         }
94 92
         array_unshift($args, $data);
95
-        if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) {
93
+        if (isset($callback) && $callback[0]->objMap | $data->_objType) {
96 94
             return call_user_func_array($callback, $args);
97 95
         }
98 96
         return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
@@ -122,7 +120,7 @@  discard block
 block discarded – undo
122 120
     public function __get($property_name)
123 121
     {
124 122
         // object properties of runtime template extensions will start with '_'
125
-        if ($property_name[ 0 ] == '_') {
123
+        if ($property_name[0] == '_') {
126 124
             $class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1));
127 125
         } else {
128 126
             $class = 'Smarty_Internal_Method_' . ucfirst($property_name);
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,41 +12,41 @@
 block discarded – undo
12 12
 class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
13 13
 {
14 14
 
15
-    /**
16
-     * Add autoload filters
17
-     *
18
-     * @api Smarty::setAutoloadFilters()
19
-     *
20
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
21
-     * @param  array                                                          $filters filters to load automatically
22
-     * @param  string                                                         $type    "pre", "output", … specify the
23
-     *                                                                                 filter type to set. Defaults to
24
-     *                                                                                 none treating $filters' keys as
25
-     *                                                                                 the appropriate types
26
-     *
27
-     * @return \Smarty|\Smarty_Internal_Template
28
-     */
29
-    public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
30
-    {
31
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
32
-        if ($type !== null) {
33
-            $this->_checkFilterType($type);
34
-            if (!empty($smarty->autoload_filters[ $type ])) {
35
-                $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters);
36
-            } else {
37
-                $smarty->autoload_filters[ $type ] = (array) $filters;
38
-            }
39
-        } else {
40
-            foreach ((array) $filters as $type => $value) {
41
-                $this->_checkFilterType($type);
42
-                if (!empty($smarty->autoload_filters[ $type ])) {
43
-                    $smarty->autoload_filters[ $type ] =
44
-                        array_merge($smarty->autoload_filters[ $type ], (array) $value);
45
-                } else {
46
-                    $smarty->autoload_filters[ $type ] = (array) $value;
47
-                }
48
-            }
49
-        }
50
-        return $obj;
51
-    }
15
+	/**
16
+	 * Add autoload filters
17
+	 *
18
+	 * @api Smarty::setAutoloadFilters()
19
+	 *
20
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
21
+	 * @param  array                                                          $filters filters to load automatically
22
+	 * @param  string                                                         $type    "pre", "output", … specify the
23
+	 *                                                                                 filter type to set. Defaults to
24
+	 *                                                                                 none treating $filters' keys as
25
+	 *                                                                                 the appropriate types
26
+	 *
27
+	 * @return \Smarty|\Smarty_Internal_Template
28
+	 */
29
+	public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
30
+	{
31
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
32
+		if ($type !== null) {
33
+			$this->_checkFilterType($type);
34
+			if (!empty($smarty->autoload_filters[ $type ])) {
35
+				$smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters);
36
+			} else {
37
+				$smarty->autoload_filters[ $type ] = (array) $filters;
38
+			}
39
+		} else {
40
+			foreach ((array) $filters as $type => $value) {
41
+				$this->_checkFilterType($type);
42
+				if (!empty($smarty->autoload_filters[ $type ])) {
43
+					$smarty->autoload_filters[ $type ] =
44
+						array_merge($smarty->autoload_filters[ $type ], (array) $value);
45
+				} else {
46
+					$smarty->autoload_filters[ $type ] = (array) $value;
47
+				}
48
+			}
49
+		}
50
+		return $obj;
51
+	}
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
         $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
32 32
         if ($type !== null) {
33 33
             $this->_checkFilterType($type);
34
-            if (!empty($smarty->autoload_filters[ $type ])) {
35
-                $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters);
34
+            if (!empty($smarty->autoload_filters[$type])) {
35
+                $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $filters);
36 36
             } else {
37
-                $smarty->autoload_filters[ $type ] = (array) $filters;
37
+                $smarty->autoload_filters[$type] = (array) $filters;
38 38
             }
39 39
         } else {
40 40
             foreach ((array) $filters as $type => $value) {
41 41
                 $this->_checkFilterType($type);
42
-                if (!empty($smarty->autoload_filters[ $type ])) {
43
-                    $smarty->autoload_filters[ $type ] =
44
-                        array_merge($smarty->autoload_filters[ $type ], (array) $value);
42
+                if (!empty($smarty->autoload_filters[$type])) {
43
+                    $smarty->autoload_filters[$type] =
44
+                        array_merge($smarty->autoload_filters[$type], (array) $value);
45 45
                 } else {
46
-                    $smarty->autoload_filters[ $type ] = (array) $value;
46
+                    $smarty->autoload_filters[$type] = (array) $value;
47 47
                 }
48 48
             }
49 49
         }
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,30 +11,30 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_UnregisterCacheResource
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Registers a resource to fetch a template
23
-     *
24
-     * @api      Smarty::unregisterCacheResource()
25
-     * @link     http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
26
-     *
27
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
-     * @param                                                                 $name
29
-     *
30
-     * @return \Smarty|\Smarty_Internal_Template
31
-     */
32
-    public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
33
-    {
34
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
-        if (isset($smarty->registered_cache_resources[ $name ])) {
36
-            unset($smarty->registered_cache_resources[ $name ]);
37
-        }
38
-        return $obj;
39
-    }
21
+	/**
22
+	 * Registers a resource to fetch a template
23
+	 *
24
+	 * @api      Smarty::unregisterCacheResource()
25
+	 * @link     http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
+	 * @param                                                                 $name
29
+	 *
30
+	 * @return \Smarty|\Smarty_Internal_Template
31
+	 */
32
+	public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
33
+	{
34
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
+		if (isset($smarty->registered_cache_resources[ $name ])) {
36
+			unset($smarty->registered_cache_resources[ $name ]);
37
+		}
38
+		return $obj;
39
+	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
     public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
33 33
     {
34 34
         $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
-        if (isset($smarty->registered_cache_resources[ $name ])) {
36
-            unset($smarty->registered_cache_resources[ $name ]);
35
+        if (isset($smarty->registered_cache_resources[$name])) {
36
+            unset($smarty->registered_cache_resources[$name]);
37 37
         }
38 38
         return $obj;
39 39
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,41 +11,41 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_MustCompile
13 13
 {
14
-    /**
15
-     * Valid for template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 2;
14
+	/**
15
+	 * Valid for template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 2;
20 20
 
21
-    /**
22
-     * Returns if the current template must be compiled by the Smarty compiler
23
-     * It does compare the timestamps of template source and the compiled templates and checks the force compile
24
-     * configuration
25
-     *
26
-     * @param \Smarty_Internal_Template $_template
27
-     *
28
-     * @return bool
29
-     * @throws \SmartyException
30
-     */
31
-    public function mustCompile(Smarty_Internal_Template $_template)
32
-    {
33
-        if (!$_template->source->exists) {
34
-            if (isset($_template->parent) && $_template->parent->_objType == 2) {
35
-                $parent_resource = " in '$_template->parent->template_resource}'";
36
-            } else {
37
-                $parent_resource = '';
38
-            }
39
-            throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
40
-        }
41
-        if ($_template->mustCompile === null) {
42
-            $_template->mustCompile = (!$_template->source->handler->uncompiled &&
43
-                                       ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
44
-                                        !$_template->compiled->exists || ($_template->smarty->compile_check &&
45
-                                                                          $_template->compiled->getTimeStamp() <
46
-                                                                          $_template->source->getTimeStamp())));
47
-        }
21
+	/**
22
+	 * Returns if the current template must be compiled by the Smarty compiler
23
+	 * It does compare the timestamps of template source and the compiled templates and checks the force compile
24
+	 * configuration
25
+	 *
26
+	 * @param \Smarty_Internal_Template $_template
27
+	 *
28
+	 * @return bool
29
+	 * @throws \SmartyException
30
+	 */
31
+	public function mustCompile(Smarty_Internal_Template $_template)
32
+	{
33
+		if (!$_template->source->exists) {
34
+			if (isset($_template->parent) && $_template->parent->_objType == 2) {
35
+				$parent_resource = " in '$_template->parent->template_resource}'";
36
+			} else {
37
+				$parent_resource = '';
38
+			}
39
+			throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
40
+		}
41
+		if ($_template->mustCompile === null) {
42
+			$_template->mustCompile = (!$_template->source->handler->uncompiled &&
43
+									   ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
44
+										!$_template->compiled->exists || ($_template->smarty->compile_check &&
45
+																		  $_template->compiled->getTimeStamp() <
46
+																		  $_template->source->getTimeStamp())));
47
+		}
48 48
 
49
-        return $_template->mustCompile;
50
-    }
49
+		return $_template->mustCompile;
50
+	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php 2 patches
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,141 +17,141 @@
 block discarded – undo
17 17
  */
18 18
 class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
19 19
 {
20
-    /**
21
-     * Compiles code for modifier execution
22
-     *
23
-     * @param  array                                $args      array with attributes from parser
24
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
25
-     * @param  array                                $parameter array with compilation parameter
26
-     *
27
-     * @return string compiled code
28
-     * @throws \SmartyCompilerException
29
-     */
30
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
31
-    {
32
-        // check and get attributes
33
-        $_attr = $this->getAttributes($compiler, $args);
34
-        $output = $parameter[ 'value' ];
35
-        // loop over list of modifiers
36
-        foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
37
-            $modifier = $single_modifier[ 0 ];
38
-            $single_modifier[ 0 ] = $output;
39
-            $params = implode(',', $single_modifier);
40
-            // check if we know already the type of modifier
41
-            if (isset($compiler->known_modifier_type[ $modifier ])) {
42
-                $modifier_types = array($compiler->known_modifier_type[ $modifier ]);
43
-            } else {
44
-                $modifier_types = array(1, 2, 3, 4, 5, 6);
45
-            }
46
-            foreach ($modifier_types as $type) {
47
-                switch ($type) {
48
-                    case 1:
49
-                        // registered modifier
50
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
51
-                            $function =
52
-                                $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
53
-                            if (!is_array($function)) {
54
-                                $output = "{$function}({$params})";
55
-                            } else {
56
-                                if (is_object($function[ 0 ])) {
57
-                                    $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
58
-                                              $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
59
-                                } else {
60
-                                    $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
61
-                                }
62
-                            }
63
-                            $compiler->known_modifier_type[ $modifier ] = $type;
64
-                            break 2;
65
-                        }
66
-                        break;
67
-                    case 2:
68
-                        // registered modifier compiler
69
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
70
-                            $output =
71
-                                call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
72
-                                               $single_modifier, $compiler->smarty);
73
-                            $compiler->known_modifier_type[ $modifier ] = $type;
74
-                            break 2;
75
-                        }
76
-                        break;
77
-                    case 3:
78
-                        // modifiercompiler plugin
79
-                        if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
80
-                            // check if modifier allowed
81
-                            if (!is_object($compiler->smarty->security_policy) ||
82
-                                $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
83
-                            ) {
84
-                                $plugin = 'smarty_modifiercompiler_' . $modifier;
85
-                                $output = $plugin($single_modifier, $compiler);
86
-                            }
87
-                            $compiler->known_modifier_type[ $modifier ] = $type;
88
-                            break 2;
89
-                        }
90
-                        break;
91
-                    case 4:
92
-                        // modifier plugin
93
-                        if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
94
-                            // check if modifier allowed
95
-                            if (!is_object($compiler->smarty->security_policy) ||
96
-                                $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
97
-                            ) {
98
-                                $output = "{$function}({$params})";
99
-                            }
100
-                            $compiler->known_modifier_type[ $modifier ] = $type;
101
-                            break 2;
102
-                        }
103
-                        break;
104
-                    case 5:
105
-                        // PHP function
106
-                        if (is_callable($modifier)) {
107
-                            // check if modifier allowed
108
-                            if (!is_object($compiler->smarty->security_policy) ||
109
-                                $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
110
-                            ) {
111
-                                $output = "{$modifier}({$params})";
112
-                            }
113
-                            $compiler->known_modifier_type[ $modifier ] = $type;
114
-                            break 2;
115
-                        }
116
-                        break;
117
-                    case 6:
118
-                        // default plugin handler
119
-                        if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
120
-                            (is_callable($compiler->smarty->default_plugin_handler_func) &&
121
-                             $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
122
-                        ) {
123
-                            $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
124
-                            // check if modifier allowed
125
-                            if (!is_object($compiler->smarty->security_policy) ||
126
-                                $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
127
-                            ) {
128
-                                if (!is_array($function)) {
129
-                                    $output = "{$function}({$params})";
130
-                                } else {
131
-                                    if (is_object($function[ 0 ])) {
132
-                                        $output =  $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')';
133
-                                    } else {
134
-                                        $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
135
-                                    }
136
-                                }
137
-                            }
138
-                            if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
139
-                                isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
140
-                            ) {
141
-                                // was a plugin
142
-                                $compiler->known_modifier_type[ $modifier ] = 4;
143
-                            } else {
144
-                                $compiler->known_modifier_type[ $modifier ] = $type;
145
-                            }
146
-                            break 2;
147
-                        }
148
-                }
149
-            }
150
-            if (!isset($compiler->known_modifier_type[ $modifier ])) {
151
-                $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
152
-            }
153
-        }
20
+	/**
21
+	 * Compiles code for modifier execution
22
+	 *
23
+	 * @param  array                                $args      array with attributes from parser
24
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
25
+	 * @param  array                                $parameter array with compilation parameter
26
+	 *
27
+	 * @return string compiled code
28
+	 * @throws \SmartyCompilerException
29
+	 */
30
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
31
+	{
32
+		// check and get attributes
33
+		$_attr = $this->getAttributes($compiler, $args);
34
+		$output = $parameter[ 'value' ];
35
+		// loop over list of modifiers
36
+		foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
37
+			$modifier = $single_modifier[ 0 ];
38
+			$single_modifier[ 0 ] = $output;
39
+			$params = implode(',', $single_modifier);
40
+			// check if we know already the type of modifier
41
+			if (isset($compiler->known_modifier_type[ $modifier ])) {
42
+				$modifier_types = array($compiler->known_modifier_type[ $modifier ]);
43
+			} else {
44
+				$modifier_types = array(1, 2, 3, 4, 5, 6);
45
+			}
46
+			foreach ($modifier_types as $type) {
47
+				switch ($type) {
48
+					case 1:
49
+						// registered modifier
50
+						if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
51
+							$function =
52
+								$compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
53
+							if (!is_array($function)) {
54
+								$output = "{$function}({$params})";
55
+							} else {
56
+								if (is_object($function[ 0 ])) {
57
+									$output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
58
+											  $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
59
+								} else {
60
+									$output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
61
+								}
62
+							}
63
+							$compiler->known_modifier_type[ $modifier ] = $type;
64
+							break 2;
65
+						}
66
+						break;
67
+					case 2:
68
+						// registered modifier compiler
69
+						if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
70
+							$output =
71
+								call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
72
+											   $single_modifier, $compiler->smarty);
73
+							$compiler->known_modifier_type[ $modifier ] = $type;
74
+							break 2;
75
+						}
76
+						break;
77
+					case 3:
78
+						// modifiercompiler plugin
79
+						if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
80
+							// check if modifier allowed
81
+							if (!is_object($compiler->smarty->security_policy) ||
82
+								$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
83
+							) {
84
+								$plugin = 'smarty_modifiercompiler_' . $modifier;
85
+								$output = $plugin($single_modifier, $compiler);
86
+							}
87
+							$compiler->known_modifier_type[ $modifier ] = $type;
88
+							break 2;
89
+						}
90
+						break;
91
+					case 4:
92
+						// modifier plugin
93
+						if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
94
+							// check if modifier allowed
95
+							if (!is_object($compiler->smarty->security_policy) ||
96
+								$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
97
+							) {
98
+								$output = "{$function}({$params})";
99
+							}
100
+							$compiler->known_modifier_type[ $modifier ] = $type;
101
+							break 2;
102
+						}
103
+						break;
104
+					case 5:
105
+						// PHP function
106
+						if (is_callable($modifier)) {
107
+							// check if modifier allowed
108
+							if (!is_object($compiler->smarty->security_policy) ||
109
+								$compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
110
+							) {
111
+								$output = "{$modifier}({$params})";
112
+							}
113
+							$compiler->known_modifier_type[ $modifier ] = $type;
114
+							break 2;
115
+						}
116
+						break;
117
+					case 6:
118
+						// default plugin handler
119
+						if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
120
+							(is_callable($compiler->smarty->default_plugin_handler_func) &&
121
+							 $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
122
+						) {
123
+							$function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
124
+							// check if modifier allowed
125
+							if (!is_object($compiler->smarty->security_policy) ||
126
+								$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
127
+							) {
128
+								if (!is_array($function)) {
129
+									$output = "{$function}({$params})";
130
+								} else {
131
+									if (is_object($function[ 0 ])) {
132
+										$output =  $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')';
133
+									} else {
134
+										$output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
135
+									}
136
+								}
137
+							}
138
+							if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
139
+								isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
140
+							) {
141
+								// was a plugin
142
+								$compiler->known_modifier_type[ $modifier ] = 4;
143
+							} else {
144
+								$compiler->known_modifier_type[ $modifier ] = $type;
145
+							}
146
+							break 2;
147
+						}
148
+				}
149
+			}
150
+			if (!isset($compiler->known_modifier_type[ $modifier ])) {
151
+				$compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
152
+			}
153
+		}
154 154
 
155
-        return $output;
156
-    }
155
+		return $output;
156
+	}
157 157
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
     {
32 32
         // check and get attributes
33 33
         $_attr = $this->getAttributes($compiler, $args);
34
-        $output = $parameter[ 'value' ];
34
+        $output = $parameter['value'];
35 35
         // loop over list of modifiers
36
-        foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
37
-            $modifier = $single_modifier[ 0 ];
38
-            $single_modifier[ 0 ] = $output;
36
+        foreach ($parameter['modifierlist'] as $single_modifier) {
37
+            $modifier = $single_modifier[0];
38
+            $single_modifier[0] = $output;
39 39
             $params = implode(',', $single_modifier);
40 40
             // check if we know already the type of modifier
41
-            if (isset($compiler->known_modifier_type[ $modifier ])) {
42
-                $modifier_types = array($compiler->known_modifier_type[ $modifier ]);
41
+            if (isset($compiler->known_modifier_type[$modifier])) {
42
+                $modifier_types = array($compiler->known_modifier_type[$modifier]);
43 43
             } else {
44 44
                 $modifier_types = array(1, 2, 3, 4, 5, 6);
45 45
             }
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
                 switch ($type) {
48 48
                     case 1:
49 49
                         // registered modifier
50
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
50
+                        if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {
51 51
                             $function =
52
-                                $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
52
+                                $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
53 53
                             if (!is_array($function)) {
54 54
                                 $output = "{$function}({$params})";
55 55
                             } else {
56
-                                if (is_object($function[ 0 ])) {
56
+                                if (is_object($function[0])) {
57 57
                                     $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
58
-                                              $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
58
+                                              $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
59 59
                                 } else {
60
-                                    $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
60
+                                    $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
61 61
                                 }
62 62
                             }
63
-                            $compiler->known_modifier_type[ $modifier ] = $type;
63
+                            $compiler->known_modifier_type[$modifier] = $type;
64 64
                             break 2;
65 65
                         }
66 66
                         break;
67 67
                     case 2:
68 68
                         // registered modifier compiler
69
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
69
+                        if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {
70 70
                             $output =
71
-                                call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
71
+                                call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0],
72 72
                                                $single_modifier, $compiler->smarty);
73
-                            $compiler->known_modifier_type[ $modifier ] = $type;
73
+                            $compiler->known_modifier_type[$modifier] = $type;
74 74
                             break 2;
75 75
                         }
76 76
                         break;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                                 $plugin = 'smarty_modifiercompiler_' . $modifier;
85 85
                                 $output = $plugin($single_modifier, $compiler);
86 86
                             }
87
-                            $compiler->known_modifier_type[ $modifier ] = $type;
87
+                            $compiler->known_modifier_type[$modifier] = $type;
88 88
                             break 2;
89 89
                         }
90 90
                         break;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                             ) {
98 98
                                 $output = "{$function}({$params})";
99 99
                             }
100
-                            $compiler->known_modifier_type[ $modifier ] = $type;
100
+                            $compiler->known_modifier_type[$modifier] = $type;
101 101
                             break 2;
102 102
                         }
103 103
                         break;
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
                             ) {
111 111
                                 $output = "{$modifier}({$params})";
112 112
                             }
113
-                            $compiler->known_modifier_type[ $modifier ] = $type;
113
+                            $compiler->known_modifier_type[$modifier] = $type;
114 114
                             break 2;
115 115
                         }
116 116
                         break;
117 117
                     case 6:
118 118
                         // default plugin handler
119
-                        if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
119
+                        if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) ||
120 120
                             (is_callable($compiler->smarty->default_plugin_handler_func) &&
121 121
                              $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
122 122
                         ) {
123
-                            $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
123
+                            $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
124 124
                             // check if modifier allowed
125 125
                             if (!is_object($compiler->smarty->security_policy) ||
126 126
                                 $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
                                 if (!is_array($function)) {
129 129
                                     $output = "{$function}({$params})";
130 130
                                 } else {
131
-                                    if (is_object($function[ 0 ])) {
132
-                                        $output =  $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')';
131
+                                    if (is_object($function[0])) {
132
+                                        $output = $function[0] . '->' . $function[1] . '(' . $params . ')';
133 133
                                     } else {
134
-                                        $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
134
+                                        $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
135 135
                                     }
136 136
                                 }
137 137
                             }
138
-                            if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
139
-                                isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
138
+                            if (isset($compiler->parent_compiler->template->compiled->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) ||
139
+                                isset($compiler->parent_compiler->template->compiled->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])
140 140
                             ) {
141 141
                                 // was a plugin
142
-                                $compiler->known_modifier_type[ $modifier ] = 4;
142
+                                $compiler->known_modifier_type[$modifier] = 4;
143 143
                             } else {
144
-                                $compiler->known_modifier_type[ $modifier ] = $type;
144
+                                $compiler->known_modifier_type[$modifier] = $type;
145 145
                             }
146 146
                             break 2;
147 147
                         }
148 148
                 }
149 149
             }
150
-            if (!isset($compiler->known_modifier_type[ $modifier ])) {
150
+            if (!isset($compiler->known_modifier_type[$modifier])) {
151 151
                 $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
152 152
             }
153 153
         }
Please login to merge, or discard this patch.