To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN
(without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 92 | $id = (int) $wpdb->insert_id; |
| 93 | |
| 94 | if ( $comment_approved == 1) { |
| 95 | $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); |
| 96 | $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$comment_post_ID'" ); |
| 97 | } |
| 98 | return $id; |
| 99 | } |
| 100 | |
| 101 | function wp_filter_comment($commentdata) { |
| 102 | $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']); |
| 103 | $commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']); |
| 104 | $commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']); |
| 105 | $commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']); |
| 106 | $commentdata['comment_author_IP'] = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']); |
| 107 | $commentdata['comment_author_url'] = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']); |
| 108 | $commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']); |
| 109 | $commentdata['filtered'] = true; |
| 110 | return $commentdata; |
| 111 | } |
| 112 | |
| 113 | function wp_allow_comment($commentdata) { |
| 114 | global $wpdb; |
| 115 | extract($commentdata); |
| 116 | |
| 117 | // Simple duplicate check |
| 118 | $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$comment_author' "; |
| 119 | if ( $comment_author_email ) |
| 120 | $dupe .= "OR comment_author_email = '$comment_author_email' "; |
| 121 | $dupe .= ") AND comment_content = '$comment_content' LIMIT 1"; |
| 122 | if ( $wpdb->get_var($dupe) ) |
| Line | Code |
| 891 | if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { |
| 892 | $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]); |
| 893 | $comment_author = stripslashes($comment_author); |
| 894 | $comment_author = attribute_escape($comment_author); |
| 895 | $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author; |
| 896 | } |
| 897 | |
| 898 | if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { |
| 899 | $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); |
| 900 | $comment_author_email = stripslashes($comment_author_email); |
| 901 | $comment_author_email = attribute_escape($comment_author_email); |
| 902 | $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; |
| 903 | } |
| 904 | |
| 905 | if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { |
| 906 | $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); |
| 907 | $comment_author_url = stripslashes($comment_author_url); |
| 908 | $comment_author_url = attribute_escape($comment_author_url); |
| 909 | $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url; |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | function wp_get_current_commenter() { |
| 914 | // Cookies should already be sanitized. |
| 915 | |
| 916 | $comment_author = ''; |
| 917 | if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) |
| 918 | $comment_author = $_COOKIE['comment_author_'.COOKIEHASH]; |
| 919 | |
| 920 | $comment_author_email = ''; |
| 921 | if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) |