Changeset 885 for trunk/wp-includes/template-functions-post.php
- Timestamp:
- 02/17/2004 04:56:29 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/template-functions-post.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-post.php
r841 r885 1 1 <?php 2 2 3 // Default filters 4 add_filter('the_title', 'convert_chars'); 5 add_filter('the_title', 'trim'); 6 7 add_filter('the_title_rss', 'strip_tags'); 8 9 add_filter('the_content', 'convert_smilies'); 10 add_filter('the_content', 'convert_chars'); 11 add_filter('the_content', 'wpautop'); 12 13 add_filter('the_excerpt', 'convert_smilies'); 14 add_filter('the_excerpt', 'autop'); 15 add_filter('the_excerpt', 'convert_chars'); 16 add_filter('the_excerpt', 'wpautop'); 3 17 4 18 function get_the_password_form() { … … 8 22 </form> 9 23 "; 10 return $output;24 return $output; 11 25 } 12 26 13 27 function the_ID() { 14 global $id;15 echo $id;28 global $id; 29 echo $id; 16 30 } 17 31 18 32 function the_title($before = '', $after = '', $echo = true) { 19 $title = get_the_title(); 20 $title = convert_smilies($title); 21 if (!empty($title)) { 22 $title = convert_chars($before.$title.$after); 23 $title = apply_filters('the_title', $title); 24 if ($echo) 25 echo $title; 26 else 27 return $title; 28 } 29 } 33 $title = get_the_title(); 34 if (!empty($title)) { 35 $title = apply_filters('the_title', $before . $title . $after); 36 if ($echo) 37 echo $title; 38 else 39 return $title; 40 } 41 } 42 30 43 function the_title_rss() { 31 $title = get_the_title(); 32 $title = strip_tags($title); 33 if (trim($title)) { 34 echo convert_chars($title, 'unicode'); 35 } 36 } 37 function the_title_unicode($before='',$after='') { 38 $title = get_the_title(); 39 $title = convert_bbcode($title); 40 $title = convert_gmcode($title); 41 if ($title) { 42 $title = convert_chars($before.$title.$after); 43 $title = apply_filters('the_title_unicode', $title); 44 echo $title; 45 } 46 } 44 $title = get_the_title(); 45 $title = apply_filters('the_title', $title); 46 $title = apply_filters('the_title_rss', $title): 47 echo $title; 48 } 49 47 50 function get_the_title() { 48 global $post;49 $output = stripslashes($post->post_title);50 if (!empty($post->post_password)) { // if there's a password51 $output = 'Protected: ' . $output;52 }53 return $output;54 } 55 56 function the_content($more_link_text ='(more...)', $stripteaser=0, $more_file='') {51 global $post; 52 $output = stripslashes($post->post_title); 53 if (!empty($post->post_password)) { // if there's a password 54 $output = 'Protected: ' . $output; 55 } 56 return $output; 57 } 58 59 function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { 57 60 $content = get_the_content($more_link_text, $stripteaser, $more_file); 58 $content = convert_bbcode($content);59 $content = convert_gmcode($content);60 $content = convert_smilies($content);61 $content = convert_chars($content, 'html');62 61 $content = apply_filters('the_content', $content); 63 62 echo $content; … … 65 64 66 65 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { 67 $content = get_the_content($more_link_text, $stripteaser, $more_file); 68 $content = convert_bbcode($content); 69 $content = convert_gmcode($content); 70 $content = convert_chars($content, 'unicode'); 71 if ($cut && !$encode_html) { 72 $encode_html = 2; 73 } 74 if ($encode_html == 1) { 75 $content = htmlspecialchars($content); 76 $cut = 0; 77 } elseif ($encode_html == 0) { 78 $content = make_url_footnote($content); 79 } elseif ($encode_html == 2) { 80 $content = strip_tags($content); 81 } 82 if ($cut) { 83 $blah = explode(' ', $content); 84 if (count($blah) > $cut) { 85 $k = $cut; 86 $use_dotdotdot = 1; 87 } else { 88 $k = count($blah); 89 $use_dotdotdot = 0; 90 } 91 for ($i=0; $i<$k; $i++) { 92 $excerpt .= $blah[$i].' '; 93 } 94 $excerpt .= ($use_dotdotdot) ? '...' : ''; 95 $content = $excerpt; 96 } 97 echo $content; 98 } 99 100 function the_content_unicode($more_link_text='(more...)', $stripteaser=0, $more_file='') { 101 $content = get_the_content($more_link_text, $stripteaser, $more_file); 102 $content = convert_bbcode($content); 103 $content = convert_gmcode($content); 104 $content = convert_smilies($content); 105 $content = convert_chars($content, 'unicode'); 106 $content = apply_filters('the_content_unicode', $content); 107 echo $content; 108 } 109 110 function get_the_content($more_link_text='(more...)', $stripteaser=0, $more_file='') { 66 $content = get_the_content($more_link_text, $stripteaser, $more_file); 67 $content = apply_filters('the_content', $content); 68 if ($cut && !$encode_html) { 69 $encode_html = 2; 70 } 71 if ($encode_html == 1) { 72 $content = htmlspecialchars($content); 73 $cut = 0; 74 } elseif ($encode_html == 0) { 75 $content = make_url_footnote($content); 76 } elseif ($encode_html == 2) { 77 $content = strip_tags($content); 78 } 79 if ($cut) { 80 $blah = explode(' ', $content); 81 if (count($blah) > $cut) { 82 $k = $cut; 83 $use_dotdotdot = 1; 84 } else { 85 $k = count($blah); 86 $use_dotdotdot = 0; 87 } 88 for ($i=0; $i<$k; $i++) { 89 $excerpt .= $blah[$i].' '; 90 } 91 $excerpt .= ($use_dotdotdot) ? '...' : ''; 92 $content = $excerpt; 93 } 94 echo $content; 95 } 96 97 function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { 111 98 global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages; 112 global $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $preview, $cookiehash; 113 global $querystring_start, $querystring_equal, $querystring_separator; 99 global $HTTP_SERVER_VARS, $preview, $cookiehash; 114 100 global $pagenow; 115 101 $output = ''; 116 102 117 103 if (!empty($post->post_password)) { // if there's a password 118 if ($ HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie104 if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie 119 105 $output = get_the_password_form(); 120 106 return $output; … … 149 135 150 136 function the_excerpt() { 151 $excerpt = get_the_excerpt(); 152 $excerpt = convert_bbcode($excerpt); 153 $excerpt = convert_gmcode($excerpt); 154 $excerpt = convert_smilies($excerpt); 155 $excerpt = convert_chars($excerpt, 'html'); 156 $excerpt = apply_filters('the_excerpt', $excerpt); 157 echo $excerpt; 137 echo apply_filters('the_excerpt', get_the_excerpt()); 158 138 } 159 139 160 140 function the_excerpt_rss($cut = 0, $encode_html = 0) { 161 141 $output = get_the_excerpt(true); 162 $output = convert_bbcode($output); 163 $output = convert_gmcode($output); 164 $output = convert_chars($output, 'unicode'); 142 143 $output = convert_chars($output); 165 144 if ($cut && !$encode_html) { 166 145 $encode_html = 2; … … 193 172 } 194 173 195 function the_excerpt_unicode() {196 $excerpt = get_the_excerpt();197 $excerpt = convert_bbcode($excerpt);198 $excerpt = convert_gmcode($excerpt);199 $excerpt = convert_smilies($excerpt);200 $excerpt = convert_chars($excerpt, 'unicode');201 $excerpt = apply_filters('the_excerpt_unicode', $excerpt);202 echo $excerpt;203 }204 205 174 function get_the_excerpt($fakeit = true) { 206 175 global $id, $post; 207 global $HTTP_SERVER_VARS, $ HTTP_COOKIE_VARS, $preview, $cookiehash;176 global $HTTP_SERVER_VARS, $preview, $cookiehash; 208 177 $output = ''; 209 178 $output = stripslashes($post->post_excerpt); 210 179 if (!empty($post->post_password)) { // if there's a password 211 if ($ HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie180 if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie 212 181 $output = "There is no excerpt because this is a protected post."; 213 182 return $output;
Note: See TracChangeset
for help on using the changeset viewer.