Completed
Push — developer ( 7db3ed...77625b )
by Błażej
272:57 queued 225:17
created
libraries/SabreDAV/DAVACL/Xml/Property/Principal.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
      * the next element.
173 173
      *
174 174
      * @param Reader $reader
175
-     * @return mixed
175
+     * @return Principal
176 176
      */
177 177
     static function xmlDeserialize(Reader $reader) {
178 178
 
Please login to merge, or discard this patch.
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -20,177 +20,177 @@
 block discarded – undo
20 20
  */
21 21
 class Principal extends DAV\Xml\Property\Href {
22 22
 
23
-    /**
24
-     * To specify a not-logged-in user, use the UNAUTHENTICATED principal
25
-     */
26
-    const UNAUTHENTICATED = 1;
27
-
28
-    /**
29
-     * To specify any principal that is logged in, use AUTHENTICATED
30
-     */
31
-    const AUTHENTICATED = 2;
32
-
33
-    /**
34
-     * Specific principals can be specified with the HREF
35
-     */
36
-    const HREF = 3;
37
-
38
-    /**
39
-     * Everybody, basically
40
-     */
41
-    const ALL = 4;
42
-
43
-    /**
44
-     * Principal-type
45
-     *
46
-     * Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
47
-     *
48
-     * @var int
49
-     */
50
-    protected $type;
51
-
52
-    /**
53
-     * Creates the property.
54
-     *
55
-     * The 'type' argument must be one of the type constants defined in this class.
56
-     *
57
-     * 'href' is only required for the HREF type.
58
-     *
59
-     * @param int $type
60
-     * @param string|null $href
61
-     */
62
-    public function __construct($type, $href = null) {
63
-
64
-        $this->type = $type;
65
-        if ($type === self::HREF && is_null($href)) {
66
-            throw new DAV\Exception('The href argument must be specified for the HREF principal type.');
67
-        }
68
-        if ($href) {
69
-            $href = rtrim($href, '/') . '/';
70
-            parent::__construct($href);
71
-        }
72
-
73
-    }
74
-
75
-    /**
76
-     * Returns the principal type
77
-     *
78
-     * @return int
79
-     */
80
-    public function getType() {
81
-
82
-        return $this->type;
83
-
84
-    }
85
-
86
-
87
-    /**
88
-     * The xmlSerialize metod is called during xml writing.
89
-     *
90
-     * Use the $writer argument to write its own xml serialization.
91
-     *
92
-     * An important note: do _not_ create a parent element. Any element
93
-     * implementing XmlSerializble should only ever write what's considered
94
-     * its 'inner xml'.
95
-     *
96
-     * The parent of the current element is responsible for writing a
97
-     * containing element.
98
-     *
99
-     * This allows serializers to be re-used for different element names.
100
-     *
101
-     * If you are opening new elements, you must also close them again.
102
-     *
103
-     * @param Writer $writer
104
-     * @return void
105
-     */
106
-    public function xmlSerialize(Writer $writer) {
107
-
108
-        switch ($this->type) {
109
-
110
-            case self::UNAUTHENTICATED :
111
-                $writer->writeElement('{DAV:}unauthenticated');
112
-                break;
113
-            case self::AUTHENTICATED :
114
-                $writer->writeElement('{DAV:}authenticated');
115
-                break;
116
-            case self::HREF :
117
-                parent::xmlSerialize($writer);
118
-                break;
119
-            case self::ALL :
120
-                $writer->writeElement('{DAV:}all');
121
-                break;
122
-        }
123
-
124
-    }
125
-
126
-    /**
127
-     * Generate html representation for this value.
128
-     *
129
-     * The html output is 100% trusted, and no effort is being made to sanitize
130
-     * it. It's up to the implementor to sanitize user provided values.
131
-     *
132
-     * The output must be in UTF-8.
133
-     *
134
-     * The baseUri parameter is a url to the root of the application, and can
135
-     * be used to construct local links.
136
-     *
137
-     * @param HtmlOutputHelper $html
138
-     * @return string
139
-     */
140
-    public function toHtml(HtmlOutputHelper $html) {
141
-
142
-        switch ($this->type) {
143
-
144
-            case self::UNAUTHENTICATED :
145
-                return '<em>unauthenticated</em>';
146
-            case self::AUTHENTICATED :
147
-                return '<em>authenticated</em>';
148
-            case self::HREF :
149
-                return parent::toHtml($html);
150
-            case self::ALL :
151
-                return '<em>all</em>';
152
-        }
153
-
154
-    }
155
-
156
-    /**
157
-     * The deserialize method is called during xml parsing.
158
-     *
159
-     * This method is called staticly, this is because in theory this method
160
-     * may be used as a type of constructor, or factory method.
161
-     *
162
-     * Often you want to return an instance of the current class, but you are
163
-     * free to return other data as well.
164
-     *
165
-     * Important note 2: You are responsible for advancing the reader to the
166
-     * next element. Not doing anything will result in a never-ending loop.
167
-     *
168
-     * If you just want to skip parsing for this element altogether, you can
169
-     * just call $reader->next();
170
-     *
171
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
172
-     * the next element.
173
-     *
174
-     * @param Reader $reader
175
-     * @return mixed
176
-     */
177
-    static function xmlDeserialize(Reader $reader) {
178
-
179
-        $tree = $reader->parseInnerTree()[0];
180
-
181
-        switch ($tree['name']) {
182
-            case '{DAV:}unauthenticated' :
183
-                return new self(self::UNAUTHENTICATED);
184
-            case '{DAV:}authenticated' :
185
-                return new self(self::AUTHENTICATED);
186
-            case '{DAV:}href':
187
-                return new self(self::HREF, $tree['value']);
188
-            case '{DAV:}all':
189
-                return new self(self::ALL);
190
-            default :
191
-                throw new BadRequest('Unknown or unsupported principal type: ' . $tree['name']);
192
-        }
193
-
194
-    }
23
+	/**
24
+	 * To specify a not-logged-in user, use the UNAUTHENTICATED principal
25
+	 */
26
+	const UNAUTHENTICATED = 1;
27
+
28
+	/**
29
+	 * To specify any principal that is logged in, use AUTHENTICATED
30
+	 */
31
+	const AUTHENTICATED = 2;
32
+
33
+	/**
34
+	 * Specific principals can be specified with the HREF
35
+	 */
36
+	const HREF = 3;
37
+
38
+	/**
39
+	 * Everybody, basically
40
+	 */
41
+	const ALL = 4;
42
+
43
+	/**
44
+	 * Principal-type
45
+	 *
46
+	 * Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
47
+	 *
48
+	 * @var int
49
+	 */
50
+	protected $type;
51
+
52
+	/**
53
+	 * Creates the property.
54
+	 *
55
+	 * The 'type' argument must be one of the type constants defined in this class.
56
+	 *
57
+	 * 'href' is only required for the HREF type.
58
+	 *
59
+	 * @param int $type
60
+	 * @param string|null $href
61
+	 */
62
+	public function __construct($type, $href = null) {
63
+
64
+		$this->type = $type;
65
+		if ($type === self::HREF && is_null($href)) {
66
+			throw new DAV\Exception('The href argument must be specified for the HREF principal type.');
67
+		}
68
+		if ($href) {
69
+			$href = rtrim($href, '/') . '/';
70
+			parent::__construct($href);
71
+		}
72
+
73
+	}
74
+
75
+	/**
76
+	 * Returns the principal type
77
+	 *
78
+	 * @return int
79
+	 */
80
+	public function getType() {
81
+
82
+		return $this->type;
83
+
84
+	}
85
+
86
+
87
+	/**
88
+	 * The xmlSerialize metod is called during xml writing.
89
+	 *
90
+	 * Use the $writer argument to write its own xml serialization.
91
+	 *
92
+	 * An important note: do _not_ create a parent element. Any element
93
+	 * implementing XmlSerializble should only ever write what's considered
94
+	 * its 'inner xml'.
95
+	 *
96
+	 * The parent of the current element is responsible for writing a
97
+	 * containing element.
98
+	 *
99
+	 * This allows serializers to be re-used for different element names.
100
+	 *
101
+	 * If you are opening new elements, you must also close them again.
102
+	 *
103
+	 * @param Writer $writer
104
+	 * @return void
105
+	 */
106
+	public function xmlSerialize(Writer $writer) {
107
+
108
+		switch ($this->type) {
109
+
110
+			case self::UNAUTHENTICATED :
111
+				$writer->writeElement('{DAV:}unauthenticated');
112
+				break;
113
+			case self::AUTHENTICATED :
114
+				$writer->writeElement('{DAV:}authenticated');
115
+				break;
116
+			case self::HREF :
117
+				parent::xmlSerialize($writer);
118
+				break;
119
+			case self::ALL :
120
+				$writer->writeElement('{DAV:}all');
121
+				break;
122
+		}
123
+
124
+	}
125
+
126
+	/**
127
+	 * Generate html representation for this value.
128
+	 *
129
+	 * The html output is 100% trusted, and no effort is being made to sanitize
130
+	 * it. It's up to the implementor to sanitize user provided values.
131
+	 *
132
+	 * The output must be in UTF-8.
133
+	 *
134
+	 * The baseUri parameter is a url to the root of the application, and can
135
+	 * be used to construct local links.
136
+	 *
137
+	 * @param HtmlOutputHelper $html
138
+	 * @return string
139
+	 */
140
+	public function toHtml(HtmlOutputHelper $html) {
141
+
142
+		switch ($this->type) {
143
+
144
+			case self::UNAUTHENTICATED :
145
+				return '<em>unauthenticated</em>';
146
+			case self::AUTHENTICATED :
147
+				return '<em>authenticated</em>';
148
+			case self::HREF :
149
+				return parent::toHtml($html);
150
+			case self::ALL :
151
+				return '<em>all</em>';
152
+		}
153
+
154
+	}
155
+
156
+	/**
157
+	 * The deserialize method is called during xml parsing.
158
+	 *
159
+	 * This method is called staticly, this is because in theory this method
160
+	 * may be used as a type of constructor, or factory method.
161
+	 *
162
+	 * Often you want to return an instance of the current class, but you are
163
+	 * free to return other data as well.
164
+	 *
165
+	 * Important note 2: You are responsible for advancing the reader to the
166
+	 * next element. Not doing anything will result in a never-ending loop.
167
+	 *
168
+	 * If you just want to skip parsing for this element altogether, you can
169
+	 * just call $reader->next();
170
+	 *
171
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
172
+	 * the next element.
173
+	 *
174
+	 * @param Reader $reader
175
+	 * @return mixed
176
+	 */
177
+	static function xmlDeserialize(Reader $reader) {
178
+
179
+		$tree = $reader->parseInnerTree()[0];
180
+
181
+		switch ($tree['name']) {
182
+			case '{DAV:}unauthenticated' :
183
+				return new self(self::UNAUTHENTICATED);
184
+			case '{DAV:}authenticated' :
185
+				return new self(self::AUTHENTICATED);
186
+			case '{DAV:}href':
187
+				return new self(self::HREF, $tree['value']);
188
+			case '{DAV:}all':
189
+				return new self(self::ALL);
190
+			default :
191
+				throw new BadRequest('Unknown or unsupported principal type: ' . $tree['name']);
192
+		}
193
+
194
+	}
195 195
 
196 196
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/DAVACL/Xml/Request/ExpandPropertyReport.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      * the next element.
52 52
      *
53 53
      * @param Reader $reader
54
-     * @return mixed
54
+     * @return ExpandPropertyReport
55 55
      */
56 56
     static function xmlDeserialize(Reader $reader) {
57 57
 
Please login to merge, or discard this patch.
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -18,86 +18,86 @@
 block discarded – undo
18 18
  */
19 19
 class ExpandPropertyReport implements XmlDeserializable {
20 20
 
21
-    /**
22
-     * An array with requested properties.
23
-     *
24
-     * The requested properties will be used as keys in this array. The value
25
-     * is normally null.
26
-     *
27
-     * If the value is an array though, it means the property must be expanded.
28
-     * Within the array, the sub-properties, which themselves may be null or
29
-     * arrays.
30
-     *
31
-     * @var array
32
-     */
33
-    public $properties;
34
-
35
-    /**
36
-     * The deserialize method is called during xml parsing.
37
-     *
38
-     * This method is called statictly, this is because in theory this method
39
-     * may be used as a type of constructor, or factory method.
40
-     *
41
-     * Often you want to return an instance of the current class, but you are
42
-     * free to return other data as well.
43
-     *
44
-     * You are responsible for advancing the reader to the next element. Not
45
-     * doing anything will result in a never-ending loop.
46
-     *
47
-     * If you just want to skip parsing for this element altogether, you can
48
-     * just call $reader->next();
49
-     *
50
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
51
-     * the next element.
52
-     *
53
-     * @param Reader $reader
54
-     * @return mixed
55
-     */
56
-    static function xmlDeserialize(Reader $reader) {
57
-
58
-        $elems = $reader->parseInnerTree();
59
-
60
-        $obj = new self();
61
-        $obj->properties = self::traverse($elems);
62
-
63
-        return $obj;
64
-
65
-    }
66
-
67
-    /**
68
-     * This method is used by deserializeXml, to recursively parse the
69
-     * {DAV:}property elements.
70
-     *
71
-     * @param array $elems
72
-     * @return void
73
-     */
74
-    private static function traverse($elems) {
75
-
76
-        $result = [];
77
-
78
-        foreach ($elems as $elem) {
79
-
80
-            if ($elem['name'] !== '{DAV:}property') {
81
-                continue;
82
-            }
83
-
84
-            $namespace = isset($elem['attributes']['namespace']) ?
85
-                $elem['attributes']['namespace'] :
86
-                'DAV:';
87
-
88
-            $propName = '{' . $namespace . '}' . $elem['attributes']['name'];
89
-
90
-            $value = null;
91
-            if (is_array($elem['value'])) {
92
-                $value = self::traverse($elem['value']);
93
-            }
94
-
95
-            $result[$propName] = $value;
96
-
97
-        }
98
-
99
-        return $result;
100
-
101
-    }
21
+	/**
22
+	 * An array with requested properties.
23
+	 *
24
+	 * The requested properties will be used as keys in this array. The value
25
+	 * is normally null.
26
+	 *
27
+	 * If the value is an array though, it means the property must be expanded.
28
+	 * Within the array, the sub-properties, which themselves may be null or
29
+	 * arrays.
30
+	 *
31
+	 * @var array
32
+	 */
33
+	public $properties;
34
+
35
+	/**
36
+	 * The deserialize method is called during xml parsing.
37
+	 *
38
+	 * This method is called statictly, this is because in theory this method
39
+	 * may be used as a type of constructor, or factory method.
40
+	 *
41
+	 * Often you want to return an instance of the current class, but you are
42
+	 * free to return other data as well.
43
+	 *
44
+	 * You are responsible for advancing the reader to the next element. Not
45
+	 * doing anything will result in a never-ending loop.
46
+	 *
47
+	 * If you just want to skip parsing for this element altogether, you can
48
+	 * just call $reader->next();
49
+	 *
50
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
51
+	 * the next element.
52
+	 *
53
+	 * @param Reader $reader
54
+	 * @return mixed
55
+	 */
56
+	static function xmlDeserialize(Reader $reader) {
57
+
58
+		$elems = $reader->parseInnerTree();
59
+
60
+		$obj = new self();
61
+		$obj->properties = self::traverse($elems);
62
+
63
+		return $obj;
64
+
65
+	}
66
+
67
+	/**
68
+	 * This method is used by deserializeXml, to recursively parse the
69
+	 * {DAV:}property elements.
70
+	 *
71
+	 * @param array $elems
72
+	 * @return void
73
+	 */
74
+	private static function traverse($elems) {
75
+
76
+		$result = [];
77
+
78
+		foreach ($elems as $elem) {
79
+
80
+			if ($elem['name'] !== '{DAV:}property') {
81
+				continue;
82
+			}
83
+
84
+			$namespace = isset($elem['attributes']['namespace']) ?
85
+				$elem['attributes']['namespace'] :
86
+				'DAV:';
87
+
88
+			$propName = '{' . $namespace . '}' . $elem['attributes']['name'];
89
+
90
+			$value = null;
91
+			if (is_array($elem['value'])) {
92
+				$value = self::traverse($elem['value']);
93
+			}
94
+
95
+			$result[$propName] = $value;
96
+
97
+		}
98
+
99
+		return $result;
100
+
101
+	}
102 102
 
103 103
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@
 block discarded – undo
82 82
             }
83 83
 
84 84
             $namespace = isset($elem['attributes']['namespace']) ?
85
-                $elem['attributes']['namespace'] :
86
-                'DAV:';
85
+                $elem['attributes']['namespace'] : 'DAV:';
87 86
 
88 87
             $propName = '{' . $namespace . '}' . $elem['attributes']['name'];
89 88
 
Please login to merge, or discard this patch.
libraries/SabreDAV/DAVACL/Xml/Request/PrincipalPropertySearchReport.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
      * the next element.
73 73
      *
74 74
      * @param Reader $reader
75
-     * @return mixed
75
+     * @return PrincipalPropertySearchReport
76 76
      */
77 77
     static function xmlDeserialize(Reader $reader) {
78 78
 
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -20,108 +20,108 @@
 block discarded – undo
20 20
  */
21 21
 class PrincipalPropertySearchReport implements XmlDeserializable {
22 22
 
23
-    /**
24
-     * The requested properties.
25
-     *
26
-     * @var array|null
27
-     */
28
-    public $properties;
29
-
30
-    /**
31
-     * searchProperties
32
-     *
33
-     * @var array
34
-     */
35
-    public $searchProperties = [];
36
-
37
-    /**
38
-     * By default the property search will be conducted on the url of the http
39
-     * request. If this is set to true, it will be applied to the principal
40
-     * collection set instead.
41
-     *
42
-     * @var bool
43
-     */
44
-    public $applyToPrincipalCollectionSet = false;
45
-
46
-    /**
47
-     * Search for principals matching ANY of the properties (OR) or a ALL of
48
-     * the properties (AND).
49
-     *
50
-     * This property is either "anyof" or "allof".
51
-     *
52
-     * @var string
53
-     */
54
-    public $test;
55
-
56
-    /**
57
-     * The deserialize method is called during xml parsing.
58
-     *
59
-     * This method is called statictly, this is because in theory this method
60
-     * may be used as a type of constructor, or factory method.
61
-     *
62
-     * Often you want to return an instance of the current class, but you are
63
-     * free to return other data as well.
64
-     *
65
-     * You are responsible for advancing the reader to the next element. Not
66
-     * doing anything will result in a never-ending loop.
67
-     *
68
-     * If you just want to skip parsing for this element altogether, you can
69
-     * just call $reader->next();
70
-     *
71
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
72
-     * the next element.
73
-     *
74
-     * @param Reader $reader
75
-     * @return mixed
76
-     */
77
-    static function xmlDeserialize(Reader $reader) {
78
-
79
-        $self = new self();
80
-
81
-        $foundSearchProp = false;
82
-        $self->test = 'allof';
83
-        if ($reader->getAttribute('test') === 'anyof') {
84
-            $self->test = 'anyof';
85
-        }
86
-
87
-        $elemMap = [
88
-            '{DAV:}property-search' => 'Sabre\\Xml\\Element\\KeyValue',
89
-            '{DAV:}prop'            => 'Sabre\\Xml\\Element\\KeyValue',
90
-        ];
23
+	/**
24
+	 * The requested properties.
25
+	 *
26
+	 * @var array|null
27
+	 */
28
+	public $properties;
29
+
30
+	/**
31
+	 * searchProperties
32
+	 *
33
+	 * @var array
34
+	 */
35
+	public $searchProperties = [];
36
+
37
+	/**
38
+	 * By default the property search will be conducted on the url of the http
39
+	 * request. If this is set to true, it will be applied to the principal
40
+	 * collection set instead.
41
+	 *
42
+	 * @var bool
43
+	 */
44
+	public $applyToPrincipalCollectionSet = false;
45
+
46
+	/**
47
+	 * Search for principals matching ANY of the properties (OR) or a ALL of
48
+	 * the properties (AND).
49
+	 *
50
+	 * This property is either "anyof" or "allof".
51
+	 *
52
+	 * @var string
53
+	 */
54
+	public $test;
55
+
56
+	/**
57
+	 * The deserialize method is called during xml parsing.
58
+	 *
59
+	 * This method is called statictly, this is because in theory this method
60
+	 * may be used as a type of constructor, or factory method.
61
+	 *
62
+	 * Often you want to return an instance of the current class, but you are
63
+	 * free to return other data as well.
64
+	 *
65
+	 * You are responsible for advancing the reader to the next element. Not
66
+	 * doing anything will result in a never-ending loop.
67
+	 *
68
+	 * If you just want to skip parsing for this element altogether, you can
69
+	 * just call $reader->next();
70
+	 *
71
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
72
+	 * the next element.
73
+	 *
74
+	 * @param Reader $reader
75
+	 * @return mixed
76
+	 */
77
+	static function xmlDeserialize(Reader $reader) {
78
+
79
+		$self = new self();
80
+
81
+		$foundSearchProp = false;
82
+		$self->test = 'allof';
83
+		if ($reader->getAttribute('test') === 'anyof') {
84
+			$self->test = 'anyof';
85
+		}
86
+
87
+		$elemMap = [
88
+			'{DAV:}property-search' => 'Sabre\\Xml\\Element\\KeyValue',
89
+			'{DAV:}prop'            => 'Sabre\\Xml\\Element\\KeyValue',
90
+		];
91 91
         
92
-        foreach ($reader->parseInnerTree($elemMap) as $elem) {
93
-
94
-            switch ($elem['name']) {
95
-
96
-                case '{DAV:}prop' :
97
-                    $self->properties = array_keys($elem['value']);
98
-                    break;
99
-                case '{DAV:}property-search' :
100
-                    $foundSearchProp = true;
101
-                    // This property has two sub-elements:
102
-                    //   {DAV:}prop - The property to be searched on. This may
103
-                    //                also be more than one
104
-                    //   {DAV:}match - The value to match with
105
-                    if (!isset($elem['value']['{DAV:}prop']) || !isset($elem['value']['{DAV:}match'])) {
106
-                        throw new BadRequest('The {DAV:}property-search element must contain one {DAV:}match and one {DAV:}prop element');
107
-                    }
108
-                    foreach ($elem['value']['{DAV:}prop'] as $propName => $discard) {
109
-                        $self->searchProperties[$propName] = $elem['value']['{DAV:}match'];
110
-                    }
111
-                    break;
112
-                case '{DAV:}apply-to-principal-collection-set' :
113
-                    $self->applyToPrincipalCollectionSet = true;
114
-                    break;
115
-
116
-            }
117
-
118
-        }
119
-        if (!$foundSearchProp) {
120
-            throw new BadRequest('The {DAV:}principal-property-search report must contain at least 1 {DAV:}property-search element');
121
-        }
122
-
123
-        return $self;
124
-
125
-    }
92
+		foreach ($reader->parseInnerTree($elemMap) as $elem) {
93
+
94
+			switch ($elem['name']) {
95
+
96
+				case '{DAV:}prop' :
97
+					$self->properties = array_keys($elem['value']);
98
+					break;
99
+				case '{DAV:}property-search' :
100
+					$foundSearchProp = true;
101
+					// This property has two sub-elements:
102
+					//   {DAV:}prop - The property to be searched on. This may
103
+					//                also be more than one
104
+					//   {DAV:}match - The value to match with
105
+					if (!isset($elem['value']['{DAV:}prop']) || !isset($elem['value']['{DAV:}match'])) {
106
+						throw new BadRequest('The {DAV:}property-search element must contain one {DAV:}match and one {DAV:}prop element');
107
+					}
108
+					foreach ($elem['value']['{DAV:}prop'] as $propName => $discard) {
109
+						$self->searchProperties[$propName] = $elem['value']['{DAV:}match'];
110
+					}
111
+					break;
112
+				case '{DAV:}apply-to-principal-collection-set' :
113
+					$self->applyToPrincipalCollectionSet = true;
114
+					break;
115
+
116
+			}
117
+
118
+		}
119
+		if (!$foundSearchProp) {
120
+			throw new BadRequest('The {DAV:}principal-property-search report must contain at least 1 {DAV:}property-search element');
121
+		}
122
+
123
+		return $self;
124
+
125
+	}
126 126
 
127 127
 }
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\DAVACL\Xml\Request;
4 4
 
5
+use Sabre\DAV\Exception\BadRequest;
5 6
 use Sabre\Xml\Reader;
6 7
 use Sabre\Xml\XmlDeserializable;
7
-use Sabre\DAV\Exception\BadRequest;
8 8
 
9 9
 /**
10 10
  * PrincipalSearchPropertySetReport request parser.
Please login to merge, or discard this patch.
libraries/SabreDAV/DAVACL/Xml/Request/PrincipalSearchPropertySetReport.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      * the next element.
40 40
      *
41 41
      * @param Reader $reader
42
-     * @return mixed
42
+     * @return PrincipalSearchPropertySetReport
43 43
      */
44 44
     static function xmlDeserialize(Reader $reader) {
45 45
 
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -20,39 +20,39 @@
 block discarded – undo
20 20
  */
21 21
 class PrincipalSearchPropertySetReport implements XmlDeserializable {
22 22
 
23
-    /**
24
-     * The deserialize method is called during xml parsing.
25
-     *
26
-     * This method is called statictly, this is because in theory this method
27
-     * may be used as a type of constructor, or factory method.
28
-     *
29
-     * Often you want to return an instance of the current class, but you are
30
-     * free to return other data as well.
31
-     *
32
-     * You are responsible for advancing the reader to the next element. Not
33
-     * doing anything will result in a never-ending loop.
34
-     *
35
-     * If you just want to skip parsing for this element altogether, you can
36
-     * just call $reader->next();
37
-     *
38
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
39
-     * the next element.
40
-     *
41
-     * @param Reader $reader
42
-     * @return mixed
43
-     */
44
-    static function xmlDeserialize(Reader $reader) {
45
-
46
-        if (!$reader->isEmptyElement) {
47
-            throw new BadRequest('The {DAV:}principal-search-property-set element must be empty');
48
-        }
49
-
50
-        // The element is actually empty, so there's not much to do.
51
-        $reader->next();
52
-
53
-        $self = new self();
54
-        return $self;
55
-
56
-    }
23
+	/**
24
+	 * The deserialize method is called during xml parsing.
25
+	 *
26
+	 * This method is called statictly, this is because in theory this method
27
+	 * may be used as a type of constructor, or factory method.
28
+	 *
29
+	 * Often you want to return an instance of the current class, but you are
30
+	 * free to return other data as well.
31
+	 *
32
+	 * You are responsible for advancing the reader to the next element. Not
33
+	 * doing anything will result in a never-ending loop.
34
+	 *
35
+	 * If you just want to skip parsing for this element altogether, you can
36
+	 * just call $reader->next();
37
+	 *
38
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
39
+	 * the next element.
40
+	 *
41
+	 * @param Reader $reader
42
+	 * @return mixed
43
+	 */
44
+	static function xmlDeserialize(Reader $reader) {
45
+
46
+		if (!$reader->isEmptyElement) {
47
+			throw new BadRequest('The {DAV:}principal-search-property-set element must be empty');
48
+		}
49
+
50
+		// The element is actually empty, so there's not much to do.
51
+		$reader->next();
52
+
53
+		$self = new self();
54
+		return $self;
55
+
56
+	}
57 57
 
58 58
 }
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\DAVACL\Xml\Request;
4 4
 
5
+use Sabre\DAV\Exception\BadRequest;
5 6
 use Sabre\Xml\Reader;
6 7
 use Sabre\Xml\XmlDeserializable;
7
-use Sabre\DAV\Exception\BadRequest;
8 8
 
9 9
 /**
10 10
  * PrincipalSearchPropertySetReport request parser.
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_checkboxes.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -177,6 +177,13 @@
 block discarded – undo
177 177
     }
178 178
 }
179 179
 
180
+/**
181
+ * @param string $name
182
+ * @param string $extra
183
+ * @param string $separator
184
+ * @param boolean $labels
185
+ * @param boolean $label_ids
186
+ */
180 187
 function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
181 188
                                                 $label_ids, $escape = true)
182 189
 {
Please login to merge, or discard this patch.
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -45,205 +45,205 @@
 block discarded – undo
45 45
  */
46 46
 function smarty_function_html_checkboxes($params, $template)
47 47
 {
48
-    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
-
50
-    $name = 'checkbox';
51
-    $values = null;
52
-    $options = null;
53
-    $selected = array();
54
-    $separator = '';
55
-    $escape = true;
56
-    $labels = true;
57
-    $label_ids = false;
58
-    $output = null;
59
-
60
-    $extra = '';
61
-
62
-    foreach ($params as $_key => $_val) {
63
-        switch ($_key) {
64
-            case 'name':
65
-            case 'separator':
66
-                $$_key = (string) $_val;
67
-                break;
68
-
69
-            case 'escape':
70
-            case 'labels':
71
-            case 'label_ids':
72
-                $$_key = (bool) $_val;
73
-                break;
74
-
75
-            case 'options':
76
-                $$_key = (array) $_val;
77
-                break;
78
-
79
-            case 'values':
80
-            case 'output':
81
-                $$_key = array_values((array) $_val);
82
-                break;
83
-
84
-            case 'checked':
85
-            case 'selected':
86
-                if (is_array($_val)) {
87
-                    $selected = array();
88
-                    foreach ($_val as $_sel) {
89
-                        if (is_object($_sel)) {
90
-                            if (method_exists($_sel, "__toString")) {
91
-                                $_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
92
-                            } else {
93
-                                trigger_error("html_checkboxes: selected attribute contains an object of class '" .
94
-                                              get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
95
-                                continue;
96
-                            }
97
-                        } else {
98
-                            $_sel = smarty_function_escape_special_chars((string) $_sel);
99
-                        }
100
-                        $selected[ $_sel ] = true;
101
-                    }
102
-                } elseif (is_object($_val)) {
103
-                    if (method_exists($_val, "__toString")) {
104
-                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());
105
-                    } else {
106
-                        trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) .
107
-                                      "' without __toString() method", E_USER_NOTICE);
108
-                    }
109
-                } else {
110
-                    $selected = smarty_function_escape_special_chars((string) $_val);
111
-                }
112
-                break;
113
-
114
-            case 'checkboxes':
115
-                trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
116
-                              E_USER_WARNING);
117
-                $options = (array) $_val;
118
-                break;
119
-
120
-            case 'assign':
121
-                break;
122
-
123
-            case 'strict':
124
-                break;
125
-
126
-            case 'disabled':
127
-            case 'readonly':
128
-                if (!empty($params[ 'strict' ])) {
129
-                    if (!is_scalar($_val)) {
130
-                        trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
131
-                                      E_USER_NOTICE);
132
-                    }
133
-
134
-                    if ($_val === true || $_val === $_key) {
135
-                        $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
136
-                    }
137
-
138
-                    break;
139
-                }
140
-            // omit break; to fall through!
141
-
142
-            default:
143
-                if (!is_array($_val)) {
144
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
145
-                } else {
146
-                    trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
147
-                }
148
-                break;
149
-        }
150
-    }
151
-
152
-    if (!isset($options) && !isset($values)) {
153
-        return '';
154
-    } /* raise error here? */
155
-
156
-    $_html_result = array();
157
-
158
-    if (isset($options)) {
159
-        foreach ($options as $_key => $_val) {
160
-            $_html_result[] =
161
-                smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
162
-                                                       $label_ids, $escape);
163
-        }
164
-    } else {
165
-        foreach ($values as $_i => $_key) {
166
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
167
-            $_html_result[] =
168
-                smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
169
-                                                       $label_ids, $escape);
170
-        }
171
-    }
172
-
173
-    if (!empty($params[ 'assign' ])) {
174
-        $template->assign($params[ 'assign' ], $_html_result);
175
-    } else {
176
-        return implode("\n", $_html_result);
177
-    }
48
+	require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
+
50
+	$name = 'checkbox';
51
+	$values = null;
52
+	$options = null;
53
+	$selected = array();
54
+	$separator = '';
55
+	$escape = true;
56
+	$labels = true;
57
+	$label_ids = false;
58
+	$output = null;
59
+
60
+	$extra = '';
61
+
62
+	foreach ($params as $_key => $_val) {
63
+		switch ($_key) {
64
+			case 'name':
65
+			case 'separator':
66
+				$$_key = (string) $_val;
67
+				break;
68
+
69
+			case 'escape':
70
+			case 'labels':
71
+			case 'label_ids':
72
+				$$_key = (bool) $_val;
73
+				break;
74
+
75
+			case 'options':
76
+				$$_key = (array) $_val;
77
+				break;
78
+
79
+			case 'values':
80
+			case 'output':
81
+				$$_key = array_values((array) $_val);
82
+				break;
83
+
84
+			case 'checked':
85
+			case 'selected':
86
+				if (is_array($_val)) {
87
+					$selected = array();
88
+					foreach ($_val as $_sel) {
89
+						if (is_object($_sel)) {
90
+							if (method_exists($_sel, "__toString")) {
91
+								$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
92
+							} else {
93
+								trigger_error("html_checkboxes: selected attribute contains an object of class '" .
94
+											  get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
95
+								continue;
96
+							}
97
+						} else {
98
+							$_sel = smarty_function_escape_special_chars((string) $_sel);
99
+						}
100
+						$selected[ $_sel ] = true;
101
+					}
102
+				} elseif (is_object($_val)) {
103
+					if (method_exists($_val, "__toString")) {
104
+						$selected = smarty_function_escape_special_chars((string) $_val->__toString());
105
+					} else {
106
+						trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) .
107
+									  "' without __toString() method", E_USER_NOTICE);
108
+					}
109
+				} else {
110
+					$selected = smarty_function_escape_special_chars((string) $_val);
111
+				}
112
+				break;
113
+
114
+			case 'checkboxes':
115
+				trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
116
+							  E_USER_WARNING);
117
+				$options = (array) $_val;
118
+				break;
119
+
120
+			case 'assign':
121
+				break;
122
+
123
+			case 'strict':
124
+				break;
125
+
126
+			case 'disabled':
127
+			case 'readonly':
128
+				if (!empty($params[ 'strict' ])) {
129
+					if (!is_scalar($_val)) {
130
+						trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
131
+									  E_USER_NOTICE);
132
+					}
133
+
134
+					if ($_val === true || $_val === $_key) {
135
+						$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
136
+					}
137
+
138
+					break;
139
+				}
140
+			// omit break; to fall through!
141
+
142
+			default:
143
+				if (!is_array($_val)) {
144
+					$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
145
+				} else {
146
+					trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
147
+				}
148
+				break;
149
+		}
150
+	}
151
+
152
+	if (!isset($options) && !isset($values)) {
153
+		return '';
154
+	} /* raise error here? */
155
+
156
+	$_html_result = array();
157
+
158
+	if (isset($options)) {
159
+		foreach ($options as $_key => $_val) {
160
+			$_html_result[] =
161
+				smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
162
+													   $label_ids, $escape);
163
+		}
164
+	} else {
165
+		foreach ($values as $_i => $_key) {
166
+			$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
167
+			$_html_result[] =
168
+				smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
169
+													   $label_ids, $escape);
170
+		}
171
+	}
172
+
173
+	if (!empty($params[ 'assign' ])) {
174
+		$template->assign($params[ 'assign' ], $_html_result);
175
+	} else {
176
+		return implode("\n", $_html_result);
177
+	}
178 178
 }
