Completed
Pull Request — master (#1637)
by Ravinder
16:50
created
includes/class-give-html-elements.php 1 patch
Spacing   +141 added lines, -141 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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function transactions_dropdown( $args = array() ) {
38
+	public function transactions_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'transactions',
@@ -45,33 +45,33 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => esc_html__( 'Select a transaction', 'give' )
48
+			'placeholder' => esc_html__('Select a transaction', 'give')
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53
-		$payments = new Give_Payments_Query( array(
53
+		$payments = new Give_Payments_Query(array(
54 54
 			'number' => $args['number']
55
-		) );
55
+		));
56 56
 
57 57
 		$payments = $payments->get_payments();
58 58
 
59 59
 		$options = array();
60 60
 
61 61
 		//Provide nice human readable options.
62
-		if ( $payments ) {
63
-			$options[0] = esc_html__( 'Select a donation', 'give' );
64
-			foreach ( $payments as $payment ) {
62
+		if ($payments) {
63
+			$options[0] = esc_html__('Select a donation', 'give');
64
+			foreach ($payments as $payment) {
65 65
 
66
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title);
66
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
67 67
 
68 68
 			}
69 69
 		} else {
70
-			$options[0] = esc_html__( 'No donations found.', 'give' );
70
+			$options[0] = esc_html__('No donations found.', 'give');
71 71
 		}
72 72
 
73 73
 
74
-		$output = $this->select( array(
74
+		$output = $this->select(array(
75 75
 			'name'             => $args['name'],
76 76
 			'selected'         => $args['selected'],
77 77
 			'id'               => $args['id'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'select_atts'      => $args['select_atts'],
84 84
 			'show_option_all'  => false,
85 85
 			'show_option_none' => false
86
-		) );
86
+		));
87 87
 
88 88
 		return $output;
89 89
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string      Give forms dropdown.
102 102
 	 */
103
-	public function forms_dropdown( $args = array() ) {
103
+	public function forms_dropdown($args = array()) {
104 104
 
105 105
 		$defaults = array(
106 106
 			'name'        => 'forms',
@@ -110,31 +110,31 @@  discard block
 block discarded – undo
110 110
 			'selected'    => 0,
111 111
 			'chosen'      => false,
112 112
 			'number'      => 30,
113
-			'placeholder' => esc_attr__( 'Select a Donation Form', 'give' )
113
+			'placeholder' => esc_attr__('Select a Donation Form', 'give')
114 114
 		);
115 115
 
116
-		$args = wp_parse_args( $args, $defaults );
116
+		$args = wp_parse_args($args, $defaults);
117 117
 
118
-		$forms = get_posts( array(
118
+		$forms = get_posts(array(
119 119
 			'post_type'      => 'give_forms',
120 120
 			'orderby'        => 'title',
121 121
 			'order'          => 'ASC',
122 122
 			'posts_per_page' => $args['number']
123
-		) );
123
+		));
124 124
 
125 125
 		$options = array();
126 126
 
127
-		if ( $forms ) {
128
-			$options[0] = esc_attr__( 'Select a Donation Form', 'give' );
129
-			foreach ( $forms as $form ) {
130
-				$form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
131
-				$options[ absint( $form->ID ) ] = esc_html( $form_title );
127
+		if ($forms) {
128
+			$options[0] = esc_attr__('Select a Donation Form', 'give');
129
+			foreach ($forms as $form) {
130
+				$form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title;
131
+				$options[absint($form->ID)] = esc_html($form_title);
132 132
 			}
133 133
 		} else {
134
-			$options[0] = esc_html__( 'No forms found.', 'give' );
134
+			$options[0] = esc_html__('No forms found.', 'give');
135 135
 		}
136 136
 
137
-		$output = $this->select( array(
137
+		$output = $this->select(array(
138 138
 			'name'             => $args['name'],
139 139
 			'selected'         => $args['selected'],
140 140
 			'id'               => $args['id'],
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'placeholder'      => $args['placeholder'],
146 146
 			'show_option_all'  => false,
147 147
 			'show_option_none' => false
148
-		) );
148
+		));
149 149
 
150 150
 		return $output;
151 151
 	}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return string      Donors dropdown.
164 164
 	 */
165
-	public function donor_dropdown( $args = array() ) {
165
+	public function donor_dropdown($args = array()) {
166 166
 
167 167
 		$defaults = array(
168 168
 			'name'        => 'customers',
@@ -171,38 +171,38 @@  discard block
 block discarded – undo
171 171
 			'multiple'    => false,
172 172
 			'selected'    => 0,
173 173
 			'chosen'      => true,
174
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
174
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
175 175
 			'number'      => 30
176 176
 		);
177 177
 
178
-		$args = wp_parse_args( $args, $defaults );
178
+		$args = wp_parse_args($args, $defaults);
179 179
 
180
-		$customers = Give()->customers->get_customers( array(
180
+		$customers = Give()->customers->get_customers(array(
181 181
 			'number' => $args['number']
182
-		) );
182
+		));
183 183
 
184 184
 		$options = array();
185 185
 
186
-		if ( $customers ) {
187
-			$options[0] = esc_html__( 'No donor attached', 'give' );
188
-			foreach ( $customers as $customer ) {
189
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
186
+		if ($customers) {
187
+			$options[0] = esc_html__('No donor attached', 'give');
188
+			foreach ($customers as $customer) {
189
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
190 190
 			}
191 191
 		} else {
192
-			$options[0] = esc_html__( 'No donors found.', 'give' );
192
+			$options[0] = esc_html__('No donors found.', 'give');
193 193
 		}
194 194
 
195
-		if ( ! empty( $args['selected'] ) ) {
195
+		if ( ! empty($args['selected'])) {
196 196
 
197 197
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
198 198
 
199
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
199
+			if ( ! array_key_exists($args['selected'], $options)) {
200 200
 
201
-				$customer = new Give_Customer( $args['selected'] );
201
+				$customer = new Give_Customer($args['selected']);
202 202
 
203
-				if ( $customer ) {
203
+				if ($customer) {
204 204
 
205
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
205
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
206 206
 
207 207
 				}
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
 
211 211
 		}
212 212
 
213
-		$output = $this->select( array(
213
+		$output = $this->select(array(
214 214
 			'name'             => $args['name'],
215 215
 			'selected'         => $args['selected'],
216 216
 			'id'               => $args['id'],
217
-			'class'            => $args['class'] . ' give-customer-select',
217
+			'class'            => $args['class'].' give-customer-select',
218 218
 			'options'          => $options,
219 219
 			'multiple'         => $args['multiple'],
220 220
 			'chosen'           => $args['chosen'],
221 221
 			'show_option_all'  => false,
222 222
 			'show_option_none' => false
223
-		) );
223
+		));
224 224
 
225 225
 		return $output;
226 226
 	}
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return string           Categories dropdown.
241 241
 	 */
242
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
243
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
242
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) {
243
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
244 244
 		$options    = array();
245 245
 
246
-		foreach ( $categories as $category ) {
247
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
246
+		foreach ($categories as $category) {
247
+			$options[absint($category->term_id)] = esc_html($category->name);
248 248
 		}
249 249
 
250
-		$output = $this->select( wp_parse_args(
250
+		$output = $this->select(wp_parse_args(
251 251
 			$args,
252 252
 			array(
253 253
 				'name'             => $name,
254 254
 				'selected'         => $selected,
255 255
 				'options'          => $options,
256
-				'show_option_all'  => esc_html__( 'All Categories', 'give' ),
256
+				'show_option_all'  => esc_html__('All Categories', 'give'),
257 257
 				'show_option_none' => false
258 258
 			)
259
-		) );
259
+		));
260 260
 
261 261
 		return $output;
262 262
 	}
@@ -275,24 +275,24 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return string           Tags dropdown.
277 277
 	 */
278
-	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
279
-		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
278
+	public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) {
279
+		$tags    = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
280 280
 		$options = array();
281 281
 
282
-		foreach ( $tags as $tag ) {
283
-			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
282
+		foreach ($tags as $tag) {
283
+			$options[absint($tag->term_id)] = esc_html($tag->name);
284 284
 		}
285 285
 
286
-		$output = $this->select( wp_parse_args(
286
+		$output = $this->select(wp_parse_args(
287 287
 			$args,
288 288
 			array(
289 289
 				'name'             => $name,
290 290
 				'selected'         => $selected,
291 291
 				'options'          => $options,
292
-				'show_option_all'  => esc_html__( 'All Tags', 'give' ),
292
+				'show_option_all'  => esc_html__('All Tags', 'give'),
293 293
 				'show_option_none' => false,
294 294
 			)
295
-		) );
295
+		));
296 296
 
297 297
 		return $output;
298 298
 	}
@@ -312,25 +312,25 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return string               Years dropdown.
314 314
 	 */
315
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
316
-		$current    = date( 'Y' );
317
-		$start_year = $current - absint( $years_before );
318
-		$end_year   = $current + absint( $years_after );
319
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
315
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
316
+		$current    = date('Y');
317
+		$start_year = $current - absint($years_before);
318
+		$end_year   = $current + absint($years_after);
319
+		$selected   = empty($selected) ? date('Y') : $selected;
320 320
 		$options    = array();
321 321
 
322
-		while ( $start_year <= $end_year ) {
323
-			$options[ absint( $start_year ) ] = $start_year;
324
-			$start_year ++;
322
+		while ($start_year <= $end_year) {
323
+			$options[absint($start_year)] = $start_year;
324
+			$start_year++;
325 325
 		}
326 326
 
327
-		$output = $this->select( array(
327
+		$output = $this->select(array(
328 328
 			'name'             => $name,
329 329
 			'selected'         => $selected,
330 330
 			'options'          => $options,
331 331
 			'show_option_all'  => false,
332 332
 			'show_option_none' => false
333
-		) );
333
+		));
334 334
 
335 335
 		return $output;
336 336
 	}
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return string           Months dropdown.
350 350
 	 */
351
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
351
+	public function month_dropdown($name = 'month', $selected = 0) {
352 352
 		$month    = 1;
353 353
 		$options  = array();
354
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
354
+		$selected = empty($selected) ? date('n') : $selected;
355 355
 
356
-		while ( $month <= 12 ) {
357
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
358
-			$month ++;
356
+		while ($month <= 12) {
357
+			$options[absint($month)] = give_month_num_to_name($month);
358
+			$month++;
359 359
 		}
360 360
 
361
-		$output = $this->select( array(
361
+		$output = $this->select(array(
362 362
 			'name'             => $name,
363 363
 			'selected'         => $selected,
364 364
 			'options'          => $options,
365 365
 			'show_option_all'  => false,
366 366
 			'show_option_none' => false
367
-		) );
367
+		));
368 368
 
369 369
 		return $output;
370 370
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 * @return string      The dropdown.
383 383
 	 */
384
-	public function select( $args = array() ) {
384
+	public function select($args = array()) {
385 385
 		$defaults = array(
386 386
 			'options'          => array(),
387 387
 			'name'             => null,
@@ -392,60 +392,60 @@  discard block
 block discarded – undo
392 392
 			'placeholder'      => null,
393 393
 			'multiple'         => false,
394 394
 			'select_atts'      => false,
395
-			'show_option_all'  => esc_html__( 'All', 'give' ),
396
-			'show_option_none' => esc_html__( 'None', 'give' )
395
+			'show_option_all'  => esc_html__('All', 'give'),
396
+			'show_option_none' => esc_html__('None', 'give')
397 397
 		);
398 398
 
399
-		$args = wp_parse_args( $args, $defaults );
399
+		$args = wp_parse_args($args, $defaults);
400 400
 
401
-		if ( $args['multiple'] ) {
401
+		if ($args['multiple']) {
402 402
 			$multiple = ' MULTIPLE';
403 403
 		} else {
404 404
 			$multiple = '';
405 405
 		}
406 406
 
407
-		if ( $args['chosen'] ) {
407
+		if ($args['chosen']) {
408 408
 			$args['class'] .= ' give-select-chosen';
409 409
 		}
410 410
 
411
-		if ( $args['placeholder'] ) {
411
+		if ($args['placeholder']) {
412 412
 			$placeholder = $args['placeholder'];
413 413
 		} else {
414 414
 			$placeholder = '';
415 415
 		}
416 416
 
417 417
 
418
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">';
418
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">';
419 419
 
420
-		if ( $args['show_option_all'] ) {
421
-			if ( $args['multiple'] ) {
422
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
420
+		if ($args['show_option_all']) {
421
+			if ($args['multiple']) {
422
+				$selected = selected(true, in_array(0, $args['selected']), false);
423 423
 			} else {
424
-				$selected = selected( $args['selected'], 0, false );
424
+				$selected = selected($args['selected'], 0, false);
425 425
 			}
426
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
426
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
427 427
 		}
428 428
 
429
-		if ( ! empty( $args['options'] ) ) {
429
+		if ( ! empty($args['options'])) {
430 430
 
431
-			if ( $args['show_option_none'] ) {
432
-				if ( $args['multiple'] ) {
433
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
431
+			if ($args['show_option_none']) {
432
+				if ($args['multiple']) {
433
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
434 434
 				} else {
435
-					$selected = selected( $args['selected'], - 1, false );
435
+					$selected = selected($args['selected'], - 1, false);
436 436
 				}
437
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
437
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
438 438
 			}
439 439
 
440
-			foreach ( $args['options'] as $key => $option ) {
440
+			foreach ($args['options'] as $key => $option) {
441 441
 
442
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
443
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
442
+				if ($args['multiple'] && is_array($args['selected'])) {
443
+					$selected = selected(true, in_array($key, $args['selected']), false);
444 444
 				} else {
445
-					$selected = selected( $args['selected'], $key, false );
445
+					$selected = selected($args['selected'], $key, false);
446 446
 				}
447 447
 
448
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
448
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
449 449
 			}
450 450
 		}
451 451
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return string      The checkbox.
468 468
 	 */
469
-	public function checkbox( $args = array() ) {
469
+	public function checkbox($args = array()) {
470 470
 		$defaults = array(
471 471
 			'name'    => null,
472 472
 			'current' => null,
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
 			)
478 478
 		);
479 479
 
480
-		$args = wp_parse_args( $args, $defaults );
480
+		$args = wp_parse_args($args, $defaults);
481 481
 
482 482
 		$options = '';
483
-		if ( ! empty( $args['options']['disabled'] ) ) {
483
+		if ( ! empty($args['options']['disabled'])) {
484 484
 			$options .= ' disabled="disabled"';
485
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
485
+		} elseif ( ! empty($args['options']['readonly'])) {
486 486
 			$options .= ' readonly';
487 487
 		}
488 488
 
489
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
489
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
490 490
 
491 491
 		return $output;
492 492
 	}
@@ -503,22 +503,22 @@  discard block
 block discarded – undo
503 503
 	 *
504 504
 	 * @return string      The text field.
505 505
 	 */
506
-	public function text( $args = array() ) {
506
+	public function text($args = array()) {
507 507
 		// Backwards compatibility
508
-		if ( func_num_args() > 1 ) {
508
+		if (func_num_args() > 1) {
509 509
 			$args = func_get_args();
510 510
 
511 511
 			$name  = $args[0];
512
-			$value = isset( $args[1] ) ? $args[1] : '';
513
-			$label = isset( $args[2] ) ? $args[2] : '';
514
-			$desc  = isset( $args[3] ) ? $args[3] : '';
512
+			$value = isset($args[1]) ? $args[1] : '';
513
+			$label = isset($args[2]) ? $args[2] : '';
514
+			$desc  = isset($args[3]) ? $args[3] : '';
515 515
 		}
516 516
 
517 517
 		$defaults = array(
518
-			'name'         => isset( $name ) ? $name : 'text',
519
-			'value'        => isset( $value ) ? $value : null,
520
-			'label'        => isset( $label ) ? $label : null,
521
-			'desc'         => isset( $desc ) ? $desc : null,
518
+			'name'         => isset($name) ? $name : 'text',
519
+			'value'        => isset($value) ? $value : null,
520
+			'label'        => isset($label) ? $label : null,
521
+			'desc'         => isset($desc) ? $desc : null,
522 522
 			'placeholder'  => '',
523 523
 			'class'        => 'regular-text',
524 524
 			'disabled'     => false,
@@ -526,29 +526,29 @@  discard block
 block discarded – undo
526 526
 			'data'         => false
527 527
 		);
528 528
 
529
-		$args = wp_parse_args( $args, $defaults );
529
+		$args = wp_parse_args($args, $defaults);
530 530
 
531 531
 		$disabled = '';
532
-		if ( $args['disabled'] ) {
532
+		if ($args['disabled']) {
533 533
 			$disabled = ' disabled="disabled"';
534 534
 		}
535 535
 
536 536
 		$data = '';
537
-		if ( ! empty( $args['data'] ) ) {
538
-			foreach ( $args['data'] as $key => $value ) {
539
-				$data .= 'data-' . $key . '="' . $value . '" ';
537
+		if ( ! empty($args['data'])) {
538
+			foreach ($args['data'] as $key => $value) {
539
+				$data .= 'data-'.$key.'="'.$value.'" ';
540 540
 			}
541 541
 		}
542 542
 
543
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
543
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
544 544
 
545
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
545
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
546 546
 
547
-		if ( ! empty( $args['desc'] ) ) {
548
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
547
+		if ( ! empty($args['desc'])) {
548
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
549 549
 		}
550 550
 
551
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
551
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
552 552
 
553 553
 		$output .= '</span>';
554 554
 
@@ -567,15 +567,15 @@  discard block
 block discarded – undo
567 567
 	 *
568 568
 	 * @return string      The date picker.
569 569
 	 */
570
-	public function date_field( $args = array() ) {
570
+	public function date_field($args = array()) {
571 571
 
572
-		if ( empty( $args['class'] ) ) {
572
+		if (empty($args['class'])) {
573 573
 			$args['class'] = 'give_datepicker';
574
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
574
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
575 575
 			$args['class'] .= ' give_datepicker';
576 576
 		}
577 577
 
578
-		return $this->text( $args );
578
+		return $this->text($args);
579 579
 	}
580 580
 
581 581
 	/**
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return string      The textarea.
592 592
 	 */
593
-	public function textarea( $args = array() ) {
593
+	public function textarea($args = array()) {
594 594
 		$defaults = array(
595 595
 			'name'     => 'textarea',
596 596
 			'value'    => null,
@@ -600,21 +600,21 @@  discard block
 block discarded – undo
600 600
 			'disabled' => false
601 601
 		);
602 602
 
603
-		$args = wp_parse_args( $args, $defaults );
603
+		$args = wp_parse_args($args, $defaults);
604 604
 
605 605
 		$disabled = '';
606
-		if ( $args['disabled'] ) {
606
+		if ($args['disabled']) {
607 607
 			$disabled = ' disabled="disabled"';
608 608
 		}
609 609
 
610
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
610
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
611 611
 
612
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
612
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
613 613
 
614
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
614
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
615 615
 
616
-		if ( ! empty( $args['desc'] ) ) {
617
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
616
+		if ( ! empty($args['desc'])) {
617
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
618 618
 		}
619 619
 
620 620
 		$output .= '</span>';
@@ -634,12 +634,12 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @return string      The text field with ajax search.
636 636
 	 */
637
-	public function ajax_user_search( $args = array() ) {
637
+	public function ajax_user_search($args = array()) {
638 638
 
639 639
 		$defaults = array(
640 640
 			'name'         => 'user_id',
641 641
 			'value'        => null,
642
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
642
+			'placeholder'  => esc_attr__('Enter username', 'give'),
643 643
 			'label'        => null,
644 644
 			'desc'         => null,
645 645
 			'class'        => '',
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
 			'data'         => false
649 649
 		);
650 650
 
651
-		$args = wp_parse_args( $args, $defaults );
651
+		$args = wp_parse_args($args, $defaults);
652 652
 
653
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
653
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
654 654
 
655 655
 		$output = '<span class="give_user_search_wrap">';
656
-		$output .= $this->text( $args );
657
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
656
+		$output .= $this->text($args);
657
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
658 658
 		$output .= '</span>';
659 659
 
660 660
 		return $output;
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
  *
99 99
  * @since 1.8
100 100
  *
101
- * @return bool
101
+ * @return false|null
102 102
  */
103 103
 function give_redirect_to_clean_url_admin_pages() {
104 104
 	// Give admin pages.
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 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
 
@@ -24,53 +24,53 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
 	// Hide subscription notices permanently.
27
-	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+	if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
 		$current_user = wp_get_current_user();
29 29
 
30 30
 		// check previously disabled notice ids.
31
-		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+		$already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
 			? $already_dismiss_notices
33 33
 			: array();
34 34
 
35 35
 		// Get notice id.
36
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-		if ( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+		if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
 			$already_dismiss_notices[] = $notice_id;
40 40
 		}
41 41
 
42 42
 		// Store subscription ids.
43
-		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+		update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
 		// Redirect user.
46
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
 		exit();
48 48
 	}
49 49
 
50 50
 	// Hide subscription notices shortly.
51
-	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+	if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
 		$current_user = wp_get_current_user();
53 53
 
54 54
 		// Get notice id.
55
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
 		// Transient key name.
58 58
 		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-		if ( Give_Cache::get( $transient_key, true ) ) {
60
+		if (Give_Cache::get($transient_key, true)) {
61 61
 			return;
62 62
 		}
63 63
 
64 64
 		// Hide notice for 24 hours.
65
-		Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
65
+		Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
66 66
 
67 67
 		// Redirect user.
68
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
68
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
69 69
 		exit();
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'admin_init', 'give_hide_subscription_notices' );
73
+add_action('admin_init', 'give_hide_subscription_notices');
74 74
 
75 75
 /**
76 76
  * Load wp editor by ajax.
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
  * @since 1.8
79 79
  */
80 80
 function give_load_wp_editor() {
81
-	if ( ! isset( $_POST['wp_editor'] ) ) {
81
+	if ( ! isset($_POST['wp_editor'])) {
82 82
 		die();
83 83
 	}
84 84
 
85
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
85
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
86 86
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
87 87
 
88
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
88
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
89 89
 
90 90
 	die();
91 91
 }
92 92
 
93
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
93
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
94 94
 
95 95
 
96 96
 /**
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 	);
110 110
 
111 111
 	// Get current page.
112
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
112
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
113 113
 
114 114
 	// Bailout.
115 115
 	if (
116
-		empty( $current_page )
117
-		|| empty( $_GET['_wp_http_referer'] )
118
-		|| ! in_array( $current_page, $give_pages )
116
+		empty($current_page)
117
+		|| empty($_GET['_wp_http_referer'])
118
+		|| ! in_array($current_page, $give_pages)
119 119
 	) {
120 120
 		return false;
121 121
 	}
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @since 1.8
127 127
 	 */
128
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
128
+	$redirect = apply_filters("give_validate_{$current_page}", true);
129 129
 
130
-	if ( $redirect ) {
130
+	if ($redirect) {
131 131
 		// Redirect.
132 132
 		wp_redirect(
133 133
 			remove_query_arg(
134
-				array( '_wp_http_referer', '_wpnonce' ),
135
-				wp_unslash( $_SERVER['REQUEST_URI'] )
134
+				array('_wp_http_referer', '_wpnonce'),
135
+				wp_unslash($_SERVER['REQUEST_URI'])
136 136
 			)
137 137
 		);
138 138
 		exit;
139 139
 	}
140 140
 }
141 141
 
142
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
142
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
Please login to merge, or discard this patch.
includes/admin/class-admin-notices.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference.
51 51
 	 *
52
-	 * @return bool
52
+	 * @return false|null
53 53
 	 */
54 54
 	public function give_admin_bar_menu( $wp_admin_bar ) {
55 55
 
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 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
 
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	 * @since 1.0
34 34
 	 */
35 35
 	public function __construct() {
36
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
37
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
38
-		add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000, 1 );
36
+		add_action('admin_notices', array($this, 'show_notices'));
37
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
38
+		add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000, 1);
39 39
 
40 40
 		$this->notices = array(
41 41
 			'updated' => array(),
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return bool
53 53
 	 */
54
-	public function give_admin_bar_menu( $wp_admin_bar ) {
54
+	public function give_admin_bar_menu($wp_admin_bar) {
55 55
 
56
-		if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) {
56
+		if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) {
57 57
 			return false;
58 58
 		}
59 59
 
60 60
 		// Add the main siteadmin menu item.
61
-		$wp_admin_bar->add_menu( array(
61
+		$wp_admin_bar->add_menu(array(
62 62
 			'id'     => 'give-test-notice',
63
-			'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
63
+			'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
64 64
 			'parent' => 'top-secondary',
65
-			'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
66
-			'meta'   => array( 'class' => 'give-test-mode-active' ),
67
-		) );
65
+			'title'  => esc_html__('Give Test Mode Active', 'give'),
66
+			'meta'   => array('class' => 'give-test-mode-active'),
67
+		));
68 68
 
69 69
 	}
70 70
 
@@ -75,100 +75,100 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function show_notices() {
77 77
 
78
-		if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) {
78
+		if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) {
79 79
 			echo '<div class="error">';
80
-			echo '<p>' . esc_html__( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>';
80
+			echo '<p>'.esc_html__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>';
81 81
 			/* translators: %s: http://docs.givewp.com/ajax-blocked */
82
-			echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'http://docs.givewp.com/ajax-blocked' ) ) . '</p>';
83
-			echo '<p><a href="' . add_query_arg( array(
82
+			echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('http://docs.givewp.com/ajax-blocked')).'</p>';
83
+			echo '<p><a href="'.add_query_arg(array(
84 84
 					'give_action' => 'dismiss_notices',
85 85
 					'give_notice' => 'admin_ajax_inaccessible',
86
-				) ) . '">' . esc_html__( 'Dismiss Notice', 'give' ) . '</a></p>';
86
+				)).'">'.esc_html__('Dismiss Notice', 'give').'</a></p>';
87 87
 			echo '</div>';
88 88
 		}
89 89
 
90
-		if ( isset( $_GET['give-message'] ) ) {
90
+		if (isset($_GET['give-message'])) {
91 91
 
92 92
 			// Donation reports errors.
93
-			if ( current_user_can( 'view_give_reports' ) ) {
94
-				switch ( $_GET['give-message'] ) {
93
+			if (current_user_can('view_give_reports')) {
94
+				switch ($_GET['give-message']) {
95 95
 					case 'donation_deleted' :
96
-						$this->notices['updated']['give-donation-deleted'] = esc_attr__( 'The donation has been deleted.', 'give' );
96
+						$this->notices['updated']['give-donation-deleted'] = esc_attr__('The donation has been deleted.', 'give');
97 97
 						break;
98 98
 					case 'email_sent' :
99
-						$this->notices['updated']['give-payment-sent'] = esc_attr__( 'The donation receipt has been resent.', 'give' );
99
+						$this->notices['updated']['give-payment-sent'] = esc_attr__('The donation receipt has been resent.', 'give');
100 100
 						break;
101 101
 					case 'refreshed-reports' :
102
-						$this->notices['updated']['give-refreshed-reports'] = esc_attr__( 'The reports cache has been cleared.', 'give' );
102
+						$this->notices['updated']['give-refreshed-reports'] = esc_attr__('The reports cache has been cleared.', 'give');
103 103
 						break;
104 104
 					case 'donation-note-deleted' :
105
-						$this->notices['updated']['give-donation-note-deleted'] = esc_attr__( 'The donation note has been deleted.', 'give' );
105
+						$this->notices['updated']['give-donation-note-deleted'] = esc_attr__('The donation note has been deleted.', 'give');
106 106
 						break;
107 107
 				}
108 108
 			}
109 109
 
110 110
 			// Give settings notices and errors.
111
-			if ( current_user_can( 'manage_give_settings' ) ) {
112
-				switch ( $_GET['give-message'] ) {
111
+			if (current_user_can('manage_give_settings')) {
112
+				switch ($_GET['give-message']) {
113 113
 					case 'settings-imported' :
114
-						$this->notices['updated']['give-settings-imported'] = esc_attr__( 'The settings have been imported.', 'give' );
114
+						$this->notices['updated']['give-settings-imported'] = esc_attr__('The settings have been imported.', 'give');
115 115
 						break;
116 116
 					case 'api-key-generated' :
117
-						$this->notices['updated']['give-api-key-generated'] = esc_attr__( 'API keys have been generated.', 'give' );
117
+						$this->notices['updated']['give-api-key-generated'] = esc_attr__('API keys have been generated.', 'give');
118 118
 						break;
119 119
 					case 'api-key-exists' :
120
-						$this->notices['error']['give-api-key-exists'] = esc_attr__( 'The specified user already has API keys.', 'give' );
120
+						$this->notices['error']['give-api-key-exists'] = esc_attr__('The specified user already has API keys.', 'give');
121 121
 						break;
122 122
 					case 'api-key-regenerated' :
123
-						$this->notices['updated']['give-api-key-regenerated'] = esc_attr__( 'API keys have been regenerated.', 'give' );
123
+						$this->notices['updated']['give-api-key-regenerated'] = esc_attr__('API keys have been regenerated.', 'give');
124 124
 						break;
125 125
 					case 'api-key-revoked' :
126
-						$this->notices['updated']['give-api-key-revoked'] = esc_attr__( 'API keys have been revoked.', 'give' );
126
+						$this->notices['updated']['give-api-key-revoked'] = esc_attr__('API keys have been revoked.', 'give');
127 127
 						break;
128 128
 					case 'sent-test-email' :
129
-						$this->notices['updated']['give-sent-test-email'] = esc_attr__( 'The test email has been sent.', 'give' );
129
+						$this->notices['updated']['give-sent-test-email'] = esc_attr__('The test email has been sent.', 'give');
130 130
 						break;
131 131
 					case 'matched-success-failure-page':
132
-						$this->notices['updated']['give-matched-success-failure-page'] = esc_html__( 'You cannot set the success and failed pages to the same page', 'give' );
132
+						$this->notices['updated']['give-matched-success-failure-page'] = esc_html__('You cannot set the success and failed pages to the same page', 'give');
133 133
 				}
134 134
 			}
135 135
 			// Payments errors.
136
-			if ( current_user_can( 'edit_give_payments' ) ) {
137
-				switch ( $_GET['give-message'] ) {
136
+			if (current_user_can('edit_give_payments')) {
137
+				switch ($_GET['give-message']) {
138 138
 					case 'note-added' :
139
-						$this->notices['updated']['give-note-added'] = esc_attr__( 'The donation note has been added.', 'give' );
139
+						$this->notices['updated']['give-note-added'] = esc_attr__('The donation note has been added.', 'give');
140 140
 						break;
141 141
 					case 'payment-updated' :
142
-						$this->notices['updated']['give-payment-updated'] = esc_attr__( 'The donation has been updated.', 'give' );
142
+						$this->notices['updated']['give-payment-updated'] = esc_attr__('The donation has been updated.', 'give');
143 143
 						break;
144 144
 				}
145 145
 			}
146 146
 
147 147
 			// Customer Notices.
148
-			if ( current_user_can( 'edit_give_payments' ) ) {
149
-				switch ( $_GET['give-message'] ) {
148
+			if (current_user_can('edit_give_payments')) {
149
+				switch ($_GET['give-message']) {
150 150
 					case 'customer-deleted' :
151
-						$this->notices['updated']['give-customer-deleted'] = esc_attr__( 'The donor has been deleted.', 'give' );
151
+						$this->notices['updated']['give-customer-deleted'] = esc_attr__('The donor has been deleted.', 'give');
152 152
 						break;
153 153
 
154 154
 					case 'email-added' :
155
-						$this->notices['updated']['give-customer-email-added'] = esc_attr__( 'Donor email added', 'give' );
155
+						$this->notices['updated']['give-customer-email-added'] = esc_attr__('Donor email added', 'give');
156 156
 						break;
157 157
 
158 158
 					case 'email-removed' :
159
-						$this->notices['updated']['give-customer-email-removed'] = esc_attr__( 'Donor email removed', 'give' );
159
+						$this->notices['updated']['give-customer-email-removed'] = esc_attr__('Donor email removed', 'give');
160 160
 						break;
161 161
 
162 162
 					case 'email-remove-failed' :
163
-						$this->notices['error']['give-customer-email-remove-failed'] = esc_attr__( 'Failed to remove donor email', 'give' );
163
+						$this->notices['error']['give-customer-email-remove-failed'] = esc_attr__('Failed to remove donor email', 'give');
164 164
 						break;
165 165
 
166 166
 					case 'primary-email-updated' :
167
-						$this->notices['updated']['give-customer-primary-email-updated'] = esc_attr__( 'Primary email updated for donor', 'give' );
167
+						$this->notices['updated']['give-customer-primary-email-updated'] = esc_attr__('Primary email updated for donor', 'give');
168 168
 						break;
169 169
 
170 170
 					case 'primary-email-failed' :
171
-						$this->notices['error']['give-customer-primary-email-failed'] = esc_attr__( 'Failed to set primary email', 'give' );
171
+						$this->notices['error']['give-customer-primary-email-failed'] = esc_attr__('Failed to set primary email', 'give');
172 172
 
173 173
 				}
174 174
 			}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$this->add_payment_bulk_action_notice();
178 178
 
179
-		if ( count( $this->notices['updated'] ) > 0 ) {
180
-			foreach ( $this->notices['updated'] as $notice => $message ) {
181
-				add_settings_error( 'give-notices', $notice, $message, 'updated' );
179
+		if (count($this->notices['updated']) > 0) {
180
+			foreach ($this->notices['updated'] as $notice => $message) {
181
+				add_settings_error('give-notices', $notice, $message, 'updated');
182 182
 			}
183 183
 		}
184 184
 
185
-		if ( count( $this->notices['error'] ) > 0 ) {
186
-			foreach ( $this->notices['error'] as $notice => $message ) {
187
-				add_settings_error( 'give-notices', $notice, $message, 'error' );
185
+		if (count($this->notices['error']) > 0) {
186
+			foreach ($this->notices['error'] as $notice => $message) {
187
+				add_settings_error('give-notices', $notice, $message, 'error');
188 188
 			}
189 189
 		}
190 190
 
191
-		settings_errors( 'give-notices' );
191
+		settings_errors('give-notices');
192 192
 
193 193
 	}
194 194
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	 * @return void
201 201
 	 */
202 202
 	function give_admin_addons_notices() {
203
-		add_settings_error( 'give-notices', 'give-addons-feed-error', esc_attr__( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' );
204
-		settings_errors( 'give-notices' );
203
+		add_settings_error('give-notices', 'give-addons-feed-error', esc_attr__('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error');
204
+		settings_errors('give-notices');
205 205
 	}
206 206
 
207 207
 
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @return void
213 213
 	 */
214 214
 	function dismiss_notices() {
215
-		if ( isset( $_GET['give_notice'] ) ) {
216
-			update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 );
217
-			wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) );
215
+		if (isset($_GET['give_notice'])) {
216
+			update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1);
217
+			wp_redirect(remove_query_arg(array('give_action', 'give_notice')));
218 218
 			exit;
219 219
 		}
220 220
 	}
@@ -229,24 +229,24 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	function add_payment_bulk_action_notice() {
231 231
 		if (
232
-			current_user_can( 'edit_give_payments' )
233
-			&& isset( $_GET['action'] )
234
-			&& ! empty( $_GET['action'] )
235
-			&& isset( $_GET['payment'] )
236
-			&& ! empty( $_GET['payment'] )
232
+			current_user_can('edit_give_payments')
233
+			&& isset($_GET['action'])
234
+			&& ! empty($_GET['action'])
235
+			&& isset($_GET['payment'])
236
+			&& ! empty($_GET['payment'])
237 237
 		) {
238
-			$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
238
+			$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
239 239
 
240
-			switch ( $_GET['action'] ) {
240
+			switch ($_GET['action']) {
241 241
 				case 'delete':
242
-					if ( $payment_count ) {
243
-						$this->notices['updated']['bulk_action_delete'] = sprintf( _n( 'Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give' ), $payment_count );
242
+					if ($payment_count) {
243
+						$this->notices['updated']['bulk_action_delete'] = sprintf(_n('Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give'), $payment_count);
244 244
 					}
245 245
 					break;
246 246
 
247 247
 				case 'resend-receipt':
248
-					if ( $payment_count ) {
249
-						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf( _n( 'Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give' ), $payment_count );
248
+					if ($payment_count) {
249
+						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf(_n('Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give'), $payment_count);
250 250
 					}
251 251
 					break;
252 252
 			}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return string
269 269
 	 */
270
-	public static function notice_html( $message, $type = 'updated' ) {
270
+	public static function notice_html($message, $type = 'updated') {
271 271
 		ob_start();
272 272
 		?>
273 273
 		<div class="<?php echo $type; ?> notice">
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 * @access public
50 50
 	 * @since 1.5
51 51
 	 *
52
-	 * @return array $data The data for the CSV file
52
+	 * @return boolean $data The data for the CSV file
53 53
 	 */
54 54
 	public function get_data() {
55 55
 
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 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,32 +55,32 @@  discard block
 block discarded – undo
55 55
 
56 56
 		$args = array(
57 57
 			'number'  => $this->per_step,
58
-			'offset'  => $this->per_step * ( $this->step - 1 ),
58
+			'offset'  => $this->per_step * ($this->step - 1),
59 59
 			'orderby' => 'id',
60 60
 			'order'   => 'DESC',
61 61
 		);
62 62
 
63
-		$customers = Give()->customers->get_customers( $args );
63
+		$customers = Give()->customers->get_customers($args);
64 64
 
65
-		if ( $customers ) {
65
+		if ($customers) {
66 66
 
67
-			$allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() );
67
+			$allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys());
68 68
 
69
-			foreach ( $customers as $customer ) {
69
+			foreach ($customers as $customer) {
70 70
 
71
-				$attached_payment_ids = explode( ',', $customer->payment_ids );
71
+				$attached_payment_ids = explode(',', $customer->payment_ids);
72 72
 
73 73
 				$attached_args = array(
74 74
 					'post__in' => $attached_payment_ids,
75
-					'number'   => - 1,
75
+					'number'   => -1,
76 76
 					'status'   => $allowed_payment_status,
77 77
 				);
78 78
 
79
-				$attached_payments = (array) give_get_payments( $attached_args );
79
+				$attached_payments = (array) give_get_payments($attached_args);
80 80
 
81 81
 				$unattached_args = array(
82 82
 					'post__not_in' => $attached_payment_ids,
83
-					'number'       => - 1,
83
+					'number'       => -1,
84 84
 					'status'       => $allowed_payment_status,
85 85
 					'meta_query'   => array(
86 86
 						array(
@@ -91,29 +91,29 @@  discard block
 block discarded – undo
91 91
 					),
92 92
 				);
93 93
 
94
-				$unattached_payments = give_get_payments( $unattached_args );
94
+				$unattached_payments = give_get_payments($unattached_args);
95 95
 
96
-				$payments = array_merge( $attached_payments, $unattached_payments );
96
+				$payments = array_merge($attached_payments, $unattached_payments);
97 97
 
98 98
 				$purchase_value = 0.00;
99 99
 				$purchase_count = 0;
100 100
 				$payment_ids    = array();
101 101
 
102
-				if ( $payments ) {
102
+				if ($payments) {
103 103
 
104
-					foreach ( $payments as $payment ) {
104
+					foreach ($payments as $payment) {
105 105
 
106 106
 						$should_process_payment = 'publish' == $payment->post_status ? true : false;
107
-						$should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment );
107
+						$should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment);
108 108
 
109
-						if ( true === $should_process_payment ) {
109
+						if (true === $should_process_payment) {
110 110
 
111
-							if ( apply_filters( 'give_customer_recount_should_increase_value', true, $payment ) ) {
112
-								$purchase_value += give_get_payment_amount( $payment->ID );
111
+							if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) {
112
+								$purchase_value += give_get_payment_amount($payment->ID);
113 113
 							}
114 114
 
115
-							if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
116
-								$purchase_count ++;
115
+							if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
116
+								$purchase_count++;
117 117
 							}
118 118
 
119 119
 						}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 				}
125 125
 
126
-				$payment_ids = implode( ',', $payment_ids );
126
+				$payment_ids = implode(',', $payment_ids);
127 127
 
128 128
 				$customer_update_data = array(
129 129
 					'purchase_count' => $purchase_count,
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 					'payment_ids'    => $payment_ids,
132 132
 				);
133 133
 
134
-				$customer_instance = new Give_Customer( $customer->id );
135
-				$customer_instance->update( $customer_update_data );
134
+				$customer_instance = new Give_Customer($customer->id);
135
+				$customer_instance->update($customer_update_data);
136 136
 
137 137
 			}
138 138
 
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
 	public function get_percentage_complete() {
153 153
 
154 154
 		$args = array(
155
-			'number'  => - 1,
155
+			'number'  => -1,
156 156
 			'orderby' => 'id',
157 157
 			'order'   => 'DESC',
158 158
 		);
159 159
 
160
-		$customers = Give()->customers->get_customers( $args );
161
-		$total     = count( $customers );
160
+		$customers = Give()->customers->get_customers($args);
161
+		$total     = count($customers);
162 162
 
163 163
 		$percentage = 100;
164 164
 
165
-		if ( $total > 0 ) {
166
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
165
+		if ($total > 0) {
166
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
167 167
 		}
168 168
 
169
-		if ( $percentage > 100 ) {
169
+		if ($percentage > 100) {
170 170
 			$percentage = 100;
171 171
 		}
172 172
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @param array $request The Form Data passed into the batch processing
182 182
 	 */
183
-	public function set_properties( $request ) {
183
+	public function set_properties($request) {
184 184
 	}
185 185
 
186 186
 	/**
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function process_step() {
193 193
 
194
-		if ( ! $this->can_export() ) {
195
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
194
+		if ( ! $this->can_export()) {
195
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
196 196
 		}
197 197
 
198 198
 		$had_data = $this->get_data();
199 199
 
200
-		if ( $had_data ) {
200
+		if ($had_data) {
201 201
 			$this->done = false;
202 202
 
203 203
 			return true;
204 204
 		} else {
205 205
 			$this->done    = true;
206
-			$this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' );
206
+			$this->message = esc_html__('Donor stats have been successfully recounted.', 'give');
207 207
 
208 208
 			return false;
209 209
 		}
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 	 * Headers
214 214
 	 */
215 215
 	public function headers() {
216
-		ignore_user_abort( true );
216
+		ignore_user_abort(true);
217 217
 
218
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
219
-			set_time_limit( 0 );
218
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
219
+			set_time_limit(0);
220 220
 		}
221 221
 	}
222 222
 
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-form-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $give_logs, $wpdb;
Please login to merge, or discard this 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.
includes/class-give-logging.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -463,7 +463,7 @@
 block discarded – undo
463 463
 	 * @since  1.7
464 464
 	 * @access public
465 465
 	 *
466
-	 * @return bool
466
+	 * @return false|null
467 467
 	 */
468 468
 	public function delete_cache() {
469 469
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function __setup_hooks() {
45 45
 		// Create the log post type
46
-		add_action( 'init', array( $this, 'register_post_type' ), 1 );
46
+		add_action('init', array($this, 'register_post_type'), 1);
47 47
 
48 48
 		// Create types taxonomy and default types
49
-		add_action( 'init', array( $this, 'register_taxonomy' ), 1 );
49
+		add_action('init', array($this, 'register_taxonomy'), 1);
50 50
 
51
-		add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) );
52
-		add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) );
53
-		add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) );
54
-		add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) );
51
+		add_action('save_post_give_payment', array($this, 'background_process_delete_cache'));
52
+		add_action('save_post_give_forms', array($this, 'background_process_delete_cache'));
53
+		add_action('save_post_give_log', array($this, 'background_process_delete_cache'));
54
+		add_action('give_delete_log_cache', array($this, 'delete_cache'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		/* Logs post type */
69 69
 		$log_args = array(
70 70
 			'labels'              => array(
71
-				'name' => esc_html__( 'Logs', 'give' ),
71
+				'name' => esc_html__('Logs', 'give'),
72 72
 			),
73 73
 			'public'              => false,
74 74
 			'exclude_from_search' => true,
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 			'query_var'           => false,
78 78
 			'rewrite'             => false,
79 79
 			'capability_type'     => 'post',
80
-			'supports'            => array( 'title', 'editor' ),
80
+			'supports'            => array('title', 'editor'),
81 81
 			'can_export'          => true,
82 82
 		);
83 83
 
84
-		register_post_type( 'give_log', $log_args );
84
+		register_post_type('give_log', $log_args);
85 85
 	}
86 86
 
87 87
 	/**
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	public function register_taxonomy() {
98
-		register_taxonomy( 'give_log_type', 'give_log', array(
98
+		register_taxonomy('give_log_type', 'give_log', array(
99 99
 			'public' => false,
100
-		) );
100
+		));
101 101
 	}
102 102
 
103 103
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			'api_request',
118 118
 		);
119 119
 
120
-		return apply_filters( 'give_log_types', $terms );
120
+		return apply_filters('give_log_types', $terms);
121 121
 	}
122 122
 
123 123
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return bool         Whether log type is valid.
134 134
 	 */
135
-	public function valid_type( $type ) {
136
-		return in_array( $type, $this->log_types() );
135
+	public function valid_type($type) {
136
+		return in_array($type, $this->log_types());
137 137
 	}
138 138
 
139 139
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return int             Log ID.
154 154
 	 */
155
-	public function add( $title = '', $message = '', $parent = 0, $type = null ) {
155
+	public function add($title = '', $message = '', $parent = 0, $type = null) {
156 156
 		$log_data = array(
157 157
 			'post_title'   => $title,
158 158
 			'post_content' => $message,
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			'log_type'     => $type,
161 161
 		);
162 162
 
163
-		return $this->insert_log( $log_data );
163
+		return $this->insert_log($log_data);
164 164
 	}
165 165
 
166 166
 	/**
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @return array             An array of the connected logs.
179 179
 	 */
180
-	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
181
-		return $this->get_connected_logs( array(
180
+	public function get_logs($object_id = 0, $type = null, $paged = null) {
181
+		return $this->get_connected_logs(array(
182 182
 			'post_parent' => $object_id,
183 183
 			'paged'       => $paged,
184 184
 			'log_type'    => $type,
185
-		) );
185
+		));
186 186
 	}
187 187
 
188 188
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return int             The ID of the newly created log item.
198 198
 	 */
199
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
199
+	public function insert_log($log_data = array(), $log_meta = array()) {
200 200
 		$defaults = array(
201 201
 			'post_type'    => 'give_log',
202 202
 			'post_status'  => 'publish',
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			'log_type'     => false,
206 206
 		);
207 207
 
208
-		$args = wp_parse_args( $log_data, $defaults );
208
+		$args = wp_parse_args($log_data, $defaults);
209 209
 
210 210
 		/**
211 211
 		 * Fires before inserting log entry.
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 		 * @param array $log_data Log entry data.
216 216
 		 * @param array $log_meta Log entry meta.
217 217
 		 */
218
-		do_action( 'give_pre_insert_log', $log_data, $log_meta );
218
+		do_action('give_pre_insert_log', $log_data, $log_meta);
219 219
 
220 220
 		// Store the log entry
221
-		$log_id = wp_insert_post( $args );
221
+		$log_id = wp_insert_post($args);
222 222
 
223 223
 		// Set the log type, if any
224
-		if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
225
-			wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false );
224
+		if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) {
225
+			wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false);
226 226
 		}
227 227
 
228 228
 		// Set log meta, if any
229
-		if ( $log_id && ! empty( $log_meta ) ) {
230
-			foreach ( (array) $log_meta as $key => $meta ) {
231
-				update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
229
+		if ($log_id && ! empty($log_meta)) {
230
+			foreach ((array) $log_meta as $key => $meta) {
231
+				update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
232 232
 			}
233 233
 		}
234 234
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $log_data Log entry data.
242 242
 		 * @param array $log_meta Log entry meta.
243 243
 		 */
244
-		do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta );
244
+		do_action('give_post_insert_log', $log_id, $log_data, $log_meta);
245 245
 
246 246
 		return $log_id;
247 247
 	}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return bool|null       True if successful, false otherwise.
259 259
 	 */
260
-	public function update_log( $log_data = array(), $log_meta = array() ) {
260
+	public function update_log($log_data = array(), $log_meta = array()) {
261 261
 
262 262
 		/**
263 263
 		 * Fires before updating log entry.
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		 * @param array $log_data Log entry data.
268 268
 		 * @param array $log_meta Log entry meta.
269 269
 		 */
270
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
270
+		do_action('give_pre_update_log', $log_data, $log_meta);
271 271
 
272 272
 		$defaults = array(
273 273
 			'post_type'   => 'give_log',
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 			'post_parent' => 0,
276 276
 		);
277 277
 
278
-		$args = wp_parse_args( $log_data, $defaults );
278
+		$args = wp_parse_args($log_data, $defaults);
279 279
 
280 280
 		// Store the log entry
281
-		$log_id = wp_update_post( $args );
281
+		$log_id = wp_update_post($args);
282 282
 
283
-		if ( $log_id && ! empty( $log_meta ) ) {
284
-			foreach ( (array) $log_meta as $key => $meta ) {
285
-				if ( ! empty( $meta ) ) {
286
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
283
+		if ($log_id && ! empty($log_meta)) {
284
+			foreach ((array) $log_meta as $key => $meta) {
285
+				if ( ! empty($meta)) {
286
+					update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
287 287
 				}
288 288
 			}
289 289
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		 * @param array $log_data Log entry data.
298 298
 		 * @param array $log_meta Log entry meta.
299 299
 		 */
300
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
300
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
301 301
 	}
302 302
 
303 303
 	/**
@@ -312,19 +312,19 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return array|false Array if logs were found, false otherwise.
314 314
 	 */
315
-	public function get_connected_logs( $args = array() ) {
315
+	public function get_connected_logs($args = array()) {
316 316
 
317 317
 		$defaults = array(
318 318
 			'post_type'      => 'give_log',
319 319
 			'posts_per_page' => 20,
320 320
 			'post_status'    => 'publish',
321
-			'paged'          => get_query_var( 'paged' ),
321
+			'paged'          => get_query_var('paged'),
322 322
 			'log_type'       => false,
323 323
 		);
324 324
 
325
-		$query_args = wp_parse_args( $args, $defaults );
325
+		$query_args = wp_parse_args($args, $defaults);
326 326
 
327
-		if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) {
327
+		if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) {
328 328
 			$query_args['tax_query'] = array(
329 329
 				array(
330 330
 					'taxonomy' => 'give_log_type',
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 			);
335 335
 		}
336 336
 
337
-		$logs = get_posts( $query_args );
337
+		$logs = get_posts($query_args);
338 338
 
339
-		if ( $logs ) {
339
+		if ($logs) {
340 340
 			return $logs;
341 341
 		}
342 342
 
@@ -359,20 +359,20 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @return int                Log count.
361 361
 	 */
362
-	public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) {
362
+	public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) {
363 363
 
364 364
 		$query_args = array(
365 365
 			'post_type'      => 'give_log',
366
-			'posts_per_page' => - 1,
366
+			'posts_per_page' => -1,
367 367
 			'post_status'    => 'publish',
368 368
 			'fields'         => 'ids',
369 369
 		);
370 370
 
371
-		if ( $object_id ) {
371
+		if ($object_id) {
372 372
 			$query_args['post_parent'] = $object_id;
373 373
 		}
374 374
 
375
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
375
+		if ( ! empty($type) && $this->valid_type($type)) {
376 376
 			$query_args['tax_query'] = array(
377 377
 				array(
378 378
 					'taxonomy' => 'give_log_type',
@@ -382,24 +382,24 @@  discard block
 block discarded – undo
382 382
 			);
383 383
 		}
384 384
 
385
-		if ( ! empty( $meta_query ) ) {
385
+		if ( ! empty($meta_query)) {
386 386
 			$query_args['meta_query'] = $meta_query;
387 387
 		}
388 388
 
389
-		if ( ! empty( $date_query ) ) {
389
+		if ( ! empty($date_query)) {
390 390
 			$query_args['date_query'] = $date_query;
391 391
 		}
392 392
 
393 393
 		// Get cache key for current query.
394
-		$cache_key = Give_Cache::get_key( 'get_log_count', $query_args );
394
+		$cache_key = Give_Cache::get_key('get_log_count', $query_args);
395 395
 
396 396
 		// check if cache already exist or not.
397
-		if ( ! ( $logs_count = Give_Cache::get( $cache_key ) ) ) {
398
-			$logs       = new WP_Query( $query_args );
397
+		if ( ! ($logs_count = Give_Cache::get($cache_key))) {
398
+			$logs       = new WP_Query($query_args);
399 399
 			$logs_count = (int) $logs->post_count;
400 400
 
401 401
 			// Cache results.
402
-			Give_Cache::set( $cache_key, $logs_count );
402
+			Give_Cache::set($cache_key, $logs_count);
403 403
 		}
404 404
 
405 405
 		return $logs_count;
@@ -419,16 +419,16 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return void
421 421
 	 */
422
-	public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) {
422
+	public function delete_logs($object_id = 0, $type = null, $meta_query = null) {
423 423
 		$query_args = array(
424 424
 			'post_parent'    => $object_id,
425 425
 			'post_type'      => 'give_log',
426
-			'posts_per_page' => - 1,
426
+			'posts_per_page' => -1,
427 427
 			'post_status'    => 'publish',
428 428
 			'fields'         => 'ids',
429 429
 		);
430 430
 
431
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
431
+		if ( ! empty($type) && $this->valid_type($type)) {
432 432
 			$query_args['tax_query'] = array(
433 433
 				array(
434 434
 					'taxonomy' => 'give_log_type',
@@ -438,15 +438,15 @@  discard block
 block discarded – undo
438 438
 			);
439 439
 		}
440 440
 
441
-		if ( ! empty( $meta_query ) ) {
441
+		if ( ! empty($meta_query)) {
442 442
 			$query_args['meta_query'] = $meta_query;
443 443
 		}
444 444
 
445
-		$logs = get_posts( $query_args );
445
+		$logs = get_posts($query_args);
446 446
 
447
-		if ( $logs ) {
448
-			foreach ( $logs as $log ) {
449
-				wp_delete_post( $log, true );
447
+		if ($logs) {
448
+			foreach ($logs as $log) {
449
+				wp_delete_post($log, true);
450 450
 			}
451 451
 		}
452 452
 	}
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 	 *
460 460
 	 * @param int $post_id
461 461
 	 */
462
-	public function background_process_delete_cache( $post_id ) {
462
+	public function background_process_delete_cache($post_id) {
463 463
 		// Delete log cache immediately
464
-		wp_schedule_single_event( time() - 5, 'give_delete_log_cache' );
464
+		wp_schedule_single_event(time() - 5, 'give_delete_log_cache');
465 465
 	}
466 466
 
467 467
 	/**
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 		);
490 490
 
491 491
 		// Bailout.
492
-		if ( empty( $cache_option_names ) ) {
492
+		if (empty($cache_option_names)) {
493 493
 			return false;
494 494
 		}
495 495
 
496
-		Give_Cache::delete( $cache_option_names );
496
+		Give_Cache::delete($cache_option_names);
497 497
 	}
498 498
 }
499 499
 
@@ -515,10 +515,10 @@  discard block
 block discarded – undo
515 515
  *
516 516
  * @return int             ID of the new log entry.
517 517
  */
518
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
518
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
519 519
 	/* @var Give_Logging $give_logs */
520 520
 	global $give_logs;
521
-	$log = $give_logs->add( $title, $message, $parent, $type );
521
+	$log = $give_logs->add($title, $message, $parent, $type);
522 522
 
523 523
 	return $log;
524 524
 }
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
  *
438 438
  * @param int $form_id Give Form ID
439 439
  *
440
- * @return int $earnings Earnings for a certain form
440
+ * @return double $earnings Earnings for a certain form
441 441
  */
442 442
 function give_get_form_earnings_stats( $form_id = 0 ) {
443 443
 	$give_form = new Give_Donate_Form( $form_id );
Please login to merge, or discard this patch.
Spacing   +213 added lines, -213 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
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
261
-	if ( $extras ) {
260
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
261
+	if ($extras) {
262 262
 		$uri .= $extras;
263 263
 	}
264 264
 
265
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
265
+	return apply_filters('give_get_failed_transaction_uri', $uri);
266 266
 }
267 267
 
268 268
 /**
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function give_is_failed_transaction_page() {
275 275
 	$give_options = give_get_settings();
276
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
276
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
277 277
 
278
-	return apply_filters( 'give_is_failure_page', $ret );
278
+	return apply_filters('give_is_failure_page', $ret);
279 279
 }
280 280
 
281 281
 /**
@@ -287,18 +287,18 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function give_listen_for_failed_payments() {
289 289
 
290
-	$failed_page = give_get_option( 'failure_page', 0 );
290
+	$failed_page = give_get_option('failure_page', 0);
291 291
 
292
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
292
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
293 293
 
294
-		$payment_id = absint( $_GET['payment-id'] );
295
-		give_update_payment_status( $payment_id, 'failed' );
294
+		$payment_id = absint($_GET['payment-id']);
295
+		give_update_payment_status($payment_id, 'failed');
296 296
 
297 297
 	}
298 298
 
299 299
 }
300 300
 
301
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
301
+add_action('template_redirect', 'give_listen_for_failed_payments');
302 302
 
303 303
 /**
304 304
  * Retrieve the Donation History page URI
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 function give_get_history_page_uri() {
312 312
 	$give_options = give_get_settings();
313 313
 
314
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
314
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
315 315
 
316
-	return apply_filters( 'give_get_history_page_uri', $history_page );
316
+	return apply_filters('give_get_history_page_uri', $history_page);
317 317
 }
318 318
 
319 319
 /**
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
  * @since       1.0
327 327
  * @return      bool
328 328
  */
329
-function give_field_is_required( $field = '', $form_id ) {
329
+function give_field_is_required($field = '', $form_id) {
330 330
 
331
-	$required_fields = give_get_required_fields( $form_id );
331
+	$required_fields = give_get_required_fields($form_id);
332 332
 
333
-	return array_key_exists( $field, $required_fields );
333
+	return array_key_exists($field, $required_fields);
334 334
 }
335 335
 
336 336
 /**
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
  *
349 349
  * @return void
350 350
  */
351
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
351
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
352 352
 	global $give_logs;
353 353
 
354 354
 	$log_data = array(
355 355
 		'post_parent'   => $give_form_id,
356 356
 		'log_type'      => 'sale',
357
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
358
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null,
357
+		'post_date'     => isset($sale_date) ? $sale_date : null,
358
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null,
359 359
 	);
360 360
 
361 361
 	$log_meta = array(
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		'price_id'   => (int) $price_id,
364 364
 	);
365 365
 
366
-	$give_logs->insert_log( $log_data, $log_meta );
366
+	$give_logs->insert_log($log_data, $log_meta);
367 367
 }
368 368
 
369 369
 
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
  *
378 378
  * @return bool|int
379 379
  */
380
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
380
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
381 381
 	$quantity = (int) $quantity;
382
-	$form     = new Give_Donate_Form( $form_id );
382
+	$form     = new Give_Donate_Form($form_id);
383 383
 
384
-	return $form->increase_sales( $quantity );
384
+	return $form->increase_sales($quantity);
385 385
 }
386 386
 
387 387
 /**
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
  *
395 395
  * @return bool|int
396 396
  */
397
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
397
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
398 398
 	$quantity = (int) $quantity;
399
-	$form     = new Give_Donate_Form( $form_id );
399
+	$form     = new Give_Donate_Form($form_id);
400 400
 
401
-	return $form->decrease_sales( $quantity );
401
+	return $form->decrease_sales($quantity);
402 402
 }
403 403
 
404 404
 /**
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
  *
412 412
  * @return bool|int
413 413
  */
414
-function give_increase_earnings( $give_form_id = 0, $amount ) {
415
-	$form = new Give_Donate_Form( $give_form_id );
414
+function give_increase_earnings($give_form_id = 0, $amount) {
415
+	$form = new Give_Donate_Form($give_form_id);
416 416
 
417
-	return $form->increase_earnings( $amount );
417
+	return $form->increase_earnings($amount);
418 418
 }
419 419
 
420 420
 /**
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
  *
428 428
  * @return bool|int
429 429
  */
430
-function give_decrease_earnings( $form_id = 0, $amount ) {
431
-	$form = new Give_Donate_Form( $form_id );
430
+function give_decrease_earnings($form_id = 0, $amount) {
431
+	$form = new Give_Donate_Form($form_id);
432 432
 
433
-	return $form->decrease_earnings( $amount );
433
+	return $form->decrease_earnings($amount);
434 434
 }
435 435
 
436 436
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
  *
444 444
  * @return int $earnings Earnings for a certain form
445 445
  */
446
-function give_get_form_earnings_stats( $form_id = 0 ) {
447
-	$give_form = new Give_Donate_Form( $form_id );
446
+function give_get_form_earnings_stats($form_id = 0) {
447
+	$give_form = new Give_Donate_Form($form_id);
448 448
 
449 449
 	return $give_form->earnings;
450 450
 }
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
  *
460 460
  * @return int $sales Amount of sales for a certain form
461 461
  */
462
-function give_get_form_sales_stats( $give_form_id = 0 ) {
463
-	$give_form = new Give_Donate_Form( $give_form_id );
462
+function give_get_form_sales_stats($give_form_id = 0) {
463
+	$give_form = new Give_Donate_Form($give_form_id);
464 464
 
465 465
 	return $give_form->sales;
466 466
 }
@@ -475,16 +475,16 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return float $sales Average monthly sales
477 477
  */
478
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
479
-	$sales        = give_get_form_sales_stats( $form_id );
480
-	$release_date = get_post_field( 'post_date', $form_id );
478
+function give_get_average_monthly_form_sales($form_id = 0) {
479
+	$sales        = give_get_form_sales_stats($form_id);
480
+	$release_date = get_post_field('post_date', $form_id);
481 481
 
482
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
482
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
483 483
 
484
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
484
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
485 485
 
486
-	if ( $months > 0 ) {
487
-		$sales = ( $sales / $months );
486
+	if ($months > 0) {
487
+		$sales = ($sales / $months);
488 488
 	}
489 489
 
490 490
 	return $sales;
@@ -500,16 +500,16 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return float $earnings Average monthly earnings
502 502
  */
503
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
504
-	$earnings     = give_get_form_earnings_stats( $form_id );
505
-	$release_date = get_post_field( 'post_date', $form_id );
503
+function give_get_average_monthly_form_earnings($form_id = 0) {
504
+	$earnings     = give_get_form_earnings_stats($form_id);
505
+	$release_date = get_post_field('post_date', $form_id);
506 506
 
507
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
507
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
508 508
 
509
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
509
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
510 510
 
511
-	if ( $months > 0 ) {
512
-		$earnings = ( $earnings / $months );
511
+	if ($months > 0) {
512
+		$earnings = ($earnings / $months);
513 513
 	}
514 514
 
515 515
 	return $earnings < 0 ? 0 : $earnings;
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
  *
530 530
  * @return string $price_name Name of the price option
531 531
  */
532
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
532
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
533 533
 
534
-	$prices     = give_get_variable_prices( $form_id );
534
+	$prices     = give_get_variable_prices($form_id);
535 535
 	$price_name = '';
536 536
 
537
-	foreach ( $prices as $price ) {
537
+	foreach ($prices as $price) {
538 538
 
539
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
539
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
540 540
 
541
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
542
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
543
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
541
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
542
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
543
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
544 544
 
545 545
 		}
546 546
 	}
547 547
 
548
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
548
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
549 549
 }
550 550
 
551 551
 
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
  *
559 559
  * @return string $range A fully formatted price range
560 560
  */
561
-function give_price_range( $form_id = 0 ) {
562
-	$low   = give_get_lowest_price_option( $form_id );
563
-	$high  = give_get_highest_price_option( $form_id );
564
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
561
+function give_price_range($form_id = 0) {
562
+	$low   = give_get_lowest_price_option($form_id);
563
+	$high  = give_get_highest_price_option($form_id);
564
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
565 565
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
566
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
566
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
567 567
 
568
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
568
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
569 569
 }
570 570
 
571 571
 
@@ -580,35 +580,35 @@  discard block
 block discarded – undo
580 580
  *
581 581
  * @return int ID of the lowest price
582 582
  */
583
-function give_get_lowest_price_id( $form_id = 0 ) {
583
+function give_get_lowest_price_id($form_id = 0) {
584 584
 
585
-	if ( empty( $form_id ) ) {
585
+	if (empty($form_id)) {
586 586
 		$form_id = get_the_ID();
587 587
 	}
588 588
 
589
-	if ( ! give_has_variable_prices( $form_id ) ) {
590
-		return give_get_form_price( $form_id );
589
+	if ( ! give_has_variable_prices($form_id)) {
590
+		return give_get_form_price($form_id);
591 591
 	}
592 592
 
593
-	$prices = give_get_variable_prices( $form_id );
593
+	$prices = give_get_variable_prices($form_id);
594 594
 
595 595
 	$min = $min_id = 0;
596 596
 
597
-	if ( ! empty( $prices ) ) {
597
+	if ( ! empty($prices)) {
598 598
 
599
-		foreach ( $prices as $key => $price ) {
599
+		foreach ($prices as $key => $price) {
600 600
 
601
-			if ( empty( $price['_give_amount'] ) ) {
601
+			if (empty($price['_give_amount'])) {
602 602
 				continue;
603 603
 			}
604 604
 
605
-			if ( ! isset( $min ) ) {
605
+			if ( ! isset($min)) {
606 606
 				$min = $price['_give_amount'];
607 607
 			} else {
608
-				$min = min( $min, $price['_give_amount'] );
608
+				$min = min($min, $price['_give_amount']);
609 609
 			}
610 610
 
611
-			if ( $price['_give_amount'] == $min ) {
611
+			if ($price['_give_amount'] == $min) {
612 612
 				$min_id = $price['_give_id']['level_id'];
613 613
 			}
614 614
 		}
@@ -626,45 +626,45 @@  discard block
 block discarded – undo
626 626
  *
627 627
  * @return float Amount of the lowest price
628 628
  */
629
-function give_get_lowest_price_option( $form_id = 0 ) {
630
-	if ( empty( $form_id ) ) {
629
+function give_get_lowest_price_option($form_id = 0) {
630
+	if (empty($form_id)) {
631 631
 		$form_id = get_the_ID();
632 632
 	}
633 633
 
634
-	if ( ! give_has_variable_prices( $form_id ) ) {
635
-		return give_get_form_price( $form_id );
634
+	if ( ! give_has_variable_prices($form_id)) {
635
+		return give_get_form_price($form_id);
636 636
 	}
637 637
 
638
-	$prices = give_get_variable_prices( $form_id );
638
+	$prices = give_get_variable_prices($form_id);
639 639
 
640 640
 	$low = 0;
641 641
 
642
-	if ( ! empty( $prices ) ) {
642
+	if ( ! empty($prices)) {
643 643
 
644 644
 		$min = $min_id = 0;
645 645
 
646
-		foreach ( $prices as $key => $price ) {
646
+		foreach ($prices as $key => $price) {
647 647
 
648
-			if ( empty( $price['_give_amount'] ) ) {
648
+			if (empty($price['_give_amount'])) {
649 649
 				continue;
650 650
 			}
651 651
 
652
-			if ( ! isset( $min ) ) {
652
+			if ( ! isset($min)) {
653 653
 				$min = $price['_give_amount'];
654 654
 			} else {
655
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
655
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
656 656
 			}
657 657
 
658
-			if ( $price['_give_amount'] == $min ) {
658
+			if ($price['_give_amount'] == $min) {
659 659
 				$min_id = $key;
660 660
 			}
661 661
 		}
662 662
 
663
-		$low = $prices[ $min_id ]['_give_amount'];
663
+		$low = $prices[$min_id]['_give_amount'];
664 664
 
665 665
 	}
666 666
 
667
-	return give_sanitize_amount( $low );
667
+	return give_sanitize_amount($low);
668 668
 }
669 669
 
670 670
 /**
@@ -676,41 +676,41 @@  discard block
 block discarded – undo
676 676
  *
677 677
  * @return float Amount of the highest price
678 678
  */
679
-function give_get_highest_price_option( $form_id = 0 ) {
679
+function give_get_highest_price_option($form_id = 0) {
680 680
 
681
-	if ( empty( $form_id ) ) {
681
+	if (empty($form_id)) {
682 682
 		$form_id = get_the_ID();
683 683
 	}
684 684
 
685
-	if ( ! give_has_variable_prices( $form_id ) ) {
686
-		return give_get_form_price( $form_id );
685
+	if ( ! give_has_variable_prices($form_id)) {
686
+		return give_get_form_price($form_id);
687 687
 	}
688 688
 
689
-	$prices = give_get_variable_prices( $form_id );
689
+	$prices = give_get_variable_prices($form_id);
690 690
 
691 691
 	$high = 0.00;
692 692
 
693
-	if ( ! empty( $prices ) ) {
693
+	if ( ! empty($prices)) {
694 694
 
695 695
 		$max_id = $max = 0;
696 696
 
697
-		foreach ( $prices as $key => $price ) {
698
-			if ( empty( $price['_give_amount'] ) ) {
697
+		foreach ($prices as $key => $price) {
698
+			if (empty($price['_give_amount'])) {
699 699
 				continue;
700 700
 			}
701
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
701
+			$give_amount = give_sanitize_amount($price['_give_amount']);
702 702
 
703
-			$max = max( $max, $give_amount );
703
+			$max = max($max, $give_amount);
704 704
 
705
-			if ( $give_amount == $max ) {
705
+			if ($give_amount == $max) {
706 706
 				$max_id = $key;
707 707
 			}
708 708
 		}
709 709
 
710
-		$high = $prices[ $max_id ]['_give_amount'];
710
+		$high = $prices[$max_id]['_give_amount'];
711 711
 	}
712 712
 
713
-	return give_sanitize_amount( $high );
713
+	return give_sanitize_amount($high);
714 714
 }
715 715
 
716 716
 /**
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return mixed string|int Price of the form
724 724
  */
725
-function give_get_form_price( $form_id = 0 ) {
725
+function give_get_form_price($form_id = 0) {
726 726
 
727
-	if ( empty( $form_id ) ) {
727
+	if (empty($form_id)) {
728 728
 		return false;
729 729
 	}
730 730
 
731
-	$form = new Give_Donate_Form( $form_id );
731
+	$form = new Give_Donate_Form($form_id);
732 732
 
733
-	return $form->__get( 'price' );
733
+	return $form->__get('price');
734 734
 }
735 735
 
736 736
 /**
@@ -742,15 +742,15 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @return mixed string|int Minimum price of the form
744 744
  */
745
-function give_get_form_minimum_price( $form_id = 0 ) {
745
+function give_get_form_minimum_price($form_id = 0) {
746 746
 
747
-	if ( empty( $form_id ) ) {
747
+	if (empty($form_id)) {
748 748
 		return false;
749 749
 	}
750 750
 
751
-	$form = new Give_Donate_Form( $form_id );
751
+	$form = new Give_Donate_Form($form_id);
752 752
 
753
-	return $form->__get( 'minimum_price' );
753
+	return $form->__get('minimum_price');
754 754
 
755 755
 }
756 756
 
@@ -765,51 +765,51 @@  discard block
 block discarded – undo
765 765
  *
766 766
  * @return int $formatted_price
767 767
  */
768
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
768
+function give_price($form_id = 0, $echo = true, $price_id = false) {
769 769
 
770
-	if ( empty( $form_id ) ) {
770
+	if (empty($form_id)) {
771 771
 		$form_id = get_the_ID();
772 772
 	}
773 773
 
774
-	if ( give_has_variable_prices( $form_id ) ) {
774
+	if (give_has_variable_prices($form_id)) {
775 775
 
776
-		$prices = give_get_variable_prices( $form_id );
776
+		$prices = give_get_variable_prices($form_id);
777 777
 
778
-		if ( false !== $price_id ) {
778
+		if (false !== $price_id) {
779 779
 
780 780
 			// loop through multi-prices to see which is default
781
-			foreach ( $prices as $price ) {
781
+			foreach ($prices as $price) {
782 782
 				// this is the default price
783
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
783
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
784 784
 					$price = (float) $price['_give_amount'];
785 785
 				};
786 786
 			}
787 787
 		} else {
788 788
 
789
-			$price = give_get_lowest_price_option( $form_id );
789
+			$price = give_get_lowest_price_option($form_id);
790 790
 		}
791 791
 
792
-		$price = give_sanitize_amount( $price );
792
+		$price = give_sanitize_amount($price);
793 793
 
794 794
 	} else {
795 795
 
796
-		$price = give_get_form_price( $form_id );
796
+		$price = give_get_form_price($form_id);
797 797
 
798 798
 	}
799 799
 
800
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
801
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
802
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
800
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
801
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
802
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
803 803
 
804
-	if ( $echo ) {
804
+	if ($echo) {
805 805
 		echo $formatted_price;
806 806
 	} else {
807 807
 		return $formatted_price;
808 808
 	}
809 809
 }
810 810
 
811
-add_filter( 'give_form_price', 'give_format_amount', 10 );
812
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
811
+add_filter('give_form_price', 'give_format_amount', 10);
812
+add_filter('give_form_price', 'give_currency_filter', 20);
813 813
 
814 814
 
815 815
 /**
@@ -822,19 +822,19 @@  discard block
 block discarded – undo
822 822
  *
823 823
  * @return float $amount Amount of the price option
824 824
  */
825
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
826
-	$prices = give_get_variable_prices( $form_id );
825
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
826
+	$prices = give_get_variable_prices($form_id);
827 827
 
828 828
 	$amount = 0.00;
829 829
 
830
-	foreach ( $prices as $price ) {
831
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
832
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
830
+	foreach ($prices as $price) {
831
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
832
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
833 833
 			break;
834 834
 		};
835 835
 	}
836 836
 
837
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
837
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
838 838
 }
839 839
 
840 840
 /**
@@ -846,13 +846,13 @@  discard block
 block discarded – undo
846 846
  *
847 847
  * @return mixed string|int Goal of the form
848 848
  */
849
-function give_get_form_goal( $form_id = 0 ) {
849
+function give_get_form_goal($form_id = 0) {
850 850
 
851
-	if ( empty( $form_id ) ) {
851
+	if (empty($form_id)) {
852 852
 		return false;
853 853
 	}
854 854
 
855
-	$form = new Give_Donate_Form( $form_id );
855
+	$form = new Give_Donate_Form($form_id);
856 856
 
857 857
 	return $form->goal;
858 858
 
@@ -868,27 +868,27 @@  discard block
 block discarded – undo
868 868
  *
869 869
  * @return string $formatted_goal
870 870
  */
871
-function give_goal( $form_id = 0, $echo = true ) {
871
+function give_goal($form_id = 0, $echo = true) {
872 872
 
873
-	if ( empty( $form_id ) ) {
873
+	if (empty($form_id)) {
874 874
 		$form_id = get_the_ID();
875 875
 	}
876 876
 
877
-	$goal = give_get_form_goal( $form_id );
877
+	$goal = give_get_form_goal($form_id);
878 878
 
879
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
880
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
881
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
879
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
880
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
881
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
882 882
 
883
-	if ( $echo ) {
883
+	if ($echo) {
884 884
 		echo $formatted_goal;
885 885
 	} else {
886 886
 		return $formatted_goal;
887 887
 	}
888 888
 }
889 889
 
890
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
891
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
890
+add_filter('give_form_goal', 'give_format_amount', 10);
891
+add_filter('give_form_goal', 'give_currency_filter', 20);
892 892
 
893 893
 
894 894
 /**
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
  *
901 901
  * @return bool  $ret Whether or not the logged_in_only setting is set
902 902
  */
903
-function give_logged_in_only( $form_id ) {
903
+function give_logged_in_only($form_id) {
904 904
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
905 905
 	// Otherwise it is member only donation form.
906
-	$val = get_post_meta( $form_id, '_give_logged_in_only', true );
907
-	$val = ! empty( $val ) ? $val : 'enabled';
906
+	$val = get_post_meta($form_id, '_give_logged_in_only', true);
907
+	$val = ! empty($val) ? $val : 'enabled';
908 908
 
909
-	$ret = ! give_is_setting_enabled( $val );
909
+	$ret = ! give_is_setting_enabled($val);
910 910
 
911
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
911
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
912 912
 }
913 913
 
914 914
 
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
  *
922 922
  * @return string
923 923
  */
924
-function give_show_login_register_option( $form_id ) {
924
+function give_show_login_register_option($form_id) {
925 925
 
926
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
926
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
927 927
 
928
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
928
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
929 929
 
930 930
 }
931 931
 
@@ -941,12 +941,12 @@  discard block
 block discarded – undo
941 941
  *
942 942
  * @return array
943 943
  */
944
-function _give_get_prefill_form_field_values( $form_id ) {
944
+function _give_get_prefill_form_field_values($form_id) {
945 945
 	$logged_in_donor_info = array();
946 946
 
947
-	if ( is_user_logged_in() ) :
948
-		$donor_data    = get_userdata( get_current_user_id() );
949
-		$donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
947
+	if (is_user_logged_in()) :
948
+		$donor_data    = get_userdata(get_current_user_id());
949
+		$donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
950 950
 
951 951
 		$logged_in_donor_info = array(
952 952
 			// First name.
@@ -959,42 +959,42 @@  discard block
 block discarded – undo
959 959
 			'give_email'      => $donor_data->user_email,
960 960
 
961 961
 			// Street address 1.
962
-			'card_address'    => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ),
962
+			'card_address'    => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''),
963 963
 
964 964
 			// Street address 2.
965
-			'card_address_2'  => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ),
965
+			'card_address_2'  => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''),
966 966
 
967 967
 			// Country.
968
-			'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ),
968
+			'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''),
969 969
 
970 970
 			// State.
971
-			'card_state'      => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ),
971
+			'card_state'      => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''),
972 972
 
973 973
 			// City.
974
-			'card_city'       => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ),
974
+			'card_city'       => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''),
975 975
 
976 976
 			// Zipcode
977
-			'card_zip'        => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ),
977
+			'card_zip'        => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''),
978 978
 		);
979 979
 	endif;
980 980
 
981 981
 	// Bailout: Auto fill form field values only form form which donor is donating.
982 982
 	if (
983
-		empty( $_GET['form-id'] )
983
+		empty($_GET['form-id'])
984 984
 		|| ! $form_id
985
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
985
+		|| ($form_id !== absint($_GET['form-id']))
986 986
 	) {
987 987
 		return $logged_in_donor_info;
988 988
 	}
989 989
 
990 990
 	// Get purchase data.
991
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
991
+	$give_purchase_data = Give()->session->get('give_purchase');
992 992
 
993 993
 	// Get donor info from form data.
994
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
994
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
995 995
 		? array()
996 996
 		: $give_purchase_data['post_data'];
997 997
 
998 998
 	// Output.
999
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
999
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1000 1000
 }
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @param  int|bool $payment_id A given payment
394 394
 	 *
395
-	 * @return mixed void|false
395
+	 * @return false|null void|false
396 396
 	 */
397 397
 	public function __construct( $payment_id = false ) {
398 398
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 *
464 464
 	 * @param  string $name The attribute to get
465 465
 	 *
466
-	 * @return boolean       If the item is set or not
466
+	 * @return boolean|null       If the item is set or not
467 467
 	 */
468 468
 	public function __isset( $name ) {
469 469
 		if ( property_exists( $this, $name ) ) {
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 	 *
1303 1303
 	 * @param  string $note The note to add
1304 1304
 	 *
1305
-	 * @return void
1305
+	 * @return false|null
1306 1306
 	 */
1307 1307
 	public function add_note( $note = false ) {
1308 1308
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1050,7 +1050,7 @@
 block discarded – undo
1050 1050
 					// Find a match between price_id and level_id.
1051 1051
 					// First verify array keys exists THEN make the match.
1052 1052
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1053
-					     && $args['price_id'] == $price['_give_id']['level_id']
1053
+						 && $args['price_id'] == $price['_give_id']['level_id']
1054 1054
 					) {
1055 1055
 						$item_price = $price['_give_amount'];
1056 1056
 					}
Please login to merge, or discard this patch.
Spacing   +322 added lines, -322 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
 
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed void|false
396 396
 	 */
397
-	public function __construct( $payment_id = false ) {
397
+	public function __construct($payment_id = false) {
398 398
 
399
-		if ( empty( $payment_id ) ) {
399
+		if (empty($payment_id)) {
400 400
 			return false;
401 401
 		}
402 402
 
403
-		$this->setup_payment( $payment_id );
403
+		$this->setup_payment($payment_id);
404 404
 	}
405 405
 
406 406
 	/**
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	 *
414 414
 	 * @return mixed        The value.
415 415
 	 */
416
-	public function __get( $key ) {
416
+	public function __get($key) {
417 417
 
418
-		if ( method_exists( $this, 'get_' . $key ) ) {
418
+		if (method_exists($this, 'get_'.$key)) {
419 419
 
420
-			$value = call_user_func( array( $this, 'get_' . $key ) );
420
+			$value = call_user_func(array($this, 'get_'.$key));
421 421
 
422 422
 		} else {
423 423
 
@@ -439,18 +439,18 @@  discard block
 block discarded – undo
439 439
 	 * @param  string $key   The property name
440 440
 	 * @param  mixed  $value The value of the property
441 441
 	 */
442
-	public function __set( $key, $value ) {
443
-		$ignore = array( '_ID' );
442
+	public function __set($key, $value) {
443
+		$ignore = array('_ID');
444 444
 
445
-		if ( $key === 'status' ) {
445
+		if ($key === 'status') {
446 446
 			$this->old_status = $this->status;
447 447
 		}
448 448
 
449
-		if ( ! in_array( $key, $ignore ) ) {
450
-			$this->pending[ $key ] = $value;
449
+		if ( ! in_array($key, $ignore)) {
450
+			$this->pending[$key] = $value;
451 451
 		}
452 452
 
453
-		if ( '_ID' !== $key ) {
453
+		if ('_ID' !== $key) {
454 454
 			$this->$key = $value;
455 455
 		}
456 456
 	}
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 	 *
466 466
 	 * @return boolean       If the item is set or not
467 467
 	 */
468
-	public function __isset( $name ) {
469
-		if ( property_exists( $this, $name ) ) {
470
-			return false === empty( $this->$name );
468
+	public function __isset($name) {
469
+		if (property_exists($this, $name)) {
470
+			return false === empty($this->$name);
471 471
 		} else {
472 472
 			return null;
473 473
 		}
@@ -483,20 +483,20 @@  discard block
 block discarded – undo
483 483
 	 *
484 484
 	 * @return bool            If the setup was successful or not
485 485
 	 */
486
-	private function setup_payment( $payment_id ) {
486
+	private function setup_payment($payment_id) {
487 487
 		$this->pending = array();
488 488
 
489
-		if ( empty( $payment_id ) ) {
489
+		if (empty($payment_id)) {
490 490
 			return false;
491 491
 		}
492 492
 
493
-		$payment = get_post( $payment_id );
493
+		$payment = get_post($payment_id);
494 494
 
495
-		if ( ! $payment || is_wp_error( $payment ) ) {
495
+		if ( ! $payment || is_wp_error($payment)) {
496 496
 			return false;
497 497
 		}
498 498
 
499
-		if ( 'give_payment' !== $payment->post_type ) {
499
+		if ('give_payment' !== $payment->post_type) {
500 500
 			return false;
501 501
 		}
502 502
 
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
 		 * @param Give_Payment $this       Payment object.
511 511
 		 * @param int          $payment_id The ID of the payment.
512 512
 		 */
513
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
513
+		do_action('give_pre_setup_payment', $this, $payment_id);
514 514
 
515 515
 		// Primary Identifier.
516
-		$this->ID = absint( $payment_id );
516
+		$this->ID = absint($payment_id);
517 517
 
518 518
 		// Protected ID that can never be changed.
519
-		$this->_ID = absint( $payment_id );
519
+		$this->_ID = absint($payment_id);
520 520
 
521 521
 		// We have a payment, get the generic payment_meta item to reduce calls to it.
522 522
 		$this->payment_meta = $this->get_meta();
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		$this->parent_payment = $payment->post_parent;
532 532
 
533 533
 		$all_payment_statuses  = give_get_payment_statuses();
534
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
534
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
535 535
 
536 536
 		// Items.
537 537
 		$this->fees = $this->setup_fees();
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 		 * @param Give_Payment $this       Payment object.
574 574
 		 * @param int          $payment_id The ID of the payment.
575 575
 		 */
576
-		do_action( 'give_setup_payment', $this, $payment_id );
576
+		do_action('give_setup_payment', $this, $payment_id);
577 577
 
578 578
 		return true;
579 579
 	}
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 	 *
592 592
 	 * @return void
593 593
 	 */
594
-	public function update_payment_setup( $payment_id ) {
595
-		$this->setup_payment( $payment_id );
594
+	public function update_payment_setup($payment_id) {
595
+		$this->setup_payment($payment_id);
596 596
 	}
597 597
 
598 598
 	/**
@@ -607,24 +607,24 @@  discard block
 block discarded – undo
607 607
 
608 608
 		// Construct the payment title.
609 609
 		$payment_title = '';
610
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
611
-			$payment_title = $this->first_name . ' ' . $this->last_name;
612
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
610
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
611
+			$payment_title = $this->first_name.' '.$this->last_name;
612
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
613 613
 			$payment_title = $this->first_name;
614
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
614
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
615 615
 			$payment_title = $this->email;
616 616
 		}
617 617
 
618 618
 		// Set Key.
619
-		if ( empty( $this->key ) ) {
619
+		if (empty($this->key)) {
620 620
 
621
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
622
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
621
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
622
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
623 623
 			$this->pending['key'] = $this->key;
624 624
 		}
625 625
 
626 626
 		// Set IP.
627
-		if ( empty( $this->ip ) ) {
627
+		if (empty($this->ip)) {
628 628
 
629 629
 			$this->ip            = give_get_ip();
630 630
 			$this->pending['ip'] = $this->ip;
@@ -651,63 +651,63 @@  discard block
 block discarded – undo
651 651
 			'fees'         => $this->fees,
652 652
 		);
653 653
 
654
-		$args = apply_filters( 'give_insert_payment_args', array(
654
+		$args = apply_filters('give_insert_payment_args', array(
655 655
 			'post_title'    => $payment_title,
656 656
 			'post_status'   => $this->status,
657 657
 			'post_type'     => 'give_payment',
658
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
659
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
658
+			'post_date'     => ! empty($this->date) ? $this->date : null,
659
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
660 660
 			'post_parent'   => $this->parent_payment,
661
-		), $payment_data );
661
+		), $payment_data);
662 662
 
663 663
 		// Create a blank payment
664
-		$payment_id = wp_insert_post( $args );
664
+		$payment_id = wp_insert_post($args);
665 665
 
666
-		if ( ! empty( $payment_id ) ) {
666
+		if ( ! empty($payment_id)) {
667 667
 
668 668
 			$this->ID  = $payment_id;
669 669
 			$this->_ID = $payment_id;
670 670
 
671 671
 			$customer = new stdClass;
672 672
 
673
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
674
-				$customer = new Give_Customer( get_current_user_id(), true );
673
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
674
+				$customer = new Give_Customer(get_current_user_id(), true);
675 675
 
676 676
 				// Customer is logged in but used a different email to purchase with so assign to their customer record
677
-				if ( ! empty( $customer->id ) && $this->email != $customer->email ) {
678
-					$customer->add_email( $this->email );
677
+				if ( ! empty($customer->id) && $this->email != $customer->email) {
678
+					$customer->add_email($this->email);
679 679
 				}
680 680
 			}
681 681
 
682
-			if ( empty( $customer->id ) ) {
683
-				$customer = new Give_Customer( $this->email );
682
+			if (empty($customer->id)) {
683
+				$customer = new Give_Customer($this->email);
684 684
 			}
685 685
 
686
-			if ( empty( $customer->id ) ) {
686
+			if (empty($customer->id)) {
687 687
 
688 688
 				$customer_data = array(
689
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
689
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
690 690
 					'email'   => $this->email,
691 691
 					'user_id' => $this->user_id,
692 692
 				);
693 693
 
694
-				$customer->create( $customer_data );
694
+				$customer->create($customer_data);
695 695
 
696 696
 			}
697 697
 
698 698
 			$this->customer_id            = $customer->id;
699 699
 			$this->pending['customer_id'] = $this->customer_id;
700
-			$customer->attach_payment( $this->ID, false );
700
+			$customer->attach_payment($this->ID, false);
701 701
 
702
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
703
-			if ( ! empty( $this->payment_meta['fees'] ) ) {
704
-				$this->fees = array_merge( $this->fees, $this->payment_meta['fees'] );
705
-				foreach ( $this->fees as $fee ) {
706
-					$this->increase_fees( $fee['amount'] );
702
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
703
+			if ( ! empty($this->payment_meta['fees'])) {
704
+				$this->fees = array_merge($this->fees, $this->payment_meta['fees']);
705
+				foreach ($this->fees as $fee) {
706
+					$this->increase_fees($fee['amount']);
707 707
 				}
708 708
 			}
709 709
 
710
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
710
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
711 711
 			$this->new = true;
712 712
 		}
713 713
 
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 		$saved = false;
730 730
 
731 731
 		// Must have an ID.
732
-		if ( empty( $this->ID ) ) {
732
+		if (empty($this->ID)) {
733 733
 
734 734
 			$payment_id = $this->insert_payment();
735 735
 
736
-			if ( false === $payment_id ) {
736
+			if (false === $payment_id) {
737 737
 				$saved = false;
738 738
 			} else {
739 739
 				$this->ID = $payment_id;
@@ -741,48 +741,48 @@  discard block
 block discarded – undo
741 741
 		}
742 742
 
743 743
 		// Set ID if not matching.
744
-		if ( $this->ID !== $this->_ID ) {
744
+		if ($this->ID !== $this->_ID) {
745 745
 			$this->ID = $this->_ID;
746 746
 		}
747 747
 
748 748
 		// If we have something pending, let's save it.
749
-		if ( ! empty( $this->pending ) ) {
749
+		if ( ! empty($this->pending)) {
750 750
 
751 751
 			$total_increase = 0;
752 752
 			$total_decrease = 0;
753 753
 
754
-			foreach ( $this->pending as $key => $value ) {
754
+			foreach ($this->pending as $key => $value) {
755 755
 
756
-				switch ( $key ) {
756
+				switch ($key) {
757 757
 
758 758
 					case 'donations':
759 759
 						// Update totals for pending donations.
760
-						foreach ( $this->pending[ $key ] as $item ) {
760
+						foreach ($this->pending[$key] as $item) {
761 761
 
762
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
763
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
762
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
763
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
764 764
 
765
-							switch ( $item['action'] ) {
765
+							switch ($item['action']) {
766 766
 
767 767
 								case 'add':
768 768
 
769 769
 									$price = $item['price'];
770 770
 
771
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
771
+									if ('publish' === $this->status || 'complete' === $this->status) {
772 772
 
773 773
 										// Add sales logs.
774
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
774
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
775 775
 
776 776
 										$y = 0;
777
-										while ( $y < $quantity ) {
777
+										while ($y < $quantity) {
778 778
 
779
-											give_record_sale_in_log( $item['id'], $this->ID, $price_id, $log_date );
780
-											$y ++;
779
+											give_record_sale_in_log($item['id'], $this->ID, $price_id, $log_date);
780
+											$y++;
781 781
 										}
782 782
 
783
-										$form = new Give_Donate_Form( $item['id'] );
784
-										$form->increase_sales( $quantity );
785
-										$form->increase_earnings( $price );
783
+										$form = new Give_Donate_Form($item['id']);
784
+										$form->increase_sales($quantity);
785
+										$form->increase_earnings($price);
786 786
 
787 787
 										$total_increase += $price;
788 788
 									}
@@ -807,15 +807,15 @@  discard block
 block discarded – undo
807 807
 										),
808 808
 									);
809 809
 
810
-									$found_logs = get_posts( $log_args );
811
-									foreach ( $found_logs as $log ) {
812
-										wp_delete_post( $log->ID, true );
810
+									$found_logs = get_posts($log_args);
811
+									foreach ($found_logs as $log) {
812
+										wp_delete_post($log->ID, true);
813 813
 									}
814 814
 
815
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
816
-										$form = new Give_Donate_Form( $item['id'] );
817
-										$form->decrease_sales( $quantity );
818
-										$form->decrease_earnings( $item['amount'] );
815
+									if ('publish' === $this->status || 'complete' === $this->status) {
816
+										$form = new Give_Donate_Form($item['id']);
817
+										$form->decrease_sales($quantity);
818
+										$form->decrease_earnings($item['amount']);
819 819
 
820 820
 										$total_decrease += $item['amount'];
821 821
 									}
@@ -827,17 +827,17 @@  discard block
 block discarded – undo
827 827
 
828 828
 					case 'fees':
829 829
 
830
-						if ( 'publish' !== $this->status && 'complete' !== $this->status ) {
830
+						if ('publish' !== $this->status && 'complete' !== $this->status) {
831 831
 							break;
832 832
 						}
833 833
 
834
-						if ( empty( $this->pending[ $key ] ) ) {
834
+						if (empty($this->pending[$key])) {
835 835
 							break;
836 836
 						}
837 837
 
838
-						foreach ( $this->pending[ $key ] as $fee ) {
838
+						foreach ($this->pending[$key] as $fee) {
839 839
 
840
-							switch ( $fee['action'] ) {
840
+							switch ($fee['action']) {
841 841
 
842 842
 								case 'add':
843 843
 									$total_increase += $fee['amount'];
@@ -853,43 +853,43 @@  discard block
 block discarded – undo
853 853
 						break;
854 854
 
855 855
 					case 'status':
856
-						$this->update_status( $this->status );
856
+						$this->update_status($this->status);
857 857
 						break;
858 858
 
859 859
 					case 'gateway':
860
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
860
+						$this->update_meta('_give_payment_gateway', $this->gateway);
861 861
 						break;
862 862
 
863 863
 					case 'mode':
864
-						$this->update_meta( '_give_payment_mode', $this->mode );
864
+						$this->update_meta('_give_payment_mode', $this->mode);
865 865
 						break;
866 866
 
867 867
 					case 'transaction_id':
868
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
868
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
869 869
 						break;
870 870
 
871 871
 					case 'ip':
872
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
872
+						$this->update_meta('_give_payment_user_ip', $this->ip);
873 873
 						break;
874 874
 
875 875
 					case 'customer_id':
876
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
876
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
877 877
 						break;
878 878
 
879 879
 					case 'user_id':
880
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
880
+						$this->update_meta('_give_payment_user_id', $this->user_id);
881 881
 						break;
882 882
 
883 883
 					case 'form_title':
884
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
884
+						$this->update_meta('_give_payment_form_title', $this->form_title);
885 885
 						break;
886 886
 
887 887
 					case 'form_id':
888
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
888
+						$this->update_meta('_give_payment_form_id', $this->form_id);
889 889
 						break;
890 890
 
891 891
 					case 'price_id':
892
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
892
+						$this->update_meta('_give_payment_price_id', $this->price_id);
893 893
 						break;
894 894
 
895 895
 					case 'first_name':
@@ -905,15 +905,15 @@  discard block
 block discarded – undo
905 905
 						break;
906 906
 
907 907
 					case 'email':
908
-						$this->update_meta( '_give_payment_user_email', $this->email );
908
+						$this->update_meta('_give_payment_user_email', $this->email);
909 909
 						break;
910 910
 
911 911
 					case 'key':
912
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
912
+						$this->update_meta('_give_payment_purchase_key', $this->key);
913 913
 						break;
914 914
 
915 915
 					case 'number':
916
-						$this->update_meta( '_give_payment_number', $this->number );
916
+						$this->update_meta('_give_payment_number', $this->number);
917 917
 						break;
918 918
 
919 919
 					case 'date':
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 							'edit_date' => true,
924 924
 						);
925 925
 
926
-						wp_update_post( $args );
926
+						wp_update_post($args);
927 927
 						break;
928 928
 
929 929
 					case 'completed_date':
930
-						$this->update_meta( '_give_completed_date', $this->completed_date );
930
+						$this->update_meta('_give_completed_date', $this->completed_date);
931 931
 						break;
932 932
 
933 933
 					case 'parent_payment':
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 							'post_parent' => $this->parent_payment,
937 937
 						);
938 938
 
939
-						wp_update_post( $args );
939
+						wp_update_post($args);
940 940
 						break;
941 941
 
942 942
 					default:
@@ -947,33 +947,33 @@  discard block
 block discarded – undo
947 947
 						 *
948 948
 						 * @param Give_Payment $this Payment object.
949 949
 						 */
950
-						do_action( 'give_payment_save', $this, $key );
950
+						do_action('give_payment_save', $this, $key);
951 951
 						break;
952 952
 				}
953 953
 			}
954 954
 
955
-			if ( 'pending' !== $this->status ) {
955
+			if ('pending' !== $this->status) {
956 956
 
957
-				$customer = new Give_Customer( $this->customer_id );
957
+				$customer = new Give_Customer($this->customer_id);
958 958
 
959 959
 				$total_change = $total_increase - $total_decrease;
960
-				if ( $total_change < 0 ) {
960
+				if ($total_change < 0) {
961 961
 
962
-					$total_change = - ( $total_change );
962
+					$total_change = - ($total_change);
963 963
 					// Decrease the customer's donation stats.
964
-					$customer->decrease_value( $total_change );
965
-					give_decrease_total_earnings( $total_change );
964
+					$customer->decrease_value($total_change);
965
+					give_decrease_total_earnings($total_change);
966 966
 
967
-				} elseif ( $total_change > 0 ) {
967
+				} elseif ($total_change > 0) {
968 968
 
969 969
 					// Increase the customer's donation stats.
970
-					$customer->increase_value( $total_change );
971
-					give_increase_total_earnings( $total_change );
970
+					$customer->increase_value($total_change);
971
+					give_increase_total_earnings($total_change);
972 972
 
973 973
 				}
974 974
 			}
975 975
 
976
-			$this->update_meta( '_give_payment_total', $this->total );
976
+			$this->update_meta('_give_payment_total', $this->total);
977 977
 
978 978
 			$new_meta = array(
979 979
 				'form_title' => $this->form_title,
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
 			);
986 986
 
987 987
 			$meta        = $this->get_meta();
988
-			$merged_meta = array_merge( $meta, $new_meta );
988
+			$merged_meta = array_merge($meta, $new_meta);
989 989
 
990 990
 			// Only save the payment meta if it's changed.
991
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
992
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
993
-				if ( false !== $updated ) {
991
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
992
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
993
+				if (false !== $updated) {
994 994
 					$saved = true;
995 995
 				}
996 996
 			}
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
 			$saved         = true;
1000 1000
 		}
1001 1001
 
1002
-		if ( true === $saved ) {
1003
-			$this->setup_payment( $this->ID );
1002
+		if (true === $saved) {
1003
+			$this->setup_payment($this->ID);
1004 1004
 		}
1005 1005
 
1006 1006
 		return $saved;
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
 	 *
1019 1019
 	 * @return bool           True when successful, false otherwise
1020 1020
 	 */
1021
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
1021
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
1022 1022
 
1023
-		$donation = new Give_Donate_Form( $form_id );
1023
+		$donation = new Give_Donate_Form($form_id);
1024 1024
 
1025 1025
 		// Bail if this post isn't a give donation form.
1026
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
1026
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
1027 1027
 			return false;
1028 1028
 		}
1029 1029
 
@@ -1034,59 +1034,59 @@  discard block
 block discarded – undo
1034 1034
 			'fees'     => array(),
1035 1035
 		);
1036 1036
 
1037
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1037
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1038 1038
 
1039 1039
 		// Allow overriding the price.
1040
-		if ( false !== $args['price'] ) {
1040
+		if (false !== $args['price']) {
1041 1041
 			$item_price = $args['price'];
1042 1042
 		} else {
1043 1043
 
1044 1044
 			// Deal with variable pricing.
1045
-			if ( give_has_variable_prices( $donation->ID ) ) {
1046
-				$prices     = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1045
+			if (give_has_variable_prices($donation->ID)) {
1046
+				$prices     = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1047 1047
 				$item_price = '';
1048 1048
 				// Loop through prices.
1049
-				foreach ( $prices as $price ) {
1049
+				foreach ($prices as $price) {
1050 1050
 					// Find a match between price_id and level_id.
1051 1051
 					// First verify array keys exists THEN make the match.
1052
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1052
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1053 1053
 					     && $args['price_id'] == $price['_give_id']['level_id']
1054 1054
 					) {
1055 1055
 						$item_price = $price['_give_amount'];
1056 1056
 					}
1057 1057
 				}
1058 1058
 				// Fallback to the lowest price point.
1059
-				if ( $item_price == '' ) {
1060
-					$item_price       = give_get_lowest_price_option( $donation->ID );
1061
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1059
+				if ($item_price == '') {
1060
+					$item_price       = give_get_lowest_price_option($donation->ID);
1061
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1062 1062
 				}
1063 1063
 			} else {
1064 1064
 				// Simple form price.
1065
-				$item_price = give_get_form_price( $donation->ID );
1065
+				$item_price = give_get_form_price($donation->ID);
1066 1066
 			}
1067 1067
 		}
1068 1068
 
1069 1069
 		// Sanitizing the price here so we don't have a dozen calls later.
1070
-		$item_price = give_sanitize_amount( $item_price );
1071
-		$total      = round( $item_price, give_currency_decimal_filter() );
1070
+		$item_price = give_sanitize_amount($item_price);
1071
+		$total      = round($item_price, give_currency_decimal_filter());
1072 1072
 
1073 1073
 		// Add Options.
1074 1074
 		$default_options = array();
1075
-		if ( false !== $args['price_id'] ) {
1075
+		if (false !== $args['price_id']) {
1076 1076
 			$default_options['price_id'] = (int) $args['price_id'];
1077 1077
 		}
1078
-		$options = wp_parse_args( $options, $default_options );
1078
+		$options = wp_parse_args($options, $default_options);
1079 1079
 
1080 1080
 		// Do not allow totals to go negative.
1081
-		if ( $total < 0 ) {
1081
+		if ($total < 0) {
1082 1082
 			$total = 0;
1083 1083
 		}
1084 1084
 
1085 1085
 		$donation = array(
1086 1086
 			'name'     => $donation->post_title,
1087 1087
 			'id'       => $donation->ID,
1088
-			'price'    => round( $total, give_currency_decimal_filter() ),
1089
-			'subtotal' => round( $total, give_currency_decimal_filter() ),
1088
+			'price'    => round($total, give_currency_decimal_filter()),
1089
+			'subtotal' => round($total, give_currency_decimal_filter()),
1090 1090
 			'fees'     => $args['fees'],
1091 1091
 			'price_id' => $args['price_id'],
1092 1092
 			'action'   => 'add',
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 		$this->pending['donations'][] = $donation;
1097 1097
 
1098
-		$this->increase_subtotal( $total );
1098
+		$this->increase_subtotal($total);
1099 1099
 
1100 1100
 		return true;
1101 1101
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 *
1113 1113
 	 * @return bool           If the item was removed or not
1114 1114
 	 */
1115
-	public function remove_donation( $form_id, $args = array() ) {
1115
+	public function remove_donation($form_id, $args = array()) {
1116 1116
 
1117 1117
 		// Set some defaults.
1118 1118
 		$defaults = array(
@@ -1120,12 +1120,12 @@  discard block
 block discarded – undo
1120 1120
 			'price'    => false,
1121 1121
 			'price_id' => false,
1122 1122
 		);
1123
-		$args     = wp_parse_args( $args, $defaults );
1123
+		$args = wp_parse_args($args, $defaults);
1124 1124
 
1125
-		$form = new Give_Donate_Form( $form_id );
1125
+		$form = new Give_Donate_Form($form_id);
1126 1126
 
1127 1127
 		// Bail if this post isn't a valid give donation form.
1128
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1128
+		if ( ! $form || $form->post_type !== 'give_forms') {
1129 1129
 			return false;
1130 1130
 		}
1131 1131
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 
1139 1139
 		$this->pending['donations'][] = $pending_args;
1140 1140
 
1141
-		$this->decrease_subtotal( $this->total );
1141
+		$this->decrease_subtotal($this->total);
1142 1142
 
1143 1143
 		return true;
1144 1144
 	}
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 	 *
1155 1155
 	 * @return bool          If the fee was added
1156 1156
 	 */
1157
-	public function add_fee( $args, $global = true ) {
1157
+	public function add_fee($args, $global = true) {
1158 1158
 
1159 1159
 		$default_args = array(
1160 1160
 			'label'    => '',
@@ -1164,15 +1164,15 @@  discard block
 block discarded – undo
1164 1164
 			'price_id' => 0,
1165 1165
 		);
1166 1166
 
1167
-		$fee          = wp_parse_args( $args, $default_args );
1167
+		$fee          = wp_parse_args($args, $default_args);
1168 1168
 		$this->fees[] = $fee;
1169 1169
 
1170 1170
 		$added_fee               = $fee;
1171 1171
 		$added_fee['action']     = 'add';
1172 1172
 		$this->pending['fees'][] = $added_fee;
1173
-		reset( $this->fees );
1173
+		reset($this->fees);
1174 1174
 
1175
-		$this->increase_fees( $fee['amount'] );
1175
+		$this->increase_fees($fee['amount']);
1176 1176
 
1177 1177
 		return true;
1178 1178
 	}
@@ -1187,11 +1187,11 @@  discard block
 block discarded – undo
1187 1187
 	 *
1188 1188
 	 * @return bool     If the fee was removed successfully
1189 1189
 	 */
1190
-	public function remove_fee( $key ) {
1190
+	public function remove_fee($key) {
1191 1191
 		$removed = false;
1192 1192
 
1193
-		if ( is_numeric( $key ) ) {
1194
-			$removed = $this->remove_fee_by( 'index', $key );
1193
+		if (is_numeric($key)) {
1194
+			$removed = $this->remove_fee_by('index', $key);
1195 1195
 		}
1196 1196
 
1197 1197
 		return $removed;
@@ -1210,55 +1210,55 @@  discard block
 block discarded – undo
1210 1210
 	 *
1211 1211
 	 * @return boolean            If the item is removed
1212 1212
 	 */
1213
-	public function remove_fee_by( $key, $value, $global = false ) {
1213
+	public function remove_fee_by($key, $value, $global = false) {
1214 1214
 
1215
-		$allowed_fee_keys = apply_filters( 'give_payment_fee_keys', array(
1215
+		$allowed_fee_keys = apply_filters('give_payment_fee_keys', array(
1216 1216
 			'index',
1217 1217
 			'label',
1218 1218
 			'amount',
1219 1219
 			'type',
1220
-		) );
1220
+		));
1221 1221
 
1222
-		if ( ! in_array( $key, $allowed_fee_keys ) ) {
1222
+		if ( ! in_array($key, $allowed_fee_keys)) {
1223 1223
 			return false;
1224 1224
 		}
1225 1225
 
1226 1226
 		$removed = false;
1227
-		if ( 'index' === $key && array_key_exists( $value, $this->fees ) ) {
1227
+		if ('index' === $key && array_key_exists($value, $this->fees)) {
1228 1228
 
1229
-			$removed_fee             = $this->fees[ $value ];
1229
+			$removed_fee             = $this->fees[$value];
1230 1230
 			$removed_fee['action']   = 'remove';
1231 1231
 			$this->pending['fees'][] = $removed_fee;
1232 1232
 
1233
-			$this->decrease_fees( $removed_fee['amount'] );
1233
+			$this->decrease_fees($removed_fee['amount']);
1234 1234
 
1235
-			unset( $this->fees[ $value ] );
1235
+			unset($this->fees[$value]);
1236 1236
 			$removed = true;
1237 1237
 
1238
-		} elseif ( 'index' !== $key ) {
1238
+		} elseif ('index' !== $key) {
1239 1239
 
1240
-			foreach ( $this->fees as $index => $fee ) {
1240
+			foreach ($this->fees as $index => $fee) {
1241 1241
 
1242
-				if ( isset( $fee[ $key ] ) && $fee[ $key ] == $value ) {
1242
+				if (isset($fee[$key]) && $fee[$key] == $value) {
1243 1243
 
1244 1244
 					$removed_fee             = $fee;
1245 1245
 					$removed_fee['action']   = 'remove';
1246 1246
 					$this->pending['fees'][] = $removed_fee;
1247 1247
 
1248
-					$this->decrease_fees( $removed_fee['amount'] );
1248
+					$this->decrease_fees($removed_fee['amount']);
1249 1249
 
1250
-					unset( $this->fees[ $index ] );
1250
+					unset($this->fees[$index]);
1251 1251
 					$removed = true;
1252 1252
 
1253
-					if ( false === $global ) {
1253
+					if (false === $global) {
1254 1254
 						break;
1255 1255
 					}
1256 1256
 				}
1257 1257
 			}
1258 1258
 		}
1259 1259
 
1260
-		if ( true === $removed ) {
1261
-			$this->fees = array_values( $this->fees );
1260
+		if (true === $removed) {
1261
+			$this->fees = array_values($this->fees);
1262 1262
 		}
1263 1263
 
1264 1264
 		return $removed;
@@ -1274,14 +1274,14 @@  discard block
 block discarded – undo
1274 1274
 	 *
1275 1275
 	 * @return array        The Fees for the type specified
1276 1276
 	 */
1277
-	public function get_fees( $type = 'all' ) {
1277
+	public function get_fees($type = 'all') {
1278 1278
 		$fees = array();
1279 1279
 
1280
-		if ( ! empty( $this->fees ) && is_array( $this->fees ) ) {
1280
+		if ( ! empty($this->fees) && is_array($this->fees)) {
1281 1281
 
1282
-			foreach ( $this->fees as $fee_id => $fee ) {
1282
+			foreach ($this->fees as $fee_id => $fee) {
1283 1283
 
1284
-				if ( 'all' != $type && ! empty( $fee['type'] ) && $type != $fee['type'] ) {
1284
+				if ('all' != $type && ! empty($fee['type']) && $type != $fee['type']) {
1285 1285
 					continue;
1286 1286
 				}
1287 1287
 
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 			}
1292 1292
 		}
1293 1293
 
1294
-		return apply_filters( 'give_get_payment_fees', $fees, $this->ID, $this );
1294
+		return apply_filters('give_get_payment_fees', $fees, $this->ID, $this);
1295 1295
 	}
1296 1296
 
1297 1297
 	/**
@@ -1304,13 +1304,13 @@  discard block
 block discarded – undo
1304 1304
 	 *
1305 1305
 	 * @return void
1306 1306
 	 */
1307
-	public function add_note( $note = false ) {
1307
+	public function add_note($note = false) {
1308 1308
 		// Bail if no note specified.
1309
-		if ( ! $note ) {
1309
+		if ( ! $note) {
1310 1310
 			return false;
1311 1311
 		}
1312 1312
 
1313
-		give_insert_payment_note( $this->ID, $note );
1313
+		give_insert_payment_note($this->ID, $note);
1314 1314
 	}
1315 1315
 
1316 1316
 	/**
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @return void
1325 1325
 	 */
1326
-	private function increase_subtotal( $amount = 0.00 ) {
1326
+	private function increase_subtotal($amount = 0.00) {
1327 1327
 		$amount = (float) $amount;
1328 1328
 		$this->subtotal += $amount;
1329 1329
 
@@ -1340,11 +1340,11 @@  discard block
 block discarded – undo
1340 1340
 	 *
1341 1341
 	 * @return void
1342 1342
 	 */
1343
-	private function decrease_subtotal( $amount = 0.00 ) {
1343
+	private function decrease_subtotal($amount = 0.00) {
1344 1344
 		$amount = (float) $amount;
1345 1345
 		$this->subtotal -= $amount;
1346 1346
 
1347
-		if ( $this->subtotal < 0 ) {
1347
+		if ($this->subtotal < 0) {
1348 1348
 			$this->subtotal = 0;
1349 1349
 		}
1350 1350
 
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 	 *
1362 1362
 	 * @return void
1363 1363
 	 */
1364
-	private function increase_fees( $amount = 0.00 ) {
1364
+	private function increase_fees($amount = 0.00) {
1365 1365
 		$amount = (float) $amount;
1366 1366
 		$this->fees_total += $amount;
1367 1367
 
@@ -1378,11 +1378,11 @@  discard block
 block discarded – undo
1378 1378
 	 *
1379 1379
 	 * @return void
1380 1380
 	 */
1381
-	private function decrease_fees( $amount = 0.00 ) {
1381
+	private function decrease_fees($amount = 0.00) {
1382 1382
 		$amount = (float) $amount;
1383 1383
 		$this->fees_total -= $amount;
1384 1384
 
1385
-		if ( $this->fees_total < 0 ) {
1385
+		if ($this->fees_total < 0) {
1386 1386
 			$this->fees_total = 0;
1387 1387
 		}
1388 1388
 
@@ -1411,24 +1411,24 @@  discard block
 block discarded – undo
1411 1411
 	 *
1412 1412
 	 * @return bool   $updated Returns if the status was successfully updated.
1413 1413
 	 */
1414
-	public function update_status( $status = false ) {
1414
+	public function update_status($status = false) {
1415 1415
 
1416 1416
 		// standardize the 'complete(d)' status.
1417
-		if ( $status == 'completed' || $status == 'complete' ) {
1417
+		if ($status == 'completed' || $status == 'complete') {
1418 1418
 			$status = 'publish';
1419 1419
 		}
1420 1420
 
1421
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1421
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1422 1422
 
1423
-		if ( $old_status === $status ) {
1423
+		if ($old_status === $status) {
1424 1424
 			return false; // Don't permit status changes that aren't changes.
1425 1425
 		}
1426 1426
 
1427
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1427
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1428 1428
 
1429 1429
 		$updated = false;
1430 1430
 
1431
-		if ( $do_change ) {
1431
+		if ($do_change) {
1432 1432
 
1433 1433
 			/**
1434 1434
 			 * Fires before changing payment status.
@@ -1439,21 +1439,21 @@  discard block
 block discarded – undo
1439 1439
 			 * @param string $status     The new status.
1440 1440
 			 * @param string $old_status The old status.
1441 1441
 			 */
1442
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1442
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1443 1443
 
1444 1444
 			$update_fields = array(
1445 1445
 				'ID'          => $this->ID,
1446 1446
 				'post_status' => $status,
1447
-				'edit_date'   => current_time( 'mysql' ),
1447
+				'edit_date'   => current_time('mysql'),
1448 1448
 			);
1449 1449
 
1450
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1450
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1451 1451
 
1452 1452
 			$all_payment_statuses  = give_get_payment_statuses();
1453
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1453
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1454 1454
 
1455 1455
 			// Process any specific status functions.
1456
-			switch ( $status ) {
1456
+			switch ($status) {
1457 1457
 				case 'refunded':
1458 1458
 					$this->process_refund();
1459 1459
 					break;
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 			 * @param string $status     The new status.
1481 1481
 			 * @param string $old_status The old status.
1482 1482
 			 */
1483
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1483
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1484 1484
 
1485 1485
 		}
1486 1486
 
@@ -1515,33 +1515,33 @@  discard block
 block discarded – undo
1515 1515
 	 *
1516 1516
 	 * @return mixed             The value from the post meta
1517 1517
 	 */
1518
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1518
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1519 1519
 
1520
-		$meta = get_post_meta( $this->ID, $meta_key, $single );
1520
+		$meta = get_post_meta($this->ID, $meta_key, $single);
1521 1521
 
1522
-		if ( $meta_key === '_give_payment_meta' ) {
1522
+		if ($meta_key === '_give_payment_meta') {
1523 1523
 			$meta = (array) $meta;
1524 1524
 
1525
-			if ( empty( $meta['key'] ) ) {
1525
+			if (empty($meta['key'])) {
1526 1526
 				$meta['key'] = $this->setup_payment_key();
1527 1527
 			}
1528 1528
 
1529
-			if ( empty( $meta['form_title'] ) ) {
1529
+			if (empty($meta['form_title'])) {
1530 1530
 				$meta['form_title'] = $this->setup_form_title();
1531 1531
 			}
1532 1532
 
1533
-			if ( empty( $meta['email'] ) ) {
1533
+			if (empty($meta['email'])) {
1534 1534
 				$meta['email'] = $this->setup_email();
1535 1535
 			}
1536 1536
 
1537
-			if ( empty( $meta['date'] ) ) {
1538
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1537
+			if (empty($meta['date'])) {
1538
+				$meta['date'] = get_post_field('post_date', $this->ID);
1539 1539
 			}
1540 1540
 		}
1541 1541
 
1542
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1542
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1543 1543
 
1544
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1544
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1545 1545
 	}
1546 1546
 
1547 1547
 	/**
@@ -1556,23 +1556,23 @@  discard block
 block discarded – undo
1556 1556
 	 *
1557 1557
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1558 1558
 	 */
1559
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1560
-		if ( empty( $meta_key ) ) {
1559
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1560
+		if (empty($meta_key)) {
1561 1561
 			return false;
1562 1562
 		}
1563 1563
 
1564
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1564
+		if ($meta_key == 'key' || $meta_key == 'date') {
1565 1565
 
1566 1566
 			$current_meta              = $this->get_meta();
1567
-			$current_meta[ $meta_key ] = $meta_value;
1567
+			$current_meta[$meta_key] = $meta_value;
1568 1568
 
1569 1569
 			$meta_key   = '_give_payment_meta';
1570 1570
 			$meta_value = $current_meta;
1571 1571
 
1572
-		} elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1572
+		} elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1573 1573
 
1574
-			$meta_value = apply_filters( "give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1575
-			update_post_meta( $this->ID, '_give_payment_user_email', $meta_value );
1574
+			$meta_value = apply_filters("give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1575
+			update_post_meta($this->ID, '_give_payment_user_email', $meta_value);
1576 1576
 
1577 1577
 			$current_meta                       = $this->get_meta();
1578 1578
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1582,9 +1582,9 @@  discard block
 block discarded – undo
1582 1582
 
1583 1583
 		}
1584 1584
 
1585
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1585
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1586 1586
 
1587
-		return update_post_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1587
+		return update_post_meta($this->ID, $meta_key, $meta_value, $prev_value);
1588 1588
 	}
1589 1589
 
1590 1590
 	/**
@@ -1599,14 +1599,14 @@  discard block
 block discarded – undo
1599 1599
 		$process_refund = true;
1600 1600
 
1601 1601
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1602
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1602
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1603 1603
 			$process_refund = false;
1604 1604
 		}
1605 1605
 
1606 1606
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1607
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1607
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1608 1608
 
1609
-		if ( false === $process_refund ) {
1609
+		if (false === $process_refund) {
1610 1610
 			return;
1611 1611
 		}
1612 1612
 
@@ -1617,13 +1617,13 @@  discard block
 block discarded – undo
1617 1617
 		 *
1618 1618
 		 * @param Give_Payment $this Payment object.
1619 1619
 		 */
1620
-		do_action( 'give_pre_refund_payment', $this );
1620
+		do_action('give_pre_refund_payment', $this);
1621 1621
 
1622
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1623
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1624
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1622
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1623
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1624
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1625 1625
 
1626
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1626
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1627 1627
 		$this->delete_sales_logs();
1628 1628
 
1629 1629
 		// @todo: Refresh only range related stat cache
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 		 *
1637 1637
 		 * @param Give_Payment $this Payment object.
1638 1638
 		 */
1639
-		do_action( 'give_post_refund_payment', $this );
1639
+		do_action('give_post_refund_payment', $this);
1640 1640
 	}
1641 1641
 
1642 1642
 	/**
@@ -1663,26 +1663,26 @@  discard block
 block discarded – undo
1663 1663
 		$process_pending = true;
1664 1664
 
1665 1665
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1666
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1666
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1667 1667
 			$process_pending = false;
1668 1668
 		}
1669 1669
 
1670 1670
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1671
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1671
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1672 1672
 
1673
-		if ( false === $process_pending ) {
1673
+		if (false === $process_pending) {
1674 1674
 			return;
1675 1675
 		}
1676 1676
 
1677
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_pending', true, $this );
1678
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_pending', true, $this );
1679
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_pending', true, $this );
1677
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_pending', true, $this);
1678
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_pending', true, $this);
1679
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_pending', true, $this);
1680 1680
 
1681
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1681
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1682 1682
 		$this->delete_sales_logs();
1683 1683
 
1684 1684
 		$this->completed_date = false;
1685
-		$this->update_meta( '_give_completed_date', '' );
1685
+		$this->update_meta('_give_completed_date', '');
1686 1686
 
1687 1687
 		// @todo: Refresh only range related stat cache
1688 1688
 		give_delete_donation_stats();
@@ -1700,26 +1700,26 @@  discard block
 block discarded – undo
1700 1700
 		$process_cancelled = true;
1701 1701
 
1702 1702
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1703
-		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1703
+		if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1704 1704
 			$process_cancelled = false;
1705 1705
 		}
1706 1706
 
1707 1707
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1708
-		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1708
+		$process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1709 1709
 
1710
-		if ( false === $process_cancelled ) {
1710
+		if (false === $process_cancelled) {
1711 1711
 			return;
1712 1712
 		}
1713 1713
 
1714
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this );
1715
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this );
1716
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this );
1714
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_cancelled', true, $this);
1715
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_cancelled', true, $this);
1716
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_cancelled', true, $this);
1717 1717
 
1718
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1718
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1719 1719
 		$this->delete_sales_logs();
1720 1720
 
1721 1721
 		$this->completed_date = false;
1722
-		$this->update_meta( '_give_completed_date', '' );
1722
+		$this->update_meta('_give_completed_date', '');
1723 1723
 
1724 1724
 		// @todo: Refresh only range related stat cache
1725 1725
 		give_delete_donation_stats();
@@ -1735,26 +1735,26 @@  discard block
 block discarded – undo
1735 1735
 		$process_revoked = true;
1736 1736
 
1737 1737
 		// If the payment was not in publish, don't decrement stats as they were never incremented.
1738
-		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1738
+		if ('publish' != $this->old_status || 'revoked' != $this->status) {
1739 1739
 			$process_revoked = false;
1740 1740
 		}
1741 1741
 
1742 1742
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1743
-		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1743
+		$process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1744 1744
 
1745
-		if ( false === $process_revoked ) {
1745
+		if (false === $process_revoked) {
1746 1746
 			return;
1747 1747
 		}
1748 1748
 
1749
-		$decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this );
1750
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this );
1751
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this );
1749
+		$decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_revoked', true, $this);
1750
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_revoked', true, $this);
1751
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_revoked', true, $this);
1752 1752
 
1753
-		$this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count );
1753
+		$this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count);
1754 1754
 		$this->delete_sales_logs();
1755 1755
 
1756 1756
 		$this->completed_date = false;
1757
-		$this->update_meta( '_give_completed_date', '' );
1757
+		$this->update_meta('_give_completed_date', '');
1758 1758
 
1759 1759
 		// @todo: Refresh only range related stat cache
1760 1760
 		give_delete_donation_stats();
@@ -1772,25 +1772,25 @@  discard block
 block discarded – undo
1772 1772
 	 *
1773 1773
 	 * @return void
1774 1774
 	 */
1775
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1775
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1776 1776
 
1777
-		give_undo_purchase( false, $this->ID );
1777
+		give_undo_purchase(false, $this->ID);
1778 1778
 
1779 1779
 		// Decrease store earnings.
1780
-		if ( true === $alter_store_earnings ) {
1781
-			give_decrease_total_earnings( $this->total );
1780
+		if (true === $alter_store_earnings) {
1781
+			give_decrease_total_earnings($this->total);
1782 1782
 		}
1783 1783
 
1784 1784
 		// Decrement the stats for the customer.
1785
-		if ( ! empty( $this->customer_id ) ) {
1785
+		if ( ! empty($this->customer_id)) {
1786 1786
 
1787
-			$customer = new Give_Customer( $this->customer_id );
1787
+			$customer = new Give_Customer($this->customer_id);
1788 1788
 
1789
-			if ( true === $alter_customer_value ) {
1790
-				$customer->decrease_value( $this->total );
1789
+			if (true === $alter_customer_value) {
1790
+				$customer->decrease_value($this->total);
1791 1791
 			}
1792 1792
 
1793
-			if ( true === $alter_customer_purchase_count ) {
1793
+			if (true === $alter_customer_purchase_count) {
1794 1794
 				$customer->decrease_purchase_count();
1795 1795
 			}
1796 1796
 		}
@@ -1839,13 +1839,13 @@  discard block
 block discarded – undo
1839 1839
 	 * @return string The date the payment was completed
1840 1840
 	 */
1841 1841
 	private function setup_completed_date() {
1842
-		$payment = get_post( $this->ID );
1842
+		$payment = get_post($this->ID);
1843 1843
 
1844
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1844
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1845 1845
 			return false; // This payment was never completed.
1846 1846
 		}
1847 1847
 
1848
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1848
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1849 1849
 
1850 1850
 		return $date;
1851 1851
 	}
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 	 * @return string The payment mode
1860 1860
 	 */
1861 1861
 	private function setup_mode() {
1862
-		return $this->get_meta( '_give_payment_mode' );
1862
+		return $this->get_meta('_give_payment_mode');
1863 1863
 	}
1864 1864
 
1865 1865
 	/**
@@ -1871,19 +1871,19 @@  discard block
 block discarded – undo
1871 1871
 	 * @return float The payment total
1872 1872
 	 */
1873 1873
 	private function setup_total() {
1874
-		$amount = $this->get_meta( '_give_payment_total', true );
1874
+		$amount = $this->get_meta('_give_payment_total', true);
1875 1875
 
1876
-		if ( empty( $amount ) && '0.00' != $amount ) {
1877
-			$meta = $this->get_meta( '_give_payment_meta', true );
1878
-			$meta = maybe_unserialize( $meta );
1876
+		if (empty($amount) && '0.00' != $amount) {
1877
+			$meta = $this->get_meta('_give_payment_meta', true);
1878
+			$meta = maybe_unserialize($meta);
1879 1879
 
1880
-			if ( isset( $meta['amount'] ) ) {
1880
+			if (isset($meta['amount'])) {
1881 1881
 				$amount = $meta['amount'];
1882 1882
 			}
1883 1883
 		}
1884 1884
 
1885 1885
 
1886
-		return round( floatval( $amount ), give_currency_decimal_filter() );
1886
+		return round(floatval($amount), give_currency_decimal_filter());
1887 1887
 	}
1888 1888
 
1889 1889
 	/**
@@ -1911,9 +1911,9 @@  discard block
 block discarded – undo
1911 1911
 	private function setup_fees_total() {
1912 1912
 		$fees_total = (float) 0.00;
1913 1913
 
1914
-		$payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array();
1915
-		if ( ! empty( $payment_fees ) ) {
1916
-			foreach ( $payment_fees as $fee ) {
1914
+		$payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array();
1915
+		if ( ! empty($payment_fees)) {
1916
+			foreach ($payment_fees as $fee) {
1917 1917
 				$fees_total += (float) $fee['amount'];
1918 1918
 			}
1919 1919
 		}
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
 	 * @return string The currency for the payment
1932 1932
 	 */
1933 1933
 	private function setup_currency() {
1934
-		$currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this );
1934
+		$currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this);
1935 1935
 
1936 1936
 		return $currency;
1937 1937
 	}
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 	 * @return array The Fees
1946 1946
 	 */
1947 1947
 	private function setup_fees() {
1948
-		$payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array();
1948
+		$payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array();
1949 1949
 
1950 1950
 		return $payment_fees;
1951 1951
 	}
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
 	 * @return string The gateway
1960 1960
 	 */
1961 1961
 	private function setup_gateway() {
1962
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1962
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1963 1963
 
1964 1964
 		return $gateway;
1965 1965
 	}
@@ -1973,11 +1973,11 @@  discard block
 block discarded – undo
1973 1973
 	 * @return string The donation ID
1974 1974
 	 */
1975 1975
 	private function setup_transaction_id() {
1976
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1976
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1977 1977
 
1978
-		if ( empty( $transaction_id ) ) {
1978
+		if (empty($transaction_id)) {
1979 1979
 			$gateway        = $this->gateway;
1980
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1980
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1981 1981
 		}
1982 1982
 
1983 1983
 		return $transaction_id;
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 	 * @return string The IP address for the payment
1993 1993
 	 */
1994 1994
 	private function setup_ip() {
1995
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1995
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1996 1996
 
1997 1997
 		return $ip;
1998 1998
 	}
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 	 * @return int The Customer ID
2007 2007
 	 */
2008 2008
 	private function setup_customer_id() {
2009
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
2009
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
2010 2010
 
2011 2011
 		return $customer_id;
2012 2012
 	}
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 	 * @return int The User ID
2021 2021
 	 */
2022 2022
 	private function setup_user_id() {
2023
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
2023
+		$user_id = $this->get_meta('_give_payment_user_id', true);
2024 2024
 
2025 2025
 		return $user_id;
2026 2026
 	}
@@ -2034,10 +2034,10 @@  discard block
 block discarded – undo
2034 2034
 	 * @return string The email address for the payment
2035 2035
 	 */
2036 2036
 	private function setup_email() {
2037
-		$email = $this->get_meta( '_give_payment_user_email', true );
2037
+		$email = $this->get_meta('_give_payment_user_email', true);
2038 2038
 
2039
-		if ( empty( $email ) ) {
2040
-			$email = Give()->customers->get_column( 'email', $this->customer_id );
2039
+		if (empty($email)) {
2040
+			$email = Give()->customers->get_column('email', $this->customer_id);
2041 2041
 		}
2042 2042
 
2043 2043
 		return $email;
@@ -2057,15 +2057,15 @@  discard block
 block discarded – undo
2057 2057
 			'last_name'  => $this->last_name,
2058 2058
 		);
2059 2059
 
2060
-		$user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array();
2061
-		$user_info = wp_parse_args( $user_info, $defaults );
2060
+		$user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array();
2061
+		$user_info = wp_parse_args($user_info, $defaults);
2062 2062
 
2063
-		if ( empty( $user_info ) ) {
2063
+		if (empty($user_info)) {
2064 2064
 			// Get the customer, but only if it's been created.
2065
-			$customer = new Give_Customer( $this->customer_id );
2065
+			$customer = new Give_Customer($this->customer_id);
2066 2066
 
2067
-			if ( $customer->id > 0 ) {
2068
-				$name      = explode( ' ', $customer->name, 2 );
2067
+			if ($customer->id > 0) {
2068
+				$name      = explode(' ', $customer->name, 2);
2069 2069
 				$user_info = array(
2070 2070
 					'first_name' => $name[0],
2071 2071
 					'last_name'  => $name[1],
@@ -2075,29 +2075,29 @@  discard block
 block discarded – undo
2075 2075
 			}
2076 2076
 		} else {
2077 2077
 			// Get the customer, but only if it's been created.
2078
-			$customer = new Give_Customer( $this->customer_id );
2079
-			if ( $customer->id > 0 ) {
2080
-				foreach ( $user_info as $key => $value ) {
2081
-					if ( ! empty( $value ) ) {
2078
+			$customer = new Give_Customer($this->customer_id);
2079
+			if ($customer->id > 0) {
2080
+				foreach ($user_info as $key => $value) {
2081
+					if ( ! empty($value)) {
2082 2082
 						continue;
2083 2083
 					}
2084 2084
 
2085
-					switch ( $key ) {
2085
+					switch ($key) {
2086 2086
 						case 'first_name':
2087
-							$name = explode( ' ', $customer->name, 2 );
2087
+							$name = explode(' ', $customer->name, 2);
2088 2088
 
2089
-							$user_info[ $key ] = $name[0];
2089
+							$user_info[$key] = $name[0];
2090 2090
 							break;
2091 2091
 
2092 2092
 						case 'last_name':
2093
-							$name      = explode( ' ', $customer->name, 2 );
2094
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
2093
+							$name      = explode(' ', $customer->name, 2);
2094
+							$last_name = ! empty($name[1]) ? $name[1] : '';
2095 2095
 
2096
-							$user_info[ $key ] = $last_name;
2096
+							$user_info[$key] = $last_name;
2097 2097
 							break;
2098 2098
 
2099 2099
 						case 'email':
2100
-							$user_info[ $key ] = $customer->email;
2100
+							$user_info[$key] = $customer->email;
2101 2101
 							break;
2102 2102
 					}
2103 2103
 				}
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 	 */
2119 2119
 	private function setup_address() {
2120 2120
 
2121
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
2121
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
2122 2122
 			'line1'   => '',
2123 2123
 			'line2'   => '',
2124 2124
 			'city'    => '',
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
 	 */
2141 2141
 	private function setup_form_title() {
2142 2142
 
2143
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
2143
+		$form_id = $this->get_meta('_give_payment_form_title', true);
2144 2144
 
2145 2145
 		return $form_id;
2146 2146
 	}
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 	 */
2156 2156
 	private function setup_form_id() {
2157 2157
 
2158
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
2158
+		$form_id = $this->get_meta('_give_payment_form_id', true);
2159 2159
 
2160 2160
 		return $form_id;
2161 2161
 	}
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
 	 * @return int The Form Price ID
2170 2170
 	 */
2171 2171
 	private function setup_price_id() {
2172
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
2172
+		$price_id = $this->get_meta('_give_payment_price_id', true);
2173 2173
 
2174 2174
 		return $price_id;
2175 2175
 	}
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 	 * @return string The Payment Key
2184 2184
 	 */
2185 2185
 	private function setup_payment_key() {
2186
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
2186
+		$key = $this->get_meta('_give_payment_purchase_key', true);
2187 2187
 
2188 2188
 		return $key;
2189 2189
 	}
@@ -2199,11 +2199,11 @@  discard block
 block discarded – undo
2199 2199
 	private function setup_payment_number() {
2200 2200
 		$number = $this->ID;
2201 2201
 
2202
-		if ( give_get_option( 'enable_sequential' ) ) {
2202
+		if (give_get_option('enable_sequential')) {
2203 2203
 
2204
-			$number = $this->get_meta( '_give_payment_number', true );
2204
+			$number = $this->get_meta('_give_payment_number', true);
2205 2205
 
2206
-			if ( ! $number ) {
2206
+			if ( ! $number) {
2207 2207
 
2208 2208
 				$number = $this->ID;
2209 2209
 
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 	 * @return array The payment object as an array
2222 2222
 	 */
2223 2223
 	public function array_convert() {
2224
-		return get_object_vars( $this );
2224
+		return get_object_vars($this);
2225 2225
 	}
2226 2226
 
2227 2227
 
@@ -2234,7 +2234,7 @@  discard block
 block discarded – undo
2234 2234
 	 * @return bool
2235 2235
 	 */
2236 2236
 	public function is_completed() {
2237
-		return ( 'publish' === $this->status && $this->completed_date );
2237
+		return ('publish' === $this->status && $this->completed_date);
2238 2238
 	}
2239 2239
 
2240 2240
 	/**
@@ -2246,7 +2246,7 @@  discard block
 block discarded – undo
2246 2246
 	 * @return string Date payment was completed
2247 2247
 	 */
2248 2248
 	private function get_completed_date() {
2249
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2249
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2250 2250
 	}
2251 2251
 
2252 2252
 	/**
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
 	 * @return float Payment subtotal
2259 2259
 	 */
2260 2260
 	private function get_subtotal() {
2261
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2261
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2262 2262
 	}
2263 2263
 
2264 2264
 	/**
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
 	 * @return string Payment currency code
2271 2271
 	 */
2272 2272
 	private function get_currency() {
2273
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2273
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2274 2274
 	}
2275 2275
 
2276 2276
 	/**
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
 	 * @return string Gateway used
2283 2283
 	 */
2284 2284
 	private function get_gateway() {
2285
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2285
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2286 2286
 	}
2287 2287
 
2288 2288
 	/**
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
 	 * @return string Donation ID from merchant processor
2295 2295
 	 */
2296 2296
 	private function get_transaction_id() {
2297
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2297
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2298 2298
 	}
2299 2299
 
2300 2300
 	/**
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
 	 * @return string Payment IP address
2307 2307
 	 */
2308 2308
 	private function get_ip() {
2309
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2309
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2310 2310
 	}
2311 2311
 
2312 2312
 	/**
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 	 * @return int Payment customer ID
2319 2319
 	 */
2320 2320
 	private function get_customer_id() {
2321
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2321
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2322 2322
 	}
2323 2323
 
2324 2324
 	/**
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 	 * @return int Payment user ID
2331 2331
 	 */
2332 2332
 	private function get_user_id() {
2333
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2333
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2334 2334
 	}
2335 2335
 
2336 2336
 	/**
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 	 * @return string Payment customer email
2343 2343
 	 */
2344 2344
 	private function get_email() {
2345
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2345
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2346 2346
 	}
2347 2347
 
2348 2348
 	/**
@@ -2354,7 +2354,7 @@  discard block
 block discarded – undo
2354 2354
 	 * @return array Payment user info
2355 2355
 	 */
2356 2356
 	private function get_user_info() {
2357
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2357
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2358 2358
 	}
2359 2359
 
2360 2360
 	/**
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 	 * @return array Payment billing address
2367 2367
 	 */
2368 2368
 	private function get_address() {
2369
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2369
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2370 2370
 	}
2371 2371
 
2372 2372
 	/**
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
 	 * @return string Payment key
2379 2379
 	 */
2380 2380
 	private function get_key() {
2381
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2381
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2382 2382
 	}
2383 2383
 
2384 2384
 	/**
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
 	 * @return string Payment form id
2391 2391
 	 */
2392 2392
 	private function get_form_id() {
2393
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2393
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2394 2394
 	}
2395 2395
 
2396 2396
 	/**
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
 	 * @return int|string Payment number
2403 2403
 	 */
2404 2404
 	private function get_number() {
2405
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2405
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2406 2406
 	}
2407 2407
 
2408 2408
 }
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @see    Give_Cron::weekly_events()
35 35
 	 */
36 36
 	public function __construct() {
37
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
38
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
37
+		add_filter('cron_schedules', array($this, 'add_schedules'));
38
+		add_action('wp', array($this, 'schedule_Events'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @return array            An array of non-default cron schedules.
50 50
 	 */
51
-	public function add_schedules( $schedules = array() ) {
51
+	public function add_schedules($schedules = array()) {
52 52
 		// Adds once weekly to the existing schedules.
53 53
 		$schedules['weekly'] = array(
54 54
 			'interval' => 604800,
55
-			'display'  => esc_html__( 'Once Weekly', 'give' )
55
+			'display'  => esc_html__('Once Weekly', 'give')
56 56
 		);
57 57
 
58 58
 		return $schedules;
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	private function weekly_events() {
83
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
84
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
83
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
84
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
85 85
 		}
86 86
 	}
87 87
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @return void
95 95
 	 */
96 96
 	private function daily_events() {
97
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
98
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
97
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
98
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
99 99
 		}
100 100
 	}
101 101
 
Please login to merge, or discard this patch.