Completed
Push — developer ( 7f46f3...3f66fa )
by Błażej
134:52 queued 72:56
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.
libraries/Smarty/libs/sysplugins/smarty_internal_data.php 2 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -28,216 +28,216 @@
 block discarded – undo
28 28
  */
29 29
 class Smarty_Internal_Data
30 30
 {
31
-    /**
32
-     * This object type (Smarty = 1, template = 2, data = 4)
33
-     *
34
-     * @var int
35
-     */
36
-    public $_objType = 4;
37
-
38
-    /**
39
-     * name of class used for templates
40
-     *
41
-     * @var string
42
-     */
43
-    public $template_class = 'Smarty_Internal_Template';
44
-
45
-    /**
46
-     * template variables
47
-     *
48
-     * @var Smarty_Variable[]
49
-     */
50
-    public $tpl_vars = array();
51
-
52
-    /**
53
-     * parent template (if any)
54
-     *
55
-     * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data
56
-     */
57
-    public $parent = null;
58
-
59
-    /**
60
-     * configuration settings
61
-     *
62
-     * @var string[]
63
-     */
64
-    public $config_vars = array();
65
-
66
-    /**
67
-     * extension handler
68
-     *
69
-     * @var Smarty_Internal_Extension_Handler
70
-     */
71
-    public $ext = null;
72
-
73
-    /**
74
-     * Smarty_Internal_Data constructor.
75
-     *
76
-     * Install extension handler
77
-     */
78
-    public function __construct()
79
-    {
80
-        $this->ext = new Smarty_Internal_Extension_Handler();
81
-        $this->ext->objType = $this->_objType;
82
-    }
83
-
84
-    /**
85
-     * assigns a Smarty variable
86
-     *
87
-     * @param  array|string $tpl_var the template variable name(s)
88
-     * @param  mixed        $value   the value to assign
89
-     * @param  boolean      $nocache if true any output of this variable will be not cached
90
-     *
91
-     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
92
-     *                              chaining
93
-     */
94
-    public function assign($tpl_var, $value = null, $nocache = false)
95
-    {
96
-        if (is_array($tpl_var)) {
97
-            foreach ($tpl_var as $_key => $_val) {
98
-                $this->assign($_key, $_val, $nocache);
99
-            }
100
-        } else {
101
-            if ($tpl_var != '') {
102
-                if ($this->_objType == 2) {
103
-                    /** @var  Smarty_Internal_Template $this */
104
-                    $this->_assignInScope($tpl_var, $value, $nocache);
105
-                } else {
106
-                    $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
107
-                }
108
-            }
109
-        }
110
-        return $this;
111
-    }
112
-
113
-    /**
114
-     * appends values to template variables
115
-     *
116
-     * @api  Smarty::append()
117
-     * @link http://www.smarty.net/docs/en/api.append.tpl
118
-     *
119
-     * @param  array|string $tpl_var                                           the template variable name(s)
120
-     * @param  mixed        $value                                             the value to append
121
-     * @param  bool         $merge                                             flag if array elements shall be merged
122
-     * @param  bool         $nocache                                           if true any output of this variable will
123
-     *                                                                         be not cached
124
-     *
125
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
126
-     */
127
-    public function append($tpl_var, $value = null, $merge = false, $nocache = false)
128
-    {
129
-        return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache);
130
-    }
131
-
132
-    /**
133
-     * assigns a global Smarty variable
134
-     *
135
-     * @param  string  $varName the global variable name
136
-     * @param  mixed   $value   the value to assign
137
-     * @param  boolean $nocache if true any output of this variable will be not cached
138
-     *
139
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
140
-     */
141
-    public function assignGlobal($varName, $value = null, $nocache = false)
142
-    {
143
-        return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache);
144
-    }
145
-
146
-    /**
147
-     * appends values to template variables by reference
148
-     *
149
-     * @param  string  $tpl_var the template variable name
150
-     * @param  mixed   &$value  the referenced value to append
151
-     * @param  boolean $merge   flag if array elements shall be merged
152
-     *
153
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
154
-     */
155
-    public function appendByRef($tpl_var, &$value, $merge = false)
156
-    {
157
-        return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge);
158
-    }
159
-
160
-    /**
161
-     * assigns values to template variables by reference
162
-     *
163
-     * @param string   $tpl_var the template variable name
164
-     * @param          $value
165
-     * @param  boolean $nocache if true any output of this variable will be not cached
166
-     *
167
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
168
-     */
169
-    public function assignByRef($tpl_var, &$value, $nocache = false)
170
-    {
171
-        return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache);
172
-    }
173
-
174
-    /**
175
-     * Returns a single or all template variables
176
-     *
177
-     * @api  Smarty::getTemplateVars()
178
-     * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
179
-     *
180
-     * @param  string                                                 $varName       variable name or null
181
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
182
-     * @param  bool                                                   $searchParents include parent templates?
183
-     *
184
-     * @return mixed variable value or or array of variables
185
-     */
186
-    public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
187
-    {
188
-        return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents);
189
-    }
190
-
191
-    /**
192
-     * gets the object of a Smarty variable
193
-     *
194
-     * @param  string               $variable      the name of the Smarty variable
195
-     * @param  Smarty_Internal_Data $_ptr          optional pointer to data object
196
-     * @param  boolean              $searchParents search also in parent data
197
-     * @param bool                  $error_enable
198
-     *
199
-     * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable
200
-     * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
201
-     */
202
-    public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
203
-                                $error_enable = true)
204
-    {
205
-        return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
206
-    }
207
-
208
-    /**
209
-     * Follow the parent chain an merge template and config variables
210
-     *
211
-     * @param \Smarty_Internal_Data|null $data
212
-     */
213
-    public function _mergeVars(Smarty_Internal_Data $data = null)
214
-    {
215
-        if (isset($data)) {
216
-            if (!empty($this->tpl_vars)) {
217
-                $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars);
218
-            }
219
-            if (!empty($this->config_vars)) {
220
-                $data->config_vars = array_merge($this->config_vars, $data->config_vars);
221
-            }
222
-        } else {
223
-            $data = $this;
224
-        }
225
-        if (isset($this->parent)) {
226
-            $this->parent->_mergeVars($data);
227
-        }
228
-    }
229
-
230
-    /**
231
-     * Handle unknown class methods
232
-     *
233
-     * @param string $name unknown method-name
234
-     * @param array  $args argument array
235
-     *
236
-     * @return mixed
237
-     * @throws SmartyException
238
-     */
239
-    public function __call($name, $args)
240
-    {
241
-        return $this->ext->_callExternalMethod($this, $name, $args);
242
-    }
31
+	/**
32
+	 * This object type (Smarty = 1, template = 2, data = 4)
33
+	 *
34
+	 * @var int
35
+	 */
36
+	public $_objType = 4;
37
+
38
+	/**
39
+	 * name of class used for templates
40
+	 *
41
+	 * @var string
42
+	 */
43
+	public $template_class = 'Smarty_Internal_Template';
44
+
45
+	/**
46
+	 * template variables
47
+	 *
48
+	 * @var Smarty_Variable[]
49
+	 */
50
+	public $tpl_vars = array();
51
+
52
+	/**
53
+	 * parent template (if any)
54
+	 *
55
+	 * @var Smarty|Smarty_Internal_Template|Smarty_Internal_Data
56
+	 */
57
+	public $parent = null;
58
+
59
+	/**
60
+	 * configuration settings
61
+	 *
62
+	 * @var string[]
63
+	 */
64
+	public $config_vars = array();
65
+
66
+	/**
67
+	 * extension handler
68
+	 *
69
+	 * @var Smarty_Internal_Extension_Handler
70
+	 */
71
+	public $ext = null;
72
+
73
+	/**
74
+	 * Smarty_Internal_Data constructor.
75
+	 *
76
+	 * Install extension handler
77
+	 */
78
+	public function __construct()
79
+	{
80
+		$this->ext = new Smarty_Internal_Extension_Handler();
81
+		$this->ext->objType = $this->_objType;
82
+	}
83
+
84
+	/**
85
+	 * assigns a Smarty variable
86
+	 *
87
+	 * @param  array|string $tpl_var the template variable name(s)
88
+	 * @param  mixed        $value   the value to assign
89
+	 * @param  boolean      $nocache if true any output of this variable will be not cached
90
+	 *
91
+	 * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
92
+	 *                              chaining
93
+	 */
94
+	public function assign($tpl_var, $value = null, $nocache = false)
95
+	{
96
+		if (is_array($tpl_var)) {
97
+			foreach ($tpl_var as $_key => $_val) {
98
+				$this->assign($_key, $_val, $nocache);
99
+			}
100
+		} else {
101
+			if ($tpl_var != '') {
102
+				if ($this->_objType == 2) {
103
+					/** @var  Smarty_Internal_Template $this */
104
+					$this->_assignInScope($tpl_var, $value, $nocache);
105
+				} else {
106
+					$this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
107
+				}
108
+			}
109
+		}
110
+		return $this;
111
+	}
112
+
113
+	/**
114
+	 * appends values to template variables
115
+	 *
116
+	 * @api  Smarty::append()
117
+	 * @link http://www.smarty.net/docs/en/api.append.tpl
118
+	 *
119
+	 * @param  array|string $tpl_var                                           the template variable name(s)
120
+	 * @param  mixed        $value                                             the value to append
121
+	 * @param  bool         $merge                                             flag if array elements shall be merged
122
+	 * @param  bool         $nocache                                           if true any output of this variable will
123
+	 *                                                                         be not cached
124
+	 *
125
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
126
+	 */
127
+	public function append($tpl_var, $value = null, $merge = false, $nocache = false)
128
+	{
129
+		return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache);
130
+	}
131
+
132
+	/**
133
+	 * assigns a global Smarty variable
134
+	 *
135
+	 * @param  string  $varName the global variable name
136
+	 * @param  mixed   $value   the value to assign
137
+	 * @param  boolean $nocache if true any output of this variable will be not cached
138
+	 *
139
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
140
+	 */
141
+	public function assignGlobal($varName, $value = null, $nocache = false)
142
+	{
143
+		return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache);
144
+	}
145
+
146
+	/**
147
+	 * appends values to template variables by reference
148
+	 *
149
+	 * @param  string  $tpl_var the template variable name
150
+	 * @param  mixed   &$value  the referenced value to append
151
+	 * @param  boolean $merge   flag if array elements shall be merged
152
+	 *
153
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
154
+	 */
155
+	public function appendByRef($tpl_var, &$value, $merge = false)
156
+	{
157
+		return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge);
158
+	}
159
+
160
+	/**
161
+	 * assigns values to template variables by reference
162
+	 *
163
+	 * @param string   $tpl_var the template variable name
164
+	 * @param          $value
165
+	 * @param  boolean $nocache if true any output of this variable will be not cached
166
+	 *
167
+	 * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
168
+	 */
169
+	public function assignByRef($tpl_var, &$value, $nocache = false)
170
+	{
171
+		return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache);
172
+	}
173
+
174
+	/**
175
+	 * Returns a single or all template variables
176
+	 *
177
+	 * @api  Smarty::getTemplateVars()
178
+	 * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
179
+	 *
180
+	 * @param  string                                                 $varName       variable name or null
181
+	 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
182
+	 * @param  bool                                                   $searchParents include parent templates?
183
+	 *
184
+	 * @return mixed variable value or or array of variables
185
+	 */
186
+	public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
187
+	{
188
+		return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents);
189
+	}
190
+
191
+	/**
192
+	 * gets the object of a Smarty variable
193
+	 *
194
+	 * @param  string               $variable      the name of the Smarty variable
195
+	 * @param  Smarty_Internal_Data $_ptr          optional pointer to data object
196
+	 * @param  boolean              $searchParents search also in parent data
197
+	 * @param bool                  $error_enable
198
+	 *
199
+	 * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable
200
+	 * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
201
+	 */
202
+	public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
203
+								$error_enable = true)
204
+	{
205
+		return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
206
+	}
207
+
208
+	/**
209
+	 * Follow the parent chain an merge template and config variables
210
+	 *
211
+	 * @param \Smarty_Internal_Data|null $data
212
+	 */
213
+	public function _mergeVars(Smarty_Internal_Data $data = null)
214
+	{
215
+		if (isset($data)) {
216
+			if (!empty($this->tpl_vars)) {
217
+				$data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars);
218
+			}
219
+			if (!empty($this->config_vars)) {
220
+				$data->config_vars = array_merge($this->config_vars, $data->config_vars);
221
+			}
222
+		} else {
223
+			$data = $this;
224
+		}
225
+		if (isset($this->parent)) {
226
+			$this->parent->_mergeVars($data);
227
+		}
228
+	}
229
+
230
+	/**
231
+	 * Handle unknown class methods
232
+	 *
233
+	 * @param string $name unknown method-name
234
+	 * @param array  $args argument array
235
+	 *
236
+	 * @return mixed
237
+	 * @throws SmartyException
238
+	 */
239
+	public function __call($name, $args)
240
+	{
241
+		return $this->ext->_callExternalMethod($this, $name, $args);
242
+	}
243 243
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
                     /** @var  Smarty_Internal_Template $this */
