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-includes/post.php

    r47066 r47122  
    88
    99//
    10 // Post Type Registration
     10// Post Type registration.
    1111//
    1212
     
    716716 */
    717717function get_extended( $post ) {
    718     //Match the new style more links.
     718    // Match the new style more links.
    719719    if ( preg_match( '/<!--more(.*?)?-->/', $post, $matches ) ) {
    720720        list($main, $extended) = explode( $matches[0], $post, 2 );
     
    726726    }
    727727
    728     //  leading and trailing whitespace.
     728    // Leading and trailing whitespace.
    729729    $main      = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $main );
    730730    $extended  = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $extended );
     
    14171417    }
    14181418
    1419     // Sanitize post type name
     1419    // Sanitize post type name.
    14201420    $post_type = sanitize_key( $post_type );
    14211421
     
    15591559
    15601560    $default_capabilities = array(
    1561         // Meta capabilities
     1561        // Meta capabilities.
    15621562        'edit_post'          => 'edit_' . $singular_base,
    15631563        'read_post'          => 'read_' . $singular_base,
     
    20342034    if ( ! empty( $parsed_args['include'] ) ) {
    20352035        $incposts                      = wp_parse_id_list( $parsed_args['include'] );
    2036         $parsed_args['posts_per_page'] = count( $incposts );  // only the number of posts included
     2036        $parsed_args['posts_per_page'] = count( $incposts );  // Only the number of posts included.
    20372037        $parsed_args['post__in']       = $incposts;
    20382038    } elseif ( ! empty( $parsed_args['exclude'] ) ) {
     
    20492049
    20502050//
    2051 // Post meta functions
     2051// Post meta functions.
    20522052//
    20532053
     
    27142714 */
    27152715function get_post_mime_types() {
    2716     $post_mime_types = array(   //  array( adj, noun )
     2716    $post_mime_types = array(   // array( adj, noun )
    27172717        'image'       => array(
    27182718            __( 'Images' ),
     
    42754275    // Uh oh, someone jumped the gun!
    42764276    if ( $time > time() ) {
    4277         wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system
     4277        wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // Clear anything else in the system.
    42784278        wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
    42794279        return;
     
    48334833
    48344834//
    4835 // Page functions
     4835// Page functions.
    48364836//
    48374837
     
    52675267    $inclusions = '';
    52685268    if ( ! empty( $parsed_args['include'] ) ) {
    5269         $child_of     = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
     5269        $child_of     = 0; // Ignore child_of, parent, exclude, meta_key, and meta_value params if using include.
    52705270        $parent       = -1;
    52715271        $exclude      = '';
     
    52935293        if ( ! empty( $post_authors ) ) {
    52945294            foreach ( $post_authors as $post_author ) {
    5295                 //Do we have an author id or an author login?
     5295                // Do we have an author id or an author login?
    52965296                if ( 0 == intval( $post_author ) ) {
    52975297                    $post_author = get_user_by( 'login', $post_author );
     
    53225322        $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
    53235323
    5324         // meta_key and meta_value might be slashed
     5324        // meta_key and meta_value might be slashed.
    53255325        $meta_key   = wp_unslash( $meta_key );
    53265326        $meta_value = wp_unslash( $meta_value );
     
    54625462    wp_cache_set( $cache_key, $page_structure, 'posts' );
    54635463
    5464     // Convert to WP_Post instances
     5464    // Convert to WP_Post instances.
    54655465    $pages = array_map( 'get_post', $pages );
    54665466
     
    54775477
    54785478//
    5479 // Attachment functions
     5479// Attachment functions.
    54805480//
    54815481
     
    58345834                $url = str_replace( $uploads['basedir'], $uploads['baseurl'], $file );
    58355835            } elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) {
    5836                 // Get the directory name relative to the basedir (back compat for pre-2.7 uploads)
     5836                // Get the directory name relative to the basedir (back compat for pre-2.7 uploads).
    58375837                $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . wp_basename( $file );
    58385838            } else {
     
    63546354                } elseif ( $id == (int) $post_author ) {
    63556355                    $post_status_sql .= " OR post_status = 'private'";
    6356                 } // else none
    6357             } // else none
     6356                } // Else none.
     6357            } // Else none.
    63586358        }
    63596359
     
    67136713
    67146714//
    6715 // Hooks
     6715// Hooks.
    67166716//
    67176717
     
    68756875    $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent );
    68766876    if ( ! $loop ) {
    6877         return $post_parent; // No loop
     6877        return $post_parent; // No loop.
    68786878    }
    68796879
Note: See TracChangeset for help on using the changeset viewer.