Changeset 32510
- Timestamp:
- 05/19/2015 12:32:10 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r31447 r32510 852 852 * 853 853 * @since 4.0.0 854 * @since 4.3.0 Introduced the `echo` argument. 854 855 * 855 856 * @see get_available_languages() … … 859 860 * Optional. Array or string of arguments for outputting the language selector. 860 861 * 861 * @type string $id ID attribute of the select element. Default empty. 862 * @type string $name Name attribute of the select element. Default empty. 863 * @type array $languages List of installed languages, contain only the locales. 864 * Default empty array. 865 * @type array $translations List of available translations. Default result of 866 * {@see wp_get_available_translations()}. 867 * @type string $selected Language which should be selected. Default empty. 868 * @type bool $show_available_translations Whether to show available translations. Default true. 862 * @type string $id ID attribute of the select element. Default empty. 863 * @type string $name Name attribute of the select element. Default empty. 864 * @type array $languages List of installed languages, contain only the locales. 865 * Default empty array. 866 * @type array $translations List of available translations. Default result of 867 * {@see wp_get_available_translations()}. 868 * @type string $selected Language which should be selected. Default empty. 869 * @type bool|int $echo Whether to echo or return the generated markup. Accepts 0, 1, or their 870 * bool equivalents. Default 1. 871 * @type bool $show_available_translations Whether to show available translations. Default true. 869 872 * } 873 * @return string HTML content only if 'echo' argument is 0. 870 874 */ 871 875 function wp_dropdown_languages( $args = array() ) { … … 877 881 'translations' => array(), 878 882 'selected' => '', 883 'echo' => 1, 879 884 'show_available_translations' => true, 880 885 ) ); … … 913 918 $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] ); 914 919 915 printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );920 $output = sprintf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) ); 916 921 917 922 // Holds the HTML markup. … … 951 956 } 952 957 953 echo join( "\n", $structure ); 954 955 echo '</select>'; 956 } 958 $output .= join( "\n", $structure ); 959 960 $output .= '</select>'; 961 962 if ( $args['echo'] ) { 963 echo $output; 964 } 965 966 return $output; 967 }
Note: See TracChangeset
for help on using the changeset viewer.