104 104
                     $this->_assignInScope($tpl_var, $value, $nocache);
105 105
                 } else {
106
-                    $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
106
+                    $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache);
107 107
                 }
108 108
             }
109 109
         }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_debug.php 2 patches
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
     public function start_template(Smarty_Internal_Template $template, $mode = null)
54 54
     {
55 55
         if (isset($mode)) {
56
-            $this->index ++;
57
-            $this->offset ++;
58
-            $this->template_data[ $this->index ] = null;
56
+            $this->index++;
57
+            $this->offset++;
58
+            $this->template_data[$this->index] = null;
59 59
         }
60 60
         $key = $this->get_key($template);
61
-        $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
61
+        $this->template_data[$this->index][$key]['start_template_time'] = microtime(true);
62 62
     }
63 63
 
64 64
     /**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     public function end_template(Smarty_Internal_Template $template)
70 70
     {
71 71
         $key = $this->get_key($template);
72
-        $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
73
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
72
+        $this->template_data[$this->index][$key]['total_time'] +=
73
+            microtime(true) - $this->template_data[$this->index][$key]['start_template_time'];
74 74
     }
75 75
 
76 76
     /**
@@ -83,24 +83,24 @@  discard block
 block discarded – undo
83 83
         static $_is_stringy = array('string' => true, 'eval' => true);
84 84
         if (!empty($template->compiler->trace_uid)) {
85 85
             $key = $template->compiler->trace_uid;
86
-            if (!isset($this->template_data[ $this->index ][ $key ])) {
87
-                if (isset($_is_stringy[ $template->source->type ])) {
88
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] =
86
+            if (!isset($this->template_data[$this->index][$key])) {
87
+                if (isset($_is_stringy[$template->source->type])) {
88
+                    $this->template_data[$this->index][$key]['name'] =
89 89
                         '\'' . substr($template->source->name, 0, 25) . '...\'';
90 90
                 } else {
91
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
91
+                    $this->template_data[$this->index][$key]['name'] = $template->source->filepath;
92 92
                 }
93
-                $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
94
-                $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
95
-                $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
93
+                $this->template_data[$this->index][$key]['compile_time'] = 0;
94
+                $this->template_data[$this->index][$key]['render_time'] = 0;
95
+                $this->template_data[$this->index][$key]['cache_time'] = 0;
96 96
             }
97 97
         } else {
98
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
98
+            if (isset($this->ignore_uid[$template->source->uid])) {
99 99
                 return;
100 100
             }
101 101
             $key = $this->get_key($template);
102 102
         }
103
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
103
+        $this->template_data[$this->index][$key]['start_time'] = microtime(true);
104 104
     }
105 105
 
106 106
     /**
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
         if (!empty($template->compiler->trace_uid)) {
114 114
             $key = $template->compiler->trace_uid;
115 115
         } else {
116
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
116
+            if (isset($this->ignore_uid[$template->source->uid])) {
117 117
                 return;
118 118
             }
119 119
 
120 120
             $key = $this->get_key($template);
121 121
         }
122
-        $this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
123
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
122
+        $this->template_data[$this->index][$key]['compile_time'] +=
123
+            microtime(true) - $this->template_data[$this->index][$key]['start_time'];
124 124
     }
125 125
 
126 126
     /**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     public function start_render(Smarty_Internal_Template $template)
132 132
     {
133 133
         $key = $this->get_key($template);
134
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
134
+        $this->template_data[$this->index][$key]['start_time'] = microtime(true);
135 135
     }
136 136
 
137 137
     /**
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
     public function end_render(Smarty_Internal_Template $template)
143 143
     {
144 144
         $key = $this->get_key($template);
145
-        $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
146
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
145
+        $this->template_data[$this->index][$key]['render_time'] +=
146
+            microtime(true) - $this->template_data[$this->index][$key]['start_time'];
147 147
     }
148 148
 
149 149
     /**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     public function start_cache(Smarty_Internal_Template $template)
155 155
     {
156 156
         $key = $this->get_key($template);
157
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
157
+        $this->template_data[$this->index][$key]['start_time'] = microtime(true);
158 158
     }
159 159
 
160 160
     /**
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
     public function end_cache(Smarty_Internal_Template $template)
166 166
     {
167 167
         $key = $this->get_key($template);
168
-        $this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
169
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
168
+        $this->template_data[$this->index][$key]['cache_time'] +=
169
+            microtime(true) - $this->template_data[$this->index][$key]['start_time'];
170 170
     }
171 171
 
172 172
     /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     public function display_debug($obj, $full = false)
197 197
     {
198 198
         if (!$full) {
199
-            $this->offset ++;
199
+            $this->offset++;
200 200
             $savedIndex = $this->index;
201 201
             $this->index = 9999;
202 202
         }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
244 244
         }
245 245
         if ($obj->_objType == 1 || $full) {
246
-            $_template->assign('template_data', $this->template_data[ $this->index ]);
246
+            $_template->assign('template_data', $this->template_data[$this->index]);
247 247
         } else {
248 248
             $_template->assign('template_data', null);
249 249
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         $_template->assign('offset', $this->offset * 50);
255 255
         echo $_template->fetch();
256 256
         if (isset($full)) {
257
-            $this->index --;
257
+            $this->index--;
258 258
         }
259 259
         if (!$full) {
260 260
             $this->index = $savedIndex;
@@ -272,53 +272,53 @@  discard block
 block discarded – undo
272 272
     {
273 273
         $config_vars = array();
274 274
         foreach ($obj->config_vars as $key => $var) {
275
-            $config_vars[ $key ][ 'value' ] = $var;
275
+            $config_vars[$key]['value'] = $var;
276 276
             if ($obj->_objType == 2) {
277
-                $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
277
+                $config_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
278 278
             } elseif ($obj->_objType == 4) {
279
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
279
+                $tpl_vars[$key]['scope'] = $obj->dataObjectName;
280 280
             } else {
281
-                $config_vars[ $key ][ 'scope' ] = 'Smarty object';
281
+                $config_vars[$key]['scope'] = 'Smarty object';
282 282
             }
283 283
         }
284 284
         $tpl_vars = array();
285 285
         foreach ($obj->tpl_vars as $key => $var) {
286 286
             foreach ($var as $varkey => $varvalue) {
287 287
                 if ($varkey == 'value') {
288
-                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
288
+                    $tpl_vars[$key][$varkey] = $varvalue;
289 289
                 } else {
290 290
                     if ($varkey == 'nocache') {
291 291
                         if ($varvalue == true) {
292
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
292
+                            $tpl_vars[$key][$varkey] = $varvalue;
293 293
                         }
294 294
                     } else {
295 295
                         if ($varkey != 'scope' || $varvalue !== 0) {
296
-                            $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
296
+                            $tpl_vars[$key]['attributes'][$varkey] = $varvalue;
297 297
                         }
298 298
                     }
299 299
                 }
300 300
             }
301 301
             if ($obj->_objType == 2) {
302
-                $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
302
+                $tpl_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
303 303
             } elseif ($obj->_objType == 4) {
304
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
304
+                $tpl_vars[$key]['scope'] = $obj->dataObjectName;
305 305
             } else {
306
-                $tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
306
+                $tpl_vars[$key]['scope'] = 'Smarty object';
307 307
             }
308 308
         }
309 309
 
310 310
         if (isset($obj->parent)) {
311 311
             $parent = $this->get_debug_vars($obj->parent);
312 312
             foreach ($parent->tpl_vars as $name => $pvar) {
313
-                if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
314
-                    $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
313
+                if (isset($tpl_vars[$name]) && $tpl_vars[$name]['value'] === $pvar['value']) {
314
+                    $tpl_vars[$name]['scope'] = $pvar['scope'];
315 315
                 }
316 316
             }
317 317
             $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
318 318
 
319 319
             foreach ($parent->config_vars as $name => $pvar) {
320
-                if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
321
-                    $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
320
+                if (isset($config_vars[$name]) && $config_vars[$name]['value'] === $pvar['value']) {
321
+                    $config_vars[$name]['scope'] = $pvar['scope'];
322 322
                 }
323 323
             }
324 324
             $config_vars = array_merge($parent->config_vars, $config_vars);
@@ -327,20 +327,20 @@  discard block
 block discarded – undo
327 327
                 if (!array_key_exists($key, $tpl_vars)) {
328 328
                     foreach ($var as $varkey => $varvalue) {
329 329
                         if ($varkey == 'value') {
330
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
330
+                            $tpl_vars[$key][$varkey] = $varvalue;
331 331
                         } else {
332 332
                             if ($varkey == 'nocache') {
333 333
                                 if ($varvalue == true) {
334
-                                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
334
+                                    $tpl_vars[$key][$varkey] = $varvalue;
335 335
                                 }
336 336
                             } else {
337 337
                                 if ($varkey != 'scope' || $varvalue !== 0) {
338
-                                    $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
338
+                                    $tpl_vars[$key]['attributes'][$varkey] = $varvalue;
339 339
                                 }
340 340
                             }
341 341
                         }
342 342
                     }
343
-                    $tpl_vars[ $key ][ 'scope' ] = 'Global';
343
+                    $tpl_vars[$key]['scope'] = 'Global';
344 344
                 }
345 345
             }
346 346
         }
@@ -363,19 +363,19 @@  discard block
 block discarded – undo
363 363
             $template->source->filepath;
364 364
         }
365 365
         $key = $template->source->uid;
366
-        if (isset($this->template_data[ $this->index ][ $key ])) {
366
+        if (isset($this->template_data[$this->index][$key])) {
367 367
             return $key;
368 368
         } else {
369
-            if (isset($_is_stringy[ $template->source->type ])) {
370
-                $this->template_data[ $this->index ][ $key ][ 'name' ] =
369
+            if (isset($_is_stringy[$template->source->type])) {
370
+                $this->template_data[$this->index][$key]['name'] =
371 371
                     '\'' . substr($template->source->name, 0, 25) . '...\'';
372 372
             } else {
373
-                $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
373
+                $this->template_data[$this->index][$key]['name'] = $template->source->filepath;
374 374
             }
375
-            $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
376
-            $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
377
-            $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
378
-            $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
375
+            $this->template_data[$this->index][$key]['compile_time'] = 0;
376
+            $this->template_data[$this->index][$key]['render_time'] = 0;
377
+            $this->template_data[$this->index][$key]['cache_time'] = 0;
378
+            $this->template_data[$this->index][$key]['total_time'] = 0;
379 379
 
380 380
             return $key;
381 381
         }
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         if ($template->source->uid == '') {
393 393
             $template->source->filepath;
394 394
         }
395
-        $this->ignore_uid[ $template->source->uid ] = true;
395
+        $this->ignore_uid[$template->source->uid] = true;
396 396
     }
397 397
 
398 398
     /**
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
      */