179 179
 
180 180
 function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
181
-                                                $label_ids, $escape = true)
181
+												$label_ids, $escape = true)
182 182
 {
183
-    $_output = '';
184
-
185
-    if (is_object($value)) {
186
-        if (method_exists($value, "__toString")) {
187
-            $value = (string) $value->__toString();
188
-        } else {
189
-            trigger_error("html_options: value is an object of class '" . get_class($value) .
190
-                          "' without __toString() method", E_USER_NOTICE);
191
-
192
-            return '';
193
-        }
194
-    } else {
195
-        $value = (string) $value;
196
-    }
197
-
198
-    if (is_object($output)) {
199
-        if (method_exists($output, "__toString")) {
200
-            $output = (string) $output->__toString();
201
-        } else {
202
-            trigger_error("html_options: output is an object of class '" . get_class($output) .
203
-                          "' without __toString() method", E_USER_NOTICE);
204
-
205
-            return '';
206
-        }
207
-    } else {
208
-        $output = (string) $output;
209
-    }
210
-
211
-    if ($labels) {
212
-        if ($label_ids) {
213
-            $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
214
-                                                                     $name . '_' . $value));
215
-            $_output .= '<label for="' . $_id . '">';
216
-        } else {
217
-            $_output .= '<label>';
218
-        }
219
-    }
220
-
221
-    $name = smarty_function_escape_special_chars($name);
222
-    $value = smarty_function_escape_special_chars($value);
223
-    if ($escape) {
224
-        $output = smarty_function_escape_special_chars($output);
225
-    }
226
-
227
-    $_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
228
-
229
-    if ($labels && $label_ids) {
230
-        $_output .= ' id="' . $_id . '"';
231
-    }
232
-
233
-    if (is_array($selected)) {
234
-        if (isset($selected[ $value ])) {
235
-            $_output .= ' checked="checked"';
236
-        }
237
-    } elseif ($value === $selected) {
238
-        $_output .= ' checked="checked"';
239
-    }
240
-
241
-    $_output .= $extra . ' />' . $output;
242
-    if ($labels) {
243
-        $_output .= '</label>';
244
-    }
245
-
246
-    $_output .= $separator;
247
-
248
-    return $_output;
183
+	$_output = '';
184
+
185
+	if (is_object($value)) {
186
+		if (method_exists($value, "__toString")) {
187
+			$value = (string) $value->__toString();
188
+		} else {
189
+			trigger_error("html_options: value is an object of class '" . get_class($value) .
190
+						  "' without __toString() method", E_USER_NOTICE);
191
+
192
+			return '';
193
+		}
194
+	} else {
195
+		$value = (string) $value;
196
+	}
197
+
198
+	if (is_object($output)) {
199
+		if (method_exists($output, "__toString")) {
200
+			$output = (string) $output->__toString();
201
+		} else {
202
+			trigger_error("html_options: output is an object of class '" . get_class($output) .
203
+						  "' without __toString() method", E_USER_NOTICE);
204
+
205
+			return '';
206
+		}
207
+	} else {
208
+		$output = (string) $output;
209
+	}
210
+
211
+	if ($labels) {
212
+		if ($label_ids) {
213
+			$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
214
+																	 $name . '_' . $value));
215
+			$_output .= '<label for="' . $_id . '">';
216
+		} else {
217
+			$_output .= '<label>';
218
+		}
219
+	}
220
+
221
+	$name = smarty_function_escape_special_chars($name);
222
+	$value = smarty_function_escape_special_chars($value);
223
+	if ($escape) {
224
+		$output = smarty_function_escape_special_chars($output);
225
+	}
226
+
227
+	$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
228
+
229
+	if ($labels && $label_ids) {
230
+		$_output .= ' id="' . $_id . '"';
231
+	}
232
+
233
+	if (is_array($selected)) {
234
+		if (isset($selected[ $value ])) {
235
+			$_output .= ' checked="checked"';
236
+		}
237
+	} elseif ($value === $selected) {
238
+		$_output .= ' checked="checked"';
239
+	}
240
+
241
+	$_output .= $extra . ' />' . $output;
242
+	if ($labels) {
243
+		$_output .= '</label>';
244
+	}
245
+
246
+	$_output .= $separator;
247
+
248
+	return $_output;
249 249
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                         } else {
98 98
                             $_sel = smarty_function_escape_special_chars((string) $_sel);
99 99
                         }
100
-                        $selected[ $_sel ] = true;
100
+                        $selected[$_sel] = true;
101 101
                     }
102 102
                 } elseif (is_object($_val)) {
103 103
                     if (method_exists($_val, "__toString")) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
             case 'disabled':
127 127
             case 'readonly':
128
-                if (!empty($params[ 'strict' ])) {
128
+                if (!empty($params['strict'])) {
129 129
                     if (!is_scalar($_val)) {
130 130
                         trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
131 131
                                       E_USER_NOTICE);
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
         }
164 164
     } else {
165 165
         foreach ($values as $_i => $_key) {
166
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
166
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
167 167
             $_html_result[] =
168 168
                 smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
169 169
                                                        $label_ids, $escape);
170 170
         }
171 171
     }
172 172
 
