Make WordPress Core


Ignore:
Timestamp:
07/09/2013 05:22:50 AM (13 years ago)
Author:
nacin
Message:

Remove wp_parse_post_content(), get_paged_content(), paginate_content() from 3.6, and remove the new $id parameters for get_the_content() and the_content().

The content parsing functions are good abstractions, but are no longer needed by core and are too closely tied to legacy globals, rather than paving a new path.

For get_the_content() and the_content(), this only worsens the function prototype. It muddies theme-specific display (more links, etc) with filtered content. apply_filters( 'the_content', $post->post_content ) is sufficient practice for now.

see #24330, [24301]. see #23625, [23804].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r24593 r24598  
    36303630    endif;
    36313631}
    3632 /**
    3633  * Split the passed content by <!--nextpage-->
    3634  *
    3635  * @since 3.6.0
    3636  *
    3637  * @param string $content Content to split.
    3638  * @return array Paged content.
    3639  */
    3640 function paginate_content( $content ) {
    3641     $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
    3642     $content = str_replace( "\n<!--nextpage-->",   '<!--nextpage-->', $content );
    3643     $content = str_replace( "<!--nextpage-->\n",   '<!--nextpage-->', $content );
    3644     return explode( '<!--nextpage-->', $content );
    3645 }
    3646 
    3647 /**
    3648  * Return content offset by $page
    3649  *
    3650  * @since 3.6.0
    3651  *
    3652  * @param string $content
    3653  * @param int $paged
    3654  * @return string
    3655  */
    3656 function get_paged_content( $content = '', $paged = 0 ) {
    3657     global $page;
    3658     if ( empty( $page ) )
    3659         $page = 1;
    3660 
    3661     if ( empty( $paged ) )
    3662         $paged = $page;
    3663 
    3664     if ( empty( $content ) ) {
    3665         $post = get_post();
    3666         if ( empty( $post ) )
    3667             return '';
    3668 
    3669         $content = $post->post_content;
    3670     }
    3671 
    3672     $pages = paginate_content( $content );
    3673     if ( isset( $pages[$paged - 1] ) )
    3674         return $pages[$paged - 1];
    3675 
    3676     return reset( $pages );
    3677 }
    36783632
    36793633/**
     
    36963650    $currentmonth = mysql2date('m', $post->post_date, false);
    36973651    $numpages = 1;
     3652    $multipage = 0;
    36983653    $page = get_query_var('page');
    36993654    if ( ! $page )
     
    37013656    if ( is_single() || is_page() || is_feed() )
    37023657        $more = 1;
    3703 
    3704     extract( wp_parse_post_content( $post, false ) );
    3705 
    3706     if ( $multipage && ( $page > 1 ) )
     3658    $content = $post->post_content;
     3659    if ( strpos( $content, '<!--nextpage-->' ) ) {
     3660        if ( $page > 1 )
    37073661            $more = 1;
     3662        $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
     3663        $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
     3664        $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
     3665        $pages = explode('<!--nextpage-->', $content);
     3666        $numpages = count($pages);
     3667        if ( $numpages > 1 )
     3668            $multipage = 1;
     3669    } else {
     3670        $pages = array( $post->post_content );
     3671    }
    37083672
    37093673    do_action_ref_array('the_post', array(&$post));
Note: See TracChangeset for help on using the changeset viewer.