403 403
     public function debugUrl(Smarty $smarty)
404 404
     {
405
-        if (isset($_SERVER[ 'QUERY_STRING' ])) {
406
-            $_query_string = $_SERVER[ 'QUERY_STRING' ];
405
+        if (isset($_SERVER['QUERY_STRING'])) {
406
+            $_query_string = $_SERVER['QUERY_STRING'];
407 407
         } else {
408 408
             $_query_string = '';
409 409
         }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                 $smarty->debugging = true;
422 422
             }
423 423
         } else {
424
-            if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
424
+            if (isset($_COOKIE['SMARTY_DEBUG'])) {
425 425
                 $smarty->debugging = true;
426 426
             }
427 427
         }
Please login to merge, or discard this patch.
Indentation   +386 added lines, -386 removed lines patch added patch discarded remove patch
@@ -16,414 +16,414 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Debug extends Smarty_Internal_Data
18 18
 {
19
-    /**
20
-     * template data
21
-     *
22
-     * @var array
23
-     */
24
-    public $template_data = array();
19
+	/**
20
+	 * template data
21
+	 *
22
+	 * @var array
23
+	 */
24
+	public $template_data = array();
25 25
 
26
-    /**
27
-     * List of uid's which shall be ignored
28
-     *
29
-     * @var array
30
-     */
31
-    public $ignore_uid = array();
26
+	/**
27
+	 * List of uid's which shall be ignored
28
+	 *
29
+	 * @var array
30
+	 */
31
+	public $ignore_uid = array();
32 32
 
33
-    /**
34
-     * Index of display() and fetch() calls
35
-     *
36
-     * @var int
37
-     */
38
-    public $index = 0;
33
+	/**
34
+	 * Index of display() and fetch() calls
35
+	 *
36
+	 * @var int
37
+	 */
38
+	public $index = 0;
39 39
 
40
-    /**
41
-     * Counter for window offset
42
-     *
43
-     * @var int
44
-     */
45
-    public $offset = 0;
40
+	/**
41
+	 * Counter for window offset
42
+	 *
43
+	 * @var int
44
+	 */
45
+	public $offset = 0;
46 46
 
47
-    /**
48
-     * Start logging template
49
-     *
50
-     * @param \Smarty_Internal_Template $template template
51
-     * @param null                      $mode     true: display   false: fetch  null: subtemplate
52
-     */
53
-    public function start_template(Smarty_Internal_Template $template, $mode = null)
54
-    {
55
-        if (isset($mode)) {
56
-            $this->index ++;
57
-            $this->offset ++;
58
-            $this->template_data[ $this->index ] = null;
59
-        }
60
-        $key = $this->get_key($template);
61
-        $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
62
-    }
47
+	/**
48
+	 * Start logging template
49
+	 *
50
+	 * @param \Smarty_Internal_Template $template template
51
+	 * @param null                      $mode     true: display   false: fetch  null: subtemplate
52
+	 */
53
+	public function start_template(Smarty_Internal_Template $template, $mode = null)
54
+	{
55
+		if (isset($mode)) {
56
+			$this->index ++;
57
+			$this->offset ++;
58
+			$this->template_data[ $this->index ] = null;
59
+		}
60
+		$key = $this->get_key($template);
61
+		$this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
62
+	}
63 63
 
64
-    /**
65
-     * End logging of cache time
66
-     *
67
-     * @param \Smarty_Internal_Template $template cached template
68
-     */
69
-    public function end_template(Smarty_Internal_Template $template)
70
-    {
71
-        $key = $this->get_key($template);
72
-        $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
73
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
74
-    }
64
+	/**
65
+	 * End logging of cache time
66
+	 *
67
+	 * @param \Smarty_Internal_Template $template cached template
68
+	 */
69
+	public function end_template(Smarty_Internal_Template $template)
70
+	{
71
+		$key = $this->get_key($template);
72
+		$this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
73
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
74
+	}
75 75
 
76
-    /**
77
-     * Start logging of compile time
78
-     *
79
-     * @param \Smarty_Internal_Template $template
80
-     */
81
-    public function start_compile(Smarty_Internal_Template $template)
82
-    {
83
-        static $_is_stringy = array('string' => true, 'eval' => true);
84
-        if (!empty($template->compiler->trace_uid)) {
85
-            $key = $template->compiler->trace_uid;
86
-            if (!isset($this->template_data[ $this->index ][ $key ])) {
87
-                if (isset($_is_stringy[ $template->source->type ])) {
88
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] =
89
-                        '\'' . substr($template->source->name, 0, 25) . '...\'';
90
-                } else {
91
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
92
-                }
93
-                $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
94
-                $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
95
-                $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
96
-            }
97
-        } else {
98
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
99
-                return;
100
-            }
101
-            $key = $this->get_key($template);
102
-        }
103
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
104
-    }
76
+	/**
77
+	 * Start logging of compile time
78
+	 *
79
+	 * @param \Smarty_Internal_Template $template
80
+	 */
81
+	public function start_compile(Smarty_Internal_Template $template)
82
+	{
83
+		static $_is_stringy = array('string' => true, 'eval' => true);
84
+		if (!empty($template->compiler->trace_uid)) {
85
+			$key = $template->compiler->trace_uid;
86
+			if (!isset($this->template_data[ $this->index ][ $key ])) {
87
+				if (isset($_is_stringy[ $template->source->type ])) {
88
+					$this->template_data[ $this->index ][ $key ][ 'name' ] =
89
+						'\'' . substr($template->source->name, 0, 25) . '...\'';
90
+				} else {
91
+					$this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
92
+				}
93
+				$this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
94
+				$this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
95
+				$this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
96
+			}
97
+		} else {
98
+			if (isset($this->ignore_uid[ $template->source->uid ])) {
99
+				return;
100
+			}
101
+			$key = $this->get_key($template);
102
+		}
103
+		$this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
104
+	}
105 105
 
