mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 22:24:36 +00:00
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:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user