Ticket #23572: 23572-html.10.diff
File 23572-html.10.diff, 23.4 KB (added by , 12 years ago) |
---|
-
wp-includes/media.php
diff --git wp-includes/media.php wp-includes/media.php index 60677ba..b1e08fc 100644
function wp_audio_shortcode( $attr ) { 887 887 } 888 888 889 889 $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ); 890 if ( 'mediaelement' === $library ) {890 if ( 'mediaelement' === $library && did_action( 'init' ) ) { 891 891 wp_enqueue_style( 'wp-mediaelement' ); 892 892 wp_enqueue_script( 'wp-mediaelement' ); 893 893 } … … function wp_video_shortcode( $attr ) { 994 994 } 995 995 996 996 $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' ); 997 if ( 'mediaelement' === $library ) {997 if ( 'mediaelement' === $library && did_action( 'init' ) ) { 998 998 wp_enqueue_style( 'wp-mediaelement' ); 999 999 wp_enqueue_script( 'wp-mediaelement' ); 1000 1000 } … … function get_attached_video( $post_id = 0 ) { 1828 1828 } 1829 1829 1830 1830 /** 1831 * Extract the srcs from the post's [{media type}] <source>s1831 * Extract and parse {media type} shortcodes or srcs from the passed content 1832 1832 * 1833 1833 * @since 3.6.0 1834 1834 * 1835 * @param string $type Type of media: audio or video 1835 1836 * @param string $content A string which might contain media data. 1837 * @param boolean $html Whether to return HTML or URLs 1836 1838 * @param boolean $remove Whether to remove the found URL from the passed content. 1837 * @return array A list of lists. Each item has a list of sources corresponding 1838 * to a [{media type}]'s primary src and specified fallbacks 1839 * @return array A list of parsed shortcodes or extracted srcs 1839 1840 */ 1840 function get_content_media( $type, &$content, $remove = false ) { 1841 $src = ''; 1841 function get_content_media( $type, &$content, $html = true, $remove = false ) { 1842 1842 $items = array(); 1843 1843 $matches = array(); 1844 1844 1845 1845 if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) { 1846 1846 foreach ( $matches as $shortcode ) { 1847 1847 if ( $type === $shortcode[2] ) { 1848 $srcs = array();1849 1848 $count = 1; 1850 1849 if ( $remove ) 1851 $content = str_replace( $shortcode[0], '', $content, $count ); 1852 1853 $item = do_shortcode_tag( $shortcode ); 1854 preg_match_all( '#src=[\'"](.+?)[\'"]#is', $item, $src, PREG_SET_ORDER ); 1855 if ( ! empty( $src ) ) { 1856 foreach ( $src as $s ) 1857 $srcs[] = $s[1]; 1850 $content =& str_replace( $shortcode[0], '', $content, $count ); 1858 1851 1859 $items[] = array_values( array_unique( $srcs ) ); 1860 } 1852 $items[] = do_shortcode_tag( $shortcode ); 1861 1853 } 1862 1854 } 1863 1855 } 1864 return $items; 1856 1857 if ( $html ) 1858 return $items; 1859 1860 $src = ''; 1861 $data = array(); 1862 1863 foreach ( $items as $item ) { 1864 preg_match_all( '#src=[\'"](.+?)[\'"]#is', $item, $src, PREG_SET_ORDER ); 1865 if ( ! empty( $src ) ) { 1866 $srcs = array(); 1867 foreach ( $src as $s ) 1868 $srcs[] = $s[1]; 1869 1870 $data[] = array_values( array_unique( $srcs ) ); 1871 } 1872 } 1873 1874 return $data; 1865 1875 } 1866 1876 1867 1877 /** … … function get_content_media( $type, &$content, $remove = false ) { 1870 1880 * 1871 1881 * @since 3.6.0 1872 1882 * 1883 * @param string $type Type of media: audio or video 1873 1884 * @param string $content A string which might contain media data. 1874 1885 * @param boolean $remove Whether to remove the found URL from the passed content. 1886 * @param int $limit Optional. The number of galleries to return 1875 1887 * @return array A list of found HTML media embeds and possibly a URL by itself 1876 1888 */ 1877 function get_embedded_media( $type, &$content, $remove = false ) {1889 function get_embedded_media( $type, &$content, $remove = false, $limit = 0 ) { 1878 1890 $html = array(); 1879 1891 $matches = ''; 1880 1892 … … function get_embedded_media( $type, &$content, $remove = false ) { 1884 1896 if ( $remove ) 1885 1897 $content = str_replace( $matches[0], '', $content ); 1886 1898 1887 return $html; 1899 if ( $limit > 0 && count( $html ) >= $limit ) 1900 break; 1888 1901 } 1889 1902 } 1890 1903 1904 if ( ! empty( $html ) && count( $html ) >= $limit ) 1905 return $html; 1906 1891 1907 $lines = explode( "\n", trim( $content ) ); 1892 1908 $line = trim( array_shift( $lines ) ); 1893 1894 1909 if ( 0 === stripos( $line, 'http' ) ) { 1895 1910 if ( $remove ) 1896 1911 $content = join( "\n", $lines ); … … function get_embedded_media( $type, &$content, $remove = false ) { 1901 1916 } 1902 1917 1903 1918 /** 1904 * Extract the srcs from the post's [audio] <source>s1919 * Extract the HTML or <source> srcs from the content's [audio] 1905 1920 * 1906 1921 * @since 3.6.0 1907 1922 * 1908 1923 * @param string $content A string which might contain audio data. 1924 * @param boolean $html Whether to return HTML or URLs 1909 1925 * @param boolean $remove Whether to remove the found URL from the passed content. 1910 * @return array A list of lists. Each item has a list of sources corresponding1911 * to a [audio]'sprimary src and specified fallbacks1926 * @return array A list of lists. Each item has a list of HTML or srcs corresponding 1927 * to an [audio]'s HTML or primary src and specified fallbacks 1912 1928 */ 1913 function get_content_audio( &$content, $ remove = false ) {1914 return get_content_media( 'audio', $content, $ remove );1929 function get_content_audio( &$content, $html = true, $remove = false ) { 1930 return get_content_media( 'audio', $content, $html, $remove ); 1915 1931 } 1916 1932 1917 1933 /** … … function get_embedded_audio( &$content, $remove = false ) { 1929 1945 } 1930 1946 1931 1947 /** 1932 * Extract the srcs from the post's [video] <source>s1948 * Extract the HTML or <source> srcs from the content's [video] 1933 1949 * 1934 1950 * @since 3.6.0 1935 1951 * 1936 1952 * @param string $content A string which might contain video data. 1953 * @param boolean $html Whether to return HTML or URLs 1937 1954 * @param boolean $remove Whether to remove the found URL from the passed content. 1938 * @return array A list of lists. Each item has a list of sources corresponding1939 * to a [video]'s primary src and specified fallbacks1955 * @return array A list of lists. Each item has a list of HTML or srcs corresponding 1956 * to a [video]'s HTML or primary src and specified fallbacks 1940 1957 */ 1941 function get_content_video( &$content, $ remove = false ) {1942 return get_content_media( 'video', $content, $ remove );1958 function get_content_video( &$content, $html = true, $remove = false ) { 1959 return get_content_media( 'video', $content, $html, $remove ); 1943 1960 } 1944 1961 1945 1962 /** … … function wp_video_embed( $matches, $attr, $url, $rawattr ) { 2001 2018 wp_embed_register_handler( 'wp_video_embed', '#https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')#i', apply_filters( 'wp_video_embed_handler', 'wp_video_embed' ), 9999 ); 2002 2019 2003 2020 /** 2021 * Return suitable HTML code for output based on the content related to the global $post 2022 * If found, remove the content from the @global $post's post_content field 2023 * 2024 * @since 3.6.0 2025 * 2026 * @param string $type Required. 'audio' or 'video' 2027 * @param WP_Post $post Optional. Used instead of global $post when passed. 2028 * @return string 2029 */ 2030 function get_the_media( $type, &$post = null ) { 2031 global $wp_embed; 2032 2033 if ( empty( $post ) ) 2034 $post =& get_post(); 2035 2036 if ( empty( $post ) ) 2037 return ''; 2038 2039 if ( isset( $post->format_content ) ) 2040 return $post->format_content; 2041 2042 $count = 1; 2043 2044 if ( has_post_format( $type ) ) { 2045 $meta = get_post_format_meta( $post->ID ); 2046 if ( ! empty( $meta['media'] ) ) { 2047 if ( is_numeric( $meta['media'] ) ) { 2048 $url = wp_get_attachment_url( $meta['media'] ); 2049 $shortcode = sprintf( '[%s src="%s"]', $type, $url ); 2050 } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $meta['media'] ) ) { 2051 $shortcode = $meta['media']; 2052 } elseif ( preg_match( '#<[^>]+>#', $meta['media'] ) ) { 2053 $post->format_content = $meta['media']; 2054 return $post->format_content; 2055 } elseif ( 0 === strpos( $meta['media'], 'http' ) ) { 2056 $post->split_content = str_replace( $meta['media'], '', $post->post_content, $count ); 2057 if ( strstr( $meta['media'], home_url() ) ) { 2058 $shortcode = sprintf( '[%s src="%s"]', $type, $meta['media'] ); 2059 } else { 2060 $post->format_content = $wp_embed->autoembed( $meta['media'] ); 2061 return $post->format_content; 2062 } 2063 } 2064 2065 if ( ! empty( $shortcode ) ) { 2066 $post->format_content = do_shortcode( $shortcode ); 2067 return $post->format_content; 2068 } 2069 } 2070 } 2071 2072 $medias = call_user_func( 'get_attached_' . $type ); 2073 if ( ! empty( $medias ) ) { 2074 $media = reset( $medias ); 2075 $url = wp_get_attachment_url( $media->ID ); 2076 $shortcode = sprintf( '[%s src="%s"]', $type, $url ); 2077 $post->format_content = do_shortcode( $shortcode ); 2078 return $post->format_content; 2079 } 2080 2081 // these functions expected a reference, not a value 2082 $_content = $post->post_content; 2083 $content =& $_content; 2084 2085 $htmls = get_content_media( $type, $content, true, true ); 2086 if ( ! empty( $htmls ) ) { 2087 $html = reset( $htmls ); 2088 $post->split_content = $content; 2089 $post->format_content = $html; 2090 return $post->format_content; 2091 } 2092 2093 $embeds = get_embedded_media( $type, $content, true, 1 ); 2094 if ( ! empty( $embeds ) ) { 2095 $embed = reset( $embeds ); 2096 $post->split_content = $content; 2097 if ( 0 === strpos( $embed, 'http' ) ) { 2098 if ( strstr( $embed, home_url() ) ) { 2099 $post->format_content = do_shortcode( sprintf( '[%s src="%s"]', $type, $embed ) ); 2100 } else { 2101 $post->format_content = $wp_embed->autoembed( $embed ); 2102 } 2103 } else { 2104 $post->format_content = $embed; 2105 } 2106 return $post->format_content; 2107 } 2108 2109 return ''; 2110 } 2111 2112 /** 2113 * Output the first video in the current (@global) post's content 2114 * 2115 * @since 3.6.0 2116 * 2117 */ 2118 function the_video() { 2119 echo get_the_media( 'video' ); 2120 } 2121 /** 2122 * Output the first audio in the current (@global) post's content 2123 * 2124 * @since 3.6.0 2125 * 2126 */ 2127 function the_audio() { 2128 echo get_the_media( 'audio' ); 2129 } 2130 2131 /** 2004 2132 * Retrieve images attached to the passed post 2005 2133 * 2006 2134 * @since 3.6.0 … … function get_attached_image_srcs( $post_id = 0 ) { 2033 2161 } 2034 2162 2035 2163 /** 2036 * Check the content blob for image srcs2164 * Check the content blob for images or image srcs 2037 2165 * 2038 2166 * @since 3.6.0 2039 2167 * 2040 2168 * @param string $content A string which might contain image data. 2169 * @param boolean $html Whether to return HTML or URLs 2041 2170 * @param boolean $remove Whether to remove the found data from the passed content. 2042 2171 * @param int $limit Optional. The number of image srcs to return 2043 * @return array The found image srcs2172 * @return array The found images or srcs 2044 2173 */ 2045 function get_content_images( &$content, $remove = false, $limit = 0 ) { 2046 $src = ''; 2047 $srcs = array(); 2174 function get_content_images( &$content, $html = true, $remove = false, $limit = 0 ) { 2048 2175 $matches = array(); 2176 $tags = array(); 2177 $captions = array(); 2049 2178 2050 2179 if ( $remove && preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) { 2051 $captions = array();2052 2180 foreach ( $matches as $shortcode ) { 2053 2181 if ( 'caption' === $shortcode[2] ) 2054 2182 $captions[] = $shortcode[0]; … … function get_content_images( &$content, $remove = false, $limit = 0 ) { 2068 2196 $content = str_replace( $tag[0], '', $content, $count ); 2069 2197 } 2070 2198 2071 preg_match( '#src=[\'"](.+?)[\'"]#is', $tag[0], $src ); 2072 if ( ! empty( $src[1] ) ) { 2073 $srcs[] = $src[1]; 2074 if ( $limit > 0 && count( $srcs ) >= $limit ) 2075 break; 2076 } 2199 $tags[] = $tag[0]; 2200 2201 if ( $limit > 0 && count( $tags ) >= $limit ) 2202 break; 2203 } 2204 } 2205 2206 if ( $html ) 2207 return $tags; 2208 2209 $src = ''; 2210 $srcs = array(); 2211 2212 foreach ( $tags as $tag ) { 2213 preg_match( '#src=[\'"](.+?)[\'"]#is', $tag, $src ); 2214 if ( ! empty( $src[1] ) ) { 2215 $srcs[] = $src[1]; 2216 if ( $limit > 0 && count( $srcs ) >= $limit ) 2217 break; 2077 2218 } 2078 2219 } 2079 2220 … … function get_content_images( &$content, $remove = false, $limit = 0 ) { 2081 2222 } 2082 2223 2083 2224 /** 2084 * Check the content blob for image srcs and return the first2225 * Check the content blob for images or srcs and return the first 2085 2226 * 2086 2227 * @since 3.6.0 2087 2228 * 2088 2229 * @param string $content A string which might contain image data. 2230 * @param boolean $html Whether to return HTML or URLs 2089 2231 * @param boolean $remove Whether to remove the found data from the passed content. 2090 2232 * @return string The found data 2091 2233 */ 2092 function get_content_image( &$content, $ remove = false ) {2093 $srcs = get_content_images( $content, $ remove, 1 );2234 function get_content_image( &$content, $html = true, $remove = false ) { 2235 $srcs = get_content_images( $content, $html, $remove, 1 ); 2094 2236 if ( empty( $srcs ) ) 2095 2237 return ''; 2096 2238 … … function get_post_gallery_images( $post_id = 0 ) { 2205 2347 return array(); 2206 2348 2207 2349 return $gallery['src']; 2350 } 2351 2352 /** 2353 * Return the first image in the current (@global) post's content 2354 * 2355 * @since 3.6.0 2356 * 2357 * @param string $attached_size If an attached image is found, the size to display it. 2358 * @param WP_Post $post Optional. Used instead of global $post when passed. 2359 */ 2360 function get_the_image( $attached_size = 'full', &$post = null ) { 2361 if ( empty( $post ) ) 2362 $post = get_post(); 2363 2364 if ( empty( $post ) ) 2365 return ''; 2366 2367 if ( isset( $post->format_content ) ) 2368 return $post->format_content; 2369 2370 $medias = get_attached_images(); 2371 if ( ! empty( $medias ) ) { 2372 $media = reset( $medias ); 2373 $sizes = get_intermediate_image_sizes(); 2374 2375 $urls = array(); 2376 foreach ( $sizes as $size ) { 2377 $urls[] = reset( wp_get_attachment_image_src( $media->ID, $size ) ); 2378 $urls[] = get_attachment_link( $media->ID ); 2379 } 2380 2381 $count = 1; 2382 $matches = array(); 2383 $content =& $post->post_content; 2384 2385 if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) { 2386 foreach ( $matches as $shortcode ) { 2387 if ( 'caption' === $shortcode[2] ) { 2388 foreach ( $urls as $url ) { 2389 if ( strstr( $shortcode[0], $url ) ) 2390 $content = str_replace( $shortcode[0], '', $content, $count ); 2391 } 2392 } 2393 } 2394 } 2395 2396 foreach ( array( 'a', 'img' ) as $tag ) { 2397 if ( preg_match_all( '#' . get_tag_regex( $tag ) . '#', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) { 2398 foreach ( $matches as $match ) { 2399 foreach ( $urls as $url ) { 2400 if ( strstr( $match[0], $url ) ) 2401 $content = str_replace( $match[0], '', $content, $count ); 2402 } 2403 } 2404 } 2405 } 2406 2407 $post->split_content = $content; 2408 $post->format_content = wp_get_attachment_image( $media->ID, $attached_size ); 2409 return $post->format_content; 2410 } 2411 2412 $content =& $post->post_content; 2413 $htmls = get_content_images( $content, true, true, 1 ); 2414 if ( ! empty( $htmls ) ) { 2415 $html = reset( $htmls ); 2416 $post->split_content = $content; 2417 $post->format_content = $html; 2418 return $post->format_content; 2419 } 2420 } 2421 2422 /** 2423 * Output the first image in the current (@global) post's content 2424 * 2425 * @since 3.6.0 2426 * 2427 * @param string $attached_size If an attached image is found, the size to display it. 2428 */ 2429 function the_image( $attached_size = 'full' ) { 2430 echo get_the_image( $attached_size ); 2208 2431 } 2432 No newline at end of file -
wp-includes/post-formats.php
diff --git wp-includes/post-formats.php wp-includes/post-formats.php index a37eeaa..f83e08a 100644
function get_the_url( $id = 0 ) { 678 678 function the_url() { 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 } -
wp-includes/post-template.php
diff --git wp-includes/post-template.php wp-includes/post-template.php index 9df1de9..5412ce5 100644
function get_the_guid( $id = 0 ) { 159 159 * @since 0.71 160 160 * 161 161 * @param string $more_link_text Optional. Content for when there is more text. 162 * @param bool $strip teaser Optional. Strip teaser content before the more text. Default is false.162 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 163 163 */ 164 function the_content($more_link_text = null, $stripteaser = false) { 165 $content = get_the_content($more_link_text, $stripteaser); 166 $content = apply_filters('the_content', $content); 167 $content = str_replace(']]>', ']]>', $content); 168 echo $content; 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 ) ); 166 echo str_replace( ']]>', ']]>', $content ); 169 167 } 170 168 171 169 /** … … function the_content($more_link_text = null, $stripteaser = false) { 177 175 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. 178 176 * @return string 179 177 */ 180 function get_the_content( $more_link_text = null, $strip teaser = false ) {178 function get_the_content( $more_link_text = null, $strip_teaser = false ) { 181 179 global $more, $page, $pages, $multipage, $preview; 182 180 183 181 $post = get_post(); … … function get_the_content( $more_link_text = null, $stripteaser = false ) { 186 184 $more_link_text = __( '(more...)' ); 187 185 188 186 $output = ''; 189 $hasTeaser = false; 187 $has_teaser = false; 188 $matches = array(); 190 189 191 190 // If post password required and it doesn't match the cookie. 192 191 if ( post_password_required() ) 193 192 return get_the_password_form(); 194 193 195 if ( $page > count( $pages) ) // if the requested page doesn't exist196 $page = count( $pages); // give them the highest numbered page that DOES exist194 if ( $page > count( $pages ) ) // if the requested page doesn't exist 195 $page = count( $pages ); // give them the highest numbered page that DOES exist 197 196 198 $content = $pages[$page -1];199 if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches) ) {200 $content = explode( $matches[0], $content, 2);201 if ( ! empty($matches[1]) && !empty($more_link_text) )202 $more_link_text = strip_tags( wp_kses_no_null(trim($matches[1])));197 $content = $pages[$page - 1]; 198 if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { 199 $content = explode( $matches[0], $content, 2 ); 200 if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) 201 $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) ); 203 202 204 $has Teaser = true;203 $has_teaser = true; 205 204 } else { 206 $content = array( $content);205 $content = array( $content ); 207 206 } 208 if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) 209 $stripteaser = true; 207 208 if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) ) 209 $strip_teaser = true; 210 210 211 $teaser = $content[0]; 211 if ( $more && $stripteaser && $hasTeaser ) 212 213 if ( $more && $strip_teaser && $has_teaser ) 212 214 $teaser = ''; 215 213 216 $output .= $teaser; 214 if ( count($content) > 1 ) { 217 218 if ( count( $content ) > 1 ) { 215 219 if ( $more ) { 216 220 $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1]; 217 221 } else { 218 if ( ! empty( $more_link_text) )222 if ( ! empty( $more_link_text ) ) 219 223 $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text ); 220 $output = force_balance_tags( $output);224 $output = force_balance_tags( $output ); 221 225 } 222 223 226 } 227 224 228 if ( $preview ) // preview fix for javascript bug with foreign languages 225 $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);229 $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output ); 226 230 227 231 return $output; 228 232 } -
wp-includes/query.php
diff --git wp-includes/query.php wp-includes/query.php index 370f443..478beb9 100644
function get_paged_content( $content = null, $paged = null ) { 3677 3677 * @return bool True when finished. 3678 3678 */ 3679 3679 function setup_postdata($post) { 3680 global $id, $authordata, $currentday, $currentmonth, $page, $pages, $ multipage, $more, $numpages;3680 global $id, $authordata, $currentday, $currentmonth, $page, $pages, $format_pages, $multipage, $more, $numpages; 3681 3681 3682 3682 $id = (int) $post->ID; 3683 3683 … … function setup_postdata($post) { 3691 3691 $page = 1; 3692 3692 if ( is_single() || is_page() || is_feed() ) 3693 3693 $more = 1; 3694 $content = $post->post_content; 3694 $split_content = $content = $post->post_content; 3695 $format = get_post_format( $post ); 3696 if ( $format && in_array( $format, array( 'image', 'audio', 'video' ) ) ) { 3697 switch ( $format ) { 3698 case 'image': 3699 get_the_image( 'full', $post ); 3700 if ( isset( $post->split_content ) ) 3701 $split_content = $post->split_content; 3702 break; 3703 case 'audio': 3704 get_the_media( 'audio', $post ); 3705 if ( isset( $post->split_content ) ) 3706 $split_content = $post->split_content; 3707 break; 3708 case 'video': 3709 get_the_media( 'video', $post ); 3710 if ( isset( $post->split_content ) ) 3711 $split_content = $post->split_content; 3712 break; 3713 } 3714 } 3715 3695 3716 if ( strpos( $content, '<!--nextpage-->' ) ) { 3696 3717 if ( $page > 1 ) 3697 3718 $more = 1; 3698 3719 $multipage = 1; 3699 $content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content); 3700 $content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content); 3701 $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content); 3702 $pages = explode('<!--nextpage-->', $content); 3703 $numpages = count($pages); 3720 $pages = paginate_content( $content ); 3721 $format_pages = paginate_content( $split_content ); 3722 $numpages = count( $pages ); 3704 3723 } else { 3705 3724 $pages = array( $post->post_content ); 3725 $format_pages = array( $split_content ); 3706 3726 $multipage = 0; 3707 3727 } 3708 3728