← All changes
|
includes/queries/class-charitable-donations-query.php
+5
-4
1.7.0.11
→
1.8.13
View file →
| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * A helper class to retrieve Donations. |
| 4 | 4 | * |
| 5 | 5 | * @package Charitable/Classes/Charitable_Donations_Query |
| 6 | 6 | * @author David Bisset |
| 7 | - * @copyright Copyright (c) 2022, WP Charitable LLC | |
| 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.4.0 |
| 10 | 10 | * @version 1.6.54 |
| 11 | 11 | */ |
| @@ -119,9 +119,10 @@ | ||
| 119 | 119 | global $wpdb; |
| 120 | 120 | |
| 121 | 121 | $sql = "SELECT {$this->fields()} {$this->from()} {$this->join()} {$this->where()} {$this->groupby()} {$this->orderby()} {$this->order()} {$this->limit()} {$this->offset()};"; |
| 122 | 122 | |
| 123 | - return $wpdb->get_col( $this->get_prepared_sql( $sql ) ); | |
| 123 | + // phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter -- get_prepared_sql() internally calls $wpdb->prepare() which properly escapes the SQL. | |
| 124 | + return $wpdb->get_col( $this->get_prepared_sql( $sql ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 124 | 125 | } |
| 125 | 126 | |
| 126 | 127 | /** |
| 127 | 128 | * Set up fields query argument. |
| @@ -176,9 +177,9 @@ | ||
| 176 | 177 | public function unhook_callbacks() { |
| 177 | 178 | remove_action( 'charitable_pre_query', array( $this, 'setup_fields' ) ); |
| 178 | 179 | remove_filter( 'charitable_query_fields', array( $this, 'donation_fields' ), 4 ); |
| 179 | 180 | remove_filter( 'charitable_query_fields', array( $this, 'donation_calc_fields' ), 5 ); |
| 180 | - remove_filter( 'charitable_query_join', array( $this, 'join_campaign_donations_table_on_donation' ), 5 ); | |
| 181 | + remove_filter( 'charitable_query_join', array( $this, 'join_campaign_donations_table_on_donation' ), 4 ); | |
| 181 | 182 | remove_filter( 'charitable_query_join', array( $this, 'join_campaign_donors_table_on_donation' ), 6 ); |
| 182 | 183 | remove_filter( 'charitable_query_join', array( $this, 'join_meta' ), 7 ); |
| 183 | 184 | remove_filter( 'charitable_query_where', array( $this, 'where_donation_plan_is_in' ), 8 ); |
| 184 | 185 | remove_filter( 'charitable_query_where', array( $this, 'where_status_is_in' ), 9 ); |
| @@ -206,9 +207,9 @@ | ||
| 206 | 207 | */ |
| 207 | 208 | protected function prepare_query() { |
| 208 | 209 | add_action( 'charitable_pre_query', array( $this, 'setup_fields' ) ); |
| 209 | 210 | add_action( 'charitable_pre_query', array( $this, 'setup_orderby' ) ); |
| 210 | - add_filter( 'charitable_query_join', array( $this, 'join_campaign_donations_table_on_donation' ), 5 ); | |
| 211 | + add_filter( 'charitable_query_join', array( $this, 'join_campaign_donations_table_on_donation' ), 4 ); | |
| 211 | 212 | add_filter( 'charitable_query_join', array( $this, 'join_campaign_donors_table_on_donation' ), 6 ); |
| 212 | 213 | add_filter( 'charitable_query_join', array( $this, 'join_meta' ), 7 ); |
| 213 | 214 | add_filter( 'charitable_query_where', array( $this, 'where_donation_plan_is_in' ), 8 ); |
| 214 | 215 | add_filter( 'charitable_query_where', array( $this, 'where_status_is_in' ), 9 ); |