173
-    if (!empty($params[ 'assign' ])) {
174
-        $template->assign($params[ 'assign' ], $_html_result);
173
+    if (!empty($params['assign'])) {
174
+        $template->assign($params['assign'], $_html_result);
175 175
     } else {
176 176
         return implode("\n", $_html_result);
177 177
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     }
232 232
 
233 233
     if (is_array($selected)) {
234
-        if (isset($selected[ $value ])) {
234
+        if (isset($selected[$value])) {
235 235
             $_output .= ' checked="checked"';
236 236
         }
237 237
     } elseif ($value === $selected) {
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_options.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -192,6 +192,10 @@
 block discarded – undo
192 192
     return $_html_result;
193 193
 }
194 194
 
195
+/**
196
+ * @param string|null $id
197
+ * @param integer $idx
198
+ */
195 199
 function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
196 200
 {
197 201
     $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -35,170 +35,170 @@
 block discarded – undo
35 35
  */
36 36
 function smarty_function_html_options($params)
37 37
 {
38
-    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
39
-
40
-    $name = null;
41
-    $values = null;
42
-    $options = null;
43
-    $selected = null;
44
-    $output = null;
45
-    $id = null;
46
-    $class = null;
47
-
48
-    $extra = '';
49
-
50
-    foreach ($params as $_key => $_val) {
51
-        switch ($_key) {
52
-            case 'name':
53
-            case 'class':
54
-            case 'id':
55
-                $$_key = (string) $_val;
56
-                break;
57
-
58
-            case 'options':
59
-                $options = (array) $_val;
60
-                break;
61
-
62
-            case 'values':
63
-            case 'output':
64
-                $$_key = array_values((array) $_val);
65
-                break;
66
-
67
-            case 'selected':
68
-                if (is_array($_val)) {
69
-                    $selected = array();
70
-                    foreach ($_val as $_sel) {
71
-                        if (is_object($_sel)) {
72
-                            if (method_exists($_sel, "__toString")) {
73
-                                $_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
74
-                            } else {
75
-                                trigger_error("html_options: selected attribute contains an object of class '" .
76
-                                              get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
77
-                                continue;
78
-                            }
79
-                        } else {
80
-                            $_sel = smarty_function_escape_special_chars((string) $_sel);
81
-                        }
82
-                        $selected[ $_sel ] = true;
83
-                    }
84
-                } elseif (is_object($_val)) {
85
-                    if (method_exists($_val, "__toString")) {
86
-                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());
87
-                    } else {
88
-                        trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) .
89
-                                      "' without __toString() method", E_USER_NOTICE);
90
-                    }
91
-                } else {
92
-                    $selected = smarty_function_escape_special_chars((string) $_val);
93
-                }
94
-                break;
95
-
96
-            case 'strict':
97
-                break;
98
-
99
-            case 'disabled':
100
-            case 'readonly':
101
-                if (!empty($params[ 'strict' ])) {
102
-                    if (!is_scalar($_val)) {
103
-                        trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
104
-                                      E_USER_NOTICE);
105
-                    }
106
-
107
-                    if ($_val === true || $_val === $_key) {
108
-                        $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
109
-                    }
110
-
111
-                    break;
112
-                }
113
-            // omit break; to fall through!
114
-
115
-            default:
116
-                if (!is_array($_val)) {
117
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
118
-                } else {
119
-                    trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
120
-                }
121
-                break;
122
-        }
123
-    }
124
-
125
-    if (!isset($options) && !isset($values)) {
126
-        /* raise error here? */
127
-
128
-        return '';
129
-    }
130
-
131
-    $_html_result = '';
132
-    $_idx = 0;
133
-
134
-    if (isset($options)) {
135
-        foreach ($options as $_key => $_val) {
136
-            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
137
-        }
138
-    } else {
139
-        foreach ($values as $_i => $_key) {
140
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
141
-            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
142
-        }
143
-    }
144
-
145
-    if (!empty($name)) {
146
-        $_html_class = !empty($class) ? ' class="' . $class . '"' : '';
147
-        $_html_id = !empty($id) ? ' id="' . $id . '"' : '';
148
-        $_html_result =
149
-            '<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result .
150
-            '</select>' . "\n";
151
-    }
152
-
153
-    return $_html_result;
38
+	require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
39
+
40
+	$name = null;
41
+	$values = null;
42
+	$options = null;
43
+	$selected = null;
44
+	$output = null;
45
+	$id = null;
46
+	$class = null;
47
+
48
+	$extra = '';
49
+
50
+	foreach ($params as $_key => $_val) {
51
+		switch ($_key) {
52
+			case 'name':
53
+			case 'class':
54
+			case 'id':
55
+				$$_key = (string) $_val;
56
+				break;
57
+
58
+			case 'options':
59
+				$options = (array) $_val;
60
+				break;
61
+
62
+			case 'values':
63
+			case 'output':
64
+				$$_key = array_values((array) $_val);
65
+				break;
66
+
67
+			case 'selected':
68
+				if (is_array($_val)) {
69
+					$selected = array();
70
+					foreach ($_val as $_sel) {
71
+						if (is_object($_sel)) {
72
+							if (method_exists($_sel, "__toString")) {
73
+								$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
74
+							} else {
75
+								trigger_error("html_options: selected attribute contains an object of class '" .
76
+											  get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
77
+								continue;
78
+							}
79
+						} else {
80
+							$_sel = smarty_function_escape_special_chars((string) $_sel);
81
+						}
82
+						$selected[ $_sel ] = true;
83
+					}
84
+				} elseif (is_object($_val)) {
85
+					if (method_exists($_val, "__toString")) {
86
+						$selected = smarty_function_escape_special_chars((string) $_val->__toString());
87
+					} else {
88
+						trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) .
89
+									  "' without __toString() method", E_USER_NOTICE);
90
+					}
91
+				} else {
92
+					$selected = smarty_function_escape_special_chars((string) $_val);
93
+				}
94
+				break;
95
+
96
+			case 'strict':
97
+				break;
98
+
99
+			case 'disabled':
100
+			case 'readonly':
101
+				if (!empty($params[ 'strict' ])) {
102
+					if (!is_scalar($_val)) {
103
+						trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
104
+									  E_USER_NOTICE);
105
+					}
106
+
107
+					if ($_val === true || $_val === $_key) {
108
+						$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
109
+					}
110
+
111
+					break;
112
+				}
113
+			// omit break; to fall through!
114
+
115
+			default:
116
+				if (!is_array($_val)) {
117
+					$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
118
+				} else {
119
+					trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
120
+				}
121
+				break;
122
+		}
123
+	}
124
+
125
+	if (!isset($options) && !isset($values)) {
126
+		/* raise error here? */
127
+
128
+		return '';
129
+	}
130
+
131
+	$_html_result = '';
132
+	$_idx = 0;
133
+
134
+	if (isset($options)) {
135
+		foreach ($options as $_key => $_val) {
136
+			$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
137
+		}
138
+	} else {
139
+		foreach ($values as $_i => $_key) {
140
+			$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
141
+			$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
142
+		}
143
+	}
144
+
145
+	if (!empty($name)) {
146
+		$_html_class = !empty($class) ? ' class="' . $class . '"' : '';
147
+		$_html_id = !empty($id) ? ' id="' . $id . '"' : '';
148
+		$_html_result =
149
+			'<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result .
150
+			'</select>' . "\n";
151
+	}
152
+
153
+	return $_html_result;
154 154
 }
155 155
 
156 156
 function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
157 157
 {
158
-    if (!is_array($value)) {
159
-        $_key = smarty_function_escape_special_chars($key);
160
-        $_html_result = '<option value="' . $_key . '"';
161
-        if (is_array($selected)) {
162
-            if (isset($selected[ $_key ])) {
163
-                $_html_result .= ' selected="selected"';
164
-            }
165
-        } elseif ($_key === $selected) {
166
-            $_html_result .= ' selected="selected"';
167
-        }
168
-        $_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
169
-        $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
170
-        if (is_object($value)) {
171
-            if (method_exists($value, "__toString")) {
172
-                $value = smarty_function_escape_special_chars((string) $value->__toString());
173
-            } else {
174
-                trigger_error("html_options: value is an object of class '" . get_class($value) .
175
-                              "' without __toString() method", E_USER_NOTICE);
176
-
177
-                return '';
178
-            }
179
-        } else {
180
-            $value = smarty_function_escape_special_chars((string) $value);
181
-        }
182
-        $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
183
-        $idx ++;
184
-    } else {
185
-        $_idx = 0;
186
-        $_html_result =
187
-            smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null,
188
-                                                  $class, $_idx);
189
-        $idx ++;
190
-    }
191
-
192
-    return $_html_result;
158
+	if (!is_array($value)) {
159
+		$_key = smarty_function_escape_special_chars($key);
160
+		$_html_result = '<option value="' . $_key . '"';
161
+		if (is_array($selected)) {
162
+			if (isset($selected[ $_key ])) {
163
+				$_html_result .= ' selected="selected"';
164
+			}
165
+		} elseif ($_key === $selected) {
166
+			$_html_result .= ' selected="selected"';
167
+		}
168
+		$_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
169
+		$_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
170
+		if (is_object($value)) {
171
+			if (method_exists($value, "__toString")) {
172
+				$value = smarty_function_escape_special_chars((string) $value->__toString());
173
+			} else {
174
+				trigger_error("html_options: value is an object of class '" . get_class($value) .
175
+							  "' without __toString() method", E_USER_NOTICE);
176
+
177
+				return '';
178
+			}
179
+		} else {
180
+			$value = smarty_function_escape_special_chars((string) $value);
181
+		}
182
+		$_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
183
+		$idx ++;
184
+	} else {
185
+		$_idx = 0;
186
+		$_html_result =
187
+			smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null,
188
+												  $class, $_idx);
189
+		$idx ++;
190
+	}
191
+
192
+	return $_html_result;
193 193
 }
194 194
 
195 195
 function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
196 196
 {
197
-    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
198
-    foreach ($values as $key => $value) {
199
-        $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
200
-    }
201
-    $optgroup_html .= "</optgroup>\n";
197
+	$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
198
+	foreach ($values as $key => $value) {
199
+		$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
200
+	}
201
+	$optgroup_html .= "</optgroup>\n";
202 202
 
203
-    return $optgroup_html;
203
+	return $optgroup_html;
204 204
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                         } else {
80 80
                             $_sel = smarty_function_escape_special_chars((string) $_sel);
81 81
                         }
82
-                        $selected[ $_sel ] = true;
82
+                        $selected[$_sel] = true;
83 83
                     }
84 84
                 } elseif (is_object($_val)) {
85 85
                     if (method_exists($_val, "__toString")) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             case 'disabled':
100 100
             case 'readonly':
101
-                if (!empty($params[ 'strict' ])) {
101
+                if (!empty($params['strict'])) {
102 102
                     if (!is_scalar($_val)) {
103 103
                         trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
104 104
                                       E_USER_NOTICE);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         }
138 138
     } else {
139 139
         foreach ($values as $_i => $_key) {
140
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
140
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
141 141
             $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
142 142
         }
143 143
     }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $_key = smarty_function_escape_special_chars($key);
160 160
         $_html_result = '<option value="' . $_key . '"';
161 161
         if (is_array($selected)) {
162
-            if (isset($selected[ $_key ])) {
162
+            if (isset($selected[$_key])) {
163 163
                 $_html_result .= ' selected="selected"';
164 164
             }
165 165
         } elseif ($_key === $selected) {
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
             $value = smarty_function_escape_special_chars((string) $value);
181 181
         }
182 182
         $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
183
-        $idx ++;
183
+        $idx++;
184 184
     } else {
185 185
         $_idx = 0;
186 186
         $_html_result =
187 187
             smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null,
188 188
                                                   $class, $_idx);
189
-        $idx ++;
189
+        $idx++;
190 190
     }
191 191
 
192 192
     return $_html_result;
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_radios.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -164,6 +164,14 @@
 block discarded – undo
164 164
     }
165 165
 }
166 166
 
167
+/**
168
+ * @param string $name
169
+ * @param string $extra
170
+ * @param string $separator
171
+ * @param boolean $labels
172
+ * @param boolean $label_ids
173
+ * @param boolean $escape
174
+ */
167 175
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
168 176
                                             $escape)
169 177
 {
Please login to merge, or discard this patch.
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -45,188 +45,188 @@
 block discarded – undo
45 45
  */
46 46
 function smarty_function_html_radios($params, $template)
47 47
 {
48
-    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
-
50
-    $name = 'radio';
51
-    $values = null;
52
-    $options = null;
53
-    $selected = null;
54
-    $separator = '';
55
-    $escape = true;
56
-    $labels = true;
57
-    $label_ids = false;
58
-    $output = null;
59
-    $extra = '';
60
-
61
-    foreach ($params as $_key => $_val) {
62
-        switch ($_key) {
63
-            case 'name':
64
-            case 'separator':
65
-                $$_key = (string) $_val;
66
-                break;
67
-
68
-            case 'checked':
69
-            case 'selected':
70
-                if (is_array($_val)) {
71
-                    trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
72
-                } elseif (is_object($_val)) {
73
-                    if (method_exists($_val, "__toString")) {
74
-                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());
75
-                    } else {
76
-                        trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) .
77
-                                      "' without __toString() method", E_USER_NOTICE);
78
-                    }
79
-                } else {
80
-                    $selected = (string) $_val;
81
-                }
82
-                break;
83
-
84
-            case 'escape':
85
-            case 'labels':
86
-            case 'label_ids':
87
-                $$_key = (bool) $_val;
88
-                break;
89
-
90
-            case 'options':
91
-                $$_key = (array) $_val;
92
-                break;
93
-
94
-            case 'values':
95
-            case 'output':
96
-                $$_key = array_values((array) $_val);
97
-                break;
98
-
99
-            case 'radios':
100
-                trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
101
-                              E_USER_WARNING);
102
-                $options = (array) $_val;
103
-                break;
104
-
105
-            case 'assign':
106
-                break;
107
-
108
-            case 'strict':
109
-                break;
110
-
111
-            case 'disabled':
112
-            case 'readonly':
113
-                if (!empty($params[ 'strict' ])) {
114
-                    if (!is_scalar($_val)) {
115
-                        trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
116
-                                      E_USER_NOTICE);
117
-                    }
118
-
119
-                    if ($_val === true || $_val === $_key) {
120
-                        $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
121
-                    }
122
-
123
-                    break;
124
-                }
125
-            // omit break; to fall through!
126
-
127
-            default:
128
-                if (!is_array($_val)) {
129
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
130
-                } else {
131
-                    trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
132
-                }
133
-                break;
134
-        }
135
-    }
136
-
137
-    if (!isset($options) && !isset($values)) {
138
-        /* raise error here? */
139
-
140
-        return '';
141
-    }
142
-
143
-    $_html_result = array();
144
-
145
-    if (isset($options)) {
146
-        foreach ($options as $_key => $_val) {
147
-            $_html_result[] =
148
-                smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
149
-                                                   $label_ids, $escape);
150
-        }
151
-    } else {
152
-        foreach ($values as $_i => $_key) {
153
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
154
-            $_html_result[] =
155
-                smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
156
-                                                   $label_ids, $escape);
157
-        }
158
-    }
159
-
160
-    if (!empty($params[ 'assign' ])) {
161
-        $template->assign($params[ 'assign' ], $_html_result);
162
-    } else {
163
-        return implode("\n", $_html_result);
164
-    }
48
+	require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
+
50
+	$name = 'radio';
51
+	$values = null;
52
+	$options = null;
53
+	$selected = null;
54
+	$separator = '';
55
+	$escape = true;
56
+	$labels = true;
57
+	$label_ids = false;
58
+	$output = null;
59
+	$extra = '';
60
+
61
+	foreach ($params as $_key => $_val) {
62
+		switch ($_key) {
63
+			case 'name':
64
+			case 'separator':
65
+				$$_key = (string) $_val;
66
+				break;
67
+
68
+			case 'checked':
69
+			case 'selected':
70
+				if (is_array($_val)) {
71
+					trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
72
+				} elseif (is_object($_val)) {
73
+					if (method_exists($_val, "__toString")) {
74
+						$selected = smarty_function_escape_special_chars((string) $_val->__toString());
75
+					} else {
76
+						trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) .
77
+									  "' without __toString() method", E_USER_NOTICE);
78
+					}
79
+				} else {
80
+					$selected = (string) $_val;
81
+				}
82
+				break;
83
+
84
+			case 'escape':
85
+			case 'labels':
86
+			case 'label_ids':
87
+				$$_key = (bool) $_val;
88
+				break;
89
+
90
+			case 'options':
91
+				$$_key = (array) $_val;
92
+				break;
93
+
94
+			case 'values':
95
+			case 'output':
96
+				$$_key = array_values((array) $_val);
97
+				break;
98
+
99
+			case 'radios':
100
+				trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
101
+							  E_USER_WARNING);
102
+				$options = (array) $_val;
103
+				break;
104
+
105
+			case 'assign':
106
+				break;
107
+
108
+			case 'strict':
109
+				break;
110
+
111
+			case 'disabled':
112
+			case 'readonly':
113
+				if (!empty($params[ 'strict' ])) {
114
+					if (!is_scalar($_val)) {
115
+						trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
116
+									  E_USER_NOTICE);
117
+					}
118
+
119
+					if ($_val === true || $_val === $_key) {
120
+						$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
121
+					}
122
+
123
+					break;
124
+				}
125
+			// omit break; to fall through!
126
+
127
+			default:
128
+				if (!is_array($_val)) {
129
+					$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
130
+				} else {
131
+					trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
132
+				}
133
+				break;
134
+		}
135
+	}
136
+
137
+	if (!isset($options) && !isset($values)) {
138
+		/* raise error here? */
139
+
140
+		return '';
141
+	}
142
+
143
+	$_html_result = array();
144
+
145
+	if (isset($options)) {
146
+		foreach ($options as $_key => $_val) {
147
+			$_html_result[] =
148
+				smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
149
+												   $label_ids, $escape);
150
+		}
151
+	} else {
152
+		foreach ($values as $_i => $_key) {
153
+			$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
154
+			$_html_result[] =
155
+				smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
156
+												   $label_ids, $escape);
157
+		}
158
+	}
159
+
160
+	if (!empty($params[ 'assign' ])) {
161
+		$template->assign($params[ 'assign' ], $_html_result);
162
+	} else {
163
+		return implode("\n", $_html_result);
164
+	}
165 165
 }
166 166
 
167 167
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
168
-                                            $escape)
168
+											$escape)
169 169
 {
170
-    $_output = '';
171
-
172
-    if (is_object($value)) {
173
-        if (method_exists($value, "__toString")) {
174
-            $value = (string) $value->__toString();
175
-        } else {
176
-            trigger_error("html_options: value is an object of class '" . get_class($value) .
177
-                          "' without __toString() method", E_USER_NOTICE);
178
-
179
-            return '';
180
-        }
181
-    } else {
182
-        $value = (string) $value;
183
-    }
184
-
185
-    if (is_object($output)) {
186
-        if (method_exists($output, "__toString")) {
187
-            $output = (string) $output->__toString();
188
-        } else {
189
-            trigger_error("html_options: output is an object of class '" . get_class($output) .
190
-                          "' without __toString() method", E_USER_NOTICE);
191
-
192
-            return '';
193
-        }
194
-    } else {
195
-        $output = (string) $output;
196
-    }
197
-
198
-    if ($labels) {
199
-        if ($label_ids) {
200
-            $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
201
-                                                                     $name . '_' . $value));
202
-            $_output .= '<label for="' . $_id . '">';
203
-        } else {
204
-            $_output .= '<label>';
205
-        }
206
-    }
207
-
208
-    $name = smarty_function_escape_special_chars($name);
209
-    $value = smarty_function_escape_special_chars($value);
210
-    if ($escape) {
211
-        $output = smarty_function_escape_special_chars($output);
212
-    }
213
-
214
-    $_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
215
-
216
-    if ($labels && $label_ids) {
217
-        $_output .= ' id="' . $_id . '"';
218
-    }
219
-
220
-    if ($value === $selected) {
221
-        $_output .= ' checked="checked"';
222
-    }
223
-
224
-    $_output .= $extra . ' />' . $output;
225
-    if ($labels) {
226
-        $_output .= '</label>';
227
-    }
228
-
229
-    $_output .= $separator;
230
-
231
-    return $_output;
170
+	$_output = '';
171
+
172
+	if (is_object($value)) {
173
+		if (method_exists($value, "__toString")) {
174
+			$value = (string) $value->__toString();
175
+		} else {
176
+			trigger_error("html_options: value is an object of class '" . get_class($value) .
177
+						  "' without __toString() method", E_USER_NOTICE);
178
+
179
+			return '';
180
+		}
181
+	} else {
182
+		$value = (string) $value;
183
+	}
184
+
185
+	if (is_object($output)) {
186
+		if (method_exists($output, "__toString")) {
187
+			$output = (string) $output->__toString();
188
+		} else {
189
+			trigger_error("html_options: output is an object of class '" . get_class($output) .
190
+						  "' without __toString() method", E_USER_NOTICE);
191
+
192
+			return '';
193
+		}
194
+	} else {
195
+		$output = (string) $output;
196
+	}
197
+
198
+	if ($labels) {
199
+		if ($label_ids) {
200
+			$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
201
+																	 $name . '_' . $value));
202
+			$_output .= '<label for="' . $_id . '">';
203
+		} else {
204
+			$_output .= '<label>';
205
+		}
206
+	}
207
+
208
+	$name = smarty_function_escape_special_chars($name);
209
+	$value = smarty_function_escape_special_chars($value);
210
+	if ($escape) {
211
+		$output = smarty_function_escape_special_chars($output);
212
+	}
213
+
214
+	$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
215
+
216
+	if ($labels && $label_ids) {
217
+		$_output .= ' id="' . $_id . '"';
218
+	}
219
+
220
+	if ($value === $selected) {
221
+		$_output .= ' checked="checked"';
222
+	}
223
+
224
+	$_output .= $extra . ' />' . $output;
225
+	if ($labels) {
226
+		$_output .= '</label>';
227
+	}
228
+
229
+	$_output .= $separator;
230
+
231
+	return $_output;
232 232
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
             case 'disabled':
112 112
             case 'readonly':
113
-                if (!empty($params[ 'strict' ])) {
113
+                if (!empty($params['strict'])) {
114 114
                     if (!is_scalar($_val)) {
115 115
                         trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
116 116
                                       E_USER_NOTICE);
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
         }
151 151
     } else {
152 152
         foreach ($values as $_i => $_key) {
153
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
153
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
154 154
             $_html_result[] =
155 155
                 smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
156 156
                                                    $label_ids, $escape);
157 157
         }
158 158
     }
159 159
 
