WP hooks navigation: Home/browse • Actions index • Filters index
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.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 401 | fclose($fs); |
| 402 | $response = explode("\r\n\r\n", $response, 2); |
| 403 | } |
| 404 | return $response; |
| 405 | } |
| 406 | |
| 407 | // filter handler used to return a spam result to pre_comment_approved |
| 408 | function akismet_result_spam( $approved ) { |
| 409 | // bump the counter here instead of when the filter is added to reduce the possibility of overcounting |
| 410 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
| 411 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
| 412 | return 'spam'; |
| 413 | } |
| 414 | |
| 415 | function akismet_auto_check_comment( $comment ) { |
| 416 | global $akismet_api_host, $akismet_api_port; |
| 417 | |
| 418 | $comment['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ); |
| 419 | $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
| Line | Code |
| 441 | do_action( 'akismet_spam_caught' ); |
| 442 | |
| 443 | $post = get_post( $comment['comment_post_ID'] ); |
| 444 | $last_updated = strtotime( $post->post_modified_gmt ); |
| 445 | $diff = time() - $last_updated; |
| 446 | $diff = $diff / 86400; |
| 447 | |
| 448 | if ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' ) { |
| 449 | // akismet_result_spam() won't be called so bump the counter here |
| 450 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
| 451 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
| 452 | die; |
| 453 | } |
| 454 | } |
| 455 | akismet_delete_old(); |
| 456 | return $comment; |
| 457 | } |
| 458 | |
| 459 | function akismet_delete_old() { |