Passed
Push — master ( 0926cc...b588cd )
by ྅༻ Ǭɀħ
24:37 queued 09:29
created

yourls_valid_unicode()   B

Complexity

Conditions 9
Paths 31

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 10.2655

Importance

Changes 0
Metric Value
cc 9
eloc 4
nc 31
nop 1
dl 0
loc 5
ccs 3
cts 4
cp 0.75
crap 10.2655
rs 8.0555
c 0
b 0
f 0
1
<?php
2
/**
3
 * YOURLS modification of a small subset from WordPress' KSES implementation.
4
 * Straight from the Let's Not Reinvent The Wheel department.
5
 */
6
7
/**
8
 * kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
9
 * Copyright (C) 2002, 2003, 2005  Ulf Harnhammar
10
 *
11
 * This program is free software and open source software; you can redistribute
12
 * it and/or modify it under the terms of the GNU General Public License as
13
 * published by the Free Software Foundation; either version 2 of the License,
14
 * or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful, but WITHOUT
17
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19
 * more details.
20
 *
21
 * You should have received a copy of the GNU General Public License along
22
 * with this program; if not, write to the Free Software Foundation, Inc.,
23
 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24
 * http://www.gnu.org/licenses/gpl.html
25
 *
26
 * [kses strips evil scripts!]
27
 *
28
 * @version 0.2.2
29
 * @copyright (C) 2002, 2003, 2005
30
 * @author Ulf Harnhammar <http://advogato.org/person/metaur/>
31
 *
32
 * @package External
33
 * @subpackage KSES
34
 *
35
 */
36
37
/* NOTE ABOUT GLOBALS
0 ignored issues
show
Coding Style introduced by
Block comment text must start on a new line
Loading history...
38
 * Two globals are defined: $yourls_allowedentitynames and $yourls_allowedprotocols
39
 * - $yourls_allowedentitynames is used internally in KSES functions to sanitize HTML entities
40
 * - $yourls_allowedprotocols is used in various parts of YOURLS, not just in KSES, albeit being defined here
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 109 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
41
 * Two globals are not defined and unused at this moment: $yourls_allowedtags_all and $yourls_allowedtags
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 105 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
42
 * The code for these vars is here and ready for any future use 
43
 */
44
45
// Populate after plugins have loaded to allow user defined values
46
yourls_add_action( 'plugins_loaded', 'yourls_kses_init' );
47
 
48
/**
49
 * Init KSES globals if not already defined (by a plugin)
50
 *
51
 * @since 1.6
52
 *
53
 */
54
function yourls_kses_init() {
55 1
	global $yourls_allowedentitynames, $yourls_allowedprotocols;
56
57 1
	if( ! $yourls_allowedentitynames ) {
58 1
		$yourls_allowedentitynames = yourls_apply_filter( 'kses_allowed_entities', yourls_kses_allowed_entities() );
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 110 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
59
	}
60
	
61 1
	if( ! $yourls_allowedprotocols ) {
62 1
		$yourls_allowedprotocols   = yourls_apply_filter( 'kses_allowed_protocols', yourls_kses_allowed_protocols() );
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 112 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
63
	}	
64
65
	/** See NOTE ABOUT GLOBALS **
0 ignored issues
show
Coding Style introduced by
Block comments must be started with /*
Loading history...
66
	
67
	if( ! $yourls_allowedtags_all ) {
68
		$yourls_allowedtags_all = yourls_kses_allowed_tags_all();
69
		$yourls_allowedtags_all = array_map( '_yourls_add_global_attributes', $yourls_allowedtags_all );
70
		$yourls_allowedtags_all = yourls_apply_filter( 'kses_allowed_tags_all', $yourls_allowedtags_all );
71
	} else {
72
		// User defined: let's sanitize
73
		$yourls_allowedtags_all = yourls_kses_array_lc( $yourls_allowedtags_all );
74
	}
75
	
76
	if( ! $yourls_allowedtags ) {
77
		$yourls_allowedtags = yourls_kses_allowed_tags();
78
		$yourls_allowedtags = array_map( '_yourls_add_global_attributes', $yourls_allowedtags );
79
		$yourls_allowedtags = yourls_apply_filter( 'kses_allowed_tags', $yourls_allowedtags );
80
	} else {
81
		// User defined: let's sanitize
82
		$yourls_allowedtags = yourls_kses_array_lc( $yourls_allowedtags );
83
	}
84
85
	/**/
0 ignored issues
show
Coding Style introduced by
Block comments must be ended with */
Loading history...
86 1
}
87
 
