Completed
Push — master ( 82a250...ece35a )
by Devin
38:40 queued 18:41
created
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function get_predefined_dates() {
87 87
 		$predefined = array(
88
-			'today'        => esc_html__( 'Today', 'give' ),
89
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
90
-			'this_week'    => esc_html__( 'This Week', 'give' ),
91
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
92
-			'this_month'   => esc_html__( 'This Month', 'give' ),
93
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
94
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
95
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
96
-			'this_year'    => esc_html__( 'This Year', 'give' ),
97
-			'last_year'    => esc_html__( 'Last Year', 'give' )
88
+			'today'        => esc_html__('Today', 'give'),
89
+			'yesterday'    => esc_html__('Yesterday', 'give'),
90
+			'this_week'    => esc_html__('This Week', 'give'),
91
+			'last_week'    => esc_html__('Last Week', 'give'),
92
+			'this_month'   => esc_html__('This Month', 'give'),
93
+			'last_month'   => esc_html__('Last Month', 'give'),
94
+			'this_quarter' => esc_html__('This Quarter', 'give'),
95
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
96
+			'this_year'    => esc_html__('This Year', 'give'),
97
+			'last_year'    => esc_html__('Last Year', 'give')
98 98
 		);
99 99
 
100
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
100
+		return apply_filters('give_stats_predefined_dates', $predefined);
101 101
 	}
102 102
 
103 103
 	/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return void
115 115
 	 */
116
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
116
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
117 117
 
