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

Line Code
873
874      public static function get_akismet_user( $api_key ) {
875           $akismet_user = false;
876
877           $request_args = array(
878                'key' => $api_key,
879                'blog' => get_option( 'home' ),
880           );
881
882           $request_args = apply_filters( 'akismet_request_args', $request_args, 'get-subscription' );
883
884           $subscription_verification = Akismet::http_post( Akismet::build_query( $request_args ), 'get-subscription' );
885
886           if ( ! empty( $subscription_verification[1] ) ) {
887                if ( 'invalid' !== $subscription_verification[1] ) {
888                     $akismet_user = json_decode( $subscription_verification[1] );
889                }
890           }
891
 
Line Code
896           $stat_totals = array();
897
898           foreach( array( '6-months', 'all' ) as $interval ) {
899                $request_args = array(
900                     'blog' => get_option( 'home' ),
901                     'key' => $api_key,
902                     'from' => $interval,
903                );
904
905                $request_args = apply_filters( 'akismet_request_args', $request_args, 'get-stats' );
906
907                $response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' );
908
909                if ( ! empty( $response[1] ) ) {
910                     $data = json_decode( $response[1] );
911                     /*
912                      * The json decoded response should be an object. If it's not an object, something's wrong, and the data
913                      * shouldn't be added to the stats_totals array.
914                      */
 
Line Code
925           $request_args = array_merge(
926                array(
927                     'user_id' => $user_id,
928                     'api_key' => $api_key,
929                     'get_account_type' => 'true',
930                ),
931                $extra
932           );
933
934           $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-wpcom-key' );
935
936           $akismet_account = Akismet::http_post( Akismet::build_query( $request_args ), 'verify-wpcom-key' );
937
938           if ( ! empty( $akismet_account[1] ) )
939                $akismet_account = json_decode( $akismet_account[1] );
940
941           Akismet::log( compact( 'akismet_account' ) );
942
943           return $akismet_account;