Make WordPress Core

Ticket #32432: 32432.4.patch

File 32432.4.patch, 1.5 KB (added by juliobox, 11 years ago)
  • l10n.php

     
    866866 *                                                 {@see wp_get_available_translations()}.
    867867 *     @type string  $selected                     Language which should be selected. Default empty.
    868868 *     @type bool    $show_available_translations  Whether to show available translations. Default true.
     869 *     @type bool    $echo                         True to output the markup (default), or false to return it.
    869870 * }
    870871 */
    871872function wp_dropdown_languages( $args = array() ) {
     
    877878                'translations' => array(),
    878879                'selected'     => '',
    879880                'show_available_translations' => true,
     881                'echo'         => true,
    880882        ) );
    881883
    882884        $translations = $args['translations'];
     
    910912                }
    911913        }
    912914
     915        $output = '';
     916
    913917        $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
    914918
    915         printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
     919        $output .= sprintf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
    916920
    917921        // Holds the HTML markup.
    918922        $structure = array();
     
    950954                $structure[] = '</optgroup>';
    951955        }
    952956
    953         echo join( "\n", $structure );
     957        $output .= join( "\n", $structure );
    954958
    955         echo '</select>';
     959        $output .= '</select>';
     960        if ( $args['echo'] ) {
     961                echo $output;
     962        } else {
     963                return $output;
     964        }
    956965}