Completed
Push — developer ( 51f696...681523 )
by Błażej
549:36 queued 490:16
created
libraries/SabreDAV/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
      * the next element.
116 116
      *
117 117
      * @param Reader $reader
118
-     * @return mixed
118
+     * @return CurrentUserPrivilegeSet
119 119
      */
120 120
     static function xmlDeserialize(Reader $reader) {
121 121
 
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -20,140 +20,140 @@
 block discarded – undo
20 20
  */
21 21
 class CurrentUserPrivilegeSet implements Element, HtmlOutput {
22 22
 
23
-    /**
24
-     * List of privileges
25
-     *
26
-     * @var array
27
-     */
28
-    private $privileges;
29
-
30
-    /**
31
-     * Creates the object
32
-     *
33
-     * Pass the privileges in clark-notation
34
-     *
35
-     * @param array $privileges
36
-     */
37
-    public function __construct(array $privileges) {
38
-
39
-        $this->privileges = $privileges;
40
-
41
-    }
42
-
43
-    /**
44
-     * The xmlSerialize metod is called during xml writing.
45
-     *
46
-     * Use the $writer argument to write its own xml serialization.
47
-     *
48
-     * An important note: do _not_ create a parent element. Any element
49
-     * implementing XmlSerializble should only ever write what's considered
50
-     * its 'inner xml'.
51
-     *
52
-     * The parent of the current element is responsible for writing a
53
-     * containing element.
54
-     *
55
-     * This allows serializers to be re-used for different element names.
56
-     *
57
-     * If you are opening new elements, you must also close them again.
58
-     *
59
-     * @param Writer $writer
60
-     * @return void
61
-     */
62
-    public function xmlSerialize(Writer $writer) {
63
-
64
-        foreach ($this->privileges as $privName) {
65
-
66
-            $writer->startElement('{DAV:}privilege');
67
-            $writer->writeElement($privName);
68
-            $writer->endElement();
69
-
70
-        }
71
-
72
-
73
-    }
74
-
75
-    /**
76
-     * Returns true or false, whether the specified principal appears in the
77
-     * list.
78
-     *
79
-     * @param string $privilegeName
80
-     * @return bool
81
-     */
82
-    public function has($privilegeName) {
83
-
84
-        return in_array($privilegeName, $this->privileges);
85
-
86
-    }
87
-
88
-    /**
89
-     * Returns the list of privileges.
90
-     *
91
-     * @return array
92
-     */
93
-    public function getValue() {
94
-
95
-        return $this->privileges;
96
-
97
-    }
98
-
99
-    /**
100
-     * The deserialize method is called during xml parsing.
101
-     *
102
-     * This method is called statictly, this is because in theory this method
103
-     * may be used as a type of constructor, or factory method.
104
-     *
105
-     * Often you want to return an instance of the current class, but you are
106
-     * free to return other data as well.
107
-     *
108
-     * You are responsible for advancing the reader to the next element. Not
109
-     * doing anything will result in a never-ending loop.
110
-     *
111
-     * If you just want to skip parsing for this element altogether, you can
112
-     * just call $reader->next();
113
-     *
114
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
115
-     * the next element.
116
-     *
117
-     * @param Reader $reader
118
-     * @return mixed
119
-     */
120
-    static function xmlDeserialize(Reader $reader) {
121
-
122
-        $result = [];
123
-
124
-        $tree = $reader->parseInnerTree(['{DAV:}privilege' => 'Sabre\\Xml\\Element\\Elements']);
125
-        foreach ($tree as $element) {
126
-            if ($element['name'] !== '{DAV:}privilege') {
127
-                continue;
128
-            }
129
-            $result[] = $element['value'][0];
130
-        }
131
-        return new self($result);
132
-
133
-    }
134
-
135
-    /**
136
-     * Generate html representation for this value.
137
-     *
138
-     * The html output is 100% trusted, and no effort is being made to sanitize
139
-     * it. It's up to the implementor to sanitize user provided values.
140
-     *
141
-     * The output must be in UTF-8.
142
-     *
143
-     * The baseUri parameter is a url to the root of the application, and can
144
-     * be used to construct local links.
145
-     *
146
-     * @param HtmlOutputHelper $html
147
-     * @return string
148
-     */
149
-    public function toHtml(HtmlOutputHelper $html) {
150
-
151
-        return implode(
152
-            ', ',
153
-            array_map([$html, 'xmlName'], $this->getValue())
154
-        );
155
-
156
-    }
23
+	/**
24
+	 * List of privileges
25
+	 *
26
+	 * @var array
27
+	 */
28
+	private $privileges;
29
+
30
+	/**
31
+	 * Creates the object
32
+	 *
33
+	 * Pass the privileges in clark-notation
34
+	 *
35
+	 * @param array $privileges
36
+	 */
37
+	public function __construct(array $privileges) {
38
+
39
+		$this->privileges = $privileges;
40
+
41
+	}
42
+
43
+	/**
44
+	 * The xmlSerialize metod is called during xml writing.
45
+	 *
46
+	 * Use the $writer argument to write its own xml serialization.
47
+	 *
48
+	 * An important note: do _not_ create a parent element. Any element
49
+	 * implementing XmlSerializble should only ever write what's considered
50
+	 * its 'inner xml'.
51
+	 *
52
+	 * The parent of the current element is responsible for writing a
53
+	 * containing element.
54
+	 *
55
+	 * This allows serializers to be re-used for different element names.
56
+	 *
57
+	 * If you are opening new elements, you must also close them again.
58
+	 *
59
+	 * @param Writer $writer
60
+	 * @return void
61
+	 */
62
+	public function xmlSerialize(Writer $writer) {
63
+
64
+		foreach ($this->privileges as $privName) {
65
+
66
+			$writer->startElement('{DAV:}privilege');
67
+			$writer->writeElement($privName);
68
+			$writer->endElement();
69
+
70
+		}
71
+
72
+
73
+	}
74
+
75
+	/**
76
+	 * Returns true or false, whether the specified principal appears in the
77
+	 * list.
78
+	 *
79
+	 * @param string $privilegeName
80
+	 * @return bool
81
+	 */
82
+	public function has($privilegeName) {
83
+
84
+		return in_array($privilegeName, $this->privileges);
85
+
86
+	}
87
+
88
+	/**
89
+	 * Returns the list of privileges.
90
+	 *
91
+	 * @return array
92
+	 */
93
+	public function getValue() {
94
+
95
+		return $this->privileges;
96
+
97
+	}
98
+
99
+	/**
100
+	 * The deserialize method is called during xml parsing.
101
+	 *
102
+	 * This method is called statictly, this is because in theory this method
103
+	 * may be used as a type of constructor, or factory method.
104
+	 *
105
+	 * Often you want to return an instance of the current class, but you are
106
+	 * free to return other data as well.
107
+	 *
108
+	 * You are responsible for advancing the reader to the next element. Not
109
+	 * doing anything will result in a never-ending loop.
110
+	 *
111
+	 * If you just want to skip parsing for this element altogether, you can
112
+	 * just call $reader->next();
113
+	 *
114
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
115
+	 * the next element.
116
+	 *
117
+	 * @param Reader $reader
118
+	 * @return mixed
119
+	 */
120
+	static function xmlDeserialize(Reader $reader) {
121
+
122
+		$result = [];
123
+
124
+		$tree = $reader->parseInnerTree(['{DAV:}privilege' => 'Sabre\\Xml\\Element\\Elements']);
125
+		foreach ($tree as $element) {
126
+			if ($element['name'] !== '{DAV:}privilege') {
127
+				continue;
128
+			}
129
+			$result[] = $element['value'][0];
130
+		}
131
+		return new self($result);
132
+
133
+	}
134
+
135
+	/**
136
+	 * Generate html representation for this value.
137
+	 *
138
+	 * The html output is 100% trusted, and no effort is being made to sanitize
139
+	 * it. It's up to the implementor to sanitize user provided values.
140
+	 *
141
+	 * The output must be in UTF-8.
142
+	 *
143
+	 * The baseUri parameter is a url to the root of the application, and can
144
+	 * be used to construct local links.
145
+	 *
146
+	 * @param HtmlOutputHelper $html
147
+	 * @return string
148
+	 */
149
+	public function toHtml(HtmlOutputHelper $html) {
150
+
151
+		return implode(
152
+			', ',
153
+			array_map([$html, 'xmlName'], $this->getValue())
154
+		);
155
+
156
+	}
157 157
 
158 158
 
159 159
 }
Please login to merge, or discard this patch.
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.