<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[24598] trunk/wp-includes: 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().</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/24598">24598</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-07-09 05:22:50 +0000 (Tue, 09 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>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 <a href="http://core.trac.wordpress.org/ticket/24330">#24330</a>, <a href="http://core.trac.wordpress.org/changeset/24301">[24301]</a>. see <a href="http://core.trac.wordpress.org/ticket/23625">#23625</a>, <a href="http://core.trac.wordpress.org/changeset/23804">[23804]</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesposttemplatephp">trunk/wp-includes/post-template.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesqueryphp">trunk/wp-includes/query.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesposttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post-template.php (24597 => 24598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post-template.php      2013-07-09 02:22:57 UTC (rev 24597)
+++ trunk/wp-includes/post-template.php 2013-07-09 05:22:50 UTC (rev 24598)
</span><span class="lines">@@ -160,21 +160,12 @@
</span><span class="cx">  *
</span><span class="cx">  * @param string $more_link_text Optional. Content for when there is more text.
</span><span class="cx">  * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
</span><del>- * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise.
</del><span class="cx">  */
</span><del>-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( ']]>', ']]&gt;', $content );
</del><ins>+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( ']]>', ']]&gt;', $content );
+       echo $content;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -184,19 +175,12 @@
</span><span class="cx">  *
</span><span class="cx">  * @param string $more_link_text Optional. Content for when there is more text.
</span><span class="cx">  * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
</span><del>- * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise.
</del><span class="cx">  * @return string
</span><span class="cx">  */
</span><del>-function get_the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) {
-       global $page, $more, $preview;
</del><ins>+function get_the_content( $more_link_text = null, $strip_teaser = false ) {
+       global $page, $more, $preview, $pages, $multipage;
</ins><span class="cx"> 
</span><del>-       $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;
</del><ins>+        $post = get_post();
</ins><span class="cx"> 
</span><span class="cx">  if ( null === $more_link_text )
</span><span class="cx">          $more_link_text = __( '(more&hellip;)' );
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (24597 => 24598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php       2013-07-09 02:22:57 UTC (rev 24597)
+++ trunk/wp-includes/post.php  2013-07-09 05:22:50 UTC (rev 24598)
</span><span class="lines">@@ -4970,28 +4970,3 @@
</span><span class="cx">          update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
</span><span class="cx">  }
</span><span class="cx"> }
</span><del>-
-/**
- * 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, '<!--nextpage-->' ) ) {
-               $multipage = 1;
-               $pages = paginate_content( $post->post_content );
-               $numpages = count( $pages );
-       } else {
-               $pages = array( $post->post_content );
-               $multipage = 0;
-       }
-
-       return compact( 'multipage', 'pages', 'numpages' );
-}
</del></span></pre></div>
<a id="trunkwpincludesqueryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/query.php (24597 => 24598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/query.php      2013-07-09 02:22:57 UTC (rev 24597)
+++ trunk/wp-includes/query.php 2013-07-09 05:22:50 UTC (rev 24598)
</span><span class="lines">@@ -3629,54 +3629,8 @@
</span><span class="cx">          exit;
</span><span class="cx">  endif;
</span><span class="cx"> }
</span><del>-/**
- * 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 );
-}
</del><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * 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 );
-}
-
-/**
</del><span class="cx">  * Set up global post data.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><span class="lines">@@ -3695,16 +3649,26 @@
</span><span class="cx">  $currentday = mysql2date('d.m.y', $post->post_date, false);
</span><span class="cx">  $currentmonth = mysql2date('m', $post->post_date, false);
</span><span class="cx">  $numpages = 1;
</span><ins>+       $multipage = 0;
</ins><span class="cx">   $page = get_query_var('page');
</span><span class="cx">  if ( ! $page )
</span><span class="cx">          $page = 1;
</span><span class="cx">  if ( is_single() || is_page() || is_feed() )
</span><span class="cx">          $more = 1;
</span><del>-
-       extract( wp_parse_post_content( $post, false ) );
-
-       if ( $multipage && ( $page > 1 ) )
</del><ins>+        $content = $post->post_content;
+       if ( strpos( $content, '<!--nextpage-->' ) ) {
+               if ( $page > 1 )
</ins><span class="cx">                   $more = 1;
</span><ins>+               $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 );
+       }
</ins><span class="cx"> 
</span><span class="cx">  do_action_ref_array('the_post', array(&$post));
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>