160
-    if (!empty($params[ 'assign' ])) {
161
-        $template->assign($params[ 'assign' ], $_html_result);
160
+    if (!empty($params['assign'])) {
161
+        $template->assign($params['assign'], $_html_result);
162 162
     } else {
163 163
         return implode("\n", $_html_result);
164 164
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_table.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -164,6 +164,10 @@
 block discarded – undo
164 164
     return $output;
165 165
 }
166 166
 
167
+/**
168
+ * @param string $name
169
+ * @param string $var
170
+ */
167 171
 function smarty_function_html_table_cycle($name, $var, $no)
168 172
 {
169 173
     if (!is_array($var)) {
Please login to merge, or discard this patch.
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -49,128 +49,128 @@
 block discarded – undo
49 49
  */
50 50
 function smarty_function_html_table($params)
51 51
 {
52
-    $table_attr = 'border="1"';
53
-    $tr_attr = '';
54
-    $th_attr = '';
55
-    $td_attr = '';
56
-    $cols = $cols_count = 3;
57
-    $rows = 3;
58
-    $trailpad = '&nbsp;';
59
-    $vdir = 'down';
60
-    $hdir = 'right';
61
-    $inner = 'cols';
62
-    $caption = '';
63
-    $loop = null;
64
-
65
-    if (!isset($params[ 'loop' ])) {
66
-        trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
67
-
68
-        return;
69
-    }
70
-
71
-    foreach ($params as $_key => $_value) {
72
-        switch ($_key) {
73
-            case 'loop':
74
-                $$_key = (array) $_value;
75
-                break;
76
-
77
-            case 'cols':
78
-                if (is_array($_value) && !empty($_value)) {
79
-                    $cols = $_value;
80
-                    $cols_count = count($_value);
81
-                } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
82
-                    $cols = explode(',', $_value);
83
-                    $cols_count = count($cols);
84
-                } elseif (!empty($_value)) {
85
-                    $cols_count = (int) $_value;
86
-                } else {
87
-                    $cols_count = $cols;
88
-                }
89
-                break;
90
-
91
-            case 'rows':
92
-                $$_key = (int) $_value;
93
-                break;
94
-
95
-            case 'table_attr':
96
-            case 'trailpad':
97
-            case 'hdir':
98
-            case 'vdir':
99
-            case 'inner':
100
-            case 'caption':
101
-                $$_key = (string) $_value;
102
-                break;
103
-
104
-            case 'tr_attr':
105
-            case 'td_attr':
106
-            case 'th_attr':
107
-                $$_key = $_value;
108
-                break;
109
-        }
110
-    }
111
-
112
-    $loop_count = count($loop);
113
-    if (empty($params[ 'rows' ])) {
114
-        /* no rows specified */
115
-        $rows = ceil($loop_count / $cols_count);
116
-    } elseif (empty($params[ 'cols' ])) {
117
-        if (!empty($params[ 'rows' ])) {
118
-            /* no cols specified, but rows */
119
-            $cols_count = ceil($loop_count / $rows);
120
-        }
121
-    }
122
-
123
-    $output = "<table $table_attr>\n";
124
-
125
-    if (!empty($caption)) {
126
-        $output .= '<caption>' . $caption . "</caption>\n";
127
-    }
128
-
129
-    if (is_array($cols)) {
130
-        $cols = ($hdir == 'right') ? $cols : array_reverse($cols);
131
-        $output .= "<thead><tr>\n";
132
-
133
-        for ($r = 0; $r < $cols_count; $r ++) {
134
-            $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
135
-            $output .= $cols[ $r ];
136
-            $output .= "</th>\n";
137
-        }
138
-        $output .= "</tr></thead>\n";
139
-    }
140
-
141
-    $output .= "<tbody>\n";
142
-    for ($r = 0; $r < $rows; $r ++) {
143
-        $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
144
-        $rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
145
-
146
-        for ($c = 0; $c < $cols_count; $c ++) {
147
-            $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
148
-            if ($inner != 'cols') {
149
-                /* shuffle x to loop over rows*/
150
-                $x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
151
-            }
152
-
153
-            if ($x < $loop_count) {
154
-                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n";
155
-            } else {
156
-                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
157
-            }
158
-        }
159
-        $output .= "</tr>\n";
160
-    }
161
-    $output .= "</tbody>\n";
162
-    $output .= "</table>\n";
163
-
164
-    return $output;
52
+	$table_attr = 'border="1"';
53
+	$tr_attr = '';
54
+	$th_attr = '';
55
+	$td_attr = '';
56
+	$cols = $cols_count = 3;
57
+	$rows = 3;
58
+	$trailpad = '&nbsp;';
59
+	$vdir = 'down';
60
+	$hdir = 'right';
61
+	$inner = 'cols';
62
+	$caption = '';
63
+	$loop = null;
64
+
65
+	if (!isset($params[ 'loop' ])) {
66
+		trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
67
+
68
+		return;
69
+	}
70
+
71
+	foreach ($params as $_key => $_value) {
72
+		switch ($_key) {
73
+			case 'loop':
74
+				$$_key = (array) $_value;
75
+				break;
76
+
77
+			case 'cols':
78
+				if (is_array($_value) && !empty($_value)) {
79
+					$cols = $_value;
80
+					$cols_count = count($_value);
81
+				} elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
82
+					$cols = explode(',', $_value);
83
+					$cols_count = count($cols);
84
+				} elseif (!empty($_value)) {
85
+					$cols_count = (int) $_value;
86
+				} else {
87
+					$cols_count = $cols;
88
+				}
89
+				break;
90
+
91
+			case 'rows':
92
+				$$_key = (int) $_value;
93
+				break;
94
+
95
+			case 'table_attr':
96
+			case 'trailpad':
97
+			case 'hdir':
98
+			case 'vdir':
99
+			case 'inner':
100
+			case 'caption':
101
+				$$_key = (string) $_value;
102
+				break;
103
+
104
+			case 'tr_attr':
105
+			case 'td_attr':
106
+			case 'th_attr':
107
+				$$_key = $_value;
108
+				break;
109
+		}
110
+	}
111
+
112
+	$loop_count = count($loop);
113
+	if (empty($params[ 'rows' ])) {
114
+		/* no rows specified */
115
+		$rows = ceil($loop_count / $cols_count);
116
+	} elseif (empty($params[ 'cols' ])) {
117
+		if (!empty($params[ 'rows' ])) {
118
+			/* no cols specified, but rows */
119
+			$cols_count = ceil($loop_count / $rows);
120
+		}
121
+	}
122
+
123
+	$output = "<table $table_attr>\n";
124
+
125
+	if (!empty($caption)) {
126
+		$output .= '<caption>' . $caption . "</caption>\n";
127
+	}
128
+
129
+	if (is_array($cols)) {
130
+		$cols = ($hdir == 'right') ? $cols : array_reverse($cols);
131
+		$output .= "<thead><tr>\n";
132
+
133
+		for ($r = 0; $r < $cols_count; $r ++) {
134
+			$output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
135
+			$output .= $cols[ $r ];
136
+			$output .= "</th>\n";
137
+		}
138
+		$output .= "</tr></thead>\n";
139
+	}
140
+
141
+	$output .= "<tbody>\n";
142
+	for ($r = 0; $r < $rows; $r ++) {
143
+		$output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
144
+		$rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
145
+
146
+		for ($c = 0; $c < $cols_count; $c ++) {
147
+			$x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
148
+			if ($inner != 'cols') {
149
+				/* shuffle x to loop over rows*/
150
+				$x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
151
+			}
152
+
153
+			if ($x < $loop_count) {
154
+				$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n";
155
+			} else {
156
+				$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
157
+			}
158
+		}
159
+		$output .= "</tr>\n";
160
+	}
161
+	$output .= "</tbody>\n";
162
+	$output .= "</table>\n";
163
+
164
+	return $output;
165 165
 }
166 166
 
167 167
 function smarty_function_html_table_cycle($name, $var, $no)
168 168
 {
169
-    if (!is_array($var)) {
170
-        $ret = $var;
171
-    } else {
172
-        $ret = $var[ $no % count($var) ];
173
-    }
169
+	if (!is_array($var)) {
170
+		$ret = $var;
171
+	} else {
172
+		$ret = $var[ $no % count($var) ];
173
+	}
174 174
 
175
-    return ($ret) ? ' ' . $ret : '';
175
+	return ($ret) ? ' ' . $ret : '';
176 176
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     $caption = '';
63 63
     $loop = null;
64 64
 
65
-    if (!isset($params[ 'loop' ])) {
65
+    if (!isset($params['loop'])) {
66 66
         trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
67 67
 
68 68
         return;
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
     }
111 111
 
112 112
     $loop_count = count($loop);
113
-    if (empty($params[ 'rows' ])) {
113
+    if (empty($params['rows'])) {
114 114
         /* no rows specified */
115 115
         $rows = ceil($loop_count / $cols_count);
116
-    } elseif (empty($params[ 'cols' ])) {
117
-        if (!empty($params[ 'rows' ])) {
116
+    } elseif (empty($params['cols'])) {
117
+        if (!empty($params['rows'])) {
118 118
             /* no cols specified, but rows */
119 119
             $cols_count = ceil($loop_count / $rows);
120 120
         }
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
         $cols = ($hdir == 'right') ? $cols : array_reverse($cols);
131 131
         $output .= "<thead><tr>\n";
132 132
 
133
-        for ($r = 0; $r < $cols_count; $r ++) {
133
+        for ($r = 0; $r < $cols_count; $r++) {
134 134
             $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
135
-            $output .= $cols[ $r ];
135
+            $output .= $cols[$r];
136 136
             $output .= "</th>\n";
137 137
         }
138 138
         $output .= "</tr></thead>\n";
139 139
     }
140 140
 
141 141
     $output .= "<tbody>\n";
142
-    for ($r = 0; $r < $rows; $r ++) {
142
+    for ($r = 0; $r < $rows; $r++) {
143 143
         $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
144 144
         $rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
145 145
 
146
-        for ($c = 0; $c < $cols_count; $c ++) {
146
+        for ($c = 0; $c < $cols_count; $c++) {
147 147
             $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
148 148
             if ($inner != 'cols') {
149 149
                 /* shuffle x to loop over rows*/
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             }
152 152
 
153 153
             if ($x < $loop_count) {
154
-                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n";
154
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n";
155 155
             } else {
156 156
                 $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
157 157
             }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     if (!is_array($var)) {
170 170
         $ret = $var;
171 171
     } else {
172
-        $ret = $var[ $no % count($var) ];
172
+        $ret = $var[$no % count($var)];
173 173
     }
174 174
 
175 175
     return ($ret) ? ' ' . $ret : '';
Please login to merge, or discard this patch.
libraries/Smarty/libs/Smarty.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1159,7 +1159,7 @@
 block discarded – undo
1159 1159
      * @param string                    $template_name
1160 1160
      * @param null|mixed                $cache_id
1161 1161
      * @param null|mixed                $compile_id
1162
-     * @param null                      $caching
1162
+     * @param integer                      $caching
1163 1163
      * @param \Smarty_Internal_Template $template
1164 1164
      *
1165 1165
      * @return string
Please login to merge, or discard this patch.
Indentation   +1355 added lines, -1355 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * define shorthand directory separator constant
35 35
  */
36 36
 if (!defined('DS')) {
37
-    define('DS', DIRECTORY_SEPARATOR);
37
+	define('DS', DIRECTORY_SEPARATOR);
38 38
 }
39 39
 
40 40
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  * Sets SMARTY_DIR only if user application has not already defined it.
43 43
  */
44 44
 if (!defined('SMARTY_DIR')) {
45
-    define('SMARTY_DIR', dirname(__FILE__) . DS);
45
+	define('SMARTY_DIR', dirname(__FILE__) . DS);
46 46
 }
47 47
 
48 48
 /**
@@ -50,26 +50,26 @@  discard block
 block discarded – undo
50 50
  * Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.
51 51
  */
52 52
 if (!defined('SMARTY_SYSPLUGINS_DIR')) {
53
-    define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);
53
+	define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);
54 54
 }
55 55
 if (!defined('SMARTY_PLUGINS_DIR')) {
56
-    define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
56
+	define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
57 57
 }
58 58
 if (!defined('SMARTY_MBSTRING')) {
59
-    define('SMARTY_MBSTRING', function_exists('mb_get_info'));
59
+	define('SMARTY_MBSTRING', function_exists('mb_get_info'));
60 60
 }
61 61
 if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
62
-    // UTF-8 can only be done properly when mbstring is available!
63
-    /**
64
-     * @deprecated in favor of Smarty::$_CHARSET
65
-     */
66
-    define('SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1');
62
+	// UTF-8 can only be done properly when mbstring is available!
63
+	/**
64
+	 * @deprecated in favor of Smarty::$_CHARSET
65
+	 */
66
+	define('SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1');
67 67
 }
68 68
 if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
69
-    /**
70
-     * @deprecated in favor of Smarty::$_DATE_FORMAT
71
-     */
72
-    define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
69
+	/**
70
+	 * @deprecated in favor of Smarty::$_DATE_FORMAT
71
+	 */
72
+	define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
73 73
 }
74 74
 
75 75
 /**
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
  * Otherwise we may have a global autoloader like Composer
79 79
  */
80 80
 if (!class_exists('Smarty_Autoloader', false)) {
81
-    if (!class_exists('Smarty_Internal_Data', true)) {
82
-        require_once dirname(__FILE__) . '/Autoloader.php';
83
-        Smarty_Autoloader::registerBC();
84
-    }
81
+	if (!class_exists('Smarty_Internal_Data', true)) {
82
+		require_once dirname(__FILE__) . '/Autoloader.php';
83
+		Smarty_Autoloader::registerBC();
84
+	}
85 85
 }
86 86
 
87 87
 /**
88 88
  * Load always needed external class files
89 89
  */
90 90
 if (!class_exists('Smarty_Internal_Data', false)) {
91
-    require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php';
91
+	require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php';
92 92
 }
93 93
 require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php';
94 94
 require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php';
@@ -114,1385 +114,1385 @@  discard block
 block discarded – undo
114 114
  */
115 115
 class Smarty extends Smarty_Internal_TemplateBase
116 116
 {
117
-    /**#@+
117
+	/**#@+
118 118
      * constant definitions
119 119
      */
120 120
 
121
-    /**
122
-     * smarty version
123
-     */
124
-    const SMARTY_VERSION = '3.1.30';
121
+	/**
122
+	 * smarty version
123
+	 */
124
+	const SMARTY_VERSION = '3.1.30';
125 125
 
126
-    /**
127
-     * define variable scopes
128
-     */
129
-    const SCOPE_LOCAL = 1;
126
+	/**
127
+	 * define variable scopes
128
+	 */
129
+	const SCOPE_LOCAL = 1;
130 130
 
131
-    const SCOPE_PARENT = 2;
131
+	const SCOPE_PARENT = 2;
132 132
 
133
-    const SCOPE_TPL_ROOT = 4;
133
+	const SCOPE_TPL_ROOT = 4;
134 134
 
135
-    const SCOPE_ROOT = 8;
135
+	const SCOPE_ROOT = 8;
136 136
 
137
-    const SCOPE_SMARTY = 16;
137
+	const SCOPE_SMARTY = 16;
138 138
 
139
-    const SCOPE_GLOBAL = 32;
139
+	const SCOPE_GLOBAL = 32;
140 140
 
141
-    /**
142
-     * define caching modes
143
-     */
144
-    const CACHING_OFF = 0;
141
+	/**
142
+	 * define caching modes
143
+	 */
144
+	const CACHING_OFF = 0;
145 145
 
146
-    const CACHING_LIFETIME_CURRENT = 1;
146
+	const CACHING_LIFETIME_CURRENT = 1;
147 147
 
148
-    const CACHING_LIFETIME_SAVED = 2;
148
+	const CACHING_LIFETIME_SAVED = 2;
149 149
 
150
-    /**
151
-     * define constant for clearing cache files be saved expiration dates
152
-     */
153
-    const CLEAR_EXPIRED = - 1;
150
+	/**
151
+	 * define constant for clearing cache files be saved expiration dates
152
+	 */
153
+	const CLEAR_EXPIRED = - 1;
154 154
 
155
-    /**
156
-     * define compile check modes
157
-     */
158
-    const COMPILECHECK_OFF = 0;
155
+	/**
156
+	 * define compile check modes
157
+	 */
158
+	const COMPILECHECK_OFF = 0;
159 159
 
160
-    const COMPILECHECK_ON = 1;
160
+	const COMPILECHECK_ON = 1;
161 161
 
162
-    const COMPILECHECK_CACHEMISS = 2;
162
+	const COMPILECHECK_CACHEMISS = 2;
163 163
 
164
-    /**
165
-     * define debug modes
166
-     */
167
-    const DEBUG_OFF = 0;
164
+	/**
165
+	 * define debug modes
166
+	 */
167
+	const DEBUG_OFF = 0;
168 168
 
169
-    const DEBUG_ON = 1;
169
+	const DEBUG_ON = 1;
170 170
 
171
-    const DEBUG_INDIVIDUAL = 2;
171
+	const DEBUG_INDIVIDUAL = 2;
172 172
 
173
-    /**
174
-     * modes for handling of "<?php ... ?>" tags in templates.
175
-     */
176
-    const PHP_PASSTHRU = 0; //-> print tags as plain text
173
+	/**
174
+	 * modes for handling of "<?php ... ?>" tags in templates.
175
+	 */
176
+	const PHP_PASSTHRU = 0; //-> print tags as plain text
177 177
 
178
-    const PHP_QUOTE = 1; //-> escape tags as entities
178
+	const PHP_QUOTE = 1; //-> escape tags as entities
179 179
 
180
-    const PHP_REMOVE = 2; //-> escape tags as entities
180
+	const PHP_REMOVE = 2; //-> escape tags as entities
181 181
 
182
-    const PHP_ALLOW = 3; //-> escape tags as entities
182
+	const PHP_ALLOW = 3; //-> escape tags as entities
183 183
 
184
-    /**
185
-     * filter types
186
-     */
187
-    const FILTER_POST = 'post';
184
+	/**
185
+	 * filter types
186
+	 */
187
+	const FILTER_POST = 'post';
188 188
 
189
-    const FILTER_PRE = 'pre';
189
+	const FILTER_PRE = 'pre';
190 190
 
191
-    const FILTER_OUTPUT = 'output';
191
+	const FILTER_OUTPUT = 'output';
192 192
 
193
-    const FILTER_VARIABLE = 'variable';
193
+	const FILTER_VARIABLE = 'variable';
194 194
 
195
-    /**
196
-     * plugin types
197
-     */
198
-    const PLUGIN_FUNCTION = 'function';
195
+	/**
196
+	 * plugin types
197
+	 */
198
+	const PLUGIN_FUNCTION = 'function';
199 199
 
200
-    const PLUGIN_BLOCK = 'block';
200
+	const PLUGIN_BLOCK = 'block';
201 201
 
202
-    const PLUGIN_COMPILER = 'compiler';
202
+	const PLUGIN_COMPILER = 'compiler';
203 203
 
204
-    const PLUGIN_MODIFIER = 'modifier';
204
+	const PLUGIN_MODIFIER = 'modifier';
205 205
 
206
-    const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler';
206
+	const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler';
207 207
 
208
-    /**
209
-     * Resource caching modes
210
-     * (not used since 3.1.30)
211
-     */
212
-    const RESOURCE_CACHE_OFF = 0;
208
+	/**
209
+	 * Resource caching modes
210
+	 * (not used since 3.1.30)
211
+	 */
212
+	const RESOURCE_CACHE_OFF = 0;
213 213
 
214
-    const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules
214
+	const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules
215 215
 
216
-    const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects
216
+	const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects
217 217
 
218
-    const RESOURCE_CACHE_ON = 4;    // cache source and compiled resources
218
+	const RESOURCE_CACHE_ON = 4;    // cache source and compiled resources
219 219
 
220
-    /**#@-*/
220
+	/**#@-*/
221 221
 
222
-    /**
223
-     * assigned global tpl vars
224
-     */
225
-    public static $global_tpl_vars = array();
222
+	/**
223
+	 * assigned global tpl vars
224
+	 */
225
+	public static $global_tpl_vars = array();
226 226
 
227
-    /**
228
-     * error handler returned by set_error_handler() in Smarty::muteExpectedErrors()
229
-     */
230
-    public static $_previous_error_handler = null;
227
+	/**
228
+	 * error handler returned by set_error_handler() in Smarty::muteExpectedErrors()
229
+	 */
230
+	public static $_previous_error_handler = null;
231 231
 
232
-    /**
233
-     * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
234
-     */
235
-    public static $_muted_directories = array();
232
+	/**
233
+	 * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
234
+	 */
235
+	public static $_muted_directories = array();
236 236
 
237
-    /**
238
-     * Flag denoting if Multibyte String functions are available
239
-     */
240
-    public static $_MBSTRING = SMARTY_MBSTRING;
237
+	/**
238
+	 * Flag denoting if Multibyte String functions are available
239
+	 */
240
+	public static $_MBSTRING = SMARTY_MBSTRING;
241 241
 
242
-    /**
243
-     * The character set to adhere to (e.g. "UTF-8")
244
-     */
245
-    public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;
242
+	/**
243
+	 * The character set to adhere to (e.g. "UTF-8")
244
+	 */
245
+	public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;
246 246
 
247
-    /**
248
-     * The date format to be used internally
249
-     * (accepts date() and strftime())
250
-     */
251
-    public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT;
247
+	/**
248
+	 * The date format to be used internally
249
+	 * (accepts date() and strftime())
250
+	 */
251
+	public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT;
252 252
 
253
-    /**
254
-     * Flag denoting if PCRE should run in UTF-8 mode
255
-     */
256
-    public static $_UTF8_MODIFIER = 'u';
253
+	/**
254
+	 * Flag denoting if PCRE should run in UTF-8 mode
255
+	 */
256
+	public static $_UTF8_MODIFIER = 'u';
257 257
 
258
-    /**
259
-     * Flag denoting if operating system is windows
260
-     */
261
-    public static $_IS_WINDOWS = false;
258
+	/**
259
+	 * Flag denoting if operating system is windows
260
+	 */
261
+	public static $_IS_WINDOWS = false;
262 262
 
263
-    /**#@+
263
+	/**#@+
264 264
      * variables
265 265
      */
266 266
 
267
-    /**
268
-     * auto literal on delimiters with whitespace
269
-     *
270
-     * @var boolean
271
-     */
272
-    public $auto_literal = true;
273
-
274
-    /**
275
-     * display error on not assigned variables
276
-     *
277
-     * @var boolean
278
-     */
279
-    public $error_unassigned = false;
280
-
281
-    /**
282
-     * look up relative file path in include_path
283
-     *
284
-     * @var boolean
285
-     */
286
-    public $use_include_path = false;
287
-
288
-    /**
289
-     * template directory
290
-     *
291
-     * @var array
292
-     */
293
-    protected $template_dir = array('./templates/');
294
-
295
-    /**
296
-     * flags for normalized template directory entries
297
-     *
298
-     * @var array
299
-     */
300
-    protected $_processedTemplateDir = array();
301
-
302
-    /**
303
-     * flag if template_dir is normalized
304
-     *
305
-     * @var bool
306
-     */
307
-    public $_templateDirNormalized = false;
308
-
309
-    /**
310
-     * joined template directory string used in cache keys
311
-     *
312
-     * @var string
313
-     */
314
-    public $_joined_template_dir = null;
315
-
316
-    /**
317
-     * config directory
318
-     *
319
-     * @var array
320
-     */
321
-    protected $config_dir = array('./configs/');
322
-
323
-    /**
324
-     * flags for normalized template directory entries
325
-     *
326
-     * @var array
327
-     */
328
-    protected $_processedConfigDir = array();
329
-
330
-    /**
331
-     * flag if config_dir is normalized
332
-     *
333
-     * @var bool
334
-     */
335
-    public $_configDirNormalized = false;
336
-
337
-    /**
338
-     * joined config directory string used in cache keys
339
-     *
340
-     * @var string
341
-     */
342
-    public $_joined_config_dir = null;
343
-
344
-    /**
345
-     * default template handler
346
-     *
347
-     * @var callable
348
-     */
349
-    public $default_template_handler_func = null;
350
-
351
-    /**
352
-     * default config handler
353
-     *
354
-     * @var callable
355
-     */
356
-    public $default_config_handler_func = null;
357
-
358
-    /**
359
-     * default plugin handler
360
-     *
361
-     * @var callable
362
-     */
363
-    public $default_plugin_handler_func = null;
364
-
365
-    /**
366
-     * compile directory
367
-     *
368
-     * @var string
369
-     */
370
-    protected $compile_dir = './templates_c/';
371
-
372
-    /**
373
-     * flag if template_dir is normalized
374
-     *
375
-     * @var bool
376
-     */
377
-    public $_compileDirNormalized = false;
378
-
379
-    /**
380
-     * plugins directory
381
-     *
382
-     * @var array
383
-     */
384
-    protected $plugins_dir = array();
385
-
386
-    /**
387
-     * flag if plugins_dir is normalized
388
-     *
389
-     * @var bool
390
-     */
391
-    public $_pluginsDirNormalized = false;
392
-
393
-    /**
394
-     * cache directory
395
-     *
396
-     * @var string
397
-     */
398
-    protected $cache_dir = './cache/';
399
-
400
-    /**
401
-     * flag if template_dir is normalized
402
-     *
403
-     * @var bool
404
-     */
405
-    public $_cacheDirNormalized = false;
406
-
407
-    /**
408
-     * force template compiling?
409
-     *
410
-     * @var boolean
411
-     */
412
-    public $force_compile = false;
413
-
414
-    /**
415
-     * check template for modifications?
416
-     *
417
-     * @var boolean
418
-     */
419
-    public $compile_check = true;
420
-
421
-    /**
422
-     * use sub dirs for compiled/cached files?
423
-     *
424
-     * @var boolean
425
-     */
426
-    public $use_sub_dirs = false;
427
-
428
-    /**
429
-     * allow ambiguous resources (that are made unique by the resource handler)
430
-     *
431
-     * @var boolean
432
-     */
433
-    public $allow_ambiguous_resources = false;
434
-
435
-    /**
436
-     * merge compiled includes
437
-     *
438
-     * @var boolean
439
-     */
440
-    public $merge_compiled_includes = false;
441
-
442
-    /**
443
-     * force cache file creation
444
-     *
445
-     * @var boolean
446
-     */
447
-    public $force_cache = false;
448
-
449
-    /**
450
-     * template left-delimiter
451
-     *
452
-     * @var string
453
-     */
454
-    public $left_delimiter = "{";
455
-
456
-    /**
457
-     * template right-delimiter
458
-     *
459
-     * @var string
460
-     */
461
-    public $right_delimiter = "}";
462
-
463
-    /**#@+
267
+	/**
268
+	 * auto literal on delimiters with whitespace
269
+	 *
270
+	 * @var boolean
271
+	 */
272
+	public $auto_literal = true;
273
+
274
+	/**
275
+	 * display error on not assigned variables
276
+	 *
277
+	 * @var boolean
278
+	 */
279
+	public $error_unassigned = false;
280
+
281
+	/**
282
+	 * look up relative file path in include_path
283
+	 *
284
+	 * @var boolean
285
+	 */
286
+	public $use_include_path = false;
287
+
288
+	/**
289
+	 * template directory
290
+	 *
291
+	 * @var array
292
+	 */
293
+	protected $template_dir = array('./templates/');
294
+
295
+	/**
296
+	 * flags for normalized template directory entries
297
+	 *
298
+	 * @var array
299
+	 */
300
+	protected $_processedTemplateDir = array();
301
+
302
+	/**
303
+	 * flag if template_dir is normalized
304
+	 *
305
+	 * @var bool
306
+	 */
307
+	public $_templateDirNormalized = false;
308
+
309
+	/**
310
+	 * joined template directory string used in cache keys
311
+	 *
312
+	 * @var string
313
+	 */
314
+	public $_joined_template_dir = null;
315
+
316
+	/**
317
+	 * config directory
318
+	 *
319
+	 * @var array
320
+	 */
321
+	protected $config_dir = array('./configs/');
322
+
323
+	/**
324
+	 * flags for normalized template directory entries
325
+	 *
326
+	 * @var array
327
+	 */
328
+	protected $_processedConfigDir = array();
329
+
330
+	/**
331
+	 * flag if config_dir is normalized
332
+	 *
333
+	 * @var bool
334
+	 */
335
+	public $_configDirNormalized = false;
336
+
337
+	/**
338
+	 * joined config directory string used in cache keys
339
+	 *
340
+	 * @var string
341
+	 */
342
+	public $_joined_config_dir = null;
343
+
344
+	/**
345
+	 * default template handler
346
+	 *
347
+	 * @var callable
348
+	 */
349
+	public $default_template_handler_func = null;
350
+
351
+	/**
352
+	 * default config handler
353
+	 *
354
+	 * @var callable
355
+	 */
356
+	public $default_config_handler_func = null;
357
+
358
+	/**
359
+	 * default plugin handler
360
+	 *
361
+	 * @var callable
362
+	 */
363
+	public $default_plugin_handler_func = null;
364
+
365
+	/**
366
+	 * compile directory
367
+	 *
368
+	 * @var string
369
+	 */
370
+	protected $compile_dir = './templates_c/';
371
+
372
+	/**
373
+	 * flag if template_dir is normalized
374
+	 *
375
+	 * @var bool
376
+	 */
377
+	public $_compileDirNormalized = false;
378
+
379
+	/**
380
+	 * plugins directory
381
+	 *
382
+	 * @var array
383
+	 */
384
+	protected $plugins_dir = array();
385
+
386
+	/**
387
+	 * flag if plugins_dir is normalized
388
+	 *
389
+	 * @var bool
390
+	 */
391
+	public $_pluginsDirNormalized = false;
392
+
393
+	/**
394
+	 * cache directory
395
+	 *
396
+	 * @var string
397
+	 */
398
+	protected $cache_dir = './cache/';
399
+
400
+	/**
401
+	 * flag if template_dir is normalized
402
+	 *
403
+	 * @var bool
404
+	 */
405
+	public $_cacheDirNormalized = false;
406
+
407
+	/**
408
+	 * force template compiling?
409
+	 *
410
+	 * @var boolean
411
+	 */
412
+	public $force_compile = false;
413
+
414
+	/**
415
+	 * check template for modifications?
416
+	 *
417
+	 * @var boolean
418
+	 */
419
+	public $compile_check = true;
420
+
421
+	/**
422
+	 * use sub dirs for compiled/cached files?
423
+	 *
424
+	 * @var boolean
425
+	 */
426
+	public $use_sub_dirs = false;
427
+
428
+	/**
429
+	 * allow ambiguous resources (that are made unique by the resource handler)
430
+	 *
431
+	 * @var boolean
432
+	 */
433
+	public $allow_ambiguous_resources = false;
434
+
435
+	/**
436
+	 * merge compiled includes
437
+	 *
438
+	 * @var boolean
439
+	 */
440
+	public $merge_compiled_includes = false;
441
+
442
+	/**
443
+	 * force cache file creation
444
+	 *
445
+	 * @var boolean
446
+	 */
447
+	public $force_cache = false;
448
+
449
+	/**
450
+	 * template left-delimiter
451
+	 *
452
+	 * @var string
453
+	 */
454
+	public $left_delimiter = "{";
455
+
456
+	/**
457
+	 * template right-delimiter
458
+	 *
459
+	 * @var string
460
+	 */
461
+	public $right_delimiter = "}";
462
+
463
+	/**#@+
464 464
      * security
465 465
      */
466
-    /**
467
-     * class name
468
-     * This should be instance of Smarty_Security.
469
-     *
470
-     * @var string
471
-     * @see Smarty_Security
472
-     */
473
-    public $security_class = 'Smarty_Security';
474
-
475
-    /**
476
-     * implementation of security class
477
-     *
478
-     * @var Smarty_Security
479
-     */
480
-    public $security_policy = null;
481
-
482
-    /**
483
-     * controls handling of PHP-blocks
484
-     *
485
-     * @var integer
486
-     */
487
-    public $php_handling = self::PHP_PASSTHRU;
488
-
489
-    /**
490
-     * controls if the php template file resource is allowed
491
-     *
492
-     * @var bool
493
-     */
494
-    public $allow_php_templates = false;
495
-
496
-    /**#@-*/
497
-    /**
498
-     * debug mode
499
-     * Setting this to true enables the debug-console.
500
-     *
501
-     * @var boolean
502
-     */
503
-    public $debugging = false;
504
-
505
-    /**
506
-     * This determines if debugging is enable-able from the browser.
507
-     * <ul>
508
-     *  <li>NONE => no debugging control allowed</li>
509
-     *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
510
-     * </ul>
511
-     *
512
-     * @var string
513
-     */
514
-    public $debugging_ctrl = 'NONE';
515
-
516
-    /**
517
-     * Name of debugging URL-param.
518
-     * Only used when $debugging_ctrl is set to 'URL'.
519
-     * The name of the URL-parameter that activates debugging.
520
-     *
521
-     * @var string
522
-     */
523
-    public $smarty_debug_id = 'SMARTY_DEBUG';
524
-
525
-    /**
526
-     * Path of debug template.
527
-     *
528
-     * @var string
529
-     */
530
-    public $debug_tpl = null;
531
-
532
-    /**
533
-     * When set, smarty uses this value as error_reporting-level.
534
-     *
535
-     * @var int
536
-     */
537
-    public $error_reporting = null;
538
-
539
-    /**#@+
466
+	/**
467
+	 * class name
468
+	 * This should be instance of Smarty_Security.
469
+	 *
470
+	 * @var string
471
+	 * @see Smarty_Security
472
+	 */
473
+	public $security_class = 'Smarty_Security';
474
+
475
+	/**
476
+	 * implementation of security class
477
+	 *
478
+	 * @var Smarty_Security
479
+	 */
480
+	public $security_policy = null;
481
+
482
+	/**
483
+	 * controls handling of PHP-blocks
484
+	 *
485
+	 * @var integer
486
+	 */
487
+	public $php_handling = self::PHP_PASSTHRU;
488
+
489
+	/**
490
+	 * controls if the php template file resource is allowed
491
+	 *
492
+	 * @var bool
493
+	 */
494
+	public $allow_php_templates = false;
495
+
496
+	/**#@-*/
497
+	/**
498
+	 * debug mode
499
+	 * Setting this to true enables the debug-console.
500
+	 *
501
+	 * @var boolean
502
+	 */
503
+	public $debugging = false;
504
+
505
+	/**
506
+	 * This determines if debugging is enable-able from the browser.
507
+	 * <ul>
508
+	 *  <li>NONE => no debugging control allowed</li>
509
+	 *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
510
+	 * </ul>
511
+	 *
512
+	 * @var string
513
+	 */
514
+	public $debugging_ctrl = 'NONE';
515
+
516
+	/**
517
+	 * Name of debugging URL-param.
518
+	 * Only used when $debugging_ctrl is set to 'URL'.
519
+	 * The name of the URL-parameter that activates debugging.
520
+	 *
521
+	 * @var string
522
+	 */
523
+	public $smarty_debug_id = 'SMARTY_DEBUG';
524
+
525
+	/**
526
+	 * Path of debug template.
527
+	 *
528
+	 * @var string
529
+	 */
530
+	public $debug_tpl = null;
531
+
532
+	/**
533
+	 * When set, smarty uses this value as error_reporting-level.
534
+	 *
535
+	 * @var int
536
+	 */
537
+	public $error_reporting = null;
538
+
539
+	/**#@+
540 540
      * config var settings
541 541
      */
542 542
 
543
-    /**
544
-     * Controls whether variables with the same name overwrite each other.
545
-     *
546
-     * @var boolean
547
-     */
548
-    public $config_overwrite = true;
543
+	/**
544
+	 * Controls whether variables with the same name overwrite each other.
545
+	 *
546
+	 * @var boolean
547
+	 */
548
+	public $config_overwrite = true;
549 549
 
550
-    /**
551
-     * Controls whether config values of on/true/yes and off/false/no get converted to boolean.
552
-     *
553
-     * @var boolean
554
-     */
555
-    public $config_booleanize = true;
550
+	/**
551
+	 * Controls whether config values of on/true/yes and off/false/no get converted to boolean.
552
+	 *
553
+	 * @var boolean
554
+	 */
555
+	public $config_booleanize = true;
556 556
 
557
-    /**
558
-     * Controls whether hidden config sections/vars are read from the file.
559
-     *
560
-     * @var boolean
561
-     */
562
-    public $config_read_hidden = false;
557
+	/**
558
+	 * Controls whether hidden config sections/vars are read from the file.
559
+	 *
560
+	 * @var boolean
561
+	 */
562
+	public $config_read_hidden = false;
563 563
 
564
-    /**#@-*/
564
+	/**#@-*/
565 565
 
566
-    /**#@+
566
+	/**#@+
567 567
      * resource locking
568 568
      */
569 569
 
570
-    /**
571
-     * locking concurrent compiles
572
-     *
573
-     * @var boolean
574
-     */
575
-    public $compile_locking = true;
576
-
577
-    /**
578
-     * Controls whether cache resources should use locking mechanism
579
-     *
580
-     * @var boolean
581
-     */
582
-    public $cache_locking = false;
583
-
584
-    /**
585
-     * seconds to wait for acquiring a lock before ignoring the write lock
586
-     *
587
-     * @var float
588
-     */
589
-    public $locking_timeout = 10;
590
-
591
-    /**#@-*/
592
-
593
-    /**
594
-     * resource type used if none given
595
-     * Must be an valid key of $registered_resources.
596
-     *
597
-     * @var string
598
-     */
599
-    public $default_resource_type = 'file';
600
-
601
-    /**
602
-     * caching type
603
-     * Must be an element of $cache_resource_types.
604
-     *
605
-     * @var string
606
-     */
607
-    public $caching_type = 'file';
608
-
609
-    /**
610
-     * config type
611
-     *
612
-     * @var string
613
-     */
614
-    public $default_config_type = 'file';
615
-
616
-    /**
617
-     * check If-Modified-Since headers
618
-     *
619
-     * @var boolean
620
-     */
621
-    public $cache_modified_check = false;
622
-
623
-    /**
624
-     * registered plugins
625
-     *
626
-     * @var array
627
-     */
628
-    public $registered_plugins = array();
629
-
630
-    /**
631
-     * registered objects
632
-     *
633
-     * @var array
634
-     */
635
-    public $registered_objects = array();
636
-
637
-    /**
638
-     * registered classes
639
-     *
640
-     * @var array
641
-     */
642
-    public $registered_classes = array();
643
-
644
-    /**
645
-     * registered filters
646
-     *
647
-     * @var array
648
-     */
649
-    public $registered_filters = array();
650
-
651
-    /**
652
-     * registered resources
653
-     *
654
-     * @var array
655
-     */
656
-    public $registered_resources = array();
657
-
658
-    /**
659
-     * registered cache resources
660
-     *
661
-     * @var array
662
-     */
663
-    public $registered_cache_resources = array();
664
-
665
-    /**
666
-     * autoload filter
667
-     *
668
-     * @var array
669
-     */
670
-    public $autoload_filters = array();
671
-
672
-    /**
673
-     * default modifier
674
-     *
675
-     * @var array
676
-     */
677
-    public $default_modifiers = array();
678
-
679
-    /**
680
-     * autoescape variable output
681
-     *
682
-     * @var boolean
683
-     */
684
-    public $escape_html = false;
685
-
686
-    /**
687
-     * start time for execution time calculation
688
-     *
689
-     * @var int
690
-     */
691
-    public $start_time = 0;
692
-
693
-    /**
694
-     * required by the compiler for BC
695
-     *
696
-     * @var string
697
-     */
698
-    public $_current_file = null;
699
-
700
-    /**
701
-     * internal flag to enable parser debugging
702
-     *
703
-     * @var bool
704
-     */
705
-    public $_parserdebug = false;
706
-
707
-    /**
708
-     * This object type (Smarty = 1, template = 2, data = 4)
709
-     *
710
-     * @var int
711
-     */
712
-    public $_objType = 1;
713
-
714
-    /**
715
-     * Debug object
716
-     *
717
-     * @var Smarty_Internal_Debug
718
-     */
719
-    public $_debug = null;
720
-
721
-    /**
722
-     * removed properties
723
-     *
724
-     * @var string[]
725
-     */
726
-    private $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security',
727
-                                        '_dir_perms', '_file_perms', 'plugin_search_order',
728
-                                        'inheritance_merge_compiled_includes', 'resource_cache_mode',);
729
-
730
-    /**
731
-     * List of private properties which will call getter/setter on a direct access
732
-     *
733
-     * @var string[]
734
-     */
735
-    private $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir',
736
-                               'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir',
737
-                               'cache_dir' => 'CacheDir',);
738
-
739
-    /**#@-*/
740
-
741
-    /**
742
-     * Initialize new Smarty object
743
-     */
744
-    public function __construct()
745
-    {
746
-        parent::__construct();
747
-        if (is_callable('mb_internal_encoding')) {
748
-            mb_internal_encoding(Smarty::$_CHARSET);
749
-        }
750
-        $this->start_time = microtime(true);
751
-
752
-        if (isset($_SERVER[ 'SCRIPT_NAME' ])) {
753
-            Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]);
754
-        }
755
-
756
-        // Check if we're running on windows
757
-        Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
758
-        // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8
759
-        if (Smarty::$_CHARSET !== 'UTF-8') {
760
-            Smarty::$_UTF8_MODIFIER = '';
761
-        }
762
-    }
763
-
764
-    /**
765
-     * Check if a template resource exists
766
-     *
767
-     * @param  string $resource_name template name
768
-     *
769
-     * @return boolean status
770
-     */
771
-    public function templateExists($resource_name)
772
-    {
773
-        // create source object
774
-        $source = Smarty_Template_Source::load(null, $this, $resource_name);
775
-        return $source->exists;
776
-    }
777
-
778
-    /**
779
-     * Loads security class and enables security
780
-     *
781
-     * @param  string|Smarty_Security $security_class if a string is used, it must be class-name
782
-     *
783
-     * @return Smarty                 current Smarty instance for chaining
784
-     * @throws SmartyException        when an invalid class name is provided
785
-     */
786
-    public function enableSecurity($security_class = null)
787
-    {
788
-        Smarty_Security::enableSecurity($this, $security_class);
789
-        return $this;
790
-    }
791
-
792
-    /**
793
-     * Disable security
794
-     *
795
-     * @return Smarty current Smarty instance for chaining
796
-     */
797
-    public function disableSecurity()
798
-    {
799
-        $this->security_policy = null;
800
-
801
-        return $this;
802
-    }
803
-
804
-    /**
805
-     * Set template directory
806
-     *
807
-     * @param  string|array $template_dir directory(s) of template sources
808
-     * @param bool          $isConfig     true for config_dir
809
-     *
810
-     * @return \Smarty current Smarty instance for chaining
811
-     */
812
-    public function setTemplateDir($template_dir, $isConfig = false)
813
-    {
814
-        if ($isConfig) {
815
-            $this->config_dir = array();
816
-            $this->_processedConfigDir = array();
817
-        } else {
818
-            $this->template_dir = array();
819
-            $this->_processedTemplateDir = array();
820
-        }
821
-        $this->addTemplateDir($template_dir, null, $isConfig);
822
-        return $this;
823
-    }
824
-
825
-    /**
826
-     * Add template directory(s)
827
-     *
828
-     * @param  string|array $template_dir directory(s) of template sources
829
-     * @param  string       $key          of the array element to assign the template dir to
830
-     * @param bool          $isConfig     true for config_dir
831
-     *
832
-     * @return Smarty          current Smarty instance for chaining
833
-     */
834
-    public function addTemplateDir($template_dir, $key = null, $isConfig = false)
835
-    {
836
-        if ($isConfig) {
837
-            $processed = &$this->_processedConfigDir;
838
-            $dir = &$this->config_dir;
839
-            $this->_configDirNormalized = false;
840
-        } else {
841
-            $processed = &$this->_processedTemplateDir;
842
-            $dir = &$this->template_dir;
843
-            $this->_templateDirNormalized = false;
844
-        }
845
-        if (is_array($template_dir)) {
846
-            foreach ($template_dir as $k => $v) {
847
-                if (is_int($k)) {
848
-                    // indexes are not merged but appended
849
-                    $dir[] = $v;
850
-                } else {
851
-                    // string indexes are overridden
852
-                    $dir[ $k ] = $v;
853
-                    unset($processed[ $key ]);
854
-                }
855
-            }
856
-        } else {
857
-            if ($key !== null) {
858
-                // override directory at specified index
859
-                $dir[ $key ] = $template_dir;
860
-                unset($processed[ $key ]);
861
-            } else {
862
-                // append new directory
863
-                $dir[] = $template_dir;
864
-            }
865
-        }
866
-        return $this;
867
-    }
868
-
869
-    /**
870
-     * Get template directories
871
-     *
872
-     * @param mixed $index    index of directory to get, null to get all
873
-     * @param bool  $isConfig true for config_dir
874
-     *
875
-     * @return array list of template directories, or directory of $index
876
-     */
877
-    public function getTemplateDir($index = null, $isConfig = false)
878
-    {
879
-        if ($isConfig) {
880
-            $dir = &$this->config_dir;
881
-        } else {
882
-            $dir = &$this->template_dir;
883
-        }
884
-        if ($isConfig ? !$this->_configDirNormalized : !$this->_templateDirNormalized) {
885
-            $this->_nomalizeTemplateConfig($isConfig);
886
-        }
887
-        if ($index !== null) {
888
-            return isset($dir[ $index ]) ? $dir[ $index ] : null;
889
-        }
890
-        return $dir;
891
-    }
892
-
893
-    /**
894
-     * Set config directory
895
-     *
896
-     * @param $config_dir
897
-     *
898
-     * @return Smarty       current Smarty instance for chaining
899
-     */
900
-    public function setConfigDir($config_dir)
901
-    {
902
-        return $this->setTemplateDir($config_dir, true);
903
-    }
904
-
905
-    /**
906
-     * Add config directory(s)
907
-     *
908
-     * @param string|array $config_dir directory(s) of config sources
909
-     * @param mixed        $key        key of the array element to assign the config dir to
910
-     *
911
-     * @return Smarty current Smarty instance for chaining
912
-     */
913
-    public function addConfigDir($config_dir, $key = null)
914
-    {
915
-        return $this->addTemplateDir($config_dir, $key, true);
916
-    }
917
-
918
-    /**
919
-     * Get config directory
920
-     *
921
-     * @param mixed $index index of directory to get, null to get all
922
-     *
923
-     * @return array configuration directory
924
-     */
925
-    public function getConfigDir($index = null)
926
-    {
927
-        return $this->getTemplateDir($index, true);
928
-    }
929
-
930
-    /**
931
-     * Set plugins directory
932
-     *
933
-     * @param  string|array $plugins_dir directory(s) of plugins
934
-     *
935
-     * @return Smarty       current Smarty instance for chaining
936
-     */
937
-    public function setPluginsDir($plugins_dir)
938
-    {
939
-        $this->plugins_dir = (array) $plugins_dir;
940
-        $this->_pluginsDirNormalized = false;
941
-        return $this;
942
-    }
943
-
944
-    /**
945
-     * Adds directory of plugin files
946
-     *
947
-     * @param null|array $plugins_dir
948
-     *
949
-     * @return Smarty current Smarty instance for chaining
950
-     */
951
-    public function addPluginsDir($plugins_dir)
952
-    {
953
-        if (empty($this->plugins_dir)) {
954
-            $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
955
-        }
956
-        $this->plugins_dir = array_merge($this->plugins_dir, (array) $plugins_dir);
957
-        $this->_pluginsDirNormalized = false;
958
-        return $this;
959
-    }
960
-
961
-    /**
962
-     * Get plugin directories
963
-     *
964
-     * @return array list of plugin directories
965
-     */
966
-    public function getPluginsDir()
967
-    {
968
-        if (empty($this->plugins_dir)) {
969
-            $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
970
-            $this->_pluginsDirNormalized = false;
971
-        }
972
-        if (!$this->_pluginsDirNormalized) {
973
-            if (!is_array($this->plugins_dir)) {
974
-                $this->plugins_dir = (array) $this->plugins_dir;
975
-            }
976
-            foreach ($this->plugins_dir as $k => $v) {
977
-                $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . DS, true);
978
-            }
979
-            $this->_cache[ 'plugin_files' ] = array();
980
-            $this->_pluginsDirNormalized = true;
981
-        }
982
-        return $this->plugins_dir;
983
-    }
984
-
985
-    /**
986
-     *
987
-     * @param  string $compile_dir directory to store compiled templates in
988
-     *
989
-     * @return Smarty current Smarty instance for chaining
990
-     */
991
-    public function setCompileDir($compile_dir)
992
-    {
993
-        $this->_normalizeDir('compile_dir', $compile_dir);
994
-        $this->_compileDirNormalized = true;
995
-        return $this;
996
-    }
997
-
998
-    /**
999
-     * Get compiled directory
1000
-     *
1001
-     * @return string path to compiled templates
1002
-     */
1003
-    public function getCompileDir()
1004
-    {
1005
-        if (!$this->_compileDirNormalized) {
1006
-            $this->_normalizeDir('compile_dir', $this->compile_dir);
1007
-            $this->_compileDirNormalized = true;
1008
-        }
1009
-        return $this->compile_dir;
1010
-    }
1011
-
1012
-    /**
1013
-     * Set cache directory
1014
-     *
1015
-     * @param  string $cache_dir directory to store cached templates in
1016
-     *
1017
-     * @return Smarty current Smarty instance for chaining
1018
-     */
1019
-    public function setCacheDir($cache_dir)
1020
-    {
1021
-        $this->_normalizeDir('cache_dir', $cache_dir);
1022
-        $this->_cacheDirNormalized = true;
1023
-        return $this;
1024
-    }
1025
-
1026
-    /**
1027
-     * Get cache directory
1028
-     *
1029
-     * @return string path of cache directory
1030
-     */
1031
-    public function getCacheDir()
1032
-    {
1033
-        if (!$this->_cacheDirNormalized) {
1034
-            $this->_normalizeDir('cache_dir', $this->cache_dir);
1035
-            $this->_cacheDirNormalized = true;
1036
-        }
1037
-        return $this->cache_dir;
1038
-    }
1039
-
1040
-    /**
1041
-     * Normalize and set directory string
1042
-     *
1043
-     * @param string $dirName cache_dir or compile_dir
1044
-     * @param string $dir     filepath of folder
1045
-     */
1046
-    private function _normalizeDir($dirName, $dir)
1047
-    {
1048
-        $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DS, true);
1049
-        if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) {
1050
-            Smarty::$_muted_directories[ $this->{$dirName} ] = null;
1051
-        }
1052
-    }
1053
-
1054
-    /**
1055
-     * Normalize template_dir or config_dir
1056
-     *
1057
-     * @param bool $isConfig true for config_dir
1058
-     *
1059
-     */
1060
-    private function _nomalizeTemplateConfig($isConfig)
1061
-    {
1062
-        if ($isConfig) {
1063
-            $processed = &$this->_processedConfigDir;
1064
-            $dir = &$this->config_dir;
1065
-        } else {
1066
-            $processed = &$this->_processedTemplateDir;
1067
-            $dir = &$this->template_dir;
1068
-        }
1069
-        if (!is_array($dir)) {
1070
-            $dir = (array) $dir;
1071
-        }
1072
-        foreach ($dir as $k => $v) {
1073
-            if (!isset($processed[ $k ])) {
1074
-                $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DS, true);
1075
-                $processed[ $k ] = true;
1076
-            }
1077
-        }
1078
-        $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true;
1079
-        $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) :
1080
-            $this->_joined_template_dir = join('#', $this->template_dir);
1081
-    }
1082
-
1083
-    /**
1084
-     * creates a template object
1085
-     *
1086
-     * @param  string  $template   the resource handle of the template file
1087
-     * @param  mixed   $cache_id   cache id to be used with this template
1088
-     * @param  mixed   $compile_id compile id to be used with this template
1089
-     * @param  object  $parent     next higher level of Smarty variables
1090
-     * @param  boolean $do_clone   flag is Smarty object shall be cloned
1091
-     *
1092
-     * @return object  template object
1093
-     */
1094
-    public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
1095
-    {
1096
-        if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
1097
-            $parent = $cache_id;
1098
-            $cache_id = null;
1099
-        }
1100
-        if ($parent !== null && is_array($parent)) {
1101
-            $data = $parent;
1102
-            $parent = null;
1103
-        } else {
1104
-            $data = null;
1105
-        }
1106
-        $_templateId = $this->_getTemplateId($template, $cache_id, $compile_id);
1107
-        $tpl = null;
1108
-        if ($this->caching && isset($this->_cache[ 'isCached' ][ $_templateId ])) {
1109
-            $tpl = $do_clone ? clone $this->_cache[ 'isCached' ][ $_templateId ] :
1110
-                $this->_cache[ 'isCached' ][ $_templateId ];
1111
-            $tpl->tpl_vars = $tpl->config_vars = array();
1112
-        } else if (!$do_clone && isset($this->_cache[ 'tplObjects' ][ $_templateId ])) {
1113
-            $tpl = clone $this->_cache[ 'tplObjects' ][ $_templateId ];
1114
-        } else {
1115
-            /* @var Smarty_Internal_Template $tpl */
1116
-            $tpl = new $this->template_class($template, $this, null, $cache_id, $compile_id, null, null);
1117
-            $tpl->templateId = $_templateId;
1118
-        }
1119
-        if ($do_clone) {
1120
-            $tpl->smarty = clone $tpl->smarty;
1121
-        }
1122
-        $tpl->parent = $parent ? $parent : $this;
1123
-        // fill data if present
1124
-        if (!empty($data) && is_array($data)) {
1125
-            // set up variable values
1126
-            foreach ($data as $_key => $_val) {
1127
-                $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val);
1128
-            }
1129
-        }
1130
-        if ($this->debugging || $this->debugging_ctrl == 'URL') {
1131
-            $tpl->smarty->_debug = new Smarty_Internal_Debug();
1132
-            // check URL debugging control
1133
-            if (!$this->debugging && $this->debugging_ctrl == 'URL') {
1134
-                $tpl->smarty->_debug->debugUrl($tpl->smarty);
1135
-            }
1136
-        }
1137
-        return $tpl;
1138
-    }
1139
-
1140
-    /**
1141
-     * Takes unknown classes and loads plugin files for them
1142
-     * class name format: Smarty_PluginType_PluginName
1143
-     * plugin filename format: plugintype.pluginname.php
1144
-     *
1145
-     * @param  string $plugin_name class plugin name to load
1146
-     * @param  bool   $check       check if already loaded
1147
-     *
1148
-     * @throws SmartyException
1149
-     * @return string |boolean filepath of loaded file or false
1150
-     */
1151
-    public function loadPlugin($plugin_name, $check = true)
1152
-    {
1153
-        return $this->ext->loadPlugin->loadPlugin($this, $plugin_name, $check);
1154
-    }
1155
-
1156
-    /**
1157
-     * Get unique template id
1158
-     *
1159
-     * @param string                    $template_name
1160
-     * @param null|mixed                $cache_id
1161
-     * @param null|mixed                $compile_id
1162
-     * @param null                      $caching
1163
-     * @param \Smarty_Internal_Template $template
1164
-     *
1165
-     * @return string
1166
-     */
1167
-    public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null,
1168
-                                   Smarty_Internal_Template $template = null)
1169
-    {
1170
-        $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
1171
-            $template_name;
1172
-        $cache_id = $cache_id === null ? $this->cache_id : $cache_id;
1173
-        $compile_id = $compile_id === null ? $this->compile_id : $compile_id;
1174
-        $caching = (int) ($caching === null ? $this->caching : $caching);
1175
-
1176
-        if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) {
1177
-            $_templateId =
1178
-                Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) .
1179
-                "#{$cache_id}#{$compile_id}#{$caching}";
1180
-        } else {
1181
-            $_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}";
1182
-        }
1183
-        if (isset($_templateId[ 150 ])) {
1184
-            $_templateId = sha1($_templateId);
1185
-        }
1186
-        return $_templateId;
1187
-    }
1188
-
1189
-    /**
1190
-     * Normalize path
1191
-     *  - remove /./ and /../
1192
-     *  - make it absolute if required
1193
-     *
1194
-     * @param string $path      file path
1195
-     * @param bool   $realpath  if true - convert to absolute
1196
-     *                          false - convert to relative
1197
-     *                          null - keep as it is but remove /./ /../
1198
-     *
1199
-     * @return string
1200
-     */
1201
-    public function _realpath($path, $realpath = null)
1202
-    {
1203
-        $nds = DS == '/' ? '\\' : '/';
1204
-        // normalize DS 
1205
-        $path = str_replace($nds, DS, $path);
1206
-        preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%',
1207
-                   $path, $parts);
1208
-        $path = $parts[ 'path' ];
1209
-        if ($parts[ 'root' ] == '\\') {
1210
-            $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
1211
-        } else {
1212
-            if ($realpath !== null && !$parts[ 'root' ]) {
1213
-                $path = getcwd() . DS . $path;
1214
-            }
1215
-        }
1216
-        // remove noop 'DS DS' and 'DS.DS' patterns
1217
-        $path = preg_replace('#([\\\\/]([.]?[\\\\/])+)#', DS, $path);
1218
-        // resolve '..DS' pattern, smallest first
1219
-        if (strpos($path, '..' . DS) != false &&
1220
-            preg_match_all('#(([.]?[\\\\/])*([.][.])[\\\\/]([.]?[\\\\/])*)+#', $path, $match)
1221
-        ) {
1222
-            $counts = array();
1223
-            foreach ($match[ 0 ] as $m) {
1224
-                $counts[] = (int) ((strlen($m) - 1) / 3);
1225
-            }
1226
-            sort($counts);
1227
-            foreach ($counts as $count) {
1228
-                $path = preg_replace('#(([\\\\/]([.]?[\\\\/])*[^\\\\/.]+){' . $count .
1229
-                                     '}[\\\\/]([.]?[\\\\/])*([.][.][\\\\/]([.]?[\\\\/])*){' . $count . '})(?=[^.])#',
1230
-                                     DS, $path);
1231
-            }
1232
-        }
1233
-
1234
-        return $parts[ 'root' ] . $path;
1235
-    }
1236
-
1237
-    /**
1238
-     * Empty template objects cache
1239
-     */
1240
-    public function _clearTemplateCache()
1241
-    {
1242
-        $this->_cache[ 'isCached' ] = array();
1243
-        $this->_cache[ 'tplObjects' ] = array();
1244
-    }
1245
-
1246
-    /**
1247
-     * @param boolean $compile_check
1248
-     */
1249
-    public function setCompileCheck($compile_check)
1250
-    {
1251
-        $this->compile_check = $compile_check;
1252
-    }
1253
-
1254
-    /**
1255
-     * @param boolean $use_sub_dirs
1256
-     */
1257
-    public function setUseSubDirs($use_sub_dirs)
1258
-    {
1259
-        $this->use_sub_dirs = $use_sub_dirs;
1260
-    }
1261
-
1262
-    /**
1263
-     * @param int $error_reporting
1264
-     */
1265
-    public function setErrorReporting($error_reporting)
1266
-    {
1267
-        $this->error_reporting = $error_reporting;
1268
-    }
1269
-
1270
-    /**
1271
-     * @param boolean $escape_html
1272
-     */
1273
-    public function setEscapeHtml($escape_html)
1274
-    {
1275
-        $this->escape_html = $escape_html;
1276
-    }
1277
-
1278
-    /**
1279
-     * @param boolean $auto_literal
1280
-     */
1281
-    public function setAutoLiteral($auto_literal)
1282
-    {
1283
-        $this->auto_literal = $auto_literal;
1284
-    }
1285
-
1286
-    /**
1287
-     * @param boolean $force_compile
1288
-     */
1289
-    public function setForceCompile($force_compile)
1290
-    {
1291
-        $this->force_compile = $force_compile;
1292
-    }
1293
-
1294
-    /**
1295
-     * @param boolean $merge_compiled_includes
1296
-     */
1297
-    public function setMergeCompiledIncludes($merge_compiled_includes)
1298
-    {
1299
-        $this->merge_compiled_includes = $merge_compiled_includes;
1300
-    }
1301
-
1302
-    /**
1303
-     * @param string $left_delimiter
1304
-     */
1305
-    public function setLeftDelimiter($left_delimiter)
1306
-    {
1307
-        $this->left_delimiter = $left_delimiter;
1308
-    }
1309
-
1310
-    /**
1311
-     * @param string $right_delimiter
1312
-     */
1313
-    public function setRightDelimiter($right_delimiter)
1314
-    {
1315
-        $this->right_delimiter = $right_delimiter;
1316
-    }
1317
-
1318
-    /**
1319
-     * @param boolean $debugging
1320
-     */
1321
-    public function setDebugging($debugging)
1322
-    {
1323
-        $this->debugging = $debugging;
1324
-    }
1325
-
1326
-    /**
1327
-     * @param boolean $config_overwrite
1328
-     */
1329
-    public function setConfigOverwrite($config_overwrite)
1330
-    {
1331
-        $this->config_overwrite = $config_overwrite;
1332
-    }
1333
-
1334
-    /**
1335
-     * @param boolean $config_booleanize
1336
-     */
1337
-    public function setConfigBooleanize($config_booleanize)
1338
-    {
1339
-        $this->config_booleanize = $config_booleanize;
1340
-    }
1341
-
1342
-    /**
1343
-     * @param boolean $config_read_hidden
1344
-     */
1345
-    public function setConfigReadHidden($config_read_hidden)
1346
-    {
1347
-        $this->config_read_hidden = $config_read_hidden;
1348
-    }
1349
-
1350
-    /**
1351
-     * @param boolean $compile_locking
1352
-     */
1353
-    public function setCompileLocking($compile_locking)
1354
-    {
1355
-        $this->compile_locking = $compile_locking;
1356
-    }
1357
-
1358
-    /**
1359
-     * @param string $default_resource_type
1360
-     */
1361
-    public function setDefaultResourceType($default_resource_type)
1362
-    {
1363
-        $this->default_resource_type = $default_resource_type;
1364
-    }
1365
-
1366
-    /**
1367
-     * @param string $caching_type
1368
-     */
1369
-    public function setCachingType($caching_type)
1370
-    {
1371
-        $this->caching_type = $caching_type;
1372
-    }
1373
-
1374
-    /**
1375
-     * Test install
1376
-     *
1377
-     * @param null $errors
1378
-     */
1379
-    public function testInstall(&$errors = null)
1380
-    {
1381
-        Smarty_Internal_TestInstall::testInstall($this, $errors);
1382
-    }
1383
-
1384
-    /**
1385
-     * <<magic>> Generic getter.
1386
-     * Calls the appropriate getter function.
1387
-     * Issues an E_USER_NOTICE if no valid getter is found.
1388
-     *
1389
-     * @param  string $name property name
1390
-     *
1391
-     * @return mixed
1392
-     */
1393
-    public function __get($name)
1394
-    {
1395
-        if (isset($this->accessMap[ $name ])) {
1396
-            $method = 'get' . $this->accessMap[ $name ];
1397
-            return $this->{$method}();
1398
-        } elseif (isset($this->_cache[ $name ])) {
1399
-            return $this->_cache[ $name ];
1400
-        } elseif (in_array($name, $this->obsoleteProperties)) {
1401
-            return null;
1402
-        } else {
1403
-            trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
1404
-        }
1405
-        return null;
1406
-    }
1407
-
1408
-    /**
1409
-     * <<magic>> Generic setter.
1410
-     * Calls the appropriate setter function.
1411
-     * Issues an E_USER_NOTICE if no valid setter is found.
1412
-     *
1413
-     * @param string $name  property name
1414
-     * @param mixed  $value parameter passed to setter
1415
-     */
1416
-    public function __set($name, $value)
1417
-    {
1418
-        if (isset($this->accessMap[ $name ])) {
1419
-            $method = 'set' . $this->accessMap[ $name ];
1420
-            $this->{$method}($value);
1421
-        } elseif (in_array($name, $this->obsoleteProperties)) {
1422
-            return;
1423
-        } else {
1424
-            if (is_object($value) && method_exists($value, $name)) {
1425
-                $this->$name = $value;
1426
-            } else {
1427
-                trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
1428
-            }
1429
-        }
1430
-    }
1431
-
1432
-    /**
1433
-     * Error Handler to mute expected messages
1434
-     *
1435
-     * @link http://php.net/set_error_handler
1436
-     *
1437
-     * @param  integer $errno Error level
1438
-     * @param          $errstr
1439
-     * @param          $errfile
1440
-     * @param          $errline
1441
-     * @param          $errcontext
1442
-     *
1443
-     * @return bool|void
1444
-     */
1445
-    public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
1446
-    {
1447
-        $_is_muted_directory = false;
1448
-
1449
-        // add the SMARTY_DIR to the list of muted directories
1450
-        if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) {
1451
-            $smarty_dir = realpath(SMARTY_DIR);
1452
-            if ($smarty_dir !== false) {
1453
-                Smarty::$_muted_directories[ SMARTY_DIR ] =
1454
-                    array('file' => $smarty_dir, 'length' => strlen($smarty_dir),);
1455
-            }
1456
-        }
1457
-
1458
-        // walk the muted directories and test against $errfile
1459
-        foreach (Smarty::$_muted_directories as $key => &$dir) {
1460
-            if (!$dir) {
1461
-                // resolve directory and length for speedy comparisons
1462
-                $file = realpath($key);
1463
-                if ($file === false) {
1464
-                    // this directory does not exist, remove and skip it
1465
-                    unset(Smarty::$_muted_directories[ $key ]);
1466
-                    continue;
1467
-                }
1468
-                $dir = array('file' => $file, 'length' => strlen($file),);
1469
-            }
1470
-            if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) {
1471
-                $_is_muted_directory = true;
1472
-                break;
1473
-            }
1474
-        }
1475
-        // pass to next error handler if this error did not occur inside SMARTY_DIR
1476
-        // or the error was within smarty but masked to be ignored
1477
-        if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
1478
-            if (Smarty::$_previous_error_handler) {
1479
-                return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline,
1480
-                                      $errcontext);
1481
-            } else {
1482
-                return false;
1483
-            }
1484
-        }
1485
-        return;
1486
-    }
1487
-
1488
-    /**
1489
-     * Enable error handler to mute expected messages
1490
-     *
1491
-     * @return void
1492
-     */
1493
-    public static function muteExpectedErrors()
1494
-    {
1495
-        /*
570
+	/**
571
+	 * locking concurrent compiles
572
+	 *
573
+	 * @var boolean
574
+	 */
575
+	public $compile_locking = true;
576
+
577
+	/**
578
+	 * Controls whether cache resources should use locking mechanism
579
+	 *
580
+	 * @var boolean
581
+	 */
582
+	public $cache_locking = false;
583
+
584
+	/**
585
+	 * seconds to wait for acquiring a lock before ignoring the write lock
586
+	 *
587
+	 * @var float
588
+	 */
589
+	public $locking_timeout = 10;
590
+
591
+	/**#@-*/
592
+
593
+	/**
594
+	 * resource type used if none given
595
+	 * Must be an valid key of $registered_resources.
596
+	 *
597
+	 * @var string
598
+	 */
599
+	public $default_resource_type = 'file';
600
+
601
+	/**
602
+	 * caching type
603
+	 * Must be an element of $cache_resource_types.
604
+	 *
605
+	 * @var string
606
+	 */
607
+	public $caching_type = 'file';
608
+
609
+	/**
610
+	 * config type
611
+	 *
612
+	 * @var string
613
+	 */
614
+	public $default_config_type = 'file';
615
+
616
+	/**
617
+	 * check If-Modified-Since headers
618
+	 *
619
+	 * @var boolean
620
+	 */
621
+	public $cache_modified_check = false;
622
+
623
+	/**
624
+	 * registered plugins
625
+	 *
626
+	 * @var array
627
+	 */
628
+	public $registered_plugins = array();
629
+
630
+	/**
631
+	 * registered objects
632
+	 *
633
+	 * @var array
634
+	 */
635
+	public $registered_objects = array();
636
+
637
+	/**
638
+	 * registered classes
639
+	 *
640
+	 * @var array
641
+	 */
642
+	public $registered_classes = array();
643
+
644
+	/**
645
+	 * registered filters
646
+	 *
647
+	 * @var array
648
+	 */
649
+	public $registered_filters = array();
650
+
651
+	/**
652
+	 * registered resources
653
+	 *
654
+	 * @var array
655
+	 */
656
+	public $registered_resources = array();
657
+
658
+	/**
659
+	 * registered cache resources
660
+	 *
661
+	 * @var array
662
+	 */
663
+	public $registered_cache_resources = array();
664
+
665
+	/**
666
+	 * autoload filter
667
+	 *
668
+	 * @var array
669
+	 */
670
+	public $autoload_filters = array();
671
+
672
+	/**
673
+	 * default modifier
674
+	 *
675
+	 * @var array
676
+	 */
677
+	public $default_modifiers = array();
678
+
679
+	/**
680
+	 * autoescape variable output
681
+	 *
682
+	 * @var boolean
683
+	 */
684
+	public $escape_html = false;
685
+
686
+	/**
687
+	 * start time for execution time calculation
688
+	 *
689
+	 * @var int
690
+	 */
691
+	public $start_time = 0;
692
+
693
+	/**
694
+	 * required by the compiler for BC
695
+	 *
696
+	 * @var string
697
+	 */
698
+	public $_current_file = null;
699
+
700
+	/**
701
+	 * internal flag to enable parser debugging
702
+	 *
703
+	 * @var bool
704
+	 */
705
+	public $_parserdebug = false;
706
+
707
+	/**
708
+	 * This object type (Smarty = 1, template = 2, data = 4)
709
+	 *
710
+	 * @var int
711
+	 */
712
+	public $_objType = 1;
713
+
714
+	/**
715
+	 * Debug object
716
+	 *
717
+	 * @var Smarty_Internal_Debug
718
+	 */
719
+	public $_debug = null;
720
+
721
+	/**
722
+	 * removed properties
723
+	 *
724
+	 * @var string[]
725
+	 */
726
+	private $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security',
727
+										'_dir_perms', '_file_perms', 'plugin_search_order',
728
+										'inheritance_merge_compiled_includes', 'resource_cache_mode',);
729
+
730
+	/**
731
+	 * List of private properties which will call getter/setter on a direct access
732
+	 *
733
+	 * @var string[]
734
+	 */
735
+	private $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir',
736
+							   'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir',
737
+							   'cache_dir' => 'CacheDir',);
738
+
739
+	/**#@-*/
740
+
741
+	/**
742
+	 * Initialize new Smarty object
743
+	 */
744
+	public function __construct()
745
+	{
746
+		parent::__construct();
747
+		if (is_callable('mb_internal_encoding')) {
748
+			mb_internal_encoding(Smarty::$_CHARSET);
749
+		}
750
+		$this->start_time = microtime(true);
751
+
752
+		if (isset($_SERVER[ 'SCRIPT_NAME' ])) {
753
+			Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]);
754
+		}
755
+
756
+		// Check if we're running on windows
757
+		Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
758
+		// let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8
759
+		if (Smarty::$_CHARSET !== 'UTF-8') {
760
+			Smarty::$_UTF8_MODIFIER = '';
761
+		}
762
+	}
763
+
764
+	/**
765
+	 * Check if a template resource exists
766
+	 *
767
+	 * @param  string $resource_name template name
768
+	 *
769
+	 * @return boolean status
770
+	 */
771
+	public function templateExists($resource_name)
772
+	{
773
+		// create source object
774
+		$source = Smarty_Template_Source::load(null, $this, $resource_name);
775
+		return $source->exists;
776
+	}
777
+
778
+	/**
779
+	 * Loads security class and enables security
780
+	 *
781
+	 * @param  string|Smarty_Security $security_class if a string is used, it must be class-name
782
+	 *
783
+	 * @return Smarty                 current Smarty instance for chaining
784
+	 * @throws SmartyException        when an invalid class name is provided
785
+	 */
786
+	public function enableSecurity($security_class = null)
787
+	{
788
+		Smarty_Security::enableSecurity($this, $security_class);
789
+		return $this;
790
+	}
791
+
792
+	/**
793
+	 * Disable security
794
+	 *
795
+	 * @return Smarty current Smarty instance for chaining
796
+	 */
797
+	public function disableSecurity()
798
+	{
799
+		$this->security_policy = null;
800
+
801
+		return $this;
802
+	}
803
+
804
+	/**
805
+	 * Set template directory
806
+	 *
807
+	 * @param  string|array $template_dir directory(s) of template sources
808
+	 * @param bool          $isConfig     true for config_dir
809
+	 *
810
+	 * @return \Smarty current Smarty instance for chaining
811
+	 */
812
+	public function setTemplateDir($template_dir, $isConfig = false)
813
+	{
814
+		if ($isConfig) {
815
+			$this->config_dir = array();
816
+			$this->_processedConfigDir = array();
817
+		} else {
818
+			$this->template_dir = array();
819
+			$this->_processedTemplateDir = array();
820
+		}
821
+		$this->addTemplateDir($template_dir, null, $isConfig);
822
+		return $this;
823
+	}
824
+
825
+	/**
826
+	 * Add template directory(s)
827
+	 *
828
+	 * @param  string|array $template_dir directory(s) of template sources
829
+	 * @param  string       $key          of the array element to assign the template dir to
830
+	 * @param bool          $isConfig     true for config_dir
831
+	 *
832
+	 * @return Smarty          current Smarty instance for chaining
833
+	 */
834
+	public function addTemplateDir($template_dir, $key = null, $isConfig = false)
835
+	{
836
+		if ($isConfig) {
837
+			$processed = &$this->_processedConfigDir;
838
+			$dir = &$this->config_dir;
839
+			$this->_configDirNormalized = false;
840
+		} else {
841
+			$processed = &$this->_processedTemplateDir;
842
+			$dir = &$this->template_dir;
843
+			$this->_templateDirNormalized = false;
844
+		}
845
+		if (is_array($template_dir)) {
846
+			foreach ($template_dir as $k => $v) {
847
+				if (is_int($k)) {
848
+					// indexes are not merged but appended
849
+					$dir[] = $v;
850
+				} else {
851
+					// string indexes are overridden
852
+					$dir[ $k ] = $v;
853
+					unset($processed[ $key ]);
854
+				}
855
+			}
856
+		} else {
857
+			if ($key !== null) {
858
+				// override directory at specified index
859
+				$dir[ $key ] = $template_dir;
860
+				unset($processed[ $key ]);
861
+			} else {
862
+				// append new directory
863
+				$dir[] = $template_dir;
864
+			}
865
+		}
866
+		return $this;
867
+	}
868
+
869
+	/**
870
+	 * Get template directories
871
+	 *
872
+	 * @param mixed $index    index of directory to get, null to get all
873
+	 * @param bool  $isConfig true for config_dir
874
+	 *
875
+	 * @return array list of template directories, or directory of $index
876
+	 */
877
+	public function getTemplateDir($index = null, $isConfig = false)
878
+	{
879
+		if ($isConfig) {
880
+			$dir = &$this->config_dir;
881
+		} else {
882
+			$dir = &$this->template_dir;
883
+		}
884
+		if ($isConfig ? !$this->_configDirNormalized : !$this->_templateDirNormalized) {
885
+			$this->_nomalizeTemplateConfig($isConfig);
886
+		}
887
+		if ($index !== null) {
888
+			return isset($dir[ $index ]) ? $dir[ $index ] : null;
889
+		}
890
+		return $dir;
891
+	}
892
+
893
+	/**
894
+	 * Set config directory
895
+	 *
896
+	 * @param $config_dir
897
+	 *
898
+	 * @return Smarty       current Smarty instance for chaining
899
+	 */
900
+	public function setConfigDir($config_dir)
901
+	{
902
+		return $this->setTemplateDir($config_dir, true);
903
+	}
904
+
905
+	/**
906
+	 * Add config directory(s)
907
+	 *
908
+	 * @param string|array $config_dir directory(s) of config sources
909
+	 * @param mixed        $key        key of the array element to assign the config dir to
910
+	 *
911
+	 * @return Smarty current Smarty instance for chaining
912
+	 */
913
+	public function addConfigDir($config_dir, $key = null)
914
+	{
915
+		return $this->addTemplateDir($config_dir, $key, true);
916
+	}
917
+
918
+	/**
919
+	 * Get config directory
920
+	 *
921
+	 * @param mixed $index index of directory to get, null to get all
922
+	 *
923
+	 * @return array configuration directory
924
+	 */
925
+	public function getConfigDir($index = null)
926
+	{
927
+		return $this->getTemplateDir($index, true);
928
+	}
929
+
930
+	/**
931
+	 * Set plugins directory
932
+	 *
933
+	 * @param  string|array $plugins_dir directory(s) of plugins
934
+	 *
935
+	 * @return Smarty       current Smarty instance for chaining
936
+	 */
937
+	public function setPluginsDir($plugins_dir)
938
+	{
939
+		$this->plugins_dir = (array) $plugins_dir;
940
+		$this->_pluginsDirNormalized = false;
941
+		return $this;
942
+	}
943
+
944
+	/**
945
+	 * Adds directory of plugin files
946
+	 *
947
+	 * @param null|array $plugins_dir
948
+	 *
949
+	 * @return Smarty current Smarty instance for chaining
950
+	 */
951
+	public function addPluginsDir($plugins_dir)
952
+	{
953
+		if (empty($this->plugins_dir)) {
954
+			$this->plugins_dir[] = SMARTY_PLUGINS_DIR;
955
+		}
956
+		$this->plugins_dir = array_merge($this->plugins_dir, (array) $plugins_dir);
957
+		$this->_pluginsDirNormalized = false;
958
+		return $this;
959
+	}
960
+
961
+	/**
962
+	 * Get plugin directories
963
+	 *
964
+	 * @return array list of plugin directories
965
+	 */
966
+	public function getPluginsDir()
967
+	{
968
+		if (empty($this->plugins_dir)) {
969
+			$this->plugins_dir[] = SMARTY_PLUGINS_DIR;
970
+			$this->_pluginsDirNormalized = false;
971
+		}
972
+		if (!$this->_pluginsDirNormalized) {
973
+			if (!is_array($this->plugins_dir)) {
974
+				$this->plugins_dir = (array) $this->plugins_dir;
975
+			}
976
+			foreach ($this->plugins_dir as $k => $v) {
977
+				$this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . DS, true);
978
+			}
979
+			$this->_cache[ 'plugin_files' ] = array();
980
+			$this->_pluginsDirNormalized = true;
981
+		}
982
+		return $this->plugins_dir;
983
+	}
984
+
985
+	/**
986
+	 *
987
+	 * @param  string $compile_dir directory to store compiled templates in
988
+	 *
989
+	 * @return Smarty current Smarty instance for chaining
990
+	 */
991
+	public function setCompileDir($compile_dir)
992
+	{
993
+		$this->_normalizeDir('compile_dir', $compile_dir);
994
+		$this->_compileDirNormalized = true;
995
+		return $this;
996
+	}
997
+
998
+	/**
999
+	 * Get compiled directory
1000
+	 *
1001
+	 * @return string path to compiled templates
1002
+	 */
1003
+	public function getCompileDir()
1004
+	{
1005
+		if (!$this->_compileDirNormalized) {
1006
+			$this->_normalizeDir('compile_dir', $this->compile_dir);
1007
+			$this->_compileDirNormalized = true;
1008
+		}
1009
+		return $this->compile_dir;
1010
+	}
1011
+
1012
+	/**
1013
+	 * Set cache directory
1014
+	 *
1015
+	 * @param  string $cache_dir directory to store cached templates in
1016
+	 *
1017
+	 * @return Smarty current Smarty instance for chaining
1018
+	 */
1019
+	public function setCacheDir($cache_dir)
1020
+	{
1021
+		$this->_normalizeDir('cache_dir', $cache_dir);
1022
+		$this->_cacheDirNormalized = true;
1023
+		return $this;
1024
+	}
1025
+
1026
+	/**
1027
+	 * Get cache directory
1028
+	 *
1029
+	 * @return string path of cache directory
1030
+	 */
1031
+	public function getCacheDir()
1032
+	{
1033
+		if (!$this->_cacheDirNormalized) {
1034
+			$this->_normalizeDir('cache_dir', $this->cache_dir);
1035
+			$this->_cacheDirNormalized = true;
1036
+		}
1037
+		return $this->cache_dir;
1038
+	}
1039
+
1040
+	/**
1041
+	 * Normalize and set directory string
1042
+	 *
1043
+	 * @param string $dirName cache_dir or compile_dir
1044
+	 * @param string $dir     filepath of folder
1045
+	 */
1046
+	private function _normalizeDir($dirName, $dir)
1047
+	{
1048
+		$this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DS, true);
1049
+		if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) {
1050
+			Smarty::$_muted_directories[ $this->{$dirName} ] = null;
1051
+		}
1052
+	}
1053
+
1054
+	/**
1055
+	 * Normalize template_dir or config_dir
1056
+	 *
1057
+	 * @param bool $isConfig true for config_dir
1058
+	 *
1059
+	 */
1060
+	private function _nomalizeTemplateConfig($isConfig)
1061
+	{
1062
+		if ($isConfig) {
1063
+			$processed = &$this->_processedConfigDir;
1064
+			$dir = &$this->config_dir;
1065
+		} else {
1066
+			$processed = &$this->_processedTemplateDir;
1067
+			$dir = &$this->template_dir;
1068
+		}
1069
+		if (!is_array($dir)) {
1070
+			$dir = (array) $dir;
1071
+		}
1072
+		foreach ($dir as $k => $v) {
1073
+			if (!isset($processed[ $k ])) {
1074
+				$dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DS, true);
1075
+				$processed[ $k ] = true;
1076
+			}
1077
+		}
1078
+		$isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true;
1079
+		$isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) :
1080
+			$this->_joined_template_dir = join('#', $this->template_dir);
1081
+	}
1082
+
1083
+	/**
1084
+	 * creates a template object
1085
+	 *
1086
+	 * @param  string  $template   the resource handle of the template file
1087
+	 * @param  mixed   $cache_id   cache id to be used with this template
1088
+	 * @param  mixed   $compile_id compile id to be used with this template
1089
+	 * @param  object  $parent     next higher level of Smarty variables
1090
+	 * @param  boolean $do_clone   flag is Smarty object shall be cloned
1091
+	 *
1092
+	 * @return object  template object
1093
+	 */
1094
+	public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
1095
+	{
1096
+		if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
1097
+			$parent = $cache_id;
1098
+			$cache_id = null;
1099
+		}
1100
+		if ($parent !== null && is_array($parent)) {
1101
+			$data = $parent;
1102
+			$parent = null;
1103
+		} else {
1104
+			$data = null;
1105
+		}
1106
+		$_templateId = $this->_getTemplateId($template, $cache_id, $compile_id);
1107
+		$tpl = null;
1108
+		if ($this->caching && isset($this->_cache[ 'isCached' ][ $_templateId ])) {
1109
+			$tpl = $do_clone ? clone $this->_cache[ 'isCached' ][ $_templateId ] :
1110
+				$this->_cache[ 'isCached' ][ $_templateId ];
1111
+			$tpl->tpl_vars = $tpl->config_vars = array();
1112
+		} else if (!$do_clone && isset($this->_cache[ 'tplObjects' ][ $_templateId ])) {
1113
+			$tpl = clone $this->_cache[ 'tplObjects' ][ $_templateId ];
1114
+		} else {
1115
+			/* @var Smarty_Internal_Template $tpl */
1116
+			$tpl = new $this->template_class($template, $this, null, $cache_id, $compile_id, null, null);
1117
+			$tpl->templateId = $_templateId;
1118
+		}
1119
+		if ($do_clone) {
1120
+			$tpl->smarty = clone $tpl->smarty;
1121
+		}
1122
+		$tpl->parent = $parent ? $parent : $this;
1123
+		// fill data if present
1124
+		if (!empty($data) && is_array($data)) {
1125
+			// set up variable values
1126
+			foreach ($data as $_key => $_val) {
1127
+				$tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val);
1128
+			}
1129
+		}
1130
+		if ($this->debugging || $this->debugging_ctrl == 'URL') {
1131
+			$tpl->smarty->_debug = new Smarty_Internal_Debug();
1132
+			// check URL debugging control
1133
+			if (!$this->debugging && $this->debugging_ctrl == 'URL') {
1134
+				$tpl->smarty->_debug->debugUrl($tpl->smarty);
1135
+			}
1136
+		}
1137
+		return $tpl;
1138
+	}
1139
+
1140
+	/**
1141
+	 * Takes unknown classes and loads plugin files for them
1142
+	 * class name format: Smarty_PluginType_PluginName
1143
+	 * plugin filename format: plugintype.pluginname.php
1144
+	 *
1145
+	 * @param  string $plugin_name class plugin name to load
1146
+	 * @param  bool   $check       check if already loaded
1147
+	 *
1148
+	 * @throws SmartyException
1149
+	 * @return string |boolean filepath of loaded file or false
1150
+	 */
1151
+	public function loadPlugin($plugin_name, $check = true)
1152
+	{
1153
+		return $this->ext->loadPlugin->loadPlugin($this, $plugin_name, $check);
1154
+	}
1155
+
1156
+	/**
1157
+	 * Get unique template id
1158
+	 *
1159
+	 * @param string                    $template_name
1160
+	 * @param null|mixed                $cache_id
1161
+	 * @param null|mixed                $compile_id
1162
+	 * @param null                      $caching
1163
+	 * @param \Smarty_Internal_Template $template
1164
+	 *
1165
+	 * @return string
1166
+	 */
1167
+	public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null,
1168
+								   Smarty_Internal_Template $template = null)
1169
+	{
1170
+		$template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
1171
+			$template_name;
1172
+		$cache_id = $cache_id === null ? $this->cache_id : $cache_id;
1173
+		$compile_id = $compile_id === null ? $this->compile_id : $compile_id;
1174
+		$caching = (int) ($caching === null ? $this->caching : $caching);
1175
+
1176
+		if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) {
1177
+			$_templateId =
1178
+				Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) .
1179
+				"#{$cache_id}#{$compile_id}#{$caching}";
1180
+		} else {
1181
+			$_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}";
1182
+		}
1183
+		if (isset($_templateId[ 150 ])) {
1184
+			$_templateId = sha1($_templateId);
1185
+		}
1186
+		return $_templateId;
1187
+	}
1188
+
1189
+	/**
1190
+	 * Normalize path
1191
+	 *  - remove /./ and /../
1192
+	 *  - make it absolute if required
1193
+	 *
1194
+	 * @param string $path      file path
1195
+	 * @param bool   $realpath  if true - convert to absolute
1196
+	 *                          false - convert to relative
1197
+	 *                          null - keep as it is but remove /./ /../
1198
+	 *
1199
+	 * @return string
1200
+	 */
1201
+	public function _realpath($path, $realpath = null)
1202
+	{
1203
+		$nds = DS == '/' ? '\\' : '/';
1204
+		// normalize DS 
1205
+		$path = str_replace($nds, DS, $path);
1206
+		preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%',
1207
+				   $path, $parts);
1208
+		$path = $parts[ 'path' ];
1209
+		if ($parts[ 'root' ] == '\\') {
1210
+			$parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
1211
+		} else {
1212
+			if ($realpath !== null && !$parts[ 'root' ]) {
1213
+				$path = getcwd() . DS . $path;
1214
+			}
1215
+		}
1216
+		// remove noop 'DS DS' and 'DS.DS' patterns
1217
+		$path = preg_replace('#([\\\\/]([.]?[\\\\/])+)#', DS, $path);
1218
+		// resolve '..DS' pattern, smallest first
1219
+		if (strpos($path, '..' . DS) != false &&
1220
+			preg_match_all('#(([.]?[\\\\/])*([.][.])[\\\\/]([.]?[\\\\/])*)+#', $path, $match)
1221
+		) {
1222
+			$counts = array();
1223
+			foreach ($match[ 0 ] as $m) {
1224
+				$counts[] = (int) ((strlen($m) - 1) / 3);
1225
+			}
1226
+			sort($counts);
1227
+			foreach ($counts as $count) {
1228
+				$path = preg_replace('#(([\\\\/]([.]?[\\\\/])*[^\\\\/.]+){' . $count .
1229
+									 '}[\\\\/]([.]?[\\\\/])*([.][.][\\\\/]([.]?[\\\\/])*){' . $count . '})(?=[^.])#',
1230
+									 DS, $path);
1231
+			}
1232
+		}
1233
+
1234
+		return $parts[ 'root' ] . $path;
1235
+	}
1236
+
1237
+	/**
1238
+	 * Empty template objects cache
1239
+	 */
1240
+	public function _clearTemplateCache()
1241
+	{
1242
+		$this->_cache[ 'isCached' ] = array();
1243
+		$this->_cache[ 'tplObjects' ] = array();
1244
+	}
1245
+
1246
+	/**
1247
+	 * @param boolean $compile_check
1248
+	 */
1249
+	public function setCompileCheck($compile_check)
1250
+	{
1251
+		$this->compile_check = $compile_check;
1252
+	}
1253
+
1254
+	/**
1255
+	 * @param boolean $use_sub_dirs
1256
+	 */
1257
+	public function setUseSubDirs($use_sub_dirs)
1258
+	{
1259
+		$this->use_sub_dirs = $use_sub_dirs;
1260
+	}
1261
+
1262
+	/**
1263
+	 * @param int $error_reporting
1264
+	 */
1265
+	public function setErrorReporting($error_reporting)
1266
+	{
1267
+		$this->error_reporting = $error_reporting;
1268
+	}
1269
+
1270
+	/**
1271
+	 * @param boolean $escape_html
1272
+	 */
1273
+	public function setEscapeHtml($escape_html)
1274
+	{
1275
+		$this->escape_html = $escape_html;
1276
+	}
1277
+
1278
+	/**
1279
+	 * @param boolean $auto_literal
1280
+	 */
1281
+	public function setAutoLiteral($auto_literal)
1282
+	{
1283
+		$this->auto_literal = $auto_literal;
1284
+	}
1285
+
1286
+	/**
1287
+	 * @param boolean $force_compile
1288
+	 */
1289
+	public function setForceCompile($force_compile)
1290
+	{
1291
+		$this->force_compile = $force_compile;
1292
+	}
1293
+
1294
+	/**
1295
+	 * @param boolean $merge_compiled_includes
1296
+	 */
1297
+	public function setMergeCompiledIncludes($merge_compiled_includes)
1298
+	{
1299
+		$this->merge_compiled_includes = $merge_compiled_includes;
1300
+	}
1301
+
1302
+	/**
1303
+	 * @param string $left_delimiter
1304
+	 */
1305
+	public function setLeftDelimiter($left_delimiter)
1306
+	{
1307
+		$this->left_delimiter = $left_delimiter;
1308
+	}
1309
+
1310
+	/**
1311
+	 * @param string $right_delimiter
1312
+	 */
1313
+	public function setRightDelimiter($right_delimiter)
1314
+	{
1315
+		$this->right_delimiter = $right_delimiter;
1316
+	}
1317
+
1318
+	/**
1319
+	 * @param boolean $debugging
1320
+	 */
1321
+	public function setDebugging($debugging)
1322
+	{
1323
+		$this->debugging = $debugging;
1324
+	}
1325
+
1326
+	/**
1327
+	 * @param boolean $config_overwrite
1328
+	 */
1329
+	public function setConfigOverwrite($config_overwrite)
1330
+	{
1331
+		$this->config_overwrite = $config_overwrite;
1332
+	}
1333
+
1334
+	/**
1335
+	 * @param boolean $config_booleanize
1336
+	 */
1337
+	public function setConfigBooleanize($config_booleanize)
1338
+	{
1339
+		$this->config_booleanize = $config_booleanize;
1340
+	}
1341
+
1342
+	/**
1343
+	 * @param boolean $config_read_hidden
1344
+	 */
1345
+	public function setConfigReadHidden($config_read_hidden)
1346
+	{
1347
+		$this->config_read_hidden = $config_read_hidden;
1348
+	}
1349
+
1350
+	/**
1351
+	 * @param boolean $compile_locking
1352
+	 */
1353
+	public function setCompileLocking($compile_locking)
1354
+	{
1355
+		$this->compile_locking = $compile_locking;
1356
+	}
1357
+
1358
+	/**
1359
+	 * @param string $default_resource_type
1360
+	 */
1361
+	public function setDefaultResourceType($default_resource_type)
1362
+	{
1363
+		$this->default_resource_type = $default_resource_type;
1364
+	}
1365
+
1366
+	/**
1367
+	 * @param string $caching_type
1368
+	 */
1369
+	public function setCachingType($caching_type)
1370
+	{
1371
+		$this->caching_type = $caching_type;
1372
+	}
1373
+
1374
+	/**
1375
+	 * Test install
1376
+	 *
1377
+	 * @param null $errors
1378
+	 */
1379
+	public function testInstall(&$errors = null)
1380
+	{
1381
+		Smarty_Internal_TestInstall::testInstall($this, $errors);
1382
+	}
1383
+
1384
+	/**
1385
+	 * <<magic>> Generic getter.
1386
+	 * Calls the appropriate getter function.
1387
+	 * Issues an E_USER_NOTICE if no valid getter is found.
1388
+	 *
1389
+	 * @param  string $name property name
1390
+	 *
1391
+	 * @return mixed
1392
+	 */
1393
+	public function __get($name)
1394
+	{
1395
+		if (isset($this->accessMap[ $name ])) {
1396
+			$method = 'get' . $this->accessMap[ $name ];
1397
+			return $this->{$method}();
1398
+		} elseif (isset($this->_cache[ $name ])) {
1399
+			return $this->_cache[ $name ];
1400
+		} elseif (in_array($name, $this->obsoleteProperties)) {
1401
+			return null;
1402
+		} else {
1403
+			trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
1404
+		}
1405
+		return null;
1406
+	}
1407
+
1408
+	/**
1409
+	 * <<magic>> Generic setter.
1410
+	 * Calls the appropriate setter function.
1411
+	 * Issues an E_USER_NOTICE if no valid setter is found.
1412
+	 *
1413
+	 * @param string $name  property name
1414
+	 * @param mixed  $value parameter passed to setter
1415
+	 */
1416
+	public function __set($name, $value)
1417
+	{
1418
+		if (isset($this->accessMap[ $name ])) {
1419
+			$method = 'set' . $this->accessMap[ $name ];
1420
+			$this->{$method}($value);
1421
+		} elseif (in_array($name, $this->obsoleteProperties)) {
1422
+			return;
1423
+		} else {
1424
+			if (is_object($value) && method_exists($value, $name)) {
1425
+				$this->$name = $value;
1426
+			} else {
1427
+				trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
1428
+			}
1429
+		}
1430
+	}
1431
+
1432
+	/**
1433
+	 * Error Handler to mute expected messages
1434
+	 *
1435
+	 * @link http://php.net/set_error_handler
1436
+	 *
1437
+	 * @param  integer $errno Error level
1438
+	 * @param          $errstr
1439
+	 * @param          $errfile
1440
+	 * @param          $errline
1441
+	 * @param          $errcontext
1442
+	 *
1443
+	 * @return bool|void
1444
+	 */
1445
+	public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
1446
+	{
1447
+		$_is_muted_directory = false;
1448
+
1449
+		// add the SMARTY_DIR to the list of muted directories
1450
+		if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) {
1451
+			$smarty_dir = realpath(SMARTY_DIR);
1452
+			if ($smarty_dir !== false) {
1453
+				Smarty::$_muted_directories[ SMARTY_DIR ] =
1454
+					array('file' => $smarty_dir, 'length' => strlen($smarty_dir),);
1455
+			}
1456
+		}
1457
+
1458
+		// walk the muted directories and test against $errfile
1459
+		foreach (Smarty::$_muted_directories as $key => &$dir) {
1460
+			if (!$dir) {
1461
+				// resolve directory and length for speedy comparisons
1462
+				$file = realpath($key);
1463
+				if ($file === false) {
1464
+					// this directory does not exist, remove and skip it
1465
+					unset(Smarty::$_muted_directories[ $key ]);
1466
+					continue;
1467
+				}
1468
+				$dir = array('file' => $file, 'length' => strlen($file),);
1469
+			}
1470
+			if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) {
1471
+				$_is_muted_directory = true;
1472
+				break;
1473
+			}
1474
+		}
1475
+		// pass to next error handler if this error did not occur inside SMARTY_DIR
1476
+		// or the error was within smarty but masked to be ignored
1477
+		if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
1478
+			if (Smarty::$_previous_error_handler) {
1479
+				return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline,
1480
+									  $errcontext);
1481
+			} else {
1482
+				return false;
1483
+			}
1484
+		}
1485
+		return;
1486
+	}
1487
+
1488
+	/**
1489
+	 * Enable error handler to mute expected messages
1490
+	 *
1491
+	 * @return void
1492
+	 */
1493
+	public static function muteExpectedErrors()
1494
+	{
1495
+		/*
1496 1496
             error muting is done because some people implemented custom error_handlers using
1497 1497
             http://php.net/set_error_handler and for some reason did not understand the following paragraph:
1498 1498
 
@@ -1508,22 +1508,22 @@  discard block
 block discarded – undo
1508 1508
                 - between file_exists() and filemtime() a possible race condition is opened,
1509 1509
                   which does not exist using the simple @filemtime() approach.
1510 1510
         */
1511
-        $error_handler = array('Smarty', 'mutingErrorHandler');
1512
-        $previous = set_error_handler($error_handler);
1513
-
1514
-        // avoid dead loops
1515
-        if ($previous !== $error_handler) {
1516
-            Smarty::$_previous_error_handler = $previous;
1517
-        }
1518
-    }
1519
-
1520
-    /**
1521
-     * Disable error handler muting expected messages
1522
-     *
1523
-     * @return void
1524
-     */
1525
-    public static function unmuteExpectedErrors()
1526
-    {
1527
-        restore_error_handler();
1528
-    }
1511
+		$error_handler = array('Smarty', 'mutingErrorHandler');
1512
+		$previous = set_error_handler($error_handler);
1513
+
1514
+		// avoid dead loops
1515
+		if ($previous !== $error_handler) {
1516
+			Smarty::$_previous_error_handler = $previous;
1517
+		}
1518
+	}
1519
+
1520
+	/**
1521
+	 * Disable error handler muting expected messages
1522
+	 *
1523
+	 * @return void
1524
+	 */
1525
+	public static function unmuteExpectedErrors()
1526
+	{
1527
+		restore_error_handler();
1528
+	}
1529 1529
 }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -44 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
     const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects
