Changeset 41733
- Timestamp:
- 10/04/2017 03:07:26 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r41289 r41733 1134 1134 function wp_dropdown_languages( $args = array() ) { 1135 1135 1136 $ args = wp_parse_args( $args, array(1136 $parsed_args = wp_parse_args( $args, array( 1137 1137 'id' => '', 1138 1138 'name' => '', … … 1146 1146 1147 1147 // English (United States) uses an empty string for the value attribute. 1148 if ( 'en_US' === $ args['selected'] ) {1149 $ args['selected'] = '';1150 } 1151 1152 $translations = $ args['translations'];1148 if ( 'en_US' === $parsed_args['selected'] ) { 1149 $parsed_args['selected'] = ''; 1150 } 1151 1152 $translations = $parsed_args['translations']; 1153 1153 if ( empty( $translations ) ) { 1154 1154 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); … … 1157 1157 1158 1158 /* 1159 * $ args['languages'] should only contain the locales. Find the locale in1159 * $parsed_args['languages'] should only contain the locales. Find the locale in 1160 1160 * $translations to get the native name. Fall back to locale. 1161 1161 */ 1162 1162 $languages = array(); 1163 foreach ( $ args['languages'] as $locale ) {1163 foreach ( $parsed_args['languages'] as $locale ) { 1164 1164 if ( isset( $translations[ $locale ] ) ) { 1165 1165 $translation = $translations[ $locale ]; … … 1181 1181 } 1182 1182 1183 $translations_available = ( ! empty( $translations ) && $ args['show_available_translations'] );1184 1185 $output = sprintf( '<select name="%s" id="%s">', esc_attr( $ args['name'] ), esc_attr( $args['id'] ) );1183 $translations_available = ( ! empty( $translations ) && $parsed_args['show_available_translations'] ); 1184 1185 $output = sprintf( '<select name="%s" id="%s">', esc_attr( $parsed_args['name'] ), esc_attr( $parsed_args['id'] ) ); 1186 1186 1187 1187 // Holds the HTML markup. … … 1193 1193 } 1194 1194 1195 if ( $ args['show_option_site_default'] ) {1195 if ( $parsed_args['show_option_site_default'] ) { 1196 1196 $structure[] = sprintf( 1197 1197 '<option value="site-default" data-installed="1"%s>%s</option>', 1198 selected( 'site-default', $ args['selected'], false ),1198 selected( 'site-default', $parsed_args['selected'], false ), 1199 1199 _x( 'Site Default', 'default site language' ) 1200 1200 ); … … 1203 1203 $structure[] = sprintf( 1204 1204 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', 1205 selected( '', $ args['selected'], false )1205 selected( '', $parsed_args['selected'], false ) 1206 1206 ); 1207 1207 … … 1211 1211 esc_attr( $language['language'] ), 1212 1212 esc_attr( $language['lang'] ), 1213 selected( $language['language'], $ args['selected'], false ),1213 selected( $language['language'], $parsed_args['selected'], false ), 1214 1214 esc_html( $language['native_name'] ) 1215 1215 ); … … 1227 1227 esc_attr( $translation['language'] ), 1228 1228 esc_attr( current( $translation['iso'] ) ), 1229 selected( $translation['language'], $ args['selected'], false ),1229 selected( $translation['language'], $parsed_args['selected'], false ), 1230 1230 esc_html( $translation['native_name'] ) 1231 1231 ); … … 1238 1238 $output .= '</select>'; 1239 1239 1240 if ( $ args['echo'] ) {1240 if ( $parsed_args['echo'] ) { 1241 1241 echo $output; 1242 1242 }
Note: See TracChangeset
for help on using the changeset viewer.