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 |
---|---|
104 | * |
105 | * @return string |
106 | */ |
107 | public static function get_access_token() { |
108 | static $access_token = null; |
109 |
|
110 | if ( is_null( $access_token ) ) { |
111 | $request_args = array( 'api_key' => self::get_api_key() ); |
112 |
|
113 | $request_args = apply_filters( 'akismet_request_args', $request_args, 'token' ); |
114 |
|
115 | $response = self::http_post( self::build_query( $request_args ), 'token' ); |
116 |
|
117 | $access_token = $response[1]; |
118 | } |
119 |
|
120 | return $access_token; |
121 | } |
122 |
|
123 | public static function check_key_status( $key, $ip = null ) { |
124 | $request_args = array( |
125 | 'key' => $key, |
126 | 'blog' => get_option( 'home' ), |
127 | ); |
128 |
|
129 | $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-key' ); |
130 |
|
131 | return self::http_post( self::build_query( $request_args ), 'verify-key', $ip ); |
132 | } |
133 |
|
134 | public static function verify_key( $key, $ip = null ) { |
135 | // Shortcut for obviously invalid keys. |
136 | if ( strlen( $key ) != 12 ) { |
137 | return 'invalid'; |
138 | } |
Line | Code |
145 | return $response[1]; |
146 | } |
147 |
|
148 | public static function deactivate_key( $key ) { |
149 | $request_args = array( |
150 | 'key' => $key, |
151 | 'blog' => get_option( 'home' ), |
152 | ); |
153 |
|
154 | $request_args = apply_filters( 'akismet_request_args', $request_args, 'deactivate' ); |
155 |
|
156 | $response = self::http_post( self::build_query( $request_args ), 'deactivate' ); |
157 |
|
158 | if ( $response[1] != 'deactivated' ) |
159 | return 'failed'; |
160 |
|
161 | return $response[1]; |
162 | } |
163 |
|
Line | Code |
318 |
|
319 | /** |
320 | * Filter the data that is used to generate the request body for the API call. |
321 | * |
322 | * @since 5.3.1 |
323 | * |
324 | * @param array $comment An array of request data. |
325 | * @param string $endpoint The API endpoint being requested. |
326 | */ |
327 | $comment = apply_filters( 'akismet_request_args', $comment, 'comment-check' ); |
328 |
|
329 | $response = self::http_post( self::build_query( $comment ), 'comment-check' ); |
330 |
|
331 | do_action( 'akismet_comment_check_response', $response ); |
332 |
|
333 | $commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys ); |
334 |
|
335 | // Also include any form fields we inject into the comment form, like ak_js |
336 | foreach ( $_POST as $key => $value ) { |
Line | Code |
781 |
|
782 | $c['user_role'] = ''; |
783 | if ( ! empty( $c['user_ID'] ) ) { |
784 | $c['user_role'] = Akismet::get_user_roles( $c['user_ID'] ); |
785 | } |
786 |
|
787 | if ( self::is_test_mode() ) |
788 | $c['is_test'] = 'true'; |
789 |
|
790 | $c = apply_filters( 'akismet_request_args', $c, 'comment-check' ); |
791 |
|
792 | $response = self::http_post( self::build_query( $c ), 'comment-check' ); |
793 |
|
794 | if ( ! empty( $response[1] ) ) { |
795 | return $response[1]; |
796 | } |
797 |
|
798 | return false; |
799 | } |
Line | Code |
963 | $comment['is_test'] = 'true'; |
964 | } |
965 |
|
966 | $post = get_post( $comment['comment_post_ID'] ); |
967 |
|
968 | if ( ! is_null( $post ) ) { |
969 | $comment['comment_post_modified_gmt'] = $post->post_modified_gmt; |
970 | } |
971 |
|
972 | $comment = apply_filters( 'akismet_request_args', $comment, 'submit-spam' ); |
973 |
|
974 | $response = self::http_post( self::build_query( $comment ), 'submit-spam' ); |
975 |
|
976 | update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); |
977 |
|
978 | if ( $comment['reporter'] ) { |
979 | update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] ); |
980 | } |
981 |
|
Line | Code |
1030 | $comment['is_test'] = 'true'; |
1031 | } |
1032 |
|
1033 | $post = get_post( $comment['comment_post_ID'] ); |
1034 |
|
1035 | if ( ! is_null( $post ) ) { |
1036 | $comment['comment_post_modified_gmt'] = $post->post_modified_gmt; |
1037 | } |
1038 |
|
1039 | $comment = apply_filters( 'akismet_request_args', $comment, 'submit-ham' ); |
1040 |
|
1041 | $response = self::http_post( self::build_query( $comment ), 'submit-ham' ); |
1042 |
|
1043 | update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); |
1044 |
|
1045 | if ( $comment['reporter'] ) { |
1046 | update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] ); |
1047 | } |
1048 |
|