@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | function delete_specific_field($id) |
43 | 43 | { |
44 | 44 | $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); |
45 | - $id = (int)$id; |
|
45 | + $id = (int) $id; |
|
46 | 46 | if (!is_numeric($id)) { |
47 | 47 | return false; |
48 | 48 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | function edit_specific_field($id, $name) |
61 | 61 | { |
62 | 62 | $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); |
63 | - $id = (int)$id; |
|
63 | + $id = (int) $id; |
|
64 | 64 | if (!is_numeric($id)) { |
65 | 65 | return false; |
66 | 66 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
30 | + $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function get_all($where_conditions = array()) |
48 | 48 | { |
49 | - return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC')); |
|
49 | + return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // action links |
58 | 58 | $html = '<div class="actions">'; |
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>'; |
|
61 | 61 | $html .= '</div>'; |
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | unset($item['end_date']); |
246 | 246 | // Assets |
247 | - $item['asset'] = array( 'media' => $item['media'], |
|
247 | + $item['asset'] = array('media' => $item['media'], |
|
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | 250 | ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
81 | 81 | $sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id"; |
82 | 82 | $res = Database::query($sql); |
83 | - $users = array (); |
|
83 | + $users = array(); |
|
84 | 84 | while ($user = Database::fetch_array($res, 'ASSOC')) { |
85 | 85 | $users[] = $user; |
86 | 86 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
118 | 118 | $courses = ClassManager :: get_courses($class_id); |
119 | 119 | if (count($courses) != 0) { |
120 | - $course_codes = array (); |
|
120 | + $course_codes = array(); |
|
121 | 121 | foreach ($courses as $index => $course) { |
122 | 122 | $course_codes[] = $course['course_code']; |
123 | 123 | $sql = "SELECT DISTINCT user_id FROM $table_class_user t1, $table_course_class t2 WHERE t1.class_id=t2.class_id AND course_code = '".$course['course_code']."' AND user_id = $user_id AND t2.class_id<>'$class_id'"; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
143 | 143 | $sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code"; |
144 | 144 | $res = Database::query($sql); |
145 | - $courses = array (); |
|
145 | + $courses = array(); |
|
146 | 146 | while ($course = Database::fetch_array($res, 'ASSOC')) { |
147 | 147 | $courses[] = $course; |
148 | 148 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
218 | 218 | $sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".Database::escape_string($course_code)."' AND cc.class_id = cl.id"; |
219 | 219 | $res = Database::query($sql); |
220 | - $classes = array (); |
|
220 | + $classes = array(); |
|
221 | 221 | while ($class = Database::fetch_array($res, 'ASSOC')) { |
222 | 222 | $classes[] = $class; |
223 | 223 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * Constructor, init tool path for rendering |
20 | 20 | * @param string tool name (optional) |
21 | 21 | */ |
22 | - public function __construct($toolname = '', $template_path=null) |
|
22 | + public function __construct($toolname = '', $template_path = null) |
|
23 | 23 | { |
24 | 24 | if (!empty($toolname)) { |
25 | 25 | if (isset($template_path)) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if (is_dir($path)) { |
31 | 31 | $this->tool_path = $path; |
32 | 32 | } else { |
33 | - throw new ViewException('View::__construct() $path directory does not exist ' . $path); |
|
33 | + throw new ViewException('View::__construct() $path directory does not exist '.$path); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function set_data($data) |
43 | 43 | { |
44 | 44 | if (!is_array($data)) { |
45 | - throw new ViewException('View::set_data() $data must to be an array, you have sent a' . gettype( $data )); |
|
45 | + throw new ViewException('View::set_data() $data must to be an array, you have sent a'.gettype($data)); |
|
46 | 46 | } |
47 | 47 | $this->data = $data; |
48 | 48 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * Set layout view sent from a controller |
52 | 52 | * @param string layout view |
53 | 53 | */ |
54 | - public function set_layout( $layout ) |
|
54 | + public function set_layout($layout) |
|
55 | 55 | { |
56 | 56 | $this->layout = $layout; |
57 | 57 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $course_title = null; |
22 | 22 | $xajax_response = new xajaxResponse(); |
23 | 23 | $return = ''; |
24 | - if(!empty($needle) && !empty($type)) { |
|
24 | + if (!empty($needle) && !empty($type)) { |
|
25 | 25 | // xajax send utf8 datas... datas in db can be non-utf8 datas |
26 | 26 | $charset = api_get_system_encoding(); |
27 | 27 | $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | while ($row = Database::fetch_row($res)) { |
39 | 39 | $course_codes .= '\''.$row[0].'\','; |
40 | 40 | } |
41 | - $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
41 | + $course_codes = substr($course_codes, 0, (strlen($course_codes) - 1)); |
|
42 | 42 | |
43 | 43 | $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - if ($type=='single') { |
|
47 | + if ($type == 'single') { |
|
48 | 48 | // search users where username or firstname or lastname begins likes $needle |
49 | 49 | $sql = 'SELECT |
50 | 50 | course.code, |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | if (api_is_multiple_url_enabled()) { |
70 | 70 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
71 | 71 | $access_url_id = api_get_current_access_url_id(); |
72 | - if ($access_url_id != -1){ |
|
72 | + if ($access_url_id != -1) { |
|
73 | 73 | |
74 | - if ($type=='single') { |
|
74 | + if ($type == 'single') { |
|
75 | 75 | $sql = 'SELECT |
76 | 76 | course.code, |
77 | 77 | course.visual_code, |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | |
102 | 102 | $rs = Database::query($sql); |
103 | 103 | $course_list = array(); |
104 | - if ($type=='single') { |
|
104 | + if ($type == 'single') { |
|
105 | 105 | |
106 | - while($course = Database :: fetch_array($rs)) { |
|
106 | + while ($course = Database :: fetch_array($rs)) { |
|
107 | 107 | $course_list[] = $course['code']; |
108 | - $course_title=str_replace("'","\'",$course_title); |
|
108 | + $course_title = str_replace("'", "\'", $course_title); |
|
109 | 109 | $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
110 | 110 | } |
111 | - $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | + $xajax_response -> addAssign('ajax_list_courses_single', 'innerHTML', api_utf8_encode($return)); |
|
112 | 112 | } else { |
113 | 113 | $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
114 | - while($course = Database :: fetch_array($rs)) { |
|
114 | + while ($course = Database :: fetch_array($rs)) { |
|
115 | 115 | $course_list[] = $course['code']; |
116 | - $course_title=str_replace("'","\'",$course_title); |
|
117 | - $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
116 | + $course_title = str_replace("'", "\'", $course_title); |
|
117 | + $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
118 | 118 | } |
119 | 119 | $return .= '</select>'; |
120 | 120 | |
121 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
121 | + $xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return)); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | $_SESSION['course_list'] = $course_list; |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | # matches stray ">" characters. |
74 | 74 | ############################################################################### |
75 | 75 | { |
76 | - return preg_replace('%(<'. # EITHER: < |
|
77 | - '[^>]*'. # things that aren't > |
|
78 | - '(>|$)'. # > or end of string |
|
76 | + return preg_replace('%(<'.# EITHER: < |
|
77 | + '[^>]*'.# things that aren't > |
|
78 | + '(>|$)'.# > or end of string |
|
79 | 79 | '|>)%e', # OR: just a > |
80 | 80 | "kses_split2('\\1', \$allowed_html, ". |
81 | 81 | '$allowed_protocols)', |
@@ -228,8 +228,7 @@ discard block |
||
228 | 228 | if (preg_match('/^\s+/', $attr)) # valueless |
229 | 229 | { |
230 | 230 | $working = 1; $mode = 0; |
231 | - $attrarr[] = array |
|
232 | - ('name' => $attrname, |
|
231 | + $attrarr[] = array('name' => $attrname, |
|
233 | 232 | 'value' => '', |
234 | 233 | 'whole' => $attrname, |
235 | 234 | 'vless' => 'y'); |
@@ -245,8 +244,7 @@ discard block |
||
245 | 244 | { |
246 | 245 | $thisval = kses_bad_protocol($match[1], $allowed_protocols); |
247 | 246 | |
248 | - $attrarr[] = array |
|
249 | - ('name' => $attrname, |
|
247 | + $attrarr[] = array('name' => $attrname, |
|
250 | 248 | 'value' => $thisval, |
251 | 249 | 'whole' => "$attrname=\"$thisval\"", |
252 | 250 | 'vless' => 'n'); |
@@ -260,8 +258,7 @@ discard block |
||
260 | 258 | { |
261 | 259 | $thisval = kses_bad_protocol($match[1], $allowed_protocols); |
262 | 260 | |
263 | - $attrarr[] = array |
|
264 | - ('name' => $attrname, |
|
261 | + $attrarr[] = array('name' => $attrname, |
|
265 | 262 | 'value' => $thisval, |
266 | 263 | 'whole' => "$attrname='$thisval'", |
267 | 264 | 'vless' => 'n'); |
@@ -275,8 +272,7 @@ discard block |
||
275 | 272 | { |
276 | 273 | $thisval = kses_bad_protocol($match[1], $allowed_protocols); |
277 | 274 | |
278 | - $attrarr[] = array |
|
279 | - ('name' => $attrname, |
|
275 | + $attrarr[] = array('name' => $attrname, |
|
280 | 276 | 'value' => $thisval, |
281 | 277 | 'whole' => "$attrname=\"$thisval\"", |
282 | 278 | 'vless' => 'n'); |
@@ -298,8 +294,7 @@ discard block |
||
298 | 294 | if ($mode == 1) |
299 | 295 | # special case, for when the attribute list ends with a valueless |
300 | 296 | # attribute like "selected" |
301 | - $attrarr[] = array |
|
302 | - ('name' => $attrname, |
|
297 | + $attrarr[] = array('name' => $attrname, |
|
303 | 298 | 'value' => '', |
304 | 299 | 'whole' => $attrname, |
305 | 300 | 'vless' => 'y'); |
@@ -470,9 +465,9 @@ discard block |
||
470 | 465 | ############################################################################### |
471 | 466 | { |
472 | 467 | $string2 = preg_split('/:|:|:/i', $string, 2); |
473 | - if(isset($string2[1]) && !preg_match('%/\?%',$string2[0])) |
|
468 | + if (isset($string2[1]) && !preg_match('%/\?%', $string2[0])) |
|
474 | 469 | { |
475 | - $string = kses_bad_protocol_once2($string2[0],$allowed_protocols).trim($string2[1]); |
|
470 | + $string = kses_bad_protocol_once2($string2[0], $allowed_protocols).trim($string2[1]); |
|
476 | 471 | } |
477 | 472 | return $string; |
478 | 473 | } # function kses_bad_protocol_once |
@@ -35,47 +35,47 @@ discard block |
||
35 | 35 | */ |
36 | 36 | |
37 | 37 | $kses_allowedentitynames = array( |
38 | - 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', |
|
39 | - 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', |
|
40 | - 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', |
|
41 | - 'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', |
|
42 | - 'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', |
|
43 | - 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', |
|
44 | - 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', |
|
45 | - 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', |
|
46 | - 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', |
|
47 | - 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', |
|
48 | - 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', |
|
49 | - 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', |
|
50 | - 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', |
|
51 | - 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', |
|
52 | - 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', |
|
53 | - 'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', |
|
54 | - 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', |
|
55 | - 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', |
|
56 | - 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', |
|
57 | - 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', |
|
58 | - 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', |
|
59 | - 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', |
|
60 | - 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', |
|
61 | - 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', |
|
62 | - 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', |
|
63 | - 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', |
|
64 | - 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', |
|
65 | - 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', |
|
66 | - 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', |
|
67 | - 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', |
|
68 | - 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', |
|
69 | - 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', |
|
70 | - 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', |
|
71 | - 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', |
|
72 | - 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', |
|
73 | - 'radic', 'prop', 'infin', 'ang', 'and', 'or', |
|
74 | - 'cap', 'cup', 'int', 'sim', 'cong', 'asymp', |
|
75 | - 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', |
|
76 | - 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', |
|
77 | - 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', |
|
78 | - 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', |
|
38 | + 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', |
|
39 | + 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', |
|
40 | + 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', |
|
41 | + 'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', |
|
42 | + 'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', |
|
43 | + 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', |
|
44 | + 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', |
|
45 | + 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', |
|
46 | + 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', |
|
47 | + 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', |
|
48 | + 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', |
|
49 | + 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', |
|
50 | + 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', |
|
51 | + 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', |
|
52 | + 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', |
|
53 | + 'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', |
|
54 | + 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', |
|
55 | + 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', |
|
56 | + 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', |
|
57 | + 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', |
|
58 | + 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', |
|
59 | + 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', |
|
60 | + 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', |
|
61 | + 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', |
|
62 | + 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', |
|
63 | + 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', |
|
64 | + 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', |
|
65 | + 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', |
|
66 | + 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', |
|
67 | + 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', |
|
68 | + 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', |
|
69 | + 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', |
|
70 | + 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', |
|
71 | + 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', |
|
72 | + 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', |
|
73 | + 'radic', 'prop', 'infin', 'ang', 'and', 'or', |
|
74 | + 'cap', 'cup', 'int', 'sim', 'cong', 'asymp', |
|
75 | + 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', |
|
76 | + 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', |
|
77 | + 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', |
|
78 | + 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | global $pass_allowed_html, $pass_allowed_protocols; |
146 | 146 | $pass_allowed_html = $allowed_html; |
147 | 147 | $pass_allowed_protocols = $allowed_protocols; |
148 | - return preg_replace_callback( '%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', '_kses_split_callback', $string ); |
|
148 | + return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', '_kses_split_callback', $string); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @access private |
155 | 155 | */ |
156 | -function _kses_split_callback( $match ) |
|
156 | +function _kses_split_callback($match) |
|
157 | 157 | { |
158 | 158 | global $pass_allowed_html, $pass_allowed_protocols; |
159 | - return kses_split2( $match[1], $pass_allowed_html, $pass_allowed_protocols ); |
|
159 | + return kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | |
190 | 190 | if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) { |
191 | 191 | $string = str_replace(array('<!--', '-->'), '', $matches[1]); |
192 | - while ( $string != $newstring = kses($string, $allowed_html, $allowed_protocols) ) |
|
192 | + while ($string != $newstring = kses($string, $allowed_html, $allowed_protocols)) |
|
193 | 193 | $string = $newstring; |
194 | - if ( $string == '' ) |
|
194 | + if ($string == '') |
|
195 | 195 | return ''; |
196 | 196 | // prevent multiple dashes in comments |
197 | 197 | $string = preg_replace('/--+/', '-', $string); |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | $currkey, $currval)) |
283 | 283 | { $ok = false; break; } |
284 | 284 | |
285 | - if ( strtolower($arreach['name']) == 'style' ) { |
|
285 | + if (strtolower($arreach['name']) == 'style') { |
|
286 | 286 | $orig_value = $arreach['value']; |
287 | 287 | |
288 | 288 | $value = kses_safecss_filter_attr($orig_value); |
289 | 289 | |
290 | - if ( empty($value) ) |
|
290 | + if (empty($value)) |
|
291 | 291 | continue; |
292 | 292 | |
293 | 293 | $arreach['value'] = $value; |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | if (preg_match('/^\s+/', $attr)) // valueless |
362 | 362 | { |
363 | 363 | $working = 1; $mode = 0; |
364 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
365 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
364 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
365 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
366 | 366 | } |
367 | 367 | $attr = preg_replace('/^\s+/', '', $attr); |
368 | 368 | } |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | $thisval = $match[1]; |
380 | 380 | } else { |
381 | 381 | $thisval = $match[1]; |
382 | - if ( in_array(strtolower($attrname), $uris) ) |
|
382 | + if (in_array(strtolower($attrname), $uris)) |
|
383 | 383 | $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
384 | 384 | } |
385 | 385 | |
386 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
387 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
386 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
387 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
388 | 388 | } |
389 | 389 | $working = 1; $mode = 0; |
390 | 390 | $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | // 'value' |
396 | 396 | { |
397 | 397 | $thisval = $match[1]; |
398 | - if ( in_array(strtolower($attrname), $uris) ) |
|
398 | + if (in_array(strtolower($attrname), $uris)) |
|
399 | 399 | $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
400 | 400 | |
401 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
402 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
|
401 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
402 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
|
403 | 403 | } |
404 | 404 | $working = 1; $mode = 0; |
405 | 405 | $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr); |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | // value |
411 | 411 | { |
412 | 412 | $thisval = $match[1]; |
413 | - if ( in_array(strtolower($attrname), $uris) ) |
|
413 | + if (in_array(strtolower($attrname), $uris)) |
|
414 | 414 | $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
415 | 415 | |
416 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
417 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
416 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
417 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
418 | 418 | } |
419 | 419 | // We add quotes to conform to W3C's HTML spec. |
420 | 420 | $working = 1; $mode = 0; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) |
435 | 435 | // special case, for when the attribute list ends with a valueless |
436 | 436 | // attribute like "selected" |
437 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
437 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
438 | 438 | |
439 | 439 | return $attrarr; |
440 | 440 | } |
@@ -579,12 +579,12 @@ discard block |
||
579 | 579 | { |
580 | 580 | $outarray = array(); |
581 | 581 | |
582 | - foreach ( (array) $inarray as $inkey => $inval) |
|
582 | + foreach ((array) $inarray as $inkey => $inval) |
|
583 | 583 | { |
584 | 584 | $outkey = strtolower($inkey); |
585 | 585 | $outarray[$outkey] = array(); |
586 | 586 | |
587 | - foreach ( (array) $inval as $inkey2 => $inval2) |
|
587 | + foreach ((array) $inval as $inkey2 => $inval2) |
|
588 | 588 | { |
589 | 589 | $outkey2 = strtolower($inkey2); |
590 | 590 | $outarray[$outkey][$outkey2] = $inval2; |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | function kses_bad_protocol_once($string, $allowed_protocols) |
633 | 633 | { |
634 | 634 | $string2 = preg_split('/:|�*58;|�*3a;/i', $string, 2); |
635 | - if(isset($string2[1]) && !preg_match('%/\?%',$string2[0])) |
|
635 | + if (isset($string2[1]) && !preg_match('%/\?%', $string2[0])) |
|
636 | 636 | { |
637 | - $string = kses_bad_protocol_once2($string2[0],$allowed_protocols).trim($string2[1]); |
|
637 | + $string = kses_bad_protocol_once2($string2[0], $allowed_protocols).trim($string2[1]); |
|
638 | 638 | } |
639 | 639 | return $string; |
640 | 640 | } |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $string2 = strtolower($string2); |
661 | 661 | |
662 | 662 | $allowed = false; |
663 | - foreach ( (array) $allowed_protocols as $one_protocol) |
|
663 | + foreach ((array) $allowed_protocols as $one_protocol) |
|
664 | 664 | if (strtolower($one_protocol) == $string2) |
665 | 665 | { |
666 | 666 | $allowed = true; |
@@ -711,11 +711,11 @@ discard block |
||
711 | 711 | function kses_named_entities($matches) { |
712 | 712 | global $kses_allowedentitynames; |
713 | 713 | |
714 | - if ( empty($matches[1]) ) |
|
714 | + if (empty($matches[1])) |
|
715 | 715 | return ''; |
716 | 716 | |
717 | 717 | $i = $matches[1]; |
718 | - return ( ( ! in_array($i, $kses_allowedentitynames) ) ? "&$i;" : "&$i;" ); |
|
718 | + return ((!in_array($i, $kses_allowedentitynames)) ? "&$i;" : "&$i;"); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
@@ -730,12 +730,12 @@ discard block |
||
730 | 730 | * @return string Correctly encoded entity |
731 | 731 | */ |
732 | 732 | function kses_normalize_entities2($matches) { |
733 | - if ( empty($matches[1]) ) |
|
733 | + if (empty($matches[1])) |
|
734 | 734 | return ''; |
735 | 735 | |
736 | 736 | $i = $matches[1]; |
737 | 737 | if (kses_valid_unicode($i)) { |
738 | - $i = str_pad(ltrim($i,'0'), 3, '0', STR_PAD_LEFT); |
|
738 | + $i = str_pad(ltrim($i, '0'), 3, '0', STR_PAD_LEFT); |
|
739 | 739 | $i = "&#$i;"; |
740 | 740 | } else { |
741 | 741 | $i = "&#$i;"; |
@@ -756,11 +756,11 @@ discard block |
||
756 | 756 | * @return string Correctly encoded entity |
757 | 757 | */ |
758 | 758 | function kses_normalize_entities3($matches) { |
759 | - if ( empty($matches[1]) ) |
|
759 | + if (empty($matches[1])) |
|
760 | 760 | return ''; |
761 | 761 | |
762 | 762 | $hexchars = $matches[1]; |
763 | - return ( ( ! kses_valid_unicode(hexdec($hexchars)) ) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' ); |
|
763 | + return ((!kses_valid_unicode(hexdec($hexchars))) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars, '0').';'); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | * @return bool true if the value was a valid Unicode number |
771 | 771 | */ |
772 | 772 | function kses_valid_unicode($i) { |
773 | - return ( $i == 0x9 || $i == 0xa || $i == 0xd || |
|
773 | + return ($i == 0x9 || $i == 0xa || $i == 0xd || |
|
774 | 774 | ($i >= 0x20 && $i <= 0xd7ff) || |
775 | 775 | ($i >= 0xe000 && $i <= 0xfffd) || |
776 | - ($i >= 0x10000 && $i <= 0x10ffff) ); |
|
776 | + ($i >= 0x10000 && $i <= 0x10ffff)); |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | * @param array $match preg match |
801 | 801 | * @return string |
802 | 802 | */ |
803 | -function _kses_decode_entities_chr( $match ) { |
|
804 | - return chr( $match[1] ); |
|
803 | +function _kses_decode_entities_chr($match) { |
|
804 | + return chr($match[1]); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -810,24 +810,24 @@ discard block |
||
810 | 810 | * @param array $match preg match |
811 | 811 | * @return string |
812 | 812 | */ |
813 | -function _kses_decode_entities_chr_hexdec( $match ) { |
|
814 | - return chr( hexdec( $match[1] ) ); |
|
813 | +function _kses_decode_entities_chr_hexdec($match) { |
|
814 | + return chr(hexdec($match[1])); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
818 | 818 | * Inline CSS filter |
819 | 819 | * |
820 | 820 | */ |
821 | -function kses_safecss_filter_attr( $css ) { |
|
821 | +function kses_safecss_filter_attr($css) { |
|
822 | 822 | |
823 | 823 | $css = kses_no_null($css); |
824 | - $css = str_replace(array("\n","\r","\t"), '', $css); |
|
824 | + $css = str_replace(array("\n", "\r", "\t"), '', $css); |
|
825 | 825 | |
826 | - if ( preg_match( '%[\\(&=}]|/\*%', $css ) ) // remove any inline css containing \ ( & } = or comments |
|
826 | + if (preg_match('%[\\(&=}]|/\*%', $css)) // remove any inline css containing \ ( & } = or comments |
|
827 | 827 | return ''; |
828 | 828 | |
829 | - $css_array = explode( ';', trim( $css ) ); |
|
830 | - $allowed_attr = array( 'text-align', 'margin', 'color', 'float', |
|
829 | + $css_array = explode(';', trim($css)); |
|
830 | + $allowed_attr = array('text-align', 'margin', 'color', 'float', |
|
831 | 831 | 'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color', |
832 | 832 | 'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left', |
833 | 833 | 'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color', |
@@ -837,26 +837,26 @@ discard block |
||
837 | 837 | 'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom', |
838 | 838 | 'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom', |
839 | 839 | 'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align', |
840 | - 'width' ); |
|
840 | + 'width'); |
|
841 | 841 | |
842 | - if ( empty($allowed_attr) ) |
|
842 | + if (empty($allowed_attr)) |
|
843 | 843 | return $css; |
844 | 844 | |
845 | 845 | $css = ''; |
846 | - foreach ( $css_array as $css_item ) { |
|
847 | - if ( $css_item == '' ) |
|
846 | + foreach ($css_array as $css_item) { |
|
847 | + if ($css_item == '') |
|
848 | 848 | continue; |
849 | - $css_item = trim( $css_item ); |
|
849 | + $css_item = trim($css_item); |
|
850 | 850 | $found = false; |
851 | - if ( strpos( $css_item, ':' ) === false ) { |
|
851 | + if (strpos($css_item, ':') === false) { |
|
852 | 852 | $found = true; |
853 | 853 | } else { |
854 | - $parts = split( ':', $css_item ); |
|
855 | - if ( in_array( strtolower( trim( $parts[0] ) ), $allowed_attr ) ) |
|
854 | + $parts = split(':', $css_item); |
|
855 | + if (in_array(strtolower(trim($parts[0])), $allowed_attr)) |
|
856 | 856 | $found = true; |
857 | 857 | } |
858 | - if ( $found ) { |
|
859 | - if( $css != '' ) |
|
858 | + if ($found) { |
|
859 | + if ($css != '') |
|
860 | 860 | $css .= ';'; |
861 | 861 | $css .= $css_item; |
862 | 862 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @subpackage kses5 |
51 | 51 | */ |
52 | 52 | |
53 | - if(substr(phpversion(), 0, 1) < 5) |
|
53 | + if (substr(phpversion(), 0, 1) < 5) |
|
54 | 54 | { |
55 | 55 | die("Class kses requires PHP 5 or higher."); |
56 | 56 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Only install KSES5 once |
60 | 60 | */ |
61 | - if(!defined('KSES_CLASS_PHP5')) |
|
61 | + if (!defined('KSES_CLASS_PHP5')) |
|
62 | 62 | { |
63 | 63 | define('KSES_CLASS_PHP5', true); |
64 | 64 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $string = preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string); |
156 | 156 | $string = $this->normalizeEntities($string); |
157 | 157 | $string = $this->filterKsesTextHook($string); |
158 | - $string = preg_replace('%(<' . '[^>]*' . '(>|$)' . '|>)%e', "\$this->stripTags('\\1')", $string); |
|
158 | + $string = preg_replace('%(<'.'[^>]*'.'(>|$)'.'|>)%e', "\$this->stripTags('\\1')", $string); |
|
159 | 159 | return $string; |
160 | 160 | } |
161 | 161 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function AddProtocols() |
178 | 178 | { |
179 | 179 | $c_args = func_num_args(); |
180 | - if($c_args != 1) |
|
180 | + if ($c_args != 1) |
|
181 | 181 | { |
182 | 182 | trigger_error("kses5::AddProtocols() did not receive an argument.", E_USER_WARNING); |
183 | 183 | return false; |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | |
186 | 186 | $protocol_data = func_get_arg(0); |
187 | 187 | |
188 | - if(is_array($protocol_data) && count($protocol_data) > 0) |
|
188 | + if (is_array($protocol_data) && count($protocol_data) > 0) |
|
189 | 189 | { |
190 | - foreach($protocol_data as $protocol) |
|
190 | + foreach ($protocol_data as $protocol) |
|
191 | 191 | { |
192 | 192 | $this->AddProtocol($protocol); |
193 | 193 | } |
194 | 194 | return true; |
195 | 195 | } |
196 | - elseif(is_string($protocol_data)) |
|
196 | + elseif (is_string($protocol_data)) |
|
197 | 197 | { |
198 | 198 | $this->AddProtocol($protocol_data); |
199 | 199 | return true; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function Protocols() |
217 | 217 | { |
218 | 218 | $c_args = func_num_args(); |
219 | - if($c_args != 1) |
|
219 | + if ($c_args != 1) |
|
220 | 220 | { |
221 | 221 | trigger_error("kses5::Protocols() did not receive an argument.", E_USER_WARNING); |
222 | 222 | return false; |
@@ -239,27 +239,27 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function AddProtocol($protocol = "") |
241 | 241 | { |
242 | - if(!is_string($protocol)) |
|
242 | + if (!is_string($protocol)) |
|
243 | 243 | { |
244 | 244 | trigger_error("kses5::AddProtocol() requires a string.", E_USER_WARNING); |
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Remove any inadvertent ':' at the end of the protocol. |
249 | - if(substr($protocol, strlen($protocol) - 1, 1) == ":") |
|
249 | + if (substr($protocol, strlen($protocol) - 1, 1) == ":") |
|
250 | 250 | { |
251 | 251 | $protocol = substr($protocol, 0, strlen($protocol) - 1); |
252 | 252 | } |
253 | 253 | |
254 | 254 | $protocol = strtolower(trim($protocol)); |
255 | - if($protocol == "") |
|
255 | + if ($protocol == "") |
|
256 | 256 | { |
257 | 257 | trigger_error("kses5::AddProtocol() tried to add an empty/NULL protocol.", E_USER_WARNING); |
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | |
261 | 261 | // prevent duplicate protocols from being added. |
262 | - if(!in_array($protocol, $this->allowed_protocols)) |
|
262 | + if (!in_array($protocol, $this->allowed_protocols)) |
|
263 | 263 | { |
264 | 264 | array_push($this->allowed_protocols, $protocol); |
265 | 265 | sort($this->allowed_protocols); |
@@ -281,27 +281,27 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function RemoveProtocol($protocol = "") |
283 | 283 | { |
284 | - if(!is_string($protocol)) |
|
284 | + if (!is_string($protocol)) |
|
285 | 285 | { |
286 | 286 | trigger_error("kses5::RemoveProtocol() requires a string.", E_USER_WARNING); |
287 | 287 | return false; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // Remove any inadvertent ':' at the end of the protocol. |
291 | - if(substr($protocol, strlen($protocol) - 1, 1) == ":") |
|
291 | + if (substr($protocol, strlen($protocol) - 1, 1) == ":") |
|
292 | 292 | { |
293 | 293 | $protocol = substr($protocol, 0, strlen($protocol) - 1); |
294 | 294 | } |
295 | 295 | |
296 | 296 | $protocol = strtolower(trim($protocol)); |
297 | - if($protocol == "") |
|
297 | + if ($protocol == "") |
|
298 | 298 | { |
299 | 299 | trigger_error("kses5::RemoveProtocol() tried to remove an empty/NULL protocol.", E_USER_WARNING); |
300 | 300 | return false; |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Ensures that the protocol exists before removing it. |
304 | - if(in_array($protocol, $this->allowed_protocols)) |
|
304 | + if (in_array($protocol, $this->allowed_protocols)) |
|
305 | 305 | { |
306 | 306 | $this->allowed_protocols = array_diff($this->allowed_protocols, array($protocol)); |
307 | 307 | sort($this->allowed_protocols); |
@@ -328,21 +328,21 @@ discard block |
||
328 | 328 | public function RemoveProtocols() |
329 | 329 | { |
330 | 330 | $c_args = func_num_args(); |
331 | - if($c_args != 1) |
|
331 | + if ($c_args != 1) |
|
332 | 332 | { |
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | |
336 | 336 | $protocol_data = func_get_arg(0); |
337 | 337 | |
338 | - if(is_array($protocol_data) && count($protocol_data) > 0) |
|
338 | + if (is_array($protocol_data) && count($protocol_data) > 0) |
|
339 | 339 | { |
340 | - foreach($protocol_data as $protocol) |
|
340 | + foreach ($protocol_data as $protocol) |
|
341 | 341 | { |
342 | 342 | $this->RemoveProtocol($protocol); |
343 | 343 | } |
344 | 344 | } |
345 | - elseif(is_string($protocol_data)) |
|
345 | + elseif (is_string($protocol_data)) |
|
346 | 346 | { |
347 | 347 | $this->RemoveProtocol($protocol_data); |
348 | 348 | return true; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | public function SetProtocols() |
373 | 373 | { |
374 | 374 | $c_args = func_num_args(); |
375 | - if($c_args != 1) |
|
375 | + if ($c_args != 1) |
|
376 | 376 | { |
377 | 377 | trigger_error("kses5::SetProtocols() did not receive an argument.", E_USER_WARNING); |
378 | 378 | return false; |
@@ -380,16 +380,16 @@ discard block |
||
380 | 380 | |
381 | 381 | $protocol_data = func_get_arg(0); |
382 | 382 | |
383 | - if(is_array($protocol_data) && count($protocol_data) > 0) |
|
383 | + if (is_array($protocol_data) && count($protocol_data) > 0) |
|
384 | 384 | { |
385 | 385 | $this->allowed_protocols = array(); |
386 | - foreach($protocol_data as $protocol) |
|
386 | + foreach ($protocol_data as $protocol) |
|
387 | 387 | { |
388 | 388 | $this->AddProtocol($protocol); |
389 | 389 | } |
390 | 390 | return true; |
391 | 391 | } |
392 | - elseif(is_string($protocol_data)) |
|
392 | + elseif (is_string($protocol_data)) |
|
393 | 393 | { |
394 | 394 | $this->allowed_protocols = array(); |
395 | 395 | $this->AddProtocol($protocol_data); |
@@ -447,37 +447,37 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public function AddHTML($tag = "", $attribs = array()) |
449 | 449 | { |
450 | - if(!is_string($tag)) |
|
450 | + if (!is_string($tag)) |
|
451 | 451 | { |
452 | 452 | trigger_error("kses5::AddHTML() requires the tag to be a string", E_USER_WARNING); |
453 | 453 | return false; |
454 | 454 | } |
455 | 455 | |
456 | 456 | $tag = strtolower(trim($tag)); |
457 | - if($tag == "") |
|
457 | + if ($tag == "") |
|
458 | 458 | { |
459 | 459 | trigger_error("kses5::AddHTML() tried to add an empty/NULL tag", E_USER_WARNING); |
460 | 460 | return false; |
461 | 461 | } |
462 | 462 | |
463 | - if(!is_array($attribs)) |
|
463 | + if (!is_array($attribs)) |
|
464 | 464 | { |
465 | 465 | trigger_error("kses5::AddHTML() requires an array (even an empty one) of attributes for '$tag'", E_USER_WARNING); |
466 | 466 | return false; |
467 | 467 | } |
468 | 468 | |
469 | 469 | $new_attribs = array(); |
470 | - if(is_array($attribs) && count($attribs) > 0) |
|
470 | + if (is_array($attribs) && count($attribs) > 0) |
|
471 | 471 | { |
472 | - foreach($attribs as $idx1 => $val1) |
|
472 | + foreach ($attribs as $idx1 => $val1) |
|
473 | 473 | { |
474 | 474 | $new_idx1 = strtolower($idx1); |
475 | 475 | $new_val1 = $attribs[$idx1]; |
476 | 476 | |
477 | - if(is_array($new_val1) && count($attribs) > 0) |
|
477 | + if (is_array($new_val1) && count($attribs) > 0) |
|
478 | 478 | { |
479 | 479 | $tmp_val = array(); |
480 | - foreach($new_val1 as $idx2 => $val2) |
|
480 | + foreach ($new_val1 as $idx2 => $val2) |
|
481 | 481 | { |
482 | 482 | $new_idx2 = strtolower($idx2); |
483 | 483 | $tmp_val[$new_idx2] = $val2; |
@@ -620,14 +620,14 @@ discard block |
||
620 | 620 | { |
621 | 621 | $out_array = array(); |
622 | 622 | |
623 | - if(is_array($in_array) && count($in_array) > 0) |
|
623 | + if (is_array($in_array) && count($in_array) > 0) |
|
624 | 624 | { |
625 | 625 | foreach ($in_array as $in_key => $in_val) |
626 | 626 | { |
627 | 627 | $out_key = strtolower($in_key); |
628 | 628 | $out_array[$out_key] = array(); |
629 | 629 | |
630 | - if(is_array($in_val) && count($in_val) > 0) |
|
630 | + if (is_array($in_val) && count($in_val) > 0) |
|
631 | 631 | { |
632 | 632 | foreach ($in_val as $in_key2 => $in_val2) |
633 | 633 | { |
@@ -732,11 +732,11 @@ discard block |
||
732 | 732 | # Go through $attrarr, and save the allowed attributes for this element |
733 | 733 | # in $attr2 |
734 | 734 | $attr2 = ''; |
735 | - if(is_array($attrarr) && count($attrarr) > 0) |
|
735 | + if (is_array($attrarr) && count($attrarr) > 0) |
|
736 | 736 | { |
737 | 737 | foreach ($attrarr as $arreach) |
738 | 738 | { |
739 | - if(!isset($this->allowed_html[strtolower($element)][strtolower($arreach['name'])])) |
|
739 | + if (!isset($this->allowed_html[strtolower($element)][strtolower($arreach['name'])])) |
|
740 | 740 | { |
741 | 741 | continue; |
742 | 742 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | { |
753 | 753 | # there are some checks |
754 | 754 | $ok = true; |
755 | - if(is_array($current) && count($current) > 0) |
|
755 | + if (is_array($current) && count($current) > 0) |
|
756 | 756 | { |
757 | 757 | foreach ($current as $currkey => $currval) |
758 | 758 | { |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | 'whole' => $attrname, |
835 | 835 | 'vless' => 'y' |
836 | 836 | ); |
837 | - $attr = preg_replace('/^\s+/', '', $attr); |
|
837 | + $attr = preg_replace('/^\s+/', '', $attr); |
|
838 | 838 | } |
839 | 839 | break; |
840 | 840 | case 2: # attribute value, a URL after href= for instance |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $attrarr[] = array( |
845 | 845 | 'name' => $attrname, |
846 | 846 | 'value' => $thisval, |
847 | - 'whole' => $attrname . '="' . $thisval . '"', |
|
847 | + 'whole' => $attrname.'="'.$thisval.'"', |
|
848 | 848 | 'vless' => 'n' |
849 | 849 | ); |
850 | 850 | $working = 1; |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $attrarr[] = array( |
873 | 873 | 'name' => $attrname, |
874 | 874 | 'value' => $thisval, |
875 | - 'whole' => $attrname . '="' . $thisval . '"', |
|
875 | + 'whole' => $attrname.'="'.$thisval.'"', |
|
876 | 876 | 'vless' => 'n' |
877 | 877 | ); |
878 | 878 | # We add quotes to conform to W3C's HTML spec. |
@@ -922,10 +922,10 @@ discard block |
||
922 | 922 | { |
923 | 923 | $string = $this->RemoveNulls($string); |
924 | 924 | $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature" |
925 | - $string2 = $string . 'a'; |
|
925 | + $string2 = $string.'a'; |
|
926 | 926 | |
927 | 927 | $string2 = preg_split('/:|:|:/i', $string, 2); |
928 | - if(isset($string2[1]) && !preg_match('%/\?%',$string2[0])) |
|
928 | + if (isset($string2[1]) && !preg_match('%/\?%', $string2[0])) |
|
929 | 929 | { |
930 | 930 | $string = $this->filterProtocols($string2[0]).trim($string2[1]); |
931 | 931 | } |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | $string = preg_replace('/\xad+/', '', $string2); # deals with Opera "feature" |
953 | 953 | $string = strtolower($string); |
954 | 954 | |
955 | - if(is_array($this->allowed_protocols) && count($this->allowed_protocols) > 0) |
|
955 | + if (is_array($this->allowed_protocols) && count($this->allowed_protocols) > 0) |
|
956 | 956 | { |
957 | 957 | foreach ($this->allowed_protocols as $one_protocol) |
958 | 958 | { |
@@ -989,8 +989,8 @@ discard block |
||
989 | 989 | private function checkAttributeValue($value, $vless, $checkname, $checkvalue) |
990 | 990 | { |
991 | 991 | $ok = true; |
992 | - $check_attribute_method_name = 'checkAttributeValue' . ucfirst(strtolower($checkname)); |
|
993 | - if(method_exists($this, $check_attribute_method_name)) |
|
992 | + $check_attribute_method_name = 'checkAttributeValue'.ucfirst(strtolower($checkname)); |
|
993 | + if (method_exists($this, $check_attribute_method_name)) |
|
994 | 994 | { |
995 | 995 | $ok = $this->$check_attribute_method_name($value, $checkvalue, $vless); |
996 | 996 | } |
@@ -5,11 +5,11 @@ discard block |
||
5 | 5 | // current valid email address at http://chaos.org/contact/ |
6 | 6 | |
7 | 7 | // Make sure we're in a usable PHP environment |
8 | - if(substr(phpversion(), 0, 1) < 4) |
|
8 | + if (substr(phpversion(), 0, 1) < 4) |
|
9 | 9 | { |
10 | 10 | define('KSESTEST_VER', 0); |
11 | 11 | } |
12 | - elseif(substr(phpversion(), 0, 1) >= 5) |
|
12 | + elseif (substr(phpversion(), 0, 1) >= 5) |
|
13 | 13 | { |
14 | 14 | define('KSESTEST_VER', 5); |
15 | 15 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | // See if we're in command line or web |
22 | - if($_SERVER["DOCUMENT_ROOT"] == "") |
|
22 | + if ($_SERVER["DOCUMENT_ROOT"] == "") |
|
23 | 23 | { |
24 | 24 | define('KSESTEST_ENV', 'CLI'); |
25 | 25 | } |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | define('KSESTEST_ENV', 'WEB'); |
29 | 29 | } |
30 | 30 | |
31 | - if(KSESTEST_VER == 0) |
|
31 | + if (KSESTEST_VER == 0) |
|
32 | 32 | { |
33 | 33 | $message = array( |
34 | 34 | "Error: Not using a current version of PHP!", |
35 | - "You are using PHP version " . phpversion() . ".", |
|
35 | + "You are using PHP version ".phpversion().".", |
|
36 | 36 | "KSES Class version requires PHP4 or better.", |
37 | 37 | "KSES test program ending." |
38 | 38 | ); |
@@ -44,27 +44,27 @@ discard block |
||
44 | 44 | exit(); |
45 | 45 | } |
46 | 46 | |
47 | - $include_file = "php" . KSESTEST_VER . ".class.kses.php"; |
|
48 | - if(file_exists($include_file) && is_readable($include_file)) |
|
47 | + $include_file = "php".KSESTEST_VER.".class.kses.php"; |
|
48 | + if (file_exists($include_file) && is_readable($include_file)) |
|
49 | 49 | { |
50 | 50 | include_once($include_file); |
51 | 51 | } |
52 | 52 | else |
53 | 53 | { |
54 | 54 | $message = array( |
55 | - "Error: Unable to find '" . $include_file . "'.", |
|
55 | + "Error: Unable to find '".$include_file."'.", |
|
56 | 56 | "Please check your include path and make sure the file is available.", |
57 | - "Path: " . ini_get('include_path') |
|
57 | + "Path: ".ini_get('include_path') |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | displayPage( |
61 | - array('title' => 'Unable to include ' . $include_file, 'message' => $message) |
|
61 | + array('title' => 'Unable to include '.$include_file, 'message' => $message) |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | exit(); |
65 | 65 | } |
66 | 66 | |
67 | - $kses_type = "kses" . KSESTEST_VER; |
|
67 | + $kses_type = "kses".KSESTEST_VER; |
|
68 | 68 | $myKses = new $kses_type; |
69 | 69 | |
70 | 70 | $test_text = array(); |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | |
99 | 99 | $out_li = array(); |
100 | 100 | // Keep only allowed HTML from the presumed 'form'. |
101 | - foreach($test_tags as $tag) |
|
101 | + foreach ($test_tags as $tag) |
|
102 | 102 | { |
103 | 103 | $temp = $myKses->Parse($tag); |
104 | 104 | $check = ($temp == $tag) ? true : false; |
105 | 105 | $text = ($temp == $tag) ? 'pass' : 'fail'; |
106 | 106 | |
107 | - $li_text = output_testresult($check, $text) . output_newline(); |
|
108 | - $li_text .= "Input: " . output_translate($tag) . output_newline(); |
|
109 | - $li_text .= "Output: " . output_translate($temp); |
|
110 | - if(KSESTEST_ENV == 'CLI') |
|
107 | + $li_text = output_testresult($check, $text).output_newline(); |
|
108 | + $li_text .= "Input: ".output_translate($tag).output_newline(); |
|
109 | + $li_text .= "Output: ".output_translate($temp); |
|
110 | + if (KSESTEST_ENV == 'CLI') |
|
111 | 111 | { |
112 | 112 | $li_text .= output_newline(); |
113 | 113 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | function output_code_wrap($text) |
125 | 125 | { |
126 | - if(KSESTEST_ENV == 'CLI') |
|
126 | + if (KSESTEST_ENV == 'CLI') |
|
127 | 127 | { |
128 | 128 | return $text; |
129 | 129 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | function output_translate($text) |
137 | 137 | { |
138 | - if(KSESTEST_ENV == 'CLI') |
|
138 | + if (KSESTEST_ENV == 'CLI') |
|
139 | 139 | { |
140 | 140 | return $text; |
141 | 141 | } |
@@ -147,26 +147,26 @@ discard block |
||
147 | 147 | |
148 | 148 | function output_testresult($pass = false, $text = "") |
149 | 149 | { |
150 | - if(KSESTEST_ENV == 'CLI') |
|
150 | + if (KSESTEST_ENV == 'CLI') |
|
151 | 151 | { |
152 | - return '[' . $text . ']'; |
|
152 | + return '['.$text.']'; |
|
153 | 153 | } |
154 | 154 | else |
155 | 155 | { |
156 | - if($pass == true) |
|
156 | + if ($pass == true) |
|
157 | 157 | { |
158 | - return '<span style="color: green;">[' . $text . ']</span>'; |
|
158 | + return '<span style="color: green;">['.$text.']</span>'; |
|
159 | 159 | } |
160 | 160 | else |
161 | 161 | { |
162 | - return '<span style="color: red;">[' . $text . ']</span>'; |
|
162 | + return '<span style="color: red;">['.$text.']</span>'; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | 167 | function output_spaces() |
168 | 168 | { |
169 | - if(KSESTEST_ENV == 'WEB') |
|
169 | + if (KSESTEST_ENV == 'WEB') |
|
170 | 170 | { |
171 | 171 | $out = " "; |
172 | 172 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | function output_newline() |
182 | 182 | { |
183 | - if(KSESTEST_ENV == 'WEB') |
|
183 | + if (KSESTEST_ENV == 'WEB') |
|
184 | 184 | { |
185 | 185 | $out = "<br />\n"; |
186 | 186 | } |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | |
200 | 200 | $out = ""; |
201 | 201 | |
202 | - foreach($message as $text) |
|
202 | + foreach ($message as $text) |
|
203 | 203 | { |
204 | - if(KSESTEST_ENV == 'WEB') |
|
204 | + if (KSESTEST_ENV == 'WEB') |
|
205 | 205 | { |
206 | 206 | $header = "\t\t<h1>$title</h1>\n\t\t<hr />\n"; |
207 | 207 | $out .= "\t\t<p>\n"; |
@@ -210,12 +210,12 @@ discard block |
||
210 | 210 | } |
211 | 211 | else |
212 | 212 | { |
213 | - $header = "$title\n" . str_repeat('-', 60) . "\n\n"; |
|
213 | + $header = "$title\n".str_repeat('-', 60)."\n\n"; |
|
214 | 214 | $out .= "\t$text\n\n"; |
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - if(KSESTEST_ENV == 'WEB') |
|
218 | + if (KSESTEST_ENV == 'WEB') |
|
219 | 219 | { |
220 | 220 | echo "<html>\n"; |
221 | 221 | echo "\t<head>\n"; |
@@ -236,28 +236,28 @@ discard block |
||
236 | 236 | |
237 | 237 | function output_hr() |
238 | 238 | { |
239 | - if(KSESTEST_ENV == 'WEB') |
|
239 | + if (KSESTEST_ENV == 'WEB') |
|
240 | 240 | { |
241 | 241 | return "\t\t\t<hr />\n"; |
242 | 242 | } |
243 | 243 | else |
244 | 244 | { |
245 | - return str_repeat(60, '-') . "\n"; |
|
245 | + return str_repeat(60, '-')."\n"; |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | 249 | function output_ul($data = array(), $padding = "") |
250 | 250 | { |
251 | - if(!is_array($data) || count($data) < 1) |
|
251 | + if (!is_array($data) || count($data) < 1) |
|
252 | 252 | { |
253 | 253 | return ""; |
254 | 254 | } |
255 | 255 | |
256 | 256 | $text = ""; |
257 | - if(KSESTEST_ENV == 'WEB') |
|
257 | + if (KSESTEST_ENV == 'WEB') |
|
258 | 258 | { |
259 | 259 | $text = "\t\t\t<ul>\n"; |
260 | - foreach($data as $li) |
|
260 | + foreach ($data as $li) |
|
261 | 261 | { |
262 | 262 | $text .= "\t\t\t\t<li>$li</li>\n"; |
263 | 263 | } |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | } |
266 | 266 | else |
267 | 267 | { |
268 | - foreach($data as $li) |
|
268 | + foreach ($data as $li) |
|
269 | 269 | { |
270 | - $text .= $padding . " * $li\n"; |
|
270 | + $text .= $padding." * $li\n"; |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
@@ -278,32 +278,32 @@ discard block |
||
278 | 278 | { |
279 | 279 | $default_prots = $myKses->dumpProtocols(); |
280 | 280 | $out_text = array(); |
281 | - if(count($default_prots) > 0) |
|
281 | + if (count($default_prots) > 0) |
|
282 | 282 | { |
283 | - array_push($out_text, "Initial protocols from KSES" . KSESTEST_VER . ":"); |
|
283 | + array_push($out_text, "Initial protocols from KSES".KSESTEST_VER.":"); |
|
284 | 284 | array_push($out_text, output_ul($default_prots)); |
285 | 285 | array_push($out_text, output_hr()); |
286 | 286 | } |
287 | 287 | |
288 | - $myKses->AddProtocols(array("proto1", "proto2:", "proto3")); // Add a list of protocols |
|
289 | - $myKses->AddProtocols("proto4:"); // Add a single protocol (Note ':' is optional at end) |
|
288 | + $myKses->AddProtocols(array("proto1", "proto2:", "proto3")); // Add a list of protocols |
|
289 | + $myKses->AddProtocols("proto4:"); // Add a single protocol (Note ':' is optional at end) |
|
290 | 290 | $myKses->AddProtocol("proto9", "mystery:", "anarchy"); |
291 | 291 | $myKses->AddProtocol("alpha", "beta", "gamma:"); |
292 | 292 | |
293 | 293 | $add_protocol = "\t\t\t<ol>\n"; |
294 | - $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocols(array("proto1", "proto2:", "proto3"));</li>' . "\n"; |
|
295 | - $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocols("proto4:");</li>' . "\n"; |
|
296 | - $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocols("proto4:");</li>' . "\n"; |
|
297 | - $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocol("proto9", "mystery:", "anarchy");</li>' . "\n"; |
|
298 | - $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocol("alpha", "beta", "gamma:");</li>' . "\n"; |
|
294 | + $add_protocol .= "\t\t\t\t".'<li>$myKses->AddProtocols(array("proto1", "proto2:", "proto3"));</li>'."\n"; |
|
295 | + $add_protocol .= "\t\t\t\t".'<li>$myKses->AddProtocols("proto4:");</li>'."\n"; |
|
296 | + $add_protocol .= "\t\t\t\t".'<li>$myKses->AddProtocols("proto4:");</li>'."\n"; |
|
297 | + $add_protocol .= "\t\t\t\t".'<li>$myKses->AddProtocol("proto9", "mystery:", "anarchy");</li>'."\n"; |
|
298 | + $add_protocol .= "\t\t\t\t".'<li>$myKses->AddProtocol("alpha", "beta", "gamma:");</li>'."\n"; |
|
299 | 299 | $add_protocol .= "\t\t\t</ol>\n"; |
300 | 300 | |
301 | 301 | array_push($out_text, $add_protocol); |
302 | 302 | |
303 | 303 | $new_prots = $myKses->dumpProtocols(); |
304 | - if(count($new_prots) > 0) |
|
304 | + if (count($new_prots) > 0) |
|
305 | 305 | { |
306 | - array_push($out_text, "New protocols from KSES" . KSESTEST_VER . " after using AddProtocol(s):"); |
|
306 | + array_push($out_text, "New protocols from KSES".KSESTEST_VER." after using AddProtocol(s):"); |
|
307 | 307 | array_push($out_text, output_ul($new_prots)); |
308 | 308 | array_push($out_text, output_hr()); |
309 | 309 | } |
@@ -314,31 +314,31 @@ discard block |
||
314 | 314 | $myKses->RemoveProtocol("gamma"); |
315 | 315 | |
316 | 316 | $remove_protocol = "\t\t\t<ol>\n"; |
317 | - $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocols(array("mystery", "anarchy:"));</li>' . "\n"; |
|
318 | - $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocols("alpha:");</li>' . "\n"; |
|
319 | - $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocol("beta:");</li>' . "\n"; |
|
320 | - $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocol("gamma");</li>' . "\n"; |
|
317 | + $remove_protocol .= "\t\t\t\t".'<li>$myKses->RemoveProtocols(array("mystery", "anarchy:"));</li>'."\n"; |
|
318 | + $remove_protocol .= "\t\t\t\t".'<li>$myKses->RemoveProtocols("alpha:");</li>'."\n"; |
|
319 | + $remove_protocol .= "\t\t\t\t".'<li>$myKses->RemoveProtocol("beta:");</li>'."\n"; |
|
320 | + $remove_protocol .= "\t\t\t\t".'<li>$myKses->RemoveProtocol("gamma");</li>'."\n"; |
|
321 | 321 | $remove_protocol .= "\t\t\t</ol>\n"; |
322 | 322 | array_push($out_text, $remove_protocol); |
323 | 323 | |
324 | 324 | $new_prots = $myKses->dumpProtocols(); |
325 | - if(count($new_prots) > 0) |
|
325 | + if (count($new_prots) > 0) |
|
326 | 326 | { |
327 | - array_push($out_text, "Resulting protocols from KSES" . KSESTEST_VER . " after using RemoveProtocol(s):"); |
|
327 | + array_push($out_text, "Resulting protocols from KSES".KSESTEST_VER." after using RemoveProtocol(s):"); |
|
328 | 328 | array_push($out_text, output_ul($new_prots)); |
329 | 329 | array_push($out_text, output_hr()); |
330 | 330 | } |
331 | 331 | |
332 | 332 | $myKses->SetProtocols(array("https", "gopher", "news")); |
333 | 333 | $set_protocol = "\t\t\t<ol>\n"; |
334 | - $set_protocol .= "\t\t\t\t" . '<li>$myKses->SetProtocols(array("https", "gopher", "news"));</li>' . "\n"; |
|
334 | + $set_protocol .= "\t\t\t\t".'<li>$myKses->SetProtocols(array("https", "gopher", "news"));</li>'."\n"; |
|
335 | 335 | $set_protocol .= "\t\t\t</ol>\n"; |
336 | 336 | array_push($out_text, $set_protocol); |
337 | 337 | |
338 | 338 | $new_prots = $myKses->dumpProtocols(); |
339 | - if(count($new_prots) > 0) |
|
339 | + if (count($new_prots) > 0) |
|
340 | 340 | { |
341 | - array_push($out_text, "Resulting protocols from KSES" . KSESTEST_VER . " after using SetProtocols:"); |
|
341 | + array_push($out_text, "Resulting protocols from KSES".KSESTEST_VER." after using SetProtocols:"); |
|
342 | 342 | array_push($out_text, output_ul($new_prots)); |
343 | 343 | array_push($out_text, output_hr()); |
344 | 344 | } |
@@ -427,18 +427,18 @@ discard block |
||
427 | 427 | array_push($out, "Net results:"); |
428 | 428 | |
429 | 429 | $out_elems = $myKses->DumpElements(); |
430 | - if(count($out_elems) > 0) |
|
430 | + if (count($out_elems) > 0) |
|
431 | 431 | { |
432 | 432 | //array_push($out, "\t\t\t<ul>\n"); |
433 | - foreach($out_elems as $tag => $attr_data) |
|
433 | + foreach ($out_elems as $tag => $attr_data) |
|
434 | 434 | { |
435 | 435 | $out_li_elems = array(); |
436 | 436 | $elem_text = "(X)HTML element $tag"; |
437 | 437 | $allow = ""; |
438 | - if(isset($attr_data) && is_array($attr_data) && count($attr_data) > 0) |
|
438 | + if (isset($attr_data) && is_array($attr_data) && count($attr_data) > 0) |
|
439 | 439 | { |
440 | 440 | $allow = " allows attribute"; |
441 | - if(count($attr_data) > 1) |
|
441 | + if (count($attr_data) > 1) |
|
442 | 442 | { |
443 | 443 | $allow .= "s"; |
444 | 444 | } |
@@ -448,31 +448,31 @@ discard block |
||
448 | 448 | array_push($out_li_elems, "$elem_text$allow"); |
449 | 449 | |
450 | 450 | $attr_test_li = array(); |
451 | - if(isset($attr_data) && is_array($attr_data) && count($attr_data) > 0) |
|
451 | + if (isset($attr_data) && is_array($attr_data) && count($attr_data) > 0) |
|
452 | 452 | { |
453 | - foreach($attr_data as $attr_name => $attr_tests) |
|
453 | + foreach ($attr_data as $attr_name => $attr_tests) |
|
454 | 454 | { |
455 | 455 | $li_text = $attr_name; |
456 | - if(isset($attr_tests) && count($attr_tests) > 0) |
|
456 | + if (isset($attr_tests) && count($attr_tests) > 0) |
|
457 | 457 | { |
458 | - foreach($attr_tests as $test_name => $test_val) |
|
458 | + foreach ($attr_tests as $test_name => $test_val) |
|
459 | 459 | { |
460 | - switch($test_name) |
|
460 | + switch ($test_name) |
|
461 | 461 | { |
462 | 462 | case "maxlen": |
463 | - $li_text .= " - maximum length of '" . $test_val . "' characters"; |
|
463 | + $li_text .= " - maximum length of '".$test_val."' characters"; |
|
464 | 464 | break; |
465 | 465 | case "minlen": |
466 | - $li_text .= " - minimum length of '" . $test_val . "' characters"; |
|
466 | + $li_text .= " - minimum length of '".$test_val."' characters"; |
|
467 | 467 | break; |
468 | 468 | case "minval": |
469 | - $li_text .= " - minimum value of '" . $test_val . "'"; |
|
469 | + $li_text .= " - minimum value of '".$test_val."'"; |
|
470 | 470 | break; |
471 | 471 | case "maxval": |
472 | - $li_text .= " - maximum value of '" . $test_val . "'"; |
|
472 | + $li_text .= " - maximum value of '".$test_val."'"; |
|
473 | 473 | break; |
474 | 474 | case "valueless": |
475 | - switch(strtolower($test_val)) |
|
475 | + switch (strtolower($test_val)) |
|
476 | 476 | { |
477 | 477 | case 'n': |
478 | 478 | $li_text .= " - must not be valueless"; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | } |
492 | 492 | array_push($attr_test_li, $li_text); |
493 | 493 | } |
494 | - if(count($attr_test_li) > 0) |
|
494 | + if (count($attr_test_li) > 0) |
|
495 | 495 | { |
496 | 496 | $attr_test_li = output_ul($attr_test_li, " "); |
497 | 497 | $out_li_elems = array("$elem_text$allow$attr_test_li"); |