This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Kazakh (Қазақша) specific code. |
||
4 | * |
||
5 | * This program is free software; you can redistribute it and/or modify |
||
6 | * it under the terms of the GNU General Public License as published by |
||
7 | * the Free Software Foundation; either version 2 of the License, or |
||
8 | * (at your option) any later version. |
||
9 | * |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU General Public License for more details. |
||
14 | * |
||
15 | * You should have received a copy of the GNU General Public License along |
||
16 | * with this program; if not, write to the Free Software Foundation, Inc., |
||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
18 | * http://www.gnu.org/copyleft/gpl.html |
||
19 | * |
||
20 | * @file |
||
21 | * @ingroup Language |
||
22 | */ |
||
23 | |||
24 | /** |
||
25 | * Kazakh (Қазақша) |
||
26 | * |
||
27 | * @ingroup Language |
||
28 | */ |
||
29 | // @codingStandardsIgnoreStart Ignore class name is not in camel caps format error |
||
30 | class LanguageKk_cyrl extends Language { |
||
31 | // @codingStandardsIgnoreEnd |
||
32 | # Convert from the nominative form of a noun to some other case |
||
33 | # Invoked with {{GRAMMAR:case|word}} |
||
34 | /** |
||
35 | * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms |
||
36 | * |
||
37 | * @param string $word |
||
38 | * @param string $case |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | function convertGrammarKk_cyrl( $word, $case ) { |
||
43 | global $wgGrammarForms; |
||
44 | if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) { |
||
45 | return $wgGrammarForms['kk-kz'][$case][$word]; |
||
46 | } |
||
47 | if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) { |
||
48 | return $wgGrammarForms['kk-cyrl'][$case][$word]; |
||
49 | } |
||
50 | // Set up some constants... |
||
51 | // Vowels in last syllable |
||
52 | $frontVowels = [ "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" ]; |
||
53 | $backVowels = [ "а", "о", "ұ", "ы" ]; |
||
54 | $allVowels = [ "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" ]; |
||
55 | // Preceding letters |
||
56 | $Nasals = [ "м", "н", "ң" ]; |
||
57 | $Sonants = [ "и", "й", "л", "р", "у", "ю" ]; |
||
58 | $Consonants = [ "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" ]; |
||
59 | $Sibilants = [ "ж", "з" ]; |
||
60 | $Sonorants = [ "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" ]; |
||
61 | |||
62 | // Possessives |
||
63 | $firstPerson = [ "м", "ң" ]; // 1st singular, 2nd unformal |
||
64 | $secondPerson = [ "з" ]; // 1st plural, 2nd formal |
||
65 | $thirdPerson = [ "ы", "і" ]; // 3rd |
||
66 | |||
67 | $lastLetter = $this->lastLetter( $word, $allVowels ); |
||
68 | $wordEnding =& $lastLetter[0]; |
||
69 | $wordLastVowel =& $lastLetter[1]; |
||
70 | |||
71 | // Now convert the word |
||
72 | View Code Duplication | switch ( $case ) { |
|
73 | case "dc1": |
||
74 | case "genitive": # ilik |
||
75 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
76 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
77 | $word = $word . "тің"; |
||
78 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
79 | $word = $word . "тың"; |
||
80 | } |
||
81 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) { |
||
82 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
83 | $word = $word . "нің"; |
||
84 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
85 | $word = $word . "ның"; |
||
86 | } |
||
87 | } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) { |
||
88 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
89 | $word = $word . "дің"; |
||
90 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
91 | $word = $word . "дың"; |
||
92 | } |
||
93 | } |
||
94 | break; |
||
95 | case "dc2": |
||
96 | case "dative": # barıs |
||
97 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
98 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
99 | $word = $word . "ке"; |
||
100 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
101 | $word = $word . "қа"; |
||
102 | } |
||
103 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) { |
||
104 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
105 | $word = $word . "ге"; |
||
106 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
107 | $word = $word . "ға"; |
||
108 | } |
||
109 | } |
||
110 | break; |
||
111 | case "dc21": |
||
112 | case "possessive dative": # täweldık + barıs |
||
113 | if ( in_array( $wordEnding, $firstPerson ) ) { |
||
114 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
115 | $word = $word . "е"; |
||
116 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
117 | $word = $word . "а"; |
||
118 | } |
||
119 | } elseif ( in_array( $wordEnding, $secondPerson ) ) { |
||
120 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
121 | $word = $word . "ге"; |
||
122 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
123 | $word = $word . "ға"; |
||
124 | } |
||
125 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
126 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
127 | $word = $word . "не"; |
||
128 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
129 | $word = $word . "на"; |
||
130 | } |
||
131 | } |
||
132 | break; |
||
133 | case "dc3": |
||
134 | case "accusative": # tabıs |
||
135 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
136 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
137 | $word = $word . "ті"; |
||
138 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
139 | $word = $word . "ты"; |
||
140 | } |
||
141 | } elseif ( in_array( $wordEnding, $allVowels ) ) { |
||
142 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
143 | $word = $word . "ні"; |
||
144 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
145 | $word = $word . "ны"; |
||
146 | } |
||
147 | } elseif ( in_array( $wordEnding, $Sonorants ) ) { |
||
148 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
149 | $word = $word . "ді"; |
||
150 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
151 | $word = $word . "ды"; |
||
152 | } |
||
153 | } |
||
154 | break; |
||
155 | case "dc31": |
||
156 | case "possessive accusative": # täweldık + tabıs |
||
157 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { |
||
158 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
159 | $word = $word . "ді"; |
||
160 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
161 | $word = $word . "ды"; |
||
162 | } |
||
163 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
164 | $word = $word . "н"; |
||
165 | } |
||
166 | break; |
||
167 | case "dc4": |
||
168 | case "locative": # jatıs |
||
169 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
170 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
171 | $word = $word . "те"; |
||
172 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
173 | $word = $word . "та"; |
||
174 | } |
||
175 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) { |
||
176 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
177 | $word = $word . "де"; |
||
178 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
179 | $word = $word . "да"; |
||
180 | } |
||
181 | } |
||
182 | break; |
||
183 | case "dc41": |
||
184 | case "possessive locative": # täweldık + jatıs |
||
185 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { |
||
186 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
187 | $word = $word . "де"; |
||
188 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
189 | $word = $word . "да"; |
||
190 | } |
||
191 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
192 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
193 | $word = $word . "нде"; |
||
194 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
195 | $word = $word . "нда"; |
||
196 | } |
||
197 | } |
||
198 | break; |
||
199 | case "dc5": |
||
200 | case "ablative": # şığıs |
||
201 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
202 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
203 | $word = $word . "тен"; |
||
204 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
205 | $word = $word . "тан"; |
||
206 | } |
||
207 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
208 | || in_array( $wordEnding, $Sonants ) |
||
209 | || in_array( $wordEnding, $Sibilants ) |
||
210 | ) { |
||
211 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
212 | $word = $word . "ден"; |
||
213 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
214 | $word = $word . "дан"; |
||
215 | } |
||
216 | } elseif ( in_array( $wordEnding, $Nasals ) ) { |
||
217 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
218 | $word = $word . "нен"; |
||
219 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
220 | $word = $word . "нан"; |
||
221 | } |
||
222 | } |
||
223 | break; |
||
224 | case "dc51": |
||
225 | case "possessive ablative": # täweldık + şığıs |
||
226 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { |
||
227 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
228 | $word = $word . "нен"; |
||
229 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
230 | $word = $word . "нан"; |
||
231 | } |
||
232 | } elseif ( in_array( $wordEnding, $secondPerson ) ) { |
||
233 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
234 | $word = $word . "ден"; |
||
235 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
236 | $word = $word . "дан"; |
||
237 | } |
||
238 | } |
||
239 | break; |
||
240 | case "dc6": |
||
241 | case "comitative": # kömektes |
||
242 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
243 | $word = $word . "пен"; |
||
244 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
245 | || in_array( $wordEnding, $Nasals ) |
||
246 | || in_array( $wordEnding, $Sonants ) |
||
247 | ) { |
||
248 | $word = $word . "мен"; |
||
249 | } elseif ( in_array( $wordEnding, $Sibilants ) ) { |
||
250 | $word = $word . "бен"; |
||
251 | } |
||
252 | break; |
||
253 | case "dc61": |
||
254 | case "possessive comitative": # täweldık + kömektes |
||
255 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
256 | $word = $word . "пенен"; |
||
257 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
258 | || in_array( $wordEnding, $Nasals ) |
||
259 | || in_array( $wordEnding, $Sonants ) |
||
260 | ) { |
||
261 | $word = $word . "менен"; |
||
262 | } elseif ( in_array( $wordEnding, $Sibilants ) ) { |
||
263 | $word = $word . "бенен"; |
||
264 | } |
||
265 | break; |
||
266 | default: # dc0 #nominative #ataw |
||
267 | } |
||
268 | return $word; |
||
269 | } |
||
270 | |||
271 | /** |
||
272 | * @param string $word |
||
273 | * @param string $case |
||
274 | * @return string |
||
275 | */ |
||
276 | function convertGrammarKk_latn( $word, $case ) { |
||
277 | global $wgGrammarForms; |
||
278 | if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) { |
||
279 | return $wgGrammarForms['kk-tr'][$case][$word]; |
||
280 | } |
||
281 | if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) { |
||
282 | return $wgGrammarForms['kk-latn'][$case][$word]; |
||
283 | } |
||
284 | // Set up some constants... |
||
285 | // Vowels in last syllable |
||
286 | $frontVowels = [ "e", "ö", "ü", "i", "ä", "é" ]; |
||
287 | $backVowels = [ "a", "o", "u", "ı" ]; |
||
288 | $allVowels = [ "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" ]; |
||
289 | // Preceding letters |
||
290 | $Nasals = [ "m", "n", "ñ" ]; |
||
291 | $Sonants = [ "ï", "y", "ý", "l", "r", "w" ]; |
||
292 | $Consonants = [ "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" ]; |
||
293 | $Sibilants = [ "j", "z" ]; |
||
294 | $Sonorants = [ "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" ]; |
||
295 | |||
296 | // Possessives |
||
297 | $firstPerson = [ "m", "ñ" ]; // 1st singular, 2nd unformal |
||
298 | $secondPerson = [ "z" ]; // 1st plural, 2nd formal |
||
299 | $thirdPerson = [ "ı", "i" ]; // 3rd |
||
300 | |||
301 | $lastLetter = $this->lastLetter( $word, $allVowels ); |
||
302 | $wordEnding =& $lastLetter[0]; |
||
303 | $wordLastVowel =& $lastLetter[1]; |
||
304 | |||
305 | // Now convert the word |
||
306 | View Code Duplication | switch ( $case ) { |
|
307 | case "dc1": |
||
308 | case "genitive": # ilik |
||
309 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
310 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
311 | $word = $word . "tiñ"; |
||
312 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
313 | $word = $word . "tıñ"; |
||
314 | } |
||
315 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) { |
||
316 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
317 | $word = $word . "niñ"; |
||
318 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
319 | $word = $word . "nıñ"; |
||
320 | } |
||
321 | } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) { |
||
322 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
323 | $word = $word . "diñ"; |
||
324 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
325 | $word = $word . "dıñ"; |
||
326 | } |
||
327 | } |
||
328 | break; |
||
329 | case "dc2": |
||
330 | case "dative": # barıs |
||
331 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
332 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
333 | $word = $word . "ke"; |
||
334 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
335 | $word = $word . "qa"; |
||
336 | } |
||
337 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) { |
||
338 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
339 | $word = $word . "ge"; |
||
340 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
341 | $word = $word . "ğa"; |
||
342 | } |
||
343 | } |
||
344 | break; |
||
345 | case "dc21": |
||
346 | case "possessive dative": # täweldık + barıs |
||
347 | if ( in_array( $wordEnding, $firstPerson ) ) { |
||
348 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
349 | $word = $word . "e"; |
||
350 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
351 | $word = $word . "a"; |
||
352 | } |
||
353 | } elseif ( in_array( $wordEnding, $secondPerson ) ) { |
||
354 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
355 | $word = $word . "ge"; |
||
356 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
357 | $word = $word . "ğa"; |
||
358 | } |
||
359 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
360 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
361 | $word = $word . "ne"; |
||
362 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
363 | $word = $word . "na"; |
||
364 | } |
||
365 | } |
||
366 | break; |
||
367 | case "dc3": |
||
368 | case "accusative": # tabıs |
||
369 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
370 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
371 | $word = $word . "ti"; |
||
372 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
373 | $word = $word . "tı"; |
||
374 | } |
||
375 | } elseif ( in_array( $wordEnding, $allVowels ) ) { |
||
376 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
377 | $word = $word . "ni"; |
||
378 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
379 | $word = $word . "nı"; |
||
380 | } |
||
381 | } elseif ( in_array( $wordEnding, $Sonorants ) ) { |
||
382 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
383 | $word = $word . "di"; |
||
384 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
385 | $word = $word . "dı"; |
||
386 | } |
||
387 | } |
||
388 | break; |
||
389 | case "dc31": |
||
390 | case "possessive accusative": # täweldık + tabıs |
||
391 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { |
||
392 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
393 | $word = $word . "di"; |
||
394 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
395 | $word = $word . "dı"; |
||
396 | } |
||
397 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
398 | $word = $word . "n"; |
||
399 | } |
||
400 | break; |
||
401 | case "dc4": |
||
402 | case "locative": # jatıs |
||
403 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
404 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
405 | $word = $word . "te"; |
||
406 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
407 | $word = $word . "ta"; |
||
408 | } |
||
409 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) { |
||
410 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
411 | $word = $word . "de"; |
||
412 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
413 | $word = $word . "da"; |
||
414 | } |
||
415 | } |
||
416 | break; |
||
417 | case "dc41": |
||
418 | case "possessive locative": # täweldık + jatıs |
||
419 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { |
||
420 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
421 | $word = $word . "de"; |
||
422 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
423 | $word = $word . "da"; |
||
424 | } |
||
425 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
426 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
427 | $word = $word . "nde"; |
||
428 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
429 | $word = $word . "nda"; |
||
430 | } |
||
431 | } |
||
432 | break; |
||
433 | case "dc5": |
||
434 | case "ablative": # şığıs |
||
435 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
436 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
437 | $word = $word . "ten"; |
||
438 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
439 | $word = $word . "tan"; |
||
440 | } |
||
441 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
442 | || in_array( $wordEnding, $Sonants ) |
||
443 | || in_array( $wordEnding, $Sibilants ) |
||
444 | ) { |
||
445 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
446 | $word = $word . "den"; |
||
447 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
448 | $word = $word . "dan"; |
||
449 | } |
||
450 | } elseif ( in_array( $wordEnding, $Nasals ) ) { |
||
451 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
452 | $word = $word . "nen"; |
||
453 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
454 | $word = $word . "nan"; |
||
455 | } |
||
456 | } |
||
457 | break; |
||
458 | case "dc51": |
||
459 | case "possessive ablative": # täweldık + şığıs |
||
460 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { |
||
461 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
462 | $word = $word . "nen"; |
||
463 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
464 | $word = $word . "nan"; |
||
465 | } |
||
466 | } elseif ( in_array( $wordEnding, $secondPerson ) ) { |
||
467 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
468 | $word = $word . "den"; |
||
469 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
470 | $word = $word . "dan"; |
||
471 | } |
||
472 | } |
||
473 | break; |
||
474 | case "dc6": |
||
475 | case "comitative": # kömektes |
||
476 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
477 | $word = $word . "pen"; |
||
478 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
479 | || in_array( $wordEnding, $Nasals ) |
||
480 | || in_array( $wordEnding, $Sonants ) |
||
481 | ) { |
||
482 | $word = $word . "men"; |
||
483 | } elseif ( in_array( $wordEnding, $Sibilants ) ) { |
||
484 | $word = $word . "ben"; |
||
485 | } |
||
486 | break; |
||
487 | case "dc61": |
||
488 | case "possessive comitative": # täweldık + kömektes |
||
489 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
490 | $word = $word . "penen"; |
||
491 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
492 | || in_array( $wordEnding, $Nasals ) |
||
493 | || in_array( $wordEnding, $Sonants ) |
||
494 | ) { |
||
495 | $word = $word . "menen"; |
||
496 | } elseif ( in_array( $wordEnding, $Sibilants ) ) { |
||
497 | $word = $word . "benen"; |
||
498 | } |
||
499 | break; |
||
500 | default: # dc0 #nominative #ataw |
||
501 | } |
||
502 | return $word; |
||
503 | } |
||
504 | |||
505 | /** |
||
506 | * @param string $word |
||
507 | * @param string $case |
||
508 | * @return string |
||
509 | */ |
||
510 | function convertGrammarKk_arab( $word, $case ) { |
||
511 | global $wgGrammarForms; |
||
512 | if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) { |
||
513 | return $wgGrammarForms['kk-cn'][$case][$word]; |
||
514 | } |
||
515 | if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) { |
||
516 | return $wgGrammarForms['kk-arab'][$case][$word]; |
||
517 | } |
||
518 | // Set up some constants... |
||
519 | // Vowels in last syllable |
||
520 | $frontVowels = [ "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" ]; |
||
521 | $backVowels = [ "ا", "و", "ۇ", "ى" ]; |
||
522 | $allVowels = [ "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" ]; |
||
523 | // Preceding letters |
||
524 | $Nasals = [ "م", "ن", "ڭ" ]; |
||
525 | $Sonants = [ "ي", "ي", "ل", "ر", "ۋ" ]; |
||
526 | $Consonants = [ "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" ]; |
||
527 | $Sibilants = [ "ج", "ز" ]; |
||
528 | $Sonorants = [ "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز" ]; |
||
529 | |||
530 | // Possessives |
||
531 | $firstPerson = [ "م", "ڭ" ]; // 1st singular, 2nd unformal |
||
532 | $secondPerson = [ "ز" ]; // 1st plural, 2nd formal |
||
533 | $thirdPerson = [ "ى", "ٸ" ]; // 3rd |
||
534 | |||
535 | $lastLetter = $this->lastLetter( $word, $allVowels ); |
||
536 | $wordEnding = $lastLetter[0]; |
||
537 | $wordLastVowel = $lastLetter[1]; |
||
538 | |||
539 | // Now convert the word |
||
540 | View Code Duplication | switch ( $case ) { |
|
541 | case "dc1": |
||
542 | case "genitive": # ilik |
||
543 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
544 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
545 | $word = $word . "تٸڭ"; |
||
546 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
547 | $word = $word . "تىڭ"; |
||
548 | } |
||
549 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) { |
||
550 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
551 | $word = $word . "نٸڭ"; |
||
552 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
553 | $word = $word . "نىڭ"; |
||
554 | } |
||
555 | } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) { |
||
556 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
557 | $word = $word . "دٸڭ"; |
||
558 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
559 | $word = $word . "دىڭ"; |
||
560 | } |
||
561 | } |
||
562 | break; |
||
563 | case "dc2": |
||
564 | case "dative": # barıs |
||
565 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
566 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
567 | $word = $word . "كە"; |
||
568 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
569 | $word = $word . "قا"; |
||
570 | } |
||
571 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) { |
||
572 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
573 | $word = $word . "گە"; |
||
574 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
575 | $word = $word . "عا"; |
||
576 | } |
||
577 | } |
||
578 | break; |
||
579 | case "dc21": |
||
580 | case "possessive dative": # täweldık + barıs |
||
581 | if ( in_array( $wordEnding, $firstPerson ) ) { |
||
582 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
583 | $word = $word . "ە"; |
||
584 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
585 | $word = $word . "ا"; |
||
586 | } |
||
587 | } elseif ( in_array( $wordEnding, $secondPerson ) ) { |
||
588 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
589 | $word = $word . "گە"; |
||
590 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
591 | $word = $word . "عا"; |
||
592 | } |
||
593 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
594 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
595 | $word = $word . "نە"; |
||
596 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
597 | $word = $word . "نا"; |
||
598 | } |
||
599 | } |
||
600 | break; |
||
601 | case "dc3": |
||
602 | case "accusative": # tabıs |
||
603 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
604 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
605 | $word = $word . "تٸ"; |
||
606 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
607 | $word = $word . "تى"; |
||
608 | } |
||
609 | } elseif ( in_array( $wordEnding, $allVowels ) ) { |
||
610 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
611 | $word = $word . "نٸ"; |
||
612 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
613 | $word = $word . "نى"; |
||
614 | } |
||
615 | } elseif ( in_array( $wordEnding, $Sonorants ) ) { |
||
616 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
617 | $word = $word . "دٸ"; |
||
618 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
619 | $word = $word . "دى"; |
||
620 | } |
||
621 | } |
||
622 | break; |
||
623 | case "dc31": |
||
624 | case "possessive accusative": # täweldık + tabıs |
||
625 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { |
||
626 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
627 | $word = $word . "دٸ"; |
||
628 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
629 | $word = $word . "دى"; |
||
630 | } |
||
631 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
632 | $word = $word . "ن"; |
||
633 | } |
||
634 | break; |
||
635 | case "dc4": |
||
636 | case "locative": # jatıs |
||
637 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
638 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
639 | $word = $word . "تە"; |
||
640 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
641 | $word = $word . "تا"; |
||
642 | } |
||
643 | } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) { |
||
644 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
645 | $word = $word . "دە"; |
||
646 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
647 | $word = $word . "دا"; |
||
648 | } |
||
649 | } |
||
650 | break; |
||
651 | case "dc41": |
||
652 | case "possessive locative": # täweldık + jatıs |
||
653 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) { |
||
654 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
655 | $word = $word . "دە"; |
||
656 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
657 | $word = $word . "دا"; |
||
658 | } |
||
659 | } elseif ( in_array( $wordEnding, $thirdPerson ) ) { |
||
660 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
661 | $word = $word . "ندە"; |
||
662 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
663 | $word = $word . "ندا"; |
||
664 | } |
||
665 | } |
||
666 | break; |
||
667 | case "dc5": |
||
668 | case "ablative": # şığıs |
||
669 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
670 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
671 | $word = $word . "تەن"; |
||
672 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
673 | $word = $word . "تان"; |
||
674 | } |
||
675 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
676 | || in_array( $wordEnding, $Sonants ) |
||
677 | || in_array( $wordEnding, $Sibilants ) |
||
678 | ) { |
||
679 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
680 | $word = $word . "دەن"; |
||
681 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
682 | $word = $word . "دان"; |
||
683 | } |
||
684 | } elseif ( in_array( $wordEnding, $Nasals ) ) { |
||
685 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
686 | $word = $word . "نەن"; |
||
687 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
688 | $word = $word . "نان"; |
||
689 | } |
||
690 | } |
||
691 | break; |
||
692 | case "dc51": |
||
693 | case "possessive ablative": # täweldık + şığıs |
||
694 | if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) { |
||
695 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
696 | $word = $word . "نەن"; |
||
697 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
698 | $word = $word . "نان"; |
||
699 | } |
||
700 | } elseif ( in_array( $wordEnding, $secondPerson ) ) { |
||
701 | if ( in_array( $wordLastVowel, $frontVowels ) ) { |
||
702 | $word = $word . "دەن"; |
||
703 | } elseif ( in_array( $wordLastVowel, $backVowels ) ) { |
||
704 | $word = $word . "دان"; |
||
705 | } |
||
706 | } |
||
707 | break; |
||
708 | case "dc6": |
||
709 | case "comitative": # kömektes |
||
710 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
711 | $word = $word . "پەن"; |
||
712 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
713 | || in_array( $wordEnding, $Nasals ) |
||
714 | || in_array( $wordEnding, $Sonants ) |
||
715 | ) { |
||
716 | $word = $word . "مەن"; |
||
717 | } elseif ( in_array( $wordEnding, $Sibilants ) ) { |
||
718 | $word = $word . "بەن"; |
||
719 | } |
||
720 | break; |
||
721 | case "dc61": |
||
722 | case "possessive comitative": # täweldık + kömektes |
||
723 | if ( in_array( $wordEnding, $Consonants ) ) { |
||
724 | $word = $word . "پەنەن"; |
||
725 | } elseif ( in_array( $wordEnding, $allVowels ) |
||
726 | || in_array( $wordEnding, $Nasals ) |
||
727 | || in_array( $wordEnding, $Sonants ) |
||
728 | ) { |
||
729 | $word = $word . "مەنەن"; |
||
730 | } elseif ( in_array( $wordEnding, $Sibilants ) ) { |
||
731 | $word = $word . "بەنەن"; |
||
732 | } |
||
733 | break; |
||
734 | default: # dc0 #nominative #ataw |
||
735 | } |
||
736 | return $word; |
||
737 | } |
||
738 | |||
739 | /** |
||
740 | * @param string $word |
||
741 | * @param array $allVowels |
||
742 | * @return array |
||
743 | */ |
||
744 | function lastLetter( $word, $allVowels ) { |
||
745 | $lastLetter = []; |
||
746 | |||
747 | // Put the word in a form we can play with since we're using UTF-8 |
||
748 | $ar = preg_split( '//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY ); |
||
0 ignored issues
–
show
|
|||
749 | |||
750 | // Here's an array with the order of the letters in the word reversed |
||
751 | // so we can find a match quicker *shrug* |
||
752 | $wordReversed = array_reverse( $ar ); |
||
753 | |||
754 | // Here's the last letter in the word |
||
755 | $lastLetter[0] = $ar[count( $ar ) - 1]; |
||
756 | |||
757 | // Find the last vowel in the word |
||
758 | $lastLetter[1] = null; |
||
759 | View Code Duplication | foreach ( $wordReversed as $xvalue ) { |
|
760 | foreach ( $allVowels as $yvalue ) { |
||
761 | if ( strcmp( $xvalue, $yvalue ) == 0 ) { |
||
762 | $lastLetter[1] = $xvalue; |
||
763 | break; |
||
764 | } else { |
||
765 | continue; |
||
766 | } |
||
767 | } |
||
768 | if ( $lastLetter[1] !== null ) { |
||
769 | break; |
||
770 | } else { |
||
771 | continue; |
||
772 | } |
||
773 | } |
||
774 | |||
775 | return $lastLetter; |
||
776 | } |
||
777 | |||
778 | /** |
||
779 | * Avoid grouping whole numbers between 0 to 9999 |
||
780 | * |
||
781 | * @param string $_ |
||
782 | * |
||
783 | * @return string |
||
784 | */ |
||
785 | function commafy( $_ ) { |
||
786 | if ( !preg_match( '/^\d{1,4}$/', $_ ) ) { |
||
787 | return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) ); |
||
788 | } else { |
||
789 | return $_; |
||
790 | } |
||
791 | } |
||
792 | } |
||
793 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.