Changeset 2341
- Timestamp:
- 02/15/2005 12:21:21 AM (20 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-filters.php
r2240 r2341 72 72 add_filter('the_excerpt', 'wpautop'); 73 73 74 add_filter('get_the_excerpt', 'wp_trim_excerpt'); 75 74 76 add_filter('sanitize_title', 'sanitize_title_with_dashes'); 75 77 -
trunk/wp-includes/functions-formatting.php
r2246 r2341 643 643 } 644 644 645 function wp_trim_excerpt( $text ) { // Fakes an excerpt if needed 646 global $post; 647 if ( '' == $text ) { 648 $text = $post->post_content; 649 $text = strip_tags( $text ); 650 $blah = explode(' ', $text); 651 $excerpt_length = 55; 652 if (count($blah) > $excerpt_length) { 653 $k = $excerpt_length; 654 $use_dotdotdot = 1; 655 } else { 656 $k = count($blah); 657 $use_dotdotdot = 0; 658 } 659 $excerpt = ''; 660 for ($i=0; $i<$k; $i++) { 661 $excerpt .= $blah[$i].' '; 662 } 663 $excerpt .= ($use_dotdotdot) ? '[...]' : ''; 664 $text = $excerpt; 665 } // end if no excerpt 666 return $text; 667 } 668 645 669 ?> -
trunk/wp-includes/template-functions-post.php
r2330 r2341 105 105 106 106 function the_excerpt() { 107 107 echo apply_filters('the_excerpt', get_the_excerpt()); 108 108 } 109 109 110 110 function get_the_excerpt($fakeit = true) { 111 global $id, $post; 112 $output = ''; 113 $output = $post->post_excerpt; 114 if (!empty($post->post_password)) { // if there's a password 115 if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 116 $output = __('There is no excerpt because this is a protected post.'); 117 return $output; 118 } 119 } 120 121 // If we haven't got an excerpt, make one in the style of the rss ones 122 if (($output == '') && $fakeit) { 123 $output = $post->post_content; 124 $output = strip_tags($output); 125 $blah = explode(' ', $output); 126 $excerpt_length = 70; 127 if (count($blah) > $excerpt_length) { 128 $k = $excerpt_length; 129 $use_dotdotdot = 1; 130 } else { 131 $k = count($blah); 132 $use_dotdotdot = 0; 133 } 134 $excerpt = ''; 135 for ($i=0; $i<$k; $i++) { 136 $excerpt .= $blah[$i].' '; 137 } 138 $excerpt .= ($use_dotdotdot) ? '...' : ''; 139 $output = $excerpt; 140 } // end if no excerpt 141 return $output; 111 global $id, $post; 112 $output = ''; 113 $output = $post->post_excerpt; 114 if (!empty($post->post_password)) { // if there's a password 115 if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 116 $output = __('There is no excerpt because this is a protected post.'); 117 return $output; 118 } 119 } 120 121 return apply_filters('get_the_excerpt', $output); 142 122 } 143 123
Note: See TracChangeset
for help on using the changeset viewer.