106
-    /**
107
-     * End logging of compile time
108
-     *
109
-     * @param \Smarty_Internal_Template $template
110
-     */
111
-    public function end_compile(Smarty_Internal_Template $template)
112
-    {
113
-        if (!empty($template->compiler->trace_uid)) {
114
-            $key = $template->compiler->trace_uid;
115
-        } else {
116
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
117
-                return;
118
-            }
106
+	/**
107
+	 * End logging of compile time
108
+	 *
109
+	 * @param \Smarty_Internal_Template $template
110
+	 */
111
+	public function end_compile(Smarty_Internal_Template $template)
112
+	{
113
+		if (!empty($template->compiler->trace_uid)) {
114
+			$key = $template->compiler->trace_uid;
115
+		} else {
116
+			if (isset($this->ignore_uid[ $template->source->uid ])) {
117
+				return;
118
+			}
119 119
 
120
-            $key = $this->get_key($template);
121
-        }
122
-        $this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
123
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
124
-    }
120
+			$key = $this->get_key($template);
121
+		}
122
+		$this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
123
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
124
+	}
125 125
 
126
-    /**
127
-     * Start logging of render time
128
-     *
129
-     * @param \Smarty_Internal_Template $template
130
-     */
131
-    public function start_render(Smarty_Internal_Template $template)
132
-    {
133
-        $key = $this->get_key($template);
134
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
135
-    }
126
+	/**
127
+	 * Start logging of render time
128
+	 *
129
+	 * @param \Smarty_Internal_Template $template
130
+	 */
131
+	public function start_render(Smarty_Internal_Template $template)
132
+	{
133
+		$key = $this->get_key($template);
134
+		$this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
135
+	}
136 136
 
137
-    /**
138
-     * End logging of compile time
139
-     *
140
-     * @param \Smarty_Internal_Template $template
141
-     */
142
-    public function end_render(Smarty_Internal_Template $template)
143
-    {
144
-        $key = $this->get_key($template);
145
-        $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
146
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
147
-    }
137
+	/**
138
+	 * End logging of compile time
139
+	 *
140
+	 * @param \Smarty_Internal_Template $template
141
+	 */
142
+	public function end_render(Smarty_Internal_Template $template)
143
+	{
144
+		$key = $this->get_key($template);
145
+		$this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
146
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
147
+	}
148 148
 
149
-    /**
150
-     * Start logging of cache time
151
-     *
152
-     * @param \Smarty_Internal_Template $template cached template
153
-     */
154
-    public function start_cache(Smarty_Internal_Template $template)
155
-    {
156
-        $key = $this->get_key($template);
157
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
158
-    }
149
+	/**
150
+	 * Start logging of cache time
151
+	 *
152
+	 * @param \Smarty_Internal_Template $template cached template
153
+	 */
154
+	public function start_cache(Smarty_Internal_Template $template)
155
+	{
156
+		$key = $this->get_key($template);
157
+		$this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
158
+	}
159 159
 
