@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | { |
379 | 379 | $val = 'CASE '; |
380 | 380 | foreach ($members as $k => $v) |
381 | - $val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, true) . ' '; |
|
381 | + $val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, true) . ' '; |
|
382 | 382 | |
383 | 383 | $val = $val . ' END'; |
384 | 384 | $type = 'raw'; |
@@ -1045,11 +1045,11 @@ discard block |
||
1045 | 1045 | // Anything that isn't a specification, punctuation mark, or whitespace. |
1046 | 1046 | '~(?<!%)\p{L}|[^\p{L}\p{P}\s]~u', |
1047 | 1047 | // A series of punctuation marks (except %), possibly separated by whitespace. |
1048 | - '~([^%\P{P}])(\s*)(?'.'>(\1|[^%\P{Po}])\s*(?!$))*~u', |
|
1048 | + '~([^%\P{P}])(\s*)(?' . '>(\1|[^%\P{Po}])\s*(?!$))*~u', |
|
1049 | 1049 | // Unwanted trailing punctuation and whitespace. |
1050 | - '~(?'.'>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u', |
|
1050 | + '~(?' . '>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u', |
|
1051 | 1051 | // Unwanted opening punctuation and whitespace. |
1052 | - '~^\s*(?'.'>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u', |
|
1052 | + '~^\s*(?' . '>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u', |
|
1053 | 1053 | ), |
1054 | 1054 | array( |
1055 | 1055 | '', |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | elseif (!empty($context['character_set']) && is_callable('mb_decode_numericentity')) |
1140 | 1140 | { |
1141 | 1141 | // Get whatever the default replacement character is for this encoding. |
1142 | - $substitute = mb_decode_numericentity('�', array(0xFFFD,0xFFFD,0,0xFFFF), $context['character_set']); |
|
1142 | + $substitute = mb_decode_numericentity('�', array(0xFFFD, 0xFFFD, 0, 0xFFFF), $context['character_set']); |
|
1143 | 1143 | } |
1144 | 1144 | else |
1145 | 1145 | $substitute = '?'; |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | $returnContext .= '<img src="' . $currentAttachment['href'] . '"' . $alt . $title . ' class="bbc_img">'; |
1625 | 1625 | else |
1626 | 1626 | { |
1627 | - $width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"': ''; |
|
1627 | + $width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : ''; |
|
1628 | 1628 | $height = !empty($params['{height}']) ? 'height="' . $params['{height}'] . '"' : ''; |
1629 | 1629 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img resized"/>'; |
1630 | 1630 | } |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | $width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : ''; |
1636 | 1636 | $height = !empty($params['{height}']) ? ' height="' . $params['{height}'] . '"' : ''; |
1637 | 1637 | |
1638 | - $returnContext .= '<div class="videocontainer"><video controls preload="metadata" src="'. $currentAttachment['href'] . '" playsinline' . $width . $height . '><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : ''); |
|
1638 | + $returnContext .= '<div class="videocontainer"><video controls preload="metadata" src="' . $currentAttachment['href'] . '" playsinline' . $width . $height . '><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : ''); |
|
1639 | 1639 | } |
1640 | 1640 | // Audio. |
1641 | 1641 | elseif (strpos($currentAttachment['mime_type'], 'audio/') === 0) |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | $width = 'max-width:100%; width: ' . (!empty($params['{width}']) ? $params['{width}'] : '400') . 'px;'; |
1644 | 1644 | $height = !empty($params['{height}']) ? 'height: ' . $params['{height}'] . 'px;' : ''; |
1645 | 1645 | |
1646 | - $returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="'. $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>'; |
|
1646 | + $returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="' . $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>'; |
|
1647 | 1647 | } |
1648 | 1648 | // Anything else. |
1649 | 1649 | else |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | 'type' => 'unparsed_commas_content', |
1813 | 1813 | 'test' => '\d+,\d+\]', |
1814 | 1814 | 'content' => '<a href="$1" target="_blank" rel="noopener">$1</a>', |
1815 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1815 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1816 | 1816 | { |
1817 | 1817 | $data[0] = normalize_iri($data[0]); |
1818 | 1818 | |
@@ -1938,8 +1938,8 @@ discard block |
||
1938 | 1938 | else |
1939 | 1939 | $url = get_proxied_url($url); |
1940 | 1940 | |
1941 | - $alt = !empty($params['{alt}']) ? ' alt="' . $params['{alt}']. '"' : ' alt=""'; |
|
1942 | - $title = !empty($params['{title}']) ? ' title="' . $params['{title}']. '"' : ''; |
|
1941 | + $alt = !empty($params['{alt}']) ? ' alt="' . $params['{alt}'] . '"' : ' alt=""'; |
|
1942 | + $title = !empty($params['{title}']) ? ' title="' . $params['{title}'] . '"' : ''; |
|
1943 | 1943 | |
1944 | 1944 | $data = isset($disabled[$tag['tag']]) ? $url : '<img src="' . $url . '"' . $alt . $title . $params['{width}'] . $params['{height}'] . ' class="bbc_img' . (!empty($params['{width}']) || !empty($params['{height}']) ? ' resized' : '') . '" loading="lazy">'; |
1945 | 1945 | }, |
@@ -2370,12 +2370,12 @@ discard block |
||
2370 | 2370 | $codes[] = array( |
2371 | 2371 | 'tag' => 'cowsay', |
2372 | 2372 | 'parameters' => array( |
2373 | - 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc) |
|
2373 | + 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function($eyes) use ($smcFunc) |
|
2374 | 2374 | { |
2375 | 2375 | return $smcFunc['substr']($eyes . 'oo', 0, 2); |
2376 | 2376 | }, |
2377 | 2377 | ), |
2378 | - 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function ($tongue) use ($smcFunc) |
|
2378 | + 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function($tongue) use ($smcFunc) |
|
2379 | 2379 | { |
2380 | 2380 | return $smcFunc['substr']($tongue . ' ', 0, 2); |
2381 | 2381 | }, |
@@ -4080,7 +4080,7 @@ discard block |
||
4080 | 4080 | if ($fp != false) |
4081 | 4081 | { |
4082 | 4082 | // Send the HEAD request (since we don't have to worry about chunked, HTTP/1.1 is fine here.) |
4083 | - fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: '. SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n"); |
|
4083 | + fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: ' . SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n"); |
|
4084 | 4084 | |
4085 | 4085 | // Read in the HTTP/1.1 or whatever. |
4086 | 4086 | $test = substr(fgets($fp, 11), -1); |
@@ -4676,7 +4676,7 @@ discard block |
||
4676 | 4676 | |
4677 | 4677 | uasort( |
4678 | 4678 | $context['css_files'], |
4679 | - function ($a, $b) |
|
4679 | + function($a, $b) |
|
4680 | 4680 | { |
4681 | 4681 | return $a['options']['order_pos'] < $b['options']['order_pos'] ? -1 : ($a['options']['order_pos'] > $b['options']['order_pos'] ? 1 : 0); |
4682 | 4682 | } |
@@ -5973,7 +5973,7 @@ discard block |
||
5973 | 5973 | { |
5974 | 5974 | fwrite($fp, 'GET ' . ($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '') . ' HTTP/1.0' . "\r\n"); |
5975 | 5975 | fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n"); |
5976 | - fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n"); |
|
5976 | + fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n"); |
|
5977 | 5977 | if ($keep_alive) |
5978 | 5978 | fwrite($fp, 'connection: Keep-Alive' . "\r\n\r\n"); |
5979 | 5979 | else |
@@ -5983,7 +5983,7 @@ discard block |
||
5983 | 5983 | { |
5984 | 5984 | fwrite($fp, 'POST ' . ($match[6] !== '/' ? $match[6] : '') . ' HTTP/1.0' . "\r\n"); |
5985 | 5985 | fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n"); |
5986 | - fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n"); |
|
5986 | + fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n"); |
|
5987 | 5987 | if ($keep_alive) |
5988 | 5988 | fwrite($fp, 'connection: Keep-Alive' . "\r\n"); |
5989 | 5989 | else |
@@ -6232,13 +6232,13 @@ discard block |
||
6232 | 6232 | |
6233 | 6233 | // UTF-8 occurences of MS special characters |
6234 | 6234 | $findchars_utf8 = array( |
6235 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
6236 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
6237 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
6238 | - "\xe2\x80\x98", // left single curly quote |
|
6239 | - "\xe2\x80\x99", // right single curly quote |
|
6240 | - "\xe2\x80\x9c", // left double curly quote |
|
6241 | - "\xe2\x80\x9d", // right double curly quote |
|
6235 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
6236 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
6237 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
6238 | + "\xe2\x80\x98", // left single curly quote |
|
6239 | + "\xe2\x80\x99", // right single curly quote |
|
6240 | + "\xe2\x80\x9c", // left double curly quote |
|
6241 | + "\xe2\x80\x9d", // right double curly quote |
|
6242 | 6242 | ); |
6243 | 6243 | |
6244 | 6244 | // windows 1252 / iso equivalents |
@@ -6254,13 +6254,13 @@ discard block |
||
6254 | 6254 | |
6255 | 6255 | // safe replacements |
6256 | 6256 | $replacechars = array( |
6257 | - ',', // ‚ |
|
6258 | - ',,', // „ |
|
6259 | - '...', // … |
|
6260 | - "'", // ‘ |
|
6261 | - "'", // ’ |
|
6262 | - '"', // “ |
|
6263 | - '"', // ” |
|
6257 | + ',', // ‚ |
|
6258 | + ',,', // „ |
|
6259 | + '...', // … |
|
6260 | + "'", // ‘ |
|
6261 | + "'", // ’ |
|
6262 | + '"', // “ |
|
6263 | + '"', // ” |
|
6264 | 6264 | ); |
6265 | 6265 | |
6266 | 6266 | if ($context['utf8']) |
@@ -6621,7 +6621,7 @@ discard block |
||
6621 | 6621 | // We don't want abbreviations like '+03' or '-11'. |
6622 | 6622 | $abbrs = array_filter( |
6623 | 6623 | $tzvalue['abbrs'], |
6624 | - function ($abbr) |
|
6624 | + function($abbr) |
|
6625 | 6625 | { |
6626 | 6626 | return !strspn($abbr, '+-'); |
6627 | 6627 | } |
@@ -7610,7 +7610,7 @@ discard block |
||
7610 | 7610 | EXISTS ( |
7611 | 7611 | SELECT bpv.id_board |
7612 | 7612 | FROM ' . $db_prefix . 'board_permissions_view AS bpv |
7613 | - WHERE bpv.id_group IN ('. implode(',', $groups) .') |
|
7613 | + WHERE bpv.id_group IN ('. implode(',', $groups) . ') |
|
7614 | 7614 | AND bpv.deny = 0 |
7615 | 7615 | AND bpv.id_board = b.id_board |
7616 | 7616 | )'; |
@@ -7620,7 +7620,7 @@ discard block |
||
7620 | 7620 | AND NOT EXISTS ( |
7621 | 7621 | SELECT bpv.id_board |
7622 | 7622 | FROM ' . $db_prefix . 'board_permissions_view AS bpv |
7623 | - WHERE bpv.id_group IN ( '. implode(',', $groups) .') |
|
7623 | + WHERE bpv.id_group IN ( '. implode(',', $groups) . ') |
|
7624 | 7624 | AND bpv.deny = 1 |
7625 | 7625 | AND bpv.id_board = b.id_board |
7626 | 7626 | )'; |
@@ -8027,8 +8027,8 @@ discard block |
||
8027 | 8027 | $i = 0; |
8028 | 8028 | while (empty($done)) |
8029 | 8029 | { |
8030 | - if (strpos($format, '{'. --$i . '}') !== false) |
|
8031 | - $replacements['{'. $i . '}'] = array_pop($list); |
|
8030 | + if (strpos($format, '{' . --$i . '}') !== false) |
|
8031 | + $replacements['{' . $i . '}'] = array_pop($list); |
|
8032 | 8032 | else |
8033 | 8033 | $done = true; |
8034 | 8034 | } |
@@ -8038,8 +8038,8 @@ discard block |
||
8038 | 8038 | $i = 0; |
8039 | 8039 | while (empty($done)) |
8040 | 8040 | { |
8041 | - if (strpos($format, '{'. ++$i . '}') !== false) |
|
8042 | - $replacements['{'. $i . '}'] = array_shift($list); |
|
8041 | + if (strpos($format, '{' . ++$i . '}') !== false) |
|
8042 | + $replacements['{' . $i . '}'] = array_shift($list); |
|
8043 | 8043 | else |
8044 | 8044 | $done = true; |
8045 | 8045 | } |
@@ -8217,7 +8217,7 @@ discard block |
||
8217 | 8217 | if (empty($stringSubject)) |
8218 | 8218 | return ''; |
8219 | 8219 | |
8220 | - $translatable_tokens = preg_match_all('/{(.*?)}/' , $stringSubject, $matches); |
|
8220 | + $translatable_tokens = preg_match_all('/{(.*?)}/', $stringSubject, $matches); |
|
8221 | 8221 | $toFind = array(); |
8222 | 8222 | $replaceWith = array(); |
8223 | 8223 |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | if ($func_name !== 'utf8_default_ignorables') { |
242 | 242 | $func_text .= '"'; |
243 | 243 | |
244 | - $key = mb_decode_numericentity(str_replace(' ', '', $key), array(0,0x10FFFF,0,0xFFFFFF), 'UTF-8'); |
|
244 | + $key = mb_decode_numericentity(str_replace(' ', '', $key), array(0, 0x10FFFF, 0, 0xFFFFFF), 'UTF-8'); |
|
245 | 245 | |
246 | 246 | foreach (unpack('C*', $key) as $byte_value) { |
247 | 247 | $func_text .= '\\x' . strtoupper(dechex($byte_value)); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } else { |
256 | 256 | $func_text .= '"'; |
257 | 257 | |
258 | - $value = mb_decode_numericentity(str_replace(' ', '', $value), array(0,0x10FFFF,0,0xFFFFFF), 'UTF-8'); |
|
258 | + $value = mb_decode_numericentity(str_replace(' ', '', $value), array(0, 0x10FFFF, 0, 0xFFFFFF), 'UTF-8'); |
|
259 | 259 | foreach (unpack('C*', $value) as $byte_value) { |
260 | 260 | $func_text .= '\\x' . strtoupper(dechex($byte_value)); |
261 | 261 | } |
@@ -38,7 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | // We need some of these for further analysis below. |
40 | 40 | $derived_normalization_props = array(); |
41 | -foreach (file($unicode_data_url . '/DerivedNormalizationProps.txt') as $line) { |
|
41 | +foreach (file($unicode_data_url . '/DerivedNormalizationProps.txt') as $line) |
|
42 | +{ |
|
42 | 43 | $line = substr($line, 0, strcspn($line, '#')); |
43 | 44 | |
44 | 45 | if (strpos($line, ';') === false) |
@@ -46,17 +47,22 @@ discard block |
||
46 | 47 | |
47 | 48 | $fields = explode(';', $line); |
48 | 49 | |
49 | - foreach ($fields as $key => $value) { |
|
50 | + foreach ($fields as $key => $value) |
|
51 | + { |
|
50 | 52 | $fields[$key] = trim($value); |
51 | 53 | } |
52 | 54 | |
53 | - if (!isset($derived_normalization_props[$fields[1]])) { |
|
55 | + if (!isset($derived_normalization_props[$fields[1]])) |
|
56 | + { |
|
54 | 57 | $derived_normalization_props[$fields[1]] = array(); |
55 | 58 | } |
56 | 59 | |
57 | - if (strpos($fields[0], '..') === false) { |
|
60 | + if (strpos($fields[0], '..') === false) |
|
61 | + { |
|
58 | 62 | $entities = array('&#x' . $fields[0] . ';'); |
59 | - } else { |
|
63 | + } |
|
64 | + else |
|
65 | + { |
|
60 | 66 | $entities = array(); |
61 | 67 | |
62 | 68 | list($start, $end) = explode('..', $fields[0]); |
@@ -65,27 +71,35 @@ discard block |
||
65 | 71 | $ord_e = hexdec($end); |
66 | 72 | |
67 | 73 | $ord = $ord_s; |
68 | - while ($ord <= $ord_e) { |
|
74 | + while ($ord <= $ord_e) |
|
75 | + { |
|
69 | 76 | $entities[] = '&#x' . strtoupper(sprintf('%04s', dechex($ord++))) . ';'; |
70 | 77 | } |
71 | 78 | } |
72 | 79 | |
73 | 80 | $value = ''; |
74 | - if (!isset($fields[2])) { |
|
81 | + if (!isset($fields[2])) |
|
82 | + { |
|
75 | 83 | $value = 'SAME'; |
76 | - } elseif (in_array($fields[1], array('FC_NFKC', 'NFKC_CF'))) { |
|
84 | + } |
|
85 | + elseif (in_array($fields[1], array('FC_NFKC', 'NFKC_CF'))) |
|
86 | + { |
|
77 | 87 | $value = trim($fields[2]) !== '' ? '&#x' . str_replace(' ', '; &#x', trim($fields[2])) . ';' : ''; |
78 | - } else { |
|
88 | + } |
|
89 | + else |
|
90 | + { |
|
79 | 91 | $value = $fields[2]; |
80 | 92 | } |
81 | 93 | |
82 | - foreach ($entities as $entity) { |
|
94 | + foreach ($entities as $entity) |
|
95 | + { |
|
83 | 96 | $derived_normalization_props[$fields[1]][$entity] = $value === 'SAME' ? $entity : $value; |
84 | 97 | } |
85 | 98 | } |
86 | 99 | |
87 | 100 | // Go through all the characters in the Unicode database. |
88 | -foreach (file($unicode_data_url . '/UnicodeData.txt') as $line) { |
|
101 | +foreach (file($unicode_data_url . '/UnicodeData.txt') as $line) |
|
102 | +{ |
|
89 | 103 | $fields = explode(';', $line); |
90 | 104 | |
91 | 105 | if (!empty($fields[3])) |
@@ -106,12 +120,14 @@ discard block |
||
106 | 120 | $full_decomposition_maps['&#x' . $fields[0] . ';'] = '&#x' . str_replace(' ', '; &#x', trim(strip_tags($fields[5]))) . ';'; |
107 | 121 | |
108 | 122 | // Just the canonical decompositions. |
109 | - if (strpos($fields[5], '<') === false) { |
|
123 | + if (strpos($fields[5], '<') === false) |
|
124 | + { |
|
110 | 125 | $utf8_arrays['utf8_normalize_d_maps']['&#x' . $fields[0] . ';'] = '&#x' . str_replace(' ', '; &#x', trim($fields[5])) . ';'; |
111 | 126 | } |
112 | 127 | } |
113 | 128 | |
114 | -foreach (file($unicode_data_url . '/CaseFolding.txt') as $line) { |
|
129 | +foreach (file($unicode_data_url . '/CaseFolding.txt') as $line) |
|
130 | +{ |
|
115 | 131 | $line = substr($line, 0, strcspn($line, '#')); |
116 | 132 | |
117 | 133 | if (strpos($line, ';') === false) |
@@ -119,12 +135,14 @@ discard block |
||
119 | 135 | |
120 | 136 | $fields = explode(';', $line); |
121 | 137 | |
122 | - foreach ($fields as $key => $value) { |
|
138 | + foreach ($fields as $key => $value) |
|
139 | + { |
|
123 | 140 | $fields[$key] = trim($value); |
124 | 141 | } |
125 | 142 | |
126 | 143 | // Full casefolding. |
127 | - if (in_array($fields[1], array('C', 'F'))) { |
|
144 | + if (in_array($fields[1], array('C', 'F'))) |
|
145 | + { |
|
128 | 146 | $utf8_arrays['utf8_casefold_maps']['&#x' . $fields[0] . ';'] = '&#x' . str_replace(' ', '; &#x', trim($fields[2])) . ';'; |
129 | 147 | } |
130 | 148 | |
@@ -138,13 +156,17 @@ discard block |
||
138 | 156 | // This is necessary because some characters decompose to other characters that |
139 | 157 | // themselves decompose further. |
140 | 158 | $changed = true; |
141 | -while ($changed) { |
|
159 | +while ($changed) |
|
160 | +{ |
|
142 | 161 | $temp = array(); |
143 | - foreach ($full_decomposition_maps as $composed => $decomposed) { |
|
162 | + foreach ($full_decomposition_maps as $composed => $decomposed) |
|
163 | + { |
|
144 | 164 | $parts = strpos($decomposed, ' ') !== false ? explode(' ', $decomposed) : (array) $decomposed; |
145 | 165 | |
146 | - foreach ($parts as $partnum => $hex) { |
|
147 | - if (isset($full_decomposition_maps[$hex])) { |
|
166 | + foreach ($parts as $partnum => $hex) |
|
167 | + { |
|
168 | + if (isset($full_decomposition_maps[$hex])) |
|
169 | + { |
|
148 | 170 | $parts[$partnum] = $full_decomposition_maps[$hex]; |
149 | 171 | } |
150 | 172 | } |
@@ -163,17 +185,22 @@ discard block |
||
163 | 185 | // Same as above, but using only canonical decompositions. |
164 | 186 | $changed = true; |
165 | 187 | $iteration = 0; |
166 | -while ($changed) { |
|
188 | +while ($changed) |
|
189 | +{ |
|
167 | 190 | $temp = array(); |
168 | - foreach ($utf8_arrays['utf8_normalize_d_maps'] as $composed => $decomposed) { |
|
169 | - if ($iteration === 0 && !in_array($composed, $derived_normalization_props['Full_Composition_Exclusion'])) { |
|
191 | + foreach ($utf8_arrays['utf8_normalize_d_maps'] as $composed => $decomposed) |
|
192 | + { |
|
193 | + if ($iteration === 0 && !in_array($composed, $derived_normalization_props['Full_Composition_Exclusion'])) |
|
194 | + { |
|
170 | 195 | $utf8_arrays['utf8_compose_maps'][$decomposed] = $composed; |
171 | 196 | } |
172 | 197 | |
173 | 198 | $parts = strpos($decomposed, ' ') !== false ? explode(' ', $decomposed) : (array) $decomposed; |
174 | 199 | |
175 | - foreach ($parts as $partnum => $hex) { |
|
176 | - if (isset($utf8_arrays['utf8_normalize_d_maps'][$hex])) { |
|
200 | + foreach ($parts as $partnum => $hex) |
|
201 | + { |
|
202 | + if (isset($utf8_arrays['utf8_normalize_d_maps'][$hex])) |
|
203 | + { |
|
177 | 204 | $parts[$partnum] = $utf8_arrays['utf8_normalize_d_maps'][$hex]; |
178 | 205 | } |
179 | 206 | } |
@@ -193,7 +220,8 @@ discard block |
||
193 | 220 | $utf8_arrays['utf8_normalize_kd_maps'] = array_diff_assoc($full_decomposition_maps, $utf8_arrays['utf8_normalize_d_maps']); |
194 | 221 | |
195 | 222 | // Some characters have the 'Default_Ignorable_Code_Point' property. |
196 | -foreach (file($unicode_data_url . '/DerivedCoreProperties.txt') as $line) { |
|
223 | +foreach (file($unicode_data_url . '/DerivedCoreProperties.txt') as $line) |
|
224 | +{ |
|
197 | 225 | if (strpos($line, 'Default_Ignorable_Code_Point') === false) |
198 | 226 | continue; |
199 | 227 | |
@@ -204,13 +232,17 @@ discard block |
||
204 | 232 | |
205 | 233 | $fields = explode(';', $line); |
206 | 234 | |
207 | - foreach ($fields as $key => $value) { |
|
235 | + foreach ($fields as $key => $value) |
|
236 | + { |
|
208 | 237 | $fields[$key] = trim($value); |
209 | 238 | } |
210 | 239 | |
211 | - if (strpos($fields[0], '..') === false) { |
|
240 | + if (strpos($fields[0], '..') === false) |
|
241 | + { |
|
212 | 242 | $utf8_arrays['utf8_default_ignorables'][] = '&#x' . $fields[0] . ';'; |
213 | - } else { |
|
243 | + } |
|
244 | + else |
|
245 | + { |
|
214 | 246 | $entities = array(); |
215 | 247 | |
216 | 248 | list($start, $end) = explode('..', $fields[0]); |
@@ -219,7 +251,8 @@ discard block |
||
219 | 251 | $ord_e = hexdec($end); |
220 | 252 | |
221 | 253 | $ord = $ord_s; |
222 | - while ($ord <= $ord_e) { |
|
254 | + while ($ord <= $ord_e) |
|
255 | + { |
|
223 | 256 | $utf8_arrays['utf8_default_ignorables'][] = '&#x' . strtoupper(sprintf('%04s', dechex($ord++))) . ';'; |
224 | 257 | } |
225 | 258 | } |
@@ -228,35 +261,43 @@ discard block |
||
228 | 261 | // Now update the file. |
229 | 262 | $subs_charset_contents = file_get_contents($sourcedir . '/Subs-Charset.php'); |
230 | 263 | |
231 | -foreach ($utf8_arrays as $func_name => $arr) { |
|
264 | +foreach ($utf8_arrays as $func_name => $arr) |
|
265 | +{ |
|
232 | 266 | $func_text = 'function ' . $func_name . '()' . "\n" . '{'; |
233 | 267 | |
234 | 268 | $func_regex = '/' . preg_quote($func_text, '/') . '[^}]*}/'; |
235 | 269 | |
236 | 270 | $func_text .= "\n\t" . 'return array(' . "\n"; |
237 | 271 | |
238 | - foreach ($arr as $key => $value) { |
|
272 | + foreach ($arr as $key => $value) |
|
273 | + { |
|
239 | 274 | $func_text .= "\t\t"; |
240 | 275 | |
241 | - if ($func_name !== 'utf8_default_ignorables') { |
|
276 | + if ($func_name !== 'utf8_default_ignorables') |
|
277 | + { |
|
242 | 278 | $func_text .= '"'; |
243 | 279 | |
244 | 280 | $key = mb_decode_numericentity(str_replace(' ', '', $key), array(0,0x10FFFF,0,0xFFFFFF), 'UTF-8'); |
245 | 281 | |
246 | - foreach (unpack('C*', $key) as $byte_value) { |
|
282 | + foreach (unpack('C*', $key) as $byte_value) |
|
283 | + { |
|
247 | 284 | $func_text .= '\\x' . strtoupper(dechex($byte_value)); |
248 | 285 | } |
249 | 286 | |
250 | 287 | $func_text .= '" => '; |
251 | 288 | } |
252 | 289 | |
253 | - if ($func_name == 'utf8_combining_classes') { |
|
290 | + if ($func_name == 'utf8_combining_classes') |
|
291 | + { |
|
254 | 292 | $func_text .= $value; |
255 | - } else { |
|
293 | + } |
|
294 | + else |
|
295 | + { |
|
256 | 296 | $func_text .= '"'; |
257 | 297 | |
258 | 298 | $value = mb_decode_numericentity(str_replace(' ', '', $value), array(0,0x10FFFF,0,0xFFFFFF), 'UTF-8'); |
259 | - foreach (unpack('C*', $value) as $byte_value) { |
|
299 | + foreach (unpack('C*', $value) as $byte_value) |
|
300 | + { |
|
260 | 301 | $func_text .= '\\x' . strtoupper(dechex($byte_value)); |
261 | 302 | } |
262 | 303 |