217 217
 
218
-    const RESOURCE_CACHE_ON = 4;    // cache source and compiled resources
218
+    const RESOURCE_CACHE_ON = 4; // cache source and compiled resources
219 219
 
220 220
     /**#@-*/
221 221
 
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
         }
750 750
         $this->start_time = microtime(true);
751 751
 
752
-        if (isset($_SERVER[ 'SCRIPT_NAME' ])) {
753
-            Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]);
752
+        if (isset($_SERVER['SCRIPT_NAME'])) {
753
+            Smarty::$global_tpl_vars['SCRIPT_NAME'] = new Smarty_Variable($_SERVER['SCRIPT_NAME']);
754 754
         }
755 755
 
756 756
         // Check if we're running on windows
@@ -849,15 +849,15 @@  discard block
 block discarded – undo
849 849
                     $dir[] = $v;
850 850
                 } else {
851 851
                     // string indexes are overridden
852
-                    $dir[ $k ] = $v;
853
-                    unset($processed[ $key ]);
852
+                    $dir[$k] = $v;
853
+                    unset($processed[$key]);
854 854
                 }
855 855
             }
856 856
         } else {
857 857
             if ($key !== null) {
858 858
                 // override directory at specified index
859
-                $dir[ $key ] = $template_dir;
860
-                unset($processed[ $key ]);
859
+                $dir[$key] = $template_dir;
860
+                unset($processed[$key]);
861 861
             } else {
862 862
                 // append new directory
863 863
                 $dir[] = $template_dir;
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
             $this->_nomalizeTemplateConfig($isConfig);
886 886
         }
887 887
         if ($index !== null) {
888
-            return isset($dir[ $index ]) ? $dir[ $index ] : null;
888
+            return isset($dir[$index]) ? $dir[$index] : null;
889 889
         }
890 890
         return $dir;
891 891
     }