160
-    /**
161
-     * End logging of cache time
162
-     *
163
-     * @param \Smarty_Internal_Template $template cached template
164
-     */
165
-    public function end_cache(Smarty_Internal_Template $template)
166
-    {
167
-        $key = $this->get_key($template);
168
-        $this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
169
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
170
-    }
160
+	/**
161
+	 * End logging of cache time
162
+	 *
163
+	 * @param \Smarty_Internal_Template $template cached template
164
+	 */
165
+	public function end_cache(Smarty_Internal_Template $template)
166
+	{
167
+		$key = $this->get_key($template);
168
+		$this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
169
+			microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
170
+	}
171 171
 
172
-    /**
173
-     * Register template object
174
-     *
175
-     * @param \Smarty_Internal_Template $template cached template
176
-     */
177
-    public function register_template(Smarty_Internal_Template $template)
178
-    {
179
-    }
172
+	/**
173
+	 * Register template object
174
+	 *
175
+	 * @param \Smarty_Internal_Template $template cached template
176
+	 */
177
+	public function register_template(Smarty_Internal_Template $template)
178
+	{
179
+	}
180 180
 
181
-    /**
182
-     * Register data object
183
-     *
184
-     * @param \Smarty_Data $data data object
185
-     */
186
-    public static function register_data(Smarty_Data $data)
187
-    {
188
-    }
181
+	/**
182
+	 * Register data object
183
+	 *
184
+	 * @param \Smarty_Data $data data object
185
+	 */
186
+	public static function register_data(Smarty_Data $data)
187
+	{
188
+	}
189 189
 
190
-    /**
191
-     * Opens a window for the Smarty Debugging Console and display the data
192
-     *
193
-     * @param Smarty_Internal_Template|Smarty $obj object to debug
194
-     * @param bool                            $full
195
-     */
196
-    public function display_debug($obj, $full = false)
197
-    {
198
-        if (!$full) {
199
-            $this->offset ++;
200
-            $savedIndex = $this->index;
201
-            $this->index = 9999;
202
-        }
203
-        if ($obj->_objType == 1) {
204
-            $smarty = $obj;
205
-        } else {
206
-            $smarty = $obj->smarty;
207
-        }
208
-        // create fresh instance of smarty for displaying the debug console
209
-        // to avoid problems if the application did overload the Smarty class
210
-        $debObj = new Smarty();
211
-        // copy the working dirs from application
212
-        $debObj->setCompileDir($smarty->getCompileDir());
213
-        // init properties by hand as user may have edited the original Smarty class
214
-        $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
215
-        $debObj->force_compile = false;
216
-        $debObj->compile_check = true;
217
-        $debObj->left_delimiter = '{';
218
-        $debObj->right_delimiter = '}';
219
-        $debObj->security_policy = null;
220
-        $debObj->debugging = false;
221
-        $debObj->debugging_ctrl = 'NONE';
222
-        $debObj->error_reporting = E_ALL & ~E_NOTICE;
223
-        $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
224
-        $debObj->registered_plugins = array();
225
-        $debObj->registered_resources = array();
226
-        $debObj->registered_filters = array();
227
-        $debObj->autoload_filters = array();
228
-        $debObj->default_modifiers = array();
229
-        $debObj->escape_html = true;
230
-        $debObj->caching = false;
231
-        $debObj->compile_id = null;
232
-        $debObj->cache_id = null;
233
-        // prepare information of assigned variables
234
-        $ptr = $this->get_debug_vars($obj);
235
-        $_assigned_vars = $ptr->tpl_vars;
236
-        ksort($_assigned_vars);
237
-        $_config_vars = $ptr->config_vars;
238
-        ksort($_config_vars);
239
-        $debugging = $smarty->debugging;
190
+	/**
191
+	 * Opens a window for the Smarty Debugging Console and display the data
192
+	 *
193
+	 * @param Smarty_Internal_Template|Smarty $obj object to debug
194
+	 * @param bool                            $full
195
+	 */
196
+	public function display_debug($obj, $full = false)
197
+	{
198
+		if (!$full) {
199
+			$this->offset ++;
200
+			$savedIndex = $this->index;
201
+			$this->index = 9999;
202
+		}
203
+		if ($obj->_objType == 1) {
204
+			$smarty = $obj;
205
+		} else {
206
+			$smarty = $obj->smarty;
207
+		}
208
+		// create fresh instance of smarty for displaying the debug console
209
+		// to avoid problems if the application did overload the Smarty class
210
+		$debObj = new Smarty();
211
+		// copy the working dirs from application
212
+		$debObj->setCompileDir($smarty->getCompileDir());
213
+		// init properties by hand as user may have edited the original Smarty class
214
+		$debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
215
+		$debObj->force_compile = false;
216
+		$debObj->compile_check = true;
217
+		$debObj->left_delimiter = '{';
218
+		$debObj->right_delimiter = '}';
219
+		$debObj->security_policy = null;
220
+		$debObj->debugging = false;
221
+		$debObj->debugging_ctrl = 'NONE';
222
+		$debObj->error_reporting = E_ALL & ~E_NOTICE;
223
+		$debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
224
+		$debObj->registered_plugins = array();
225
+		$debObj->registered_resources = array();
226
+		$debObj->registered_filters = array();
227
+		$debObj->autoload_filters = array();
228
+		$debObj->default_modifiers = array();
229
+		$debObj->escape_html = true;
230
+		$debObj->caching = false;
231
+		$debObj->compile_id = null;
232
+		$debObj->cache_id = null;
233
+		// prepare information of assigned variables
234
+		$ptr = $this->get_debug_vars($obj);
235
+		$_assigned_vars = $ptr->tpl_vars;
236
+		ksort($_assigned_vars);
237
+		$_config_vars = $ptr->config_vars;
238
+		ksort($_config_vars);
239
+		$debugging = $smarty->debugging;
240 240
 
241
-        $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
242
-        if ($obj->_objType == 2) {
243
-            $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
244
-        }
245
-        if ($obj->_objType == 1 || $full) {
246
-            $_template->assign('template_data', $this->template_data[ $this->index ]);
247
-        } else {
248
-            $_template->assign('template_data', null);
249
-        }
250
-        $_template->assign('assigned_vars', $_assigned_vars);
251
-        $_template->assign('config_vars', $_config_vars);
252
-        $_template->assign('execution_time', microtime(true) - $smarty->start_time);
253
-        $_template->assign('display_mode', $debugging == 2 || !$full);
254
-        $_template->assign('offset', $this->offset * 50);
255
-        echo $_template->fetch();
256
-        if (isset($full)) {
257
-            $this->index --;
258
-        }
259
-        if (!$full) {
260
-            $this->index = $savedIndex;
261
-        }
262
-    }
241
+		$_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
242
+		if ($obj->_objType == 2) {
243
+			$_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
244
+		}
245
+		if ($obj->_objType == 1 || $full) {
246
+			$_template->assign('template_data', $this->template_data[ $this->index ]);
247
+		} else {
248
+			$_template->assign('template_data', null);
249
+		}
250
+		$_template->assign('assigned_vars', $_assigned_vars);
251
+		$_template->assign('config_vars', $_config_vars);
252
+		$_template->assign('execution_time', microtime(true) - $smarty->start_time);
253
+		$_template->assign('display_mode', $debugging == 2 || !$full);
254
+		$_template->assign('offset', $this->offset * 50);
255
+		echo $_template->fetch();
256
+		if (isset($full)) {
257
+			$this->index --;
258
+		}
259
+		if (!$full) {
260
+			$this->index = $savedIndex;
261
+		}
262
+	}
263 263
 
