diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-18 16:51:16 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-18 16:51:16 +0000 |
commit | 65899a8f41b2d096f44c4e545ced8c7014b2ce03 (patch) | |
tree | c304f7f23e61b44eae63a35c5836a317a9081fee /wp-admin/options-general.php | |
parent | ca142aadcb796b92dace1e227d317fb546af3f5c (diff) | |
download | wordpress-mu-65899a8f41b2d096f44c4e545ced8c7014b2ce03.tar.gz wordpress-mu-65899a8f41b2d096f44c4e545ced8c7014b2ce03.tar.xz wordpress-mu-65899a8f41b2d096f44c4e545ced8c7014b2ce03.zip |
Improved language selector, props momo360modena, fixes #529
Various clean ups. Replaced glob() with opendir()
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1249 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/options-general.php')
-rw-r--r-- | wp-admin/options-general.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index e2be9c0..8fdf3ef 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -92,22 +92,19 @@ endfor; </select></td> </tr> <?php -$lang_files = glob( ABSPATH . LANGDIR . '/*.mo' ); +if( is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) ) + while( ( $lang_file = readdir( $dh ) ) !== false ) + if( substr( $lang_file, -3 ) == '.mo' ) + $lang_files[] = $lang_file; $lang = get_option('WPLANG'); -if( is_array( $lang_files ) ) { +if( is_array($lang_files) && !empty($lang_files) ) { ?> <tr valign="top"> <th width="33%" scope="row"><?php _e('Blog language:') ?></th> <td> <select name="WPLANG" id="WPLANG"> - <?php - echo '<option value=""'.((empty($lang)) ? 'selected="selected"': '').'>'.__('English').'</option>'; - foreach ( (array) $lang_files as $key => $val ) { - $code_lang = basename( $val, '.mo' ); - echo '<option value="'.$code_lang.'"'.(($lang == $code_lang) ? ' selected="selected"' : '').'> '.format_code_lang($code_lang).'</option>'; - } - ?> + <?php mu_dropdown_languages( $lang_files, get_option('WPLANG') ); ?> </select> </td> </tr> |