Changeset 23819 for trunk/wp-includes/post-formats.php
- Timestamp:
- 03/27/2013 06:34:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-formats.php
r23804 r23819 679 679 echo esc_url( get_the_url() ); 680 680 } 681 682 /** 683 * Retrieve the post content, minus the extracted post format content 684 * 685 * @since 3.6.0 686 * 687 * @internal there is a lot of code that could be abstracted from get_the_content() 688 * 689 * @param string $more_link_text Optional. Content for when there is more text. 690 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 691 * @return string 692 */ 693 function get_the_extra_content( $more_link_text = null, $strip_teaser = false ) { 694 global $more, $page, $format_pages, $multipage, $preview; 695 696 $post = get_post(); 697 698 if ( null === $more_link_text ) 699 $more_link_text = __( '(more...)' ); 700 701 $output = ''; 702 $has_teaser = false; 703 $matches = array(); 704 705 // If post password required and it doesn't match the cookie. 706 if ( post_password_required() ) 707 return get_the_password_form(); 708 709 if ( $page > count( $format_pages ) ) // if the requested page doesn't exist 710 $page = count( $format_pages ); // give them the highest numbered page that DOES exist 711 712 $content = $format_pages[$page-1]; 713 if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { 714 $content = explode( $matches[0], $content, 2 ); 715 if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) 716 $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) ); 717 718 $has_teaser = true; 719 } else { 720 $content = array( $content ); 721 } 722 723 if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) ) 724 $strip_teaser = true; 725 726 $teaser = $content[0]; 727 728 if ( $more && $strip_teaser && $has_teaser ) 729 $teaser = ''; 730 731 $output .= $teaser; 732 733 if ( count( $content ) > 1 ) { 734 if ( $more ) { 735 $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1]; 736 } else { 737 if ( ! empty( $more_link_text ) ) 738 $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text ); 739 740 $output = force_balance_tags( $output ); 741 } 742 } 743 744 if ( $preview ) // preview fix for javascript bug with foreign languages 745 $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output ); 746 747 return $output; 748 } 749 750 /** 751 * Display the post content minus the parsed post format data. 752 * 753 * @since 3.6.0 754 * 755 * @param string $more_link_text Optional. Content for when there is more text. 756 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 757 */ 758 function the_extra_content( $more_link_text = null, $strip_teaser = false ) { 759 $extra = get_the_extra_content( $more_link_text, $strip_teaser ); 760 761 remove_filter( 'the_content', 'post_formats_compat', 7 ); 762 $content = apply_filters( 'the_content', $extra ); 763 add_filter( 'the_content', 'post_formats_compat', 7 ); 764 765 echo str_replace( ']]>', ']]>', $content ); 766 }
Note: See TracChangeset
for help on using the changeset viewer.