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 {
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;
$languages[] = array(
'language' => $translation['language'],
'native_name' => $translation['native_name'],
- 'lang' => $translation['iso'][1],
+ 'lang' => current( $translation['iso'] ),
);
// Remove installed language from available translations.
$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'] )
);