Changeset 43127 for branches/4.9/src/wp-includes/comment.php
- Timestamp:
- 05/02/2018 10:10:30 PM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
- Property svn:mergeinfo changed
/trunk merged: 42772,43042
- Property svn:mergeinfo changed
-
branches/4.9/src/wp-includes/comment.php
r43110 r43127 523 523 * to recall previous comments by this commentator that are still held in moderation. 524 524 * 525 * @param WP_Comment $comment Comment object.526 * @param object $user Comment author's object.527 *528 525 * @since 3.4.0 529 */ 530 function wp_set_comment_cookies($comment, $user) { 531 if ( $user->exists() ) 526 * @since 4.9.6 The `$cookies_consent` parameter was added. 527 * 528 * @param WP_Comment $comment Comment object. 529 * @param WP_User $user Comment author's user object. The user may not exist. 530 * @param boolean $cookies_consent Optional. Comment author's consent to store cookies. Default true. 531 */ 532 function wp_set_comment_cookies( $comment, $user, $cookies_consent = true ) { 533 // If the user already exists, or the user opted out of cookies, don't set cookies. 534 if ( $user->exists() ) { 532 535 return; 536 } 537 538 if ( false === $cookies_consent ) { 539 // Remove any existing cookies. 540 $past = time() - YEAR_IN_SECONDS; 541 setcookie( 'comment_author_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); 542 setcookie( 'comment_author_email_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); 543 setcookie( 'comment_author_url_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); 544 545 return; 546 } 533 547 534 548 /** … … 539 553 * @param int $seconds Comment cookie lifetime. Default 30000000. 540 554 */ 541 $comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 );555 $comment_cookie_lifetime = time() + apply_filters( 'comment_cookie_lifetime', 30000000 ); 542 556 $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); 543 setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, time() +$comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );544 setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() +$comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );545 setcookie( 'comment_author_url_' . COOKIEHASH, esc_url( $comment->comment_author_url), time() +$comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );557 setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); 558 setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); 559 setcookie( 'comment_author_url_' . COOKIEHASH, esc_url( $comment->comment_author_url ), $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); 546 560 } 547 561
Note: See TracChangeset
for help on using the changeset viewer.