-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.php
213 lines (192 loc) · 8.6 KB
/
constants.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
$arabic_transliteration_constants = array(
// letters
'alef' => 0x0627,
'ba' => 0x0628,
'ta' => 0x062A,
'tha' => 0x062B,
'jim' => 0x062C,
'hha' => 0x062D,
'kha' => 0x062E,
'dal' => 0x062F,
'dhal' => 0x0630,
'ra' => 0x0631,
'zay' => 0x0632,
'sin' => 0x0633,
'shin' => 0x0634,
'sad' => 0x0635,
'dad' => 0x0636,
'tta' => 0x0637,
'zza' => 0x0638,
'ayn' => 0x0639,
'ghayn' => 0x063A,
'fa' => 0x0641,
'qaf' => 0x0642,
'kaf' => 0x0643,
'lam' => 0x0644,
'mim' => 0x0645,
'nun' => 0x0646,
'ha' => 0x0647,
'waw' => 0x0648,
'ya' => 0x064A,
// other letters
'alef_with_wasla' => 0x0671,
'alef_with_sup_hamza' => 0x0623,
'alef_with_sub_hamza' => 0x0625,
'alef_maqsura' => 0x0649,
'alef_with_madda' => 0x0622,
'ta_marbuta' => 0x0629,
'waw_with_hamza' => 0x0624,
'ya_with_hamza' => 0x0626,
'hamza' => 0x0621,
// harakat
'fatha' => 0x064E,
'damma' => 0x064F,
'kasra' => 0x0650,
'sukun' => 0x0652, // (not a haraka! rather, a non-haraka!)
// tanween
'fathatan' => 0x064B,
'dammatan' => 0x064C,
'kasratan' => 0x064D,
// other tashkil
'shadda' => 0x0651,
// other
'dagger_alef' => 0x0670,
'tatwil' => 0x0640,
);
foreach($arabic_transliteration_constants as $name => $value){
$arabic_transliteration_constants[$name] = arabic_transliteration_convert_to_utf8($value);
}
$arabic_transliteration_constants['hamzas'] =
$arabic_transliteration_constants['alef_with_sup_hamza'] .
$arabic_transliteration_constants['alef_with_sub_hamza'] .
$arabic_transliteration_constants['alef_with_madda'] .
$arabic_transliteration_constants['waw_with_hamza'] .
$arabic_transliteration_constants['ya_with_hamza'] .
$arabic_transliteration_constants['hamza'];
$arabic_transliteration_constants['sun_letters'] =
$arabic_transliteration_constants['ta'] .
$arabic_transliteration_constants['tha'] .
$arabic_transliteration_constants['dal'] .
$arabic_transliteration_constants['dhal'] .
$arabic_transliteration_constants['ra'] .
$arabic_transliteration_constants['zay'] .
$arabic_transliteration_constants['sin'] .
$arabic_transliteration_constants['shin'] .
$arabic_transliteration_constants['sad'] .
$arabic_transliteration_constants['dad'] .
$arabic_transliteration_constants['tta'] .
$arabic_transliteration_constants['zza'] .
$arabic_transliteration_constants['lam'] .
$arabic_transliteration_constants['nun'];
$arabic_transliteration_constants['moon_letters'] =
$arabic_transliteration_constants['hamzas'] .
$arabic_transliteration_constants['ba'] .
$arabic_transliteration_constants['jim'] .
$arabic_transliteration_constants['hha'] .
$arabic_transliteration_constants['kha'] .
$arabic_transliteration_constants['ayn'] .
$arabic_transliteration_constants['ghayn'] .
$arabic_transliteration_constants['fa'] .
$arabic_transliteration_constants['qaf'] .
$arabic_transliteration_constants['kaf'] .
$arabic_transliteration_constants['mim'] .
$arabic_transliteration_constants['ha'] .
$arabic_transliteration_constants['waw'] .
$arabic_transliteration_constants['ya'];
$arabic_transliteration_constants['standard_letters'] =
$arabic_transliteration_constants['hamzas'] .
$arabic_transliteration_constants['ba'] .
$arabic_transliteration_constants['ta'] .
$arabic_transliteration_constants['tha'] .
$arabic_transliteration_constants['jim'] .
$arabic_transliteration_constants['hha'] .
$arabic_transliteration_constants['kha'] .
$arabic_transliteration_constants['dal'] .
$arabic_transliteration_constants['dhal'] .
$arabic_transliteration_constants['ra'] .
$arabic_transliteration_constants['zay'] .
$arabic_transliteration_constants['sin'] .
$arabic_transliteration_constants['shin'] .
$arabic_transliteration_constants['sad'] .
$arabic_transliteration_constants['dad'] .
$arabic_transliteration_constants['tta'] .
$arabic_transliteration_constants['zza'] .
$arabic_transliteration_constants['ayn'] .
$arabic_transliteration_constants['ghayn'] .
$arabic_transliteration_constants['fa'] .
$arabic_transliteration_constants['qaf'] .
$arabic_transliteration_constants['kaf'] .
$arabic_transliteration_constants['lam'] .
$arabic_transliteration_constants['mim'] .
$arabic_transliteration_constants['nun'] .
$arabic_transliteration_constants['ha'] .
$arabic_transliteration_constants['waw'] .
$arabic_transliteration_constants['ya'];
$arabic_transliteration_constants['standard_letters_without_lam'] =
$arabic_transliteration_constants['hamzas'] .
$arabic_transliteration_constants['ba'] .
$arabic_transliteration_constants['ta'] .
$arabic_transliteration_constants['tha'] .
$arabic_transliteration_constants['jim'] .
$arabic_transliteration_constants['hha'] .
$arabic_transliteration_constants['kha'] .
$arabic_transliteration_constants['dal'] .
$arabic_transliteration_constants['dhal'] .
$arabic_transliteration_constants['ra'] .
$arabic_transliteration_constants['zay'] .
$arabic_transliteration_constants['sin'] .
$arabic_transliteration_constants['shin'] .
$arabic_transliteration_constants['sad'] .
$arabic_transliteration_constants['dad'] .
$arabic_transliteration_constants['tta'] .
$arabic_transliteration_constants['zza'] .
$arabic_transliteration_constants['ayn'] .
$arabic_transliteration_constants['ghayn'] .
$arabic_transliteration_constants['fa'] .
$arabic_transliteration_constants['qaf'] .
$arabic_transliteration_constants['kaf'] .
//$arabic_transliteration_constants['lam'] .
$arabic_transliteration_constants['mim'] .
$arabic_transliteration_constants['nun'] .
$arabic_transliteration_constants['ha'] .
$arabic_transliteration_constants['waw'] .
$arabic_transliteration_constants['ya'];
$arabic_transliteration_constants['extraneous_letters'] =
$arabic_transliteration_constants['alef_with_wasla'] .
$arabic_transliteration_constants['alef_with_sup_hamza'] .
$arabic_transliteration_constants['alef_with_sub_hamza'] .
$arabic_transliteration_constants['alef_maqsura'] .
$arabic_transliteration_constants['alef_with_madda'] .
$arabic_transliteration_constants['ta_marbuta'] .
$arabic_transliteration_constants['waw_with_hamza'] .
$arabic_transliteration_constants['ya_with_hamza'] .
$arabic_transliteration_constants['hamza'];
$arabic_transliteration_constants['standard_harakat'] =
$arabic_transliteration_constants['fatha'] .
$arabic_transliteration_constants['damma'] .
$arabic_transliteration_constants['kasra'];
$arabic_transliteration_constants['tanween'] =
$arabic_transliteration_constants['fathatan'] .
$arabic_transliteration_constants['dammatan'] .
$arabic_transliteration_constants['kasratan'];
$arabic_transliteration_constants['tashkil'] =
$arabic_transliteration_constants['standard_harakat'] .
$arabic_transliteration_constants['sukun'] .
$arabic_transliteration_constants['tanween'] .
$arabic_transliteration_constants['shadda'];
$arabic_transliteration_constants['non_transforming_prefixed_particles'] =
$arabic_transliteration_constants['ba'] . $arabic_transliteration_constants['kasra'] . '|' .
$arabic_transliteration_constants['waw'] . $arabic_transliteration_constants['fatha'] . $arabic_transliteration_constants['ba'] . $arabic_transliteration_constants['kasra'] . '|' .
$arabic_transliteration_constants['fa'] . $arabic_transliteration_constants['fatha'] . $arabic_transliteration_constants['ba'] . $arabic_transliteration_constants['kasra'] . '|' .
$arabic_transliteration_constants['kaf'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['waw'] . $arabic_transliteration_constants['fatha'] . $arabic_transliteration_constants['kaf'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['fa'] . $arabic_transliteration_constants['fatha'] . $arabic_transliteration_constants['kaf'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['ta'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['waw'] . $arabic_transliteration_constants['fatha'] . $arabic_transliteration_constants['ta'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['fa'] . $arabic_transliteration_constants['fatha'] . $arabic_transliteration_constants['ta'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['waw'] . $arabic_transliteration_constants['fatha'] . '|' .
$arabic_transliteration_constants['fa'] . $arabic_transliteration_constants['fatha'];
function arabic_transliteration_convert_to_utf8($unicode , $encoding = 'UTF-8'){
return mb_convert_encoding("&#{$unicode};", $encoding, 'HTML-ENTITIES');
}