264
-    /**
265
-     * Recursively gets variables from all template/data scopes
266
-     *
267
-     * @param  Smarty_Internal_Template|Smarty_Data $obj object to debug
268
-     *
269
-     * @return StdClass
270
-     */
271
-    public function get_debug_vars($obj)
272
-    {
273
-        $config_vars = array();
274
-        foreach ($obj->config_vars as $key => $var) {
275
-            $config_vars[ $key ][ 'value' ] = $var;
276
-            if ($obj->_objType == 2) {
277
-                $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
278
-            } elseif ($obj->_objType == 4) {
279
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
280
-            } else {
281
-                $config_vars[ $key ][ 'scope' ] = 'Smarty object';
282
-            }
283
-        }
284
-        $tpl_vars = array();
285
-        foreach ($obj->tpl_vars as $key => $var) {
286
-            foreach ($var as $varkey => $varvalue) {
287
-                if ($varkey == 'value') {
288
-                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
289
-                } else {
290
-                    if ($varkey == 'nocache') {
291
-                        if ($varvalue === true) {
292
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
293
-                        }
294
-                    } else {
295
-                        if ($varkey != 'scope' || $varvalue !== 0) {
296
-                            $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
297
-                        }
298
-                    }
299
-                }
300
-            }
301
-            if ($obj->_objType == 2) {
302
-                $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
303
-            } elseif ($obj->_objType == 4) {
304
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
305
-            } else {
306
-                $tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
307
-            }
308
-        }
264
+	/**
265
+	 * Recursively gets variables from all template/data scopes
266
+	 *
267
+	 * @param  Smarty_Internal_Template|Smarty_Data $obj object to debug
268
+	 *
269
+	 * @return StdClass
270
+	 */
271
+	public function get_debug_vars($obj)
272
+	{
273
+		$config_vars = array();
274
+		foreach ($obj->config_vars as $key => $var) {
275
+			$config_vars[ $key ][ 'value' ] = $var;
276
+			if ($obj->_objType == 2) {
277
+				$config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
278
+			} elseif ($obj->_objType == 4) {
279
+				$tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
280
+			} else {
281
+				$config_vars[ $key ][ 'scope' ] = 'Smarty object';
282
+			}
283
+		}
284
+		$tpl_vars = array();
285
+		foreach ($obj->tpl_vars as $key => $var) {
286
+			foreach ($var as $varkey => $varvalue) {
287
+				if ($varkey == 'value') {
288
+					$tpl_vars[ $key ][ $varkey ] = $varvalue;
289
+				} else {
290
+					if ($varkey == 'nocache') {
291
+						if ($varvalue === true) {
292
+							$tpl_vars[ $key ][ $varkey ] = $varvalue;
293
+						}
294
+					} else {
295
+						if ($varkey != 'scope' || $varvalue !== 0) {
296
+							$tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
297
+						}
298
+					}
299
+				}
300
+			}
301
+			if ($obj->_objType == 2) {
302
+				$tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
303
+			} elseif ($obj->_objType == 4) {
304
+				$tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
305
+			} else {
306
+				$tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
307
+			}
308
+		}
309 309
 
310
-        if (isset($obj->parent)) {
311
-            $parent = $this->get_debug_vars($obj->parent);
312
-            foreach ($parent->tpl_vars as $name => $pvar) {
313
-                if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
314
-                    $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
315
-                }
316
-            }
317
-            $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
310
+		if (isset($obj->parent)) {
311
+			$parent = $this->get_debug_vars($obj->parent);
312
+			foreach ($parent->tpl_vars as $name => $pvar) {
313
+				if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
314
+					$tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
315
+				}
316
+			}
317
+			$tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
318 318
 
319
-            foreach ($parent->config_vars as $name => $pvar) {
320
-                if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
321
-                    $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
322
-                }
323
-            }
324
-            $config_vars = array_merge($parent->config_vars, $config_vars);
325
-        } else {
326
-            foreach (Smarty::$global_tpl_vars as $key => $var) {
327
-                if (!array_key_exists($key, $tpl_vars)) {
328
-                    foreach ($var as $varkey => $varvalue) {
329
-                        if ($varkey == 'value') {
330
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
331
-                        } else {
332
-                            if ($varkey == 'nocache') {
333
-                                if ($varvalue === true) {
334
-                                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
335
-                                }
336
-                            } else {
337
-                                if ($varkey != 'scope' || $varvalue !== 0) {
338
-                                    $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
339
-                                }
340
-                            }
341
-                        }
342
-                    }
343
-                    $tpl_vars[ $key ][ 'scope' ] = 'Global';
344
-                }
345
-            }
346
-        }
319
+			foreach ($parent->config_vars as $name => $pvar) {
320
+				if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
321
+					$config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
322
+				}
323
+			}
324
+			$config_vars = array_merge($parent->config_vars, $config_vars);
325
+		} else {
326
+			foreach (Smarty::$global_tpl_vars as $key => $var) {
327
+				if (!array_key_exists($key, $tpl_vars)) {
328
+					foreach ($var as $varkey => $varvalue) {
329
+						if ($varkey == 'value') {
330
+							$tpl_vars[ $key ][ $varkey ] = $varvalue;
331
+						} else {
332
+							if ($varkey == 'nocache') {
333
+								if ($varvalue === true) {
334
+									$tpl_vars[ $key ][ $varkey ] = $varvalue;
335
+								}
336
+							} else {
337
+								if ($varkey != 'scope' || $varvalue !== 0) {
338
+									$tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
339
+								}
340
+							}
341
+						}
342
+					}
343
+					$tpl_vars[ $key ][ 'scope' ] = 'Global';
344
+				}
345
+			}
346
+		}
347 347
 
348
-        return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
349
-    }
348
+		return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
349
+	}
350 350
 
351
-    /**
352
-     * Return key into $template_data for template
353
-     *
354
-     * @param \Smarty_Internal_Template $template template object
355
-     *
356
-     * @return string key into $template_data
357
-     */
358
-    private function get_key(Smarty_Internal_Template $template)
359
-    {
360
-        static $_is_stringy = array('string' => true, 'eval' => true);
361
-        // calculate Uid if not already done
362
-        if ($template->source->uid == '') {
363
-            $template->source->filepath;
364
-        }
365
-        $key = $template->source->uid;
366
-        if (isset($this->template_data[ $this->index ][ $key ])) {
367
-            return $key;
368
-        } else {
369
-            if (isset($_is_stringy[ $template->source->type ])) {
370
-                $this->template_data[ $this->index ][ $key ][ 'name' ] =
371
-                    '\'' . substr($template->source->name, 0, 25) . '...\'';
372
-            } else {
373
-                $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
374
-            }
375
-            $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
376
-            $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
377
-            $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
378
-            $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
351
+	/**
352
+	 * Return key into $template_data for template
353
+	 *
354
+	 * @param \Smarty_Internal_Template $template template object
355
+	 *
356
+	 * @return string key into $template_data
357
+	 */
358
+	private function get_key(Smarty_Internal_Template $template)
359
+	{
360
+		static $_is_stringy = array('string' => true, 'eval' => true);
361
+		// calculate Uid if not already done
362
+		if ($template->source->uid == '') {
363
+			$template->source->filepath;
364
+		}
365
+		$key = $template->source->uid;
366
+		if (isset($this->template_data[ $this->index ][ $key ])) {
367
+			return $key;
368
+		} else {
369
+			if (isset($_is_stringy[ $template->source->type ])) {
370
+				$this->template_data[ $this->index ][ $key ][ 'name' ] =
371
+					'\'' . substr($template->source->name, 0, 25) . '...\'';
372
+			} else {
373
+				$this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
374
+			}
375
+			$this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
376
+			$this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
377
+			$this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
378
+			$this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
379 379
 
380
-            return $key;
381
-        }
382
-    }
380
+			return $key;
381
+		}
382
+	}
383 383
 
384
-    /**
385
-     * Ignore template
386
-     *
387
-     * @param \Smarty_Internal_Template $template
388
-     */
389
-    public function ignore(Smarty_Internal_Template $template)
390
-    {
391
-        // calculate Uid if not already done
392
-        if ($template->source->uid == '') {
393
-            $template->source->filepath;
394
-        }
395
-        $this->ignore_uid[ $template->source->uid ] = true;
396
-    }
384
+	/**
385
+	 * Ignore template
386
+	 *
387
+	 * @param \Smarty_Internal_Template $template
388
+	 */
389
+	public function ignore(Smarty_Internal_Template $template)
390
+	{
391
+		// calculate Uid if not already done
392
+		if ($template->source->uid == '') {
393
+			$template->source->filepath;
394
+		}
395
+		$this->ignore_uid[ $template->source->uid ] = true;
396
+	}
397 397
 