88
/**
89
 * Kses global for all allowable HTML tags.
90
 *
91
 * Complete (?) list of HTML tags. Keep this function available for any plugin or
92
 * future feature that will want to display lots of HTML.
93
 *
94
 * @since 1.6
95
 *
96
 * @return array All tags
97
 */
98
function yourls_kses_allowed_tags_all() {
99
	return array(
100 1
		'address' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
101
		'a' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
102
			'href' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
103
			'rel' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
104
			'rev' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
105
			'name' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
106
			'target' => true,
107
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 9 space(s), but found 2.
Loading history...
108
		'abbr' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
109
		'acronym' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
110
		'area' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
111
			'alt' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
112
			'coords' => true,
113
			'href' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
114
			'nohref' => true,
115
			'shape' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
116
			'target' => true,
117
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
118
		'article' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
119
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
120
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
121
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
122
			'xml:lang' => true,
123
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 15 space(s), but found 2.
Loading history...
124
		'aside' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
125
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
126
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
127
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
128
			'xml:lang' => true,
129
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 13 space(s), but found 2.
Loading history...
130
		'b' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
131
		'big' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
132
		'blockquote' => array(
133
			'cite' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
134
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
135
			'xml:lang' => true,
136
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 18 space(s), but found 2.
Loading history...
137
		'br' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
138
		'button' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
139
			'disabled' => true,
140
			'name' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
141
			'type' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
142
			'value' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
143
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 14 space(s), but found 2.
Loading history...
144
		'caption' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
145
			'align' => true,
146
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 15 space(s), but found 2.
Loading history...
147
		'cite' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
148
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
149
			'lang' => true,
150
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
151
		'code' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
152
		'col' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
153
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
154
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
155
			'charoff' => true,
156
			'span' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
157
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
158
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
159
			'width' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
160
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
161
		'del' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
162
			'datetime' => true,
163
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
164
		'dd' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
165
		'details' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
166
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
167
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
168
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
169
			'open' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
170
			'xml:lang' => true,
171
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 15 space(s), but found 2.
Loading history...
172
		'div' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
173
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
174
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
175
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
176
			'xml:lang' => true,
177
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
178
		'dl' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
179
		'dt' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
180
		'em' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
181
		'fieldset' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
182
		'figure' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
183
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
184
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
185
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
186
			'xml:lang' => true,
187
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 14 space(s), but found 2.
Loading history...
188
		'figcaption' => array(
189
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
190
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
191
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
192
			'xml:lang' => true,
193
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 18 space(s), but found 2.
Loading history...
194
		'font' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
195
			'color' => true,
196
			'face' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
197
			'size' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
198
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
199
		'footer' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
200
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
201
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
202
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
203
			'xml:lang' => true,
204
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 14 space(s), but found 2.
Loading history...
205
		'form' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
206
			'action' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
207
			'accept' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
208
			'accept-charset' => true,
209
			'enctype' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
210
			'method' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
211
			'name' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 11 space(s) but found 1
Loading history...
212
			'target' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
213
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
214
		'h1' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
215
			'align' => true,
216
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
217
		'h2' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
218
			'align' => true,
219
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
220
		'h3' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
221
			'align' => true,
222
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
223
		'h4' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
224
			'align' => true,
225
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
226
		'h5' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
227
			'align' => true,
228
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
229
		'h6' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
230
			'align' => true,
231
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
232
		'header' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
233
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
234
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
235
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
236
			'xml:lang' => true,
237
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 14 space(s), but found 2.
Loading history...
238
		'hgroup' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
239
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
240
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
241
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
242
			'xml:lang' => true,
243
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 14 space(s), but found 2.
Loading history...
244
		'hr' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
245
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
246
			'noshade' => true,
247
			'size' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
248
			'width' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
249
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
250
		'i' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
251
		'img' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
252
			'alt' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
253
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
254
			'border' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
255
			'height' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
256
			'hspace' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
257
			'longdesc' => true,
258
			'vspace' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
259
			'src' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
260
			'usemap' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
261
			'width' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
262
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
263
		'ins' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
264
			'datetime' => true,
265
			'cite' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
266
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
267
		'kbd' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
268
		'label' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
269
			'for' => true,
270
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 13 space(s), but found 2.
Loading history...
271
		'legend' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
272
			'align' => true,
273
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 14 space(s), but found 2.
Loading history...
274
		'li' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
275
			'align' => true,
276
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
277
		'map' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
278
			'name' => true,
279
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
280
		'menu' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
281
			'type' => true,
282
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
283
		'nav' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
284
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
285
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
286
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
287
			'xml:lang' => true,
288
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
289
		'p' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
290
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
291
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
292
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
293
			'xml:lang' => true,
294
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 9 space(s), but found 2.
Loading history...
295
		'pre' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
296
			'width' => true,
297
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
298
		'q' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
299
			'cite' => true,
300
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 9 space(s), but found 2.
Loading history...
301
		's' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
302
		'span' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
303
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
304
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
305
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
306
			'xml:lang' => true,
307
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
308
		'section' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
309
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
310
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
311
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
312
			'xml:lang' => true,
313
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 15 space(s), but found 2.
Loading history...
314
		'small' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
315
		'strike' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
316
		'strong' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
317
		'sub' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
318
		'summary' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
319
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
320
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
321
			'lang' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
322
			'xml:lang' => true,
323
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 15 space(s), but found 2.
Loading history...
324
		'sup' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
325
		'table' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
326
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
327
			'bgcolor' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
328
			'border' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
329
			'cellpadding' => true,
330
			'cellspacing' => true,
331
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
332
			'rules' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
333
			'summary' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
334
			'width' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
335
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 13 space(s), but found 2.
Loading history...
336
		'tbody' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
337
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
338
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
339
			'charoff' => true,
340
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
341
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 13 space(s), but found 2.
Loading history...
342
		'td' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
343
			'abbr' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
344
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
345
			'axis' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
346
			'bgcolor' => true,
347
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
348
			'charoff' => true,
349
			'colspan' => true,
350
			'dir' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
351
			'headers' => true,
352
			'height' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
353
			'nowrap' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
354
			'rowspan' => true,
355
			'scope' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
356
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
357
			'width' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
358
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
359
		'textarea' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
360
			'cols' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
361
			'rows' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
362
			'disabled' => true,
363
			'name' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
364
			'readonly' => true,
365
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 16 space(s), but found 2.
Loading history...
366
		'tfoot' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
367
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
368
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
369
			'charoff' => true,
370
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
371
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 13 space(s), but found 2.
Loading history...
372
		'th' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
373
			'abbr' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
374
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
375
			'axis' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
376
			'bgcolor' => true,
377
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
378
			'charoff' => true,
379
			'colspan' => true,
380
			'headers' => true,
381
			'height' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
382
			'nowrap' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
383
			'rowspan' => true,
384
			'scope' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
385
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
386
			'width' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
387
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
388
		'thead' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
389
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
390
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
391
			'charoff' => true,
392
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
393
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 13 space(s), but found 2.
Loading history...
394
		'title' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 6 space(s) but found 1
Loading history...
395
		'tr' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
396
			'align' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
397
			'bgcolor' => true,
398
			'char' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
399
			'charoff' => true,
400
			'valign' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
401
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
402
		'tt' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
403
		'u' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
404
		'ul' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
405
			'type' => true,
406
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
407
		'ol' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
408
			'start' => true,
409
			'type' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
410
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 10 space(s), but found 2.
Loading history...
411
		'var' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
412
	);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 8 space(s), but found 1.
Loading history...
413
}
414
 
415
/**
416
 * Kses global for default allowable HTML tags. TODO: trim down to necessary only.
417
 *
418
 * Short list of HTML tags used in YOURLS core for display
419
 *
420
 * @since 1.6
421
 *
422
 * @return array Allowed tags
423
 */
424
function yourls_kses_allowed_tags() {
425
	return array(
426
		'a' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
427 1
			'href' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 2 space(s) but found 1
Loading history...
428
			'title' => true,
429
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 9 space(s), but found 2.
Loading history...
430
		'abbr' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
431
			'title' => true,
432
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 12 space(s), but found 2.
Loading history...
433
		'acronym' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
434
			'title' => true,
435
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 15 space(s), but found 2.
Loading history...
436
		'b' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
437
		'blockquote' => array(
0 ignored issues
show
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
438
			'cite' => true,
439
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 18 space(s), but found 2.
Loading history...
440
		'cite' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
441
		'code' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 7 space(s) but found 1
Loading history...
442
		'del' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 8 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
443
			'datetime' => true,
444
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 11 space(s), but found 2.
Loading history...
445
		'em' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 9 space(s) but found 1
Loading history...
446
		'i' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
447
		'q' => array(
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 10 space(s) but found 1
Loading history...
Coding Style introduced by
Multi-line array contains a single value; use single-line array instead
Loading history...
448
			'cite' => true,
449
		),
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 9 space(s), but found 2.
Loading history...
450
		'strike' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
451
		'strong' => array(),
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 5 space(s) but found 1
Loading history...
452
	);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 8 space(s), but found 1.
Loading history...
453
}
454
455
/**
456
 * Kses global for allowable HTML entities.
457
 *
458
 * @since 1.6
459
 *
460
 * @return array Allowed entities
461
 */
462
function yourls_kses_allowed_entities() {
463
	return array(
464 2
		'nbsp',    'iexcl',  'cent',    'pound',  'curren', 'yen',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
465
		'brvbar',  'sect',   'uml',     'copy',   'ordf',   'laquo',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
466
		'not',     'shy',    'reg',     'macr',   'deg',    'plusmn',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
467
		'acute',   'micro',  'para',    'middot', 'cedil',  'ordm',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
468
		'raquo',   'iquest', 'Agrave',  'Aacute', 'Acirc',  'Atilde',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
469
		'Auml',    'Aring',  'AElig',   'Ccedil', 'Egrave', 'Eacute',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
470
		'Ecirc',   'Euml',   'Igrave',  'Iacute', 'Icirc',  'Iuml',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
471
		'ETH',     'Ntilde', 'Ograve',  'Oacute', 'Ocirc',  'Otilde',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
472
		'Ouml',    'times',  'Oslash',  'Ugrave', 'Uacute', 'Ucirc',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
473
		'Uuml',    'Yacute', 'THORN',   'szlig',  'agrave', 'aacute',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
474
		'acirc',   'atilde', 'auml',    'aring',  'aelig',  'ccedil',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
475
		'egrave',  'eacute', 'ecirc',   'euml',   'igrave', 'iacute',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
476
		'icirc',   'iuml',   'eth',     'ntilde', 'ograve', 'oacute',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
477
		'ocirc',   'otilde', 'ouml',    'divide', 'oslash', 'ugrave',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
478
		'uacute',  'ucirc',  'uuml',    'yacute', 'thorn',  'yuml',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
479
		'quot',    'amp',    'lt',      'gt',     'apos',   'OElig',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
480
		'oelig',   'Scaron', 'scaron',  'Yuml',   'circ',   'tilde',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
481
		'ensp',    'emsp',   'thinsp',  'zwnj',   'zwj',    'lrm',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
482
		'rlm',     'ndash',  'mdash',   'lsquo',  'rsquo',  'sbquo',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
483
		'ldquo',   'rdquo',  'bdquo',   'dagger', 'Dagger', 'permil',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
484
		'lsaquo',  'rsaquo', 'euro',    'fnof',   'Alpha',  'Beta',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
485
		'Gamma',   'Delta',  'Epsilon', 'Zeta',   'Eta',    'Theta',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
486
		'Iota',    'Kappa',  'Lambda',  'Mu',     'Nu',     'Xi',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
487
		'Omicron', 'Pi',     'Rho',     'Sigma',  'Tau',    'Upsilon',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
488
		'Phi',     'Chi',    'Psi',     'Omega',  'alpha',  'beta',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
489
		'gamma',   'delta',  'epsilon', 'zeta',   'eta',    'theta',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
490
		'iota',    'kappa',  'lambda',  'mu',     'nu',     'xi',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
491
		'omicron', 'pi',     'rho',     'sigmaf', 'sigma',  'tau',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
492
		'upsilon', 'phi',    'chi',     'psi',    'omega',  'thetasym',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
493
		'upsih',   'piv',    'bull',    'hellip', 'prime',  'Prime',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
494
		'oline',   'frasl',  'weierp',  'image',  'real',   'trade',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
495
		'alefsym', 'larr',   'uarr',    'rarr',   'darr',   'harr',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
496
		'crarr',   'lArr',   'uArr',    'rArr',   'dArr',   'hArr',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
497
		'forall',  'part',   'exist',   'empty',  'nabla',  'isin',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
498
		'notin',   'ni',     'prod',    'sum',    'minus',  'lowast',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
499
		'radic',   'prop',   'infin',   'ang',    'and',    'or',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
500
		'cap',     'cup',    'int',     'sim',    'cong',   'asymp',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
501
		'ne',      'equiv',  'le',      'ge',     'sub',    'sup',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
502
		'nsub',    'sube',   'supe',    'oplus',  'otimes', 'perp',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
503
		'sdot',    'lceil',  'rceil',   'lfloor', 'rfloor', 'lang',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
504
		'rang',    'loz',    'spades',  'clubs',  'hearts', 'diams',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
505
	);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 8 space(s), but found 1.
Loading history...
506
}
507
508
/**
509
 * Kses global for allowable protocols.
510
 *
511
 * @since 1.6
512
 *
513
 * @return array Allowed protocols
514
 */
515
function yourls_kses_allowed_protocols() {
516
	// More or less common stuff in links. From http://en.wikipedia.org/wiki/URI_scheme
517
	return array(
518
		// Common
519 2
		'http://', 'https://', 'ftp://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
520
		'file://', 'smb://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
521
		'sftp://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
522
		'feed:', 'feed://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
523
		'mailto:',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
524
		'news:', 'nntp://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
525
		
526
		// Old school bearded geek
527
		'gopher://', 'telnet://', 'finger://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
528
		'nntp://', 'worldwind://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
529
		
530
		// Dev
531
		'ssh://', 'svn://', 'svn+ssh://', 'git://', 'cvs://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
532
		'apt:',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
533
		'market://', // Google Play
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
534
		'view-source:',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
535
		
536
		// P2P
537
		'ed2k://', 'magnet:', 'udp://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
538
		
539
		// Streaming stuff
540
		'mms://', 'lastfm://', 'spotify:', 'rtsp://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
541
542
		// Text & voice
543
		'aim:', 'facetime://', 'gtalk:', 'xmpp:',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
544
		'irc://', 'ircs://', 'mumble://', 
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
545
		'callto:', 'skype:', 'sip:',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
546
		'teamspeak://', 'tel:', 'ventrilo://', 'xfire:', 
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
547
		'ymsgr:', 'tg://', 'whatsapp://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
548
549
		// Misc
550
		'steam:', 'steam://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
551
		'bitcoin:',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
552
		'ldap://', 'ldaps://',
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 9 spaces, but found 2.
Loading history...
Coding Style introduced by
Each value in a multi-line array must be on a new line
Loading history...
553
		
554
		// Purposedly removed for security
555
		/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
Empty line required before block comment
Loading history...
556
		'about:', 'chrome://', 'chrome-extension://',
0 ignored issues
show
Coding Style introduced by
First line of comment not aligned correctly; expected 6 spaces but found 2
Loading history...
557
		'javascript:', 
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 6 spaces but found 2
Loading history...
558
		'data:',
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 6 spaces but found 2
Loading history...
559
		*/
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
560
	);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 8 space(s), but found 1.
Loading history...
561
}
562
563
564
/**
565
 * Converts and fixes HTML entities.
566
 *
567
 * This function normalizes HTML entities. It will convert "AT&T" to the correct
568
 * "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.
569
 *
570
 * @since 1.6
571
 *
572
 * @param string $string Content to normalize entities
573
 * @return string Content with normalized entities
574
 */
575
function yourls_kses_normalize_entities($string) {
576
	# Disarm all entities by converting & to &amp;
577
578 25
	$string = str_replace('&', '&amp;', $string);
579
580
	# Change back the allowed entities in our entity whitelist
581
582 25
	$string = preg_replace_callback('/&amp;([A-Za-z]{2,8});/', 'yourls_kses_named_entities', $string);
583 25
	$string = preg_replace_callback('/&amp;#(0*[0-9]{1,7});/', 'yourls_kses_normalize_entities2', $string);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 104 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
584 25
	$string = preg_replace_callback('/&amp;#[Xx](0*[0-9A-Fa-f]{1,6});/', 'yourls_kses_normalize_entities3', $string);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 114 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
585
586 25
	return $string;
587
}
588
589
/**
590
 * Callback for yourls_kses_normalize_entities() regular expression.
591
 *
592
 * This function only accepts valid named entity references, which are finite,
593
 * case-sensitive, and highly scrutinized by HTML and XML validators.
594
 *
595
 * @since 1.6
596
 *
597
 * @param array $matches preg_replace_callback() matches array
598
 * @return string Correctly encoded entity
599
 */
600
function yourls_kses_named_entities($matches) {
601 5
	global $yourls_allowedentitynames;
602
603 5
	if ( empty($matches[1]) )
604
		return '';
605
606 5
	$i = $matches[1];
607 5
	return ( ( ! in_array($i, $yourls_allowedentitynames) ) ? "&amp;$i;" : "&$i;" );
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $i instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
608
}
609
610
/**
611
 * Callback for yourls_kses_normalize_entities() regular expression.
612
 *
613
 * This function helps yourls_kses_normalize_entities() to only accept 16-bit values
614
 * and nothing more for &#number; entities.
615
 *
616
 * @access private
617
 * @since 1.6
618
 *
619
 * @param array $matches preg_replace_callback() matches array
620
 * @return string Correctly encoded entity
621
 */
622
function yourls_kses_normalize_entities2($matches) {
623
	if ( empty($matches[1]) )
624
		return '';
625
626
	$i = $matches[1];
627
	if (yourls_valid_unicode($i)) {
628
		$i = str_pad(ltrim($i,'0'), 3, '0', STR_PAD_LEFT);
629
		$i = "&#$i;";
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $i instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
630
	} else {
631
		$i = "&amp;#$i;";
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $i instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
632
	}
633
634
	return $i;
635
}
636
637
/**
638
 * Callback for yourls_kses_normalize_entities() for regular expression.
639
 *
640
 * This function helps yourls_kses_normalize_entities() to only accept valid Unicode
641
 * numeric entities in hex form.
642
 *
643
 * @access private
644
 * @since 1.6
645
 *
646
 * @param array $matches preg_replace_callback() matches array
647
 * @return string Correctly encoded entity
648
 */
649
function yourls_kses_normalize_entities3($matches) {
650 1
	if ( empty($matches[1]) )
651
		return '';
652
653 1
	$hexchars = $matches[1];
654 1
	return ( ( ! yourls_valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' );
0 ignored issues
show
Bug introduced by
It seems like hexdec($hexchars) can also be of type double; however, parameter $i of yourls_valid_unicode() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

654
	return ( ( ! yourls_valid_unicode(/** @scrutinizer ignore-type */ hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' );
Loading history...
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $hexchars instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 113 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
655
}
656
657
/**
658
 * Helper function to add global attributes to a tag in the allowed html list.
659
 *
660
 * @since 1.6
661
 * @access private
662
 *
663
 * @param array $value An array of attributes.
664
 * @return array The array of attributes with global attributes added.
665
 */
666
function _yourls_add_global_attributes( $value ) {
667
	$global_attributes = array(
668
		'class' => true,
669
		'id' => true,
0 ignored issues
show
Coding Style introduced by
Array double arrow not aligned correctly; expected 4 space(s) but found 1
Loading history...
670
		'style' => true,
671
		'title' => true,
672
	);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 22 space(s), but found 1.
Loading history...
673
674
	if ( true === $value )
0 ignored issues
show
introduced by
The condition true === $value is always false.
Loading history...
675
		$value = array();
676
677
	if ( is_array( $value ) )
0 ignored issues
show
introduced by
The condition is_array($value) is always true.
Loading history...
678
		return array_merge( $value, $global_attributes );
679
680
	return $value;
681
}
682
683
/**
684
 * Helper function to determine if a Unicode value is valid.
685
 *
686
 * @since 1.6
687
 *
688
 * @param int $i Unicode value
689
 * @return bool True if the value was a valid Unicode number
690
 */
691
function yourls_valid_unicode($i) {
692 1
	return ( $i == 0x9 || $i == 0xa || $i == 0xd ||
693 1
			($i >= 0x20 && $i <= 0xd7ff) ||
694
			($i >= 0xe000 && $i <= 0xfffd) ||
695 1
			($i >= 0x10000 && $i <= 0x10ffff) );
696
}
697
698
/**
699
 * Goes through an array and changes the keys to all lower case.
700
 *
701
 * @since 1.6
702
 *
703
 * @param array $inarray Unfiltered array
704
 * @return array Fixed array with all lowercase keys
705
 */
706
function yourls_kses_array_lc($inarray) {
707
	$outarray = array ();
0 ignored issues
show
Coding Style introduced by
There must be no space between the "array" keyword and the opening parenthesis
Loading history...
708
709
	foreach ( (array) $inarray as $inkey => $inval) {
710
		$outkey = strtolower($inkey);
711
		$outarray[$outkey] = array ();
0 ignored issues
show
Coding Style introduced by
There must be no space between the "array" keyword and the opening parenthesis
Loading history...
712
713
		foreach ( (array) $inval as $inkey2 => $inval2) {
714
			$outkey2 = strtolower($inkey2);
715
			$outarray[$outkey][$outkey2] = $inval2;
716
		} # foreach $inval
717
	} # foreach $inarray
718
719
	return $outarray;
720
}
721
722
/**
723
 * Convert all entities to their character counterparts.
724
 *
725
 * This function decodes numeric HTML entities (&#65; and &#x41;). It doesn't do
726
 * anything with other entities like &auml;, but we don't need them in the URL
727
 * protocol whitelisting system anyway.
728
 *
729
 * @since 1.6
730
 *
731
 * @param string $string Content to change entities
732
 * @return string Content after decoded entities
733
 */
734
function yourls_kses_decode_entities($string) {
735
	$string = preg_replace_callback('/&#([0-9]+);/', '_yourls_kses_decode_entities_chr', $string);
736
	$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', '_yourls_kses_decode_entities_chr_hexdec', $string);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 112 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
737
738
	return $string;
739
}
740
741
/**
742
 * Regex callback for yourls_kses_decode_entities()
743
 *
744
 * @since 1.6
745
 *
746
 * @param array $match preg match
747
 * @return string
748
 */
749
function _yourls_kses_decode_entities_chr( $match ) {
750
	return chr( $match[1] );
751
}
752
753
/**
754
 * Regex callback for yourls_kses_decode_entities()
755
 *
756
 * @since 1.6
757
 *
758
 * @param array $match preg match
759
 * @return string
760
 */
761
function _yourls_kses_decode_entities_chr_hexdec( $match ) {
762
	return chr( hexdec( $match[1] ) );
0 ignored issues
show
Bug introduced by
It seems like hexdec($match[1]) can also be of type double; however, parameter $ascii of chr() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

762
	return chr( /** @scrutinizer ignore-type */ hexdec( $match[1] ) );
Loading history...
763
}
764
765
/**
766
 * Removes any null characters in $string.
767
 *
768
 * @since 1.6
769
 *
770
 * @param string $string
771
 * @return string
772
 */
773
function yourls_kses_no_null($string) {
774
	$string = preg_replace( '/\0+/', '', $string );
775
	$string = preg_replace( '/(\\\\0)+/', '', $string );
776
777
	return $string;
778
}
779