Make WordPress Core

Changeset 29097


Ignore:
Timestamp:
07/11/2014 06:34:36 PM (12 years ago)
Author:
DrewAPicture
Message:

Fix syntax for inline comment line endings and a few line wraps in wp-includes/post.php inline documentation.

Fixes #25412.

File:
1 edited

Legend:

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

    r29094 r29097  
    392392        }
    393393
    394         // ` leading and trailing whitespace
     394        //  leading and trailing whitespace.
    395395        $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
    396396        $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
    … …  
    872872                        return 'private';
    873873
    874                 // Unattached attachments are assumed to be published
     874                // Unattached attachments are assumed to be published.
    875875                if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
    876876                        return 'publish';
    877877
    878                 // Inherit status from the parent
     878                // Inherit status from the parent.
    879879                if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) {
    880880                        $parent_post_status = get_post_status( $post->post_parent );
    … …  
    13631363                $args->exclude_from_search = !$args->public;
    13641364
    1365         // Back compat with quirky handling in version 3.0. #14122
     1365        // Back compat with quirky handling in version 3.0. #14122.
    13661366        if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) )
    13671367                $args->map_meta_cap = true;
    … …  
    16971697        foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) {
    16981698                $ptype_obj = get_post_type_object( $ptype );
    1699                 // Submenus only.
     1699                // Sub-menus only.
    17001700                if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true )
    17011701                        continue;
    … …  
    19491949 */
    19501950function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) {
    1951         // make sure meta is added to the post, not a revision
     1951        // Make sure meta is added to the post, not a revision.
    19521952        if ( $the_post = wp_is_post_revision($post_id) )
    19531953                $post_id = $the_post;
    … …  
    25922592
    25932593        if ( is_post_type_hierarchical( $post->post_type ) ) {
    2594                 // Point children of this page to its parent, also clean the cache of affected children
     2594                // Point children of this page to its parent, also clean the cache of affected children.
    25952595                $children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type );
    25962596                $children = $wpdb->get_results( $children_query );
    … …  
    25992599        }
    26002600
    2601         // Do raw query. wp_get_post_revisions() is filtered
     2601        // Do raw query. wp_get_post_revisions() is filtered.
    26022602        $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) );
    26032603        // Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up.
    … …  
    26052605                wp_delete_post_revision( $revision_id );
    26062606
    2607         // Point all attachments to this post up one level
     2607        // Point all attachments to this post up one level.
    26082608        $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
    26092609
    … …  
    26752675        $post = get_post( $post_id );
    26762676        if ( 'page' == $post->post_type ) {
    2677                 // If the page is defined in option page_on_front or post_for_posts,
    2678                 // adjust the corresponding options
     2677                /*
     2678                 * If the page is defined in option page_on_front or post_for_posts,
     2679                 * adjust the corresponding options.
     2680                 */
    26792681                if ( get_option( 'page_on_front' ) == $post->ID ) {
    26802682                        update_option( 'show_on_front', 'posts' );
    … …  
    28212823                return;
    28222824
    2823         // Cache current status for each comment
     2825        // Cache current status for each comment.
    28242826        $statuses = array();
    28252827        foreach ( $comments as $comment )
    … …  
    28272829        add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses);
    28282830
    2829         // Set status for all comments to post-trashed
     2831        // Set status for all comments to post-trashed.
    28302832        $result = $wpdb->update($wpdb->comments, array('comment_approved' => 'post-trashed'), array('comment_post_ID' => $post_id));
    28312833
    … …  
    28762878        do_action( 'untrash_post_comments', $post_id );
    28772879
    2878         // Restore each comment to its original status
     2880        // Restore each comment to its original status.
    28792881        $group_by_status = array();
    28802882        foreach ( $statuses as $comment_id => $comment_status )
    … …  
    29952997        }
    29962998
    2997         // Set default arguments
     2999        // Set default arguments.
    29983000        $defaults = array(
    29993001                'numberposts' => 10, 'offset' => 0,
    … …  
    30093011        $results = get_posts( $r );
    30103012
    3011         // Backward compatibility. Prior to 3.1 expected posts to be returned in array
     3013        // Backward compatibility. Prior to 3.1 expected posts to be returned in array.
    30123014        if ( ARRAY_A == $output ){
    30133015                foreach( $results as $key => $result ) {
    … …  
    35273529function wp_update_post( $postarr = array(), $wp_error = false ) {
    35283530        if ( is_object($postarr) ) {
    3529                 // non-escaped post was passed
     3531                // Non-escaped post was passed.
    35303532                $postarr = get_object_vars($postarr);
    35313533                $postarr = wp_slash($postarr);
    … …  
    36353637        $time = strtotime( $post->post_date_gmt . ' GMT' );
    36363638
    3637         if ( $time > time() ) { // Uh oh, someone jumped the gun!
     3639        // Uh oh, someone jumped the gun!
     3640        if ( $time > time() ) {
    36383641                wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system
    36393642                wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
    … …  
    39893992        $new = apply_filters( 'add_ping', $new );
    39903993
    3991         // expected_slashed ($new)
     3994        // expected_slashed ($new).
    39923995        $new = wp_unslash($new);
    39933996        return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
    … …  
    40934096function trackback_url_list( $tb_list, $post_id ) {
    40944097        if ( ! empty( $tb_list ) ) {
    4095                 // get post data
     4098                // Get post data.
    40964099                $postdata = get_post( $post_id, ARRAY_A );
    40974100
    4098                 // form an excerpt
     4101                // Form an excerpt.
    40994102                $excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] );
    41004103
    … …  
    44324435        $post_status = $r['post_status'];
    44334436
    4434         // Make sure the post type is hierarchical
     4437        // Make sure the post type is hierarchical.
    44354438        $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
    44364439        if ( ! in_array( $r['post_type'], $hierarchical_post_types ) ) {
    … …  
    44424445        }
    44434446
    4444         // Make sure we have a valid post status
     4447        // Make sure we have a valid post status.
    44454448        if ( ! is_array( $post_status ) ) {
    44464449                $post_status = explode( ',', $post_status );
    … …  
    44504453        }
    44514454
    4452         // $args can be whatever, only use the args defined in defaults to compute the key
     4455        // $args can be whatever, only use the args defined in defaults to compute the key.
    44534456        $key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) );
    44544457        $last_changed = wp_cache_get( 'last_changed', 'posts' );
    … …  
    44604463        $cache_key = "get_pages:$key:$last_changed";
    44614464        if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
    4462                 // Convert to WP_Post instances
     4465                // Convert to WP_Post instances.
    44634466                $pages = array_map( 'get_post', $cache );
    44644467                /** This filter is documented in wp-includes/post.php */
    … …  
    46094612        }
    46104613
    4611         // Sanitize before caching so it'll only get done once
     4614        // Sanitize before caching so it'll only get done once.
    46124615        $num_pages = count($pages);
    46134616        for ($i = 0; $i < $num_pages; $i++) {
    … …  
    46464649        wp_cache_set( $cache_key, $page_structure, 'posts' );
    46474650
    4648         // Convert to WP_Post instances
     4651        // Convert to WP_Post instances.
    46494652        $pages = array_map( 'get_post', $pages );
    46504653
    … …  
    47814784        wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
    47824785
    4783         delete_metadata( 'post', null, '_thumbnail_id', $post_id, true ); // delete all for any posts.
     4786        // Delete all for any posts.
     4787        delete_metadata( 'post', null, '_thumbnail_id', $post_id, true );
    47844788
    47854789        $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
    … …  
    52735277        $sql .= "(post_status = 'publish'";
    52745278
    5275         // Only need to check the cap if $public_only is false
     5279        // Only need to check the cap if $public_only is false.
    52765280        if ( false === $public_only ) {
    52775281                if ( current_user_can( $cap ) ) {
    … …  
    55935597
    55945598        if ( $old_status != 'publish' && $new_status == 'publish' ) {
    5595                 // Reset GUID if transitioning to publish and it is empty
     5599                // Reset GUID if transitioning to publish and it is empty.
    55965600                if ( '' == get_the_guid($post->ID) )
    55975601                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
    … …  
    56085612        }
    56095613
    5610         // If published posts changed clear the lastpostmodified cache
     5614        // If published posts changed clear the lastpostmodified cache.
    56115615        if ( 'publish' == $new_status || 'publish' == $old_status) {
    56125616                foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
    … …  
    57075711 */
    57085712function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) {
    5709         // Nothing fancy here - bail
     5713        // Nothing fancy here - bail.
    57105714        if ( !$post_parent )
    57115715                return 0;
    57125716
    5713         // New post can't cause a loop
     5717        // New post can't cause a loop.
    57145718        if ( empty( $post_ID ) )
    57155719                return $post_parent;
    57165720
    5717         // Can't be its own parent
     5721        // Can't be its own parent.
    57185722        if ( $post_parent == $post_ID )
    57195723                return 0;
    57205724
    5721         // Now look for larger loops
    5722 
     5725        // Now look for larger loops.
    57235726        if ( !$loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ) )
    57245727                return $post_parent; // No loop
    57255728
    5726         // Setting $post_parent to the given value causes a loop
     5729        // Setting $post_parent to the given value causes a loop.
    57275730        if ( isset( $loop[$post_ID] ) )
    57285731                return 0;
    … …  
    57905793
    57915794/**
    5792  * Update the custom taxonomies' term counts when a post's status is changed. For example, default posts term counts (for custom taxonomies) don't include private / draft posts.
     5795 * Update the custom taxonomies' term counts when a post's status is changed.
     5796 *
     5797 * For example, default posts term counts (for custom taxonomies) don't include
     5798 * private / draft posts.
    57935799 *
    57945800 * @since 3.3.0
    … …  
    58115817 *
    58125818 * @since 3.4.0
    5813  *
    58145819 * @access private
     5820 *
     5821 * @see update_post_caches()
    58155822 *
    58165823 * @param array $post_ids          ID list
Note: See TracChangeset for help on using the changeset viewer.