[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | if (!defined('DC_RC_PATH')) { return; } |
---|
| 13 | |
---|
| 14 | /** |
---|
| 15 | @ingroup DC_CORE |
---|
| 16 | @brief Dotclear helper methods |
---|
| 17 | |
---|
| 18 | Provides some Dotclear helpers |
---|
| 19 | */ |
---|
| 20 | class dcUtils |
---|
| 21 | { |
---|
| 22 | /** |
---|
| 23 | Static function that returns user's common name given to his |
---|
| 24 | <var>user_id</var>, <var>user_name</var>, <var>user_firstname</var> and |
---|
| 25 | <var>user_displayname</var>. |
---|
[2566] | 26 | |
---|
[0] | 27 | @param user_id <b>string</b> User ID |
---|
| 28 | @param user_name <b>string</b> User's name |
---|
| 29 | @param user_firstname <b>string</b> User's first name |
---|
| 30 | @param user_displayname <b>string</b> User's display name |
---|
| 31 | @return <b>string</b> |
---|
| 32 | */ |
---|
| 33 | public static function getUserCN($user_id, $user_name, $user_firstname, $user_displayname) |
---|
| 34 | { |
---|
| 35 | if (!empty($user_displayname)) { |
---|
| 36 | return $user_displayname; |
---|
| 37 | } |
---|
[2566] | 38 | |
---|
[0] | 39 | if (!empty($user_name)) { |
---|
| 40 | if (!empty($user_firstname)) { |
---|
| 41 | return $user_firstname.' '.$user_name; |
---|
| 42 | } else { |
---|
| 43 | return $user_name; |
---|
| 44 | } |
---|
| 45 | } elseif (!empty($user_firstname)) { |
---|
| 46 | return $user_firstname; |
---|
| 47 | } |
---|
[2566] | 48 | |
---|
[0] | 49 | return $user_id; |
---|
| 50 | } |
---|
[2566] | 51 | |
---|
[1030] | 52 | /** |
---|
| 53 | Cleanup a list of IDs |
---|
[2566] | 54 | |
---|
[1030] | 55 | @param ids <b>mixed</b> ID(s) |
---|
| 56 | @return <b>array</b> |
---|
| 57 | */ |
---|
| 58 | public static function cleanIds($ids) |
---|
| 59 | { |
---|
| 60 | $clean_ids = array(); |
---|
[2566] | 61 | |
---|
[1030] | 62 | if (!is_array($ids)) { |
---|
| 63 | $ids = array($ids); |
---|
| 64 | } |
---|
[2566] | 65 | |
---|
[1030] | 66 | foreach($ids as $id) |
---|
| 67 | { |
---|
| 68 | $id = abs((integer) $id); |
---|
[2566] | 69 | |
---|
[1030] | 70 | if (!empty($id)) { |
---|
| 71 | $clean_ids[] = $id; |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | return $clean_ids; |
---|
| 75 | } |
---|
[2388] | 76 | |
---|
| 77 | /** |
---|
| 78 | * Compare two versions with option of using only main numbers. |
---|
| 79 | * |
---|
| 80 | * @param string $current_version Current version |
---|
| 81 | * @param string $required_version Required version |
---|
| 82 | * @param string $operator Comparison operand |
---|
| 83 | * @param boolean $strict Use full version |
---|
| 84 | * @return boolean True if comparison success |
---|
| 85 | */ |
---|
| 86 | public static function versionsCompare($current_version, $required_version, $operator='>=', $strict=true) |
---|
| 87 | { |
---|
| 88 | if ($strict) { |
---|
| 89 | $current_version = preg_replace('!-r(\d+)$!', '-p$1', $current_version); |
---|
| 90 | $required_version = preg_replace('!-r(\d+)$!', '-p$1', $required_version); |
---|
| 91 | } |
---|
| 92 | else { |
---|
| 93 | $current_version = preg_replace('/^([0-9\.]+)(.*?)$/', '$1', $current_version); |
---|
| 94 | $required_version = preg_replace('/^([0-9\.]+)(.*?)$/', '$1', $required_version); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | return (boolean) version_compare($current_version, $required_version, $operator); |
---|
| 98 | } |
---|
[3057] | 99 | |
---|
| 100 | /** |
---|
| 101 | * Locale specific array sorting function |
---|
| 102 | * |
---|
| 103 | * @param array $arr single array of strings |
---|
| 104 | * @param string $ns admin/public/lang |
---|
| 105 | * @param string $lang language to be used if $ns = 'lang' |
---|
| 106 | */ |
---|
[3059] | 107 | public static function lexicalSort(&$arr,$ns='',$lang='en_US') |
---|
[3057] | 108 | { |
---|
[3059] | 109 | if ($ns != '') { |
---|
| 110 | dcUtils::setLexicalLang($ns,$lang); |
---|
| 111 | } |
---|
[3057] | 112 | return usort($arr,array('dcUtils','lexicalSortHelper')); |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * Locale specific array sorting function (preserving keys) |
---|
| 117 | * |
---|
| 118 | * @param array $arr single array of strings |
---|
| 119 | * @param string $ns admin/public/lang |
---|
| 120 | * @param string $lang language to be used if $ns = 'lang' |
---|
| 121 | */ |
---|
[3059] | 122 | public static function lexicalArraySort(&$arr,$ns='',$lang='en_US') |
---|
[3057] | 123 | { |
---|
[3059] | 124 | if ($ns != '') { |
---|
| 125 | dcUtils::setLexicalLang($ns,$lang); |
---|
| 126 | } |
---|
[3057] | 127 | return uasort($arr,array('dcUtils','lexicalSortHelper')); |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | /** |
---|
| 131 | * Locale specific array sorting function (sorting keys) |
---|
| 132 | * |
---|
| 133 | * @param array $arr single array of strings |
---|
| 134 | * @param string $ns admin/public/lang |
---|
| 135 | * @param string $lang language to be used if $ns = 'lang' |
---|
| 136 | */ |
---|
[3059] | 137 | public static function lexicalKeySort(&$arr,$ns='',$lang='en_US') |
---|
[3057] | 138 | { |
---|
[3059] | 139 | if ($ns != '') { |
---|
| 140 | dcUtils::setLexicalLang($ns,$lang); |
---|
| 141 | } |
---|
[3057] | 142 | return uksort($arr,array('dcUtils','lexicalSortHelper')); |
---|
| 143 | } |
---|
| 144 | |
---|
[3059] | 145 | public static function setLexicalLang($ns='',$lang='en_US') |
---|
[3057] | 146 | { |
---|
| 147 | global $core; |
---|
| 148 | |
---|
| 149 | // Switch to appropriate locale depending on $ns |
---|
| 150 | switch ($ns) { |
---|
| 151 | case 'admin': |
---|
| 152 | // Set locale with user prefs |
---|
| 153 | $user_language = $core->auth->getInfo('user_lang'); |
---|
| 154 | setlocale(LC_COLLATE, $user_language); |
---|
[3059] | 155 | break; |
---|
[3057] | 156 | case 'public': |
---|
| 157 | // Set locale with blog params |
---|
| 158 | $blog_language = $core->blog->settings->system->lang; |
---|
| 159 | setlocale(LC_COLLATE, $blog_language); |
---|
[3059] | 160 | break; |
---|
[3057] | 161 | case 'lang': |
---|
| 162 | // Set locale with arg |
---|
| 163 | setlocale(LC_COLLATE, $lang); |
---|
[3059] | 164 | break; |
---|
[3057] | 165 | } |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | private static function lexicalSortHelper($a,$b) |
---|
| 169 | { |
---|
| 170 | return strcoll(strtolower(dcUtils::removeDiacritics($a)),strtolower(dcUtils::removeDiacritics($b))); |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | // removeDiacritics function (see https://github.com/infralabs/DiacriticsRemovePHP) |
---|
| 174 | |
---|
| 175 | protected static $defaultDiacriticsRemovalMap = array( |
---|
| 176 | array( |
---|
| 177 | 'base'=>"A", |
---|
| 178 | 'letters'=>'/(A|Ⓐ|A|À|Á|Â|Ầ|Ấ|Ẫ|Ẩ|Ã|Ā|Ă|Ằ|Ắ|Ẵ|Ẳ|Ȧ|Ǡ|Ä|Ǟ|Ả|Å|Ǻ|Ǎ|Ȁ|Ȃ|Ạ|Ậ|Ặ|Ḁ|Ą|Ⱥ|Ɐ|[\x{0041}\x{24B6}\x{FF21}\x{00C0}\x{00C1}\x{00C2}\x{1EA6}\x{1EA4}\x{1EAA}\x{1EA8}\x{00C3}\x{0100}\x{0102}\x{1EB0}\x{1EAE}\x{1EB4}\x{1EB2}\x{0226}\x{01E0}\x{00C4}\x{01DE}\x{1EA2}\x{00C5}\x{01FA}\x{01CD}\x{0200}\x{0202}\x{1EA0}\x{1EAC}\x{1EB6}\x{1E00}\x{0104}\x{023A}\x{2C6F}])/' |
---|
| 179 | ), |
---|
| 180 | array( |
---|
| 181 | 'base'=>"AA", |
---|
| 182 | 'letters'=>'/(Ꜳ|[\x{A732}])/' |
---|
| 183 | ), |
---|
| 184 | array( |
---|
| 185 | 'base'=>"AE", |
---|
| 186 | 'letters'=>'/(Æ|Ǽ|Ǣ|[\x{00C6}\x{01FC}\x{01E2}])/' |
---|
| 187 | ), |
---|
| 188 | array( |
---|
| 189 | 'base'=>"AO", |
---|
| 190 | 'letters'=>'/(Ꜵ|[\x{A734}])/' |
---|
| 191 | ), |
---|
| 192 | array( |
---|
| 193 | 'base'=>"AU", |
---|
| 194 | 'letters'=>'/(Ꜷ|[\x{A736}])/' |
---|
| 195 | ), |
---|
| 196 | array( |
---|
| 197 | 'base'=>"AV", |
---|
| 198 | 'letters'=>'/(Ꜹ|Ꜻ|[\x{A738}\x{A73A}])/' |
---|
| 199 | ), |
---|
| 200 | array( |
---|
| 201 | 'base'=>"AY", |
---|
| 202 | 'letters'=>'/(Ꜽ|[\x{A73C}])/' |
---|
| 203 | ), |
---|
| 204 | array( |
---|
| 205 | 'base'=>"B", |
---|
| 206 | 'letters'=>'/(B|Ⓑ|B|Ḃ|Ḅ|Ḇ|Ƀ|Ƃ|Ɓ|[\x{0042}\x{24B7}\x{FF22}\x{1E02}\x{1E04}\x{1E06}\x{0243}\x{0182}\x{0181}])/' |
---|
| 207 | ), |
---|
| 208 | array( |
---|
| 209 | 'base'=>"C", |
---|
| 210 | 'letters'=>'/(C|Ⓒ|C|Ć|Ĉ|Ċ|Č|Ç|Ḉ|Ƈ|Ȼ|Ꜿ|[\x{0043}\x{24B8}\x{FF23}\x{0106}\x{0108}\x{010A}\x{010C}\x{00C7}\x{1E08}\x{0187}\x{023B}\x{A73E}])/' |
---|
| 211 | ), |
---|
| 212 | array( |
---|
| 213 | 'base'=>"D", |
---|
| 214 | 'letters'=>'/(D|Ⓓ|D|Ḋ|Ď|Ḍ|Ḑ|Ḓ|Ḏ|Đ|Ƌ|Ɗ|Ɖ|Ꝺ|Ð|[\x{0044}\x{24B9}\x{FF24}\x{1E0A}\x{010E}\x{1E0C}\x{1E10}\x{1E12}\x{1E0E}\x{0110}\x{018B}\x{018A}\x{0189}\x{A779}\x{00D0}])/' |
---|
| 215 | ), |
---|
| 216 | array( |
---|
| 217 | 'base'=>"DZ", |
---|
| 218 | 'letters'=>'/(DZ|DŽ|[\x{01F1}\x{01C4}])/' |
---|
| 219 | ), |
---|
| 220 | array( |
---|
| 221 | 'base'=>"Dz", |
---|
| 222 | 'letters'=>'/(Dz|Dž|[\x{01F2}\x{01C5}])/' |
---|
| 223 | ), |
---|
| 224 | array( |
---|
| 225 | 'base'=>"E", |
---|
| 226 | 'letters'=>'/(E|Ⓔ|E|È|É|Ê|Ề|Ế|Ễ|Ể|Ẽ|Ē|Ḕ|Ḗ|Ĕ|Ė|Ë|Ẻ|Ě|Ȅ|Ȇ|Ẹ|Ệ|Ȩ|Ḝ|Ę|Ḙ|Ḛ|Ɛ|Ǝ|[\x{0045}\x{24BA}\x{FF25}\x{00C8}\x{00C9}\x{00CA}\x{1EC0}\x{1EBE}\x{1EC4}\x{1EC2}\x{1EBC}\x{0112}\x{1E14}\x{1E16}\x{0114}\x{0116}\x{00CB}\x{1EBA}\x{011A}\x{0204}\x{0206}\x{1EB8}\x{1EC6}\x{0228}\x{1E1C}\x{0118}\x{1E18}\x{1E1A}\x{0190}\x{018E}])/' |
---|
| 227 | ), |
---|
| 228 | array( |
---|
| 229 | 'base'=>"F", |
---|
| 230 | 'letters'=>'/(F|Ⓕ|F|Ḟ|Ƒ|Ꝼ|[\x{0046}\x{24BB}\x{FF26}\x{1E1E}\x{0191}\x{A77B}])/' |
---|
| 231 | ), |
---|
| 232 | array( |
---|
| 233 | 'base'=>"G", |
---|
| 234 | 'letters'=>'/(G|Ⓖ|G|Ǵ|Ĝ|Ḡ|Ğ|Ġ|Ǧ|Ģ|Ǥ|Ɠ|Ꞡ|Ᵹ|Ꝿ|[\x{0047}\x{24BC}\x{FF27}\x{01F4}\x{011C}\x{1E20}\x{011E}\x{0120}\x{01E6}\x{0122}\x{01E4}\x{0193}\x{A7A0}\x{A77D}\x{A77E}])/' |
---|
| 235 | ), |
---|
| 236 | array( |
---|
| 237 | 'base'=>"H", |
---|
| 238 | 'letters'=>'/(H|Ⓗ|H|Ĥ|Ḣ|Ḧ|Ȟ|Ḥ|Ḩ|Ḫ|Ħ|Ⱨ|Ⱶ|Ɥ|[\x{0048}\x{24BD}\x{FF28}\x{0124}\x{1E22}\x{1E26}\x{021E}\x{1E24}\x{1E28}\x{1E2A}\x{0126}\x{2C67}\x{2C75}\x{A78D}])/' |
---|
| 239 | ), |
---|
| 240 | array( |
---|
| 241 | 'base'=>"I", |
---|
| 242 | 'letters'=>'/(I|Ⓘ|I|Ì|Í|Î|Ĩ|Ī|Ĭ|İ|Ï|Ḯ|Ỉ|Ǐ|Ȉ|Ȋ|Ị|Į|Ḭ|Ɨ|[\x{0049}\x{24BE}\x{FF29}\x{00CC}\x{00CD}\x{00CE}\x{0128}\x{012A}\x{012C}\x{0130}\x{00CF}\x{1E2E}\x{1EC8}\x{01CF}\x{0208}\x{020A}\x{1ECA}\x{012E}\x{1E2C}\x{0197}])/' |
---|
| 243 | ), |
---|
| 244 | array( |
---|
| 245 | 'base'=>"J", |
---|
| 246 | 'letters'=>'/(J|Ⓙ|J|Ĵ|Ɉ|[\x{004A}\x{24BF}\x{FF2A}\x{0134}\x{0248}])/' |
---|
| 247 | ), |
---|
| 248 | array( |
---|
| 249 | 'base'=>"K", |
---|
| 250 | 'letters'=>'/(K|Ⓚ|K|Ḱ|Ǩ|Ḳ|Ķ|Ḵ|Ƙ|Ⱪ|Ꝁ|Ꝃ|Ꝅ|Ꞣ|[\x{004B}\x{24C0}\x{FF2B}\x{1E30}\x{01E8}\x{1E32}\x{0136}\x{1E34}\x{0198}\x{2C69}\x{A740}\x{A742}\x{A744}\x{A7A2}])/' |
---|
| 251 | ), |
---|
| 252 | array( |
---|
| 253 | 'base'=>"L", |
---|
| 254 | 'letters'=>'/(L|Ⓛ|L|Ŀ|Ĺ|Ľ|Ḷ|Ḹ|Ļ|Ḽ|Ḻ|Ł|Ƚ|Ɫ|Ⱡ|Ꝉ|Ꝇ|Ꞁ|[\x{004C}\x{24C1}\x{FF2C}\x{013F}\x{0139}\x{013D}\x{1E36}\x{1E38}\x{013B}\x{1E3C}\x{1E3A}\x{0141}\x{023D}\x{2C62}\x{2C60}\x{A748}\x{A746}\x{A780}])/' |
---|
| 255 | ), |
---|
| 256 | array( |
---|
| 257 | 'base'=>"LJ", |
---|
| 258 | 'letters'=>'/(LJ|[\x{01C7}])/' |
---|
| 259 | ), |
---|
| 260 | array( |
---|
| 261 | 'base'=>"Lj", |
---|
| 262 | 'letters'=>'/(Lj|[\x{01C8}])/' |
---|
| 263 | ), |
---|
| 264 | array( |
---|
| 265 | 'base'=>"M", |
---|
| 266 | 'letters'=>'/(M|Ⓜ|M|Ḿ|Ṁ|Ṃ|Ɱ|Ɯ|[\x{004D}\x{24C2}\x{FF2D}\x{1E3E}\x{1E40}\x{1E42}\x{2C6E}\x{019C}])/' |
---|
| 267 | ), |
---|
| 268 | array( |
---|
| 269 | 'base'=>"N", |
---|
| 270 | 'letters'=>'/(N|Ⓝ|N|Ǹ|Ń|Ñ|Ṅ|Ň|Ṇ|Ņ|Ṋ|Ṉ|Ƞ|Ɲ|Ꞑ|Ꞥ|Ŋ|[\x{004E}\x{24C3}\x{FF2E}\x{01F8}\x{0143}\x{00D1}\x{1E44}\x{0147}\x{1E46}\x{0145}\x{1E4A}\x{1E48}\x{0220}\x{019D}\x{A790}\x{A7A4}\x{014A}])/' |
---|
| 271 | ), |
---|
| 272 | array( |
---|
| 273 | 'base'=>"NJ", |
---|
| 274 | 'letters'=>'/(NJ|[\x{01CA}])/' |
---|
| 275 | ), |
---|
| 276 | array( |
---|
| 277 | 'base'=>"Nj", |
---|
| 278 | 'letters'=>'/(Nj|[\x{01CB}])/' |
---|
| 279 | ), |
---|
| 280 | array( |
---|
| 281 | 'base'=>"O", |
---|
| 282 | 'letters'=>'/(O|Ⓞ|O|Ò|Ó|Ô|Ồ|Ố|Ỗ|Ổ|Õ|Ṍ|Ȭ|Ṏ|Ō|Ṑ|Ṓ|Ŏ|Ȯ|Ȱ|Ö|Ȫ|Ỏ|Ő|Ǒ|Ȍ|Ȏ|Ơ|Ờ|Ớ|Ỡ|Ở|Ợ|Ọ|Ộ|Ǫ|Ǭ|Ø|Ǿ|Ɔ|Ɵ|Ꝋ|Ꝍ|[\x{004F}\x{24C4}\x{FF2F}\x{00D2}\x{00D3}\x{00D4}\x{1ED2}\x{1ED0}\x{1ED6}\x{1ED4}\x{00D5}\x{1E4C}\x{022C}\x{1E4E}\x{014C}\x{1E50}\x{1E52}\x{014E}\x{022E}\x{0230}\x{00D6}\x{022A}\x{1ECE}\x{0150}\x{01D1}\x{020C}\x{020E}\x{01A0}\x{1EDC}\x{1EDA}\x{1EE0}\x{1EDE}\x{1EE2}\x{1ECC}\x{1ED8}\x{01EA}\x{01EC}\x{00D8}\x{01FE}\x{0186}\x{019F}\x{A74A}\x{A74C}])/' |
---|
| 283 | ), |
---|
| 284 | array( |
---|
| 285 | 'base'=>"OE", |
---|
| 286 | 'letters'=>'/(Œ|[\x{0152}])/' |
---|
| 287 | ), |
---|
| 288 | array( |
---|
| 289 | 'base'=>"OI", |
---|
| 290 | 'letters'=>'/(Ƣ|[\x{01A2}])/' |
---|
| 291 | ), |
---|
| 292 | array( |
---|
| 293 | 'base'=>"OO", |
---|
| 294 | 'letters'=>'/(Ꝏ|[\x{A74E}])/' |
---|
| 295 | ), |
---|
| 296 | array( |
---|
| 297 | 'base'=>"OU", |
---|
| 298 | 'letters'=>'/(Ȣ|[\x{0222}])/' |
---|
| 299 | ), |
---|
| 300 | array( |
---|
| 301 | 'base'=>"P", |
---|
| 302 | 'letters'=>'/(P|Ⓟ|P|Ṕ|Ṗ|Ƥ|Ᵽ|Ꝑ|Ꝓ|Ꝕ|[\x{0050}\x{24C5}\x{FF30}\x{1E54}\x{1E56}\x{01A4}\x{2C63}\x{A750}\x{A752}\x{A754}])/' |
---|
| 303 | ), |
---|
| 304 | array( |
---|
| 305 | 'base'=>"Q", |
---|
| 306 | 'letters'=>'/(Q|Ⓠ|Q|Ꝗ|Ꝙ|Ɋ|[\x{0051}\x{24C6}\x{FF31}\x{A756}\x{A758}\x{024A}])/' |
---|
| 307 | ), |
---|
| 308 | array( |
---|
| 309 | 'base'=>"R", |
---|
| 310 | 'letters'=>'/(R|Ⓡ|R|Ŕ|Ṙ|Ř|Ȑ|Ȓ|Ṛ|Ṝ|Ŗ|Ṟ|Ɍ|Ɽ|Ꝛ|Ꞧ|Ꞃ|[\x{0052}\x{24C7}\x{FF32}\x{0154}\x{1E58}\x{0158}\x{0210}\x{0212}\x{1E5A}\x{1E5C}\x{0156}\x{1E5E}\x{024C}\x{2C64}\x{A75A}\x{A7A6}\x{A782}])/' |
---|
| 311 | ), |
---|
| 312 | array( |
---|
| 313 | 'base'=>"S", |
---|
| 314 | 'letters'=>'/(S|Ⓢ|S|ẞ|Ś|Ṥ|Ŝ|Ṡ|Š|Ṧ|Ṣ|Ṩ|Ș|Ş|Ȿ|Ꞩ|Ꞅ|[\x{0053}\x{24C8}\x{FF33}\x{1E9E}\x{015A}\x{1E64}\x{015C}\x{1E60}\x{0160}\x{1E66}\x{1E62}\x{1E68}\x{0218}\x{015E}\x{2C7E}\x{A7A8}\x{A784}])/' |
---|
| 315 | ), |
---|
| 316 | array( |
---|
| 317 | 'base'=>"T", |
---|
| 318 | 'letters'=>'/(T|Ⓣ|T|Ṫ|Ť|Ṭ|Ț|Ţ|Ṱ|Ṯ|Ŧ|Ƭ|Ʈ|Ⱦ|Ꞇ|[\x{0054}\x{24C9}\x{FF34}\x{1E6A}\x{0164}\x{1E6C}\x{021A}\x{0162}\x{1E70}\x{1E6E}\x{0166}\x{01AC}\x{01AE}\x{023E}\x{A786}])/' |
---|
| 319 | ), |
---|
| 320 | array( |
---|
| 321 | 'base'=>"TH", |
---|
| 322 | 'letters'=>'/(Þ|[\x{00DE}])/' |
---|
| 323 | ), |
---|
| 324 | array( |
---|
| 325 | 'base'=>"TZ", |
---|
| 326 | 'letters'=>'/(Ꜩ|[\x{A728}])/' |
---|
| 327 | ), |
---|
| 328 | array( |
---|
| 329 | 'base'=>"U", |
---|
| 330 | 'letters'=>'/(U|Ⓤ|U|Ù|Ú|Û|Ũ|Ṹ|Ū|Ṻ|Ŭ|Ü|Ǜ|Ǘ|Ǖ|Ǚ|Ủ|Ů|Ű|Ǔ|Ȕ|Ȗ|Ư|Ừ|Ứ|Ữ|Ử|Ự|Ụ|Ṳ|Ų|Ṷ|Ṵ|Ʉ|[\x{0055}\x{24CA}\x{FF35}\x{00D9}\x{00DA}\x{00DB}\x{0168}\x{1E78}\x{016A}\x{1E7A}\x{016C}\x{00DC}\x{01DB}\x{01D7}\x{01D5}\x{01D9}\x{1EE6}\x{016E}\x{0170}\x{01D3}\x{0214}\x{0216}\x{01AF}\x{1EEA}\x{1EE8}\x{1EEE}\x{1EEC}\x{1EF0}\x{1EE4}\x{1E72}\x{0172}\x{1E76}\x{1E74}\x{0244}])/' |
---|
| 331 | ), |
---|
| 332 | array( |
---|
| 333 | 'base'=>"V", |
---|
| 334 | 'letters'=>'/(V|Ⓥ|V|Ṽ|Ṿ|Ʋ|Ꝟ|Ʌ|[\x{0056}\x{24CB}\x{FF36}\x{1E7C}\x{1E7E}\x{01B2}\x{A75E}\x{0245}])/' |
---|
| 335 | ), |
---|
| 336 | array( |
---|
| 337 | 'base'=>"VY", |
---|
| 338 | 'letters'=>'/(Ꝡ|[\x{A760}])/' |
---|
| 339 | ), |
---|
| 340 | array( |
---|
| 341 | 'base'=>"W", |
---|
| 342 | 'letters'=>'/(W|Ⓦ|W|Ẁ|Ẃ|Ŵ|Ẇ|Ẅ|Ẉ|Ⱳ|[\x{0057}\x{24CC}\x{FF37}\x{1E80}\x{1E82}\x{0174}\x{1E86}\x{1E84}\x{1E88}\x{2C72}])/' |
---|
| 343 | ), |
---|
| 344 | array( |
---|
| 345 | 'base'=>"X", |
---|
| 346 | 'letters'=>'/(X|Ⓧ|X|Ẋ|Ẍ|[\x{0058}\x{24CD}\x{FF38}\x{1E8A}\x{1E8C}])/' |
---|
| 347 | ), |
---|
| 348 | array( |
---|
| 349 | 'base'=>"Y", |
---|
| 350 | 'letters'=>'/(Y|Ⓨ|Y|Ỳ|Ý|Ŷ|Ỹ|Ȳ|Ẏ|Ÿ|Ỷ|Ỵ|Ƴ|Ɏ|Ỿ|[\x{0059}\x{24CE}\x{FF39}\x{1EF2}\x{00DD}\x{0176}\x{1EF8}\x{0232}\x{1E8E}\x{0178}\x{1EF6}\x{1EF4}\x{01B3}\x{024E}\x{1EFE}])/' |
---|
| 351 | ), |
---|
| 352 | array( |
---|
| 353 | 'base'=>"Z", |
---|
| 354 | 'letters'=>'/(Z|Ⓩ|Z|Ź|Ẑ|Ż|Ž|Ẓ|Ẕ|Ƶ|Ȥ|Ɀ|Ⱬ|Ꝣ|[\x{005A}\x{24CF}\x{FF3A}\x{0179}\x{1E90}\x{017B}\x{017D}\x{1E92}\x{1E94}\x{01B5}\x{0224}\x{2C7F}\x{2C6B}\x{A762}])/' |
---|
| 355 | ), |
---|
| 356 | array( |
---|
| 357 | 'base'=>"a", |
---|
| 358 | 'letters'=>'/(a|ⓐ|a|ẚ|à|á|â|ầ|ấ|ẫ|ẩ|ã|ā|ă|ằ|ắ|ẵ|ẳ|ȧ|ǡ|ä|ǟ|ả|å|ǻ|ǎ|ȁ|ȃ|ạ|ậ|ặ|ḁ|ą|ⱥ|ɐ|[\x{0061}\x{24D0}\x{FF41}\x{1E9A}\x{00E0}\x{00E1}\x{00E2}\x{1EA7}\x{1EA5}\x{1EAB}\x{1EA9}\x{00E3}\x{0101}\x{0103}\x{1EB1}\x{1EAF}\x{1EB5}\x{1EB3}\x{0227}\x{01E1}\x{00E4}\x{01DF}\x{1EA3}\x{00E5}\x{01FB}\x{01CE}\x{0201}\x{0203}\x{1EA1}\x{1EAD}\x{1EB7}\x{1E01}\x{0105}\x{2C65}\x{0250}])/' |
---|
| 359 | ), |
---|
| 360 | array( |
---|
| 361 | 'base'=>"aa", |
---|
| 362 | 'letters'=>'/(ꜳ|[\x{A733}])/' |
---|
| 363 | ), |
---|
| 364 | array( |
---|
| 365 | 'base'=>"ae", |
---|
| 366 | 'letters'=>'/(æ|ǽ|ǣ|[\x{00E6}\x{01FD}\x{01E3}])/' |
---|
| 367 | ), |
---|
| 368 | array( |
---|
| 369 | 'base'=>"ao", |
---|
| 370 | 'letters'=>'/(ꜵ|[\x{A735}])/' |
---|
| 371 | ), |
---|
| 372 | array( |
---|
| 373 | 'base'=>"au", |
---|
| 374 | 'letters'=>'/(ꜷ|[\x{A737}])/' |
---|
| 375 | ), |
---|
| 376 | array( |
---|
| 377 | 'base'=>"av", |
---|
| 378 | 'letters'=>'/(ꜹ|ꜻ|[\x{A739}\x{A73B}])/' |
---|
| 379 | ), |
---|
| 380 | array( |
---|
| 381 | 'base'=>"ay", |
---|
| 382 | 'letters'=>'/(ꜽ|[\x{A73D}])/' |
---|
| 383 | ), |
---|
| 384 | array( |
---|
| 385 | 'base'=>"b", |
---|
| 386 | 'letters'=>'/(b|ⓑ|b|ḃ|ḅ|ḇ|ƀ|ƃ|ɓ|[\x{0062}\x{24D1}\x{FF42}\x{1E03}\x{1E05}\x{1E07}\x{0180}\x{0183}\x{0253}])/' |
---|
| 387 | ), |
---|
| 388 | array( |
---|
| 389 | 'base'=>"c", |
---|
| 390 | 'letters'=>'/(c|ⓒ|c|ć|ĉ|ċ|č|ç|ḉ|ƈ|ȼ|ꜿ|ↄ|[\x{0063}\x{24D2}\x{FF43}\x{0107}\x{0109}\x{010B}\x{010D}\x{00E7}\x{1E09}\x{0188}\x{023C}\x{A73F}\x{2184}])/' |
---|
| 391 | ), |
---|
| 392 | array( |
---|
| 393 | 'base'=>"d", |
---|
| 394 | 'letters'=>'/(d|ⓓ|d|ḋ|ď|ḍ|ḑ|ḓ|ḏ|đ|ƌ|ɖ|ɗ|ꝺ|ð|[\x{0064}\x{24D3}\x{FF44}\x{1E0B}\x{010F}\x{1E0D}\x{1E11}\x{1E13}\x{1E0F}\x{0111}\x{018C}\x{0256}\x{0257}\x{A77A}\x{00F0}])/' |
---|
| 395 | ), |
---|
| 396 | array( |
---|
| 397 | 'base'=>"dz", |
---|
| 398 | 'letters'=>'/(dz|dž|[\x{01F3}\x{01C6}])/' |
---|
| 399 | ), |
---|
| 400 | array( |
---|
| 401 | 'base'=>"e", |
---|
| 402 | 'letters'=>'/(e|ⓔ|e|è|é|ê|ề|ế|ễ|ể|ẽ|ē|ḕ|ḗ|ĕ|ė|ë|ẻ|ě|ȅ|ȇ|ẹ|ệ|ȩ|ḝ|ę|ḙ|ḛ|ɇ|ɛ|ǝ|[\x{0065}\x{24D4}\x{FF45}\x{00E8}\x{00E9}\x{00EA}\x{1EC1}\x{1EBF}\x{1EC5}\x{1EC3}\x{1EBD}\x{0113}\x{1E15}\x{1E17}\x{0115}\x{0117}\x{00EB}\x{1EBB}\x{011B}\x{0205}\x{0207}\x{1EB9}\x{1EC7}\x{0229}\x{1E1D}\x{0119}\x{1E19}\x{1E1B}\x{0247}\x{025B}\x{01DD}])/' |
---|
| 403 | ), |
---|
| 404 | array( |
---|
| 405 | 'base'=>"f", |
---|
| 406 | 'letters'=>'/(f|ⓕ|f|ḟ|ƒ|ꝼ|[\x{0066}\x{24D5}\x{FF46}\x{1E1F}\x{0192}\x{A77C}])/' |
---|
| 407 | ), |
---|
| 408 | array( |
---|
| 409 | 'base'=>"g", |
---|
| 410 | 'letters'=>'/(g|ⓖ|g|ǵ|ĝ|ḡ|ğ|ġ|ǧ|ģ|ǥ|ɠ|ꞡ|ᵹ|ꝿ|[\x{0067}\x{24D6}\x{FF47}\x{01F5}\x{011D}\x{1E21}\x{011F}\x{0121}\x{01E7}\x{0123}\x{01E5}\x{0260}\x{A7A1}\x{1D79}\x{A77F}])/' |
---|
| 411 | ), |
---|
| 412 | array( |
---|
| 413 | 'base'=>"h", |
---|
| 414 | 'letters'=>'/(h|ⓗ|h|ĥ|ḣ|ḧ|ȟ|ḥ|ḩ|ḫ|ẖ|ħ|ⱨ|ⱶ|ɥ|[\x{0068}\x{24D7}\x{FF48}\x{0125}\x{1E23}\x{1E27}\x{021F}\x{1E25}\x{1E29}\x{1E2B}\x{1E96}\x{0127}\x{2C68}\x{2C76}\x{0265}])/' |
---|
| 415 | ), |
---|
| 416 | array( |
---|
| 417 | 'base'=>"hv", |
---|
| 418 | 'letters'=>'/(ƕ|[\x{0195}])/' |
---|
| 419 | ), |
---|
| 420 | array( |
---|
| 421 | 'base'=>"i", |
---|
| 422 | 'letters'=>'/(i|ⓘ|i|ì|í|î|ĩ|ī|ĭ|ï|ḯ|ỉ|ǐ|ȉ|ȋ|ị|į|ḭ|ɨ|ı|[\x{0069}\x{24D8}\x{FF49}\x{00EC}\x{00ED}\x{00EE}\x{0129}\x{012B}\x{012D}\x{00EF}\x{1E2F}\x{1EC9}\x{01D0}\x{0209}\x{020B}\x{1ECB}\x{012F}\x{1E2D}\x{0268}\x{0131}])/' |
---|
| 423 | ), |
---|
| 424 | array( |
---|
| 425 | 'base'=>"ij", |
---|
| 426 | 'letters'=>'/(ij|[\x{0133}])/' |
---|
| 427 | ), |
---|
| 428 | array( |
---|
| 429 | 'base'=>"j", |
---|
| 430 | 'letters'=>'/(j|ⓙ|j|ĵ|ǰ|ɉ|[\x{006A}\x{24D9}\x{FF4A}\x{0135}\x{01F0}\x{0249}])/' |
---|
| 431 | ), |
---|
| 432 | array( |
---|
| 433 | 'base'=>"k", |
---|
| 434 | 'letters'=>'/(k|ⓚ|k|ḱ|ǩ|ḳ|ķ|ḵ|ƙ|ⱪ|ꝁ|ꝃ|ꝅ|ꞣ|[\x{006B}\x{24DA}\x{FF4B}\x{1E31}\x{01E9}\x{1E33}\x{0137}\x{1E35}\x{0199}\x{2C6A}\x{A741}\x{A743}\x{A745}\x{A7A3}])/' |
---|
| 435 | ), |
---|
| 436 | array( |
---|
| 437 | 'base'=>"l", |
---|
| 438 | 'letters'=>'/(l|ⓛ|l|ŀ|ĺ|ľ|ḷ|ḹ|ļ|ḽ|ḻ|ł|ƚ|ɫ|ⱡ|ꝉ|ꞁ|ꝇ|[\x{006C}\x{24DB}\x{FF4C}\x{0140}\x{013A}\x{013E}\x{1E37}\x{1E39}\x{013C}\x{1E3D}\x{1E3B}\x{0142}\x{019A}\x{026B}\x{2C61}\x{A749}\x{A781}\x{A747}])/' |
---|
| 439 | ), |
---|
| 440 | array( |
---|
| 441 | 'base'=>"lj", |
---|
| 442 | 'letters'=>'/(lj|[\x{01C9}])/' |
---|
| 443 | ), |
---|
| 444 | array( |
---|
| 445 | 'base'=>"m", |
---|
| 446 | 'letters'=>'/(m|ⓜ|m|ḿ|ṁ|ṃ|ɱ|ɯ|[\x{006D}\x{24DC}\x{FF4D}\x{1E3F}\x{1E41}\x{1E43}\x{0271}\x{026F}])/' |
---|
| 447 | ), |
---|
| 448 | array( |
---|
| 449 | 'base'=>"n", |
---|
| 450 | 'letters'=>'/(n|ⓝ|n|ǹ|ń|ñ|ṅ|ň|ṇ|ņ|ṋ|ṉ|ƞ|ɲ|ʼn|ꞑ|ꞥ|ŋ|[\x{006E}\x{24DD}\x{FF4E}\x{01F9}\x{0144}\x{00F1}\x{1E45}\x{0148}\x{1E47}\x{0146}\x{1E4B}\x{1E49}\x{019E}\x{0272}\x{0149}\x{A791}\x{A7A5}\x{014B}])/' |
---|
| 451 | ), |
---|
| 452 | array( |
---|
| 453 | 'base'=>"nj", |
---|
| 454 | 'letters'=>'/(nj|[\x{01CC}])/' |
---|
| 455 | ), |
---|
| 456 | array( |
---|
| 457 | 'base'=>"o", |
---|
| 458 | 'letters'=>'/(o|ⓞ|o|ò|ó|ô|ồ|ố|ỗ|ổ|õ|ṍ|ȭ|ṏ|ō|ṑ|ṓ|ŏ|ȯ|ȱ|ö|ȫ|ỏ|ő|ǒ|ȍ|ȏ|ơ|ờ|ớ|ỡ|ở|ợ|ọ|ộ|ǫ|ǭ|ø|ǿ|ɔ|ꝋ|ꝍ|ɵ|[\x{006F}\x{24DE}\x{FF4F}\x{00F2}\x{00F3}\x{00F4}\x{1ED3}\x{1ED1}\x{1ED7}\x{1ED5}\x{00F5}\x{1E4D}\x{022D}\x{1E4F}\x{014D}\x{1E51}\x{1E53}\x{014F}\x{022F}\x{0231}\x{00F6}\x{022B}\x{1ECF}\x{0151}\x{01D2}\x{020D}\x{020F}\x{01A1}\x{1EDD}\x{1EDB}\x{1EE1}\x{1EDF}\x{1EE3}\x{1ECD}\x{1ED9}\x{01EB}\x{01ED}\x{00F8}\x{01FF}\x{0254}\x{A74B}\x{A74D}\x{0275}])/' |
---|
| 459 | ), |
---|
| 460 | array( |
---|
| 461 | 'base'=>"oe", |
---|
| 462 | 'letters'=>'/(œ|[\x{0153}])/' |
---|
| 463 | ), |
---|
| 464 | array( |
---|
| 465 | 'base'=>"oi", |
---|
| 466 | 'letters'=>'/(ƣ|[\x{01A3}])/' |
---|
| 467 | ), |
---|
| 468 | array( |
---|
| 469 | 'base'=>"ou", |
---|
| 470 | 'letters'=>'/(ȣ|[\x{0223}])/' |
---|
| 471 | ), |
---|
| 472 | array( |
---|
| 473 | 'base'=>"oo", |
---|
| 474 | 'letters'=>'/(ꝏ|[\x{A74F}])/' |
---|
| 475 | ), |
---|
| 476 | array( |
---|
| 477 | 'base'=>"p", |
---|
| 478 | 'letters'=>'/(p|ⓟ|p|ṕ|ṗ|ƥ|ᵽ|ꝑ|ꝓ|ꝕ|[\x{0070}\x{24DF}\x{FF50}\x{1E55}\x{1E57}\x{01A5}\x{1D7D}\x{A751}\x{A753}\x{A755}])/' |
---|
| 479 | ), |
---|
| 480 | array( |
---|
| 481 | 'base'=>"q", |
---|
| 482 | 'letters'=>'/(q|ⓠ|q|ɋ|ꝗ|ꝙ|[\x{0071}\x{24E0}\x{FF51}\x{024B}\x{A757}\x{A759}])/' |
---|
| 483 | ), |
---|
| 484 | array( |
---|
| 485 | 'base'=>"r", |
---|
| 486 | 'letters'=>'/(r|ⓡ|r|ŕ|ṙ|ř|ȑ|ȓ|ṛ|ṝ|ŗ|ṟ|ɍ|ɽ|ꝛ|ꞧ|ꞃ|[\x{0072}\x{24E1}\x{FF52}\x{0155}\x{1E59}\x{0159}\x{0211}\x{0213}\x{1E5B}\x{1E5D}\x{0157}\x{1E5F}\x{024D}\x{027D}\x{A75B}\x{A7A7}\x{A783}])/' |
---|
| 487 | ), |
---|
| 488 | array( |
---|
| 489 | 'base'=>"s", |
---|
| 490 | 'letters'=>'/(s|ⓢ|s|ś|ṥ|ŝ|ṡ|š|ṧ|ṣ|ṩ|ș|ş|ȿ|ꞩ|ꞅ|ẛ|ſ|[\x{0073}\x{24E2}\x{FF53}\x{015B}\x{1E65}\x{015D}\x{1E61}\x{0161}\x{1E67}\x{1E63}\x{1E69}\x{0219}\x{015F}\x{023F}\x{A7A9}\x{A785}\x{1E9B}\x{017F}])/' |
---|
| 491 | ), |
---|
| 492 | array( |
---|
| 493 | 'base'=>"ss", |
---|
| 494 | 'letters'=>'/(ß|[\x{00DF}])/' |
---|
| 495 | ), |
---|
| 496 | array( |
---|
| 497 | 'base'=>"t", |
---|
| 498 | 'letters'=>'/(t|ⓣ|t|ṫ|ẗ|ť|ṭ|ț|ţ|ṱ|ṯ|ŧ|ƭ|ʈ|ⱦ|ꞇ|[\x{0074}\x{24E3}\x{FF54}\x{1E6B}\x{1E97}\x{0165}\x{1E6D}\x{021B}\x{0163}\x{1E71}\x{1E6F}\x{0167}\x{01AD}\x{0288}\x{2C66}\x{A787}])/' |
---|
| 499 | ), |
---|
| 500 | array( |
---|
| 501 | 'base'=>"th", |
---|
| 502 | 'letters'=>'/(þ|[\x{00FE}])/' |
---|
| 503 | ), |
---|
| 504 | array( |
---|
| 505 | 'base'=>"tz", |
---|
| 506 | 'letters'=>'/(ꜩ|[\x{A729}])/' |
---|
| 507 | ), |
---|
| 508 | array( |
---|
| 509 | 'base'=>"u", |
---|
| 510 | 'letters'=>'/(u|ⓤ|u|ù|ú|û|ũ|ṹ|ū|ṻ|ŭ|ü|ǜ|ǘ|ǖ|ǚ|ủ|ů|ű|ǔ|ȕ|ȗ|ư|ừ|ứ|ữ|ử|ự|ụ|ṳ|ų|ṷ|ṵ|ʉ|[\x{0075}\x{24E4}\x{FF55}\x{00F9}\x{00FA}\x{00FB}\x{0169}\x{1E79}\x{016B}\x{1E7B}\x{016D}\x{00FC}\x{01DC}\x{01D8}\x{01D6}\x{01DA}\x{1EE7}\x{016F}\x{0171}\x{01D4}\x{0215}\x{0217}\x{01B0}\x{1EEB}\x{1EE9}\x{1EEF}\x{1EED}\x{1EF1}\x{1EE5}\x{1E73}\x{0173}\x{1E77}\x{1E75}\x{0289}])/' |
---|
| 511 | ), |
---|
| 512 | array( |
---|
| 513 | 'base'=>"v", |
---|
| 514 | 'letters'=>'/(v|ⓥ|v|ṽ|ṿ|ʋ|ꝟ|ʌ|[\x{0076}\x{24E5}\x{FF56}\x{1E7D}\x{1E7F}\x{028B}\x{A75F}\x{028C}])/' |
---|
| 515 | ), |
---|
| 516 | array( |
---|
| 517 | 'base'=>"vy", |
---|
| 518 | 'letters'=>'/(ꝡ|[\x{A761}])/' |
---|
| 519 | ), |
---|
| 520 | array( |
---|
| 521 | 'base'=>"w", |
---|
| 522 | 'letters'=>'/(w|ⓦ|w|ẁ|ẃ|ŵ|ẇ|ẅ|ẘ|ẉ|ⱳ|[\x{0077}\x{24E6}\x{FF57}\x{1E81}\x{1E83}\x{0175}\x{1E87}\x{1E85}\x{1E98}\x{1E89}\x{2C73}])/' |
---|
| 523 | ), |
---|
| 524 | array( |
---|
| 525 | 'base'=>"x", |
---|
| 526 | 'letters'=>'/(x|ⓧ|x|ẋ|ẍ|[\x{0078}\x{24E7}\x{FF58}\x{1E8B}\x{1E8D}])/' |
---|
| 527 | ), |
---|
| 528 | array( |
---|
| 529 | 'base'=>"y", |
---|
| 530 | 'letters'=>'/(y|ⓨ|y|ỳ|ý|ŷ|ỹ|ȳ|ẏ|ÿ|ỷ|ẙ|ỵ|ƴ|ɏ|ỿ|[\x{0079}\x{24E8}\x{FF59}\x{1EF3}\x{00FD}\x{0177}\x{1EF9}\x{0233}\x{1E8F}\x{00FF}\x{1EF7}\x{1E99}\x{1EF5}\x{01B4}\x{024F}\x{1EFF}])/' |
---|
| 531 | ), |
---|
| 532 | array( |
---|
| 533 | 'base'=>"z", |
---|
| 534 | 'letters'=>'/(z|ⓩ|z|ź|ẑ|ż|ž|ẓ|ẕ|ƶ|ȥ|ɀ|ⱬ|ꝣ|[\x{007A}\x{24E9}\x{FF5A}\x{017A}\x{1E91}\x{017C}\x{017E}\x{1E93}\x{1E95}\x{01B6}\x{0225}\x{0240}\x{2C6C}\x{A763}])/' |
---|
| 535 | ), |
---|
| 536 | ); |
---|
| 537 | |
---|
| 538 | public static function removeDiacritics($str) |
---|
| 539 | { |
---|
| 540 | $flags = "um"; |
---|
| 541 | for ($i = 0; $i < sizeof(dcUtils::$defaultDiacriticsRemovalMap); $i++) { |
---|
| 542 | $str = preg_replace( |
---|
| 543 | dcUtils::$defaultDiacriticsRemovalMap[$i]['letters'].$flags, |
---|
| 544 | dcUtils::$defaultDiacriticsRemovalMap[$i]['base'], |
---|
| 545 | $str); |
---|
| 546 | } |
---|
| 547 | return $str; |
---|
| 548 | } |
---|
[0] | 549 | } |
---|