Changeset 8800
- Timestamp:
- 09/03/2008 07:54:14 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/classic/comments-popup.php
r7450 r8800 34 34 $comments = get_approved_comments($id); 35 35 $commentstatus = get_post($id); 36 if ( !empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $commentstatus->post_password) { // and it doesn't match the cookie36 if ( post_password_required($commentstatus) ) { // and it doesn't match the cookie 37 37 echo(get_the_password_form()); 38 38 } else { ?> -
trunk/wp-content/themes/classic/comments.php
r8695 r8800 1 <?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>1 <?php if ( post_password_required() ) : ?> 2 2 <p><?php _e('Enter your password to view comments.'); ?></p> 3 3 <?php return; endif; ?> -
trunk/wp-content/themes/default/comments-popup.php
r7450 r8800 34 34 $comments = get_approved_comments($id); 35 35 $post = get_post($id); 36 if ( !empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie36 if ( post_password_required($post) ) { // and it doesn't match the cookie 37 37 echo(get_the_password_form()); 38 38 } else { ?> -
trunk/wp-content/themes/default/comments.php
r8703 r8800 3 3 die ('Please do not load this page directly. Thanks!'); 4 4 5 if (!empty($post->post_password)) { // if there's a password 6 if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 7 ?> 8 9 <p class="nocomments">This post is password protected. Enter the password to view comments.</p> 10 11 <?php 12 return; 13 } 5 if ( post_password_required() ) { ?> 6 <p class="nocomments">This post is password protected. Enter the password to view comments.</p> 7 <?php 8 return; 14 9 } 15 10 -
trunk/wp-includes/comment-template.php
r8695 r8800 803 803 } 804 804 805 if ( !empty($post->post_password) ) { // if there's a password 806 if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) || $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie 807 echo __('Enter your password to view comments'); 808 return; 809 } 805 if ( post_password_required() ) { 806 echo __('Enter your password to view comments'); 807 return; 810 808 } 811 809 -
trunk/wp-includes/feed.php
r8600 r8800 395 395 */ 396 396 function rss_enclosure() { 397 global $post; 398 if ( !empty($post->post_password) && (!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) 397 if ( post_password_required() ) 399 398 return; 400 399 … … 427 426 */ 428 427 function atom_enclosure() { 429 global $post; 430 if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) 428 if ( post_password_required() ) 431 429 return; 432 430 -
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.