398
-    /**
399
-     * handle 'URL' debugging mode
400
-     *
401
-     * @param Smarty $smarty
402
-     */
403
-    public function debugUrl(Smarty $smarty)
404
-    {
405
-        if (isset($_SERVER[ 'QUERY_STRING' ])) {
406
-            $_query_string = $_SERVER[ 'QUERY_STRING' ];
407
-        } else {
408
-            $_query_string = '';
409
-        }
410
-        if (false !== strpos($_query_string, $smarty->smarty_debug_id)) {
411
-            if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) {
412
-                // enable debugging for this browser session
413
-                setcookie('SMARTY_DEBUG', true);
414
-                $smarty->debugging = true;
415
-            } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) {
416
-                // disable debugging for this browser session
417
-                setcookie('SMARTY_DEBUG', false);
418
-                $smarty->debugging = false;
419
-            } else {
420
-                // enable debugging for this page
421
-                $smarty->debugging = true;
422
-            }
423
-        } else {
424
-            if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
425
-                $smarty->debugging = true;
426
-            }
427
-        }
428
-    }
398
+	/**
399
+	 * handle 'URL' debugging mode
400
+	 *
401
+	 * @param Smarty $smarty
402
+	 */
403
+	public function debugUrl(Smarty $smarty)
404
+	{
405
+		if (isset($_SERVER[ 'QUERY_STRING' ])) {
406
+			$_query_string = $_SERVER[ 'QUERY_STRING' ];
407
+		} else {
408
+			$_query_string = '';
409
+		}
410
+		if (false !== strpos($_query_string, $smarty->smarty_debug_id)) {
411
+			if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) {
412
+				// enable debugging for this browser session
413
+				setcookie('SMARTY_DEBUG', true);
414
+				$smarty->debugging = true;
415
+			} elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) {
416
+				// disable debugging for this browser session
417
+				setcookie('SMARTY_DEBUG', false);
418
+				$smarty->debugging = false;
419
+			} else {
420
+				// enable debugging for this page
421
+				$smarty->debugging = true;
422
+			}
423
+		} else {
424
+			if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
425
+				$smarty->debugging = true;
426
+			}
427
+		}
428
+	}
429 429
 }
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.
libraries/Smarty/libs/sysplugins/smarty_internal_method_configload.php 2 patches
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -11,174 +11,174 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_ConfigLoad
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
-     * load a config file, optionally load just selected sections
23
-     *
24
-     * @api  Smarty::configLoad()
25
-     * @link http://www.smarty.net/docs/en/api.config.load.tpl
26
-     *
27
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
28
-     * @param  string                                                 $config_file filename
29
-     * @param  mixed                                                  $sections    array of section names, single
30
-     *                                                                             section or null
31
-     *
32
-     * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
33
-     * @throws \SmartyException
34
-     */
35
-    public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
36
-    {
37
-        $this->_loadConfigFile($data, $config_file, $sections, null);
38
-        return $data;
39
-    }
21
+	/**
22
+	 * load a config file, optionally load just selected sections
23
+	 *
24
+	 * @api  Smarty::configLoad()
25
+	 * @link http://www.smarty.net/docs/en/api.config.load.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
28
+	 * @param  string                                                 $config_file filename
29
+	 * @param  mixed                                                  $sections    array of section names, single
30
+	 *                                                                             section or null
31
+	 *
32
+	 * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
33
+	 * @throws \SmartyException
34
+	 */
35
+	public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
36
+	{
37
+		$this->_loadConfigFile($data, $config_file, $sections, null);
38
+		return $data;
39
+	}
40 40
 
41
-    /**
42
-     * load a config file, optionally load just selected sections
43
-     *
44
-     * @api  Smarty::configLoad()
45
-     * @link http://www.smarty.net/docs/en/api.config.load.tpl
46
-     *
47
-     * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
48
-     * @param  string                                                 $config_file filename
49
-     * @param  mixed                                                  $sections    array of section names, single
50
-     *                                                                             section or null
51
-     * @param int                                                     $scope       scope into which config variables
52
-     *                                                                             shall be loaded
53
-     *
54
-     * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
55
-     * @throws \SmartyException
56
-     */
57
-    public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
58
-    {
59
-        /* @var \Smarty $smarty */
60
-        $smarty = isset($data->smarty) ? $data->smarty : $data;
61
-        /* @var \Smarty_Internal_Template $confObj */
62
-        $confObj = new Smarty_Internal_Template($config_file, $smarty, $data);
63
-        $confObj->caching = Smarty::CACHING_OFF;
64
-        $confObj->source = Smarty_Template_Config::load($confObj);
65
-        $confObj->source->config_sections = $sections;
66
-        $confObj->source->scope = $scope;
67
-        $confObj->compiled = Smarty_Template_Compiled::load($confObj);
68
-        $confObj->compiled->render($confObj);
69
-        if ($data->_objType == 2) {
70
-            $data->compiled->file_dependency[ $confObj->source->uid ] =
71
-                array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
72
-        }
73
-    }
41
+	/**
42
+	 * load a config file, optionally load just selected sections
43
+	 *
44
+	 * @api  Smarty::configLoad()
45
+	 * @link http://www.smarty.net/docs/en/api.config.load.tpl
46
+	 *
47
+	 * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
48
+	 * @param  string                                                 $config_file filename
49
+	 * @param  mixed                                                  $sections    array of section names, single
50
+	 *                                                                             section or null
51
+	 * @param int                                                     $scope       scope into which config variables
52
+	 *                                                                             shall be loaded
53
+	 *
54
+	 * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
55
+	 * @throws \SmartyException
56
+	 */
57
+	public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
58
+	{
59
+		/* @var \Smarty $smarty */
60
+		$smarty = isset($data->smarty) ? $data->smarty : $data;
61
+		/* @var \Smarty_Internal_Template $confObj */
62
+		$confObj = new Smarty_Internal_Template($config_file, $smarty, $data);
63
+		$confObj->caching = Smarty::CACHING_OFF;
64
+		$confObj->source = Smarty_Template_Config::load($confObj);
65
+		$confObj->source->config_sections = $sections;
66
+		$confObj->source->scope = $scope;
67
+		$confObj->compiled = Smarty_Template_Compiled::load($confObj);
68
+		$confObj->compiled->render($confObj);
69
+		if ($data->_objType == 2) {
70
+			$data->compiled->file_dependency[ $confObj->source->uid ] =
71
+				array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
72
+		}
73
+	}
74 74
 
75
-    /**
76
-     * load config variables into template object
77
-     *
78
-     * @param \Smarty_Internal_Template $tpl
79
-     * @param  array                    $new_config_vars
80
-     *
81
-     */
82
-    public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
83
-    {
84
-        $this->_assignConfigVars($tpl->parent->config_vars, $tpl, $new_config_vars);
85
-        $tagScope = $tpl->source->scope;
86
-        if ($tagScope >= 0) {
87
-            if ($tagScope == Smarty::SCOPE_LOCAL) {
88
-                $this->_updateVarStack($tpl, $new_config_vars);
89
-                $tagScope = 0;
90
-                if (!$tpl->scope) {
91
-                    return;
92
-                }
93
-            }
94
-            if ($tpl->parent->_objType == 2 && ($tagScope || $tpl->parent->scope)) {
95
-                $mergedScope = $tagScope | $tpl->scope;
96
-                if ($mergedScope) {
97
-                    // update scopes
98
-                    foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
99
-                        $this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
100
-                        if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
101
-                            $this->_updateVarStack($tpl, $new_config_vars);
102
-                        }
103
-                    }
104
-                }
105
-            }
106
-        }
107
-    }
75
+	/**
76
+	 * load config variables into template object
77
+	 *
78
+	 * @param \Smarty_Internal_Template $tpl
79
+	 * @param  array                    $new_config_vars
80
+	 *
81
+	 */
82
+	public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
83
+	{
84
+		$this->_assignConfigVars($tpl->parent->config_vars, $tpl, $new_config_vars);
85
+		$tagScope = $tpl->source->scope;
86
+		if ($tagScope >= 0) {
87
+			if ($tagScope == Smarty::SCOPE_LOCAL) {
88
+				$this->_updateVarStack($tpl, $new_config_vars);
89
+				$tagScope = 0;
90
+				if (!$tpl->scope) {
91
+					return;
92
+				}
93
+			}
94
+			if ($tpl->parent->_objType == 2 && ($tagScope || $tpl->parent->scope)) {
95
+				$mergedScope = $tagScope | $tpl->scope;
96
+				if ($mergedScope) {
97
+					// update scopes
98
+					foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
99
+						$this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
100
+						if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
101
+							$this->_updateVarStack($tpl, $new_config_vars);
102
+						}
103
+					}
104
+				}
105
+			}
106
+		}
107
+	}
108 108
 
