Changeset 38603
- Timestamp:
- 09/14/2016 09:27:16 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r38574 r38603 780 780 $post = get_post($post); 781 781 782 if ( empty( $post->post_password ) ) 783 return false; 784 785 if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) ) 786 return true; 782 if ( empty( $post->post_password ) ) { 783 /** This filter is documented in wp-includes/post.php */ 784 return apply_filters( 'post_password_required', false, $post ); 785 } 786 787 if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) { 788 /** This filter is documented in wp-includes/post.php */ 789 return apply_filters( 'post_password_required', true, $post ); 790 } 787 791 788 792 $hasher = new PasswordHash( 8, true ); 789 793 790 794 $hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ); 791 if ( 0 !== strpos( $hash, '$P$B' ) ) 792 return true; 793 794 return ! $hasher->CheckPassword( $post->post_password, $hash ); 795 if ( 0 !== strpos( $hash, '$P$B' ) ) { 796 $required = true; 797 } else { 798 $required = ! $hasher->CheckPassword( $post->post_password, $hash ); 799 } 800 801 /** 802 * Filter whether a post requires the user to supply a password. 803 * 804 * @param bool $required Whether the user needs to supply a password. True if password has not been 805 * provided or is incorrect, false if password has been supplied or is not required. 806 * @param WP_Post $post Post data. 807 */ 808 return apply_filters( 'post_password_required', $required, $post ); 795 809 } 796 810
Note: See TracChangeset
for help on using the changeset viewer.