Changeset 24301 for trunk/wp-includes/post.php
- Timestamp:
- 05/20/2013 11:05:50 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.