]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/l10n.php
WordPress 4.2.5
[autoinstalls/wordpress.git] / wp-includes / l10n.php
index 67215452b766263ccf9fa3fc1b715e6346c276ac..339602b1e8148b958e28a291653d3420416fdf5e 100644 (file)
@@ -594,7 +594,7 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
 
        if ( false !== $plugin_rel_path ) {
                $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
-       } else if ( false !== $deprecated ) {
+       } elseif ( false !== $deprecated ) {
                _deprecated_argument( __FUNCTION__, '2.7' );
                $path = ABSPATH . trim( $deprecated, '/' );
        } else {
@@ -763,11 +763,15 @@ function translate_user_role( $name ) {
 function get_available_languages( $dir = null ) {
        $languages = array();
 
-       foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {
-               $lang_file = basename($lang_file, '.mo');
-               if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
-                       0 !== strpos( $lang_file, 'admin-' ))
-                       $languages[] = $lang_file;
+       $lang_files = glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' );
+       if ( $lang_files ) {
+               foreach( $lang_files as $lang_file ) {
+                       $lang_file = basename( $lang_file, '.mo' );
+                       if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
+                               0 !== strpos( $lang_file, 'admin-' ) ) {
+                               $languages[] = $lang_file;
+                       }
+               }
        }
 
        return $languages;
@@ -896,7 +900,7 @@ function wp_dropdown_languages( $args = array() ) {
                        $languages[] = array(
                                'language'    => $translation['language'],
                                'native_name' => $translation['native_name'],
-                               'lang'        => $translation['iso'][1],
+                               'lang'        => current( $translation['iso'] ),
                        );
 
                        // Remove installed language from available translations.
@@ -942,7 +946,7 @@ function wp_dropdown_languages( $args = array() ) {
                        $structure[] = sprintf(
                                '<option value="%s" lang="%s"%s>%s</option>',
                                esc_attr( $translation['language'] ),
-                               esc_attr( $translation['iso'][1] ),
+                               esc_attr( current( $translation['iso'] ) ),
                                selected( $translation['language'], $args['selected'], false ),
                                esc_html( $translation['native_name'] )
                        );