109
-    /**
110
-     * Assign all config variables in given scope
111
-     *
112
-     * @param array    $config_vars config variables in scope
113
-     * @param \Smarty_Internal_Template $tpl
114
-     * @param  array                    $new_config_vars loaded config variables
115
-     */
116
-    public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
117
-    {
118
-        // copy global config vars
119
-        foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
120
-            if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
121
-                $config_vars[ $variable ] = $value;
122
-            } else {
123
-                $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
124
-            }
125
-        }
126
-        // scan sections
127
-        $sections = $tpl->source->config_sections;
128
-        if (!empty($sections)) {
129
-            foreach ((array) $sections as $tpl_section) {
130
-                if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
131
-                    foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
132
-                        if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
133
-                            $config_vars[ $variable ] = $value;
134
-                        } else {
135
-                            $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
136
-                        }
137
-                    }
138
-                }
139
-            }
140
-        }
141
-    }
109
+	/**
110
+	 * Assign all config variables in given scope
111
+	 *
112
+	 * @param array    $config_vars config variables in scope
113
+	 * @param \Smarty_Internal_Template $tpl
114
+	 * @param  array                    $new_config_vars loaded config variables
115
+	 */
116
+	public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
117
+	{
118
+		// copy global config vars
119
+		foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
120
+			if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
121
+				$config_vars[ $variable ] = $value;
122
+			} else {
123
+				$config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
124
+			}
125
+		}
126
+		// scan sections
127
+		$sections = $tpl->source->config_sections;
128
+		if (!empty($sections)) {
129
+			foreach ((array) $sections as $tpl_section) {
130
+				if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
131
+					foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
132
+						if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
133
+							$config_vars[ $variable ] = $value;
134
+						} else {
135
+							$config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
136
+						}
137
+					}
138
+				}
139
+			}
140
+		}
141
+	}
142 142
 
143
-    /**
144
-     * Update config variables in template local variable stack
145
-     *
146
-     * @param \Smarty_Internal_Template $tpl
147
-     * @param array                     $config_vars
148
-     */
149
-    public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
150
-    {
151
-        $i = 0;
152
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
153
-            $this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
154
-            $i ++;
155
-        }
156
-    }
143
+	/**
144
+	 * Update config variables in template local variable stack
145
+	 *
146
+	 * @param \Smarty_Internal_Template $tpl
147
+	 * @param array                     $config_vars
148
+	 */
149
+	public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
150
+	{
151
+		$i = 0;
152
+		while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
153
+			$this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
154
+			$i ++;
155
+		}
156
+	}
157 157
 
158
-    /**
159
-     * gets  a config variable value
160
-     *
161
-     * @param \Smarty_Internal_Template $tpl     template object
162
-     * @param string                    $varName the name of the config variable
163
-     * @param bool                      $errorEnable
164
-     *
165
-     * @return mixed  the value of the config variable
166
-     */
167
-    public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
168
-    {
169
-        $_ptr = $tpl;
170
-        while ($_ptr !== null) {
171
-            if (isset($_ptr->config_vars[ $varName ])) {
172
-                // found it, return it
173
-                return $_ptr->config_vars[ $varName ];
174
-            }
175
-            // not found, try at parent
176
-            $_ptr = $_ptr->parent;
177
-        }
178
-        if ($tpl->smarty->error_unassigned && $errorEnable) {
179
-            // force a notice
180
-            $x = $$varName;
181
-        }
182
-        return null;
183
-    }
158
+	/**
159
+	 * gets  a config variable value
160
+	 *
161
+	 * @param \Smarty_Internal_Template $tpl     template object
162
+	 * @param string                    $varName the name of the config variable
163
+	 * @param bool                      $errorEnable
164
+	 *
165
+	 * @return mixed  the value of the config variable
166
+	 */
167
+	public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
168
+	{
169
+		$_ptr = $tpl;
170
+		while ($_ptr !== null) {
171
+			if (isset($_ptr->config_vars[ $varName ])) {
172
+				// found it, return it
173
+				return $_ptr->config_vars[ $varName ];
174
+			}
175
+			// not found, try at parent
176
+			$_ptr = $_ptr->parent;
177
+		}
178
+		if ($tpl->smarty->error_unassigned && $errorEnable) {
179
+			// force a notice
180
+			$x = $$varName;
181
+		}
182
+		return null;
183
+	}
184 184
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $confObj->compiled = Smarty_Template_Compiled::load($confObj);
68 68
         $confObj->compiled->render($confObj);
69 69
         if ($data->_objType == 2) {
70
-            $data->compiled->file_dependency[ $confObj->source->uid ] =
70
+            $data->compiled->file_dependency[$confObj->source->uid] =
71 71
                 array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
72 72
         }
73 73
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                     // update scopes
98 98
                     foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
99 99
                         $this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
100
-                        if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
100
+                        if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache['varStack'])) {
101 101
                             $this->_updateVarStack($tpl, $new_config_vars);
102 102
                         }
103 103
                     }
@@ -116,23 +116,23 @@  discard block
 block discarded – undo
116 116
     public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
117 117
     {
118 118
         // copy global config vars
119
-        foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
120
-            if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
121
-                $config_vars[ $variable ] = $value;
119
+        foreach ($new_config_vars['vars'] as $variable => $value) {
120
+            if ($tpl->smarty->config_overwrite || !isset($config_vars[$variable])) {
121
+                $config_vars[$variable] = $value;
122 122
             } else {
123
-                $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
123
+                $config_vars[$variable] = array_merge((array) $config_vars[$variable], (array) $value);
124 124
             }
125 125
         }
126 126
         // scan sections
127 127
         $sections = $tpl->source->config_sections;
128 128
         if (!empty($sections)) {
129 129
             foreach ((array) $sections as $tpl_section) {
130
-                if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
131
-                    foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
132
-                        if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
133
-                            $config_vars[ $variable ] = $value;
130
+                if (isset($new_config_vars['sections'][$tpl_section])) {
131
+                    foreach ($new_config_vars['sections'][$tpl_section]['vars'] as $variable => $value) {
132
+                        if ($tpl->smarty->config_overwrite || !isset($config_vars[$variable])) {
133
+                            $config_vars[$variable] = $value;
134 134
                         } else {
135
-                            $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value);
135
+                            $config_vars[$variable] = array_merge((array) $config_vars[$variable], (array) $value);
136 136
                         }
137 137
                     }
138 138
                 }
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
     public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
150 150
     {
151 151
         $i = 0;
152
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
153
-            $this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
154
-            $i ++;
152
+        while (isset($tpl->_cache['varStack'][$i])) {
153
+            $this->_assignConfigVars($tpl->_cache['varStack'][$i]['config'], $tpl, $config_vars);
154
+            $i++;
155 155
         }
156 156
     }
157 157
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $_ptr = $tpl;
170 170
         while ($_ptr !== null) {
171
-            if (isset($_ptr->config_vars[ $varName ])) {
171
+            if (isset($_ptr->config_vars[$varName])) {
172 172
                 // found it, return it
173
-                return $_ptr->config_vars[ $varName ];
173
+                return $_ptr->config_vars[$varName];
174 174
             }
175 175
             // not found, try at parent
176 176
             $_ptr = $_ptr->parent;
Please login to merge, or discard this patch.