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 7 times in this file.
| Line | Code |
|---|---|
| 150 | * |
| 151 | * @return string |
| 152 | */ |
| 153 | public static function get_access_token() { |
| 154 | static $access_token = null; |
| 155 | |
| 156 | if ( is_null( $access_token ) ) { |
| 157 | $request_args = array( 'api_key' => self::get_api_key() ); |
| 158 | |
| 159 | $request_args = apply_filters( 'akismet_request_args', $request_args, 'token' ); |
| 160 | |
| 161 | $response = self::http_post( self::build_query( $request_args ), 'token' ); |
| 162 | |
| 163 | $access_token = $response[1]; |
| 164 | } |
| 165 | |
| 166 | return $access_token; |
| 167 | } |
| 168 | |
| 169 | public static function check_key_status( $key, $ip = null ) { |
| 170 | $request_args = array( |
| 171 | 'key' => $key, |
| 172 | 'blog' => get_option( 'home' ), |
| 173 | ); |
| 174 | |
| 175 | $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-key' ); |
| 176 | |
| 177 | return self::http_post( self::build_query( $request_args ), 'verify-key', $ip ); |
| 178 | } |
| 179 | |
| 180 | public static function verify_key( $key, $ip = null ) { |
| 181 | // Shortcut for obviously invalid keys. |
| 182 | if ( strlen( $key ) != 12 ) { |
| 183 | return 'invalid'; |
| 184 | } |
| Line | Code |
| 192 | return $response[1]; |
| 193 | } |
| 194 | |
| 195 | public static function deactivate_key( $key ) { |
| 196 | $request_args = array( |
| 197 | 'key' => $key, |
| 198 | 'blog' => get_option( 'home' ), |
| 199 | ); |
| 200 | |
| 201 | $request_args = apply_filters( 'akismet_request_args', $request_args, 'deactivate' ); |
| 202 | |
| 203 | $response = self::http_post( self::build_query( $request_args ), 'deactivate' ); |
| 204 | |
| 205 | if ( $response[1] != 'deactivated' ) { |
| 206 | return 'failed'; |
| 207 | } |
| 208 | |
| 209 | return $response[1]; |
| 210 | } |
| Line | Code |
| 384 | |
| 385 | /** |
| 386 | * Filter the data that is used to generate the request body for the API call. |
| 387 | * |
| 388 | * @since 5.3.1 |
| 389 | * |
| 390 | * @param array $comment An array of request data. |
| 391 | * @param string $endpoint The API endpoint being requested. |
| 392 | */ |
| 393 | $comment = apply_filters( 'akismet_request_args', $comment, 'comment-check' ); |
| 394 | |
| 395 | $response = self::http_post( self::build_query( $comment ), 'comment-check' ); |
| 396 | |
| 397 | do_action( 'akismet_comment_check_response', $response ); |
| 398 | |
| 399 | $commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys ); |
| 400 | |
| 401 | // Also include any form fields we inject into the comment form, like ak_js |
| 402 | foreach ( $_POST as $key => $value ) { |
| Line | Code |
| 991 | $c['user_role'] = ''; |
| 992 | if ( ! empty( $c['user_ID'] ) ) { |
| 993 | $c['user_role'] = self::get_user_roles( $c['user_ID'] ); |
| 994 | } |
| 995 | |
| 996 | if ( self::is_test_mode() ) { |
| 997 | $c['is_test'] = 'true'; |
| 998 | } |
| 999 | |
| 1000 | $c = apply_filters( 'akismet_request_args', $c, 'comment-check' ); |
| 1001 | |
| 1002 | $response = self::http_post( self::build_query( $c ), 'comment-check' ); |
| 1003 | |
| 1004 | if ( ! empty( $response[1] ) ) { |
| 1005 | return $response[1]; |
| 1006 | } |
| 1007 | |
| 1008 | return false; |
| 1009 | } |
| Line | Code |
| 1183 | |
| 1184 | $post = get_post( $comment['comment_post_ID'] ); |
| 1185 | |
| 1186 | if ( ! is_null( $post ) ) { |
| 1187 | $comment['comment_post_modified_gmt'] = $post->post_modified_gmt; |
| 1188 | } |
| 1189 | |
| 1190 | $comment['comment_check_response'] = self::last_comment_check_response( $comment_id ); |
| 1191 | |
| 1192 | $comment = apply_filters( 'akismet_request_args', $comment, 'submit-spam' ); |
| 1193 | |
| 1194 | $response = self::http_post( self::build_query( $comment ), 'submit-spam' ); |
| 1195 | |
| 1196 | update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); |
| 1197 | |
| 1198 | if ( $comment['reporter'] ) { |
| 1199 | update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] ); |
| 1200 | } |
| 1201 | |
| Line | Code |
| 1252 | |
| 1253 | $post = get_post( $comment['comment_post_ID'] ); |
| 1254 | |
| 1255 | if ( ! is_null( $post ) ) { |
| 1256 | $comment['comment_post_modified_gmt'] = $post->post_modified_gmt; |
| 1257 | } |
| 1258 | |
| 1259 | $comment['comment_check_response'] = self::last_comment_check_response( $comment_id ); |
| 1260 | |
| 1261 | $comment = apply_filters( 'akismet_request_args', $comment, 'submit-ham' ); |
| 1262 | |
| 1263 | $response = self::http_post( self::build_query( $comment ), 'submit-ham' ); |
| 1264 | |
| 1265 | update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); |
| 1266 | |
| 1267 | if ( $comment['reporter'] ) { |
| 1268 | update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] ); |
| 1269 | } |
| 1270 | |