Make WordPress Core

Ticket #25889: 25889.2.patch

File 25889.2.patch, 4.4 KB (added by DrewAPicture, 13 years ago)

Standardized docs

  • src/wp-admin/includes/template.php

     
    615615}
    616616
    617617/**
    618  * {@internal Missing Short Description}}
     618 * Print out HTML form date elements for editing post or comment publish date.
    619619 *
    620620 * @since 0.71
    621621 *
    622  * @param unknown_type $edit
    623  * @param unknown_type $for_post
    624  * @param unknown_type $tab_index
    625  * @param unknown_type $multi
     622 * @param int|bool $edit      Accepts 1|true for editing the date, 0|false for adding the date.
     623 * @param int|bool $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
     624 * @param int|bool $tab_index The tabindex attribute to add. Default 0.
     625 * @param int|bool $multi     Optional. Whether the additional fields and buttons should be added.
     626 *                            Default 0|false.
    626627 */
    627628function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
    628629        global $wp_locale, $comment;
     
    655656        $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n";
    656657        for ( $i = 1; $i < 13; $i = $i +1 ) {
    657658                $monthnum = zeroise($i, 2);
    658                 $month .= "\t\t\t" . '<option value="' . $monthnum . '"';
    659                 if ( $i == $mm )
    660                         $month .= ' selected="selected"';
     659                $month .= "\t\t\t" . '<option value="' . $monthnum . '" ' . selected( $i, $mm, false ) . '>';
    661660                /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
    662                 $month .= '>' . sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "</option>\n";
     661                $month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "</option>\n";
    663662        }
    664663        $month .= '</select>';
    665664
     
    680679        foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {
    681680                echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
    682681                $cur_timeunit = 'cur_' . $timeunit;
    683                 echo '<input type="hidden" id="'. $cur_timeunit . '" name="'. $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";
     682                echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";
    684683        }
    685684?>
    686685
     
    692691}
    693692
    694693/**
    695  * {@internal Missing Short Description}}
     694 * Print out <option> HTML elements for the page templates drop-down.
    696695 *
    697696 * @since 1.5.0
    698697 *
    699  * @param unknown_type $default
     698 * @param string $default Optional. The template file name. Default empty.
    700699 */
    701700function page_template_dropdown( $default = '' ) {
    702701        $templates = get_page_templates();
    703702        ksort( $templates );
    704         foreach (array_keys( $templates ) as $template )
    705                 : if ( $default == $templates[$template] )
    706                         $selected = " selected='selected'";
    707                 else
    708                         $selected = '';
    709         echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
    710         endforeach;
     703        foreach ( array_keys( $templates ) as $template ) {
     704                $selected = selected( $default, $templates[ $template ], false );
     705                echo "\n\t<option value='" . $templates[ $template ] . "' $selected>$template</option>";
     706        }
    711707}
    712708
    713709/**
    714  * {@internal Missing Short Description}}
     710 * Print out <option> HTML elements for the page parents drop-down.
    715711 *
    716712 * @since 1.5.0
    717713 *
    718  * @param unknown_type $default
    719  * @param unknown_type $parent
    720  * @param unknown_type $level
    721  * @return unknown
     714 * @param int $default Optional. The default page ID to be pre-selected. Default 0.
     715 * @param int $parent  Optional. The parent page ID. Default 0.
     716 * @param int $level   Optional. Page depth level. Default 0.
     717 *
     718 * @return void|bool Boolean False if page has no children, otherwise print out html elements
    722719 */
    723720function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
    724721        global $wpdb;
     
    732729                                continue;
    733730
    734731                        $pad = str_repeat( '&nbsp;', $level * 3 );
    735                         if ( $item->ID == $default)
    736                                 $current = ' selected="selected"';
    737                         else
    738                                 $current = '';
     732                        $selected = selected( $default, $item->ID, false );
    739733
    740                         echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
     734                        echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html($item->post_title) . "</option>";
    741735                        parent_dropdown( $default, $item->ID, $level +1 );
    742736                }
    743737        } else {