← All changes
|
includes/api/class-charitable-api-route-reports.php
+18
-14
1.6.6
→
1.8.13
View file →
| @@ -2,10 +2,10 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Sets up the /reports/ API route. |
| 4 | 4 | * |
| 5 | 5 | * @package Charitable/Classes/Charitable_API_Route_Reports |
| 6 | - * @author Eric Daams | |
| 7 | - * @copyright Copyright (c) 2018, Studio 164a | |
| 6 | + * @author David Bisset | |
| 7 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.6.0 |
| 10 | 10 | * @version 1.6.0 |
| 11 | 11 | */ |
| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | * |
| 41 | 41 | * @return void |
| 42 | 42 | */ |
| 43 | 43 | public function __construct() { |
| 44 | - parent::__constrct(); | |
| 44 | + parent::__construct(); | |
| 45 | 45 | |
| 46 | 46 | $this->base = 'reports'; |
| 47 | 47 | } |
| 48 | 48 | |
| @@ -89,17 +89,19 @@ | ||
| 89 | 89 | * is already an instance, WP_HTTP_Response, otherwise |
| 90 | 90 | * returns a new WP_REST_Response instance. |
| 91 | 91 | */ |
| 92 | 92 | public function get_reports() { |
| 93 | - return rest_ensure_response( array( | |
| 94 | - 'slug' => 'donations', | |
| 95 | - 'description' => __( 'List of donation reports.', 'charitable' ), | |
| 96 | - '_links' => array( | |
| 97 | - 'self' => array( | |
| 98 | - 'href' => get_site_url( null, '/wp-json/' . $this->namespace . '/' . $this->base . '/donations/' ), | |
| 93 | + return rest_ensure_response( | |
| 94 | + array( | |
| 95 | + 'slug' => 'donations', | |
| 96 | + 'description' => __( 'List of donation reports.', 'charitable' ), | |
| 97 | + '_links' => array( | |
| 98 | + 'self' => array( | |
| 99 | + 'href' => get_site_url( null, '/wp-json/' . $this->namespace . '/' . $this->base . '/donations/' ), | |
| 100 | + ), | |
| 99 | 101 | ), |
| 100 | - ), | |
| 101 | - ) ); | |
| 102 | + ) | |
| 103 | + ); | |
| 102 | 104 | } |
| 103 | 105 | |
| 104 | 106 | /** |
| 105 | 107 | * Return a response with the donations report. |
| @@ -111,11 +113,13 @@ | ||
| 111 | 113 | * is already an instance, WP_HTTP_Response, otherwise |
| 112 | 114 | * returns a new WP_REST_Response instance. |
| 113 | 115 | */ |
| 114 | 116 | public function get_donations_report( $request ) { |
| 115 | - $report = new Charitable_Donation_Report( array( | |
| 116 | - 'campaigns' => $request->get_param( 'campaigns' ), | |
| 117 | - ) ); | |
| 117 | + $report = new Charitable_Donation_Report( | |
| 118 | + array( | |
| 119 | + 'campaigns' => $request->get_param( 'campaigns' ), | |
| 120 | + ) | |
| 121 | + ); | |
| 118 | 122 | |
| 119 | 123 | return rest_ensure_response( $report->get_reports() ); |
| 120 | 124 | } |
| 121 | 125 | |