Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r47102 r47122  
    1616
    1717//
    18 // Category Checklists
     18// Category Checklists.
    1919//
    2020
     
    166166
    167167        if ( $parsed_args['checked_ontop'] ) {
    168                 // 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)
     168                // Post-process $categories rather than adding an exclude to the get_terms() query
     169                // to keep the query the same across all posts (for any query cache).
    169170                $checked_categories = array();
    170171                $keys               = array_keys( $categories );
     
    177178                }
    178179
    179                 // Put checked cats on top
     180                // Put checked categories on top.
    180181                $output .= $walker->walk( $checked_categories, 0, $args );
    181182        }
    182         // Then the rest of them
     183        // Then the rest of them.
    183184        $output .= $walker->walk( $categories, 0, $args );
    184185
     
    266267        if ( $link_id ) {
    267268                $checked_categories = wp_get_link_cats( $link_id );
    268                 // No selected categories, strange
     269                // No selected categories, strange.
    269270                if ( ! count( $checked_categories ) ) {
    270271                        $checked_categories[] = $default;
     
    560561 */
    561562function list_meta( $meta ) {
    562         // Exit if no meta
     563        // Exit if no meta.
    563564        if ( ! $meta ) {
    564565                echo '
     
    573574        <tr><td></td></tr>
    574575        </tbody>
    575 </table>'; //TBODY needed for list-manipulation JS
     576</table>'; // TBODY needed for list-manipulation JS.
    576577                return;
    577578        }
     
    633634
    634635        $entry['meta_key']   = esc_attr( $entry['meta_key'] );
    635         $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea />
     636        $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // Using a <textarea />.
    636637        $entry['meta_id']    = (int) $entry['meta_id'];
    637638
     
    791792        }
    792793
    793         // todo: Remove this?
     794        // @todo Remove this?
    794795        // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
    795796
     
    926927        foreach ( $editable_roles as $role => $details ) {
    927928                $name = translate_user_role( $details['name'] );
    928                 // preselect specified role
     929                // Preselect specified role.
    929930                if ( $selected == $role ) {
    930931                        $r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>";
     
    10531054                        // If a core box was previously added or removed by a plugin, don't add.
    10541055                        if ( 'core' == $priority ) {
    1055                                 // If core box previously deleted, don't add
     1056                                // If core box previously deleted, don't add.
    10561057                                if ( false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) {
    10571058                                        return;
     
    10681069                                return;
    10691070                        }
    1070                         // If no priority given and id already present, use existing priority.
     1071                        // If no priority given and ID already present, use existing priority.
    10711072                        if ( empty( $priority ) ) {
    10721073                                $priority = $a_priority;
     
    10801081                                $callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args'];
    10811082                        }
    1082                         // An id can be in only one priority and one context.
     1083                        // An ID can be in only one priority and one context.
    10831084                        if ( $priority != $a_priority || $context != $a_context ) {
    10841085                                unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] );
     
    12461247        printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) );
    12471248
    1248         // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
     1249        // Grab the ones the user has manually sorted.
     1250        // Pull them out of their previous context/priority and into the one the user chose.
    12491251        $sorted = get_user_option( "meta-box-order_$page" );
    12501252        if ( ! $already_sorted && $sorted ) {
     
    21932195                        $header_image = get_header_image();
    21942196
    2195                         // Display "Header Image" if the image was ever used as a header image
     2197                        // Display "Header Image" if the image was ever used as a header image.
    21962198                        if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) {
    21972199                                $media_states[] = __( 'Header Image' );
    21982200                        }
    21992201
    2200                         // Display "Current Header Image" if the image is currently the header image
     2202                        // Display "Current Header Image" if the image is currently the header image.
    22012203                        if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) {
    22022204                                $media_states[] = __( 'Current Header Image' );
     
    23792381        $text = $text ? $text : __( 'Save Changes' );
    23802382
    2381         // Default the id attribute to $name unless an id was specifically provided in $other_attributes
     2383        // Default the id attribute to $name unless an id was specifically provided in $other_attributes.
    23822384        $id = $name;
    23832385        if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
     
    23892391        if ( is_array( $other_attributes ) ) {
    23902392                foreach ( $other_attributes as $attribute => $value ) {
    2391                         $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
    2392                 }
    2393         } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string
     2393                        $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important.
     2394                }
     2395        } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string.
    23942396                $attributes = $other_attributes;
    23952397        }
     
    25342536        $parsed_args = wp_parse_args( $args, $defaults );
    25352537
    2536         // Non-English decimal places when the $rating is coming from a string
     2538        // Non-English decimal places when the $rating is coming from a string.
    25372539        $rating = (float) str_replace( ',', '.', $parsed_args['rating'] );
    25382540
    2539         // Convert Percentage to star rating, 0..5 in .5 increments
     2541        // Convert percentage to star rating, 0..5 in .5 increments.
    25402542        if ( 'percent' === $parsed_args['type'] ) {
    25412543                $rating = round( $rating / 10, 0 ) / 2;
    25422544        }
    25432545
    2544         // Calculate the number of each type of star needed
     2546        // Calculate the number of each type of star needed.
    25452547        $full_stars  = floor( $rating );
    25462548        $half_stars  = ceil( $rating - $full_stars );
Note: See TracChangeset for help on using the changeset viewer.