]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/l10n.php
WordPress 4.2.4-scripts
[autoinstalls/wordpress.git] / wp-includes / l10n.php
index 4c5d8b19a5028b245ca5a1a3bac9e57dce65b8bc..339602b1e8148b958e28a291653d3420416fdf5e 100644 (file)
@@ -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;