PluginProbe
Maps Plugin using Google Maps for WordPress – WP Google Map / trunk
Maps Plugin using Google Maps for WordPress – WP Google Map vtrunk
1.9.7 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 All 96 releases
gmap-embed / includes / helper.php

helper.php in Maps Plugin using Google Maps for WordPress – WP Google Map trunk, at includes/helper.php

429 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5
6 if (!function_exists('gmap_embed_no_of_post')) {
7 /**
8 * To count number of total post for type wpgmapembed
9 *
10 * @return int
11 * @since 1.7.0
12 */
13 function gmap_embed_no_of_post()
14 {
15 $count_posts = wp_count_posts('wpgmapembed');
16 // Defensive: Validate object and property
17 return (is_object($count_posts) && isset($count_posts->draft)) ? intval($count_posts->draft) : 0;
18 }
19 }
20
21 if (!function_exists('_wgm_can_add_new_map')) {
22 /**
23 * Is using premium version or not
24 *
25 * @return bool
26 * @since 1.5.0
27 */
28 //phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
29 function _wgm_can_add_new_map()
30 {
31 // Defensive: Sanitize option value
32 return (gmap_embed_no_of_post() == 0 || sanitize_text_field(get_option('_wgm_is_p_v', 'N')) == 'Y');
33 }
34 }
35
36 if (!function_exists('_wgm_is_premium')) {
37 /**
38 * Is using premium version or not
39 *
40 * @return bool
41 * @since 1.5.0
42 */
43 //phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
44 function _wgm_is_premium()
45 {
46 return get_option('_wgm_is_p_v', 'N') == 'Y';
47 }
48 }
49
50 if (!function_exists('get_center_lat_lng_by_map_id')) {
51 /**
52 * Getting center lat lng by map id
53 *
54 * @param int $map_id
55 * @return string
56 * @since 1.7.0
57 */
58 //phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
59 function get_center_lat_lng_by_map_id($map_id = 0)
60 {
61 $wpgmap_center_lat_lng = get_post_meta(intval($map_id), 'wpgmap_center_lat_lng', true);
62 $wpgmap_latlng = get_post_meta(intval($map_id), 'wpgmap_latlng', true);
63 if ($wpgmap_center_lat_lng == '' || $wpgmap_center_lat_lng == null || strlen($wpgmap_center_lat_lng) == 0) {
64 update_post_meta(intval($map_id), 'wpgmap_center_lat_lng', $wpgmap_latlng);
65 $wpgmap_center_lat_lng = $wpgmap_latlng;
66 }
67 return $wpgmap_center_lat_lng;
68 }
69 }
70
71 if (!function_exists('gmap_embed_get_languages')) {
72 /**
73 * Getting supported google map languages
74 *
75 * @return array
76 * @since 1.7.0
77 */
78 function gmap_embed_get_languages()
79 {
80 return array(
81 'af' => 'AFRIKAANS',
82 'sq' => 'ALBANIAN',
83 'am' => 'AMHARIC',
84 'ar' => 'ARABIC',
85 'hy' => 'ARMENIAN',
86 'az' => 'AZERBAIJANI',
87 'eu' => 'BASQUE',
88 'be' => 'BELARUSIAN',
89 'bn' => 'BENGALI',
90 'bs' => 'BOSNIAN',
91 'bg' => 'BULGARIAN',
92 'my' => 'BURMESE',
93 'ca' => 'CATALAN',
94 'zh' => 'CHINESE',
95 'zh-CN' => 'CHINESE (SIMPLIFIED)',
96 'zh-HK' => 'CHINESE (HONG KONG)',
97 'zh-TW' => 'CHINESE (TRADITIONAL)',
98 'hr' => 'CROATIAN',
99 'cs' => 'CZECH',
100 'da' => 'DANISH',
101 'nl' => 'DUTCH',
102 'en' => 'ENGLISH',
103 'en-AU' => 'ENGLISH (AUSTRALIAN)',
104 'en-GB' => 'ENGLISH (GREAT BRITAIN)',
105 'et' => 'ESTONIAN',
106 'fa' => 'FARSI',
107 'fi' => 'FINNISH',
108 'fil' => 'FILIPINO',
109 'fr' => 'FRENCH',
110 'fr-CA' => 'FRENCH (CANADA)',
111 'gl' => 'GALICIAN',
112 'ka' => 'GEORGIAN',
113 'de' => 'GERMAN',
114 'el' => 'GREEK',
115 'gu' => 'GUJARATI',
116 'iw' => 'HEBREW',
117 'hi' => 'HINDI',
118 'hu' => 'HUNGARIAN',
119 'is' => 'ICELANDIC',
120 'id' => 'INDONESIAN',
121 'it' => 'ITALIAN',
122 'ja' => 'JAPANESE',
123 'kn' => 'KANNADA',
124 'kk' => 'KAZAKH',
125 'km' => 'KHMER',
126 'ko' => 'KOREAN',
127 'ky' => 'KYRGYZ',
128 'lo' => 'LAO',
129 'lv' => 'LATVIAN',
130 'lt' => 'LITHUANIAN',
131 'mk' => 'MACEDONIAN',
132 'ms' => 'MALAY',
133 'ml' => 'MALAYALAM',
134 'mr' => 'MARATHI',
135 'mn' => 'MONGOLIAN',
136 'ne' => 'NEPALI',
137 'no' => 'NORWEGIAN',
138 'pl' => 'POLISH',
139 'pt' => 'PORTUGUESE',
140 'pt-BR' => 'PORTUGUESE (BRAZIL)',
141 'pt-PT' => 'PORTUGUESE (PORTUGAL)',
142 'pa' => 'PUNJABI',
143 'ro' => 'ROMANIAN',
144 'ru' => 'RUSSIAN',
145 'sr' => 'SERBIAN',
146 'si' => 'SINHALESE',
147 'sk' => 'SLOVAK',
148 'sl' => 'SLOVENIAN',
149 'es' => 'SPANISH',
150 'es-419' => 'SPANISH (LATIN AMERICA)',
151 'sw' => 'SWAHILI',
152 'sv' => 'SWEDISH',
153 'ta' => 'TAMIL',
154 'te' => 'TELUGU',
155 'th' => 'THAI',
156 'tr' => 'TURKISH',
157 'uk' => 'UKRAINIAN',
158 'ur' => 'URDU',
159 'uz' => 'UZBEK',
160 'vi' => 'VIETNAMESE',
161 'zu' => 'ZULU',
162 );
163 }
164 }
165
166 if (!function_exists('gmap_embed_get_regions')) {
167 /**
168 * Getting supported google map regions
169 *
170 * @return array
171 * @since 1.7.0
172 */
173 function gmap_embed_get_regions()
174 {
175 return array(
176 'AF' => 'Afghanistan',
177 'AX' => '�
178 land Islands',
179 'AL' => 'Albania',
180 'DZ' => 'Algeria',
181 'AS' => 'American Samoa',
182 'AD' => 'Andorra',
183 'AO' => 'Angola',
184 'AI' => 'Anguilla',
185 'AQ' => 'Antarctica',
186 'AG' => 'Antigua and Barbuda',
187 'AR' => 'Argentina',
188 'AM' => 'Armenia',
189 'AW' => 'Aruba',
190 'AU' => 'Australia',
191 'AT' => 'Austria',
192 'AZ' => 'Azerbaijan',
193 'BS' => 'Bahamas',
194 'BH' => 'Bahrain',
195 'BD' => 'Bangladesh',
196 'BB' => 'Barbados',
197 'BY' => 'Belarus',
198 'BE' => 'Belgium',
199 'BZ' => 'Belize',
200 'BJ' => 'Benin',
201 'BM' => 'Bermuda',
202 'BT' => 'Bhutan',
203 'BO' => 'Bolivia, Plurinational State of',
204 'BQ' => 'Bonaire, Sint Eustatius and Saba',
205 'BA' => 'Bosnia and Herzegovina',
206 'BW' => 'Botswana',
207 'BV' => 'Bouvet Island',
208 'BR' => 'Brazil',
209 'IO' => 'British Indian Ocean Territory',
210 'BN' => 'Brunei Darussalam',
211 'BG' => 'Bulgaria',
212 'BF' => 'Burkina Faso',
213 'BI' => 'Burundi',
214 'KH' => 'Cambodia',
215 'CM' => 'Cameroon',
216 'CA' => 'Canada',
217 'CV' => 'Cape Verde',
218 'KY' => 'Cayman Islands',
219 'CF' => 'Central African Republic',
220 'TD' => 'Chad',
221 'CL' => 'Chile',
222 'CN' => 'China',
223 'CX' => 'Christmas Island',
224 'CC' => 'Cocos (Keeling) Islands',
225 'CO' => 'Colombia',
226 'KM' => 'Comoros',
227 'CG' => 'Congo',
228 'CD' => 'Congo, the Democratic Republic of the',
229 'CK' => 'Cook Islands',
230 'CR' => 'Costa Rica',
231 'CI' => "Côte d'Ivoire",
232 'HR' => 'Croatia',
233 'CU' => 'Cuba',
234 'CW' => 'Curaçao',
235 'CY' => 'Cyprus',
236 'CZ' => 'Czech Republic',
237 'DK' => 'Denmark',
238 'DJ' => 'Djibouti',
239 'DM' => 'Dominica',
240 'DO' => 'Dominican Republic',
241 'EC' => 'Ecuador',
242 'EG' => 'Egypt',
243 'SV' => 'El Salvador',
244 'GQ' => 'Equatorial Guinea',
245 'ER' => 'Eritrea',
246 'EE' => 'Estonia',
247 'ET' => 'Ethiopia',
248 'FK' => 'Falkland Islands (Malvinas)',
249 'FO' => 'Faroe Islands',
250 'FJ' => 'Fiji',
251 'FI' => 'Finland',
252 'FR' => 'France',
253 'GF' => 'French Guiana',
254 'PF' => 'French Polynesia',
255 'TF' => 'French Southern Territories',
256 'GA' => 'Gabon',
257 'GM' => 'Gambia',
258 'GE' => 'Georgia',
259 'DE' => 'Germany',
260 'GH' => 'Ghana',
261 'GI' => 'Gibraltar',
262 'GR' => 'Greece',
263 'GL' => 'Greenland',
264 'GD' => 'Grenada',
265 'GP' => 'Guadeloupe',
266 'GU' => 'Guam',
267 'GT' => 'Guatemala',
268 'GG' => 'Guernsey',
269 'GN' => 'Guinea',
270 'GW' => 'Guinea-Bissau',
271 'GY' => 'Guyana',
272 'HT' => 'Haiti',
273 'HM' => 'Heard Island and McDonald Mcdonald Islands',
274 'VA' => 'Holy See (Vatican City State)',
275 'HN' => 'Honduras',
276 'HK' => 'Hong Kong',
277 'HU' => 'Hungary',
278 'IS' => 'Iceland',
279 'IN' => 'India',
280 'ID' => 'Indonesia',
281 'IR' => 'Iran, Islamic Republic of',
282 'IQ' => 'Iraq',
283 'IE' => 'Ireland',
284 'IM' => 'Isle of Man',
285 'IL' => 'Israel',
286 'IT' => 'Italy',
287 'JM' => 'Jamaica',
288 'JP' => 'Japan',
289 'JE' => 'Jersey',
290 'JO' => 'Jordan',
291 'KZ' => 'Kazakhstan',
292 'KE' => 'Kenya',
293 'KI' => 'Kiribati',
294 'KP' => "Korea, Democratic People's Republic of",
295 'KR' => 'Korea, Republic of',
296 'KW' => 'Kuwait',
297 'KG' => 'Kyrgyzstan',
298 'LA' => "Lao People's Democratic Republic",
299 'LV' => 'Latvia',
300 'LB' => 'Lebanon',
301 'LS' => 'Lesotho',
302 'LR' => 'Liberia',
303 'LY' => 'Libya',
304 'LI' => 'Liechtenstein',
305 'LT' => 'Lithuania',
306 'LU' => 'Luxembourg',
307 'MO' => 'Macao',
308 'MK' => 'Macedonia, the Former Yugoslav Republic of',
309 'MG' => 'Madagascar',
310 'MW' => 'Malawi',
311 'MY' => 'Malaysia',
312 'MV' => 'Maldives',
313 'ML' => 'Mali',
314 'MT' => 'Malta',
315 'MH' => 'Marshall Islands',
316 'MQ' => 'Martinique',
317 'MR' => 'Mauritania',
318 'MU' => 'Mauritius',
319 'YT' => 'Mayotte',
320 'MX' => 'Mexico',
321 'FM' => 'Micronesia, Federated States of',
322 'MD' => 'Moldova, Republic of',
323 'MC' => 'Monaco',
324 'MN' => 'Mongolia',
325 'ME' => 'Montenegro',
326 'MS' => 'Montserrat',
327 'MA' => 'Morocco',
328 'MZ' => 'Mozambique',
329 'MM' => 'Myanmar',
330 'NA' => 'Namibia',
331 'NR' => 'Nauru',
332 'NP' => 'Nepal',
333 'NL' => 'Netherlands',
334 'NC' => 'New Caledonia',
335 'NZ' => 'New Zealand',
336 'NI' => 'Nicaragua',
337 'NE' => 'Niger',
338 'NG' => 'Nigeria',
339 'NU' => 'Niue',
340 'NF' => 'Norfolk Island',
341 'MP' => 'Northern Mariana Islands',
342 'NO' => 'Norway',
343 'OM' => 'Oman',
344 'PK' => 'Pakistan',
345 'PW' => 'Palau',
346 'PS' => 'Palestine, State of',
347 'PA' => 'Panama',
348 'PG' => 'Papua New Guinea',
349 'PY' => 'Paraguay',
350 'PE' => 'Peru',
351 'PH' => 'Philippines',
352 'PN' => 'Pitcairn',
353 'PL' => 'Poland',
354 'PT' => 'Portugal',
355 'PR' => 'Puerto Rico',
356 'QA' => 'Qatar',
357 'RE' => 'Réunion',
358 'RO' => 'Romania',
359 'RU' => 'Russian Federation',
360 'RW' => 'Rwanda',
361 'BL' => 'Saint Barthélemy',
362 'SH' => 'Saint Helena, Ascension and Tristan da Cunha',
363 'KN' => 'Saint Kitts and Nevis',
364 'LC' => 'Saint Lucia',
365 'MF' => 'Saint Martin (French part)',
366 'PM' => 'Saint Pierre and Miquelon',
367 'VC' => 'Saint Vincent and the Grenadines',
368 'WS' => 'Samoa',
369 'SM' => 'San Marino',
370 'ST' => 'Sao Tome and Principe',
371 'SA' => 'Saudi Arabia',
372 'SN' => 'Senegal',
373 'RS' => 'Serbia',
374 'SC' => 'Seychelles',
375 'SL' => 'Sierra Leone',
376 'SG' => 'Singapore',
377 'SX' => 'Sint Maarten (Dutch part)',
378 'SK' => 'Slovakia',
379 'SI' => 'Slovenia',
380 'SB' => 'Solomon Islands',
381 'SO' => 'Somalia',
382 'ZA' => 'South Africa',
383 'GS' => 'South Georgia and the South Sandwich Islands',
384 'SS' => 'South Sudan',
385 'ES' => 'Spain',
386 'LK' => 'Sri Lanka',
387 'SD' => 'Sudan',
388 'SR' => 'Suriname',
389 'SJ' => 'Svalbard and Jan Mayen',
390 'SZ' => 'Swaziland',
391 'SE' => 'Sweden',
392 'CH' => 'Switzerland',
393 'SY' => 'Syrian Arab Republic',
394 'TW' => 'Taiwan',
395 'TJ' => 'Tajikistan',
396 'TZ' => 'Tanzania, United Republic of',
397 'TH' => 'Thailand',
398 'TL' => 'Timor-Leste',
399 'TG' => 'Togo',
400 'TK' => 'Tokelau',
401 'TO' => 'Tonga',
402 'TT' => 'Trinidad and Tobago',
403 'TN' => 'Tunisia',
404 'TR' => 'Turkey',
405 'TM' => 'Turkmenistan',
406 'TC' => 'Turks and Caicos Islands',
407 'TV' => 'Tuvalu',
408 'UG' => 'Uganda',
409 'UA' => 'Ukraine',
410 'AE' => 'United Arab Emirates',
411 'GB' => 'United Kingdom',
412 'US' => 'United States',
413 'UM' => 'United States Minor Outlying Islands',
414 'UY' => 'Uruguay',
415 'UZ' => 'Uzbekistan',
416 'VU' => 'Vanuatu',
417 'VE' => 'Venezuela, Bolivarian Republic of',
418 'VN' => 'Vietnam',
419 'VG' => 'Virgin Islands, British',
420 'VI' => 'Virgin Islands, U.S.',
421 'WF' => 'Wallis and Futuna',
422 'EH' => 'Western Sahara',
423 'YE' => 'Yemen',
424 'ZM' => 'Zambia',
425 'ZW' => 'Zimbabwe',
426 );
427 }
428 }
429