Changeset 24598
- Timestamp:
- 07/09/2013 05:22:50 AM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r24560 r24598 161 161 * @param string $more_link_text Optional. Content for when there is more text. 162 162 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 163 * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. 164 */ 165 function the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { 166 $post = get_post( $id ); 167 168 /* 169 * Filter: the_content 170 * 171 * param string Post content as returned by get_the_content() 172 * param int The ID of the post to which the content belongs. This was introduced 173 * in 3.6.0 and is not reliably passed by all plugins and themes that 174 * directly apply the_content. As such, it is not considered portable. 175 */ 176 $content = apply_filters( 'the_content', get_the_content( $more_link_text, $strip_teaser, $post->ID ), $post->ID ); 177 echo str_replace( ']]>', ']]>', $content ); 163 */ 164 function the_content( $more_link_text = null, $strip_teaser = false) { 165 $content = get_the_content( $more_link_text, $strip_teaser ); 166 $content = apply_filters( 'the_content', $content ); 167 $content = str_replace( ']]>', ']]>', $content ); 168 echo $content; 178 169 } 179 170 … … 185 176 * @param string $more_link_text Optional. Content for when there is more text. 186 177 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. 187 * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise.188 178 * @return string 189 179 */ 190 function get_the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { 191 global $page, $more, $preview; 192 193 $post = get_post( $id ); 194 // Avoid parsing again if the post is the same one parsed by setup_postdata(). 195 // The extract() will set up $pages and $multipage. 196 if ( $post->ID != get_post()->ID ) 197 extract( wp_parse_post_content( $post, false ) ); 198 else 199 global $pages, $multipage; 180 function get_the_content( $more_link_text = null, $strip_teaser = false ) { 181 global $page, $more, $preview, $pages, $multipage; 182 183 $post = get_post(); 200 184 201 185 if ( null === $more_link_text ) -
trunk/wp-includes/post.php
r24490 r24598 4971 4971 } 4972 4972 } 4973 4974 /**4975 * Parse post content for pagination4976 *4977 * @since 3.6.04978 *4979 * @uses paginate_content()4980 *4981 * @param object $post The post object.4982 * @return array An array of values used for paginating the parsed content.4983 */4984 function wp_parse_post_content( $post ) {4985 $numpages = 1;4986 4987 if ( strpos( $post->post_content, '<!--nextpage-->' ) ) {4988 $multipage = 1;4989 $pages = paginate_content( $post->post_content );4990 $numpages = count( $pages );4991 } else {4992 $pages = array( $post->post_content );4993 $multipage = 0;4994 }4995 4996 return compact( 'multipage', 'pages', 'numpages' );4997 } -
trunk/wp-includes/query.php
r24593 r24598 3630 3630 endif; 3631 3631 } 3632 /**3633 * Split the passed content by <!--nextpage-->3634 *3635 * @since 3.6.03636 *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 $page3649 *3650 * @since 3.6.03651 *3652 * @param string $content3653 * @param int $paged3654 * @return string3655 */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 }3678 3632 3679 3633 /** … … 3696 3650 $currentmonth = mysql2date('m', $post->post_date, false); 3697 3651 $numpages = 1; 3652 $multipage = 0; 3698 3653 $page = get_query_var('page'); 3699 3654 if ( ! $page ) … … 3701 3656 if ( is_single() || is_page() || is_feed() ) 3702 3657 $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 ) 3707 3661 $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 } 3708 3672 3709 3673 do_action_ref_array('the_post', array(&$post));
Note: See TracChangeset
for help on using the changeset viewer.