Changeset 23819 for trunk/wp-includes/post-template.php
- Timestamp:
- 03/27/2013 06:34:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r23769 r23819 160 160 * 161 161 * @param string $more_link_text Optional. Content for when there is more text. 162 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. 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; 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 ) ); 166 echo str_replace( ']]>', ']]>', $content ); 169 167 } 170 168 … … 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 … … 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. … … 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 exist197 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])));203 204 $has Teaser = true;194 if ( $page > count( $pages ) ) // if the requested page doesn't exist 195 $page = count( $pages ); // give them the highest numbered page that DOES exist 196 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] ) ) ); 202 203 $has_teaser = true; 205 204 } else { 206 $content = array($content); 207 } 208 if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) 209 $stripteaser = true; 205 $content = array( $content ); 206 } 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;
Note: See TracChangeset
for help on using the changeset viewer.