| 8 | | if ( is_single() || is_page() || $withcomments ) : |
|---|
| 9 | | $req = get_settings('require_name_email'); |
|---|
| 10 | | $comment_author = ''; |
|---|
| 11 | | if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { |
|---|
| 12 | | $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]); |
|---|
| 13 | | $comment_author = stripslashes($comment_author); |
|---|
| 14 | | $comment_author = wp_specialchars($comment_author, true); |
|---|
| 15 | | } |
|---|
| 16 | | $comment_author_email = ''; |
|---|
| 17 | | if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { |
|---|
| 18 | | $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); |
|---|
| 19 | | $comment_author_email = stripslashes($comment_author_email); |
|---|
| 20 | | $comment_author_email = wp_specialchars($comment_author_email, true); |
|---|
| 21 | | } |
|---|
| 22 | | $comment_author_url = ''; |
|---|
| 23 | | if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { |
|---|
| 24 | | $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); |
|---|
| 25 | | $comment_author_url = stripslashes($comment_author_url); |
|---|
| 26 | | $comment_author_url = wp_specialchars($comment_author_url, true); |
|---|
| 27 | | } |
|---|
| 28 | | |
|---|
| | 8 | if ( ! (is_single() || is_page() || $withcomments) ) |
|---|
| | 9 | return; |
|---|
| | 10 | |
|---|
| | 11 | $req = get_settings('require_name_email'); |
|---|
| | 12 | $commenter = wp_get_current_commenter(); |
|---|
| | 13 | extract($commenter); |
|---|
| | 14 | |
|---|
| | 15 | // TODO: Use API instead of SELECTs. |
|---|
| | 896 | function sanitize_comment_cookies() { |
|---|
| | 897 | if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { |
|---|
| | 898 | $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]); |
|---|
| | 899 | $comment_author = stripslashes($comment_author); |
|---|
| | 900 | $comment_author = wp_specialchars($comment_author, true); |
|---|
| | 901 | $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author; |
|---|
| | 902 | } |
|---|
| | 903 | |
|---|
| | 904 | if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { |
|---|
| | 905 | $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); |
|---|
| | 906 | $comment_author_email = stripslashes($comment_author_email); |
|---|
| | 907 | $comment_author_email = wp_specialchars($comment_author_email, true); |
|---|
| | 908 | $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; |
|---|
| | 909 | } |
|---|
| | 910 | |
|---|
| | 911 | if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { |
|---|
| | 912 | $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); |
|---|
| | 913 | $comment_author_url = stripslashes($comment_author_url); |
|---|
| | 914 | $comment_author_url = wp_specialchars($comment_author_url, true); |
|---|
| | 915 | $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url; |
|---|
| | 916 | } |
|---|
| | 917 | } |
|---|
| | 918 | |
|---|
| | 919 | function wp_get_current_commenter() { |
|---|
| | 920 | // Cookies should already be sanitized. |
|---|
| | 921 | |
|---|
| | 922 | $comment_author = ''; |
|---|
| | 923 | if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) |
|---|
| | 924 | $comment_author = $_COOKIE['comment_author_'.COOKIEHASH]; |
|---|
| | 925 | |
|---|
| | 926 | $comment_author_email = ''; |
|---|
| | 927 | if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) |
|---|
| | 928 | $comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH]; |
|---|
| | 929 | |
|---|
| | 930 | $comment_author_url = ''; |
|---|
| | 931 | if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) |
|---|
| | 932 | $comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH]; |
|---|
| | 933 | |
|---|
| | 934 | return compact('comment_author', 'comment_author_email', 'comment_author_url'); |
|---|
| | 935 | } |
|---|
| | 936 | |
|---|