/** * Get number of spam messages blocked by Akismet. * * @since 4.3.0 * * @return int|string Number of spam blocked by Akismet. Otherwise, an error message. */ public function get_akismet_data() { if (!is_wp_error($status = $this->akismet_is_active_and_registered())) { return rest_ensure_response(Akismet_Admin::get_stats(Akismet::get_api_key())); } else { return $status->get_error_code(); } }
/** * Get number of spam messages blocked by Akismet. * * @since 4.1.0 * * @param WP_REST_Request $data { * Array of parameters received by request. * * @type string $date Date range to restrict results to. * } * * @return int|string Number of spam blocked by Akismet. Otherwise, an error message. */ public static function akismet_get_stats_data(WP_REST_Request $data) { if (!is_wp_error($status = self::akismet_is_active_and_registered())) { return rest_ensure_response(Akismet_Admin::get_stats(Akismet::get_api_key())); } else { return $status->get_error_code(); } }