Make WordPress Core

Ticket #32432: 32432.diff

File 32432.diff, 1.4 KB (added by leewillis77, 11 years ago)

Proposed patch.

  • src/wp-includes/l10n.php

     
    867867 *     @type string  $selected                     Language which should be selected. Default empty.
    868868 *     @type bool    $show_available_translations  Whether to show available translations. Default true.
    869869 * }
     870 * @param bool $echo Whether to echo or just return the string. Defaults to true (echo).
    870871 */
    871 function wp_dropdown_languages( $args = array() ) {
     872function wp_dropdown_languages( $args = array(), $echo = TRUE ) {
    872873
    873874        $args = wp_parse_args( $args, array(
    874875                'id'           => '',
     
    912913
    913914        $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
    914915
    915         printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
    916 
    917916        // Holds the HTML markup.
    918917        $structure = array();
    919918
     
    949948                }
    950949                $structure[] = '</optgroup>';
    951950        }
     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        }
    952961
    953         echo join( "\n", $structure );
    954 
    955         echo '</select>';
    956962}