Changeset 41734
- Timestamp:
- 10/04/2017 03:22:15 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r41733 r41734 1118 1118 * Optional. Array or string of arguments for outputting the language selector. 1119 1119 * 1120 * @type string $id ID attribute of the select element. Default empty.1121 * @type string $name Name attribute of the select element. Default empty.1120 * @type string $id ID attribute of the select element. Default 'locale'. 1121 * @type string $name Name attribute of the select element. Default 'locale'. 1122 1122 * @type array $languages List of installed languages, contain only the locales. 1123 1123 * Default empty array. … … 1135 1135 1136 1136 $parsed_args = wp_parse_args( $args, array( 1137 'id' => ' ',1138 'name' => ' ',1137 'id' => 'locale', 1138 'name' => 'locale', 1139 1139 'languages' => array(), 1140 1140 'translations' => array(), … … 1144 1144 'show_option_site_default' => false, 1145 1145 ) ); 1146 1147 // Bail if no ID or no name. 1148 if ( ! $parsed_args['id'] || ! $parsed_args['name'] ) { 1149 return; 1150 } 1146 1151 1147 1152 // English (United States) uses an empty string for the value attribute. … … 1183 1188 $translations_available = ( ! empty( $translations ) && $parsed_args['show_available_translations'] ); 1184 1189 1185 $output = sprintf( '<select name="%s" id="%s">', esc_attr( $parsed_args['name'] ), esc_attr( $parsed_args['id'] ) );1186 1187 1190 // Holds the HTML markup. 1188 1191 $structure = array(); … … 1193 1196 } 1194 1197 1198 // Site default. 1195 1199 if ( $parsed_args['show_option_site_default'] ) { 1196 1200 $structure[] = sprintf( … … 1201 1205 } 1202 1206 1207 // Always show English. 1203 1208 $structure[] = sprintf( 1204 1209 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', … … 1206 1211 ); 1207 1212 1213 // List installed languages. 1208 1214 foreach ( $languages as $language ) { 1209 1215 $structure[] = sprintf( … … 1234 1240 } 1235 1241 1242 // Combine the output string. 1243 $output = sprintf( '<select name="%s" id="%s">', esc_attr( $parsed_args['name'] ), esc_attr( $parsed_args['id'] ) ); 1236 1244 $output .= join( "\n", $structure ); 1237 1238 1245 $output .= '</select>'; 1239 1246
Note: See TracChangeset
for help on using the changeset viewer.