Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: akismet_request_args

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 7 times in this file.

Line Code
136       *
137       * @return string
138       */
139      public static function get_access_token() {
140           static $access_token = null;
141
142           if ( is_null( $access_token ) ) {
143                $request_args = array( 'api_key' => self::get_api_key() );
144
145                $request_args = apply_filters( 'akismet_request_args', $request_args, 'token' );
146
147                $response = self::http_post( self::build_query( $request_args ), 'token' );
148
149                $access_token = $response[1];
150           }
151
152           return $access_token;
153      }
154
155      public static function check_key_status( $key, $ip = null ) {
156           $request_args = array(
157                'key'  => $key,
158                'blog' => get_option( 'home' ),
159           );
160
161           $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-key' );
162
163           return self::http_post( self::build_query( $request_args ), 'verify-key', $ip );
164      }
165
166      public static function verify_key( $key, $ip = null ) {
167           // Shortcut for obviously invalid keys.
168           if ( strlen( $key ) != 12 ) {
169                return 'invalid';
170           }
 
Line Code
178           return $response[1];
179      }
180
181      public static function deactivate_key( $key ) {
182           $request_args = array(
183                'key'  => $key,
184                'blog' => get_option( 'home' ),
185           );
186
187           $request_args = apply_filters( 'akismet_request_args', $request_args, 'deactivate' );
188
189           $response = self::http_post( self::build_query( $request_args ), 'deactivate' );
190
191           if ( $response[1] != 'deactivated' ) {
192                return 'failed';
193           }
194
195           return $response[1];
196      }
 
Line Code
366
367           /**
368            * Filter the data that is used to generate the request body for the API call.
369            *
370            * @since 5.3.1
371            *
372            * @param array $comment An array of request data.
373            * @param string $endpoint The API endpoint being requested.
374            */
375           $comment = apply_filters( 'akismet_request_args', $comment, 'comment-check' );
376
377           $response = self::http_post( self::build_query( $comment ), 'comment-check' );
378
379           do_action( 'akismet_comment_check_response', $response );
380
381           $commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys );
382
383           // Also include any form fields we inject into the comment form, like ak_js
384           foreach ( $_POST as $key => $value ) {
 
Line Code
822           $c['user_role'] = '';
823           if ( ! empty( $c['user_ID'] ) ) {
824                $c['user_role'] = self::get_user_roles( $c['user_ID'] );
825           }
826
827           if ( self::is_test_mode() ) {
828                $c['is_test'] = 'true';
829           }
830
831           $c = apply_filters( 'akismet_request_args', $c, 'comment-check' );
832
833           $response = self::http_post( self::build_query( $c ), 'comment-check' );
834
835           if ( ! empty( $response[1] ) ) {
836                return $response[1];
837           }
838
839           return false;
840      }
 
Line Code
1008
1009           $post = get_post( $comment['comment_post_ID'] );
1010
1011           if ( ! is_null( $post ) ) {
1012                $comment['comment_post_modified_gmt'] = $post->post_modified_gmt;
1013           }
1014
1015           $comment['comment_check_response'] = self::last_comment_check_response( $comment_id );
1016
1017           $comment = apply_filters( 'akismet_request_args', $comment, 'submit-spam' );
1018
1019           $response = self::http_post( self::build_query( $comment ), 'submit-spam' );
1020
1021           update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
1022
1023           if ( $comment['reporter'] ) {
1024                update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] );
1025           }
1026
 
Line Code
1077
1078           $post = get_post( $comment['comment_post_ID'] );
1079
1080           if ( ! is_null( $post ) ) {
1081                $comment['comment_post_modified_gmt'] = $post->post_modified_gmt;
1082           }
1083
1084           $comment['comment_check_response'] = self::last_comment_check_response( $comment_id );
1085
1086           $comment = apply_filters( 'akismet_request_args', $comment, 'submit-ham' );
1087
1088           $response = self::http_post( self::build_query( $comment ), 'submit-ham' );
1089
1090           update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
1091
1092           if ( $comment['reporter'] ) {
1093                update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] );
1094           }
1095