Ticket #32432: 32432.2.diff
| File 32432.2.diff, 2.2 KB (added by , 11 years ago) |
|---|
-
wp-includes/l10n.php
852 852 * 853 853 * @since 4.0.0 854 854 * 855 * @see get_dropdown_languages() 855 856 * @see get_available_languages() 856 857 * @see wp_get_available_translations() 857 858 * … … 869 870 * } 870 871 */ 871 872 function wp_dropdown_languages( $args = array() ) { 873 echo get_dropdown_languages( $args ); 874 } 872 875 876 /** 877 * Generates the markup of the language selector. 878 * 879 * @since 4.3 880 * 881 * @see get_available_languages() 882 * @see wp_get_available_translations() 883 * 884 * @param string|array $args { 885 * Optional. Array or string of arguments for creating the language selector. 886 * 887 * @type string $id ID attribute of the select element. Default empty. 888 * @type string $name Name attribute of the select element. Default empty. 889 * @type array $languages List of installed languages, contain only the locales. 890 * Default empty array. 891 * @type array $translations List of available translations. Default result of 892 * {@see wp_get_available_translations()}. 893 * @type string $selected Language which should be selected. Default empty. 894 * @type bool $show_available_translations Whether to show available translations. Default true. 895 * } 896 */ 897 function get_dropdown_languages( $args = array() ) { 898 $markup = ''; 873 899 $args = wp_parse_args( $args, array( 874 900 'id' => '', 875 901 'name' => '', … … 912 938 913 939 $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] ); 914 940 915 printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );941 $markup .= sprintf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) ); 916 942 917 943 // Holds the HTML markup. 918 944 $structure = array(); … … 949 975 } 950 976 $structure[] = '</optgroup>'; 951 977 } 952 953 echo join( "\n", $structure ); 954 955 echo '</select>'; 978 $markup .= join( "\n", $structure ); 979 $markup .= '</select>'; 980 return $markup; 956 981 }