@@ -974,9 +974,9 @@  discard block
 block discarded – undo
974 974
                 $this->plugins_dir = (array) $this->plugins_dir;
975 975
             }
976 976
             foreach ($this->plugins_dir as $k => $v) {
977
-                $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . DS, true);
977
+                $this->plugins_dir[$k] = $this->_realpath(rtrim($v, "/\\") . DS, true);
978 978
             }
979
-            $this->_cache[ 'plugin_files' ] = array();
979
+            $this->_cache['plugin_files'] = array();
980 980
             $this->_pluginsDirNormalized = true;
981 981
         }
982 982
         return $this->plugins_dir;
@@ -1046,8 +1046,8 @@  discard block
 block discarded – undo
1046 1046
     private function _normalizeDir($dirName, $dir)
1047 1047
     {
1048 1048
         $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DS, true);
1049
-        if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) {
1050
-            Smarty::$_muted_directories[ $this->{$dirName} ] = null;
1049
+        if (!isset(Smarty::$_muted_directories[$this->{$dirName}])) {
1050
+            Smarty::$_muted_directories[$this->{$dirName}] = null;
1051 1051
         }
1052 1052
     }
1053 1053
 
@@ -1070,14 +1070,13 @@  discard block
 block discarded – undo
1070 1070
             $dir = (array) $dir;
