Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: akismet_comment_nonce

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
22      private static function init_hooks() {
23           self::$initiated = true;
24
25           add_action( 'wp_insert_comment', array( 'Akismet', 'auto_check_update_meta' ), 10, 2 );
26           add_action( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 );
27           add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments' ) );
28           add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments_meta' ) );
29           add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) );
30
31           $akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
32
33           if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' )
34                add_action( 'comment_form',  array( 'Akismet',  'add_comment_nonce' ), 1 );
35
36           add_action( 'admin_footer-edit-comments.php', array( 'Akismet', 'load_form_js' ) );
37           add_action( 'comment_form', array( 'Akismet', 'load_form_js' ) );
38           add_action( 'comment_form', array( 'Akismet', 'inject_ak_js' ) );
39
40           add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 );
 
Line Code
76           $comment['referrer']     = self::get_referer();
77           $comment['blog']         = get_option('home');
78           $comment['blog_lang']    = get_locale();
79           $comment['blog_charset'] = get_option('blog_charset');
80           $comment['permalink']    = get_permalink( $comment['comment_post_ID'] );
81
82           if ( !empty( $comment['user_ID'] ) )
83                $comment['user_role'] = Akismet::get_user_roles( $comment['user_ID'] );
84
85           $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
86           $comment['akismet_comment_nonce'] = 'inactive';
87           if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) {
88                $comment['akismet_comment_nonce'] = 'failed';
89                if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) )
90                     $comment['akismet_comment_nonce'] = 'passed';
91
92                // comment reply in wp-admin
93                if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) )
94                     $comment['akismet_comment_nonce'] = 'passed';