diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index e6466f3c2e..f3d220fec6 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -160,21 +160,12 @@ function get_the_guid( $id = 0 ) { * * @param string $more_link_text Optional. Content for when there is more text. * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. - * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. */ -function the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { - $post = get_post( $id ); - - /* - * Filter: the_content - * - * param string Post content as returned by get_the_content() - * param int The ID of the post to which the content belongs. This was introduced - * in 3.6.0 and is not reliably passed by all plugins and themes that - * directly apply the_content. As such, it is not considered portable. - */ - $content = apply_filters( 'the_content', get_the_content( $more_link_text, $strip_teaser, $post->ID ), $post->ID ); - echo str_replace( ']]>', ']]>', $content ); +function the_content( $more_link_text = null, $strip_teaser = false) { + $content = get_the_content( $more_link_text, $strip_teaser ); + $content = apply_filters( 'the_content', $content ); + $content = str_replace( ']]>', ']]>', $content ); + echo $content; } /** @@ -184,19 +175,12 @@ function the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { * * @param string $more_link_text Optional. Content for when there is more text. * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. - * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. * @return string */ -function get_the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { - global $page, $more, $preview; +function get_the_content( $more_link_text = null, $strip_teaser = false ) { + global $page, $more, $preview, $pages, $multipage; - $post = get_post( $id ); - // Avoid parsing again if the post is the same one parsed by setup_postdata(). - // The extract() will set up $pages and $multipage. - if ( $post->ID != get_post()->ID ) - extract( wp_parse_post_content( $post, false ) ); - else - global $pages, $multipage; + $post = get_post(); if ( null === $more_link_text ) $more_link_text = __( '(more…)' ); diff --git a/wp-includes/post.php b/wp-includes/post.php index 8071f8d84b..47a5ae0873 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -4970,28 +4970,3 @@ function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache ); } } - -/** - * Parse post content for pagination - * - * @since 3.6.0 - * - * @uses paginate_content() - * - * @param object $post The post object. - * @return array An array of values used for paginating the parsed content. - */ -function wp_parse_post_content( $post ) { - $numpages = 1; - - if ( strpos( $post->post_content, '' ) ) { - $multipage = 1; - $pages = paginate_content( $post->post_content ); - $numpages = count( $pages ); - } else { - $pages = array( $post->post_content ); - $multipage = 0; - } - - return compact( 'multipage', 'pages', 'numpages' ); -} diff --git a/wp-includes/query.php b/wp-includes/query.php index c17dd5eb9e..fd93c525bd 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -3629,52 +3629,6 @@ function wp_old_slug_redirect() { exit; endif; } -/** - * Split the passed content by - * - * @since 3.6.0 - * - * @param string $content Content to split. - * @return array Paged content. - */ -function paginate_content( $content ) { - $content = str_replace( "\n\n", '', $content ); - $content = str_replace( "\n", '', $content ); - $content = str_replace( "\n", '', $content ); - return explode( '', $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, '' ) ) { + if ( $page > 1 ) $more = 1; + $content = str_replace( "\n\n", '', $content ); + $content = str_replace( "\n", '', $content ); + $content = str_replace( "\n", '', $content ); + $pages = explode('', $content); + $numpages = count($pages); + if ( $numpages > 1 ) + $multipage = 1; + } else { + $pages = array( $post->post_content ); + } do_action_ref_array('the_post', array(&$post));