1071 1071
         }
1072 1072
         foreach ($dir as $k => $v) {
1073
-            if (!isset($processed[ $k ])) {
1074
-                $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DS, true);
1075
-                $processed[ $k ] = true;
1073
+            if (!isset($processed[$k])) {
1074
+                $dir[$k] = $v = $this->_realpath(rtrim($v, "/\\") . DS, true);
1075
+                $processed[$k] = true;
1076 1076
             }
1077 1077
         }
1078 1078
         $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true;
1079
-        $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) :
1080
-            $this->_joined_template_dir = join('#', $this->template_dir);
1079
+        $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : $this->_joined_template_dir = join('#', $this->template_dir);
1081 1080
     }
1082 1081
 
1083 1082
     /**
@@ -1105,12 +1104,11 @@  discard block
 block discarded – undo
1105 1104
         }
1106 1105
         $_templateId = $this->_getTemplateId($template, $cache_id, $compile_id);
1107 1106
         $tpl = null;
1108
-        if ($this->caching && isset($this->_cache[ 'isCached' ][ $_templateId ])) {
1109
-            $tpl = $do_clone ? clone $this->_cache[ 'isCached' ][ $_templateId ] :
1110
-                $this->_cache[ 'isCached' ][ $_templateId ];
1107
+        if ($this->caching && isset($this->_cache['isCached'][$_templateId])) {
1108
+            $tpl = $do_clone ? clone $this->_cache['isCached'][$_templateId] : $this->_cache['isCached'][$_templateId];
1111 1109
             $tpl->tpl_vars = $tpl->config_vars = array();
1112
-        } else if (!$do_clone && isset($this->_cache[ 'tplObjects' ][ $_templateId ])) {
1113
-            $tpl = clone $this->_cache[ 'tplObjects' ][ $_templateId ];
1110
+        } else if (!$do_clone && isset($this->_cache['tplObjects'][$_templateId])) {
1111
+            $tpl = clone $this->_cache['tplObjects'][$_templateId];
1114 1112
         } else {
1115 1113
             /* @var Smarty_Internal_Template $tpl */
