Changeset 43127
- Timestamp:
- 05/02/2018 10:10:30 PM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 5 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-comments-post.php
r38432 r43127 34 34 35 35 $user = wp_get_current_user(); 36 $cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) ); 36 37 37 38 /** … … 39 40 * 40 41 * @since 3.4.0 42 * @since 4.9.6 The `$cookies_consent` parameter was added. 41 43 * 42 * @param WP_Comment $comment Comment object. 43 * @param WP_User $user User object. The user may not exist. 44 * @param WP_Comment $comment Comment object. 45 * @param WP_User $user Comment author's user object. The user may not exist. 46 * @param boolean $cookies_consent Comment author's consent to store cookies. 44 47 */ 45 do_action( 'set_comment_cookies', $comment, $user );48 do_action( 'set_comment_cookies', $comment, $user, $cookies_consent ); 46 49 47 50 $location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID; -
branches/4.9/src/wp-includes/comment-template.php
r42849 r43127 2196 2196 $html5 = 'html5' === $args['format']; 2197 2197 $fields = array( 2198 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . 2199 '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>', 2200 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . 2201 '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>', 2202 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' . 2203 '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>', 2198 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . 2199 '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>', 2200 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . 2201 '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>', 2202 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' . 2203 '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>', 2204 'cookies' => '<p class="comment-form-cookies-consent"><label for="wp-comment-cookies-consent">' . 2205 '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" />' . 2206 __( 'Save my name, email, and site URL in my browser for next time I post a comment.' ) . '</label></p>', 2204 2207 ); 2205 2208 -
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 -
branches/4.9/src/wp-includes/default-filters.php
r43117 r43127 301 301 add_action( 'do_pings', 'do_all_pings', 10, 1 ); 302 302 add_action( 'do_robots', 'do_robots' ); 303 add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 2);303 add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 ); 304 304 add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' ); 305 305 add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
Note: See TracChangeset
for help on using the changeset viewer.