Settings.php
583 lines
| 1 | <?php |
| 2 | namespace EmbedPress\Ends\Back; |
| 3 | |
| 4 | use \EmbedPress\Core; |
| 5 | |
| 6 | (defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed."); |
| 7 | |
| 8 | /** |
| 9 | * Entity that handles the plugin's settings page. |
| 10 | * |
| 11 | * @package EmbedPress |
| 12 | * @subpackage EmbedPress/Ends/Back |
| 13 | * @author PressShack <help@pressshack.com> |
| 14 | * @copyright Copyright (C) 2017 PressShack. All rights reserved. |
| 15 | * @license GPLv2 or later |
| 16 | * @since 1.0.0 |
| 17 | */ |
| 18 | class Settings |
| 19 | { |
| 20 | /** |
| 21 | * This class namespace. |
| 22 | * |
| 23 | * @since 1.0.0 |
| 24 | * @access private |
| 25 | * @static |
| 26 | * |
| 27 | * @var string $namespace |
| 28 | */ |
| 29 | private static $namespace = '\EmbedPress\Ends\Back\Settings'; |
| 30 | |
| 31 | /** |
| 32 | * The plugin's unique identifier. |
| 33 | * |
| 34 | * @since 1.0.0 |
| 35 | * @access private |
| 36 | * @static |
| 37 | * |
| 38 | * @var string $identifier |
| 39 | */ |
| 40 | private static $identifier = "plg_embedpress"; |
| 41 | |
| 42 | /** |
| 43 | * Unique identifier to the plugin's admin settings section. |
| 44 | * |
| 45 | * @since 1.0.0 |
| 46 | * @access private |
| 47 | * @static |
| 48 | * |
| 49 | * @var string $sectionAdminIdentifier |
| 50 | */ |
| 51 | private static $sectionAdminIdentifier = "embedpress_options_admin"; |
| 52 | |
| 53 | /** |
| 54 | * Unique identifier to the plugin's general settings section. |
| 55 | * |
| 56 | * @since 1.0.0 |
| 57 | * @access private |
| 58 | * @static |
| 59 | * |
| 60 | * @var string $sectionGroupIdentifier The name of the plugin. |
| 61 | */ |
| 62 | private static $sectionGroupIdentifier = "embedpress"; |
| 63 | |
| 64 | /** |
| 65 | * Map to all settings. |
| 66 | * |
| 67 | * @since 1.0.0 |
| 68 | * @access private |
| 69 | * @static |
| 70 | * |
| 71 | * @var string $fieldMap |
| 72 | */ |
| 73 | private static $fieldMap = array( |
| 74 | 'enablePluginInAdmin' => array( |
| 75 | 'label' => "Load previews in the admin editor", |
| 76 | 'section' => "admin" |
| 77 | ), |
| 78 | 'enablePluginInFront' => array( |
| 79 | 'label' => "Load previews in the frontend editor", |
| 80 | 'section' => "admin" |
| 81 | ), |
| 82 | 'forceFacebookLanguage' => array( |
| 83 | 'label' => "Facebook embed language", |
| 84 | 'section' => "admin" |
| 85 | ) |
| 86 | ); |
| 87 | |
| 88 | /** |
| 89 | * Class constructor. This prevents the class being directly instantiated. |
| 90 | * |
| 91 | * @since 1.0.0 |
| 92 | */ |
| 93 | public function __construct() |
| 94 | {} |
| 95 | |
| 96 | /** |
| 97 | * This prevents the class being cloned. |
| 98 | * |
| 99 | * @since 1.0.0 |
| 100 | */ |
| 101 | public function __clone() |
| 102 | {} |
| 103 | |
| 104 | /** |
| 105 | * Method that adds an sub-item for EmbedPress to the WordPress Settings menu. |
| 106 | * |
| 107 | * @since 1.0.0 |
| 108 | * @static |
| 109 | */ |
| 110 | public static function registerMenuItem() |
| 111 | { |
| 112 | add_menu_page('PublishPress Embeds Settings', 'Embeds', 'manage_options', 'embedpress', array(self::$namespace, 'renderForm'), null, 64); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Method that configures the EmbedPress settings page. |
| 117 | * |
| 118 | * @since 1.0.0 |
| 119 | * @static |
| 120 | */ |
| 121 | public static function registerActions() |
| 122 | { |
| 123 | $activeTab = isset($_GET['tab']) ? strtolower($_GET['tab']) : ""; |
| 124 | if ($activeTab !== "embedpress") { |
| 125 | $action = "embedpress:{$activeTab}:settings:register"; |
| 126 | } else { |
| 127 | $activeTab = ""; |
| 128 | } |
| 129 | |
| 130 | if (!empty($activeTab) && has_action($action)) { |
| 131 | do_action($action, array( |
| 132 | 'id' => self::$sectionAdminIdentifier, |
| 133 | 'slug' => self::$identifier |
| 134 | )); |
| 135 | } else { |
| 136 | register_setting(self::$sectionGroupIdentifier, self::$sectionGroupIdentifier, array(self::$namespace, "validateForm")); |
| 137 | |
| 138 | add_settings_section(self::$sectionAdminIdentifier, '', null, self::$identifier); |
| 139 | |
| 140 | foreach (self::$fieldMap as $fieldName => $field) { |
| 141 | add_settings_field($fieldName, $field['label'], array(self::$namespace, "renderField_{$fieldName}"), self::$identifier, self::${"section". ucfirst($field['section']) ."Identifier"}); |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Returns true if the plugin is active |
| 148 | * |
| 149 | * @param string $plugin |
| 150 | * |
| 151 | * @return boolean |
| 152 | */ |
| 153 | protected static function is_plugin_active( $plugin ) { |
| 154 | return is_plugin_active( "{$plugin}/{$plugin}.php" ); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Returns true if the plugin is installed |
| 159 | * |
| 160 | * @param string $plugin |
| 161 | * |
| 162 | * @return boolean |
| 163 | */ |
| 164 | protected static function is_plugin_installed( $plugin ) { |
| 165 | return file_exists( plugin_dir_path( EMBEDPRESS_ROOT ) . "{$plugin}/{$plugin}.php" ); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Method that render the settings's form. |
| 170 | * |
| 171 | * @since 1.0.0 |
| 172 | * @static |
| 173 | */ |
| 174 | public static function renderForm() |
| 175 | { |
| 176 | // Add the color picker css file |
| 177 | wp_enqueue_style('wp-color-picker'); |
| 178 | // Include our custom jQuery file with WordPress Color Picker dependency |
| 179 | wp_enqueue_script('ep-settings', EMBEDPRESS_URL_ASSETS .'js/settings.js', array('wp-color-picker'), EMBEDPRESS_PLG_VERSION, true); |
| 180 | |
| 181 | $activeTab = isset($_GET['tab']) ? strtolower($_GET['tab']) : ""; |
| 182 | $settingsFieldsIdentifier = !empty($activeTab) ? "embedpress:{$activeTab}" : self::$sectionGroupIdentifier; |
| 183 | $settingsSectionsIdentifier = !empty($activeTab) ? "embedpress:{$activeTab}" : self::$identifier; |
| 184 | ?> |
| 185 | <div id="embedpress-settings-wrapper"> |
| 186 | <header> |
| 187 | <h1 class="pressshack-title"> |
| 188 | <a href="//wordpress.org/plugins/embedpress" target="_blank" rel="noopener noreferrer" title="PublishPress Embeds"> |
| 189 | PublishPress Embeds |
| 190 | </a> |
| 191 | </h1> |
| 192 | </header> |
| 193 | |
| 194 | <?php settings_errors(); ?> |
| 195 | |
| 196 | <div> |
| 197 | <h2 class="nav-tab-wrapper"> |
| 198 | <a href="?page=embedpress" class="nav-tab<?php echo $activeTab === 'embedpress' || empty($activeTab) ? ' nav-tab-active' : ''; ?> "> |
| 199 | General settings |
| 200 | </a> |
| 201 | |
| 202 | <?php do_action('embedpress:settings:render:tab', $activeTab); ?> |
| 203 | |
| 204 | <a href="?page=embedpress&tab=addons" class="nav-tab<?php echo $activeTab === 'addons' ? ' nav-tab-active' : ''; ?> "> |
| 205 | Add-ons |
| 206 | </a> |
| 207 | </h2> |
| 208 | |
| 209 | <?php if ($activeTab !== 'addons') : ?> |
| 210 | <form action="options.php" method="POST" style="padding-bottom: 20px;"> |
| 211 | <?php settings_fields($settingsFieldsIdentifier); ?> |
| 212 | <?php do_settings_sections($settingsSectionsIdentifier); ?> |
| 213 | |
| 214 | <button type="submit" class="button button-primary">Save changes</button> |
| 215 | </form> |
| 216 | <?php endif; ?> |
| 217 | |
| 218 | <?php if ($activeTab === 'addons') : ?> |
| 219 | <?php |
| 220 | $icons_base_path = plugins_url( 'embedpress' ) . '/assets/images/' ; |
| 221 | |
| 222 | $addons = array( |
| 223 | 'embedpress-youtube' => array( |
| 224 | 'title' => __( 'The YouTube Add-on for PublishPress', 'embedpress' ), |
| 225 | 'description' => __( 'Get more features for your YouTube embeds in WordPress.', 'embedpress' ), |
| 226 | 'available' => true, |
| 227 | 'installed' => static::is_plugin_installed( 'embedpress-youtube' ), |
| 228 | 'active' => static::is_plugin_active( 'embedpress-youtube' ), |
| 229 | ), |
| 230 | 'embedpress-vimeo' => array( |
| 231 | 'title' => __( 'The Vimeo Add-on for PublishPress', 'embedpress' ), |
| 232 | 'description' => __( 'Get more features for your Vimeo embeds in WordPress.', 'embedpress' ), |
| 233 | 'available' => true, |
| 234 | 'installed' => static::is_plugin_installed( 'embedpress-vimeo' ), |
| 235 | 'active' => static::is_plugin_active( 'embedpress-vimeo' ), |
| 236 | ), |
| 237 | 'embedpress-wistia' => array( |
| 238 | 'title' => __( 'The Wistia Add-on for PublishPress', 'embedpress' ), |
| 239 | 'description' => __( 'Get more features for your Wistia embeds in WordPress.', 'embedpress' ), |
| 240 | 'available' => true, |
| 241 | 'installed' => static::is_plugin_installed( 'embedpress-wistia' ), |
| 242 | 'active' => static::is_plugin_active( 'embedpress-wistia' ), |
| 243 | ), |
| 244 | ); |
| 245 | |
| 246 | $args = array( |
| 247 | 'addons' => $addons, |
| 248 | 'icons_base_path' => $icons_base_path, |
| 249 | 'labels' => array( |
| 250 | 'active' => __( 'Active', 'publishpress' ), |
| 251 | 'installed' => __( 'Installed', 'publishpress' ), |
| 252 | 'get_pro_addons' => __( 'Get Pro Add-ons!', 'publishpress' ), |
| 253 | 'coming_soon' => __( 'Coming soon', 'publishpress' ), |
| 254 | ), |
| 255 | ); |
| 256 | |
| 257 | ?> |
| 258 | <div class="ep-module-settings"> |
| 259 | <ul class="ep-block-addons-items"> |
| 260 | <?php foreach ( $addons as $name => $addon ): ?> |
| 261 | <li class="ep-block-addons-item "> |
| 262 | <img src="<?php echo $icons_base_path . $name; ?>.jpg"> |
| 263 | <h3><?php echo $addon['title']; ?></h3> |
| 264 | <p><?php echo $addon['description']; ?></p> |
| 265 | |
| 266 | <?php if ( $addon['available'] ): ?> |
| 267 | <?php if ( $addon['installed'] ): ?> |
| 268 | <?php if ( $addon['active'] ): ?> |
| 269 | <div> |
| 270 | <span class="dashicons dashicons-yes"></span><span><?php echo __( 'Active', 'embedpress' ); ?></span> |
| 271 | </div> |
| 272 | <?php else: ?> |
| 273 | <div> |
| 274 | <span><?php echo __( 'Installed', 'embedpress' ); ?></span> |
| 275 | </div> |
| 276 | <?php endif; ?> |
| 277 | <?php else: ?> |
| 278 | <a href="https://pressshack.com/addons/embedpress-club/" class="button button-primary"> |
| 279 | <span class="dashicons dashicons-cart"></span> <?php echo __( 'Get Pro Add-ons!', 'embedpress' ); ?> |
| 280 | </a> |
| 281 | <?php endif; ?> |
| 282 | <?php else: ?> |
| 283 | <div><?php echo __( 'Coming soon', 'embedpress' ); ?></div> |
| 284 | <?php endif; ?> |
| 285 | </li> |
| 286 | <?php endforeach; ?> |
| 287 | </ul> |
| 288 | </div> |
| 289 | <?php endif; ?> |
| 290 | </div> |
| 291 | |
| 292 | <footer> |
| 293 | <p> |
| 294 | <a href="//wordpress.org/support/plugin/embedpress/reviews/#new-post" target="_blank" rel="noopener noreferrer">If you like <strong>PublishPress Embeds</strong> please leave us a <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span> rating. Thank you!</a> |
| 295 | </p> |
| 296 | <hr> |
| 297 | <nav> |
| 298 | <ul> |
| 299 | <li> |
| 300 | <a href="//pressshack.com/embedpress" target="_blank" rel="noopener noreferrer" title="About EmbedPress">About</a> |
| 301 | </li> |
| 302 | <li> |
| 303 | <a href="//pressshack.com/embedpress/docs/sources-support" target="_blank" rel="noopener noreferrer" title="List of supported sources by EmbedPress">Supported sources</a> |
| 304 | </li> |
| 305 | <li> |
| 306 | <a href="//pressshack.com/embedpress/docs" target="_blank" rel="noopener noreferrer" title="EmbedPress Documentation">Documentation</a> |
| 307 | </li> |
| 308 | <li> |
| 309 | <a href="//pressshack.com/publishpress/addons/" target="_blank" rel="noopener noreferrer" title="EmbedPress Add-Ons">Add-Ons</a> |
| 310 | </li> |
| 311 | <li> |
| 312 | <a href="//pressshack.com/contact" target="_blank" rel="noopener noreferrer" title="Contact the PressShack team">Contact</a> |
| 313 | </li> |
| 314 | <li> |
| 315 | <a href="//twitter.com/pressshack" target="_blank" rel="noopener noreferrer"> |
| 316 | <span class="dashicons dashicons-twitter"></span> |
| 317 | </a> |
| 318 | </li> |
| 319 | <li> |
| 320 | <a href="//facebook.com/pressshack" target="_blank" rel="noopener noreferrer"> |
| 321 | <span class="dashicons dashicons-facebook"></span> |
| 322 | </a> |
| 323 | </li> |
| 324 | </ul> |
| 325 | </nav> |
| 326 | <p> |
| 327 | <a href="//pressshack.com" target="_blank" rel="noopener noreferrer"> |
| 328 | <img width="100" src="//pressshack.com/wp-content/uploads/2016/11/logo-450.png"> |
| 329 | </a> |
| 330 | </p> |
| 331 | </footer> |
| 332 | </div> |
| 333 | <?php |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Method that validates the form data. |
| 338 | * |
| 339 | * @since 1.0.0 |
| 340 | * @static |
| 341 | * |
| 342 | * @param mixed $freshData Data received from the form. |
| 343 | * |
| 344 | * @return array |
| 345 | */ |
| 346 | public static function validateForm($freshData) |
| 347 | { |
| 348 | $data = array( |
| 349 | 'enablePluginInAdmin' => (bool)$freshData['enablePluginInAdmin'], |
| 350 | 'enablePluginInFront' => (bool)$freshData['enablePluginInFront'], |
| 351 | 'fbLanguage' => $freshData['fbLanguage'] |
| 352 | ); |
| 353 | |
| 354 | return $data; |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * Method that renders the enablePluginInAdmin input. |
| 359 | * |
| 360 | * @since 1.0.0 |
| 361 | * @static |
| 362 | */ |
| 363 | public static function renderField_enablePluginInAdmin() |
| 364 | { |
| 365 | $fieldName = "enablePluginInAdmin"; |
| 366 | |
| 367 | $options = get_option(self::$sectionGroupIdentifier); |
| 368 | |
| 369 | $options[$fieldName] = !isset($options[$fieldName]) ? true : (bool)$options[$fieldName]; |
| 370 | |
| 371 | echo '<label><input type="radio" id="'. $fieldName .'_0" name="'. self::$sectionGroupIdentifier .'['. $fieldName .']" value="0" '. (!$options[$fieldName] ? "checked" : "") .' /> No</label>'; |
| 372 | echo " "; |
| 373 | echo '<label><input type="radio" id="'. $fieldName .'_1" name="'. self::$sectionGroupIdentifier .'['. $fieldName .']" value="1" '. ($options[$fieldName] ? "checked" : "") .' /> Yes</label>'; |
| 374 | echo '<p class="description">Do you want PublishPress Embeds to run here in the admin area? Disabling this <strong>will not</strong> affect your frontend embeds.</p>'; |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * Method that renders the enablePluginInFront input. |
| 379 | * |
| 380 | * @since 1.6.0 |
| 381 | * @static |
| 382 | */ |
| 383 | public static function renderField_enablePluginInFront() |
| 384 | { |
| 385 | $fieldName = "enablePluginInFront"; |
| 386 | |
| 387 | $options = get_option(self::$sectionGroupIdentifier); |
| 388 | |
| 389 | $options[$fieldName] = !isset($options[$fieldName]) ? true : (bool)$options[$fieldName]; |
| 390 | |
| 391 | echo '<label><input type="radio" id="'. $fieldName .'_0" name="'. self::$sectionGroupIdentifier .'['. $fieldName .']" value="0" '. (!$options[$fieldName] ? "checked" : "") .' /> No</label>'; |
| 392 | echo " "; |
| 393 | echo '<label><input type="radio" id="'. $fieldName .'_1" name="'. self::$sectionGroupIdentifier .'['. $fieldName .']" value="1" '. ($options[$fieldName] ? "checked" : "") .' /> Yes</label>'; |
| 394 | echo '<p class="description">Do you want PublishPress Embeds to run within editors in frontend (if there\'s any)? Disabling this <strong>will not</strong> affect embeds seem by your regular users in frontend.</p>'; |
| 395 | } |
| 396 | |
| 397 | /** |
| 398 | * Method that renders the forceFacebookLanguage input. |
| 399 | * |
| 400 | * @since 1.3.0 |
| 401 | * @static |
| 402 | */ |
| 403 | public static function renderField_forceFacebookLanguage() |
| 404 | { |
| 405 | $fieldName = "fbLanguage"; |
| 406 | |
| 407 | $options = get_option(self::$sectionGroupIdentifier); |
| 408 | |
| 409 | $options[$fieldName] = !isset($options[$fieldName]) ? "" : $options[$fieldName]; |
| 410 | |
| 411 | $facebookLocales = self::getFacebookAvailableLocales(); |
| 412 | |
| 413 | echo '<select name="'. self::$sectionGroupIdentifier .'['. $fieldName .']">'; |
| 414 | echo '<option value="0">Automatic (by Facebook)</option>'; |
| 415 | echo '<optgroup label="Available">'; |
| 416 | foreach ($facebookLocales as $locale => $localeName) { |
| 417 | echo '<option value="'. $locale .'"'. ($options[$fieldName] === $locale ? ' selected' : '') .'>'. $localeName .'</option>'; |
| 418 | } |
| 419 | echo '</optgroup>'; |
| 420 | echo '</select>'; |
| 421 | |
| 422 | echo '<p class="description">Sometimes Facebook can choose the wrong language for embeds. If this happens, choose the correct language here.</p>'; |
| 423 | } |
| 424 | |
| 425 | /** |
| 426 | * Returns a list of locales that can be used on Facebook embeds. |
| 427 | * |
| 428 | * @since 1.3.0 |
| 429 | * @static |
| 430 | * |
| 431 | * @return array |
| 432 | */ |
| 433 | public static function getFacebookAvailableLocales() |
| 434 | { |
| 435 | $locales = array( |
| 436 | 'af_ZA' => "Afrikaans", |
| 437 | 'ak_GH' => "Akan", |
| 438 | 'am_ET' => "Amharic", |
| 439 | 'ar_AR' => "Arabic", |
| 440 | 'as_IN' => "Assamese", |
| 441 | 'ay_BO' => "Aymara", |
| 442 | 'az_AZ' => "Azerbaijani", |
| 443 | 'be_BY' => "Belarusian", |
| 444 | 'bg_BG' => "Bulgarian", |
| 445 | 'bn_IN' => "Bengali", |
| 446 | 'br_FR' => "Breton", |
| 447 | 'bs_BA' => "Bosnian", |
| 448 | 'ca_ES' => "Catalan", |
| 449 | 'cb_IQ' => "Sorani Kurdish", |
| 450 | 'ck_US' => "Cherokee", |
| 451 | 'co_FR' => "Corsican", |
| 452 | 'cs_CZ' => "Czech", |
| 453 | 'cx_PH' => "Cebuano", |
| 454 | 'cy_GB' => "Welsh", |
| 455 | 'da_DK' => "Danish", |
| 456 | 'de_DE' => "German", |
| 457 | 'el_GR' => "Greek", |
| 458 | 'en_GB' => "English (UK)", |
| 459 | 'en_IN' => "English (India)", |
| 460 | 'en_PI' => "English (Pirate)", |
| 461 | 'en_UD' => "English (Upside Down)", |
| 462 | 'en_US' => "English (US)", |
| 463 | 'eo_EO' => "Esperanto", |
| 464 | 'es_CL' => "Spanish (Chile)", |
| 465 | 'es_CO' => "Spanish (Colombia)", |
| 466 | 'es_ES' => "Spanish (Spain)", |
| 467 | 'es_LA' => "Spanish", |
| 468 | 'es_MX' => "Spanish (Mexico)", |
| 469 | 'es_VE' => "Spanish (Venezuela)", |
| 470 | 'et_EE' => "Estonian", |
| 471 | 'eu_ES' => "Basque", |
| 472 | 'fa_IR' => "Persian", |
| 473 | 'fb_LT' => "Leet Speak", |
| 474 | 'ff_NG' => "Fulah", |
| 475 | 'fi_FI' => "Finnish", |
| 476 | 'fo_FO' => "Faroese", |
| 477 | 'fr_CA' => "French (Canada)", |
| 478 | 'fr_FR' => "French (France)", |
| 479 | 'fy_NL' => "Frisian", |
| 480 | 'ga_IE' => "Irish", |
| 481 | 'gl_ES' => "Galician", |
| 482 | 'gn_PY' => "Guarani", |
| 483 | 'gu_IN' => "Gujarati", |
| 484 | 'gx_GR' => "Classical Greek", |
| 485 | 'ha_NG' => "Hausa", |
| 486 | 'he_IL' => "Hebrew", |
| 487 | 'hi_IN' => "Hindi", |
| 488 | 'hr_HR' => "Croatian", |
| 489 | 'ht_HT' => "Haitian Creole", |
| 490 | 'hu_HU' => "Hungarian", |
| 491 | 'hy_AM' => "Armenian", |
| 492 | 'id_ID' => "Indonesian", |
| 493 | 'ig_NG' => "Igbo", |
| 494 | 'is_IS' => "Icelandic", |
| 495 | 'it_IT' => "Italian", |
| 496 | 'ja_JP' => "Japanese", |
| 497 | 'ja_KS' => "Japanese (Kansai)", |
| 498 | 'jv_ID' => "Javanese", |
| 499 | 'ka_GE' => "Georgian", |
| 500 | 'kk_KZ' => "Kazakh", |
| 501 | 'km_KH' => "Khmer", |
| 502 | 'kn_IN' => "Kannada", |
| 503 | 'ko_KR' => "Korean", |
| 504 | 'ku_TR' => "Kurdish (Kurmanji)", |
| 505 | 'ky_KG' => "Kyrgyz", |
| 506 | 'la_VA' => "Latin", |
| 507 | 'lg_UG' => "Ganda", |
| 508 | 'li_NL' => "Limburgish", |
| 509 | 'ln_CD' => "Lingala", |
| 510 | 'lo_LA' => "Lao", |
| 511 | 'lt_LT' => "Lithuanian", |
| 512 | 'lv_LV' => "Latvian", |
| 513 | 'mg_MG' => "Malagasy", |
| 514 | 'mi_NZ' => "Māori", |
| 515 | 'mk_MK' => "Macedonian", |
| 516 | 'ml_IN' => "Malayalam", |
| 517 | 'mn_MN' => "Mongolian", |
| 518 | 'mr_IN' => "Marathi", |
| 519 | 'ms_MY' => "Malay", |
| 520 | 'mt_MT' => "Maltese", |
| 521 | 'my_MM' => "Burmese", |
| 522 | 'nb_NO' => "Norwegian (bokmal)", |
| 523 | 'nd_ZW' => "Ndebele", |
| 524 | 'ne_NP' => "Nepali", |
| 525 | 'nl_BE' => "Dutch (België)", |
| 526 | 'nl_NL' => "Dutch", |
| 527 | 'nn_NO' => "Norwegian (nynorsk)", |
| 528 | 'ny_MW' => "Chewa", |
| 529 | 'or_IN' => "Oriya", |
| 530 | 'pa_IN' => "Punjabi", |
| 531 | 'pl_PL' => "Polish", |
| 532 | 'ps_AF' => "Pashto", |
| 533 | 'pt_BR' => "Portuguese (Brazil)", |
| 534 | 'pt_PT' => "Portuguese (Portugal)", |
| 535 | 'qc_GT' => "Quiché", |
| 536 | 'qu_PE' => "Quechua", |
| 537 | 'rm_CH' => "Romansh", |
| 538 | 'ro_RO' => "Romanian", |
| 539 | 'ru_RU' => "Russian", |
| 540 | 'rw_RW' => "Kinyarwanda", |
| 541 | 'sa_IN' => "Sanskrit", |
| 542 | 'sc_IT' => "Sardinian", |
| 543 | 'se_NO' => "Northern Sámi", |
| 544 | 'si_LK' => "Sinhala", |
| 545 | 'sk_SK' => "Slovak", |
| 546 | 'sl_SI' => "Slovenian", |
| 547 | 'sn_ZW' => "Shona", |
| 548 | 'so_SO' => "Somali", |
| 549 | 'sq_AL' => "Albanian", |
| 550 | 'sr_RS' => "Serbian", |
| 551 | 'sv_SE' => "Swedish", |
| 552 | 'sw_KE' => "Swahili", |
| 553 | 'sy_SY' => "Syriac", |
| 554 | 'sz_PL' => "Silesian", |
| 555 | 'ta_IN' => "Tamil", |
| 556 | 'te_IN' => "Telugu", |
| 557 | 'tg_TJ' => "Tajik", |
| 558 | 'th_TH' => "Thai", |
| 559 | 'tk_TM' => "Turkmen", |
| 560 | 'tl_PH' => "Filipino", |
| 561 | 'tl_ST' => "Klingon", |
| 562 | 'tr_TR' => "Turkish", |
| 563 | 'tt_RU' => "Tatar", |
| 564 | 'tz_MA' => "Tamazight", |
| 565 | 'uk_UA' => "Ukrainian", |
| 566 | 'ur_PK' => "Urdu", |
| 567 | 'uz_UZ' => "Uzbek", |
| 568 | 'vi_VN' => "Vietnamese", |
| 569 | 'wo_SN' => "Wolof", |
| 570 | 'xh_ZA' => "Xhosa", |
| 571 | 'yi_DE' => "Yiddish", |
| 572 | 'yo_NG' => "Yoruba", |
| 573 | 'zh_CN' => "Simplified Chinese (China)", |
| 574 | 'zh_HK' => "Traditional Chinese (Hong Kong)", |
| 575 | 'zh_TW' => "Traditional Chinese (Taiwan)", |
| 576 | 'zu_ZA' => "Zulu", |
| 577 | 'zz_TR' => "Zazaki" |
| 578 | ); |
| 579 | |
| 580 | return $locales; |
| 581 | } |
| 582 | } |
| 583 |