1116 1114
             $tpl = new $this->template_class($template, $this, null, $cache_id, $compile_id, null, null);
@@ -1124,7 +1122,7 @@  discard block
 block discarded – undo
1124 1122
         if (!empty($data) && is_array($data)) {
1125 1123
             // set up variable values
1126 1124
             foreach ($data as $_key => $_val) {
1127
-                $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val);
1125
+                $tpl->tpl_vars[$_key] = new Smarty_Variable($_val);
1128 1126
             }
1129 1127
         }
1130 1128
         if ($this->debugging || $this->debugging_ctrl == 'URL') {
@@ -1167,8 +1165,7 @@  discard block
 block discarded – undo
1167 1165
     public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null,
1168 1166
                                    Smarty_Internal_Template $template = null)
1169 1167
     {
1170
-        $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
1171
-            $template_name;
1168
+        $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name;
1172 1169
         $cache_id = $cache_id === null ? $this->cache_id : $cache_id;
1173 1170
         $compile_id = $compile_id === null ? $this->compile_id : $compile_id;
1174 1171
         $caching = (int) ($caching === null ? $this->caching : $caching);
@@ -1180,7 +1177,7 @@  discard block
 block discarded – undo
1180 1177
         } else {
1181 1178
             $_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}";
1182 1179
         }
1183
-        if (isset($_templateId[ 150 ])) {
1180
+        if (isset($_templateId[150])) {
1184 1181
             $_templateId = sha1($_templateId);
1185 1182
         }
1186 1183
         return $_templateId;
@@ -1205,11 +1202,11 @@  discard block
 block discarded – undo
1205 1202
         $path = str_replace($nds, DS, $path);
1206 1203
         preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%',
1207 1204
                    $path, $parts);
1208
-        $path = $parts[ 'path' ];
1209
-        if ($parts[ 'root' ] == '\\') {
1210
-            $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
1205
+        $path = $parts['path'];
1206
+        if ($parts['root'] == '\\') {
1207
+            $parts['root'] = substr(getcwd(), 0, 2) . $parts['root'];
1211 1208
         } else {
1212
-            if ($realpath !== null && !$parts[ 'root' ]) {
1209
+            if ($realpath !== null && !$parts['root']) {
1213 1210
                 $path = getcwd() . DS . $path;
1214 1211
             }
1215 1212
         }
@@ -1220,7 +1217,7 @@  discard block
 block discarded – undo
1220 1217
             preg_match_all('#(([.]?[\\\\/])*([.][.])[\\\\/]([.]?[\\\\/])*)+#', $path, $match)
1221 1218
         ) {
1222 1219
             $counts = array();
1223
-            foreach ($match[ 0 ] as $m) {
1220
+            foreach ($match[0] as $m) {
1224 1221
                 $counts[] = (int) ((strlen($m) - 1) / 3);
1225 1222
             }
1226 1223
             sort($counts);
@@ -1231,7 +1228,7 @@  discard block
 block discarded – undo
1231 1228
             }
1232 1229
         }
1233 1230
 
1234
-        return $parts[ 'root' ] . $path;
1231
+        return $parts['root'] . $path;
1235 1232
     }
1236 1233
 
1237 1234
     /**
@@ -1239,8 +1236,8 @@  discard block
 block discarded – undo
1239 1236
      */
1240 1237
     public function _clearTemplateCache()
1241 1238
     {
1242
-        $this->_cache[ 'isCached' ] = array();
1243
-        $this->_cache[ 'tplObjects' ] = array();
1239
+        $this->_cache['isCached'] = array();
1240
+        $this->_cache['tplObjects'] = array();
1244 1241
     }
1245 1242
 
1246 1243
     /**
@@ -1392,11 +1389,11 @@  discard block
 block discarded – undo
1392 1389
      */
1393 1390
     public function __get($name)
1394 1391
     {
1395
-        if (isset($this->accessMap[ $name ])) {
1396
-            $method = 'get' . $this->accessMap[ $name ];
1392
+        if (isset($this->accessMap[$name])) {
1393
+            $method = 'get' . $this->accessMap[$name];
1397 1394
             return $this->{$method}();
1398
-        } elseif (isset($this->_cache[ $name ])) {
1399
-            return $this->_cache[ $name ];
1395
+        } elseif (isset($this->_cache[$name])) {
1396
+            return $this->_cache[$name];
1400 1397
         } elseif (in_array($name, $this->obsoleteProperties)) {
1401 1398
             return null;
1402 1399
         } else {
@@ -1415,8 +1412,8 @@  discard block
 block discarded – undo
1415 1412
      */
1416 1413
     public function __set($name, $value)
1417 1414
     {
1418
-        if (isset($this->accessMap[ $name ])) {
1419
-            $method = 'set' . $this->accessMap[ $name ];
1415
+        if (isset($this->accessMap[$name])) {
1416
+            $method = 'set' . $this->accessMap[$name];
1420 1417
             $this->{$method}($value);
1421 1418
         } elseif (in_array($name, $this->obsoleteProperties)) {
1422 1419
             return;
@@ -1447,10 +1444,10 @@  discard block
 block discarded – undo
1447 1444
         $_is_muted_directory = false;
1448 1445
 
1449 1446
         // add the SMARTY_DIR to the list of muted directories
1450
-        if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) {
1447
+        if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {
1451 1448
             $smarty_dir = realpath(SMARTY_DIR);
1452 1449
             if ($smarty_dir !== false) {
1453
-                Smarty::$_muted_directories[ SMARTY_DIR ] =
1450
+                Smarty::$_muted_directories[SMARTY_DIR] =
1454 1451
                     array('file' => $smarty_dir, 'length' => strlen($smarty_dir),);
1455 1452
             }
1456 1453
         }
@@ -1462,12 +1459,12 @@  discard block
 block discarded – undo
1462 1459
                 $file = realpath($key);
1463 1460
                 if ($file === false) {
1464 1461
                     // this directory does not exist, remove and skip it
1465
-                    unset(Smarty::$_muted_directories[ $key ]);
1462
+                    unset(Smarty::$_muted_directories[$key]);
1466 1463
                     continue;
1467 1464
                 }
1468 1465
                 $dir = array('file' => $file, 'length' => strlen($file),);
1469 1466
             }
1470
-            if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) {
1467
+            if (!strncmp($errfile, $dir['file'], $dir['length'])) {
1471 1468
                 $_is_muted_directory = true;
1472 1469
                 break;
1473 1470
             }
Please login to merge, or discard this patch.