Ticket #32432: 32432.diff
| File 32432.diff, 1.4 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/l10n.php
867 867 * @type string $selected Language which should be selected. Default empty. 868 868 * @type bool $show_available_translations Whether to show available translations. Default true. 869 869 * } 870 * @param bool $echo Whether to echo or just return the string. Defaults to true (echo). 870 871 */ 871 function wp_dropdown_languages( $args = array() ) {872 function wp_dropdown_languages( $args = array(), $echo = TRUE ) { 872 873 873 874 $args = wp_parse_args( $args, array( 874 875 'id' => '', … … 912 913 913 914 $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] ); 914 915 915 printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );916 917 916 // Holds the HTML markup. 918 917 $structure = array(); 919 918 … … 949 948 } 950 949 $structure[] = '</optgroup>'; 951 950 } 951 if ( $echo ) { 952 printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) ); 953 echo join( "\n", $structure ); 954 echo '</select>'; 955 } else { 956 $markup = sprintf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) ); 957 $markup .= join( "\n", $structure ); 958 $markup .= '</select>'; 959 return $markup; 960 } 952 961 953 echo join( "\n", $structure );954 955 echo '</select>';956 962 }