verify_key example


    public static function updated_option( $old_value$value ) {
        // Not an API call         if ( ! class_exists( 'WPCOM_JSON_API_Update_Option_Endpoint' ) ) {
            return;
        }
        // Only run the registration if the old key is different.         if ( $old_value !== $value ) {
            self::verify_key( $value );
        }
    }
    
    /** * Treat the creation of an API key the same as updating the API key to a new value. * * @param mixed $option_name Will always be "wordpress_api_key", until something else hooks in here. * @param mixed $value The option value. */
    public static function added_option( $option_name$value ) {
        if ( 'wordpress_api_key' === $option_name ) {
            
self::$notices[] = 'new-key-empty';
            }
        }
        elseif ( $new_key != $old_key ) {
            self::save_key( $new_key );
        }

        return true;
    }

    public static function save_key( $api_key ) {
        $key_status = Akismet::verify_key( $api_key );

        if ( $key_status == 'valid' ) {
            $akismet_user = self::get_akismet_user( $api_key );
            
            if ( $akismet_user ) {                
                if ( in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub' ) ) )
                    update_option( 'wordpress_api_key', $api_key );
                
                if ( $akismet_user->status == 'active' )
                    self::$notices['status'] = 'new-key-valid';
                elseif ( $akismet_user->status == 'notice' )
                    

function akismet_get_key() {
    return Akismet::get_api_key();
}
function akismet_check_key_status( $key$ip = null ) {
    return Akismet::check_key_status( $key$ip );
}
function akismet_update_alert( $response ) {
    return Akismet::update_alert( $response );
}
function akismet_verify_key( $key$ip = null ) {
    return Akismet::verify_key( $key$ip );
}
function akismet_get_user_roles( $user_id ) {
    return Akismet::get_user_roles( $user_id );
}
function akismet_result_spam( $approved ) {
    return Akismet::comment_is_spam( $approved );
}
function akismet_result_hold( $approved ) {
    return Akismet::comment_needs_moderation( $approved );
}
function akismet_get_user_comments_approved( $user_id$comment_author_email$comment_author$comment_author_url ) {
    
/** * Update the current alert code and message by triggering a call to the Akismet server. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */
    public static function set_alert( $request ) {
        delete_option( 'akismet_alert_code' );
        delete_option( 'akismet_alert_msg' );

        // Make a request so the most recent alert code and message are retrieved.         Akismet::verify_key( Akismet::get_api_key() );

        return self::get_alert( $request );
    }

    /** * Clear the current alert code and message. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */
    public static function delete_alert( $request ) {
        
Home | Imprint | This part of the site doesn't use cookies.