PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
← All changes | includes/admin/tools/data/class-give-tools-recount-income.php +29 -19 2.3.0 → 4.18.0 View file →
@@ -4,9 +4,9 @@
4 4 *
5 5 * This class handles batch processing of recounting earnings
6 6 *
7 7 * @subpackage Admin/Tools/Give_Tools_Recount_Income
8 - * @copyright Copyright (c) 2016, WordImpress
8 + * @copyright Copyright (c) 2016, GiveWP
9 9 * @license https://opensource.org/licenses/gpl-license GNU Public License
10 10 * @since 1.5
11 11 */
12 12
@@ -23,8 +23,9 @@
23 23 class Give_Tools_Recount_Income extends Give_Batch_Export {
24 24
25 25 /**
26 26 * Our export type. Used for export-type specific filters/actions
27 + *
27 28 * @var string
28 29 * @since 1.5
29 30 */
30 31 public $export_type = '';
@@ -30,8 +31,9 @@
30 31 public $export_type = '';
31 32
32 33 /**
33 34 * Allows for a non-form batch processing to be run.
35 + *
34 36 * @since 1.5
35 37 * @var boolean
36 38 */
37 39 public $is_void = true;
@@ -37,8 +39,9 @@
37 39 public $is_void = true;
38 40
39 41 /**
40 42 * Sets the number of items to pull on each step
43 + *
41 44 * @since 1.5
42 45 * @var integer
43 46 */
44 47 public $per_step = 100;
@@ -71,15 +74,18 @@
71 74 $total = (float) 0;
72 75 $this->store_data( 'give_temp_recount_earnings', $total );
73 76 }
74 77
75 - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
78 + $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', [ 'publish' ] );
76 79
77 - $args = apply_filters( 'give_recount_earnings_args', array(
78 - 'number' => $this->per_step,
79 - 'page' => $this->step,
80 - 'status' => $accepted_statuses,
81 - ) );
80 + $args = apply_filters(
81 + 'give_recount_earnings_args',
82 + [
83 + 'number' => $this->per_step,
84 + 'page' => $this->step,
85 + 'status' => $accepted_statuses,
86 + ]
87 + );
82 88
83 89 $payments = give_get_payments( $args );
84 90
85 91 if ( ! empty( $payments ) ) {
@@ -94,12 +100,16 @@
94 100 * @since 2.1
95 101 */
96 102 $donation_amount = apply_filters(
97 103 'give_donation_amount',
98 - give_format_amount( $payment_amount, array( 'donation_id' => $payment->ID ) ),
104 + give_format_amount( $payment_amount, [ 'donation_id' => $payment->ID ] ),
99 105 $payment->total,
100 106 $payment->ID,
101 - array( 'type' => 'stats', 'currency' => false, 'amount' => false )
107 + [
108 + 'type' => 'stats',
109 + 'currency' => false,
110 + 'amount' => false,
111 + ]
102 112 );
103 113
104 114 $total += (float) give_maybe_sanitize_amount( $donation_amount );
105 115 }
@@ -132,9 +142,9 @@
132 142
133 143 $total = $this->get_stored_data( 'give_recount_earnings_total' );
134 144
135 145 if ( false === $total ) {
136 - $args = apply_filters( 'give_recount_earnings_total_args', array() );
146 + $args = apply_filters( 'give_recount_earnings_total_args', [] );
137 147
138 148 $counts = give_count_payments( $args );
139 149 $total = absint( $counts->publish );
140 150 $total = apply_filters( 'give_recount_store_earnings_total', $total );
@@ -173,9 +183,9 @@
173 183 */
174 184 public function process_step() {
175 185
176 186 if ( ! $this->can_export() ) {
177 - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
187 + wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), [ 'response' => 403 ] );
178 188 }
179 189
180 190 $had_data = $this->get_data();
181 191
@@ -186,9 +196,9 @@
186 196 } else {
187 197 $this->delete_data( 'give_recount_earnings_total' );
188 198 $this->delete_data( 'give_temp_recount_earnings' );
189 199 $this->done = true;
190 - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
200 + $this->message = esc_html__( 'Revenue stats have been successfully recounted.', 'give' );
191 201
192 202 return false;
193 203 }
194 204 }
@@ -245,9 +255,9 @@
245 255 *
246 256 * @since 1.5
247 257 *
248 258 * @param string $key The option_name
249 - * @param mixed $value The value to store
259 + * @param mixed $value The value to store
250 260 *
251 261 * @return void
252 262 */
253 263 private function store_data( $key, $value ) {
@@ -254,19 +264,19 @@
254 264 global $wpdb;
255 265
256 266 $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
257 267
258 - $data = array(
268 + $data = [
259 269 'option_name' => $key,
260 270 'option_value' => $value,
261 271 'autoload' => 'no',
262 - );
272 + ];
263 273
264 - $formats = array(
274 + $formats = [
265 275 '%s',
266 276 '%s',
267 277 '%s',
268 - );
278 + ];
269 279
270 280 $wpdb->replace( $wpdb->options, $data, $formats );
271 281 }
272 282
@@ -280,9 +290,9 @@
280 290 * @return void
281 291 */
282 292 private function delete_data( $key ) {
283 293 global $wpdb;
284 - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
294 + $wpdb->delete( $wpdb->options, [ 'option_name' => $key ] );
285 295 }
286 296
287 297 /**
288 298 * Unset the properties specific to the donors export.
@@ -288,9 +298,9 @@
288 298 * Unset the properties specific to the donors export.
289 299 *
290 300 * @since 2.3.0
291 301 *
292 - * @param array $request
302 + * @param array $request
293 303 * @param Give_Batch_Export $export
294 304 */
295 305 public function unset_properties( $request, $export ) {
296 306 if ( $export->done ) {