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].



git-svn-id: https://develop.svn.wordpress.org/trunk@24598 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-07-09 05:22:50 +00:00
parent 7f0bd4bbd6
commit 65bf560b9d
3 changed files with 22 additions and 99 deletions

View File

@@ -3629,52 +3629,6 @@ function wp_old_slug_redirect() {
exit;
endif;
}
/**
* Split the passed content by <!--nextpage-->
*
* @since 3.6.0
*
* @param string $content Content to split.
* @return array Paged content.
*/
function paginate_content( $content ) {
$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
return explode( '<!--nextpage-->', $content );
}
/**
* Return content offset by $page
*
* @since 3.6.0
*
* @param string $content
* @param int $paged
* @return string
*/
function get_paged_content( $content = '', $paged = 0 ) {
global $page;
if ( empty( $page ) )
$page = 1;
if ( empty( $paged ) )
$paged = $page;
if ( empty( $content ) ) {
$post = get_post();
if ( empty( $post ) )
return '';
$content = $post->post_content;
}
$pages = paginate_content( $content );
if ( isset( $pages[$paged - 1] ) )
return $pages[$paged - 1];
return reset( $pages );
}
/**
* Set up global post data.
@@ -3695,16 +3649,26 @@ function setup_postdata( $post ) {
$currentday = mysql2date('d.m.y', $post->post_date, false);
$currentmonth = mysql2date('m', $post->post_date, false);
$numpages = 1;
$multipage = 0;
$page = get_query_var('page');
if ( ! $page )
$page = 1;
if ( is_single() || is_page() || is_feed() )
$more = 1;
extract( wp_parse_post_content( $post, false ) );
if ( $multipage && ( $page > 1 ) )
$content = $post->post_content;
if ( strpos( $content, '<!--nextpage-->' ) ) {
if ( $page > 1 )
$more = 1;
$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
$pages = explode('<!--nextpage-->', $content);
$numpages = count($pages);
if ( $numpages > 1 )
$multipage = 1;
} else {
$pages = array( $post->post_content );
}
do_action_ref_array('the_post', array(&$post));