Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r33593 r34111  
    165165 *
    166166 * @since 3.0.0
     167 * @since 4.4.0 Introduced the `$echo` argument.
    167168 *
    168169 * @param int          $post_id Optional. Post ID. Default 0.
     
    180181 *     @type bool   $checked_ontop        Whether to move checked items out of the hierarchy and to
    181182 *                                        the top of the list. Default true.
     183 *     @type bool   $echo                 Whether to echo the generated markup. False to return the markup instead
     184 *                                        of echoing it. Default true.
    182185 * }
    183186 */
     
    189192        'walker' => null,
    190193        'taxonomy' => 'category',
    191         'checked_ontop' => true
     194        'checked_ontop' => true,
     195        'echo' => true,
    192196    );
    193197
     
    252256    }
    253257
     258    $output = '';
     259
    254260    if ( $r['checked_ontop'] ) {
    255261        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
     
    257263        $keys = array_keys( $categories );
    258264
    259         foreach( $keys as $k ) {
     265        foreach ( $keys as $k ) {
    260266            if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
    261267                $checked_categories[] = $categories[$k];
     
    265271
    266272        // Put checked cats on top
    267         echo call_user_func_array( array( $walker, 'walk' ), array( $checked_categories, 0, $args ) );
     273        $output .= call_user_func_array( array( $walker, 'walk' ), array( $checked_categories, 0, $args ) );
    268274    }
    269275    // Then the rest of them
    270     echo call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
     276    $output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
     277
     278    if ( $r['echo'] ) {
     279        echo $output;
     280    }
     281
     282    return $output;
    271283}
    272284
     
    479491<form method="get">
    480492<?php if ( $table_row ) : ?>
    481 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
     493<table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
    482494<?php else : ?>
    483495<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
     
    487499    <div id="edithead" style="display:none;">
    488500        <div class="inside">
    489         <label for="author"><?php _e('Name') ?></label>
    490         <input type="text" name="newcomment_author" size="50" value="" id="author" />
     501        <label for="author-name"><?php _e( 'Name' ) ?></label>
     502        <input type="text" name="newcomment_author" size="50" value="" id="author-name" />
    491503        </div>
    492504
    493505        <div class="inside">
    494         <label for="author-email"><?php _e('E-mail') ?></label>
     506        <label for="author-email"><?php _e('Email') ?></label>
    495507        <input type="text" name="newcomment_author_email" size="50" value="" id="author-email" />
    496508        </div>
     
    743755 *
    744756 * @since 0.71
    745  *
    746  * @global WP_Locale $wp_locale
    747  * @global object    $comment
     757 * @since 4.4.0 Converted to use get_comment() instead of the global `$comment`.
     758 *
     759 * @global WP_Locale  $wp_locale
    748760 *
    749761 * @param int|bool $edit      Accepts 1|true for editing the date, 0|false for adding the date.
     
    754766 */
    755767function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
    756     global $wp_locale, $comment;
     768    global $wp_locale;
    757769    $post = get_post();
    758770
     
    768780
    769781    $time_adj = current_time('timestamp');
    770     $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
     782    $post_date = ($for_post) ? $post->post_date : get_comment()->comment_date;
    771783    $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
    772784    $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
     
    849861 *
    850862 * @since 1.5.0
     863 * @since 4.4.0 `$post` argument was added.
    851864 *
    852865 * @global wpdb $wpdb
    853866 *
    854  * @param int $default Optional. The default page ID to be pre-selected. Default 0.
    855  * @param int $parent  Optional. The parent page ID. Default 0.
    856  * @param int $level   Optional. Page depth level. Default 0.
     867 * @param int         $default Optional. The default page ID to be pre-selected. Default 0.
     868 * @param int         $parent  Optional. The parent page ID. Default 0.
     869 * @param int         $level   Optional. Page depth level. Default 0.
     870 * @param int|WP_Post $post    Post ID or WP_Post object.
    857871 *
    858872 * @return null|false Boolean False if page has no children, otherwise print out html elements
    859873 */
    860 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
     874function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) {
    861875    global $wpdb;
    862     $post = get_post();
     876    $post = get_post( $post );
    863877    $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
    864878
     
    10841098                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
    10851099                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
    1086                     if ( 'dashboard_browser_nag' != $box['id'] )
    1087                         echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
     1100                    if ( 'dashboard_browser_nag' != $box['id'] ) {
     1101                        echo '<button class="handlediv button-link" title="' . esc_attr__( 'Click to toggle' ) . '" aria-expanded="true">';
     1102                        echo '<span class="screen-reader-text">' . sprintf( __( 'Click to toggle %s panel' ), $box['title'] ) . '</span><br />';
     1103                        echo '</button>';
     1104                    }
    10881105                    echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
    10891106                    echo '<div class="inside">' . "\n";
Note: See TracChangeset for help on using the changeset viewer.