118
-		if ( empty( $_start_date ) ) {
118
+		if (empty($_start_date)) {
119 119
 			$_start_date = 'this_month';
120 120
 		}
121 121
 
122
-		if ( empty( $_end_date ) ) {
122
+		if (empty($_end_date)) {
123 123
 			$_end_date = $_start_date;
124 124
 		}
125 125
 
126
-		$this->start_date = $this->convert_date( $_start_date );
127
-		$this->end_date   = $this->convert_date( $_end_date, true );
126
+		$this->start_date = $this->convert_date($_start_date);
127
+		$this->end_date   = $this->convert_date($_end_date, true);
128 128
 	}
129 129
 
130 130
 	/**
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
142 142
 	 */
143
-	public function convert_date( $date, $end_date = false ) {
143
+	public function convert_date($date, $end_date = false) {
144 144
 
145 145
 		$this->timestamp = false;
146 146
 		$second          = $end_date ? 59 : 0;
147 147
 		$minute          = $end_date ? 59 : 0;
148 148
 		$hour            = $end_date ? 23 : 0;
149 149
 		$day             = 1;
150
-		$month           = date( 'n', current_time( 'timestamp' ) );
151
-		$year            = date( 'Y', current_time( 'timestamp' ) );
150
+		$month           = date('n', current_time('timestamp'));
151
+		$year            = date('Y', current_time('timestamp'));
152 152
 
153
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
153
+		if (array_key_exists($date, $this->get_predefined_dates())) {
154 154
 
155 155
 			// This is a predefined date rate, such as last_week
156
-			switch ( $date ) {
156
+			switch ($date) {
157 157
 
158 158
 				case 'this_month' :
159 159
 
160
-					if ( $end_date ) {
160
+					if ($end_date) {
161 161
 
162
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
162
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
163 163
 						$hour   = 23;
164 164
 						$minute = 59;
165 165
 						$second = 59;
@@ -169,28 +169,28 @@  discard block
 block discarded – undo
169 169
 
170 170
 				case 'last_month' :
171 171
 
172
-					if ( $month == 1 ) {
172
+					if ($month == 1) {
173 173
 
174 174
 						$month = 12;
175
-						$year --;
175
+						$year--;
176 176
 
177 177
 					} else {
178 178
 
179
-						$month --;
179
+						$month--;
180 180
 
181 181
 					}
182 182
 
183
-					if ( $end_date ) {
184
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
183
+					if ($end_date) {
184
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
185 185
 					}
186 186
 
187 187
 					break;
188 188
 
189 189
 				case 'today' :
190 190
 
191
-					$day = date( 'd', current_time( 'timestamp' ) );
191
+					$day = date('d', current_time('timestamp'));
192 192
 
193
-					if ( $end_date ) {
193
+					if ($end_date) {
194 194
 						$hour   = 23;
195 195
 						$minute = 59;
196 196
 						$second = 59;
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 
201 201
 				case 'yesterday' :
202 202
 
203
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
203
+					$day = date('d', current_time('timestamp')) - 1;
204 204
 
205 205
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
206
-					if ( $day < 1 ) {
206
+					if ($day < 1) {
207 207
 
208 208
 						// If current month is 1
209
-						if ( 1 == $month ) {
209
+						if (1 == $month) {
210 210
 
211 211
 							$year -= 1; // Today is January 1, so skip back to last day of December
212 212
 							$month = 12;
213
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
213
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
214 214
 
215 215
 						} else {
216 216
 
217 217
 							// Go back one month and get the last day of the month
218 218
 							$month -= 1;
219
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
219
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
220 220
 
221 221
 						}
222 222
 					}
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 
226 226
 				case 'this_week' :
227 227
 
228
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
229
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
228
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
229
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
230 230
 
231
-					if ( $today < $days_to_week_start ) {
231
+					if ($today < $days_to_week_start) {
232 232
 
233
-						if ( $month > 1 ) {
233
+						if ($month > 1) {
234 234
 							$month -= 1;
235 235
 						} else {
236 236
 							$month = 12;
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 
239 239
 					}
240 240
 
241
-					if ( ! $end_date ) {
241
+					if ( ! $end_date) {
242 242
 
243 243
 						// Getting the start day
244 244
 
245
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
246
-						$day += get_option( 'start_of_week' );
245
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
246
+						$day += get_option('start_of_week');
247 247
 
248 248
 					} else {
249 249
 
250 250
 						// Getting the end day
251 251
 
252
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
253
-						$day += get_option( 'start_of_week' ) + 6;
252
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
253
+						$day += get_option('start_of_week') + 6;
254 254
 
255 255
 					}
256 256
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 				case 'last_week' :
260 260
 
261
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
262
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
261
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
262
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
263 263
 
264
-					if ( $today < $days_to_week_start ) {
264
+					if ($today < $days_to_week_start) {
265 265
 
266
-						if ( $month > 1 ) {
266
+						if ($month > 1) {
267 267
 							$month -= 1;
268 268
 						} else {
269 269
 							$month = 12;
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 
272 272
 					}
273 273
 
274
-					if ( ! $end_date ) {
274
+					if ( ! $end_date) {
275 275
 
276 276
 						// Getting the start day
277 277
 
278
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
279
-						$day += get_option( 'start_of_week' );
278
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
279
+						$day += get_option('start_of_week');
280 280
 
281 281
 					} else {
282 282
 
283 283
 						// Getting the end day
284 284
 
285
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
286
-						$day += get_option( 'start_of_week' ) + 6;
285
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
286
+						$day += get_option('start_of_week') + 6;
287 287
 
288 288
 					}
289 289
 
@@ -291,39 +291,39 @@  discard block
 block discarded – undo
291 291
 
292 292
 				case 'this_quarter' :
293 293
 
294
-					$month_now = date( 'n', current_time( 'timestamp' ) );
294
+					$month_now = date('n', current_time('timestamp'));
295 295
 
296
-					if ( $month_now <= 3 ) {
296
+					if ($month_now <= 3) {
297 297
 
298
-						if ( ! $end_date ) {
298
+						if ( ! $end_date) {
299 299
 							$month = 1;
300 300
 						} else {
301 301
 							$month  = 3;
302
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
302
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
303 303
 							$hour   = 23;
304 304
 							$minute = 59;
305 305
 							$second = 59;
306 306
 						}
307 307
 
308
-					} else if ( $month_now <= 6 ) {
308
+					} else if ($month_now <= 6) {
309 309
 
310
-						if ( ! $end_date ) {
310
+						if ( ! $end_date) {
311 311
 							$month = 4;
312 312
 						} else {
313 313
 							$month  = 6;
314
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
314
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
315 315
 							$hour   = 23;
316 316
 							$minute = 59;
317 317
 							$second = 59;
318 318
 						}
319 319
 
320
-					} else if ( $month_now <= 9 ) {
320
+					} else if ($month_now <= 9) {
321 321
 
322
-						if ( ! $end_date ) {
322
+						if ( ! $end_date) {
323 323
 							$month = 7;
324 324
 						} else {
325 325
 							$month  = 9;
326
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
326
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
327 327
 							$hour   = 23;
328 328
 							$minute = 59;
329 329
 							$second = 59;
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 
332 332
 					} else {
333 333
 
334
-						if ( ! $end_date ) {
334
+						if ( ! $end_date) {
335 335
 							$month = 10;
336 336
 						} else {
337 337
 							$month  = 12;
338
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
338
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
339 339
 							$hour   = 23;
340 340
 							$minute = 59;
341 341
 							$second = 59;
@@ -347,40 +347,40 @@  discard block
 block discarded – undo
347 347
 
348 348
 				case 'last_quarter' :
349 349
 
350
-					$month_now = date( 'n', current_time( 'timestamp' ) );
350
+					$month_now = date('n', current_time('timestamp'));
351 351
 
352
-					if ( $month_now <= 3 ) {
352
+					if ($month_now <= 3) {
353 353
 
354
-						if ( ! $end_date ) {
354
+						if ( ! $end_date) {
355 355
 							$month = 10;
356 356
 						} else {
357 357
 							$year -= 1;
358 358
 							$month  = 12;
359
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
359
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
360 360
 							$hour   = 23;
361 361
 							$minute = 59;
362 362
 							$second = 59;
363 363
 						}
364 364
 
365
-					} else if ( $month_now <= 6 ) {
365
+					} else if ($month_now <= 6) {
366 366
 
367
-						if ( ! $end_date ) {
367
+						if ( ! $end_date) {
368 368
 							$month = 1;
369 369
 						} else {
370 370
 							$month  = 3;
371
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
371
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
372 372
 							$hour   = 23;
373 373
 							$minute = 59;
374 374
 							$second = 59;
375 375
 						}
376 376
 
377
-					} else if ( $month_now <= 9 ) {
377
+					} else if ($month_now <= 9) {
378 378
 
379
-						if ( ! $end_date ) {
379
+						if ( ! $end_date) {
380 380
 							$month = 4;
381 381
 						} else {
382 382
 							$month  = 6;
383
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
383
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
384 384
 							$hour   = 23;
385 385
 							$minute = 59;
386 386
 							$second = 59;
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 
389 389
 					} else {
390 390
 
391
-						if ( ! $end_date ) {
391
+						if ( ! $end_date) {
392 392
 							$month = 7;
393 393
 						} else {
394 394
 							$month  = 9;
395
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
395
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
396 396
 							$hour   = 23;
397 397
 							$minute = 59;
398 398
 							$second = 59;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 
405 405
 				case 'this_year' :
406 406
 
407
-					if ( ! $end_date ) {
407
+					if ( ! $end_date) {
408 408
 						$month = 1;
409 409
 					} else {
410 410
 						$month  = 12;
411
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
411
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
412 412
 						$hour   = 23;
413 413
 						$minute = 59;
414 414
 						$second = 59;
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 				case 'last_year' :
420 420
 
421 421
 					$year -= 1;
422
-					if ( ! $end_date ) {
422
+					if ( ! $end_date) {
423 423
 						$month = 1;
424 424
 					} else {
425 425
 						$month  = 12;
426
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
426
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
427 427
 						$hour   = 23;
428 428
 						$minute = 59;
429 429
 						$second = 59;
@@ -434,30 +434,30 @@  discard block
 block discarded – undo
434 434
 			}
435 435
 
436 436
 
437
-		} else if ( is_numeric( $date ) ) {
437
+		} else if (is_numeric($date)) {
438 438
 
439 439
 			// return $date unchanged since it is a timestamp
440 440
 			$this->timestamp = true;
441 441
 
442
-		} else if ( false !== strtotime( $date ) ) {
442
+		} else if (false !== strtotime($date)) {
443 443
 
444
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
445
-			$year  = date( 'Y', $date );
446
-			$month = date( 'm', $date );
447
-			$day   = date( 'd', $date );
444
+			$date  = strtotime($date, current_time('timestamp'));
445
+			$year  = date('Y', $date);
446
+			$month = date('m', $date);
447
+			$day   = date('d', $date);
448 448
 
449 449
 		} else {
450 450
 
451
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
451
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
452 452
 
453 453
 		}
454 454
 
455
-		if ( false === $this->timestamp ) {
455
+		if (false === $this->timestamp) {
456 456
 			// Create an exact timestamp
457
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
457
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
458 458
 		}
459 459
 
460
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
460
+		return apply_filters('give_stats_date', $date, $end_date, $this);
461 461
 
462 462
 	}
463 463
 
@@ -473,33 +473,33 @@  discard block
 block discarded – undo
473 473
 	 * 
474 474
 	 * @return string
475 475
 	 */
476
-	public function count_where( $where = '' ) {
476
+	public function count_where($where = '') {
477 477
 		// Only get payments in our date range
478 478
 
479 479
 		$start_where = '';
480 480
 		$end_where   = '';
481 481
 
482
-		if ( $this->start_date ) {
482
+		if ($this->start_date) {
483 483
 
484
-			if ( $this->timestamp ) {
484
+			if ($this->timestamp) {
485 485
 				$format = 'Y-m-d H:i:s';
486 486
 			} else {
487 487
 				$format = 'Y-m-d 00:00:00';
488 488
 			}
489 489
 
490
-			$start_date  = date( $format, $this->start_date );
490
+			$start_date  = date($format, $this->start_date);
491 491
 			$start_where = " AND p.post_date >= '{$start_date}'";
492 492
 		}
493 493
 
494
-		if ( $this->end_date ) {
494
+		if ($this->end_date) {
495 495
 
496
-			if ( $this->timestamp ) {
496
+			if ($this->timestamp) {
497 497
 				$format = 'Y-m-d H:i:s';
498 498
 			} else {
499 499
 				$format = 'Y-m-d 23:59:59';
500 500
 			}
501 501
 
502
-			$end_date = date( $format, $this->end_date );
502
+			$end_date = date($format, $this->end_date);
503 503
 
504 504
 			$end_where = " AND p.post_date <= '{$end_date}'";
505 505
 		}
@@ -521,34 +521,34 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string
523 523
 	 */
524
-	public function payments_where( $where = '' ) {
524
+	public function payments_where($where = '') {
525 525
 
526 526
 		global $wpdb;
527 527
 
528 528
 		$start_where = '';
529 529
 		$end_where   = '';
530 530
 
531
-		if ( ! is_wp_error( $this->start_date ) ) {
531
+		if ( ! is_wp_error($this->start_date)) {
532 532
 
533
-			if ( $this->timestamp ) {
533
+			if ($this->timestamp) {
534 534
 				$format = 'Y-m-d H:i:s';
535 535
 			} else {
536 536
 				$format = 'Y-m-d 00:00:00';
537 537
 			}
538 538
 
539
-			$start_date  = date( $format, $this->start_date );
539
+			$start_date  = date($format, $this->start_date);
540 540
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
541 541
 		}
542 542
 
543
-		if ( ! is_wp_error( $this->end_date ) ) {
543
+		if ( ! is_wp_error($this->end_date)) {
544 544
 
545
-			if ( $this->timestamp ) {
545
+			if ($this->timestamp) {
546 546
 				$format = 'Y-m-d 00:00:00';
547 547
 			} else {
548 548
 				$format = 'Y-m-d 23:59:59';
549 549
 			}
550 550
 
551
-			$end_date = date( $format, $this->end_date );
551
+			$end_date = date($format, $this->end_date);
552 552
 
553 553
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
554 554
 		}
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,38 +56,38 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69 69
 	$receipt_link = sprintf(
70 70
 		'<a href="%1$s">%2$s</a>',
71
-		esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ),
72
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
71
+		esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())),
72
+		esc_html__('View the receipt in your browser &raquo;', 'give')
73 73
 	);
74 74
 
75 75
 	$user = wp_get_current_user();
76 76
 
77
-	$message = str_replace( '{name}', $user->display_name, $message );
78
-	$message = str_replace( '{fullname}', $user->display_name, $message );
79
-	$message = str_replace( '{username}', $user->user_login, $message );
80
-	$message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message );
81
-	$message = str_replace( '{price}', $price, $message );
82
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
83
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
84
-	$message = str_replace( '{payment_method}', $gateway, $message );
85
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
86
-	$message = str_replace( '{payment_id}', $payment_id, $message );
87
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
88
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
89
-
90
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
77
+	$message = str_replace('{name}', $user->display_name, $message);
78
+	$message = str_replace('{fullname}', $user->display_name, $message);
79
+	$message = str_replace('{username}', $user->user_login, $message);
80
+	$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
81
+	$message = str_replace('{price}', $price, $message);
82
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
83
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
84
+	$message = str_replace('{payment_method}', $gateway, $message);
85
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
86
+	$message = str_replace('{payment_id}', $payment_id, $message);
87
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
88
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
89
+
90
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
91 91
 }
92 92
 
93 93
 /**
@@ -99,23 +99,23 @@  discard block
 block discarded – undo
99 99
  * @since  1.0
100 100
  * @return array|bool
101 101
  */
102
-function give_email_template_preview( $array ) {
102
+function give_email_template_preview($array) {
103 103
 
104
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
104
+	if ( ! current_user_can('manage_give_settings')) {
105 105
 		return false;
106 106
 	}
107 107
 	$custom_field = array(
108
-		'name' => esc_html__( 'Preview Email', 'give' ),
109
-		'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ),
108
+		'name' => esc_html__('Preview Email', 'give'),
109
+		'desc' => esc_html__('Click the buttons to preview emails.', 'give'),
110 110
 		'id'   => 'give_email_preview_buttons',
111 111
 		'type' => 'email_preview_buttons'
112 112
 	);
113 113
 
114
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
114
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
115 115
 
116 116
 }
117 117
 
118
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
118
+add_filter('give_settings_emails', 'give_email_template_preview');
119 119
 
120 120
 /**
121 121
  * Output Email Template Preview Buttons.
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 function give_email_preview_buttons_callback() {
128 128
 	ob_start();
129 129
 	?>
130
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e( 'Donation Receipt Preview', 'give' ); ?> "><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
131
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
130
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e('Donation Receipt Preview', 'give'); ?> "><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
131
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
132 132
 		'give_action'  => 'send_test_email',
133 133
 		'give-message' => 'sent-test-email',
134 134
 		'tag'          => 'emails'
135
-	) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
135
+	)), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
136 136
 	<?php
137 137
 	echo ob_get_clean();
138 138
 }
@@ -145,46 +145,46 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function give_display_email_template_preview() {
147 147
 
148
-	if ( empty( $_GET['give_action'] ) ) {
148
+	if (empty($_GET['give_action'])) {
149 149
 		return;
150 150
 	}
151 151
 
152
-	if ( 'preview_email' !== $_GET['give_action'] ) {
152
+	if ('preview_email' !== $_GET['give_action']) {
153 153
 		return;
154 154
 	}
155 155
 
156
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
156
+	if ( ! current_user_can('manage_give_settings')) {
157 157
 		return;
158 158
 	}
159 159
 
160 160
 
161
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
161
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
162 162
 
163
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
163
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
164 164
 
165 165
 	echo give_get_preview_email_header();
166 166
 
167 167
 	//Are we previewing an actual payment?
168
-	if ( ! empty( $payment_id ) ) {
168
+	if ( ! empty($payment_id)) {
169 169
 
170
-		$content = give_get_email_body_content( $payment_id );
170
+		$content = give_get_email_body_content($payment_id);
171 171
 
172
-		$preview_content = give_do_email_tags( $content, $payment_id );
172
+		$preview_content = give_do_email_tags($content, $payment_id);
173 173
 
174 174
 	} else {
175 175
 
176 176
 		//No payment ID, use sample preview content
177
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
177
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
178 178
 	}
179 179
 
180 180
 
181
-	echo Give()->emails->build_email( $preview_content );
181
+	echo Give()->emails->build_email($preview_content);
182 182
 
183 183
 	exit;
184 184
 
185 185
 }
186 186
 
187
-add_action( 'init', 'give_display_email_template_preview' );
187
+add_action('init', 'give_display_email_template_preview');
188 188
 
189 189
 /**
190 190
  * Email Template Body.
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return string $email_body Body of the email
198 198
  */
199
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
199
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
200 200
 
201 201
 	$default_email_body = give_get_default_donation_receipt_email();
202 202
 
203
-	$email_content = give_get_option( 'donation_receipt' );
204
-	$email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
203
+	$email_content = give_get_option('donation_receipt');
204
+	$email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body;
205 205
 
206
-	$email_body = wpautop( $email_content );
206
+	$email_body = wpautop($email_content);
207 207
 
208
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
208
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
209 209
 
210
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
210
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
211 211
 }
212 212
 
213 213
 /**
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return string $email_body Body of the email
222 222
  */
223
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
223
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
224 224
 
225
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
226
-	$email     = give_get_payment_user_email( $payment_id );
225
+	$user_info = maybe_unserialize($payment_data['user_info']);
226
+	$email     = give_get_payment_user_email($payment_id);
227 227
 
228
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
229
-		$user_data = get_userdata( $user_info['id'] );
228
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
229
+		$user_data = get_userdata($user_info['id']);
230 230
 		$name      = $user_data->display_name;
231
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
232
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
231
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
232
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
233 233
 	} else {
234 234
 		$name = $email;
235 235
 	}
236 236
 
237
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
237
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
238 238
 
239
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
240
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
239
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
240
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
241 241
 	/* translators: %s: form plural label */
242
-	$default_email_body .= sprintf( esc_html__( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n";
243
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
244
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
245
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
246
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
242
+	$default_email_body .= sprintf(esc_html__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n";
243
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
244
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
245
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
246
+	$default_email_body .= esc_html__('Thank you', 'give');
247 247
 
248
-	$email = give_get_option( 'donation_notification' );
249
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
248
+	$email = give_get_option('donation_notification');
249
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
250 250
 
251
-	$email_body = give_do_email_tags( $email, $payment_id );
251
+	$email_body = give_do_email_tags($email, $payment_id);
252 252
 
253
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
253
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
254 254
 }
255 255
 
256 256
 /**
@@ -263,34 +263,34 @@  discard block
 block discarded – undo
263 263
  * @since  1.0
264 264
  */
265 265
 function give_render_receipt_in_browser() {
266
-	if ( ! isset( $_GET['payment_key'] ) ) {
267
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
266
+	if ( ! isset($_GET['payment_key'])) {
267
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
268 268
 	}
269 269
 
270
-	$key = urlencode( $_GET['payment_key'] );
270
+	$key = urlencode($_GET['payment_key']);
271 271
 
272 272
 	ob_start();
273 273
 	//Disallows caching of the page
274
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
275
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
276
-	header( "Cache-Control: post-check=0, pre-check=0", false );
277
-	header( "Pragma: no-cache" ); // HTTP/1.0
278
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
274
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
275
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
276
+	header("Cache-Control: post-check=0, pre-check=0", false);
277
+	header("Pragma: no-cache"); // HTTP/1.0
278
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
279 279
 	?>
280 280
 	<!DOCTYPE html>
281 281
 	<html lang="en">
282 282
 	<head>
283
-		<?php do_action( 'give_receipt_head' ); ?>
283
+		<?php do_action('give_receipt_head'); ?>
284 284
 	</head>
285
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
285
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
286 286
 
287 287
 	<div id="give_receipt_wrapper">
288
-		<?php do_action( 'give_render_receipt_in_browser_before' ); ?>
289
-		<?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?>
290
-		<?php do_action( 'give_render_receipt_in_browser_after' ); ?>
288
+		<?php do_action('give_render_receipt_in_browser_before'); ?>
289
+		<?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?>
290
+		<?php do_action('give_render_receipt_in_browser_after'); ?>
291 291
 	</div>
292 292
 
293
-	<?php do_action( 'give_receipt_footer' ); ?>
293
+	<?php do_action('give_receipt_footer'); ?>
294 294
 	</body>
295 295
 	</html>
296 296
 	<?php
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	die();
299 299
 }
300 300
 
301
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
301
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
302 302
 
303 303
 
304 304
 /**
@@ -313,31 +313,31 @@  discard block
 block discarded – undo
313 313
 
314 314
 	//Payment receipt switcher
315 315
 	$payment_count = give_count_payments()->publish;
316
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
316
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
317 317
 
318
-	if ( $payment_count <= 0 ) {
318
+	if ($payment_count <= 0) {
319 319
 		return false;
320 320
 	}
321 321
 
322 322
 	//Get payments.
323
-	$payments = new Give_Payments_Query( array(
323
+	$payments = new Give_Payments_Query(array(
324 324
 		'number' => 100
325
-	) );
325
+	));
326 326
 	$payments = $payments->get_payments();
327 327
 	$options  = array();
328 328
 
329 329
 	//Provide nice human readable options.
330
-	if ( $payments ) {
330
+	if ($payments) {
331 331
 		$options[0] =
332 332
 			/* translators: %s: transaction singular label */
333
-			esc_html__( '- Select a transaction -', 'give' );
334
-		foreach ( $payments as $payment ) {
333
+			esc_html__('- Select a transaction -', 'give');
334
+		foreach ($payments as $payment) {
335 335
 
336
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
336
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
337 337
 
338 338
 		}
339 339
 	} else {
340
-		$options[0] = esc_html__( 'No Transactions Found', 'give' );
340
+		$options[0] = esc_html__('No Transactions Found', 'give');
341 341
 	}
342 342
 
343 343
 	//Start constructing HTML output.
@@ -350,16 +350,16 @@  discard block
 block discarded – undo
350 350
 			        var selected_trans = transactions.options[transactions.selectedIndex];
351 351
 				        console.log(selected_trans);
352 352
 				        if (selected_trans){
353
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
353
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
354 354
 				                window.location = url_string;
355 355
 				        }
356 356
 				    }
357 357
 			    </script>';
358 358
 
359
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a transaction:', 'give' ) . '</label>';
359
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a transaction:', 'give').'</label>';
360 360
 
361 361
 	//The select field with 100 latest transactions
362
-	$transaction_header .= Give()->html->select( array(
362
+	$transaction_header .= Give()->html->select(array(
363 363
 		'name'             => 'preview_email_payment_id',
364 364
 		'selected'         => $payment_id,
365 365
 		'id'               => 'give_preview_email_payment_id',
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 		'select_atts'      => 'onchange="change_preview()">',
370 370
 		'show_option_all'  => false,
371 371
 		'show_option_none' => false
372
-	) );
372
+	));
373 373
 
374 374
 	//Closing tag
375 375
 	$transaction_header .= '</div>';
376 376
 
377
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
377
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
378 378
 
379 379
 }
380 380
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 function give_receipt_head_content() {
389 389
 
390 390
 	//Title.
391
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
391
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
392 392
 
393 393
 	//Meta.
394 394
 	$output .= '<meta charset="utf-8"/>
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
 		<meta name="robots" content="noindex, nofollow"/>';
403 403
 
404 404
 	//CSS
405
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
405
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
406 406
 
407
-	echo apply_filters( 'give_receipt_head_content', $output );
407
+	echo apply_filters('give_receipt_head_content', $output);
408 408
 
409 409
 }
410 410
 
411
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
412 411
\ No newline at end of file
412
+add_action('give_receipt_head', 'give_receipt_head_content');
413 413
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-template-loader.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 		/**
39 39
 		 * Templates
40 40
 		 */
41
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
41
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
42 42
 
43 43
 		/**
44 44
 		 * Content Wrappers
45 45
 		 */
46
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
47
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
46
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
47
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
48 48
 
49 49
 		/**
50 50
 		 * Entry Summary Classes
51 51
 		 */
52
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
52
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
53 53
 
54 54
 		/**
55 55
 		 * Sidebar
56 56
 		 */
57
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
57
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
58 58
 
59 59
 		/**
60 60
 		 * Single Forms Summary Box
61 61
 		 */
62
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
63
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
62
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
63
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
64 64
 
65 65
 	}
66 66
 
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return string $classes List of space separated class names.
77 77
 	 */
78
-	public function give_set_single_summary_classes( $classes ) {
78
+	public function give_set_single_summary_classes($classes) {
79 79
 
80
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
80
+		$sidebar_option = give_get_option('disable_form_sidebar');
81 81
 
82 82
 		//Add full width class when feature image is disabled AND no widgets are present
83
-		if ( $sidebar_option == 'on' ) {
83
+		if ($sidebar_option == 'on') {
84 84
 			$classes .= ' give-full-width';
85 85
 		}
86 86
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function give_output_sidebar_option() {
102 102
 
103
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
103
+		$sidebar_option = give_get_option('disable_form_sidebar');
104 104
 
105 105
 		//Add full width class when feature image is disabled AND no widgets are present
106
-		if ( $sidebar_option !== 'on' ) {
107
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
108
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
109
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
110
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
106
+		if ($sidebar_option !== 'on') {
107
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
108
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
109
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
110
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
111 111
 		}
112 112
 
113 113
 	}
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string $template
131 131
 	 */
132
-	public static function template_loader( $template ) {
133
-		$find = array( 'give.php' );
132
+	public static function template_loader($template) {
133
+		$find = array('give.php');
134 134
 		$file = '';
135 135
 
136
-		if ( is_single() && get_post_type() == 'give_forms' ) {
136
+		if (is_single() && get_post_type() == 'give_forms') {
137 137
 			$file   = 'single-give-form.php';
138 138
 			$find[] = $file;
139
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
139
+			$find[] = apply_filters('give_template_path', 'give/').$file;
140 140
 		}
141 141
 
142
-		if ( $file ) {
143
-			$template = locate_template( array_unique( $find ) );
144
-			if ( ! $template ) {
145
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
142
+		if ($file) {
143
+			$template = locate_template(array_unique($find));
144
+			if ( ! $template) {
145
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
146 146
 			}
147 147
 		}
148 148
 
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Payment History Page
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 function give_payment_history_page() {
25 25
 	global $give_options;
26 26
 
27
-	$give_payment = get_post_type_object( 'give_payment' );
27
+	$give_payment = get_post_type_object('give_payment');
28 28
 
29
-	if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) {
30
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php';
29
+	if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) {
30
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php';
31 31
 	} else {
32
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
32
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
33 33
 		$payments_table = new Give_Payment_History_Table();
34 34
 		$payments_table->prepare_items();
35 35
 	?>
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		 *
44 44
 		 * @since 1.0
45 45
 		 */
46
-		do_action( 'give_payments_page_top' );
46
+		do_action('give_payments_page_top');
47 47
 		?>
48 48
 
49
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
49
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
50 50
 			<input type="hidden" name="post_type" value="give_forms" />
51 51
 			<input type="hidden" name="page" value="give-payment-history" />
52 52
 			<?php $payments_table->views() ?>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 *
61 61
 		 * @since 1.0
62 62
 		 */
63
-		do_action( 'give_payments_page_bottom' );
63
+		do_action('give_payments_page_bottom');
64 64
 		?>
65 65
 
66 66
 	</div>
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
  * @param $title
78 78
  * @return string
79 79
  */
80
-function give_view_order_details_title( $admin_title, $title ) {
80
+function give_view_order_details_title($admin_title, $title) {
81 81
 
82
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base )
82
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base)
83 83
 		return $admin_title;
84 84
 
85
-	if( ! isset( $_GET['give-action'] ) )
85
+	if ( ! isset($_GET['give-action']))
86 86
 		return $admin_title;
87 87
 
88
-	switch( $_GET['give-action'] ) :
88
+	switch ($_GET['give-action']) :
89 89
 
90 90
 		case 'view-order-details' :
91 91
 			$title = sprintf(
92 92
 				/* translators: %s: admin title */
93
-				esc_html__( 'View Donation Details - %s', 'give' ),
93
+				esc_html__('View Donation Details - %s', 'give'),
94 94
 				$admin_title
95 95
 			);
96 96
 			break;
97 97
 		case 'edit-payment' :
98 98
 			$title = sprintf(
99 99
 				/* translators: %s: admin title */
100
-				esc_html__( 'Edit Payment - %s', 'give' ),
100
+				esc_html__('Edit Payment - %s', 'give'),
101 101
 				$admin_title
102 102
 			);
103 103
 			break;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 	return $title;
110 110
 }
111
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
111
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
112 112
 
113 113
 /**
114 114
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
  * @param $context
121 121
  * @return string
122 122
  */
123
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
123
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
124 124
 
125
-	$post = get_post( $post_id );
126
-	if( ! $post )
125
+	$post = get_post($post_id);
126
+	if ( ! $post)
127 127
 		return $url;
128 128
 
129
-	if( 'give_payment' != $post->post_type )
129
+	if ('give_payment' != $post->post_type)
130 130
 		return $url;
131 131
 
132
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
132
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id);
133 133
 
134 134
 	return $url;
135 135
 }
136
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
136
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 			'donation' 		=> esc_html__( 'Donation', 'give' ),
268 268
 			'donation_form' => esc_html__( 'Donation Form', 'give' ),
269 269
 			'status'   		=> esc_html__( 'Status', 'give' ),
270
-            'date'     		=> esc_html__( 'Date', 'give' ),
271
-            'amount'   		=> esc_html__( 'Amount', 'give' ),
272
-            'details'  		=> esc_html__( 'Details', 'give' ),
273
-        );
270
+			'date'     		=> esc_html__( 'Date', 'give' ),
271
+			'amount'   		=> esc_html__( 'Amount', 'give' ),
272
+			'details'  		=> esc_html__( 'Details', 'give' ),
273
+		);
274 274
 
275 275
 		return apply_filters( 'give_payments_table_columns', $columns );
276 276
 	}
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
 	public function column_default( $payment, $column_name ) {
319 319
 		switch ( $column_name ) {
320 320
 			case 'donation' :
321
-			    ob_start();
321
+				ob_start();
322 322
 				?>
323 323
                 <a href="<?php echo get_permalink( $payment->ID ); ?>">#<?php echo $payment->ID; ?></a>
324 324
                 &nbsp;<?php _e( 'by', 'give' ); ?>&nbsp;<?php echo $this->get_donor( $payment ); ?><br>
325 325
                 <?php echo $this->get_donor_email( $payment ); ?>
326 326
                 <?php
327
-                $value = ob_get_clean();
327
+				$value = ob_get_clean();
328 328
 				break;
329 329
 
330 330
 			case 'amount' :
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 				break;
349 349
 
350 350
 			case 'status' :
351
-                $value = $this->get_payment_status( $payment );
351
+				$value = $this->get_payment_status( $payment );
352 352
 				break;
353 353
 
354 354
 			case 'details' :
@@ -411,24 +411,24 @@  discard block
 block discarded – undo
411 411
 	}
412 412
 
413 413
 
414
-    /**
415
-     *  Get payment status html.
416
-     *
417
-     * @access public
418
-     * @since  1.0
419
-     *
420
-     * @param  Give_Payment $payment Contains all the data of the payment
421
-     *
422
-     * @return string                Data shown in the Email column
423
-     */
414
+	/**
415
+	 *  Get payment status html.
416
+	 *
417
+	 * @access public
418
+	 * @since  1.0
419
+	 *
420
+	 * @param  Give_Payment $payment Contains all the data of the payment
421
+	 *
422
+	 * @return string                Data shown in the Email column
423
+	 */
424 424
 	function get_payment_status( $payment ) {
425
-        $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
426
-        if ( $payment->mode == 'test' ) {
427
-            $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
428
-        }
425
+		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
426
+		if ( $payment->mode == 'test' ) {
427
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
428
+		}
429 429
 
430
-        return $value;
431
-    }
430
+		return $value;
431
+	}
432 432
 
433 433
 	/**
434 434
 	 * Get checkbox html.
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -118,37 +118,37 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
123
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
124 124
 			'ajax'     => false                        // Does this table support ajax?
125
-		) );
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	public function advanced_filters() {
133
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
134
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
135
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
133
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
134
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
135
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
136 136
 		?>
137 137
 		<div id="give-payment-filters">
138 138
 			<span id="give-payment-date-filters">
139
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
139
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
140 140
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
141
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
141
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
142 142
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
143
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
143
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
144 144
 			</span>
145
-			<?php if ( ! empty( $status ) ) : ?>
146
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
145
+			<?php if ( ! empty($status)) : ?>
146
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
147 147
 			<?php endif; ?>
148
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
149
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
148
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
149
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
150 150
 			<?php endif; ?>
151
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
151
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
152 152
 		</div>
153 153
 
154 154
 		<?php
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return void
167 167
 	 */
168
-	public function search_box( $text, $input_id ) {
169
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
168
+	public function search_box($text, $input_id) {
169
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
170 170
 			return;
171 171
 		}
172 172
 
173
-		$input_id = $input_id . '-search-input';
173
+		$input_id = $input_id.'-search-input';
174 174
 
175
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
176
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
175
+		if ( ! empty($_REQUEST['orderby'])) {
176
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
177 177
 		}
178
-		if ( ! empty( $_REQUEST['order'] ) ) {
179
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
178
+		if ( ! empty($_REQUEST['order'])) {
179
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
180 180
 		}
181 181
 		?>
182 182
 		<p class="search-box">
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 *
189 189
 			 * @since 1.0
190 190
 			 */
191
-			do_action( 'give_payment_history_search' );
191
+			do_action('give_payment_history_search');
192 192
 			?>
193 193
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
194 194
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
195
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
195
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
196 196
 		</p>
197 197
 		<?php
198 198
 	}
@@ -206,52 +206,52 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function get_views() {
208 208
 
209
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
210
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
211
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
212
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
213
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
214
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
215
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
216
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
217
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
209
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
210
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
211
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
212
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
213
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
214
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
215
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
216
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
217
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
218 218
 
219 219
 		$views = array(
220
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
220
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
221 221
 				'status',
222 222
 				'paged'
223
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
224
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
223
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
224
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
225 225
 				'status' => 'publish',
226 226
 				'paged'  => false
227
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
228
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
227
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
228
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
229 229
 				'status' => 'pending',
230 230
 				'paged'  => false
231
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
232
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
231
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
232
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
233 233
 				'status' => 'refunded',
234 234
 				'paged'  => false
235
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
236
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
235
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
236
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
237 237
 				'status' => 'revoked',
238 238
 				'paged'  => false
239
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
240
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
239
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
240
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
241 241
 				'status' => 'failed',
242 242
 				'paged'  => false
243
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
244
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
243
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
244
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
245 245
 				'status' => 'cancelled',
246 246
 				'paged'  => false
247
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
248
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
247
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
248
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
249 249
 				'status' => 'abandoned',
250 250
 				'paged'  => false
251
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count )
251
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count)
252 252
 		);
253 253
 
254
-		return apply_filters( 'give_payments_table_views', $views );
254
+		return apply_filters('give_payments_table_views', $views);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
 	public function get_columns() {
265 265
 		$columns = array(
266 266
 			'cb'       		=> '<input type="checkbox" />', //Render a checkbox instead of text
267
-			'donation' 		=> esc_html__( 'Donation', 'give' ),
268
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
269
-			'status'   		=> esc_html__( 'Status', 'give' ),
270
-            'date'     		=> esc_html__( 'Date', 'give' ),
271
-            'amount'   		=> esc_html__( 'Amount', 'give' ),
272
-            'details'  		=> esc_html__( 'Details', 'give' ),
267
+			'donation' 		=> esc_html__('Donation', 'give'),
268
+			'donation_form' => esc_html__('Donation Form', 'give'),
269
+			'status'   		=> esc_html__('Status', 'give'),
270
+            'date'     		=> esc_html__('Date', 'give'),
271
+            'amount'   		=> esc_html__('Amount', 'give'),
272
+            'details'  		=> esc_html__('Details', 'give'),
273 273
         );
274 274
 
275
-		return apply_filters( 'give_payments_table_columns', $columns );
275
+		return apply_filters('give_payments_table_columns', $columns);
276 276
 	}
277 277
 
278 278
 	/**
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function get_sortable_columns() {
286 286
 		$columns = array(
287
-			'donation'  => array( 'ID', true ),
288
-			'amount'    => array( 'amount', false ),
289
-			'date'      => array( 'date', false )
287
+			'donation'  => array('ID', true),
288
+			'amount'    => array('amount', false),
289
+			'date'      => array('date', false)
290 290
 		);
291 291
 
292
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
292
+		return apply_filters('give_payments_table_sortable_columns', $columns);
293 293
 	}
294 294
 
295 295
 	/**
@@ -315,53 +315,53 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return string Column Name
317 317
 	 */
318
-	public function column_default( $payment, $column_name ) {
319
-		switch ( $column_name ) {
318
+	public function column_default($payment, $column_name) {
319
+		switch ($column_name) {
320 320
 			case 'donation' :
321 321
 			    ob_start();
322 322
 				?>
323
-                <a href="<?php echo get_permalink( $payment->ID ); ?>">#<?php echo $payment->ID; ?></a>
324
-                &nbsp;<?php _e( 'by', 'give' ); ?>&nbsp;<?php echo $this->get_donor( $payment ); ?><br>
325
-                <?php echo $this->get_donor_email( $payment ); ?>
323
+                <a href="<?php echo get_permalink($payment->ID); ?>">#<?php echo $payment->ID; ?></a>
324
+                &nbsp;<?php _e('by', 'give'); ?>&nbsp;<?php echo $this->get_donor($payment); ?><br>
325
+                <?php echo $this->get_donor_email($payment); ?>
326 326
                 <?php
327 327
                 $value = ob_get_clean();
328 328
 				break;
329 329
 
330 330
 			case 'amount' :
331
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
332
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
331
+				$amount = ! empty($payment->total) ? $payment->total : 0;
332
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
333 333
 				break;
334 334
 
335 335
 			case 'donation_form' :
336
-				$value = '<a href="' . get_permalink( $payment->form_id ) . '">' . $payment->form_title . '</a>';
337
-				$level = give_get_payment_form_title( $payment->meta, true );
336
+				$value = '<a href="'.get_permalink($payment->form_id).'">'.$payment->form_title.'</a>';
337
+				$level = give_get_payment_form_title($payment->meta, true);
338 338
 
339
-				if ( ! empty( $level ) ) {
339
+				if ( ! empty($level)) {
340 340
 					$value .= $level;
341 341
 				}
342 342
 
343 343
 				break;
344 344
 
345 345
 			case 'date' :
346
-				$date  = strtotime( $payment->date );
347
-				$value = date_i18n( get_option( 'date_format' ), $date );
346
+				$date  = strtotime($payment->date);
347
+				$value = date_i18n(get_option('date_format'), $date);
348 348
 				break;
349 349
 
350 350
 			case 'status' :
351
-                $value = $this->get_payment_status( $payment );
351
+                $value = $this->get_payment_status($payment);
352 352
 				break;
353 353
 
354 354
 			case 'details' :
355
-				$value = '<div class="give-payment-details-link-wrap"><a href="' . esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ) . '" class="give-payment-details-link button button-small" title="'. __( 'View Details', 'give' ) . '"><span class="dashicons dashicons-visibility"></span></a></div>';
355
+				$value = '<div class="give-payment-details-link-wrap"><a href="'.esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))).'" class="give-payment-details-link button button-small" title="'.__('View Details', 'give').'"><span class="dashicons dashicons-visibility"></span></a></div>';
356 356
 				break;
357 357
 
358 358
 			default:
359
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
359
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
360 360
 				break;
361 361
 
362 362
 		}
363 363
 
364
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
364
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
365 365
 	}
366 366
 
367 367
 	/**
@@ -374,40 +374,40 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return string                Data shown in the Email column
376 376
 	 */
377
-	public function get_donor_email( $payment ) {
377
+	public function get_donor_email($payment) {
378 378
 
379 379
 		$row_actions = array();
380 380
 
381
-		$email = give_get_payment_user_email( $payment->ID );
381
+		$email = give_get_payment_user_email($payment->ID);
382 382
 
383 383
 		// Add search term string back to base URL
384
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
385
-		if ( ! empty( $search_terms ) ) {
386
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
384
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
385
+		if ( ! empty($search_terms)) {
386
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
387 387
 		}
388 388
 
389
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
390
-			$row_actions['email_links'] = '<a href="' . add_query_arg( array(
389
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
390
+			$row_actions['email_links'] = '<a href="'.add_query_arg(array(
391 391
 					'give-action' => 'email_links',
392 392
 					'purchase_id' => $payment->ID
393
-				), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>';
393
+				), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>';
394 394
 
395 395
 		}
396 396
 
397
-		$row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array(
397
+		$row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array(
398 398
 				'give-action' => 'delete_payment',
399 399
 				'purchase_id' => $payment->ID
400
-			), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
400
+			), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>';
401 401
 
402
-		$row_actions = apply_filters( 'give_payment_row_actions', $row_actions, $payment );
402
+		$row_actions = apply_filters('give_payment_row_actions', $row_actions, $payment);
403 403
 
404
-		if ( empty( $email ) ) {
405
-			$email = esc_html__( '(unknown)', 'give' );
404
+		if (empty($email)) {
405
+			$email = esc_html__('(unknown)', 'give');
406 406
 		}
407 407
 
408
-		$value = '<a href="mailto:' . $email . '">' . $email . '</a>' . $this->row_actions( $row_actions );
408
+		$value = '<a href="mailto:'.$email.'">'.$email.'</a>'.$this->row_actions($row_actions);
409 409
 
410
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
410
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
411 411
 	}
412 412
 
413 413
 
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
      *
422 422
      * @return string                Data shown in the Email column
423 423
      */
424
-	function get_payment_status( $payment ) {
425
-        $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
426
-        if ( $payment->mode == 'test' ) {
427
-            $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
424
+	function get_payment_status($payment) {
425
+        $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
426
+        if ($payment->mode == 'test') {
427
+            $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>';
428 428
         }
429 429
 
430 430
         return $value;
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @return string Displays a checkbox
442 442
 	 */
443
-	public function column_cb( $payment ) {
443
+	public function column_cb($payment) {
444 444
 		return sprintf(
445 445
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
446 446
 			'payment',
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
 	 *
459 459
 	 * @return string Displays a checkbox
460 460
 	 */
461
-	public function get_payment_id( $payment ) {
462
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
461
+	public function get_payment_id($payment) {
462
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
463 463
 	}
464 464
 
465 465
 	/**
@@ -472,19 +472,19 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @return string Data shown in the User column
474 474
 	 */
475
-	public function get_donor( $payment ) {
475
+	public function get_donor($payment) {
476 476
 
477
-		$customer_id = give_get_payment_customer_id( $payment->ID );
477
+		$customer_id = give_get_payment_customer_id($payment->ID);
478 478
 
479
-		if ( ! empty( $customer_id ) ) {
480
-			$customer = new Give_Customer( $customer_id );
481
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
479
+		if ( ! empty($customer_id)) {
480
+			$customer = new Give_Customer($customer_id);
481
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
482 482
 		} else {
483
-			$email = give_get_payment_user_email( $payment->ID );
484
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
483
+			$email = give_get_payment_user_email($payment->ID);
484
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
485 485
 		}
486 486
 
487
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
487
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
488 488
 	}
489 489
 
490 490
 	/**
@@ -496,18 +496,18 @@  discard block
 block discarded – undo
496 496
 	 */
497 497
 	public function get_bulk_actions() {
498 498
 		$actions = array(
499
-			'delete'               => esc_html__( 'Delete', 'give' ),
500
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
501
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
502
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
503
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
504
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
505
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
506
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
507
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' )
499
+			'delete'               => esc_html__('Delete', 'give'),
500
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
501
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
502
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
503
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
504
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
505
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
506
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
507
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give')
508 508
 		);
509 509
 
510
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
510
+		return apply_filters('give_payments_table_bulk_actions', $actions);
511 511
 	}
512 512
 
513 513
 	/**
@@ -518,59 +518,59 @@  discard block
 block discarded – undo
518 518
 	 * @return void
519 519
 	 */
520 520
 	public function process_bulk_action() {
521
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
521
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
522 522
 		$action = $this->current_action();
523 523
 
524
-		if ( ! is_array( $ids ) ) {
525
-			$ids = array( $ids );
524
+		if ( ! is_array($ids)) {
525
+			$ids = array($ids);
526 526
 		}
527 527
 
528
-		if ( empty( $action ) ) {
528
+		if (empty($action)) {
529 529
 			return;
530 530
 		}
531 531
 
532
-		foreach ( $ids as $id ) {
532
+		foreach ($ids as $id) {
533 533
 
534 534
 			// Detect when a bulk action is being triggered...
535
-			switch ( $this->current_action() ) {
535
+			switch ($this->current_action()) {
536 536
 
537 537
 				case'delete':
538
-					give_delete_purchase( $id );
538
+					give_delete_purchase($id);
539 539
 					break;
540 540
 
541 541
 				case 'set-status-publish':
542
-					give_update_payment_status( $id, 'publish' );
542
+					give_update_payment_status($id, 'publish');
543 543
 					break;
544 544
 
545 545
 				case 'set-status-pending':
546
-					give_update_payment_status( $id, 'pending' );
546
+					give_update_payment_status($id, 'pending');
547 547
 					break;
548 548
 
549 549
 				case 'set-status-refunded':
550
-					give_update_payment_status( $id, 'refunded' );
550
+					give_update_payment_status($id, 'refunded');
551 551
 					break;
552 552
 				case 'set-status-revoked':
553
-					give_update_payment_status( $id, 'revoked' );
553
+					give_update_payment_status($id, 'revoked');
554 554
 					break;
555 555
 
556 556
 				case 'set-status-failed':
557
-					give_update_payment_status( $id, 'failed' );
557
+					give_update_payment_status($id, 'failed');
558 558
 					break;
559 559
 
560 560
 				case 'set-status-cancelled':
561
-					give_update_payment_status( $id, 'cancelled' );
561
+					give_update_payment_status($id, 'cancelled');
562 562
 					break;
563 563
 
564 564
 				case 'set-status-abandoned':
565
-					give_update_payment_status( $id, 'abandoned' );
565
+					give_update_payment_status($id, 'abandoned');
566 566
 					break;
567 567
 
568 568
 				case 'set-status-preapproval':
569
-					give_update_payment_status( $id, 'preapproval' );
569
+					give_update_payment_status($id, 'preapproval');
570 570
 					break;
571 571
 
572 572
 				case 'resend-receipt':
573
-					give_email_donation_receipt( $id, false );
573
+					give_email_donation_receipt($id, false);
574 574
 					break;
575 575
 			}
576 576
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 			 * @param int    $id             The ID of the payment.
583 583
 			 * @param string $current_action The action that is being triggered.
584 584
 			 */
585
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
585
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
586 586
 		}
587 587
 
588 588
 	}
@@ -600,27 +600,27 @@  discard block
 block discarded – undo
600 600
 
601 601
 		$args = array();
602 602
 
603
-		if ( isset( $_GET['user'] ) ) {
604
-			$args['user'] = urldecode( $_GET['user'] );
605
-		} elseif ( isset( $_GET['s'] ) ) {
606
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
607
-			if ( $is_user ) {
608
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
609
-				unset( $args['s'] );
603
+		if (isset($_GET['user'])) {
604
+			$args['user'] = urldecode($_GET['user']);
605
+		} elseif (isset($_GET['s'])) {
606
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
607
+			if ($is_user) {
608
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
609
+				unset($args['s']);
610 610
 			} else {
611
-				$args['s'] = sanitize_text_field( $_GET['s'] );
611
+				$args['s'] = sanitize_text_field($_GET['s']);
612 612
 			}
613 613
 		}
614 614
 
615
-		if ( ! empty( $_GET['start-date'] ) ) {
616
-			$args['start-date'] = urldecode( $_GET['start-date'] );
615
+		if ( ! empty($_GET['start-date'])) {
616
+			$args['start-date'] = urldecode($_GET['start-date']);
617 617
 		}
618 618
 
619
-		if ( ! empty( $_GET['end-date'] ) ) {
620
-			$args['end-date'] = urldecode( $_GET['end-date'] );
619
+		if ( ! empty($_GET['end-date'])) {
620
+			$args['end-date'] = urldecode($_GET['end-date']);
621 621
 		}
622 622
 
623
-		$payment_count         = give_count_payments( $args );
623
+		$payment_count         = give_count_payments($args);
624 624
 		$this->complete_count  = $payment_count->publish;
625 625
 		$this->pending_count   = $payment_count->pending;
626 626
 		$this->refunded_count  = $payment_count->refunded;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 		$this->cancelled_count = $payment_count->cancelled;
630 630
 		$this->abandoned_count = $payment_count->abandoned;
631 631
 
632
-		foreach ( $payment_count as $count ) {
632
+		foreach ($payment_count as $count) {
633 633
 			$this->total_count += $count;
634 634
 		}
635 635
 	}
@@ -644,26 +644,26 @@  discard block
 block discarded – undo
644 644
 	public function payments_data() {
645 645
 
646 646
 		$per_page   = $this->per_page;
647
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
648
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
649
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
650
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
651
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
652
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
653
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
654
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
655
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
656
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
657
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
658
-
659
-		if ( ! empty( $search ) ) {
647
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
648
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
649
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
650
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
651
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
652
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
653
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
654
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
655
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
656
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
657
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
658
+
659
+		if ( ! empty($search)) {
660 660
 			$status = 'any'; // Force all payment statuses when searching
661 661
 		}
662 662
 
663 663
 		$args = array(
664 664
 			'output'     => 'payments',
665 665
 			'number'     => $per_page,
666
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
666
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
667 667
 			'orderby'    => $orderby,
668 668
 			'order'      => $order,
669 669
 			'user'       => $user,
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 			'end_date'   => $end_date,
678 678
 		);
679 679
 
680
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
680
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
681 681
 
682 682
 			$args['search_in_notes'] = true;
683
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
683
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
684 684
 
685 685
 		}
686 686
 
687
-		$p_query = new Give_Payments_Query( $args );
687
+		$p_query = new Give_Payments_Query($args);
688 688
 
689 689
 		return $p_query->get_payments();
690 690
 
@@ -704,17 +704,17 @@  discard block
 block discarded – undo
704 704
 	 */
705 705
 	public function prepare_items() {
706 706
 
707
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
707
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
708 708
 
709 709
 		$columns  = $this->get_columns();
710 710
 		$hidden   = array(); // No hidden columns
711 711
 		$sortable = $this->get_sortable_columns();
712 712
 		$data     = $this->payments_data();
713
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
713
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
714 714
 
715
-		$this->_column_headers = array( $columns, $hidden, $sortable );
715
+		$this->_column_headers = array($columns, $hidden, $sortable);
716 716
 
717
-		switch ( $status ) {
717
+		switch ($status) {
718 718
 			case 'publish':
719 719
 				$total_items = $this->complete_count;
720 720
 				break;
@@ -741,19 +741,19 @@  discard block
 block discarded – undo
741 741
 				break;
742 742
 			default:
743 743
 				// Retrieve the count of the non-default-Give status
744
-				$count       = wp_count_posts( 'give_payment' );
744
+				$count       = wp_count_posts('give_payment');
745 745
 				$total_items = $count->{$status};
746 746
 				break;
747 747
 		}
748 748
 
749 749
 		$this->items = $data;
750 750
 
751
-		$this->set_pagination_args( array(
751
+		$this->set_pagination_args(array(
752 752
 				'total_items' => $total_items,
753 753
 				// WE have to calculate the total number of items
754 754
 				'per_page'    => $this->per_page,
755 755
 				// WE have to determine how many items to show on a page
756
-				'total_pages' => ceil( $total_items / $this->per_page )
756
+				'total_pages' => ceil($total_items / $this->per_page)
757 757
 				// WE have to calculate the total number of pages
758 758
 			)
759 759
 		);
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	// Retrieve the payment ID
38 38
 	$payment_id = absint( $data['give_payment_id'] );
39 39
 
40
-    /* @var Give_Payment $payment */
40
+	/* @var Give_Payment $payment */
41 41
 	$payment    = new Give_Payment( $payment_id );
42 42
 
43 43
 	// Retrieve existing payment meta
@@ -160,23 +160,23 @@  discard block
 block discarded – undo
160 160
 
161 161
 		if ( 'publish' == $status ) {
162 162
 
163
-            // Reduce previous user donation count and amount.
164
-            $previous_customer->decrease_purchase_count();
165
-            $previous_customer->decrease_value( $curr_total );
163
+			// Reduce previous user donation count and amount.
164
+			$previous_customer->decrease_purchase_count();
165
+			$previous_customer->decrease_value( $curr_total );
166 166
 
167
-            // If purchase was completed adjust stats of new customers.
168
-            $customer->increase_purchase_count();
167
+			// If purchase was completed adjust stats of new customers.
168
+			$customer->increase_purchase_count();
169 169
 			$customer->increase_value( $new_total );
170 170
 		}
171 171
 
172 172
 		$payment->customer_id = $customer->id;
173 173
 	} else{
174 174
 
175
-	    if( 'publish' === $status ){
176
-            // Update user donation stat.
177
-            $customer->update_donation_value( $curr_total, $new_total );
178
-        }
179
-    }
175
+		if( 'publish' === $status ){
176
+			// Update user donation stat.
177
+			$customer->update_donation_value( $curr_total, $new_total );
178
+		}
179
+	}
180 180
 
181 181
 	// Set new meta values
182 182
 	$payment->user_id    = $customer->user_id;
@@ -217,76 +217,76 @@  discard block
 block discarded – undo
217 217
 
218 218
 	$payment->save();
219 219
 
220
-    // Get new give form ID.
221
-    $new_form_id = absint( $data['forms'] );
222
-    $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
220
+	// Get new give form ID.
221
+	$new_form_id = absint( $data['forms'] );
222
+	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
223 223
 
224
-    // We are adding payment transfer code in last to remove any conflict with above functionality.
225
-    // For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
226
-    /* Check if user want to transfer current payment to new give form id. */
227
-    if( $new_form_id != $current_form_id  ) {
224
+	// We are adding payment transfer code in last to remove any conflict with above functionality.
225
+	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
226
+	/* Check if user want to transfer current payment to new give form id. */
227
+	if( $new_form_id != $current_form_id  ) {
228 228
 
229
-        // Get new give form title.
230
-        $new_form_title = get_the_title( $new_form_id );
229
+		// Get new give form title.
230
+		$new_form_title = get_the_title( $new_form_id );
231 231
 
232
-        // Update new give form data in payment data.
233
-        $payment_meta = $payment->get_meta();
234
-        $payment_meta['form_title'] = $new_form_title;
235
-        $payment_meta['form_id']    = $new_form_id;
232
+		// Update new give form data in payment data.
233
+		$payment_meta = $payment->get_meta();
234
+		$payment_meta['form_title'] = $new_form_title;
235
+		$payment_meta['form_id']    = $new_form_id;
236 236
 
237
-        // Update price id post meta data for set donation form.
238
-        if( ! give_has_variable_prices( $new_form_id ) ) {
239
-            $payment_meta['price_id'] = '';
240
-        }
237
+		// Update price id post meta data for set donation form.
238
+		if( ! give_has_variable_prices( $new_form_id ) ) {
239
+			$payment_meta['price_id'] = '';
240
+		}
241 241
 
242
-        // Update payment give form meta data.
243
-        $payment->update_meta( '_give_payment_form_id', $new_form_id );
244
-        $payment->update_meta( '_give_payment_form_title', $new_form_title );
245
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
242
+		// Update payment give form meta data.
243
+		$payment->update_meta( '_give_payment_form_id', $new_form_id );
244
+		$payment->update_meta( '_give_payment_form_title', $new_form_title );
245
+		$payment->update_meta( '_give_payment_meta', $payment_meta );
246 246
 
247
-        // Update price id payment metadata.
248
-        if( ! give_has_variable_prices( $new_form_id ) ) {
249
-            $payment->update_meta( '_give_payment_price_id', '' );
250
-        }
247
+		// Update price id payment metadata.
248
+		if( ! give_has_variable_prices( $new_form_id ) ) {
249
+			$payment->update_meta( '_give_payment_price_id', '' );
250
+		}
251 251
 
252 252
 
253
-        // If purchase was completed, adjust stats of forms
254
-        if ( 'publish' == $status ) {
253
+		// If purchase was completed, adjust stats of forms
254
+		if ( 'publish' == $status ) {
255 255
 
256
-            // Decrease sale of old give form. For other payment status 
257
-            $current_form = new Give_Donate_Form( $current_form_id );
258
-            $current_form->decrease_sales();
259
-            $current_form->decrease_earnings( $curr_total );
256
+			// Decrease sale of old give form. For other payment status 
257
+			$current_form = new Give_Donate_Form( $current_form_id );
258
+			$current_form->decrease_sales();
259
+			$current_form->decrease_earnings( $curr_total );
260 260
             
261
-            // Increase sale of new give form.
262
-            $new_form = new Give_Donate_Form($new_form_id);
263
-            $new_form->increase_sales();
264
-            $new_form->increase_earnings($new_total);
265
-        }
261
+			// Increase sale of new give form.
262
+			$new_form = new Give_Donate_Form($new_form_id);
263
+			$new_form->increase_sales();
264
+			$new_form->increase_earnings($new_total);
265
+		}
266 266
 
267
-        // Re setup payment to update new meta value in object.
268
-        $payment->update_payment_setup( $payment->ID );
269
-    }
267
+		// Re setup payment to update new meta value in object.
268
+		$payment->update_payment_setup( $payment->ID );
269
+	}
270 270
 
271
-    // Update price id if current form is variable form.
272
-    if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
271
+	// Update price id if current form is variable form.
272
+	if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
273 273
 
274
-        // Get payment meta data.
275
-        $payment_meta = $payment->get_meta();
274
+		// Get payment meta data.
275
+		$payment_meta = $payment->get_meta();
276 276
 
277
-        // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
278
-        $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
277
+		// Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
278
+		$data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
279 279
 
280
-        // Update payment meta data.
281
-        $payment_meta['price_id'] = $data['give-variable-price'];
280
+		// Update payment meta data.
281
+		$payment_meta['price_id'] = $data['give-variable-price'];
282 282
 
283
-        // Update payment give form meta data.
284
-        $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
285
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
283
+		// Update payment give form meta data.
284
+		$payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
285
+		$payment->update_meta( '_give_payment_meta', $payment_meta );
286 286
 
287
-        // Re setup payment to update new meta value in object.
288
-        $payment->update_payment_setup( $payment->ID );
289
-    }
287
+		// Re setup payment to update new meta value in object.
288
+		$payment->update_payment_setup( $payment->ID );
289
+	}
290 290
 
291 291
 	/**
292 292
 	 * Fires after updating edited purchase.
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,52 +26,52 @@  discard block
 block discarded – undo
26 26
  * @return      void
27 27
  *
28 28
  */
29
-function give_update_payment_details( $data ) {
29
+function give_update_payment_details($data) {
30 30
 
31
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
32
-		wp_die( esc_html__( 'You do not have permission to edit payment records.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
31
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
32
+		wp_die(esc_html__('You do not have permission to edit payment records.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
33 33
 	}
34 34
 
35
-	check_admin_referer( 'give_update_payment_details_nonce' );
35
+	check_admin_referer('give_update_payment_details_nonce');
36 36
 
37 37
 	// Retrieve the payment ID
38
-	$payment_id = absint( $data['give_payment_id'] );
38
+	$payment_id = absint($data['give_payment_id']);
39 39
 
40 40
     /* @var Give_Payment $payment */
41
-	$payment    = new Give_Payment( $payment_id );
41
+	$payment    = new Give_Payment($payment_id);
42 42
 
43 43
 	// Retrieve existing payment meta
44 44
 	$meta      = $payment->get_meta();
45 45
 	$user_info = $payment->user_info;
46 46
 
47 47
 	$status = $data['give-payment-status'];
48
-	$date   = sanitize_text_field( $data['give-payment-date'] );
49
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
48
+	$date   = sanitize_text_field($data['give-payment-date']);
49
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
50 50
 
51 51
 	// Restrict to our high and low
52
-	if ( $hour > 23 ) {
52
+	if ($hour > 23) {
53 53
 		$hour = 23;
54
-	} elseif ( $hour < 0 ) {
54
+	} elseif ($hour < 0) {
55 55
 		$hour = 00;
56 56
 	}
57 57
 
58
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
58
+	$minute = sanitize_text_field($data['give-payment-time-min']);
59 59
 
60 60
 	// Restrict to our high and low
61
-	if ( $minute > 59 ) {
61
+	if ($minute > 59) {
62 62
 		$minute = 59;
63
-	} elseif ( $minute < 0 ) {
63
+	} elseif ($minute < 0) {
64 64
 		$minute = 00;
65 65
 	}
66 66
 
67
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
67
+	$address = array_map('trim', $data['give-payment-address'][0]);
68 68
 
69
-	$curr_total = give_sanitize_amount( $payment->total );
70
-	$new_total  = give_sanitize_amount( $data['give-payment-total'] );
71
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
69
+	$curr_total = give_sanitize_amount($payment->total);
70
+	$new_total  = give_sanitize_amount($data['give-payment-total']);
71
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
72 72
 
73
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
74
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
73
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
74
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
75 75
 
76 76
 	/**
77 77
 	 * Fires before updating edited purchase.
@@ -80,62 +80,62 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $payment_id The ID of the payment.
82 82
 	 */
83
-	do_action( 'give_update_edited_purchase', $payment_id );
83
+	do_action('give_update_edited_purchase', $payment_id);
84 84
 
85 85
 	$payment->date = $date;
86 86
 	$updated       = $payment->save();
87 87
 
88
-	if ( 0 === $updated ) {
89
-		wp_die( esc_html__( 'Error Updating Payment.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
88
+	if (0 === $updated) {
89
+		wp_die(esc_html__('Error Updating Payment.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
90 90
 	}
91 91
 
92 92
 
93 93
 	$customer_changed = false;
94 94
 
95
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
95
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
96 96
 
97
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
98
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
97
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
98
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
99 99
 
100
-		if ( empty( $email ) || empty( $names ) ) {
101
-			wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
100
+		if (empty($email) || empty($names)) {
101
+			wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
102 102
 		}
103 103
 
104
-		$customer = new Give_Customer( $email );
105
-		if ( empty( $customer->id ) ) {
106
-			$customer_data = array( 'name' => $names, 'email' => $email );
107
-			$user_id       = email_exists( $email );
108
-			if ( false !== $user_id ) {
104
+		$customer = new Give_Customer($email);
105
+		if (empty($customer->id)) {
106
+			$customer_data = array('name' => $names, 'email' => $email);
107
+			$user_id       = email_exists($email);
108
+			if (false !== $user_id) {
109 109
 				$customer_data['user_id'] = $user_id;
110 110
 			}
111 111
 
112
-			if ( ! $customer->create( $customer_data ) ) {
112
+			if ( ! $customer->create($customer_data)) {
113 113
 				// Failed to crete the new donor, assume the previous donor
114 114
 				$customer_changed = false;
115
-				$customer         = new Give_Customer( $curr_customer_id );
116
-				give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) );
115
+				$customer         = new Give_Customer($curr_customer_id);
116
+				give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give'));
117 117
 			}
118 118
 		}
119 119
 
120 120
 		$new_customer_id = $customer->id;
121 121
 
122
-		$previous_customer = new Give_Customer( $curr_customer_id );
122
+		$previous_customer = new Give_Customer($curr_customer_id);
123 123
 
124 124
 		$customer_changed = true;
125 125
 
126
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
126
+	} elseif ($curr_customer_id !== $new_customer_id) {
127 127
 
128
-		$customer = new Give_Customer( $new_customer_id );
128
+		$customer = new Give_Customer($new_customer_id);
129 129
 		$email    = $customer->email;
130 130
 		$names    = $customer->name;
131 131
 
132
-		$previous_customer = new Give_Customer( $curr_customer_id );
132
+		$previous_customer = new Give_Customer($curr_customer_id);
133 133
 
134 134
 		$customer_changed = true;
135 135
 
136 136
 	} else {
137 137
 
138
-		$customer = new Give_Customer( $curr_customer_id );
138
+		$customer = new Give_Customer($curr_customer_id);
139 139
 		$email    = $customer->email;
140 140
 		$names    = $customer->name;
141 141
 
@@ -143,38 +143,38 @@  discard block
 block discarded – undo
143 143
 
144 144
 
145 145
 	// Setup first and last name from input values
146
-	$names      = explode( ' ', $names );
147
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
146
+	$names      = explode(' ', $names);
147
+	$first_name = ! empty($names[0]) ? $names[0] : '';
148 148
 	$last_name  = '';
149
-	if ( ! empty( $names[1] ) ) {
150
-		unset( $names[0] );
151
-		$last_name = implode( ' ', $names );
149
+	if ( ! empty($names[1])) {
150
+		unset($names[0]);
151
+		$last_name = implode(' ', $names);
152 152
 	}
153 153
 
154 154
 
155
-	if ( $customer_changed ) {
155
+	if ($customer_changed) {
156 156
 
157 157
 		// Remove the stats and payment from the previous customer and attach it to the new customer
158
-		$previous_customer->remove_payment( $payment_id, false );
159
-		$customer->attach_payment( $payment_id, false );
158
+		$previous_customer->remove_payment($payment_id, false);
159
+		$customer->attach_payment($payment_id, false);
160 160
 
161
-		if ( 'publish' == $status ) {
161
+		if ('publish' == $status) {
162 162
 
163 163
             // Reduce previous user donation count and amount.
164 164
             $previous_customer->decrease_purchase_count();
165
-            $previous_customer->decrease_value( $curr_total );
165
+            $previous_customer->decrease_value($curr_total);
166 166
 
167 167
             // If purchase was completed adjust stats of new customers.
168 168
             $customer->increase_purchase_count();
169
-			$customer->increase_value( $new_total );
169
+			$customer->increase_value($new_total);
170 170
 		}
171 171
 
172 172
 		$payment->customer_id = $customer->id;
173
-	} else{
173
+	} else {
174 174
 
175
-	    if( 'publish' === $status ){
175
+	    if ('publish' === $status) {
176 176
             // Update user donation stat.
177
-            $customer->update_donation_value( $curr_total, $new_total );
177
+            $customer->update_donation_value($curr_total, $new_total);
178 178
         }
179 179
     }
180 180
 
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
 	// Check for payment notes
191
-	if ( ! empty( $data['give-payment-note'] ) ) {
191
+	if ( ! empty($data['give-payment-note'])) {
192 192
 
193
-		$note = wp_kses( $data['give-payment-note'], array() );
194
-		give_insert_payment_note( $payment_id, $note );
193
+		$note = wp_kses($data['give-payment-note'], array());
194
+		give_insert_payment_note($payment_id, $note);
195 195
 
196 196
 	}
197 197
 
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	$payment->status = $status;
200 200
 
201 201
 	// Adjust total store earnings if the payment total has been changed
202
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
202
+	if ($new_total !== $curr_total && 'publish' == $status) {
203 203
 
204
-		if ( $new_total > $curr_total ) {
204
+		if ($new_total > $curr_total) {
205 205
 			// Increase if our new total is higher
206 206
 			$difference = $new_total - $curr_total;
207
-			give_increase_total_earnings( $difference );
207
+			give_increase_total_earnings($difference);
208 208
 
209
-		} elseif ( $curr_total > $new_total ) {
209
+		} elseif ($curr_total > $new_total) {
210 210
 			// Decrease if our new total is lower
211 211
 			$difference = $curr_total - $new_total;
212
-			give_decrease_total_earnings( $difference );
212
+			give_decrease_total_earnings($difference);
213 213
 
214 214
 		}
215 215
 
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 	$payment->save();
219 219
 
220 220
     // Get new give form ID.
221
-    $new_form_id = absint( $data['forms'] );
222
-    $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
221
+    $new_form_id = absint($data['forms']);
222
+    $current_form_id = absint($payment->get_meta('_give_payment_form_id'));
223 223
 
224 224
     // We are adding payment transfer code in last to remove any conflict with above functionality.
225 225
     // For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
226 226
     /* Check if user want to transfer current payment to new give form id. */
227
-    if( $new_form_id != $current_form_id  ) {
227
+    if ($new_form_id != $current_form_id) {
228 228
 
229 229
         // Get new give form title.
230
-        $new_form_title = get_the_title( $new_form_id );
230
+        $new_form_title = get_the_title($new_form_id);
231 231
 
232 232
         // Update new give form data in payment data.
233 233
         $payment_meta = $payment->get_meta();
@@ -235,28 +235,28 @@  discard block
 block discarded – undo
235 235
         $payment_meta['form_id']    = $new_form_id;
236 236
 
237 237
         // Update price id post meta data for set donation form.
238
-        if( ! give_has_variable_prices( $new_form_id ) ) {
238
+        if ( ! give_has_variable_prices($new_form_id)) {
239 239
             $payment_meta['price_id'] = '';
240 240
         }
241 241
 
242 242
         // Update payment give form meta data.
243
-        $payment->update_meta( '_give_payment_form_id', $new_form_id );
244
-        $payment->update_meta( '_give_payment_form_title', $new_form_title );
245
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
243
+        $payment->update_meta('_give_payment_form_id', $new_form_id);
244
+        $payment->update_meta('_give_payment_form_title', $new_form_title);
245
+        $payment->update_meta('_give_payment_meta', $payment_meta);
246 246
 
247 247
         // Update price id payment metadata.
248
-        if( ! give_has_variable_prices( $new_form_id ) ) {
249
-            $payment->update_meta( '_give_payment_price_id', '' );
248
+        if ( ! give_has_variable_prices($new_form_id)) {
249
+            $payment->update_meta('_give_payment_price_id', '');
250 250
         }
251 251
 
252 252
 
253 253
         // If purchase was completed, adjust stats of forms
254
-        if ( 'publish' == $status ) {
254
+        if ('publish' == $status) {
255 255
 
256 256
             // Decrease sale of old give form. For other payment status 
257
-            $current_form = new Give_Donate_Form( $current_form_id );
257
+            $current_form = new Give_Donate_Form($current_form_id);
258 258
             $current_form->decrease_sales();
259
-            $current_form->decrease_earnings( $curr_total );
259
+            $current_form->decrease_earnings($curr_total);
260 260
             
261 261
             // Increase sale of new give form.
262 262
             $new_form = new Give_Donate_Form($new_form_id);
@@ -265,27 +265,27 @@  discard block
 block discarded – undo
265 265
         }
266 266
 
267 267
         // Re setup payment to update new meta value in object.
268
-        $payment->update_payment_setup( $payment->ID );
268
+        $payment->update_payment_setup($payment->ID);
269 269
     }
270 270
 
271 271
     // Update price id if current form is variable form.
272
-    if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
272
+    if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) {
273 273
 
274 274
         // Get payment meta data.
275 275
         $payment_meta = $payment->get_meta();
276 276
 
277 277
         // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
278
-        $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
278
+        $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : '';
279 279
 
280 280
         // Update payment meta data.
281 281
         $payment_meta['price_id'] = $data['give-variable-price'];
282 282
 
283 283
         // Update payment give form meta data.
284
-        $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
285
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
284
+        $payment->update_meta('_give_payment_price_id', $data['give-variable-price']);
285
+        $payment->update_meta('_give_payment_meta', $payment_meta);
286 286
 
287 287
         // Re setup payment to update new meta value in object.
288
-        $payment->update_payment_setup( $payment->ID );
288
+        $payment->update_payment_setup($payment->ID);
289 289
     }
290 290
 
291 291
 	/**
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @param int $payment_id The ID of the payment.
297 297
 	 */
298
-	do_action( 'give_updated_edited_purchase', $payment_id );
298
+	do_action('give_updated_edited_purchase', $payment_id);
299 299
 
300
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
300
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
301 301
 	exit;
302 302
 }
303 303
 
304
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
304
+add_action('give_update_payment_details', 'give_update_payment_details');
305 305
 
306 306
 /**
307 307
  * Trigger a Purchase Deletion
@@ -312,48 +312,48 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @return void
314 314
  */
315
-function give_trigger_purchase_delete( $data ) {
316
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) {
315
+function give_trigger_purchase_delete($data) {
316
+	if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) {
317 317
 
318
-		$payment_id = absint( $data['purchase_id'] );
318
+		$payment_id = absint($data['purchase_id']);
319 319
 
320
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
321
-			wp_die( esc_html__( 'You do not have permission to edit payment records.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
320
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
321
+			wp_die(esc_html__('You do not have permission to edit payment records.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
322 322
 		}
323 323
 
324
-		give_delete_purchase( $payment_id );
325
-		wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) );
324
+		give_delete_purchase($payment_id);
325
+		wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted'));
326 326
 		give_die();
327 327
 	}
328 328
 }
329 329
 
330
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
330
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
331 331
 
332 332
 /**
333 333
  * AJAX Store Payment Note
334 334
  */
335 335
 function give_ajax_store_payment_note() {
336 336
 
337
-	$payment_id = absint( $_POST['payment_id'] );
338
-	$note       = wp_kses( $_POST['note'], array() );
337
+	$payment_id = absint($_POST['payment_id']);
338
+	$note       = wp_kses($_POST['note'], array());
339 339
 
340
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
341
-		wp_die( esc_html__( 'You do not have permission to edit payment records.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
340
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
341
+		wp_die(esc_html__('You do not have permission to edit payment records.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
342 342
 	}
343 343
 
344
-	if ( empty( $payment_id ) ) {
345
-		die( '-1' );
344
+	if (empty($payment_id)) {
345
+		die('-1');
346 346
 	}
347 347
 
348
-	if ( empty( $note ) ) {
349
-		die( '-1' );
348
+	if (empty($note)) {
349
+		die('-1');
350 350
 	}
351 351
 
352
-	$note_id = give_insert_payment_note( $payment_id, $note );
353
-	die( give_get_payment_note_html( $note_id ) );
352
+	$note_id = give_insert_payment_note($payment_id, $note);
353
+	die(give_get_payment_note_html($note_id));
354 354
 }
355 355
 
356
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
356
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
357 357
 
358 358
 /**
359 359
  * Triggers a payment note deletion without ajax
@@ -364,24 +364,24 @@  discard block
 block discarded – undo
364 364
  *
365 365
  * @return void
366 366
  */
367
-function give_trigger_payment_note_deletion( $data ) {
367
+function give_trigger_payment_note_deletion($data) {
368 368
 
369
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
369
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
370 370
 		return;
371 371
 	}
372 372
 
373
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
374
-		wp_die( esc_html__( 'You do not have permission to edit payment records.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
373
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
374
+		wp_die(esc_html__('You do not have permission to edit payment records.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
375 375
 	}
376 376
 
377
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) );
377
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id']));
378 378
 
379
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
379
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
380 380
 
381
-	wp_redirect( $edit_order_url );
381
+	wp_redirect($edit_order_url);
382 382
 }
383 383
 
384
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
384
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
385 385
 
386 386
 /**
387 387
  * Delete a payment note deletion with ajax
@@ -392,16 +392,16 @@  discard block
 block discarded – undo
392 392
  */
393 393
 function give_ajax_delete_payment_note() {
394 394
 
395
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
396
-		wp_die( esc_html__( 'You do not have permission to edit payment records.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
395
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
396
+		wp_die(esc_html__('You do not have permission to edit payment records.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
397 397
 	}
398 398
 
399
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
400
-		die( '1' );
399
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
400
+		die('1');
401 401
 	} else {
402
-		die( '-1' );
402
+		die('-1');
403 403
 	}
404 404
 
405 405
 }
406 406
 
407
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
408 407
\ No newline at end of file
408
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
409 409
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,50 +54,50 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		if ( $this->step == 1 ) {
58
-			$this->delete_data( 'give_temp_recount_income' );
57
+		if ($this->step == 1) {
58
+			$this->delete_data('give_temp_recount_income');
59 59
 		}
60 60
 
61
-		$total = get_option( 'give_temp_recount_income', false );
61
+		$total = get_option('give_temp_recount_income', false);
62 62
 
63
-		if ( false === $total ) {
63
+		if (false === $total) {
64 64
 			$total = (float) 0;
65
-			$this->store_data( 'give_temp_recount_income', $total );
65
+			$this->store_data('give_temp_recount_income', $total);
66 66
 		}
67 67
 
68
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
68
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
69 69
 
70
-		$args = apply_filters( 'give_recount_income_args', array(
70
+		$args = apply_filters('give_recount_income_args', array(
71 71
 			'number' => $this->per_step,
72 72
 			'page'   => $this->step,
73 73
 			'status' => $accepted_statuses,
74 74
 			'fields' => 'ids'
75
-		) );
75
+		));
76 76
 
77
-		$payments = give_get_payments( $args );
77
+		$payments = give_get_payments($args);
78 78
 
79
-		if ( ! empty( $payments ) ) {
79
+		if ( ! empty($payments)) {
80 80
 
81
-			foreach ( $payments as $payment ) {
81
+			foreach ($payments as $payment) {
82 82
 
83
-				$total += give_get_payment_amount( $payment );
83
+				$total += give_get_payment_amount($payment);
84 84
 
85 85
 			}
86 86
 
87
-			if ( $total < 0 ) {
87
+			if ($total < 0) {
88 88
 				$totals = 0;
89 89
 			}
90 90
 
91
-			$total = round( $total, give_currency_decimal_filter() );
91
+			$total = round($total, give_currency_decimal_filter());
92 92
 
93
-			$this->store_data( 'give_temp_recount_income', $total );
93
+			$this->store_data('give_temp_recount_income', $total);
94 94
 
95 95
 			return true;
96 96
 
97 97
 		}
98 98
 
99
-		update_option( 'give_income_total', $total );
100
-		set_transient( 'give_income_total', $total, 86400 );
99
+		update_option('give_income_total', $total);
100
+		set_transient('give_income_total', $total, 86400);
101 101
 
102 102
 		return false;
103 103
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get_percentage_complete() {
113 113
 
114
-		$total = $this->get_stored_data( 'give_recount_income_total' );
114
+		$total = $this->get_stored_data('give_recount_income_total');
115 115
 
116
-		if ( false === $total ) {
117
-			$args = apply_filters( 'give_recount_income_total_args', array() );
116
+		if (false === $total) {
117
+			$args = apply_filters('give_recount_income_total_args', array());
118 118
 
119
-			$counts = give_count_payments( $args );
120
-			$total  = absint( $counts->publish );
121
-			$total  = apply_filters( 'give_recount_store_income_total', $total );
119
+			$counts = give_count_payments($args);
120
+			$total  = absint($counts->publish);
121
+			$total  = apply_filters('give_recount_store_income_total', $total);
122 122
 
123
-			$this->store_data( 'give_recount_income_total', $total );
123
+			$this->store_data('give_recount_income_total', $total);
124 124
 		}
125 125
 
126 126
 		$percentage = 100;
127 127
 
128
-		if ( $total > 0 ) {
129
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
128
+		if ($total > 0) {
129
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
130 130
 		}
131 131
 
132
-		if ( $percentage > 100 ) {
132
+		if ($percentage > 100) {
133 133
 			$percentage = 100;
134 134
 		}
135 135
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param array $request The Form Data passed into the batch processing
145 145
 	 */
146
-	public function set_properties( $request ) {
146
+	public function set_properties($request) {
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function process_step() {
156 156
 
157
-		if ( ! $this->can_export() ) {
158
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
157
+		if ( ! $this->can_export()) {
158
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
159 159
 		}
160 160
 
161 161
 		$had_data = $this->get_data();
162 162
 
163
-		if ( $had_data ) {
163
+		if ($had_data) {
164 164
 			$this->done = false;
165 165
 
166 166
 			return true;
167 167
 		} else {
168
-			$this->delete_data( 'give_recount_income_total' );
169
-			$this->delete_data( 'give_temp_recount_income' );
168
+			$this->delete_data('give_recount_income_total');
169
+			$this->delete_data('give_temp_recount_income');
170 170
 			$this->done    = true;
171
-			$this->message = esc_html__( 'Give income successfully recounted.', 'give' );
171
+			$this->message = esc_html__('Give income successfully recounted.', 'give');
172 172
 
173 173
 			return false;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	public function headers() {
178
-		ignore_user_abort( true );
178
+		ignore_user_abort(true);
179 179
 
180
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
181
-			set_time_limit( 0 );
180
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
181
+			set_time_limit(0);
182 182
 		}
183 183
 	}
184 184
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return mixed       Returns the data from the database
208 208
 	 */
209
-	private function get_stored_data( $key ) {
209
+	private function get_stored_data($key) {
210 210
 		global $wpdb;
211
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
211
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
212 212
 
213
-		return empty( $value ) ? false : maybe_unserialize( $value );
213
+		return empty($value) ? false : maybe_unserialize($value);
214 214
 	}
215 215
 
216 216
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	private function store_data( $key, $value ) {
226
+	private function store_data($key, $value) {
227 227
 		global $wpdb;
228 228
 
229
-		$value = maybe_serialize( $value );
229
+		$value = maybe_serialize($value);
230 230
 
231 231
 		$data = array(
232 232
 			'option_name'  => $key,
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'%s',
241 241
 		);
242 242
 
243
-		$wpdb->replace( $wpdb->options, $data, $formats );
243
+		$wpdb->replace($wpdb->options, $data, $formats);
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function delete_data( $key ) {
255
+	private function delete_data($key) {
256 256
 		global $wpdb;
257
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
257
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
258 258
 	}
259 259
 
260 260
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-all-stats.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -55,26 +55,26 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $give_logs, $wpdb;
57 57
 
58
-		$totals             = $this->get_stored_data( 'give_temp_recount_all_stats' );
59
-		$payment_items      = $this->get_stored_data( 'give_temp_payment_items' );
60
-		$processed_payments = $this->get_stored_data( 'give_temp_processed_payments' );
61
-		$accepted_statuses  = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
58
+		$totals             = $this->get_stored_data('give_temp_recount_all_stats');
59
+		$payment_items      = $this->get_stored_data('give_temp_payment_items');
60
+		$processed_payments = $this->get_stored_data('give_temp_processed_payments');
61
+		$accepted_statuses  = apply_filters('give_recount_accepted_statuses', array('publish'));
62 62
 
63
-		if ( false === $totals ) {
63
+		if (false === $totals) {
64 64
 			$totals = array();
65 65
 		}
66 66
 
67
-		if ( false === $payment_items ) {
67
+		if (false === $payment_items) {
68 68
 			$payment_items = array();
69 69
 		}
70 70
 
71
-		if ( false === $processed_payments ) {
71
+		if (false === $processed_payments) {
72 72
 			$processed_payments = array();
73 73
 		}
74 74
 
75
-		$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
75
+		$all_forms = $this->get_stored_data('give_temp_form_ids');
76 76
 
77
-		$args = apply_filters( 'give_recount_form_stats_args', array(
77
+		$args = apply_filters('give_recount_form_stats_args', array(
78 78
 			'post_parent__in' => $all_forms,
79 79
 			'post_type'       => 'give_log',
80 80
 			'posts_per_page'  => $this->per_step,
@@ -82,73 +82,73 @@  discard block
 block discarded – undo
82 82
 			'paged'           => $this->step,
83 83
 			'log_type'        => 'sale',
84 84
 			'fields'          => 'ids',
85
-		) );
85
+		));
86 86
 
87
-		$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
87
+		$log_ids = $give_logs->get_connected_logs($args, 'sale');
88 88
 
89
-		if ( $log_ids ) {
90
-			$log_ids = implode( ',', $log_ids );
89
+		if ($log_ids) {
90
+			$log_ids = implode(',', $log_ids);
91 91
 
92
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
93
-			unset( $log_ids );
92
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
93
+			unset($log_ids);
94 94
 
95
-			$payment_ids = implode( ',', $payment_ids );
96
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
97
-			unset( $payment_ids );
95
+			$payment_ids = implode(',', $payment_ids);
96
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
97
+			unset($payment_ids);
98 98
 
99 99
 			//Loop through payments
100
-			foreach ( $payments as $payment ) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Prevent payments that have all ready been retrieved from a previous sales log from counting again.
103
-				if ( in_array( $payment->ID, $processed_payments ) ) {
103
+				if (in_array($payment->ID, $processed_payments)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				//Verify accepted status'
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					$processed_payments[] = $payment->ID;
110 110
 					continue;
111 111
 				}
112 112
 
113
-				$payment_item = $payment_items[ $payment->ID ];
113
+				$payment_item = $payment_items[$payment->ID];
114 114
 
115 115
 
116
-				$form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : '';
116
+				$form_id = isset($payment_item['id']) ? $payment_item['id'] : '';
117 117
 
118 118
 				//Must have a form ID
119
-				if ( empty( $form_id ) ) {
119
+				if (empty($form_id)) {
120 120
 					continue;
121 121
 				}
122 122
 
123 123
 				//Form ID must be within $all_forms array to be validated
124
-				if ( ! in_array( $form_id, $all_forms ) ) {
124
+				if ( ! in_array($form_id, $all_forms)) {
125 125
 					continue;
126 126
 				}
127 127
 
128 128
 				//If array key doesn't exist, create it
129
-				if ( ! array_key_exists( $form_id, $totals ) ) {
130
-					$totals[ $form_id ] = array(
129
+				if ( ! array_key_exists($form_id, $totals)) {
130
+					$totals[$form_id] = array(
131 131
 						'sales'    => (int) 0,
132 132
 						'earnings' => (float) 0,
133 133
 					);
134 134
 				}
135 135
 
136
-				$totals[ $form_id ]['sales'] ++;
137
-				$totals[ $form_id ]['earnings'] += $payment_item['price'];
136
+				$totals[$form_id]['sales']++;
137
+				$totals[$form_id]['earnings'] += $payment_item['price'];
138 138
 
139 139
 				$processed_payments[] = $payment->ID;
140 140
 
141 141
 			}
142 142
 
143
-			$this->store_data( 'give_temp_processed_payments', $processed_payments );
144
-			$this->store_data( 'give_temp_recount_all_stats', $totals );
143
+			$this->store_data('give_temp_processed_payments', $processed_payments);
144
+			$this->store_data('give_temp_recount_all_stats', $totals);
145 145
 
146 146
 			return true;
147 147
 		}
148 148
 
149
-		foreach ( $totals as $key => $stats ) {
150
-			update_post_meta( $key, '_give_form_sales', $stats['sales'] );
151
-			update_post_meta( $key, '_give_form_earnings', $stats['earnings'] );
149
+		foreach ($totals as $key => $stats) {
150
+			update_post_meta($key, '_give_form_sales', $stats['sales']);
151
+			update_post_meta($key, '_give_form_earnings', $stats['earnings']);
152 152
 		}
153 153
 
154 154
 		return false;
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function get_percentage_complete() {
165 165
 
166
-		$total = $this->get_stored_data( 'give_recount_all_total', false );
166
+		$total = $this->get_stored_data('give_recount_all_total', false);
167 167
 
168
-		if ( false === $total ) {
168
+		if (false === $total) {
169 169
 			$this->pre_fetch();
170
-			$total = $this->get_stored_data( 'give_recount_all_total', 0 );
170
+			$total = $this->get_stored_data('give_recount_all_total', 0);
171 171
 		}
172 172
 
173 173
 		$percentage = 100;
174 174
 
175
-		if ( $total > 0 ) {
176
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
175
+		if ($total > 0) {
176
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
177 177
 		}
178 178
 
179
-		if ( $percentage > 100 ) {
179
+		if ($percentage > 100) {
180 180
 			$percentage = 100;
181 181
 		}
182 182
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @param array $request The Form Data passed into the batch processing
192 192
 	 */
193
-	public function set_properties( $request ) {
194
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
193
+	public function set_properties($request) {
194
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
195 195
 	}
196 196
 
197 197
 	/**
@@ -202,34 +202,34 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function process_step() {
204 204
 
205
-		if ( ! $this->can_export() ) {
206
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
205
+		if ( ! $this->can_export()) {
206
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
207 207
 		}
208 208
 
209 209
 		$had_data = $this->get_data();
210 210
 
211
-		if ( $had_data ) {
211
+		if ($had_data) {
212 212
 			$this->done = false;
213 213
 
214 214
 			return true;
215 215
 		} else {
216
-			$this->delete_data( 'give_recount_all_total' );
217
-			$this->delete_data( 'give_temp_recount_all_stats' );
218
-			$this->delete_data( 'give_temp_payment_items' );
219
-			$this->delete_data( 'give_temp_form_ids' );
220
-			$this->delete_data( 'give_temp_processed_payments' );
216
+			$this->delete_data('give_recount_all_total');
217
+			$this->delete_data('give_temp_recount_all_stats');
218
+			$this->delete_data('give_temp_payment_items');
219
+			$this->delete_data('give_temp_form_ids');
220
+			$this->delete_data('give_temp_processed_payments');
221 221
 			$this->done    = true;
222
-			$this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' );
222
+			$this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give');
223 223
 
224 224
 			return false;
225 225
 		}
226 226
 	}
227 227
 
228 228
 	public function headers() {
229
-		ignore_user_abort( true );
229
+		ignore_user_abort(true);
230 230
 
231
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
232
-			set_time_limit( 0 );
231
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
232
+			set_time_limit(0);
233 233
 		}
234 234
 	}
235 235
 
@@ -258,76 +258,76 @@  discard block
 block discarded – undo
258 258
 
259 259
 		global $give_logs, $wpdb;
260 260
 
261
-		if ( $this->step == 1 ) {
262
-			$this->delete_data( 'give_temp_recount_all_total' );
263
-			$this->delete_data( 'give_temp_recount_all_stats' );
264
-			$this->delete_data( 'give_temp_payment_items' );
265
-			$this->delete_data( 'give_temp_processed_payments' );
261
+		if ($this->step == 1) {
262
+			$this->delete_data('give_temp_recount_all_total');
263
+			$this->delete_data('give_temp_recount_all_stats');
264
+			$this->delete_data('give_temp_payment_items');
265
+			$this->delete_data('give_temp_processed_payments');
266 266
 		}
267 267
 
268
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
269
-		$total             = $this->get_stored_data( 'give_temp_recount_all_total' );
268
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
269
+		$total             = $this->get_stored_data('give_temp_recount_all_total');
270 270
 
271
-		if ( false === $total ) {
271
+		if (false === $total) {
272 272
 			$total         = 0;
273
-			$payment_items = $this->get_stored_data( 'give_temp_payment_items' );
273
+			$payment_items = $this->get_stored_data('give_temp_payment_items');
274 274
 
275
-			if ( false === $payment_items ) {
275
+			if (false === $payment_items) {
276 276
 				$payment_items = array();
277
-				$this->store_data( 'give_temp_payment_items', $payment_items );
277
+				$this->store_data('give_temp_payment_items', $payment_items);
278 278
 			}
279 279
 
280
-			$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
280
+			$all_forms = $this->get_stored_data('give_temp_form_ids');
281 281
 
282
-			if ( false === $all_forms ) {
282
+			if (false === $all_forms) {
283 283
 				$args = array(
284 284
 					'post_status'    => 'any',
285 285
 					'post_type'      => 'give_forms',
286
-					'posts_per_page' => - 1,
286
+					'posts_per_page' => -1,
287 287
 					'fields'         => 'ids',
288 288
 				);
289 289
 
290
-				$all_forms = get_posts( $args );
291
-				$this->store_data( 'give_temp_form_ids', $all_forms );
290
+				$all_forms = get_posts($args);
291
+				$this->store_data('give_temp_form_ids', $all_forms);
292 292
 			}
293 293
 
294
-			$args = apply_filters( 'give_recount_form_stats_total_args', array(
294
+			$args = apply_filters('give_recount_form_stats_total_args', array(
295 295
 				'post_parent__in' => $all_forms,
296 296
 				'post_type'       => 'give_log',
297 297
 				'post_status'     => 'publish',
298 298
 				'log_type'        => 'sale',
299 299
 				'fields'          => 'ids',
300 300
 				'nopaging'        => true,
301
-			) );
301
+			));
302 302
 
303
-			$all_logs = $give_logs->get_connected_logs( $args, 'sale' );
303
+			$all_logs = $give_logs->get_connected_logs($args, 'sale');
304 304
 
305
-			if ( $all_logs ) {
306
-				$log_ids     = implode( ',', $all_logs );
307
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
308
-				unset( $log_ids );
305
+			if ($all_logs) {
306
+				$log_ids     = implode(',', $all_logs);
307
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
308
+				unset($log_ids);
309 309
 
310
-				$payment_ids = implode( ',', $payment_ids );
311
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
312
-				unset( $payment_ids );
310
+				$payment_ids = implode(',', $payment_ids);
311
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
312
+				unset($payment_ids);
313 313
 
314
-				foreach ( $payments as $payment ) {
314
+				foreach ($payments as $payment) {
315 315
 
316
-					$payment = new Give_Payment( $payment->ID );
316
+					$payment = new Give_Payment($payment->ID);
317 317
 					$form_id = $payment->form_id;
318 318
 
319 319
 					//If for some reason somehow the form_ID isn't set check payment meta
320
-					if ( empty( $payment->form_id ) ) {
320
+					if (empty($payment->form_id)) {
321 321
 						$payment_meta = $payment->get_meta();
322
-						$form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
322
+						$form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
323 323
 					}
324 324
 
325
-					if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
325
+					if ( ! in_array($payment->post_status, $accepted_statuses)) {
326 326
 						continue;
327 327
 					}
328 328
 
329
-					if ( ! array_key_exists( $payment->ID, $payment_items ) ) {
330
-						$payment_items[ $payment->ID ] = array(
329
+					if ( ! array_key_exists($payment->ID, $payment_items)) {
330
+						$payment_items[$payment->ID] = array(
331 331
 							'id'         => $form_id,
332 332
 							'payment_id' => $payment->ID,
333 333
 							'price'      => $payment->total
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 
337 337
 				}
338 338
 
339
-				$total = count( $all_logs );
339
+				$total = count($all_logs);
340 340
 			}
341 341
 
342
-			$this->store_data( 'give_temp_payment_items', $payment_items );
343
-			$this->store_data( 'give_recount_all_total', $total );
342
+			$this->store_data('give_temp_payment_items', $payment_items);
343
+			$this->store_data('give_recount_all_total', $total);
344 344
 		}
345 345
 
346 346
 	}
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return mixed       Returns the data from the database
356 356
 	 */
357
-	private function get_stored_data( $key ) {
357
+	private function get_stored_data($key) {
358 358
 		global $wpdb;
359
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
359
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
360 360
 
361
-		return empty( $value ) ? false : maybe_unserialize( $value );
361
+		return empty($value) ? false : maybe_unserialize($value);
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return void
373 373
 	 */
374
-	private function store_data( $key, $value ) {
374
+	private function store_data($key, $value) {
375 375
 		global $wpdb;
376 376
 
377
-		$value = maybe_serialize( $value );
377
+		$value = maybe_serialize($value);
378 378
 
379 379
 		$data = array(
380 380
 			'option_name'  => $key,
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			'%s',
389 389
 		);
390 390
 
391
-		$wpdb->replace( $wpdb->options, $data, $formats );
391
+		$wpdb->replace($wpdb->options, $data, $formats);
392 392
 	}
393 393
 
394 394
 	/**
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @return void
402 402
 	 */
403
-	private function delete_data( $key ) {
403
+	private function delete_data($key) {
404 404
 		global $wpdb;
405
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
405
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
406 406
 	}
407 407
 
408 408
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-form-stats.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 	public function get_data() {
63 63
 		global $give_logs, $wpdb;
64 64
 
65
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
65
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
66 66
 
67
-		if ( $this->step == 1 ) {
68
-			$this->delete_data( 'give_temp_recount_form_stats' );
67
+		if ($this->step == 1) {
68
+			$this->delete_data('give_temp_recount_form_stats');
69 69
 		}
70 70
 
71
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
71
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
72 72
 
73
-		if ( false === $totals ) {
73
+		if (false === $totals) {
74 74
 			$totals = array(
75 75
 				'earnings' => (float) 0,
76 76
 				'sales'    => 0,
77 77
 			);
78
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
78
+			$this->store_data('give_temp_recount_form_stats', $totals);
79 79
 		}
80 80
 
81
-		$args = apply_filters( 'give_recount_form_stats_args', array(
81
+		$args = apply_filters('give_recount_form_stats_args', array(
82 82
 			'post_parent'    => $this->form_id,
83 83
 			'post_type'      => 'give_log',
84 84
 			'posts_per_page' => $this->per_step,
@@ -86,49 +86,49 @@  discard block
 block discarded – undo
86 86
 			'paged'          => $this->step,
87 87
 			'log_type'       => 'sale',
88 88
 			'fields'         => 'ids',
89
-		) );
89
+		));
90 90
 
91
-		$log_ids              = $give_logs->get_connected_logs( $args, 'sale' );
91
+		$log_ids              = $give_logs->get_connected_logs($args, 'sale');
92 92
 		$this->_log_ids_debug = array();
93 93
 
94
-		if ( $log_ids ) {
95
-			$log_ids     = implode( ',', $log_ids );
96
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
97
-			unset( $log_ids );
94
+		if ($log_ids) {
95
+			$log_ids     = implode(',', $log_ids);
96
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
97
+			unset($log_ids);
98 98
 
99
-			$payment_ids = implode( ',', $payment_ids );
100
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
101
-			unset( $payment_ids );
99
+			$payment_ids = implode(',', $payment_ids);
100
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
101
+			unset($payment_ids);
102 102
 
103
-			foreach ( $payments as $payment ) {
103
+			foreach ($payments as $payment) {
104 104
 
105
-				$payment = new Give_Payment( $payment->ID );
105
+				$payment = new Give_Payment($payment->ID);
106 106
 
107 107
 				//Ensure acceptible status only
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					continue;
110 110
 				}
111 111
 
112 112
 				//Ensure only payments for this form are counted
113
-				if ( $payment->form_id != $this->form_id ) {
113
+				if ($payment->form_id != $this->form_id) {
114 114
 					continue;
115 115
 				}
116 116
 
117 117
 				$this->_log_ids_debug[] = $payment->ID;
118 118
 
119
-				$totals['sales'] ++;
119
+				$totals['sales']++;
120 120
 				$totals['earnings'] += $payment->total;
121 121
 
122 122
 			}
123 123
 
124
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
124
+			$this->store_data('give_temp_recount_form_stats', $totals);
125 125
 
126 126
 			return true;
127 127
 		}
128 128
 
129 129
 
130
-		update_post_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
131
-		update_post_meta( $this->form_id, '_give_form_earnings', $totals['earnings'] );
130
+		update_post_meta($this->form_id, '_give_form_sales', $totals['sales']);
131
+		update_post_meta($this->form_id, '_give_form_earnings', $totals['earnings']);
132 132
 
133 133
 		return false;
134 134
 
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	public function get_percentage_complete() {
144 144
 		global $give_logs, $wpdb;
145 145
 
146
-		if ( $this->step == 1 ) {
147
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
146
+		if ($this->step == 1) {
147
+			$this->delete_data('give_recount_total_'.$this->form_id);
148 148
 		}
149 149
 
150
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
151
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
150
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
151
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
152 152
 
153
-		if ( false === $total ) {
153
+		if (false === $total) {
154 154
 			$total = 0;
155
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
155
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
156 156
 				'post_parent' => $this->form_id,
157 157
 				'post_type'   => 'give_log',
158 158
 				'post_status' => 'publish',
159 159
 				'log_type'    => 'sale',
160 160
 				'fields'      => 'ids',
161 161
 				'nopaging'    => true,
162
-			) );
162
+			));
163 163
 
164
-			$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
164
+			$log_ids = $give_logs->get_connected_logs($args, 'sale');
165 165
 
166
-			if ( $log_ids ) {
167
-				$log_ids     = implode( ',', $log_ids );
168
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
169
-				unset( $log_ids );
166
+			if ($log_ids) {
167
+				$log_ids     = implode(',', $log_ids);
168
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
169
+				unset($log_ids);
170 170
 
171
-				$payment_ids = implode( ',', $payment_ids );
172
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
173
-				unset( $payment_ids );
171
+				$payment_ids = implode(',', $payment_ids);
172
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
173
+				unset($payment_ids);
174 174
 
175
-				foreach ( $payments as $payment ) {
176
-					if ( in_array( $payment->post_status, $accepted_statuses ) ) {
175
+				foreach ($payments as $payment) {
176
+					if (in_array($payment->post_status, $accepted_statuses)) {
177 177
 						continue;
178 178
 					}
179 179
 
180
-					$total ++;
180
+					$total++;
181 181
 				}
182 182
 			}
183 183
 
184
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
184
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
185 185
 		}
186 186
 
187 187
 		$percentage = 100;
188 188
 
189
-		if ( $total > 0 ) {
190
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
189
+		if ($total > 0) {
190
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
191 191
 		}
192 192
 
193
-		if ( $percentage > 100 ) {
193
+		if ($percentage > 100) {
194 194
 			$percentage = 100;
195 195
 		}
196 196
 
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @param array $request The Form Data passed into the batch processing
206 206
 	 */
207
-	public function set_properties( $request ) {
208
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
207
+	public function set_properties($request) {
208
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
209 209
 	}
210 210
 
211 211
 	/**
@@ -216,31 +216,31 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function process_step() {
218 218
 
219
-		if ( ! $this->can_export() ) {
220
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
219
+		if ( ! $this->can_export()) {
220
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
221 221
 		}
222 222
 
223 223
 		$had_data = $this->get_data();
224 224
 
225
-		if ( $had_data ) {
225
+		if ($had_data) {
226 226
 			$this->done = false;
227 227
 
228 228
 			return true;
229 229
 		} else {
230
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
231
-			$this->delete_data( 'give_temp_recount_form_stats' );
230
+			$this->delete_data('give_recount_total_'.$this->form_id);
231
+			$this->delete_data('give_temp_recount_form_stats');
232 232
 			$this->done    = true;
233
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
233
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
234 234
 
235 235
 			return false;
236 236
 		}
237 237
 	}
238 238
 
239 239
 	public function headers() {
240
-		ignore_user_abort( true );
240
+		ignore_user_abort(true);
241 241
 
242
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
243
-			set_time_limit( 0 );
242
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
243
+			set_time_limit(0);
244 244
 		}
245 245
 	}
246 246
 
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return mixed       Returns the data from the database
270 270
 	 */
271
-	private function get_stored_data( $key ) {
271
+	private function get_stored_data($key) {
272 272
 		global $wpdb;
273
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
273
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
274 274
 
275
-		return empty( $value ) ? false : maybe_unserialize( $value );
275
+		return empty($value) ? false : maybe_unserialize($value);
276 276
 	}
277 277
 
278 278
 	/**
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return void
287 287
 	 */
288
-	private function store_data( $key, $value ) {
288
+	private function store_data($key, $value) {
289 289
 		global $wpdb;
290 290
 
291
-		$value = maybe_serialize( $value );
291
+		$value = maybe_serialize($value);
292 292
 
293 293
 		$data = array(
294 294
 			'option_name'  => $key,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			'%s',
303 303
 		);
304 304
 
305
-		$wpdb->replace( $wpdb->options, $data, $formats );
305
+		$wpdb->replace($wpdb->options, $data, $formats);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return void
316 316
 	 */
317
-	private function delete_data( $key ) {
317
+	private function delete_data($key) {
318 318
 		global $wpdb;
319
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
319
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
320 320
 	}
321 321
 
322 322
 }
Please login to merge, or discard this patch.