Changeset 8800 for trunk/wp-includes/post-template.php
- Timestamp:
- 09/03/2008 07:54:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r8643 r8800 91 91 $output = ''; 92 92 93 if ( !empty($post->post_password) ) { // if there's a password 94 if ( !isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) { // and it doesn't match the cookie 95 $output = get_the_password_form(); 96 return $output; 97 } 93 if ( post_password_required($post) ) { // If post password required and it doesn't match the cookie 94 $output = get_the_password_form(); 95 return $output; 98 96 } 99 97 … … 146 144 $output = ''; 147 145 $output = $post->post_excerpt; 148 if ( !empty($post->post_password) ) { // if there's a password 149 if ( !isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie 150 $output = __('There is no excerpt because this is a protected post.'); 151 return $output; 152 } 146 if ( post_password_required($post) ) { 147 $output = __('There is no excerpt because this is a protected post.'); 148 return $output; 153 149 } 154 150 … … 226 222 227 223 return apply_filters('post_class', $classes, $class, $post_id); 224 } 225 226 /** 227 * Determines if post requires a password and if the correct password has been provided 228 * 229 * {@internal Missing Long Description}} 230 * 231 * @package WordPress 232 * @subpackage Post 233 * @since 2.7 234 * 235 * @param int|object $post An optional post. Global $post used if not provided. 236 * @return bool false if a password is not required or the correct password cookie is present, true otherwise 237 */ 238 function post_password_required( $post = null ) { 239 $post = get_post($post); 240 241 if ( empty($post->post_password) ) 242 return false; 243 244 if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) ) 245 return true; 246 247 if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) 248 return true; 249 250 return false; 228 251 } 229 252
Note: See TracChangeset
for help on using the changeset viewer.