Changeset 24301
- Timestamp:
- 05/20/2013 11:05:50 AM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r24275 r24301 1750 1750 1751 1751 if ( empty($post->post_excerpt) ) 1752 $excerpt = apply_filters('the_content', $post->post_content );1752 $excerpt = apply_filters('the_content', $post->post_content, $post->ID); 1753 1753 else 1754 1754 $excerpt = apply_filters('the_excerpt', $post->post_excerpt); -
trunk/wp-includes/default-filters.php
r24233 r24301 137 137 add_filter( 'the_title', '_post_formats_title', 10, 2 ); 138 138 139 add_filter( 'the_content', 'post_formats_compat', 7 );139 add_filter( 'the_content', 'post_formats_compat', 7, 2 ); 140 140 add_filter( 'the_content', 'wptexturize' ); 141 141 add_filter( 'the_content', 'convert_smilies' ); -
trunk/wp-includes/post-formats.php
r24249 r24301 867 867 * @param string $more_link_text Optional. Content for when there is more text. 868 868 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 869 * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. 869 870 * @return string The content minus the extracted post format content. 870 871 */ 871 function get_the_remaining_content( $more_link_text = null, $strip_teaser = false ) { 872 global $more, $page, $format_pages, $multipage, $preview; 873 874 $post = get_post(); 872 function get_the_remaining_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { 873 global $more, $page, $preview; 874 875 $post = get_post( $id ); 876 877 extract( wp_parse_post_content( $post, true ) ); 875 878 876 879 if ( null === $more_link_text ) … … 881 884 882 885 // If post password required and it doesn't match the cookie. 883 if ( post_password_required( ) )884 return get_the_password_form( );885 886 if ( $page > count( $ format_pages ) ) // if the requested page doesn't exist887 $page = count( $ format_pages ); // give them the highest numbered page that DOES exist888 889 $content = $ format_pages[$page-1];886 if ( post_password_required( $post ) ) 887 return get_the_password_form( $post ); 888 889 if ( $page > count( $pages ) ) // if the requested page doesn't exist 890 $page = count( $pages ); // give them the highest numbered page that DOES exist 891 892 $content = $pages[$page-1]; 890 893 if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { 891 894 $content = explode( $matches[0], $content, 2 ); … … 932 935 * @param string $more_link_text Optional. Content for when there is more text. 933 936 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 934 */ 935 function the_remaining_content( $more_link_text = null, $strip_teaser = false ) { 936 $extra = get_the_remaining_content( $more_link_text, $strip_teaser ); 937 * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. 938 */ 939 function the_remaining_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { 940 $post = get_post( $id ); 941 942 $extra = get_the_remaining_content( $more_link_text, $strip_teaser, $post->ID ); 937 943 938 944 remove_filter( 'the_content', 'post_formats_compat', 7 ); 939 $content = apply_filters( 'the_content', $extra );940 add_filter( 'the_content', 'post_formats_compat', 7 );945 $content = apply_filters( 'the_content', $extra, $post->ID ); 946 add_filter( 'the_content', 'post_formats_compat', 7, 2 ); 941 947 942 948 echo str_replace( ']]>', ']]>', $content ); -
trunk/wp-includes/post-template.php
r24207 r24301 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 */ 164 function the_content( $more_link_text = null, $strip_teaser = false ) { 165 $content = apply_filters( 'the_content', get_the_content( $more_link_text, $strip_teaser ) ); 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 ); 166 177 echo str_replace( ']]>', ']]>', $content ); 167 178 } … … 174 185 * @param string $more_link_text Optional. Content for when there is more text. 175 186 * @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. 176 188 * @return string 177 189 */ 178 function get_the_content( $more_link_text = null, $strip_teaser = false ) { 179 global $more, $page, $pages, $multipage, $preview; 180 181 $post = get_post(); 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 != $GLOBALS['id'] ) 197 extract( wp_parse_post_content( $post, false ) ); 198 else 199 global $pages, $multipage; 182 200 183 201 if ( null === $more_link_text ) … … 188 206 189 207 // If post password required and it doesn't match the cookie. 190 if ( post_password_required( ) )191 return get_the_password_form( );208 if ( post_password_required( $post ) ) 209 return get_the_password_form( $post ); 192 210 193 211 if ( $page > count( $pages ) ) // if the requested page doesn't exist … … 567 585 * @since 2.7.0 568 586 * 569 * @param int| object $post An optional post. Global $post used if not provided.587 * @param int|WP_Post $post An optional post. Global $post used if not provided. 570 588 * @return bool false if a password is not required or the correct password cookie is present, true otherwise. 571 589 */ … … 1226 1244 * @since 1.0.0 1227 1245 * @uses apply_filters() Calls 'the_password_form' filter on output. 1228 * 1246 * @param int|WP_Post $post Optional. A post id or post object. Defaults to the current post when in The Loop, undefined otherwise. 1229 1247 * @return string HTML content for password form for password protected post. 1230 1248 */ 1231 function get_the_password_form( ) {1232 $post = get_post( );1249 function get_the_password_form( $post = 0 ) { 1250 $post = get_post( $post ); 1233 1251 $label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID ); 1234 1252 $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post"> -
trunk/wp-includes/post.php
r24238 r24301 567 567 */ 568 568 public $filter; 569 570 /** 571 * Private variable used by post formats to cache parsed content. 572 * 573 * @since 3.6.0 574 * 575 * @var array 576 * @access private 577 */ 578 public $format_content; 579 580 /** 581 * Private variable used by post formats to cache parsed content. 582 * 583 * @since 3.6.0 584 * 585 * @var string 586 * @access private 587 */ 588 public $split_content; 569 589 570 590 public static function get_instance( $post_id ) { … … 4963 4983 } 4964 4984 } 4985 4986 /** 4987 * Parse post content for pagination 4988 * 4989 * @since 3.6.0 4990 * 4991 * @uses paginate_content() 4992 * 4993 * @param object $post The post object. 4994 * @param bool $remaining Whether to parse post formats from the content. Defaults to false. 4995 * @return array An array of values used for paginating the parsed content. 4996 */ 4997 function wp_parse_post_content( $post, $remaining = false ) { 4998 $numpages = 1; 4999 5000 if ( $remaining ) { 5001 $format = get_post_format( $post ); 5002 if ( $format && in_array( $format, array( 'image', 'audio', 'video', 'quote' ) ) ) { 5003 // Call get_the_post_format_*() to set $post->split_content 5004 switch ( $format ) { 5005 case 'image': 5006 get_the_post_format_image( 'full', $post ); 5007 break; 5008 case 'audio': 5009 get_the_post_format_media( 'audio', $post, 1 ); 5010 break; 5011 case 'video': 5012 get_the_post_format_media( 'video', $post, 1 ); 5013 break; 5014 case 'quote': 5015 get_the_post_format_quote( $post ); 5016 break; 5017 } 5018 } 5019 } 5020 5021 if ( strpos( $post->post_content, '<!--nextpage-->' ) ) { 5022 $multipage = 1; 5023 if ( $remaining && isset( $post->split_content ) ) 5024 $pages = paginate_content( $post->split_content ); 5025 else 5026 $pages = paginate_content( $post->post_content ); 5027 $numpages = count( $pages ); 5028 } else { 5029 if ( $remaining && isset( $post->split_content ) ) 5030 $pages = array( $post->split_content ); 5031 else 5032 $pages = array( $post->post_content ); 5033 $multipage = 0; 5034 } 5035 5036 return compact( 'multipage', 'pages', 'numpages' ); 5037 } -
trunk/wp-includes/query.php
r24115 r24301 3682 3682 * @return bool True when finished. 3683 3683 */ 3684 function setup_postdata( $post) {3685 global $id, $authordata, $currentday, $currentmonth, $page, $pages, $ format_pages, $multipage, $more, $numpages;3684 function setup_postdata( $post ) { 3685 global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; 3686 3686 3687 3687 $id = (int) $post->ID; … … 3693 3693 $numpages = 1; 3694 3694 $page = get_query_var('page'); 3695 if ( ! $page )3695 if ( ! $page ) 3696 3696 $page = 1; 3697 3697 if ( is_single() || is_page() || is_feed() ) 3698 3698 $more = 1; 3699 $split_content = $content = $post->post_content; 3700 $format = get_post_format( $post ); 3701 if ( $format && in_array( $format, array( 'image', 'audio', 'video', 'quote' ) ) ) { 3702 switch ( $format ) { 3703 case 'image': 3704 get_the_post_format_image( 'full', $post ); 3705 if ( isset( $post->split_content ) ) 3706 $split_content = $post->split_content; 3707 break; 3708 case 'audio': 3709 get_the_post_format_media( 'audio', $post, 1 ); 3710 if ( isset( $post->split_content ) ) 3711 $split_content = $post->split_content; 3712 break; 3713 case 'video': 3714 get_the_post_format_media( 'video', $post, 1 ); 3715 if ( isset( $post->split_content ) ) 3716 $split_content = $post->split_content; 3717 break; 3718 case 'quote': 3719 get_the_post_format_quote( $post ); 3720 if ( isset( $post->split_content ) ) 3721 $split_content = $post->split_content; 3722 break; 3723 } 3724 } 3725 3726 if ( strpos( $content, '<!--nextpage-->' ) ) { 3727 if ( $page > 1 ) 3699 3700 extract( wp_parse_post_content( $post, false ) ); 3701 3702 if ( $multipage && ( $page > 1 ) ) 3728 3703 $more = 1; 3729 $multipage = 1;3730 $pages = paginate_content( $content );3731 $format_pages = paginate_content( $split_content );3732 $numpages = count( $pages );3733 } else {3734 $pages = array( $post->post_content );3735 $format_pages = array( $split_content );3736 $multipage = 0;3737 }3738 3704 3739 3705 do_action_ref_array('the_post', array(&$post));
Note: See TracChangeset
for help on using the changeset viewer.