Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/class-give-db-meta.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	/**
280 280
 	 * Rename query clauses for new meta table
281 281
 	 *
282
-	 * @param $clause
282
+	 * @param string $clause
283 283
 	 * @param $filter
284 284
 	 *
285 285
 	 * @return mixed
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	 * @since 2.0.4
514 514
 	 * @access public
515 515
 	 *
516
-	 * @return string
516
+	 * @return boolean
517 517
 	 */
518 518
 	public function get_meta_type(){
519 519
 		return $this->meta_type;
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 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
 
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 		parent::__construct();
78 78
 
79 79
 		// Bailout.
80
-		if ( empty( $this->supports ) || ! $this->is_custom_meta_table_active() ) {
80
+		if (empty($this->supports) || ! $this->is_custom_meta_table_active()) {
81 81
 			return;
82 82
 		}
83 83
 
84
-		if ( in_array( 'add_post_metadata', $this->supports ) ) {
85
-			add_filter( 'add_post_metadata', array( $this, '__add_meta' ), 0, 5 );
84
+		if (in_array('add_post_metadata', $this->supports)) {
85
+			add_filter('add_post_metadata', array($this, '__add_meta'), 0, 5);
86 86
 		}
87 87
 
88
-		if ( in_array( 'get_post_metadata', $this->supports ) ) {
89
-			add_filter( 'get_post_metadata', array( $this, '__get_meta' ), 0, 4 );
88
+		if (in_array('get_post_metadata', $this->supports)) {
89
+			add_filter('get_post_metadata', array($this, '__get_meta'), 0, 4);
90 90
 		}
91 91
 
92
-		if ( in_array( 'update_post_metadata', $this->supports ) ) {
93
-			add_filter( 'update_post_metadata', array( $this, '__update_meta' ), 0, 5 );
92
+		if (in_array('update_post_metadata', $this->supports)) {
93
+			add_filter('update_post_metadata', array($this, '__update_meta'), 0, 5);
94 94
 		}
95 95
 
96
-		if ( in_array( 'delete_post_metadata', $this->supports ) ) {
97
-			add_filter( 'delete_post_metadata', array( $this, '__delete_meta' ), 0, 5 );
96
+		if (in_array('delete_post_metadata', $this->supports)) {
97
+			add_filter('delete_post_metadata', array($this, '__delete_meta'), 0, 5);
98 98
 		}
99 99
 
100
-		if ( in_array( 'posts_where', $this->supports ) ) {
101
-			add_filter( 'posts_where', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
100
+		if (in_array('posts_where', $this->supports)) {
101
+			add_filter('posts_where', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
102 102
 		}
103 103
 
104
-		if ( in_array( 'posts_join', $this->supports ) ) {
105
-			add_filter( 'posts_join', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
104
+		if (in_array('posts_join', $this->supports)) {
105
+			add_filter('posts_join', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
106 106
 		}
107 107
 
108
-		if ( in_array( 'posts_groupby', $this->supports ) ) {
109
-			add_filter( 'posts_groupby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
108
+		if (in_array('posts_groupby', $this->supports)) {
109
+			add_filter('posts_groupby', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
110 110
 		}
111 111
 
112
-		if ( in_array( 'posts_orderby', $this->supports ) ) {
113
-			add_filter( 'posts_orderby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
112
+		if (in_array('posts_orderby', $this->supports)) {
113
+			add_filter('posts_orderby', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
114 114
 		}
115 115
 	}
116 116
 
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	 * @return  mixed                 Will be an array if $single is false. Will be value of meta data field if $single
129 129
 	 *                                is true.
130 130
 	 */
131
-	public function get_meta( $id = 0, $meta_key = '', $single = false ) {
132
-		$id = $this->sanitize_id( $id );
131
+	public function get_meta($id = 0, $meta_key = '', $single = false) {
132
+		$id = $this->sanitize_id($id);
133 133
 
134 134
 		// Bailout.
135
-		if ( ! $this->is_valid_post_type( $id ) ) {
135
+		if ( ! $this->is_valid_post_type($id)) {
136 136
 			return $this->check;
137 137
 		}
138 138
 
139
-		if ( $this->raw_result ) {
140
-			if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
139
+		if ($this->raw_result) {
140
+			if ( ! ($value = get_metadata($this->meta_type, $id, $meta_key, false))) {
141 141
 				$value = '';
142 142
 			}
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			$this->raw_result = false;
146 146
 
147 147
 		} else {
148
-			$value = get_metadata( $this->meta_type, $id, $meta_key, $single );
148
+			$value = get_metadata($this->meta_type, $id, $meta_key, $single);
149 149
 		}
150 150
 
151 151
 		return $value;
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return  int|bool                  False for failure. True for success.
169 169
 	 */
170
-	public function add_meta( $id = 0, $meta_key = '', $meta_value, $unique = false ) {
171
-		$id = $this->sanitize_id( $id );
170
+	public function add_meta($id = 0, $meta_key = '', $meta_value, $unique = false) {
171
+		$id = $this->sanitize_id($id);
172 172
 
173 173
 		// Bailout.
174
-		if ( ! $this->is_valid_post_type( $id ) ) {
174
+		if ( ! $this->is_valid_post_type($id)) {
175 175
 			return $this->check;
176 176
 		}
177 177
 
178
-		$meta_id = add_metadata( $this->meta_type, $id, $meta_key, $meta_value, $unique );
178
+		$meta_id = add_metadata($this->meta_type, $id, $meta_key, $meta_value, $unique);
179 179
 
180
-		if ( $meta_id ) {
181
-			$this->delete_cache( $id );
180
+		if ($meta_id) {
181
+			$this->delete_cache($id);
182 182
 		}
183 183
 
184 184
 		return $meta_id;
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return  int|bool                  False on failure, true if success.
206 206
 	 */
207
-	public function update_meta( $id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
208
-		$id = $this->sanitize_id( $id );
207
+	public function update_meta($id = 0, $meta_key = '', $meta_value, $prev_value = '') {
208
+		$id = $this->sanitize_id($id);
209 209
 
210 210
 		// Bailout.
211
-		if ( ! $this->is_valid_post_type( $id ) ) {
211
+		if ( ! $this->is_valid_post_type($id)) {
212 212
 			return $this->check;
213 213
 		}
214 214
 
215
-		$meta_id = update_metadata( $this->meta_type, $id, $meta_key, $meta_value, $prev_value );
215
+		$meta_id = update_metadata($this->meta_type, $id, $meta_key, $meta_value, $prev_value);
216 216
 
217
-		if ( $meta_id ) {
218
-			$this->delete_cache( $id );
217
+		if ($meta_id) {
218
+			$this->delete_cache($id);
219 219
 		}
220 220
 
221 221
 		return $meta_id;
@@ -238,18 +238,18 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return  bool                  False for failure. True for success.
240 240
 	 */
241
-	public function delete_meta( $id = 0, $meta_key = '', $meta_value = '', $delete_all = '' ) {
242
-		$id = $this->sanitize_id( $id );
241
+	public function delete_meta($id = 0, $meta_key = '', $meta_value = '', $delete_all = '') {
242
+		$id = $this->sanitize_id($id);
243 243
 
244 244
 		// Bailout.
245
-		if ( ! $this->is_valid_post_type( $id ) ) {
245
+		if ( ! $this->is_valid_post_type($id)) {
246 246
 			return $this->check;
247 247
 		}
248 248
 
249
-		$is_meta_deleted = delete_metadata( $this->meta_type, $id, $meta_key, $meta_value, $delete_all );
249
+		$is_meta_deleted = delete_metadata($this->meta_type, $id, $meta_key, $meta_value, $delete_all);
250 250
 
251
-		if ( $is_meta_deleted ) {
252
-			$this->delete_cache( $id );
251
+		if ($is_meta_deleted) {
252
+			$this->delete_cache($id);
253 253
 		}
254 254
 
255 255
 		return $is_meta_deleted;
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @return string
268 268
 	 */
269
-	public function __rename_meta_table_name_in_query( $clause, $wp_query ) {
269
+	public function __rename_meta_table_name_in_query($clause, $wp_query) {
270 270
 		// Add new table to sql query.
271
-		if ( $this->is_post_type_query( $wp_query ) && ! empty( $wp_query->meta_query->queries ) ) {
272
-			$clause = $this->__rename_meta_table_name( $clause, current_filter() );
271
+		if ($this->is_post_type_query($wp_query) && ! empty($wp_query->meta_query->queries)) {
272
+			$clause = $this->__rename_meta_table_name($clause, current_filter());
273 273
 		}
274 274
 
275 275
 		return $clause;
@@ -284,39 +284,39 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return mixed
286 286
 	 */
287
-	public function __rename_meta_table_name( $clause, $filter ){
287
+	public function __rename_meta_table_name($clause, $filter) {
288 288
 		global $wpdb;
289 289
 
290
-		$clause = str_replace( "{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause );
291
-		$clause = str_replace( $wpdb->postmeta, $this->table_name, $clause );
290
+		$clause = str_replace("{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause);
291
+		$clause = str_replace($wpdb->postmeta, $this->table_name, $clause);
292 292
 
293
-		switch( $filter ) {
293
+		switch ($filter) {
294 294
 			case 'posts_join':
295
-				$joins = array( 'INNER JOIN', 'LEFT JOIN' );
295
+				$joins = array('INNER JOIN', 'LEFT JOIN');
296 296
 
297
-				foreach ( $joins as $join ) {
298
-					if( false !== strpos( $clause, $join ) ) {
299
-						$clause = explode( $join, $clause );
297
+				foreach ($joins as $join) {
298
+					if (false !== strpos($clause, $join)) {
299
+						$clause = explode($join, $clause);
300 300
 
301
-						foreach ( $clause as $key => $clause_part ) {
302
-							if( empty( $clause_part ) ) {
301
+						foreach ($clause as $key => $clause_part) {
302
+							if (empty($clause_part)) {
303 303
 								continue;
304 304
 							}
305 305
 
306
-							preg_match( '/' . $wpdb->prefix . 'give_' . $this->meta_type . 'meta AS (.*) ON/', $clause_part, $alias_table_name );
306
+							preg_match('/'.$wpdb->prefix.'give_'.$this->meta_type.'meta AS (.*) ON/', $clause_part, $alias_table_name);
307 307
 
308
-							if( isset( $alias_table_name[1] ) ) {
309
-								$clause[$key] = str_replace( "{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part );
308
+							if (isset($alias_table_name[1])) {
309
+								$clause[$key] = str_replace("{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part);
310 310
 							}
311 311
 						}
312 312
 
313
-						$clause = implode( "{$join} ", $clause );
313
+						$clause = implode("{$join} ", $clause);
314 314
 					}
315 315
 				}
316 316
 				break;
317 317
 
318 318
 			case 'posts_where':
319
-				$clause = str_replace( array( 'mt2.post_id', 'mt1.post_id' ), array( "mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id" ), $clause );
319
+				$clause = str_replace(array('mt2.post_id', 'mt1.post_id'), array("mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id"), $clause);
320 320
 				break;
321 321
 		}
322 322
 
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
 	 *
335 335
 	 * @return bool
336 336
 	 */
337
-	protected function is_post_type_query( $wp_query ) {
337
+	protected function is_post_type_query($wp_query) {
338 338
 		$status = false;
339 339
 
340 340
 		// Check if it is payment query.
341
-		if ( ! empty( $wp_query->query['post_type'] ) ) {
341
+		if ( ! empty($wp_query->query['post_type'])) {
342 342
 			if (
343
-				is_string( $wp_query->query['post_type'] ) &&
343
+				is_string($wp_query->query['post_type']) &&
344 344
 				$this->post_type === $wp_query->query['post_type']
345 345
 			) {
346 346
 				$status = true;
347 347
 			} elseif (
348
-				is_array( $wp_query->query['post_type'] ) &&
349
-				in_array( $this->post_type, $wp_query->query['post_type'] )
348
+				is_array($wp_query->query['post_type']) &&
349
+				in_array($this->post_type, $wp_query->query['post_type'])
350 350
 			) {
351 351
 				$status = true;
352 352
 			}
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @return bool
367 367
 	 */
368
-	protected function is_valid_post_type( $ID ) {
369
-		return $ID && ( $this->post_type === get_post_type( $ID ) );
368
+	protected function is_valid_post_type($ID) {
369
+		return $ID && ($this->post_type === get_post_type($ID));
370 370
 	}
371 371
 
372 372
 	/**
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return void
394 394
 	 */
395
-	private function delete_cache( $id, $meta_type = '' ) {
396
-		$meta_type = empty( $meta_type ) ? $this->meta_type : $meta_type;
395
+	private function delete_cache($id, $meta_type = '') {
396
+		$meta_type = empty($meta_type) ? $this->meta_type : $meta_type;
397 397
 
398 398
 		$group = array(
399 399
 			// 'form'    => 'give-forms',
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 			// 'log'     => 'give-logs',
404 404
 		);
405 405
 
406
-		if ( array_key_exists( $meta_type, $group ) ) {
407
-			Give_Cache::delete_group( $id, $group[ $meta_type ] );
406
+		if (array_key_exists($meta_type, $group)) {
407
+			Give_Cache::delete_group($id, $group[$meta_type]);
408 408
 		}
409 409
 	}
410 410
 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return mixed
421 421
 	 */
422
-	public function __call( $name, $arguments ) {
423
-		switch ( $name ) {
422
+	public function __call($name, $arguments) {
423
+		switch ($name) {
424 424
 			case '__add_meta':
425 425
 				$this->check = $arguments[0];
426 426
 				$id          = $arguments[1];
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
 				$unique      = $arguments[4];
430 430
 
431 431
 				// Bailout.
432
-				if ( ! $this->is_valid_post_type( $id ) ) {
432
+				if ( ! $this->is_valid_post_type($id)) {
433 433
 					return $this->check;
434 434
 				}
435 435
 
436
-				return $this->add_meta( $id, $meta_key, $meta_value, $unique );
436
+				return $this->add_meta($id, $meta_key, $meta_value, $unique);
437 437
 
438 438
 			case '__get_meta':
439 439
 				$this->check = $arguments[0];
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
 				$single      = $arguments[3];
443 443
 
444 444
 				// Bailout.
445
-				if ( ! $this->is_valid_post_type( $id ) ) {
445
+				if ( ! $this->is_valid_post_type($id)) {
446 446
 					return $this->check;
447 447
 				}
448 448
 
449 449
 				$this->raw_result = true;
450 450
 
451
-				return $this->get_meta( $id, $meta_key, $single );
451
+				return $this->get_meta($id, $meta_key, $single);
452 452
 
453 453
 			case '__update_meta':
454 454
 				$this->check = $arguments[0];
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
 				$meta_value  = $arguments[3];
458 458
 
459 459
 				// Bailout.
460
-				if ( ! $this->is_valid_post_type( $id ) ) {
460
+				if ( ! $this->is_valid_post_type($id)) {
461 461
 					return $this->check;
462 462
 				}
463 463
 
464
-				return $this->update_meta( $id, $meta_key, $meta_value );
464
+				return $this->update_meta($id, $meta_key, $meta_value);
465 465
 
466 466
 			case '__delete_meta':
467 467
 				$this->check = $arguments[0];
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
 				$delete_all  = $arguments[3];
472 472
 
473 473
 				// Bailout.
474
-				if ( ! $this->is_valid_post_type( $id ) ) {
474
+				if ( ! $this->is_valid_post_type($id)) {
475 475
 					return $this->check;
476 476
 				}
477 477
 
478
-				return $this->delete_meta( $id, $meta_key, $meta_value, $delete_all );
478
+				return $this->delete_meta($id, $meta_key, $meta_value, $delete_all);
479 479
 		}
480 480
 	}
481 481
 
@@ -500,10 +500,10 @@  discard block
 block discarded – undo
500 500
 			KEY meta_key (meta_key({$this->min_index_length}))
501 501
 			) {$charset_collate};";
502 502
 
503
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
504
-		dbDelta( $sql );
503
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
504
+		dbDelta($sql);
505 505
 
506
-		update_option( $this->table_name . '_db_version', $this->version );
506
+		update_option($this->table_name.'_db_version', $this->version);
507 507
 	}
508 508
 
509 509
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @return string
517 517
 	 */
518
-	public function get_meta_type(){
518
+	public function get_meta_type() {
519 519
 		return $this->meta_type;
520 520
 	}
521 521
 
@@ -529,12 +529,12 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @return  bool  False for failure. True for success.
531 531
 	 */
532
-	public function delete_all_meta( $id = 0 ) {
532
+	public function delete_all_meta($id = 0) {
533 533
 		global $wpdb;
534
-		$status = $wpdb->delete( $this->table_name, array( "{$this->meta_type}_id" => $id ), array( '%d' ) );
534
+		$status = $wpdb->delete($this->table_name, array("{$this->meta_type}_id" => $id), array('%d'));
535 535
 
536
-		if ( $status ) {
537
-			$this->delete_cache( $id, $this->meta_type );
536
+		if ($status) {
537
+			$this->delete_cache($id, $this->meta_type);
538 538
 		}
539 539
 
540 540
 		return $status;
Please login to merge, or discard this patch.
includes/class-give-db.php 1 patch
Spacing   +61 added lines, -61 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
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @access public
73 73
 	 */
74 74
 	public function __construct() {
75
-		if( is_multisite() ) {
76
-			add_action( 'switch_blog', array( $this, 'handle_switch_blog' ), 10, 2 );
75
+		if (is_multisite()) {
76
+			add_action('switch_blog', array($this, 'handle_switch_blog'), 10, 2);
77 77
 		}
78 78
 	}
79 79
 
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return object
113 113
 	 */
114
-	public function get( $row_id ) {
114
+	public function get($row_id) {
115 115
 		/* @var WPDB $wpdb */
116 116
 		global $wpdb;
117 117
 
118 118
 		// Bailout.
119
-		if ( empty( $row_id ) ) {
119
+		if (empty($row_id)) {
120 120
 			return null;
121 121
 		}
122 122
 
123
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
123
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
124 124
 	}
125 125
 
126 126
 	/**
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return object
136 136
 	 */
137
-	public function get_by( $column, $row_id ) {
137
+	public function get_by($column, $row_id) {
138 138
 		/* @var WPDB $wpdb */
139 139
 		global $wpdb;
140 140
 
141 141
 		// Bailout.
142
-		if ( empty( $column ) || empty( $row_id ) ) {
142
+		if (empty($column) || empty($row_id)) {
143 143
 			return null;
144 144
 		}
145 145
 
146
-		$column = esc_sql( $column );
146
+		$column = esc_sql($column);
147 147
 
148
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
148
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
149 149
 	}
150 150
 
151 151
 	/**
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @return string      Column value.
161 161
 	 */
162
-	public function get_column( $column, $row_id ) {
162
+	public function get_column($column, $row_id) {
163 163
 		/* @var WPDB $wpdb */
164 164
 		global $wpdb;
165 165
 
166 166
 		// Bailout.
167
-		if ( empty( $column ) || empty( $row_id ) ) {
167
+		if (empty($column) || empty($row_id)) {
168 168
 			return null;
169 169
 		}
170 170
 
171
-		$column = esc_sql( $column );
171
+		$column = esc_sql($column);
172 172
 
173
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
173
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
174 174
 	}
175 175
 
176 176
 	/**
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string
187 187
 	 */
188
-	public function get_column_by( $column, $column_where, $column_value ) {
188
+	public function get_column_by($column, $column_where, $column_value) {
189 189
 		/* @var WPDB $wpdb */
190 190
 		global $wpdb;
191 191
 
192 192
 		// Bailout.
193
-		if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) {
193
+		if (empty($column) || empty($column_where) || empty($column_value)) {
194 194
 			return null;
195 195
 		}
196 196
 
197
-		$column_where = esc_sql( $column_where );
198
-		$column       = esc_sql( $column );
197
+		$column_where = esc_sql($column_where);
198
+		$column       = esc_sql($column);
199 199
 
200
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
200
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
201 201
 	}
202 202
 
203 203
 	/**
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return int
213 213
 	 */
214
-	public function insert( $data, $type = '' ) {
214
+	public function insert($data, $type = '') {
215 215
 		/* @var WPDB $wpdb */
216 216
 		global $wpdb;
217 217
 
218 218
 		// Set default values.
219
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
219
+		$data = wp_parse_args($data, $this->get_column_defaults());
220 220
 
221 221
 		/**
222 222
 		 * Fires before inserting data to the database.
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		 *
226 226
 		 * @param array $data
227 227
 		 */
228
-		do_action( "give_pre_insert_{$type}", $data );
228
+		do_action("give_pre_insert_{$type}", $data);
229 229
 
230 230
 		// Initialise column format array
231 231
 		$column_formats = $this->get_columns();
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 		// $data = array_change_key_case( $data );
235 235
 
236 236
 		// White list columns
237
-		$data = array_intersect_key( $data, $column_formats );
237
+		$data = array_intersect_key($data, $column_formats);
238 238
 
239 239
 		// Reorder $column_formats to match the order of columns given in $data
240
-		$data_keys      = array_keys( $data );
241
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
240
+		$data_keys      = array_keys($data);
241
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
242 242
 
243
-		$wpdb->insert( $this->table_name, $data, $column_formats );
243
+		$wpdb->insert($this->table_name, $data, $column_formats);
244 244
 
245 245
 		/**
246 246
 		 * Fires after inserting data to the database.
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		 * @param int   $insert_id
251 251
 		 * @param array $data
252 252
 		 */
253
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
253
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
254 254
 
255 255
 		return $wpdb->insert_id;
256 256
 	}
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return bool
269 269
 	 */
270
-	public function update( $row_id, $data = array(), $where = '' ) {
270
+	public function update($row_id, $data = array(), $where = '') {
271 271
 		/* @var WPDB $wpdb */
272 272
 		global $wpdb;
273 273
 
274 274
 		// Row ID must be positive integer
275
-		$row_id = absint( $row_id );
275
+		$row_id = absint($row_id);
276 276
 
277
-		if ( empty( $row_id ) ) {
277
+		if (empty($row_id)) {
278 278
 			return false;
279 279
 		}
280 280
 
281
-		if ( empty( $where ) ) {
281
+		if (empty($where)) {
282 282
 			$where = $this->primary_key;
283 283
 		}
284 284
 
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
 		$column_formats = $this->get_columns();
287 287
 
288 288
 		// Force fields to lower case
289
-		$data = array_change_key_case( $data );
289
+		$data = array_change_key_case($data);
290 290
 
291 291
 		// White list columns
292
-		$data = array_intersect_key( $data, $column_formats );
292
+		$data = array_intersect_key($data, $column_formats);
293 293
 
294 294
 		// Reorder $column_formats to match the order of columns given in $data
295
-		$data_keys      = array_keys( $data );
296
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
295
+		$data_keys      = array_keys($data);
296
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
297 297
 
298
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
298
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
299 299
 			return false;
300 300
 		}
301 301
 
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return bool
314 314
 	 */
315
-	public function delete( $row_id = 0 ) {
315
+	public function delete($row_id = 0) {
316 316
 		/* @var WPDB $wpdb */
317 317
 		global $wpdb;
318 318
 
319 319
 		// Row ID must be positive integer
320
-		$row_id = absint( $row_id );
320
+		$row_id = absint($row_id);
321 321
 
322
-		if ( empty( $row_id ) ) {
322
+		if (empty($row_id)) {
323 323
 			return false;
324 324
 		}
325 325
 
326
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
326
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
327 327
 			return false;
328 328
 		}
329 329
 
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return bool          If the table name exists.
342 342
 	 */
343
-	public function table_exists( $table ) {
343
+	public function table_exists($table) {
344 344
 		/* @var WPDB $wpdb */
345 345
 		global $wpdb;
346 346
 
347
-		$table = sanitize_text_field( $table );
347
+		$table = sanitize_text_field($table);
348 348
 
349
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
349
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
350 350
 	}
351 351
 
352 352
 	/**
@@ -360,16 +360,16 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @return bool
362 362
 	 */
363
-	public function does_column_exist( $column_name ) {
363
+	public function does_column_exist($column_name) {
364 364
 
365 365
 		global $wpdb;
366 366
 
367
-		$column = $wpdb->get_results( $wpdb->prepare(
367
+		$column = $wpdb->get_results($wpdb->prepare(
368 368
 			"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ",
369 369
 			DB_NAME, $this->table_name, $column_name
370
-		) );
370
+		));
371 371
 
372
-		if ( ! empty( $column ) ) {
372
+		if ( ! empty($column)) {
373 373
 			return true;
374 374
 		}
375 375
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
386 386
 	 */
387 387
 	public function installed() {
388
-		return $this->table_exists( $this->table_name );
388
+		return $this->table_exists($this->table_name);
389 389
 	}
390 390
 
391 391
 	/**
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @access public
396 396
 	 */
397 397
 	public function register_table() {
398
-		$current_version = get_option( $this->table_name . '_db_version' );
399
-		if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) {
398
+		$current_version = get_option($this->table_name.'_db_version');
399
+		if ( ! $current_version || version_compare($current_version, $this->version, '<')) {
400 400
 			$this->create_table();
401 401
 		}
402 402
 	}
@@ -421,23 +421,23 @@  discard block
 block discarded – undo
421 421
 	 *
422 422
 	 * @return int|bool                The normalized log ID or false if it's found to not be valid.
423 423
 	 */
424
-	public function sanitize_id( $id ) {
425
-		if ( ! is_numeric( $id ) ) {
424
+	public function sanitize_id($id) {
425
+		if ( ! is_numeric($id)) {
426 426
 			return false;
427 427
 		}
428 428
 
429 429
 		$id = (int) $id;
430 430
 
431 431
 		// We were given a non positive number.
432
-		if ( absint( $id ) !== $id ) {
432
+		if (absint($id) !== $id) {
433 433
 			return false;
434 434
 		}
435 435
 
436
-		if ( empty( $id ) ) {
436
+		if (empty($id)) {
437 437
 			return false;
438 438
 		}
439 439
 
440
-		return absint( $id );
440
+		return absint($id);
441 441
 
442 442
 	}
443 443
 
@@ -451,23 +451,23 @@  discard block
 block discarded – undo
451 451
 	 * @param $new_blog_id
452 452
 	 * @param $prev_blog_id
453 453
 	 */
454
-	public function handle_switch_blog( $new_blog_id, $prev_blog_id ) {
454
+	public function handle_switch_blog($new_blog_id, $prev_blog_id) {
455 455
 		global $wpdb;
456 456
 
457 457
 		// Bailout.
458
-		if ( $new_blog_id === $prev_blog_id ) {
458
+		if ($new_blog_id === $prev_blog_id) {
459 459
 			return;
460 460
 		}
461 461
 
462 462
 
463 463
 		$this->table_name = str_replace(
464
-			1 != $prev_blog_id ? $wpdb->get_blog_prefix( $prev_blog_id ) : $wpdb->base_prefix,
465
-			1 != $new_blog_id ? $wpdb->get_blog_prefix( $new_blog_id ) : $wpdb->base_prefix,
464
+			1 != $prev_blog_id ? $wpdb->get_blog_prefix($prev_blog_id) : $wpdb->base_prefix,
465
+			1 != $new_blog_id ? $wpdb->get_blog_prefix($new_blog_id) : $wpdb->base_prefix,
466 466
 			$this->table_name
467 467
 		);
468 468
 
469
-		if ( $this instanceof Give_DB_Meta ) {
470
-			$wpdb->{$this->get_meta_type() . 'meta'} = $this->table_name;
469
+		if ($this instanceof Give_DB_Meta) {
470
+			$wpdb->{$this->get_meta_type().'meta'} = $this->table_name;
471 471
 		}
472 472
 
473 473
 	}
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -505,7 +505,7 @@
 block discarded – undo
505 505
 	 *
506 506
 	 * @param string $main_file Plugin Main File.
507 507
 	 *
508
-	 * @return bool|mixed|string
508
+	 * @return string
509 509
 	 */
510 510
 	public function get_plugin_folder_name( $main_file ) {
511 511
 		// Remove plugin file and get the Add-on's folder name only.
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	 *                               'testing'           => false, // (required) Never leave as "true" in production!!!
36 36
 	 *                               }
37 37
 	 */
38
-	function __construct( $_banner_details ) {
38
+	function __construct($_banner_details) {
39 39
 		global $give_addons, $pagenow;
40 40
 
41 41
 		// Append add-on information to the global variable.
42 42
 		$give_addons[] = $_banner_details;
43 43
 
44
-		if ( 'plugins.php' === $pagenow ) {
44
+		if ('plugins.php' === $pagenow) {
45 45
 
46 46
 			// Get the current user.
47 47
 			$current_user  = wp_get_current_user();
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 			$this->add_addon_activate_meta();
55 55
 
56 56
 			// Check if notice callback is already hooked.
57
-			if ( ! $this->is_banner_notice_hooked() ) {
57
+			if ( ! $this->is_banner_notice_hooked()) {
58 58
 				// If multiple add-on are activated then show activation banner in tab view.
59
-				add_action( 'admin_notices', array( $this, 'addon_activation_banner_notices' ), 10 );
59
+				add_action('admin_notices', array($this, 'addon_activation_banner_notices'), 10);
60 60
 			}
61 61
 		}
62 62
 	}
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return string
71 71
 	 */
72
-	public static function get_banner_user_meta_key( $addon_banner_key ) {
73
-		$addon_slug = sanitize_text_field( $addon_banner_key );
72
+	public static function get_banner_user_meta_key($addon_banner_key) {
73
+		$addon_slug = sanitize_text_field($addon_banner_key);
74 74
 
75 75
 		return "give_addon_{$addon_slug}_active_by_user";
76 76
 	}
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function init() {
87 87
 		// Get the current page to add the notice to
88
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
88
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
89 89
 
90 90
 		// Get the Give add-ons.
91 91
 		$give_addons = $this->get_plugin_file_names();
92 92
 
93
-		if ( ! empty( $give_addons ) ) {
93
+		if ( ! empty($give_addons)) {
94 94
 
95 95
 			// Go through each of the add-on and hook deactivate action.
96
-			foreach ( $give_addons as $addon_name => $give_addon ) {
96
+			foreach ($give_addons as $addon_name => $give_addon) {
97 97
 
98 98
 				// Testing?
99
-				if ( true === $give_addon['testing'] ) {
100
-					$nag_meta_key = 'give_addon_activation_ignore_' . $addon_name;
101
-					delete_user_meta( $this->user_id, $nag_meta_key );
99
+				if (true === $give_addon['testing']) {
100
+					$nag_meta_key = 'give_addon_activation_ignore_'.$addon_name;
101
+					delete_user_meta($this->user_id, $nag_meta_key);
102 102
 				}
103 103
 
104 104
 				// Add deactivate hook.
105
-				add_action( 'deactivate_' . $give_addon['plugin_main_file'], array( $this, 'remove_addon_activate_meta' ) );
105
+				add_action('deactivate_'.$give_addon['plugin_main_file'], array($this, 'remove_addon_activate_meta'));
106 106
 			}
107 107
 		}
108 108
 	}
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 		global $give_addons;
119 119
 
120 120
 		// Get recently activated plugins.
121
-		$active_plugins = get_option( 'active_plugins' );
121
+		$active_plugins = get_option('active_plugins');
122 122
 
123 123
 		$file_names = array();
124 124
 
125
-		if ( empty( $give_addons ) ) {
125
+		if (empty($give_addons)) {
126 126
 			return $file_names;
127 127
 		}
128 128
 
129 129
 		// Go through each addon and get the plugin file url.
130
-		foreach ( $give_addons as $give_addon ) {
130
+		foreach ($give_addons as $give_addon) {
131 131
 			$file_name = '';
132
-			$file_path = explode( '/plugins/', $give_addon['file'] );
133
-			if ( $file_path ) {
134
-				$file_path = array_pop( $file_path );
135
-				$file_name = current( explode( '/', $file_path ) );
132
+			$file_path = explode('/plugins/', $give_addon['file']);
133
+			if ($file_path) {
134
+				$file_path = array_pop($file_path);
135
+				$file_name = current(explode('/', $file_path));
136 136
 			}
137 137
 
138
-			if ( ! empty( $file_name ) ) {
139
-				foreach ( $active_plugins as $plugin ) {
140
-					if ( false !== strpos( $plugin, $file_name ) ) {
141
-						$add_on_key                     = sanitize_title( $give_addon['name'] );
138
+			if ( ! empty($file_name)) {
139
+				foreach ($active_plugins as $plugin) {
140
+					if (false !== strpos($plugin, $file_name)) {
141
+						$add_on_key                     = sanitize_title($give_addon['name']);
142 142
 						$give_addon['plugin_main_file'] = $plugin; // Include plugin file.
143
-						$file_names[ $add_on_key ]      = $give_addon;
143
+						$file_names[$add_on_key]      = $give_addon;
144 144
 						break;
145 145
 					}
146 146
 				}
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 		// Get all activated add-ons.
161 161
 		$give_addons = $this->get_plugin_file_names();
162 162
 
163
-		if ( ! empty( $give_addons ) ) {
163
+		if ( ! empty($give_addons)) {
164 164
 
165 165
 			// Go through rach add-ons and add meta data.
166
-			foreach ( $give_addons as $banner_addon_name => $addon ) {
166
+			foreach ($give_addons as $banner_addon_name => $addon) {
167 167
 
168 168
 				// User meta key.
169
-				$user_id = __give_get_active_by_user_meta( $banner_addon_name );
169
+				$user_id = __give_get_active_by_user_meta($banner_addon_name);
170 170
 
171
-				if ( ! $user_id ) {
172
-					update_option( self::get_banner_user_meta_key( $banner_addon_name ), $this->user_id, '' );
171
+				if ( ! $user_id) {
172
+					update_option(self::get_banner_user_meta_key($banner_addon_name), $this->user_id, '');
173 173
 				}
174 174
 			}
175 175
 		}
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 		global $wp_filter;
187 187
 		$notice_already_hooked = false;
188 188
 
189
-		if ( isset( $wp_filter['admin_notices']->callbacks[10] ) ) {
189
+		if (isset($wp_filter['admin_notices']->callbacks[10])) {
190 190
 			// Get all of the hooks.
191
-			$admin_notice_callbacks = array_keys( $wp_filter['admin_notices']->callbacks[10] );
191
+			$admin_notice_callbacks = array_keys($wp_filter['admin_notices']->callbacks[10]);
192 192
 
193
-			if ( ! empty( $admin_notice_callbacks ) ) {
194
-				foreach ( $admin_notice_callbacks as $key ) {
193
+			if ( ! empty($admin_notice_callbacks)) {
194
+				foreach ($admin_notice_callbacks as $key) {
195 195
 					//If the key is found in your string, set $found to true
196
-					if ( false !== strpos( $key, 'addon_activation_banner_notices' ) ) {
196
+					if (false !== strpos($key, 'addon_activation_banner_notices')) {
197 197
 						$notice_already_hooked = true;
198 198
 					}
199 199
 				}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		global $pagenow, $give_addons;
213 213
 
214 214
 		// Bailout.
215
-		if ( 'plugins.php' !== $pagenow ) {
215
+		if ('plugins.php' !== $pagenow) {
216 216
 			return false;
217 217
 		}
218 218
 
@@ -224,55 +224,55 @@  discard block
 block discarded – undo
224 224
 		$latest_addon     = array();
225 225
 
226 226
 		// Get the plugin folder name, because many give-addon not sending proper plugin_file.
227
-		if ( ! empty( $recent_activated ) ) {
228
-			foreach ( $recent_activated as $recent_addon ) {
227
+		if ( ! empty($recent_activated)) {
228
+			foreach ($recent_activated as $recent_addon) {
229 229
 				// Get the add-on folder name.
230
-				$latest_addon[] = substr( $recent_addon, 0, strpos( $recent_addon, '/' ) );
230
+				$latest_addon[] = substr($recent_addon, 0, strpos($recent_addon, '/'));
231 231
 			}
232 232
 		}
233 233
 
234 234
 		// Go through each of the give add-on.
235
-		foreach ( $give_addons as $addon ) {
236
-			$addon_sanitized_name = sanitize_title( $addon['name'] );
235
+		foreach ($give_addons as $addon) {
236
+			$addon_sanitized_name = sanitize_title($addon['name']);
237 237
 
238 238
 			// Get the add-on dismiss status.
239
-			$add_on_state = get_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true );
239
+			$add_on_state = get_user_meta($this->user_id, "give_addon_activation_ignore_{$addon_sanitized_name}", true);
240 240
 
241 241
 			// Get the option key.
242
-			$activate_by_user = (int) __give_get_active_by_user_meta( $addon_sanitized_name );
242
+			$activate_by_user = (int) __give_get_active_by_user_meta($addon_sanitized_name);
243 243
 
244 244
 			// Remove plugin file and get the Add-on's folder name only.
245
-			$file_path = $this->get_plugin_folder_name( $addon['file'] );
245
+			$file_path = $this->get_plugin_folder_name($addon['file']);
246 246
 
247 247
 			// If add-on were never dismissed.
248
-			if ( 'true' !== $add_on_state && $this->user_id === $activate_by_user ) {
249
-				if ( ! empty( $latest_addon ) && ( in_array( $file_path, $latest_addon, true ) || empty( $latest_addon ) ) ) {
248
+			if ('true' !== $add_on_state && $this->user_id === $activate_by_user) {
249
+				if ( ! empty($latest_addon) && (in_array($file_path, $latest_addon, true) || empty($latest_addon))) {
250 250
 					$addon_to_display[] = $addon;
251 251
 				}
252 252
 			}
253 253
 		}
254 254
 
255
-		if ( ! empty( $addon_to_display ) ) {
255
+		if ( ! empty($addon_to_display)) {
256 256
 			ob_start();
257 257
 
258 258
 			// Output inline styles here because there's no reason
259 259
 			// to enqueued them after the alert is dismissed.
260 260
 			$this->print_css_js();
261 261
 			?>
262
-			<div class="<?php echo ( 1 !== count( $addon_to_display ) ) ? 'give-alert-tab-wrapper' : ''; ?> updated give-addon-alert give-notice">
262
+			<div class="<?php echo (1 !== count($addon_to_display)) ? 'give-alert-tab-wrapper' : ''; ?> updated give-addon-alert give-notice">
263 263
 				<?php
264 264
 				// If multiple add-on are activated.
265
-				if ( 1 !== count( $addon_to_display ) ) {
265
+				if (1 !== count($addon_to_display)) {
266 266
 					?>
267 267
 					<div class="give-vertical-tab">
268 268
 						<div class="give-addon-tab-list">
269 269
 							<ul class="give-alert-addon-list">
270 270
 								<?php
271 271
 								$is_first = true;
272
-								foreach ( $addon_to_display as $banner ) {
272
+								foreach ($addon_to_display as $banner) {
273 273
 									?>
274
-									<li class="give-tab-list<?php echo ( true === $is_first ) ? ' active' : ''; ?>" id="give-addon-<?php echo esc_attr( basename( $banner['file'], '.php' ) ); ?>">
275
-										<a href="#"><?php echo esc_html( $banner['name'] ); ?></a>
274
+									<li class="give-tab-list<?php echo (true === $is_first) ? ' active' : ''; ?>" id="give-addon-<?php echo esc_attr(basename($banner['file'], '.php')); ?>">
275
+										<a href="#"><?php echo esc_html($banner['name']); ?></a>
276 276
 									</li>
277 277
 									<?php
278 278
 									$is_first = false;
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
 							</ul>
283 283
 						</div>
284 284
 						<div class="give-right-side-block">
285
-							<?php foreach ( $addon_to_display as $banner ) : ?>
286
-								<div class="give-tab-details <?php echo ( true === $is_first ) ? ' active' : ''; ?> " id="give-addon-<?php echo esc_attr( basename( $banner['file'], '.php' ) ); ?>">
285
+							<?php foreach ($addon_to_display as $banner) : ?>
286
+								<div class="give-tab-details <?php echo (true === $is_first) ? ' active' : ''; ?> " id="give-addon-<?php echo esc_attr(basename($banner['file'], '.php')); ?>">
287 287
 									<?php
288 288
 										// Render single add banner.
289
-										$this->render_single_addon_banner( $banner, false );
289
+										$this->render_single_addon_banner($banner, false);
290 290
 										$is_first = false;
291 291
 									?>
292 292
 								</div>
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 					</div>
296 296
 					<?php
297 297
 				} else {
298
-					$this->render_single_addon_banner( $addon_to_display[0], true );
298
+					$this->render_single_addon_banner($addon_to_display[0], true);
299 299
 				}
300 300
 				?>
301 301
 			</div>
@@ -303,12 +303,12 @@  discard block
 block discarded – undo
303 303
 			$notice_html = ob_get_clean();
304 304
 
305 305
 			// Register notice.
306
-			Give()->notices->register_notice( array(
306
+			Give()->notices->register_notice(array(
307 307
 				'id'               => 'give_add_on_activation_notice',
308 308
 				'type'             => 'updated',
309 309
 				'description_html' => $notice_html,
310 310
 				'show'             => true,
311
-			) );
311
+			));
312 312
 		}
313 313
 	}
314 314
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * @param array $banner_arr Banner options.
321 321
 	 * @param bool  $is_single  Is single.
322 322
 	 */
323
-	private function render_single_addon_banner( $banner_arr, $is_single ) {
323
+	private function render_single_addon_banner($banner_arr, $is_single) {
324 324
 		// Get all give add-on.
325 325
 		$give_addons = give_get_plugins();
326 326
 
@@ -328,80 +328,80 @@  discard block
 block discarded – undo
328 328
 		$plugin_file = $banner_arr['file'];
329 329
 
330 330
 		// Get the plugin main file.
331
-		foreach ( $give_addons as $main_file => $addon ) {
331
+		foreach ($give_addons as $main_file => $addon) {
332 332
 			// Plugin should be activated.
333
-			if ( ! is_plugin_active( $main_file ) ) {
333
+			if ( ! is_plugin_active($main_file)) {
334 334
 				continue;
335 335
 			}
336 336
 
337 337
 			if (
338
-				isset( $banner_arr['name'] )
338
+				isset($banner_arr['name'])
339 339
 				&& 'add-on' === $addon['Type']
340
-				&& $this->get_plugin_folder_name( $main_file ) === $this->get_plugin_folder_name( $plugin_file )
340
+				&& $this->get_plugin_folder_name($main_file) === $this->get_plugin_folder_name($plugin_file)
341 341
 			) {
342
-				$plugin_file = WP_PLUGIN_DIR . '/' . $main_file;
342
+				$plugin_file = WP_PLUGIN_DIR.'/'.$main_file;
343 343
 				break;
344 344
 			}
345 345
 		}
346 346
 
347 347
 		// Create dismiss URL.
348 348
 		$dismiss_url = $is_single
349
-			? admin_url( 'plugins.php?give_addon_activation_ignore=1&give_addon=' . sanitize_title( $banner_arr['name'] ) )
350
-			: admin_url( 'plugins.php?give_addon_activation_ignore=1&give_addon=all' );
349
+			? admin_url('plugins.php?give_addon_activation_ignore=1&give_addon='.sanitize_title($banner_arr['name']))
350
+			: admin_url('plugins.php?give_addon_activation_ignore=1&give_addon=all');
351 351
 
352 352
 		// Get the add-on details.
353
-		$plugin_data = get_plugin_data( $plugin_file );
353
+		$plugin_data = get_plugin_data($plugin_file);
354 354
 		?>
355
-		<img src="<?php echo esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg' ); ?>" class="give-logo" />
355
+		<img src="<?php echo esc_url(GIVE_PLUGIN_URL.'assets/dist/images/give-icon-full-circle.svg'); ?>" class="give-logo" />
356 356
 		<div class="give-alert-message">
357 357
 			<h3>
358 358
 				<?php
359 359
 				printf(
360 360
 					/* translators: %s: Add-on name */
361 361
 					'%s<span>%s</span>',
362
-					__( 'New Give Add-on Activated: ', 'give' ),
363
-					esc_html( $banner_arr['name'] )
362
+					__('New Give Add-on Activated: ', 'give'),
363
+					esc_html($banner_arr['name'])
364 364
 				);
365 365
 				?>
366 366
 			</h3>
367
-			<a href="<?php echo esc_url( $dismiss_url ); ?>" class="dismiss">
367
+			<a href="<?php echo esc_url($dismiss_url); ?>" class="dismiss">
368 368
 				<span class="dashicons dashicons-dismiss"></span>
369 369
 			</a>
370 370
 			<div class="alert-actions">
371 371
 				<?php
372 372
 				//Point them to your settings page.
373
-				if ( ! empty( $plugin_data['Description'] ) ) {
373
+				if ( ! empty($plugin_data['Description'])) {
374 374
 					?>
375 375
 					<span class="give-addon-description">
376
-					<em><?php echo esc_html( strip_tags( $plugin_data['Description'] ) ); ?></em></span><br />
376
+					<em><?php echo esc_html(strip_tags($plugin_data['Description'])); ?></em></span><br />
377 377
 					<?php
378 378
 				}
379
-				if ( isset( $banner_arr['settings_url'] ) ) {
379
+				if (isset($banner_arr['settings_url'])) {
380 380
 					printf(
381 381
 						'<a href="%s"><span class="dashicons dashicons-admin-settings"></span>%s</a>',
382
-						esc_url( $banner_arr['settings_url'] ),
383
-						esc_html__( 'Go to Settings', 'give' )
382
+						esc_url($banner_arr['settings_url']),
383
+						esc_html__('Go to Settings', 'give')
384 384
 					);
385 385
 				}
386 386
 				// Show them how to configure the Addon.
387
-				if ( isset( $banner_arr['documentation_url'] ) ) {
387
+				if (isset($banner_arr['documentation_url'])) {
388 388
 					printf(
389 389
 						'<a href="%s" target="_blank"><span class="dashicons dashicons-media-text"></span>%s</a>',
390
-						esc_url( $banner_arr['documentation_url'] ),
390
+						esc_url($banner_arr['documentation_url']),
391 391
 						sprintf(
392 392
 							/* translators: %s: Add-on name */
393
-							esc_html__( 'Documentation: %s Add-on', 'give' ),
394
-							esc_html( $banner_arr['name'] )
393
+							esc_html__('Documentation: %s Add-on', 'give'),
394
+							esc_html($banner_arr['name'])
395 395
 						)
396 396
 					);
397 397
 				}
398 398
 
399 399
 				//Let them signup for plugin updates
400
-				if ( isset( $banner_arr['support_url'] ) ) {
400
+				if (isset($banner_arr['support_url'])) {
401 401
 					printf(
402 402
 						'<a href="%s" target="_blank"><span class="dashicons dashicons-sos"></span>%s</a>',
403
-						esc_url( $banner_arr['support_url'] ),
404
-						esc_html__( 'Get Support', 'give' )
403
+						esc_url($banner_arr['support_url']),
404
+						esc_html__('Get Support', 'give')
405 405
 					);
406 406
 				}
407 407
 				?>
@@ -424,30 +424,30 @@  discard block
 block discarded – undo
424 424
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
425 425
 		 */
426 426
 		if (
427
-			isset( $_GET['give_addon'], $_GET['give_addon_activation_ignore'] )
427
+			isset($_GET['give_addon'], $_GET['give_addon_activation_ignore'])
428 428
 			&& '1' === $_GET['give_addon_activation_ignore']
429 429
 		) {
430 430
 			// Get the value of the 'give_addon' query string.
431
-			$addon_query_arg    = sanitize_text_field( wp_unslash( $_GET['give_addon'] ) );
431
+			$addon_query_arg    = sanitize_text_field(wp_unslash($_GET['give_addon']));
432 432
 			$deactivated_addons = array();
433 433
 
434 434
 			// If All add-on requested to dismiss.
435
-			if ( 'all' === $addon_query_arg ) {
435
+			if ('all' === $addon_query_arg) {
436 436
 				// Get all activated add-ons.
437 437
 				$give_addons = $this->get_plugin_file_names();
438 438
 
439
-				if ( ! empty( $give_addons ) ) {
440
-					$deactivated_addons = array_keys( $give_addons );
439
+				if ( ! empty($give_addons)) {
440
+					$deactivated_addons = array_keys($give_addons);
441 441
 				}
442 442
 			} else {
443 443
 				// Store the addon to deactivate.
444 444
 				$deactivated_addons[] = $addon_query_arg;
445 445
 			}
446 446
 
447
-			if ( ! empty( $deactivated_addons ) ) {
448
-				foreach ( $deactivated_addons as $addon ) {
447
+			if ( ! empty($deactivated_addons)) {
448
+				foreach ($deactivated_addons as $addon) {
449 449
 					// Record it user meta.
450
-					add_user_meta( $this->user_id, "give_addon_activation_ignore_{$addon}", 'true', true );
450
+					add_user_meta($this->user_id, "give_addon_activation_ignore_{$addon}", 'true', true);
451 451
 				}
452 452
 			}
453 453
 		}
@@ -462,26 +462,26 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	public function remove_addon_activate_meta() {
464 464
 		// Get the hook name and then grab the plugin file from it.
465
-		$plugin_file = str_replace( 'deactivate_', '', current_action() );
465
+		$plugin_file = str_replace('deactivate_', '', current_action());
466 466
 
467 467
 		// Get all activated add-ons.
468 468
 		$give_addons = $this->get_plugin_file_names();
469 469
 
470
-		if ( ! empty( $give_addons ) ) {
471
-			foreach ( $give_addons as $banner_addon_name => $addon ) {
472
-				if ( $plugin_file === $addon['plugin_main_file'] ) {
470
+		if ( ! empty($give_addons)) {
471
+			foreach ($give_addons as $banner_addon_name => $addon) {
472
+				if ($plugin_file === $addon['plugin_main_file']) {
473 473
 
474 474
 					// Get the user meta key.
475
-					$user_id = (int) __give_get_active_by_user_meta( $banner_addon_name );
475
+					$user_id = (int) __give_get_active_by_user_meta($banner_addon_name);
476 476
 
477
-					if ( $user_id ) {
477
+					if ($user_id) {
478 478
 						// Get user meta for this add-on.
479 479
 						$nag_meta_key = "give_addon_activation_ignore_{$banner_addon_name}";
480 480
 
481 481
 						// Delete plugin activation option key.
482
-						delete_option( self::get_banner_user_meta_key( $banner_addon_name ) );
482
+						delete_option(self::get_banner_user_meta_key($banner_addon_name));
483 483
 						// Delete user meta of plugin activation.
484
-						delete_user_meta( $user_id, $nag_meta_key );
484
+						delete_user_meta($user_id, $nag_meta_key);
485 485
 					}
486 486
 				}
487 487
 			}
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @return bool|mixed|string
510 510
 	 */
511
-	public function get_plugin_folder_name( $main_file ) {
511
+	public function get_plugin_folder_name($main_file) {
512 512
 		// Remove plugin file and get the Add-on's folder name only.
513
-		$file_path       = explode( '/plugins/', $main_file );
514
-		$addon_file_path = array_pop( $file_path );
515
-		$addon_file_path = substr( $addon_file_path, 0, strpos( $addon_file_path, '/' ) );
513
+		$file_path       = explode('/plugins/', $main_file);
514
+		$addon_file_path = array_pop($file_path);
515
+		$addon_file_path = substr($addon_file_path, 0, strpos($addon_file_path, '/'));
516 516
 
517 517
 		return $addon_file_path;
518 518
 	}
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param $url
74 74
 	 *
75
-	 * @return mixed
75
+	 * @return string
76 76
 	 */
77 77
 	public function give_update_cmb_meta_box_url( $url ) {
78 78
 		// Path to Give's CMB
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  * @since  1.0
1010 1010
  *
1011 1011
  * @param  array $field_arr
1012
- * @param  array $saved_value
1012
+ * @param  string|boolean $saved_value
1013 1013
  *
1014 1014
  * @return void
1015 1015
  */
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
  * @params $string text
1164 1164
  * @params $filter array
1165 1165
  *
1166
- * @return text $string
1166
+ * @return string $string
1167 1167
  */
1168 1168
 function give_slug_to_title( $string, $filters = array() ) {
1169 1169
 
Please login to merge, or discard this patch.
Spacing   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 
45 45
 		// Custom CMB2 Settings Fields
46
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
47
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
48
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
49
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
50
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
51
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
52
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
53
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
46
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
47
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
48
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
49
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
50
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
51
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
52
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
53
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
54 54
 	}
55 55
 
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @since  1.0
61 61
 	 */
62 62
 	public function init() {
63
-		register_setting( $this->key, $this->key );
63
+		register_setting($this->key, $this->key);
64 64
 
65 65
 	}
66 66
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed
76 76
 	 */
77
-	public function give_update_cmb_meta_box_url( $url ) {
77
+	public function give_update_cmb_meta_box_url($url) {
78 78
 		// Path to Give's CMB
79
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
79
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
80 80
 	}
81 81
 
82 82
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function give_get_settings_tabs() {
90 90
 
91
-		$settings = $this->give_settings( null );
91
+		$settings = $this->give_settings(null);
92 92
 
93 93
 		$tabs             = array();
94
-		$tabs['general']  = __( 'General', 'give' );
95
-		$tabs['gateways'] = __( 'Payment Gateways', 'give' );
96
-		$tabs['display']  = __( 'Display Options', 'give' );
97
-		$tabs['emails']   = __( 'Emails', 'give' );
94
+		$tabs['general']  = __('General', 'give');
95
+		$tabs['gateways'] = __('Payment Gateways', 'give');
96
+		$tabs['display']  = __('Display Options', 'give');
97
+		$tabs['emails']   = __('Emails', 'give');
98 98
 
99
-		if ( ! empty( $settings['addons']['fields'] ) ) {
100
-			$tabs['addons'] = __( 'Add-ons', 'give' );
99
+		if ( ! empty($settings['addons']['fields'])) {
100
+			$tabs['addons'] = __('Add-ons', 'give');
101 101
 		}
102 102
 
103
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
104
-			$tabs['licenses'] = __( 'Licenses', 'give' );
103
+		if ( ! empty($settings['licenses']['fields'])) {
104
+			$tabs['licenses'] = __('Licenses', 'give');
105 105
 		}
106 106
 
107
-		$tabs['advanced']    = __( 'Advanced', 'give' );
108
-		$tabs['api']         = __( 'API', 'give' );
109
-		$tabs['system_info'] = __( 'System Info', 'give' );
107
+		$tabs['advanced']    = __('Advanced', 'give');
108
+		$tabs['api']         = __('API', 'give');
109
+		$tabs['system_info'] = __('System Info', 'give');
110 110
 
111
-		return apply_filters( 'give_settings_tabs', $tabs );
111
+		return apply_filters('give_settings_tabs', $tabs);
112 112
 	}
113 113
 
114 114
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function admin_page_display() {
121 121
 
122
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
122
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
123 123
 
124 124
 		?>
125 125
 
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 
130 130
 			<h2 class="nav-tab-wrapper">
131 131
 				<?php
132
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
132
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
133 133
 
134
-					$tab_url = esc_url( add_query_arg( array(
134
+					$tab_url = esc_url(add_query_arg(array(
135 135
 						'settings-updated' => false,
136 136
 						'tab'              => $tab_id,
137
-					) ) );
137
+					)));
138 138
 
139 139
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
140 140
 
141
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
141
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
142 142
 
143 143
 				}
144 144
 				?>
145 145
 			</h2>
146 146
 
147
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
147
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
148 148
 
149 149
 		</div><!-- .wrap -->
150 150
 
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return string
168 168
 	 */
169
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
169
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
170 170
 
171 171
 		// only modify the give settings form
172
-		if ( 'give_settings' == $object_id ) {
172
+		if ('give_settings' == $object_id) {
173 173
 
174
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
174
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>';
175 175
 
176 176
 		}
177 177
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return array
190 190
 	 */
191
-	public function give_settings( $active_tab ) {
191
+	public function give_settings($active_tab) {
192 192
 
193 193
 		$give_settings = array(
194 194
 			/**
@@ -196,99 +196,99 @@  discard block
 block discarded – undo
196 196
 			 */
197 197
 			'general'     => array(
198 198
 				'id'         => 'general_settings',
199
-				'give_title' => __( 'General Settings', 'give' ),
200
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
201
-				'fields'     => apply_filters( 'give_settings_general', array(
199
+				'give_title' => __('General Settings', 'give'),
200
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
201
+				'fields'     => apply_filters('give_settings_general', array(
202 202
 						array(
203
-							'name' => __( 'General Settings', 'give' ),
203
+							'name' => __('General Settings', 'give'),
204 204
 							'desc' => '',
205 205
 							'type' => 'give_title',
206 206
 							'id'   => 'give_title_general_settings_1',
207 207
 						),
208 208
 						array(
209
-							'name'    => __( 'Success Page', 'give' ),
209
+							'name'    => __('Success Page', 'give'),
210 210
 							/* translators: %s: [give_receipt] */
211
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
211
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
212 212
 							'id'      => 'success_page',
213 213
 							'type'    => 'select',
214
-							'options' => give_cmb2_get_post_options( array(
214
+							'options' => give_cmb2_get_post_options(array(
215 215
 								'post_type'   => 'page',
216 216
 								'numberposts' => 999,
217
-							) ),
217
+							)),
218 218
 						),
219 219
 						array(
220
-							'name'    => __( 'Failed Donation Page', 'give' ),
221
-							'desc'    => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
220
+							'name'    => __('Failed Donation Page', 'give'),
221
+							'desc'    => __('The page donors are sent to if their donation is cancelled or fails.', 'give'),
222 222
 							'id'      => 'failure_page',
223 223
 							'type'    => 'select',
224
-							'options' => give_cmb2_get_post_options( array(
224
+							'options' => give_cmb2_get_post_options(array(
225 225
 								'post_type'   => 'page',
226 226
 								'numberposts' => 999,
227
-							) ),
227
+							)),
228 228
 						),
229 229
 						array(
230
-							'name'    => __( 'Donation History Page', 'give' ),
230
+							'name'    => __('Donation History Page', 'give'),
231 231
 							/* translators: %s: [donation_history] */
232
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
232
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
233 233
 							'id'      => 'history_page',
234 234
 							'type'    => 'select',
235
-							'options' => give_cmb2_get_post_options( array(
235
+							'options' => give_cmb2_get_post_options(array(
236 236
 								'post_type'   => 'page',
237 237
 								'numberposts' => 999,
238
-							) ),
238
+							)),
239 239
 						),
240 240
 						array(
241
-							'name'    => __( 'Base Country', 'give' ),
242
-							'desc'    => __( 'The country your site operates from.', 'give' ),
241
+							'name'    => __('Base Country', 'give'),
242
+							'desc'    => __('The country your site operates from.', 'give'),
243 243
 							'id'      => 'base_country',
244 244
 							'type'    => 'select',
245 245
 							'options' => give_get_country_list(),
246 246
 						),
247 247
 						array(
248
-							'name' => __( 'Currency Settings', 'give' ),
248
+							'name' => __('Currency Settings', 'give'),
249 249
 							'desc' => '',
250 250
 							'type' => 'give_title',
251 251
 							'id'   => 'give_title_general_settings_2',
252 252
 						),
253 253
 						array(
254
-							'name'    => __( 'Currency', 'give' ),
255
-							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
254
+							'name'    => __('Currency', 'give'),
255
+							'desc'    => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
256 256
 							'id'      => 'currency',
257 257
 							'type'    => 'select',
258 258
 							'options' => give_get_currencies(),
259 259
 							'default' => 'USD',
260 260
 						),
261 261
 						array(
262
-							'name'    => __( 'Currency Position', 'give' ),
263
-							'desc'    => __( 'The position of the currency symbol.', 'give' ),
262
+							'name'    => __('Currency Position', 'give'),
263
+							'desc'    => __('The position of the currency symbol.', 'give'),
264 264
 							'id'      => 'currency_position',
265 265
 							'type'    => 'select',
266 266
 							'options' => array(
267 267
 								/* translators: %s: currency symbol */
268
-								'before' => sprintf( __( 'Before - %s&#x200e;10', 'give' ), give_currency_symbol( give_get_currency() ) ),
268
+								'before' => sprintf(__('Before - %s&#x200e;10', 'give'), give_currency_symbol(give_get_currency())),
269 269
 								/* translators: %s: currency symbol */
270
-								'after'  => sprintf( __( 'After - 10%s&#x200f;', 'give' ), give_currency_symbol( give_get_currency() ) ),
270
+								'after'  => sprintf(__('After - 10%s&#x200f;', 'give'), give_currency_symbol(give_get_currency())),
271 271
 							),
272 272
 							'default' => 'before',
273 273
 						),
274 274
 						array(
275
-							'name'            => __( 'Thousands Separator', 'give' ),
276
-							'desc'            => __( 'The symbol (usually , or .) to separate thousands.', 'give' ),
275
+							'name'            => __('Thousands Separator', 'give'),
276
+							'desc'            => __('The symbol (usually , or .) to separate thousands.', 'give'),
277 277
 							'id'              => 'thousands_separator',
278 278
 							'type'            => 'text_small',
279 279
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
280 280
 							'default'         => ',',
281 281
 						),
282 282
 						array(
283
-							'name'    => __( 'Decimal Separator', 'give' ),
284
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
283
+							'name'    => __('Decimal Separator', 'give'),
284
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
285 285
 							'id'      => 'decimal_separator',
286 286
 							'type'    => 'text_small',
287 287
 							'default' => '.',
288 288
 						),
289 289
 						array(
290
-							'name'            => __( 'Number of Decimals', 'give' ),
291
-							'desc'            => __( 'The number of decimal points displayed in amounts.', 'give' ),
290
+							'name'            => __('Number of Decimals', 'give'),
291
+							'desc'            => __('The number of decimal points displayed in amounts.', 'give'),
292 292
 							'id'              => 'number_decimals',
293 293
 							'type'            => 'text_small',
294 294
 							'default'         => 2,
@@ -302,83 +302,83 @@  discard block
 block discarded – undo
302 302
 			 */
303 303
 			'gateways'    => array(
304 304
 				'id'         => 'payment_gateways',
305
-				'give_title' => __( 'Payment Gateways', 'give' ),
306
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
307
-				'fields'     => apply_filters( 'give_settings_gateways', array(
305
+				'give_title' => __('Payment Gateways', 'give'),
306
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
307
+				'fields'     => apply_filters('give_settings_gateways', array(
308 308
 						array(
309
-							'name' => __( 'Gateways Settings', 'give' ),
309
+							'name' => __('Gateways Settings', 'give'),
310 310
 							'desc' => '',
311 311
 							'id'   => 'give_title_gateway_settings_1',
312 312
 							'type' => 'give_title',
313 313
 						),
314 314
 						array(
315
-							'name' => __( 'Test Mode', 'give' ),
316
-							'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
315
+							'name' => __('Test Mode', 'give'),
316
+							'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
317 317
 							'id'   => 'test_mode',
318 318
 							'type' => 'checkbox',
319 319
 						),
320 320
 						array(
321
-							'name' => __( 'Enabled Gateways', 'give' ),
322
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
321
+							'name' => __('Enabled Gateways', 'give'),
322
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
323 323
 							'id'   => 'gateways',
324 324
 							'type' => 'enabled_gateways',
325 325
 						),
326 326
 						array(
327
-							'name' => __( 'Default Gateway', 'give' ),
328
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
327
+							'name' => __('Default Gateway', 'give'),
328
+							'desc' => __('The gateway that will be selected by default.', 'give'),
329 329
 							'id'   => 'default_gateway',
330 330
 							'type' => 'default_gateway',
331 331
 						),
332 332
 						array(
333
-							'name' => __( 'PayPal Standard', 'give' ),
333
+							'name' => __('PayPal Standard', 'give'),
334 334
 							'desc' => '',
335 335
 							'type' => 'give_title',
336 336
 							'id'   => 'give_title_gateway_settings_2',
337 337
 						),
338 338
 						array(
339
-							'name' => __( 'PayPal Email', 'give' ),
340
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
339
+							'name' => __('PayPal Email', 'give'),
340
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
341 341
 							'id'   => 'paypal_email',
342 342
 							'type' => 'text_email',
343 343
 						),
344 344
 						array(
345
-							'name' => __( 'PayPal Page Style', 'give' ),
346
-							'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
345
+							'name' => __('PayPal Page Style', 'give'),
346
+							'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
347 347
 							'id'   => 'paypal_page_style',
348 348
 							'type' => 'text',
349 349
 						),
350 350
 						array(
351
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
352
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
351
+							'name'    => __('PayPal Transaction Type', 'give'),
352
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
353 353
 							'id'      => 'paypal_button_type',
354 354
 							'type'    => 'radio_inline',
355 355
 							'options' => array(
356
-								'donation' => __( 'Donation', 'give' ),
357
-								'standard' => __( 'Standard Transaction', 'give' ),
356
+								'donation' => __('Donation', 'give'),
357
+								'standard' => __('Standard Transaction', 'give'),
358 358
 							),
359 359
 							'default' => 'donation',
360 360
 						),
361 361
 						array(
362
-							'name' => __( 'Disable PayPal IPN Verification', 'give' ),
363
-							'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
362
+							'name' => __('Disable PayPal IPN Verification', 'give'),
363
+							'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
364 364
 							'id'   => 'disable_paypal_verification',
365 365
 							'type' => 'checkbox',
366 366
 						),
367 367
 						array(
368
-							'name' => __( 'Offline Donations', 'give' ),
368
+							'name' => __('Offline Donations', 'give'),
369 369
 							'desc' => '',
370 370
 							'type' => 'give_title',
371 371
 							'id'   => 'give_title_gateway_settings_3',
372 372
 						),
373 373
 						array(
374
-							'name' => __( 'Collect Billing Details', 'give' ),
375
-							'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
374
+							'name' => __('Collect Billing Details', 'give'),
375
+							'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
376 376
 							'id'   => 'give_offline_donation_enable_billing_fields',
377 377
 							'type' => 'checkbox',
378 378
 						),
379 379
 						array(
380
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
381
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
380
+							'name'    => __('Offline Donation Instructions', 'give'),
381
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
382 382
 							'id'      => 'global_offline_donation_content',
383 383
 							'default' => give_get_default_offline_donation_content(),
384 384
 							'type'    => 'wysiwyg',
@@ -387,15 +387,15 @@  discard block
 block discarded – undo
387 387
 							),
388 388
 						),
389 389
 						array(
390
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
391
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
390
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
391
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
392 392
 							'id'      => 'offline_donation_subject',
393
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
393
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
394 394
 							'type'    => 'text',
395 395
 						),
396 396
 						array(
397
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
398
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
397
+							'name'    => __('Offline Donation Email Instructions', 'give'),
398
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
399 399
 							'id'      => 'global_offline_donation_email',
400 400
 							'default' => give_get_default_offline_donation_email_content(),
401 401
 							'type'    => 'wysiwyg',
@@ -409,104 +409,104 @@  discard block
 block discarded – undo
409 409
 			/** Display Settings */
410 410
 			'display'     => array(
411 411
 				'id'         => 'display_settings',
412
-				'give_title' => __( 'Display Settings', 'give' ),
413
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
414
-				'fields'     => apply_filters( 'give_settings_display', array(
412
+				'give_title' => __('Display Settings', 'give'),
413
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
414
+				'fields'     => apply_filters('give_settings_display', array(
415 415
 						array(
416
-							'name' => __( 'Display Settings', 'give' ),
416
+							'name' => __('Display Settings', 'give'),
417 417
 							'desc' => '',
418 418
 							'id'   => 'give_title_display_settings_1',
419 419
 							'type' => 'give_title',
420 420
 						),
421 421
 						array(
422
-							'name' => __( 'Disable CSS', 'give' ),
423
-							'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
422
+							'name' => __('Disable CSS', 'give'),
423
+							'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
424 424
 							'id'   => 'disable_css',
425 425
 							'type' => 'checkbox',
426 426
 						),
427 427
 						array(
428
-							'name' => __( 'Enable Floating Labels', 'give' ),
428
+							'name' => __('Enable Floating Labels', 'give'),
429 429
 							/* translators: %s: http://docs.givewp.com/form-floating-labels */
430
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array(
430
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array(
431 431
 								'a' => array(
432 432
 									'href'   => array(),
433 433
 									'target' => array(),
434 434
 								),
435
-							) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
435
+							)), esc_url('http://docs.givewp.com/form-floating-labels')),
436 436
 							'id'   => 'floatlabels',
437 437
 							'type' => 'checkbox',
438 438
 						),
439 439
 						array(
440
-							'name' => __( 'Disable Welcome Screen', 'give' ),
440
+							'name' => __('Disable Welcome Screen', 'give'),
441 441
 							/* translators: %s: about page URL */
442
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array(
442
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array(
443 443
 								'a' => array(
444 444
 									'href'   => array(),
445 445
 									'target' => array(),
446 446
 								),
447
-							) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
447
+							)), esc_url(admin_url('index.php?page=give-about'))),
448 448
 							'id'   => 'disable_welcome',
449 449
 							'type' => 'checkbox',
450 450
 						),
451 451
 						array(
452
-							'name' => __( 'Post Types', 'give' ),
452
+							'name' => __('Post Types', 'give'),
453 453
 							'desc' => '',
454 454
 							'id'   => 'give_title_display_settings_2',
455 455
 							'type' => 'give_title',
456 456
 						),
457 457
 						array(
458
-							'name' => __( 'Disable Form Single Views', 'give' ),
459
-							'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
458
+							'name' => __('Disable Form Single Views', 'give'),
459
+							'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
460 460
 							'id'   => 'disable_forms_singular',
461 461
 							'type' => 'checkbox',
462 462
 						),
463 463
 						array(
464
-							'name' => __( 'Disable Form Archives', 'give' ),
465
-							'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
464
+							'name' => __('Disable Form Archives', 'give'),
465
+							'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
466 466
 							'id'   => 'disable_forms_archives',
467 467
 							'type' => 'checkbox',
468 468
 						),
469 469
 						array(
470
-							'name' => __( 'Disable Form Excerpts', 'give' ),
471
-							'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
470
+							'name' => __('Disable Form Excerpts', 'give'),
471
+							'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
472 472
 							'id'   => 'disable_forms_excerpt',
473 473
 							'type' => 'checkbox',
474 474
 						),
475 475
 						array(
476
-							'name'    => __( 'Featured Image Size', 'give' ),
477
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
476
+							'name'    => __('Featured Image Size', 'give'),
477
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
478 478
 							'id'      => 'featured_image_size',
479 479
 							'type'    => 'select',
480 480
 							'default' => 'large',
481 481
 							'options' => give_get_featured_image_sizes(),
482 482
 						),
483 483
 						array(
484
-							'name' => __( 'Disable Form Featured Image', 'give' ),
485
-							'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
484
+							'name' => __('Disable Form Featured Image', 'give'),
485
+							'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
486 486
 							'id'   => 'disable_form_featured_img',
487 487
 							'type' => 'checkbox',
488 488
 						),
489 489
 						array(
490
-							'name' => __( 'Disable Single Form Sidebar', 'give' ),
491
-							'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
490
+							'name' => __('Disable Single Form Sidebar', 'give'),
491
+							'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
492 492
 							'id'   => 'disable_form_sidebar',
493 493
 							'type' => 'checkbox',
494 494
 						),
495 495
 						array(
496
-							'name' => __( 'Taxonomies', 'give' ),
496
+							'name' => __('Taxonomies', 'give'),
497 497
 							'desc' => '',
498 498
 							'id'   => 'give_title_display_settings_3',
499 499
 							'type' => 'give_title',
500 500
 						),
501 501
 						array(
502
-							'name' => __( 'Enable Form Categories', 'give' ),
503
-							'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
502
+							'name' => __('Enable Form Categories', 'give'),
503
+							'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'),
504 504
 							'id'   => 'categories',
505 505
 							'type' => 'checkbox',
506 506
 						),
507 507
 						array(
508
-							'name' => __( 'Enable Form Tags', 'give' ),
509
-							'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
508
+							'name' => __('Enable Form Tags', 'give'),
509
+							'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'),
510 510
 							'id'   => 'tags',
511 511
 							'type' => 'checkbox',
512 512
 						),
@@ -519,101 +519,101 @@  discard block
 block discarded – undo
519 519
 			 */
520 520
 			'emails'      => array(
521 521
 				'id'         => 'email_settings',
522
-				'give_title' => __( 'Email Settings', 'give' ),
523
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
524
-				'fields'     => apply_filters( 'give_settings_emails', array(
522
+				'give_title' => __('Email Settings', 'give'),
523
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
524
+				'fields'     => apply_filters('give_settings_emails', array(
525 525
 						array(
526
-							'name' => __( 'Email Settings', 'give' ),
526
+							'name' => __('Email Settings', 'give'),
527 527
 							'desc' => '',
528 528
 							'id'   => 'give_title_email_settings_1',
529 529
 							'type' => 'give_title',
530 530
 						),
531 531
 						array(
532 532
 							'id'      => 'email_template',
533
-							'name'    => __( 'Email Template', 'give' ),
534
-							'desc'    => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
533
+							'name'    => __('Email Template', 'give'),
534
+							'desc'    => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
535 535
 							'type'    => 'select',
536 536
 							'options' => give_get_email_templates(),
537 537
 						),
538 538
 						array(
539 539
 							'id'   => 'email_logo',
540
-							'name' => __( 'Logo', 'give' ),
541
-							'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
540
+							'name' => __('Logo', 'give'),
541
+							'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
542 542
 							'type' => 'file',
543 543
 						),
544 544
 						array(
545 545
 							'id'      => 'from_name',
546
-							'name'    => __( 'From Name', 'give' ),
547
-							'desc'    => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ),
548
-							'default' => get_bloginfo( 'name' ),
546
+							'name'    => __('From Name', 'give'),
547
+							'desc'    => __('The name that appears in the "From" field in donation receipt emails.', 'give'),
548
+							'default' => get_bloginfo('name'),
549 549
 							'type'    => 'text',
550 550
 						),
551 551
 						array(
552 552
 							'id'      => 'from_email',
553
-							'name'    => __( 'From Email', 'give' ),
554
-							'desc'    => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
555
-							'default' => get_bloginfo( 'admin_email' ),
553
+							'name'    => __('From Email', 'give'),
554
+							'desc'    => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
555
+							'default' => get_bloginfo('admin_email'),
556 556
 							'type'    => 'text',
557 557
 						),
558 558
 						array(
559
-							'name' => __( 'Donation Receipt', 'give' ),
559
+							'name' => __('Donation Receipt', 'give'),
560 560
 							'desc' => '',
561 561
 							'id'   => 'give_title_email_settings_2',
562 562
 							'type' => 'give_title',
563 563
 						),
564 564
 						array(
565 565
 							'id'      => 'donation_subject',
566
-							'name'    => __( 'Donation Email Subject', 'give' ),
567
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
568
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
566
+							'name'    => __('Donation Email Subject', 'give'),
567
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
568
+							'default' => esc_attr__('Donation Receipt', 'give'),
569 569
 							'type'    => 'text',
570 570
 						),
571 571
 						array(
572 572
 							'id'      => 'donation_receipt',
573
-							'name'    => __( 'Donation Receipt', 'give' ),
573
+							'name'    => __('Donation Receipt', 'give'),
574 574
 							'desc'    => sprintf(
575 575
 							/* translators: %s: emails tags list */
576
-								__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
577
-								'<br/>' . give_get_emails_tags_list()
576
+								__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
577
+								'<br/>'.give_get_emails_tags_list()
578 578
 							),
579 579
 							'type'    => 'wysiwyg',
580 580
 							'default' => give_get_default_donation_receipt_email(),
581 581
 						),
582 582
 						array(
583
-							'name' => __( 'New Donation Notification', 'give' ),
583
+							'name' => __('New Donation Notification', 'give'),
584 584
 							'desc' => '',
585 585
 							'id'   => 'give_title_email_settings_3',
586 586
 							'type' => 'give_title',
587 587
 						),
588 588
 						array(
589 589
 							'id'      => 'donation_notification_subject',
590
-							'name'    => __( 'Donation Notification Subject', 'give' ),
591
-							'desc'    => __( 'Enter the subject line for the donation notification email.', 'give' ),
590
+							'name'    => __('Donation Notification Subject', 'give'),
591
+							'desc'    => __('Enter the subject line for the donation notification email.', 'give'),
592 592
 							'type'    => 'text',
593
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
593
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give'),
594 594
 						),
595 595
 						array(
596 596
 							'id'      => 'donation_notification',
597
-							'name'    => __( 'Donation Notification', 'give' ),
597
+							'name'    => __('Donation Notification', 'give'),
598 598
 							'desc'    => sprintf(
599 599
 							/* translators: %s: emails tags list */
600
-								__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
601
-								'<br/>' . give_get_emails_tags_list()
600
+								__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
601
+								'<br/>'.give_get_emails_tags_list()
602 602
 							),
603 603
 							'type'    => 'wysiwyg',
604 604
 							'default' => give_get_default_donation_notification_email(),
605 605
 						),
606 606
 						array(
607 607
 							'id'      => 'admin_notice_emails',
608
-							'name'    => __( 'Donation Notification Emails', 'give' ),
609
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
608
+							'name'    => __('Donation Notification Emails', 'give'),
609
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
610 610
 							'type'    => 'textarea',
611
-							'default' => get_bloginfo( 'admin_email' ),
611
+							'default' => get_bloginfo('admin_email'),
612 612
 						),
613 613
 						array(
614 614
 							'id'   => 'disable_admin_notices',
615
-							'name' => __( 'Disable Admin Notifications', 'give' ),
616
-							'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
615
+							'name' => __('Disable Admin Notifications', 'give'),
616
+							'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'),
617 617
 							'type' => 'checkbox',
618 618
 						),
619 619
 					)
@@ -622,99 +622,99 @@  discard block
 block discarded – undo
622 622
 			/** Extension Settings */
623 623
 			'addons'      => array(
624 624
 				'id'         => 'addons',
625
-				'give_title' => __( 'Give Add-ons Settings', 'give' ),
626
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
627
-				'fields'     => apply_filters( 'give_settings_addons', array()
625
+				'give_title' => __('Give Add-ons Settings', 'give'),
626
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
627
+				'fields'     => apply_filters('give_settings_addons', array()
628 628
 				),
629 629
 			),
630 630
 			/** Licenses Settings */
631 631
 			'licenses'    => array(
632 632
 				'id'         => 'licenses',
633
-				'give_title' => __( 'Give Licenses', 'give' ),
634
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
635
-				'fields'     => apply_filters( 'give_settings_licenses', array()
633
+				'give_title' => __('Give Licenses', 'give'),
634
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
635
+				'fields'     => apply_filters('give_settings_licenses', array()
636 636
 				),
637 637
 			),
638 638
 			/** Advanced Options */
639 639
 			'advanced'    => array(
640 640
 				'id'         => 'advanced_options',
641
-				'give_title' => __( 'Advanced Options', 'give' ),
642
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
643
-				'fields'     => apply_filters( 'give_settings_advanced', array(
641
+				'give_title' => __('Advanced Options', 'give'),
642
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
643
+				'fields'     => apply_filters('give_settings_advanced', array(
644 644
 						array(
645
-							'name' => __( 'Access Control', 'give' ),
645
+							'name' => __('Access Control', 'give'),
646 646
 							'desc' => '',
647 647
 							'id'   => 'give_title_session_control_1',
648 648
 							'type' => 'give_title',
649 649
 						),
650 650
 						array(
651 651
 							'id'      => 'session_lifetime',
652
-							'name'    => __( 'Session Lifetime', 'give' ),
653
-							'desc'    => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
652
+							'name'    => __('Session Lifetime', 'give'),
653
+							'desc'    => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
654 654
 							'type'    => 'select',
655 655
 							'options' => array(
656
-								'86400'  => __( '24 Hours', 'give' ),
657
-								'172800' => __( '48 Hours', 'give' ),
658
-								'259200' => __( '72 Hours', 'give' ),
659
-								'604800' => __( '1 Week', 'give' ),
656
+								'86400'  => __('24 Hours', 'give'),
657
+								'172800' => __('48 Hours', 'give'),
658
+								'259200' => __('72 Hours', 'give'),
659
+								'604800' => __('1 Week', 'give'),
660 660
 							),
661 661
 						),
662 662
 						array(
663
-							'name' => __( 'Email Access', 'give' ),
664
-							'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
663
+							'name' => __('Email Access', 'give'),
664
+							'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
665 665
 							'id'   => 'email_access',
666 666
 							'type' => 'checkbox',
667 667
 						),
668 668
 						array(
669 669
 							'id'      => 'recaptcha_key',
670
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
670
+							'name'    => __('reCAPTCHA Site Key', 'give'),
671 671
 							/* translators: %s: https://www.google.com/recaptcha/ */
672
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
672
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
673 673
 							'default' => '',
674 674
 							'type'    => 'text',
675 675
 						),
676 676
 						array(
677 677
 							'id'      => 'recaptcha_secret',
678
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
679
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
678
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
679
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
680 680
 							'default' => '',
681 681
 							'type'    => 'text',
682 682
 						),
683 683
 						array(
684
-							'name' => __( 'Data Control', 'give' ),
684
+							'name' => __('Data Control', 'give'),
685 685
 							'desc' => '',
686 686
 							'id'   => 'give_title_data_control_2',
687 687
 							'type' => 'give_title',
688 688
 						),
689 689
 						array(
690
-							'name' => __( 'Remove All Data on Uninstall?', 'give' ),
691
-							'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
690
+							'name' => __('Remove All Data on Uninstall?', 'give'),
691
+							'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'),
692 692
 							'id'   => 'uninstall_on_delete',
693 693
 							'type' => 'checkbox',
694 694
 						),
695 695
 						array(
696
-							'name' => __( 'Filter Control', 'give' ),
696
+							'name' => __('Filter Control', 'give'),
697 697
 							'desc' => '',
698 698
 							'id'   => 'give_title_filter_control',
699 699
 							'type' => 'give_title',
700 700
 						),
701 701
 						array(
702 702
 							/* translators: %s: the_content */
703
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
703
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
704 704
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
705
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
705
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
706 706
 							'id'   => 'disable_the_content_filter',
707 707
 							'type' => 'checkbox',
708 708
 						),
709 709
 						array(
710
-							'name' => __( 'Script Loading', 'give' ),
710
+							'name' => __('Script Loading', 'give'),
711 711
 							'desc' => '',
712 712
 							'id'   => 'give_title_script_control',
713 713
 							'type' => 'give_title',
714 714
 						),
715 715
 						array(
716
-							'name' => __( 'Load Scripts in Footer?', 'give' ),
717
-							'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
716
+							'name' => __('Load Scripts in Footer?', 'give'),
717
+							'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
718 718
 							'id'   => 'scripts_footer',
719 719
 							'type' => 'checkbox',
720 720
 						),
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
 			/** API Settings */
725 725
 			'api'         => array(
726 726
 				'id'         => 'api',
727
-				'give_title' => __( 'API', 'give' ),
728
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
727
+				'give_title' => __('API', 'give'),
728
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
729 729
 				'show_names' => false, // Hide field names on the left
730
-				'fields'     => apply_filters( 'give_settings_system', array(
730
+				'fields'     => apply_filters('give_settings_system', array(
731 731
 						array(
732 732
 							'id'   => 'api',
733
-							'name' => __( 'API', 'give' ),
733
+							'name' => __('API', 'give'),
734 734
 							'type' => 'api',
735 735
 						),
736 736
 					)
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
 			/** Licenses Settings */
740 740
 			'system_info' => array(
741 741
 				'id'         => 'system_info',
742
-				'give_title' => __( 'System Info', 'give' ),
743
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
744
-				'fields'     => apply_filters( 'give_settings_system', array(
742
+				'give_title' => __('System Info', 'give'),
743
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
744
+				'fields'     => apply_filters('give_settings_system', array(
745 745
 						array(
746 746
 							'id'   => 'system-info-textarea',
747
-							'name' => __( 'System Info', 'give' ),
748
-							'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
747
+							'name' => __('System Info', 'give'),
748
+							'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'),
749 749
 							'type' => 'system_info',
750 750
 						),
751 751
 					)
@@ -753,15 +753,15 @@  discard block
 block discarded – undo
753 753
 			),
754 754
 		);
755 755
 
756
-		$give_settings = apply_filters( 'give_registered_settings', $give_settings );
756
+		$give_settings = apply_filters('give_registered_settings', $give_settings);
757 757
 
758 758
 		// Return all settings array if no active tab
759
-		if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) {
759
+		if (empty($active_tab) || ! isset($give_settings[$active_tab])) {
760 760
 			return $give_settings;
761 761
 		}
762 762
 
763 763
 		// Add other tabs and settings fields as needed
764
-		return $give_settings[ $active_tab ];
764
+		return $give_settings[$active_tab];
765 765
 
766 766
 	}
767 767
 
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 	 */
771 771
 	public function settings_notices() {
772 772
 
773
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
773
+		if ( ! isset($_POST['give_settings_saved'])) {
774 774
 			return;
775 775
 		}
776 776
 
777
-		add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' );
777
+		add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated');
778 778
 
779 779
 	}
780 780
 
@@ -789,14 +789,14 @@  discard block
 block discarded – undo
789 789
 	 * @return mixed         Field value or exception is thrown.
790 790
 	 * @throws Exception     Throws an exception if the field is invalid.
791 791
 	 */
792
-	public function __get( $field ) {
792
+	public function __get($field) {
793 793
 
794 794
 		// Allowed fields to retrieve
795
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
795
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
796 796
 			return $this->{$field};
797 797
 		}
798 798
 
799
-		throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) );
799
+		throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field));
800 800
 	}
801 801
 
802 802
 
@@ -815,12 +815,12 @@  discard block
 block discarded – undo
815 815
  *
816 816
  * @return mixed        Option value
817 817
  */
818
-function give_get_option( $key = '', $default = false ) {
818
+function give_get_option($key = '', $default = false) {
819 819
 	$give_options = give_get_settings();
820
-	$value        = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
821
-	$value        = apply_filters( 'give_get_option', $value, $key, $default );
820
+	$value        = ! empty($give_options[$key]) ? $give_options[$key] : $default;
821
+	$value        = apply_filters('give_get_option', $value, $key, $default);
822 822
 
823
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
823
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
824 824
 }
825 825
 
826 826
 
@@ -838,33 +838,33 @@  discard block
 block discarded – undo
838 838
  *
839 839
  * @return boolean True if updated, false if not.
840 840
  */
841
-function give_update_option( $key = '', $value = false ) {
841
+function give_update_option($key = '', $value = false) {
842 842
 
843 843
 	// If no key, exit
844
-	if ( empty( $key ) ) {
844
+	if (empty($key)) {
845 845
 		return false;
846 846
 	}
847 847
 
848
-	if ( empty( $value ) ) {
849
-		$remove_option = give_delete_option( $key );
848
+	if (empty($value)) {
849
+		$remove_option = give_delete_option($key);
850 850
 
851 851
 		return $remove_option;
852 852
 	}
853 853
 
854 854
 	// First let's grab the current settings
855
-	$options = get_option( 'give_settings' );
855
+	$options = get_option('give_settings');
856 856
 
857 857
 	// Let's let devs alter that value coming in
858
-	$value = apply_filters( 'give_update_option', $value, $key );
858
+	$value = apply_filters('give_update_option', $value, $key);
859 859
 
860 860
 	// Next let's try to update the value
861
-	$options[ $key ] = $value;
862
-	$did_update      = update_option( 'give_settings', $options );
861
+	$options[$key] = $value;
862
+	$did_update      = update_option('give_settings', $options);
863 863
 
864 864
 	// If it updated, let's update the global variable
865
-	if ( $did_update ) {
865
+	if ($did_update) {
866 866
 		global $give_options;
867
-		$give_options[ $key ] = $value;
867
+		$give_options[$key] = $value;
868 868
 	}
869 869
 
870 870
 	return $did_update;
@@ -883,25 +883,25 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return boolean True if updated, false if not.
885 885
  */
886
-function give_delete_option( $key = '' ) {
886
+function give_delete_option($key = '') {
887 887
 
888 888
 	// If no key, exit
889
-	if ( empty( $key ) ) {
889
+	if (empty($key)) {
890 890
 		return false;
891 891
 	}
892 892
 
893 893
 	// First let's grab the current settings
894
-	$options = get_option( 'give_settings' );
894
+	$options = get_option('give_settings');
895 895
 
896 896
 	// Next let's try to update the value
897
-	if ( isset( $options[ $key ] ) ) {
898
-		unset( $options[ $key ] );
897
+	if (isset($options[$key])) {
898
+		unset($options[$key]);
899 899
 	}
900 900
 
901
-	$did_update = update_option( 'give_settings', $options );
901
+	$did_update = update_option('give_settings', $options);
902 902
 
903 903
 	// If it updated, let's update the global variable
904
-	if ( $did_update ) {
904
+	if ($did_update) {
905 905
 		global $give_options;
906 906
 		$give_options = $options;
907 907
 	}
@@ -920,9 +920,9 @@  discard block
 block discarded – undo
920 920
  */
921 921
 function give_get_settings() {
922 922
 
923
-	$settings = get_option( 'give_settings' );
923
+	$settings = get_option('give_settings');
924 924
 
925
-	return (array) apply_filters( 'give_get_settings', $settings );
925
+	return (array) apply_filters('give_get_settings', $settings);
926 926
 
927 927
 }
928 928
 
@@ -940,25 +940,25 @@  discard block
 block discarded – undo
940 940
  *
941 941
  * @return array
942 942
  */
943
-function give_settings_array_insert( $array, $position, $insert ) {
944
-	if ( is_int( $position ) ) {
945
-		array_splice( $array, $position, 0, $insert );
943
+function give_settings_array_insert($array, $position, $insert) {
944
+	if (is_int($position)) {
945
+		array_splice($array, $position, 0, $insert);
946 946
 	} else {
947 947
 
948
-		foreach ( $array as $index => $subarray ) {
949
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
948
+		foreach ($array as $index => $subarray) {
949
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
950 950
 				$pos = $index;
951 951
 			}
952 952
 		}
953 953
 
954
-		if ( ! isset( $pos ) ) {
954
+		if ( ! isset($pos)) {
955 955
 			return $array;
956 956
 		}
957 957
 
958 958
 		$array = array_merge(
959
-			array_slice( $array, 0, $pos ),
959
+			array_slice($array, 0, $pos),
960 960
 			$insert,
961
-			array_slice( $array, $pos )
961
+			array_slice($array, $pos)
962 962
 		);
963 963
 	}
964 964
 
@@ -978,23 +978,23 @@  discard block
 block discarded – undo
978 978
  *
979 979
  * @return void
980 980
  */
981
-function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) {
981
+function give_enabled_gateways_callback($field_arr, $saved_values = array()) {
982 982
 	$saved_values = __give_validate_active_gateways($saved_values);
983 983
 	$id       = $field_arr['id'];
984
-	$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
984
+	$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
985 985
 
986 986
 	echo '<ul class="give-checklist-fields give-payment-gatways-list">';
987 987
 
988
-	foreach ( $gateways as $key => $option ) :
988
+	foreach ($gateways as $key => $option) :
989 989
 
990
-		if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) {
990
+		if (is_array($saved_values) && array_key_exists($key, $saved_values)) {
991 991
 			$enabled = '1';
992 992
 		} else {
993 993
 			$enabled = null;
994 994
 		}
995 995
 
996
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
997
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
996
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
997
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
998 998
 
999 999
 	endforeach;
1000 1000
 
@@ -1013,16 +1013,16 @@  discard block
 block discarded – undo
1013 1013
  *
1014 1014
  * @return void
1015 1015
  */
1016
-function give_default_gateway_callback( $field_arr, $saved_value ) {
1016
+function give_default_gateway_callback($field_arr, $saved_value) {
1017 1017
 	$id          = $field_arr['id'];
1018 1018
 	$gateways    = give_get_enabled_payment_gateways();
1019
-	$saved_value = give_get_default_gateway( null );
1019
+	$saved_value = give_get_default_gateway(null);
1020 1020
 
1021
-	echo '<select class="give-select" name="' . $id . '" id="' . $id . '">';
1021
+	echo '<select class="give-select" name="'.$id.'" id="'.$id.'">';
1022 1022
 
1023
-	foreach ( $gateways as $key => $option ) :
1024
-		$selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : '';
1025
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1023
+	foreach ($gateways as $key => $option) :
1024
+		$selected = isset($saved_value) ? selected($key, $saved_value, false) : '';
1025
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1026 1026
 	endforeach;
1027 1027
 
1028 1028
 	echo '</select>';
@@ -1040,13 +1040,13 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return void
1042 1042
  */
1043
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1043
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1044 1044
 
1045 1045
 	$id                = $field_type_object->field->args['id'];
1046 1046
 	$title             = $field_type_object->field->args['name'];
1047 1047
 	$field_description = $field_type_object->field->args['desc'];
1048 1048
 
1049
-	echo '<hr>' . $field_description;
1049
+	echo '<hr>'.$field_description;
1050 1050
 
1051 1051
 }
1052 1052
 
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
  *
1062 1062
  * @return void
1063 1063
  */
1064
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1064
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1065 1065
 
1066 1066
 	$id                = $field_type_object->field->args['id'];
1067 1067
 	$title             = $field_type_object->field->args['name'];
@@ -1080,25 +1080,25 @@  discard block
 block discarded – undo
1080 1080
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1081 1081
  * @return array An array of options that matches the CMB2 options array
1082 1082
  */
1083
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1083
+function give_cmb2_get_post_options($query_args, $force = false) {
1084 1084
 
1085
-	$post_options = array( '' => '' ); // Blank option
1085
+	$post_options = array('' => ''); // Blank option
1086 1086
 
1087
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1087
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1088 1088
 		return $post_options;
1089 1089
 	}
1090 1090
 
1091
-	$args = wp_parse_args( $query_args, array(
1091
+	$args = wp_parse_args($query_args, array(
1092 1092
 		'post_type'   => 'page',
1093 1093
 		'numberposts' => 10,
1094
-	) );
1094
+	));
1095 1095
 
1096
-	$posts = get_posts( $args );
1096
+	$posts = get_posts($args);
1097 1097
 
1098
-	if ( $posts ) {
1099
-		foreach ( $posts as $post ) {
1098
+	if ($posts) {
1099
+		foreach ($posts as $post) {
1100 1100
 
1101
-			$post_options[ $post->ID ] = $post->post_title;
1101
+			$post_options[$post->ID] = $post->post_title;
1102 1102
 
1103 1103
 		}
1104 1104
 	}
@@ -1123,33 +1123,33 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 	$sizes            = array();
1125 1125
 	$get_sizes        = get_intermediate_image_sizes();
1126
-	$core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
1126
+	$core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large');
1127 1127
 
1128 1128
 
1129 1129
 	// This will help us to filter special characters from a string
1130
-	$filter_slug_items = array( '_', '-' );
1130
+	$filter_slug_items = array('_', '-');
1131 1131
 
1132
-	foreach ( $get_sizes as $_size ) {
1132
+	foreach ($get_sizes as $_size) {
1133 1133
 
1134 1134
 		// Converting image size slug to title case
1135
-		$sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items );
1135
+		$sizes[$_size] = give_slug_to_title($_size, $filter_slug_items);
1136 1136
 
1137
-		if ( in_array( $_size, $core_image_sizes ) ) {
1138
-			$sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1139
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1140
-			$sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}";
1137
+		if (in_array($_size, $core_image_sizes)) {
1138
+			$sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1139
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1140
+			$sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}";
1141 1141
 		}
1142 1142
 
1143 1143
 		// Based on the above image height check, label the respective resolution as responsive
1144
-		if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) {
1145
-			$sizes[ $_size ] .= ' - responsive';
1144
+		if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) {
1145
+			$sizes[$_size] .= ' - responsive';
1146 1146
 		}
1147 1147
 
1148
-		$sizes[ $_size ] .= ')';
1148
+		$sizes[$_size] .= ')';
1149 1149
 
1150 1150
 	}
1151 1151
 
1152
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1152
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1153 1153
 }
1154 1154
 
1155 1155
 
@@ -1165,14 +1165,14 @@  discard block
 block discarded – undo
1165 1165
  *
1166 1166
  * @return text $string
1167 1167
  */
1168
-function give_slug_to_title( $string, $filters = array() ) {
1168
+function give_slug_to_title($string, $filters = array()) {
1169 1169
 
1170
-	foreach ( $filters as $filter_item ) {
1171
-		$string = str_replace( $filter_item, ' ', $string );
1170
+	foreach ($filters as $filter_item) {
1171
+		$string = str_replace($filter_item, ' ', $string);
1172 1172
 	}
1173 1173
 
1174 1174
 	// Return updated string after converting it to title case
1175
-	return ucwords( $string );
1175
+	return ucwords($string);
1176 1176
 
1177 1177
 }
1178 1178
 
@@ -1188,18 +1188,18 @@  discard block
 block discarded – undo
1188 1188
  *
1189 1189
  * @return void
1190 1190
  */
1191
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1191
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1192 1192
 	/* @var CMB2_Types $field_type_object */
1193 1193
 
1194 1194
 	$id                 = $field_type_object->field->args['id'];
1195 1195
 	$field_description  = $field_type_object->field->args['desc'];
1196 1196
 	$license            = $field_type_object->field->args['options']['license'];
1197 1197
 	$license_key        = $escaped_value;
1198
-	$is_license_key     = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1199
-	$is_valid_license   = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1198
+	$is_license_key     = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1199
+	$is_valid_license   = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1200 1200
 	$shortname          = $field_type_object->field->args['options']['shortname'];
1201 1201
 	$field_classes      = 'regular-text give-license-field';
1202
-	$type               = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1202
+	$type               = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1203 1203
 	$custom_html        = '';
1204 1204
 	$messages           = array();
1205 1205
 	$class              = '';
@@ -1211,83 +1211,83 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1213 1213
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1214
-	if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1214
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1215 1215
 		$is_license_key = false;
1216 1216
 	}
1217 1217
 
1218 1218
 	// Check if current license is part of subscription or not.
1219
-	$subscriptions = get_option( 'give_subscriptions' );
1219
+	$subscriptions = get_option('give_subscriptions');
1220 1220
 
1221
-	if ( $is_license_key && $subscriptions ) {
1222
-		foreach ( $subscriptions as $subscription ) {
1223
-			if ( in_array( $license_key, $subscription['licenses'] ) ) {
1221
+	if ($is_license_key && $subscriptions) {
1222
+		foreach ($subscriptions as $subscription) {
1223
+			if (in_array($license_key, $subscription['licenses'])) {
1224 1224
 				$is_in_subscription = $subscription['id'];
1225 1225
 				break;
1226 1226
 			}
1227 1227
 		}
1228 1228
 	}
1229 1229
 
1230
-	if ( $is_license_key ) {
1230
+	if ($is_license_key) {
1231 1231
 
1232
-		if ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1232
+		if (empty($license->success) && property_exists($license, 'error')) {
1233 1233
 
1234 1234
 			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1235
-			switch ( $license->error ) {
1235
+			switch ($license->error) {
1236 1236
 				case 'expired' :
1237 1237
 					$class          = $license->error;
1238 1238
 					$messages[]     = sprintf(
1239
-						__( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1240
-						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1241
-						$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1239
+						__('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1240
+						date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1241
+						$checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1242 1242
 					);
1243
-					$license_status = 'license-' . $class;
1243
+					$license_status = 'license-'.$class;
1244 1244
 					break;
1245 1245
 
1246 1246
 				case 'missing' :
1247 1247
 					$class          = $license->error;
1248 1248
 					$messages[]     = sprintf(
1249
-						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1250
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1249
+						__('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1250
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1251 1251
 					);
1252
-					$license_status = 'license-' . $class;
1252
+					$license_status = 'license-'.$class;
1253 1253
 					break;
1254 1254
 
1255 1255
 				case 'invalid' :
1256 1256
 					$class          = $license->error;
1257 1257
 					$messages[]     = sprintf(
1258
-						__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1258
+						__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1259 1259
 						$addon_name,
1260
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1260
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1261 1261
 					);
1262
-					$license_status = 'license-' . $class;
1262
+					$license_status = 'license-'.$class;
1263 1263
 					break;
1264 1264
 
1265 1265
 				case 'site_inactive' :
1266 1266
 					$class          = $license->error;
1267 1267
 					$messages[]     = sprintf(
1268
-						__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1268
+						__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1269 1269
 						$addon_name,
1270
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1270
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1271 1271
 					);
1272
-					$license_status = 'license-' . $class;
1272
+					$license_status = 'license-'.$class;
1273 1273
 					break;
1274 1274
 
1275 1275
 				case 'item_name_mismatch' :
1276 1276
 					$class          = $license->error;
1277
-					$messages[]     = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name );
1278
-					$license_status = 'license-' . $class;
1277
+					$messages[]     = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name);
1278
+					$license_status = 'license-'.$class;
1279 1279
 					break;
1280 1280
 
1281 1281
 				case 'no_activations_left':
1282 1282
 					$class          = $license->error;
1283
-					$messages[]     = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1284
-					$license_status = 'license-' . $class;
1283
+					$messages[]     = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1284
+					$license_status = 'license-'.$class;
1285 1285
 					break;
1286 1286
 
1287 1287
 				default:
1288 1288
 					$class          = $license->error;
1289 1289
 					$messages[]     = sprintf(
1290
-						__( 'Your license is not activated. Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give' ),
1290
+						__('Your license is not activated. Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give'),
1291 1291
 						$license->error,
1292 1292
 						'<br/>',
1293 1293
 						"{$account_page_link}?utm_campaign=admin&utm_source=licenses&utm_medium={$license->error}"
@@ -1296,74 +1296,74 @@  discard block
 block discarded – undo
1296 1296
 					break;
1297 1297
 			}
1298 1298
 
1299
-		} elseif ( $is_in_subscription ) {
1299
+		} elseif ($is_in_subscription) {
1300 1300
 
1301
-			$subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] );
1302
-			$subscription_status  = __( 'renew', 'give' );
1301
+			$subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1302
+			$subscription_status  = __('renew', 'give');
1303 1303
 
1304
-			if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) {
1305
-				$subscription_status = __( 'expire', 'give' );
1304
+			if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1305
+				$subscription_status = __('expire', 'give');
1306 1306
 			}
1307 1307
 
1308
-			if ( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1309
-				$messages[]     = sprintf(
1310
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1311
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1312
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1313
-					$checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1308
+			if ($subscription_expires < current_time('timestamp', 1)) {
1309
+				$messages[] = sprintf(
1310
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1311
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1312
+					$subscriptions[$is_in_subscription]['payment_id'],
1313
+					$checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1314 1314
 				);
1315 1315
 				$license_status = 'license-expired';
1316
-			} elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1316
+			} elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1317 1317
 				$messages[]     = sprintf(
1318
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ),
1319
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1320
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1318
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'),
1319
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1320
+					$subscriptions[$is_in_subscription]['payment_id'],
1321 1321
 					$subscription_status,
1322
-					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) )
1322
+					human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1323 1323
 				);
1324 1324
 				$license_status = 'license-expires-soon';
1325 1325
 			} else {
1326 1326
 				$messages[]     = sprintf(
1327
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ),
1328
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1329
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1327
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'),
1328
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1329
+					$subscriptions[$is_in_subscription]['payment_id'],
1330 1330
 					$subscription_status,
1331
-					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) )
1331
+					date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1332 1332
 				);
1333 1333
 				$license_status = 'license-expiration-date';
1334 1334
 			}
1335 1335
 
1336
-		} elseif ( empty( $license->success ) ) {
1336
+		} elseif (empty($license->success)) {
1337 1337
 			$class          = 'invalid';
1338 1338
 			$messages[]     = sprintf(
1339
-				__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1339
+				__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1340 1340
 				$addon_name,
1341
-				$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1341
+				$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1342 1342
 			);
1343
-			$license_status = 'license-' . $class;
1343
+			$license_status = 'license-'.$class;
1344 1344
 
1345 1345
 		} else {
1346
-			switch ( $license->license ) {
1346
+			switch ($license->license) {
1347 1347
 				case 'valid' :
1348 1348
 				default:
1349 1349
 					$class      = 'valid';
1350
-					$now        = current_time( 'timestamp' );
1351
-					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1350
+					$now        = current_time('timestamp');
1351
+					$expiration = strtotime($license->expires, current_time('timestamp'));
1352 1352
 
1353
-					if ( 'lifetime' === $license->expires ) {
1354
-						$messages[]     = __( 'License key never expires.', 'give' );
1353
+					if ('lifetime' === $license->expires) {
1354
+						$messages[]     = __('License key never expires.', 'give');
1355 1355
 						$license_status = 'license-lifetime-notice';
1356
-					} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1356
+					} elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1357 1357
 						$messages[]     = sprintf(
1358
-							__( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1359
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1360
-							$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1358
+							__('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1359
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1360
+							$checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1361 1361
 						);
1362 1362
 						$license_status = 'license-expires-soon';
1363 1363
 					} else {
1364 1364
 						$messages[]     = sprintf(
1365
-							__( 'Your license key expires on %s.', 'give' ),
1366
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1365
+							__('Your license key expires on %s.', 'give'),
1366
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1367 1367
 						);
1368 1368
 						$license_status = 'license-expiration-date';
1369 1369
 					}
@@ -1371,15 +1371,15 @@  discard block
 block discarded – undo
1371 1371
 			}
1372 1372
 		}
1373 1373
 	} else {
1374
-		$messages[]     = sprintf(
1375
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1374
+		$messages[] = sprintf(
1375
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1376 1376
 			$addon_name
1377 1377
 		);
1378 1378
 		$license_status = 'inactive';
1379 1379
 	}
1380 1380
 
1381 1381
 	// Add class for input field if license is active.
1382
-	if ( $is_valid_license ) {
1382
+	if ($is_valid_license) {
1383 1383
 		$field_classes .= ' give-license-active';
1384 1384
 	}
1385 1385
 
@@ -1387,33 +1387,33 @@  discard block
 block discarded – undo
1387 1387
 	$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">";
1388 1388
 
1389 1389
 	// If license is active so show deactivate button.
1390
-	if ( $is_valid_license ) {
1390
+	if ($is_valid_license) {
1391 1391
 		// Get input field html.
1392 1392
 		$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">";
1393 1393
 
1394
-		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1394
+		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1395 1395
 
1396 1396
 	}
1397 1397
 
1398 1398
 	// Field description.
1399
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1399
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1400 1400
 
1401 1401
 	// If no messages found then inform user that to get updated in future register yourself.
1402
-	if ( empty( $messages ) ) {
1403
-		$messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) );
1402
+	if (empty($messages)) {
1403
+		$messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give'));
1404 1404
 	}
1405 1405
 
1406
-	foreach ( $messages as $message ) {
1407
-		$custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">';
1408
-		$custom_html .= '<p>' . $message . '</p>';
1406
+	foreach ($messages as $message) {
1407
+		$custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">';
1408
+		$custom_html .= '<p>'.$message.'</p>';
1409 1409
 		$custom_html .= '</div>';
1410 1410
 	}
1411 1411
 
1412 1412
 	// Field html.
1413
-	$custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object );
1413
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1414 1414
 
1415 1415
 	// Nonce.
1416
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1416
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1417 1417
 
1418 1418
 	// Print field html.
1419 1419
 	echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>";
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
  */
1429 1429
 function give_api_callback() {
1430 1430
 
1431
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1431
+	if ( ! current_user_can('manage_give_settings')) {
1432 1432
 		return;
1433 1433
 	}
1434 1434
 
@@ -1437,9 +1437,9 @@  discard block
 block discarded – undo
1437 1437
 	 *
1438 1438
 	 * @since 1.0
1439 1439
 	 */
1440
-	do_action( 'give_tools_api_keys_before' );
1440
+	do_action('give_tools_api_keys_before');
1441 1441
 
1442
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1442
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1443 1443
 
1444 1444
 	$api_keys_table = new Give_API_Keys_Table();
1445 1445
 	$api_keys_table->prepare_items();
@@ -1448,9 +1448,9 @@  discard block
 block discarded – undo
1448 1448
 	<span class="cmb2-metabox-description api-description">
1449 1449
 		<?php echo sprintf(
1450 1450
 		/* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */
1451
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1452
-			esc_url( 'http://docs.givewp.com/api' ),
1453
-			esc_url( 'http://docs.givewp.com/addon-zapier' )
1451
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1452
+			esc_url('http://docs.givewp.com/api'),
1453
+			esc_url('http://docs.givewp.com/addon-zapier')
1454 1454
 		); ?>
1455 1455
 	</span>
1456 1456
 	<?php
@@ -1460,10 +1460,10 @@  discard block
 block discarded – undo
1460 1460
 	 *
1461 1461
 	 * @since 1.0
1462 1462
 	 */
1463
-	do_action( 'give_tools_api_keys_after' );
1463
+	do_action('give_tools_api_keys_after');
1464 1464
 }
1465 1465
 
1466
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1466
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1467 1467
 
1468 1468
 /**
1469 1469
  * Hook Callback
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
  *
1477 1477
  * @return void
1478 1478
  */
1479
-function give_hook_callback( $args ) {
1479
+function give_hook_callback($args) {
1480 1480
 
1481 1481
 	$id = $args['id'];
1482 1482
 
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 	 *
1486 1486
 	 * @since 1.0
1487 1487
 	 */
1488
-	do_action( "give_{$id}" );
1488
+	do_action("give_{$id}");
1489 1489
 
1490 1490
 }
1491 1491
 
@@ -1500,19 +1500,19 @@  discard block
 block discarded – undo
1500 1500
  *
1501 1501
  * @return bool
1502 1502
  */
1503
-function give_is_setting_enabled( $value, $compare_with = null ) {
1504
-	if ( ! is_null( $compare_with ) ) {
1503
+function give_is_setting_enabled($value, $compare_with = null) {
1504
+	if ( ! is_null($compare_with)) {
1505 1505
 
1506
-		if ( is_array( $compare_with ) ) {
1506
+		if (is_array($compare_with)) {
1507 1507
 			// Output.
1508
-			return in_array( $value, $compare_with );
1508
+			return in_array($value, $compare_with);
1509 1509
 		}
1510 1510
 
1511 1511
 		// Output.
1512
-		return ( $value === $compare_with );
1512
+		return ($value === $compare_with);
1513 1513
 	}
1514 1514
 
1515 1515
 	// Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled
1516 1516
 	// Output.
1517
-	return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false );
1517
+	return (in_array($value, array('enabled', 'on', 'yes')) ? true : false);
1518 1518
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/give-export-donations-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  *
10 10
  * @see http://wordpress.stackexchange.com/questions/58834/echo-all-meta-keys-of-a-custom-post-type
11 11
  *
12
- * @return string
12
+ * @return false|null
13 13
  */
14 14
 function give_export_donations_get_custom_fields() {
15 15
 
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 	$post_type = 'give_payment';
18 18
 	$responses = array();
19 19
 
20
-	$form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : '';
20
+	$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : '';
21 21
 
22
-	if ( empty( $form_id ) ) {
22
+	if (empty($form_id)) {
23 23
 		return false;
24 24
 	}
25 25
 
26
-	$args          = array(
27
-		'give_forms'     => array( $form_id ),
28
-		'posts_per_page' => - 1,
26
+	$args = array(
27
+		'give_forms'     => array($form_id),
28
+		'posts_per_page' => -1,
29 29
 		'fields'         => 'ids',
30 30
 	);
31
-	$donation_list = implode( ',', (array) give_get_payments( $args ) );
31
+	$donation_list = implode(',', (array) give_get_payments($args));
32 32
 
33 33
 	$query_and = sprintf(
34 34
 		"AND $wpdb->posts.ID IN (%s) 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
         LEFT JOIN $wpdb->paymentmeta 
44 44
         ON $wpdb->posts.ID = $wpdb->paymentmeta.payment_id
45 45
         WHERE $wpdb->posts.post_type = '%s'
46
-    " . $query_and;
46
+    ".$query_and;
47 47
 
48
-	$meta_keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
48
+	$meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
49 49
 
50
-	if ( ! empty( $meta_keys ) ) {
51
-		$responses['standard_fields'] = array_values( $meta_keys );
50
+	if ( ! empty($meta_keys)) {
51
+		$responses['standard_fields'] = array_values($meta_keys);
52 52
 	}
53 53
 
54 54
 	$query_and = sprintf(
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
         LEFT JOIN $wpdb->paymentmeta 
65 65
         ON $wpdb->posts.ID = $wpdb->paymentmeta.payment_id 
66 66
         WHERE $wpdb->posts.post_type = '%s'
67
-    " . $query_and;
67
+    ".$query_and;
68 68
 
69
-	$hidden_meta_keys   = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
69
+	$hidden_meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
70 70
 
71 71
 	/**
72 72
 	 * Filter to modify hidden keys that are going to be ignore when displaying the hidden keys
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return array $ignore_hidden_keys Hidden keys that are going to be ignore
80 80
 	 */
81
-	$ignore_hidden_keys = apply_filters( 'give_export_donations_ignore_hidden_keys', array(
81
+	$ignore_hidden_keys = apply_filters('give_export_donations_ignore_hidden_keys', array(
82 82
 		'_give_payment_meta',
83 83
 		'_give_payment_gateway',
84 84
 		'_give_payment_form_title',
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	);
112 112
 
113 113
 	// Unset ignored hidden keys.
114
-	foreach ( $ignore_hidden_keys as $key ) {
115
-		if ( ( $key = array_search( $key, $hidden_meta_keys ) ) !== false ) {
116
-			unset( $hidden_meta_keys[ $key ] );
114
+	foreach ($ignore_hidden_keys as $key) {
115
+		if (($key = array_search($key, $hidden_meta_keys)) !== false) {
116
+			unset($hidden_meta_keys[$key]);
117 117
 		}
118 118
 	}
119 119
 
120
-	if ( ! empty( $hidden_meta_keys ) ) {
121
-		$responses['hidden_fields'] = array_values( $hidden_meta_keys );
120
+	if ( ! empty($hidden_meta_keys)) {
121
+		$responses['hidden_fields'] = array_values($hidden_meta_keys);
122 122
 	}
123 123
 
124 124
 	/**
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return array $responses
133 133
 	 */
134
-	wp_send_json( (array) apply_filters( 'give_export_donations_get_custom_fields', $responses, $form_id ) );
134
+	wp_send_json((array) apply_filters('give_export_donations_get_custom_fields', $responses, $form_id));
135 135
 
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields' );
138
+add_action('wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields');
139 139
 
140 140
 /**
141 141
  * Register the payments batch exporter
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
  * @since  1.0
144 144
  */
145 145
 function give_register_export_donations_batch_export() {
146
-	add_action( 'give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1 );
146
+	add_action('give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1);
147 147
 }
148 148
 
149
-add_action( 'give_register_batch_exporter', 'give_register_export_donations_batch_export', 10 );
149
+add_action('give_register_batch_exporter', 'give_register_export_donations_batch_export', 10);
150 150
 
151 151
 
152 152
 /**
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @param $class Give_Export_Donations_CSV
156 156
  */
157
-function give_export_donations_include_export_class( $class ) {
158
-	if ( 'Give_Export_Donations_CSV' === $class ) {
159
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-exporter.php';
157
+function give_export_donations_include_export_class($class) {
158
+	if ('Give_Export_Donations_CSV' === $class) {
159
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-exporter.php';
160 160
 	}
161 161
 }
162 162
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
  *
169 169
  * @return string
170 170
  */
171
-function give_export_donations_create_column_key( $string ) {
172
-	return sanitize_key( str_replace( ' ', '_', $string ) );
171
+function give_export_donations_create_column_key($string) {
172
+	return sanitize_key(str_replace(' ', '_', $string));
173 173
 }
174 174
 
175 175
 /**
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
  *
182 182
  * @return array
183 183
  */
184
-function give_export_donation_form_search_args( $args ) {
185
-	if ( empty( $_POST['fields'] ) ) {
184
+function give_export_donation_form_search_args($args) {
185
+	if (empty($_POST['fields'])) {
186 186
 		return $args;
187 187
 	}
188 188
 
189
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
190
-	parse_str( $fields );
189
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
190
+	parse_str($fields);
191 191
 
192
-	if ( ! empty( $give_forms_categories ) && ! empty( $give_forms_tags ) ) {
192
+	if ( ! empty($give_forms_categories) && ! empty($give_forms_tags)) {
193 193
 		$args['tax_query']['relation'] = 'AND';
194 194
 	}
195 195
 
196
-	if ( ! empty( $give_forms_categories ) ) {
196
+	if ( ! empty($give_forms_categories)) {
197 197
 		$args['tax_query'][] = array(
198 198
 			'taxonomy' => 'give_forms_category',
199 199
 			'field'    => 'term_id',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		);
203 203
 	}
204 204
 
205
-	if ( ! empty( $give_forms_tags ) ) {
205
+	if ( ! empty($give_forms_tags)) {
206 206
 		$args['tax_query'][] = array(
207 207
 			'taxonomy' => 'give_forms_tag',
208 208
 			'field'    => 'term_id',
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	return $args;
215 215
 }
216 216
 
217
-add_filter( 'give_ajax_form_search_args', 'give_export_donation_form_search_args' );
217
+add_filter('give_ajax_form_search_args', 'give_export_donation_form_search_args');
218 218
 
219 219
 /**
220 220
  * Add Donation standard fields in export donation page
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	?>
226 226
 	<tr>
227 227
 		<td scope="row" class="row-title">
228
-			<label><?php _e( 'Standard Columns:', 'give' ); ?></label>
228
+			<label><?php _e('Standard Columns:', 'give'); ?></label>
229 229
 		</td>
230 230
 		<td>
231 231
 			<div class="give-clearfix">
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 							<li class="give-export-option-label give-export-option-donation-label">
237 237
 								<span>
238
-									<?php _e( 'Donation Payment Fields', 'give' ); ?>
238
+									<?php _e('Donation Payment Fields', 'give'); ?>
239 239
 								</span>
240 240
 							</li>
241 241
 
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
 								<label for="give-export-donation-id">
244 244
 									<input type="checkbox" checked
245 245
 									       name="give_give_donations_export_option[donation_id]"
246
-									       id="give-export-donation-id"><?php _e( 'Donation ID', 'give' ); ?>
246
+									       id="give-export-donation-id"><?php _e('Donation ID', 'give'); ?>
247 247
 								</label>
248 248
 							</li>
249 249
 
250 250
 							<?php
251
-							if ( give_is_setting_enabled( give_get_option( 'sequential-ordering_status', 'disabled' ) ) ) {
251
+							if (give_is_setting_enabled(give_get_option('sequential-ordering_status', 'disabled'))) {
252 252
 								?>
253 253
 								<li>
254 254
 									<label for="give-export-seq-id">
255 255
 										<input type="checkbox" checked
256 256
 										       name="give_give_donations_export_option[seq_id]"
257
-										       id="give-export-seq-id"><?php _e( 'Donation Number', 'give' ); ?>
257
+										       id="give-export-seq-id"><?php _e('Donation Number', 'give'); ?>
258 258
 									</label>
259 259
 								</li>
260 260
 								<?php
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 								<label for="give-export-donation-sum">
266 266
 									<input type="checkbox" checked
267 267
 									       name="give_give_donations_export_option[donation_total]"
268
-									       id="give-export-donation-sum"><?php _e( 'Donation Total', 'give' ); ?>
268
+									       id="give-export-donation-sum"><?php _e('Donation Total', 'give'); ?>
269 269
 								</label>
270 270
 							</li>
271 271
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 								<label for="give-export-donation-currency_code">
274 274
 									<input type="checkbox" checked
275 275
 									       name="give_give_donations_export_option[currency_code]"
276
-									       id="give-export-donation-currency_code"><?php _e( 'Currency Code', 'give' ); ?>
276
+									       id="give-export-donation-currency_code"><?php _e('Currency Code', 'give'); ?>
277 277
 								</label>
278 278
 							</li>
279 279
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 								<label for="give-export-donation-currency_symbol">
282 282
 									<input type="checkbox" checked
283 283
 									       name="give_give_donations_export_option[currency_symbol]"
284
-									       id="give-export-donation-currency_symbol"><?php _e( 'Currency Symbol', 'give' ); ?>
284
+									       id="give-export-donation-currency_symbol"><?php _e('Currency Symbol', 'give'); ?>
285 285
 								</label>
286 286
 							</li>
287 287
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 								<label for="give-export-donation-status">
290 290
 									<input type="checkbox" checked
291 291
 									       name="give_give_donations_export_option[donation_status]"
292
-									       id="give-export-donation-status"><?php _e( 'Donation Status', 'give' ); ?>
292
+									       id="give-export-donation-status"><?php _e('Donation Status', 'give'); ?>
293 293
 								</label>
294 294
 							</li>
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 								<label for="give-export-donation-date">
298 298
 									<input type="checkbox" checked
299 299
 									       name="give_give_donations_export_option[donation_date]"
300
-									       id="give-export-donation-date"><?php _e( 'Donation Date', 'give' ); ?>
300
+									       id="give-export-donation-date"><?php _e('Donation Date', 'give'); ?>
301 301
 								</label>
302 302
 							</li>
303 303
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 								<label for="give-export-donation-time">
306 306
 									<input type="checkbox" checked
307 307
 									       name="give_give_donations_export_option[donation_time]"
308
-									       id="give-export-donation-time"><?php _e( 'Donation Time', 'give' ); ?>
308
+									       id="give-export-donation-time"><?php _e('Donation Time', 'give'); ?>
309 309
 								</label>
310 310
 							</li>
311 311
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 								<label for="give-export-payment-gateway">
314 314
 									<input type="checkbox" checked
315 315
 									       name="give_give_donations_export_option[payment_gateway]"
316
-									       id="give-export-payment-gateway"><?php _e( 'Payment Gateway', 'give' ); ?>
316
+									       id="give-export-payment-gateway"><?php _e('Payment Gateway', 'give'); ?>
317 317
 								</label>
318 318
 							</li>
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 							 *
324 324
 							 * @since 2.1
325 325
 							 */
326
-							do_action( 'give_export_donation_standard_payment_fields' );
326
+							do_action('give_export_donation_standard_payment_fields');
327 327
 							?>
328 328
 						</ul>
329 329
 					</li>
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
 							<li class="give-export-option-label give-export-option-Form-label">
335 335
 								<span>
336
-									<?php _e( 'Donation Form Fields', 'give' ); ?>
336
+									<?php _e('Donation Form Fields', 'give'); ?>
337 337
 								</span>
338 338
 							</li>
339 339
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 								<label for="give-export-donation-form-id">
343 343
 									<input type="checkbox" checked
344 344
 									       name="give_give_donations_export_option[form_id]"
345
-									       id="give-export-donation-form-id"><?php _e( 'Donation Form ID', 'give' ); ?>
345
+									       id="give-export-donation-form-id"><?php _e('Donation Form ID', 'give'); ?>
346 346
 								</label>
347 347
 							</li>
348 348
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 								<label for="give-export-donation-form-title">
351 351
 									<input type="checkbox" checked
352 352
 									       name="give_give_donations_export_option[form_title]"
353
-									       id="give-export-donation-form-title"><?php _e( 'Donation Form Title', 'give' ); ?>
353
+									       id="give-export-donation-form-title"><?php _e('Donation Form Title', 'give'); ?>
354 354
 								</label>
355 355
 							</li>
356 356
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 								<label for="give-export-donation-form-level-id">
359 359
 									<input type="checkbox" checked
360 360
 									       name="give_give_donations_export_option[form_level_id]"
361
-									       id="give-export-donation-form-level-id"><?php _e( 'Donation Form Level ID', 'give' ); ?>
361
+									       id="give-export-donation-form-level-id"><?php _e('Donation Form Level ID', 'give'); ?>
362 362
 								</label>
363 363
 							</li>
364 364
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 								<label for="give-export-donation-form-level-title">
367 367
 									<input type="checkbox" checked
368 368
 									       name="give_give_donations_export_option[form_level_title]"
369
-									       id="give-export-donation-form-level-title"><?php _e( 'Donation Form Level Title', 'give' ); ?>
369
+									       id="give-export-donation-form-level-title"><?php _e('Donation Form Level Title', 'give'); ?>
370 370
 								</label>
371 371
 							</li>
372 372
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 							 *
377 377
 							 * @since 2.1
378 378
 							 */
379
-							do_action( 'give_export_donation_standard_form_fields' );
379
+							do_action('give_export_donation_standard_form_fields');
380 380
 							?>
381 381
 						</ul>
382 382
 					</li>
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 							<li class="give-export-option-label give-export-option-donor-label">
388 388
 								<span>
389
-									<?php _e( 'Donor Fields', 'give' ); ?>
389
+									<?php _e('Donor Fields', 'give'); ?>
390 390
 								</span>
391 391
 							</li>
392 392
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 								<label for="give-export-first-name">
395 395
 									<input type="checkbox" checked
396 396
 									       name="give_give_donations_export_option[first_name]"
397
-									       id="give-export-first-name"><?php _e( 'Donor\'s First Name', 'give' ); ?>
397
+									       id="give-export-first-name"><?php _e('Donor\'s First Name', 'give'); ?>
398 398
 								</label>
399 399
 							</li>
400 400
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 								<label for="give-export-last-name">
403 403
 									<input type="checkbox" checked
404 404
 									       name="give_give_donations_export_option[last_name]"
405
-									       id="give-export-last-name"><?php _e( 'Donor\'s Last Name', 'give' ); ?>
405
+									       id="give-export-last-name"><?php _e('Donor\'s Last Name', 'give'); ?>
406 406
 								</label>
407 407
 							</li>
408 408
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 								<label for="give-export-email">
411 411
 									<input type="checkbox" checked
412 412
 									       name="give_give_donations_export_option[email]"
413
-									       id="give-export-email"><?php _e( 'Donor\'s Email', 'give' ); ?>
413
+									       id="give-export-email"><?php _e('Donor\'s Email', 'give'); ?>
414 414
 								</label>
415 415
 							</li>
416 416
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 								<label for="give-export-company">
419 419
 									<input type="checkbox" checked
420 420
 									       name="give_give_donations_export_option[company]"
421
-									       id="give-export-company"><?php _e( 'Company Name', 'give' ); ?>
421
+									       id="give-export-company"><?php _e('Company Name', 'give'); ?>
422 422
 								</label>
423 423
 							</li>
424 424
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 								<label for="give-export-address">
427 427
 									<input type="checkbox" checked
428 428
 									       name="give_give_donations_export_option[address]"
429
-									       id="give-export-address"><?php _e( 'Donor\'s Billing Address', 'give' ); ?>
429
+									       id="give-export-address"><?php _e('Donor\'s Billing Address', 'give'); ?>
430 430
 								</label>
431 431
 							</li>
432 432
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 								<label for="give-export-userid">
435 435
 									<input type="checkbox" checked
436 436
 									       name="give_give_donations_export_option[userid]"
437
-									       id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
437
+									       id="give-export-userid"><?php _e('User ID', 'give'); ?>
438 438
 								</label>
439 439
 							</li>
440 440
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 								<label for="give-export-donorid">
443 443
 									<input type="checkbox" checked
444 444
 									       name="give_give_donations_export_option[donorid]"
445
-									       id="give-export-donorid"><?php _e( 'Donor ID', 'give' ); ?>
445
+									       id="give-export-donorid"><?php _e('Donor ID', 'give'); ?>
446 446
 								</label>
447 447
 							</li>
448 448
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 								<label for="give-export-donor-ip">
451 451
 									<input type="checkbox" checked
452 452
 									       name="give_give_donations_export_option[donor_ip]"
453
-									       id="give-export-donor-ip"><?php _e( 'Donor IP Address', 'give' ); ?>
453
+									       id="give-export-donor-ip"><?php _e('Donor IP Address', 'give'); ?>
454 454
 								</label>
455 455
 							</li>
456 456
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 							 *
461 461
 							 * @since 2.1
462 462
 							 */
463
-							do_action( 'give_export_donation_standard_donor_fields' );
463
+							do_action('give_export_donation_standard_donor_fields');
464 464
 							?>
465 465
 						</ul>
466 466
 					</li>
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 					 *
472 472
 					 * @since 2.1.4
473 473
 					 */
474
-					do_action( 'give_export_donation_add_custom_column' );
474
+					do_action('give_export_donation_add_custom_column');
475 475
 					?>
476 476
 				</ul>
477 477
 			</div>
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	<?php
481 481
 }
482 482
 
483
-add_action( 'give_export_donation_fields', 'give_export_donation_standard_fields', 10 );
483
+add_action('give_export_donation_fields', 'give_export_donation_standard_fields', 10);
484 484
 
485 485
 /**
486 486
  * Add Donation Custom fields in export donation page
@@ -492,19 +492,19 @@  discard block
 block discarded – undo
492 492
 	<tr
493 493
 		class="give-hidden give-export-donations-hide give-export-donations-standard-fields">
494 494
 		<td scope="row" class="row-title">
495
-			<label><?php _e( 'Custom Field Columns:', 'give' ); ?></label>
495
+			<label><?php _e('Custom Field Columns:', 'give'); ?></label>
496 496
 		</td>
497 497
 		<td class="give-field-wrap">
498 498
 			<div class="give-clearfix">
499 499
 				<ul class="give-export-option-ul"></ul>
500
-				<p class="give-field-description"><?php _e( 'The following fields may have been created by custom code, or another plugin.', 'give' ); ?></p>
500
+				<p class="give-field-description"><?php _e('The following fields may have been created by custom code, or another plugin.', 'give'); ?></p>
501 501
 			</div>
502 502
 		</td>
503 503
 	</tr>
504 504
 	<?php
505 505
 }
506 506
 
507
-add_action( 'give_export_donation_fields', 'give_export_donation_custom_fields', 30 );
507
+add_action('give_export_donation_fields', 'give_export_donation_custom_fields', 30);
508 508
 
509 509
 
510 510
 /**
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 
518 518
 	<tr class="give-hidden give-export-donations-hide give-export-donations-hidden-fields">
519 519
 		<td scope="row" class="row-title">
520
-			<label><?php _e( 'Hidden Custom Field Columns:', 'give' ); ?></label>
520
+			<label><?php _e('Hidden Custom Field Columns:', 'give'); ?></label>
521 521
 		</td>
522 522
 		<td class="give-field-wrap">
523 523
 			<div class="give-clearfix">
524 524
 				<ul class="give-export-option-ul"></ul>
525
-				<p class="give-field-description"><?php _e( 'The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give' ); ?></p>
525
+				<p class="give-field-description"><?php _e('The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give'); ?></p>
526 526
 			</div>
527 527
 		</td>
528 528
 	</tr>
529 529
 	<?php
530 530
 }
531 531
 
532
-add_action( 'give_export_donation_fields', 'give_export_donation_hidden_fields', 40 );
532
+add_action('give_export_donation_fields', 'give_export_donation_hidden_fields', 40);
533 533
 
Please login to merge, or discard this patch.
includes/api/class-give-api-v2.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
 	 * @param WP_REST_Request $request
149 149
 	 *
150 150
 	 * @access public
151
-	 * @return array|mixed|object
151
+	 * @return string|null
152 152
 	 */
153 153
 	public function get_donation_grid( $request ) {
154 154
 		$parameters = $request->get_params();
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return Give_API_V2
62 62
 	 */
63 63
 	public static function get_instance() {
64
-		if ( null === static::$instance ) {
64
+		if (null === static::$instance) {
65 65
 			self::$instance = new static();
66 66
 
67 67
 			self::$instance->init();
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	private function init() {
81 81
 		// Setup hooks.
82
-		add_action( 'rest_api_init', array( $this, 'register_routes' ) );
83
-		add_action( 'wp_enqueue_scripts', array( $this, 'localize_script' ), 999 );
84
-		add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 999 );
82
+		add_action('rest_api_init', array($this, 'register_routes'));
83
+		add_action('wp_enqueue_scripts', array($this, 'localize_script'), 999);
84
+		add_action('admin_enqueue_scripts', array($this, 'localize_script'), 999);
85 85
 	}
86 86
 
87 87
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	 * @access private
94 94
 	 */
95 95
 	public function register_routes() {
96
-		register_rest_route( $this->rest_base, '/form/(?P<id>[\d]+)', array(
96
+		register_rest_route($this->rest_base, '/form/(?P<id>[\d]+)', array(
97 97
 			'methods'  => 'GET',
98
-			'callback' => array( $this, 'get_forms_data' ),
99
-		) );
98
+			'callback' => array($this, 'get_forms_data'),
99
+		));
100 100
 
101
-		register_rest_route( $this->rest_base, '/form-grid', array(
101
+		register_rest_route($this->rest_base, '/form-grid', array(
102 102
 			'methods'  => 'GET',
103
-			'callback' => array( $this, 'get_donation_grid' ),
104
-		) );
103
+			'callback' => array($this, 'get_donation_grid'),
104
+		));
105 105
 	}
106 106
 
107 107
 	/**
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function localize_script() {
114 114
 		$data = array(
115
-			'root' => esc_url_raw( Give_API_V2::get_rest_api() ),
115
+			'root' => esc_url_raw(Give_API_V2::get_rest_api()),
116 116
 			'rest_base' => $this->rest_base
117 117
 		);
118 118
 
119
-		if ( is_admin() ) {
120
-			wp_localize_script( 'give-admin-scripts', 'giveApiSettings', $data );
119
+		if (is_admin()) {
120
+			wp_localize_script('give-admin-scripts', 'giveApiSettings', $data);
121 121
 		} else {
122
-			wp_localize_script( 'give', 'giveApiSettings', $data );
122
+			wp_localize_script('give', 'giveApiSettings', $data);
123 123
 		}
124 124
 	}
125 125
 
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 	 * @access public
132 132
 	 * @return array|mixed|object
133 133
 	 */
134
-	public function get_forms_data( $request ) {
134
+	public function get_forms_data($request) {
135 135
 		$parameters = $request->get_params();
136 136
 
137 137
 		// Bailout
138
-		if ( ! isset( $parameters['id'] ) || empty( $parameters['id'] ) ) {
139
-			return array( 'error' => 'no_parameter_given' );
138
+		if ( ! isset($parameters['id']) || empty($parameters['id'])) {
139
+			return array('error' => 'no_parameter_given');
140 140
 		}
141 141
 
142
-		return give_form_shortcode( $parameters );
142
+		return give_form_shortcode($parameters);
143 143
 	}
144 144
 
145 145
 	/**
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 	 * @access public
151 151
 	 * @return array|mixed|object
152 152
 	 */
153
-	public function get_donation_grid( $request ) {
153
+	public function get_donation_grid($request) {
154 154
 		$parameters = $request->get_params();
155 155
 
156
-		return give_form_grid_shortcode( $parameters );
156
+		return give_form_grid_shortcode($parameters);
157 157
 	}
158 158
 
159 159
 	/**
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Full URL to the endpoint.
170 170
 	 */
171
-	public static function get_rest_api( $blog_id = null, $path = '/', $scheme = 'rest' ) {
172
-		return trailingslashit( get_rest_url( $blog_id, $path, $scheme ) . self::$instance->rest_base );
171
+	public static function get_rest_api($blog_id = null, $path = '/', $scheme = 'rest') {
172
+		return trailingslashit(get_rest_url($blog_id, $path, $scheme).self::$instance->rest_base);
173 173
 	}
174 174
 }
175 175
 
Please login to merge, or discard this patch.
includes/import-functions.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
  *
556 556
  * @since 2.1
557 557
  *
558
- * @param $file_dir
559
- * @param $start
560
- * @param $end
561
- * @param $delimiter
558
+ * @param false|string $file_dir
559
+ * @param integer $start
560
+ * @param integer $end
561
+ * @param string $delimiter
562 562
  *
563 563
  * @return array
564 564
  */
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
  *
585 585
  * @since 2.1
586 586
  *
587
- * @param $file_id
587
+ * @param integer $file_id
588 588
  *
589 589
  * @return false|string file content
590 590
  */
Please login to merge, or discard this patch.
Spacing   +316 added lines, -316 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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.8.13
21 21
  */
22 22
 function give_import_donation_report() {
23
-	return get_option( 'give_import_donation_report', array() );
23
+	return get_option('give_import_donation_report', array());
24 24
 }
25 25
 
26 26
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @since 1.8.13
31 31
  */
32
-function give_import_donation_report_update( $value = array() ) {
33
-	update_option( 'give_import_donation_report', $value );
32
+function give_import_donation_report_update($value = array()) {
33
+	update_option('give_import_donation_report', $value);
34 34
 }
35 35
 
36 36
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @since 1.8.13
40 40
  */
41 41
 function give_import_donation_report_reset() {
42
-	update_option( 'give_import_donation_report', array() );
42
+	update_option('give_import_donation_report', array());
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  *
52 52
  * @return array|bool|Give_Donate_Form|int|null|WP_Post
53 53
  */
54
-function give_import_get_form_data_from_csv( $data, $import_setting = array() ) {
54
+function give_import_get_form_data_from_csv($data, $import_setting = array()) {
55 55
 	$new_form = false;
56
-	$dry_run  = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
56
+	$dry_run  = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
57 57
 
58 58
 	// Get the import report
59 59
 	$report = give_import_donation_report();
@@ -61,25 +61,25 @@  discard block
 block discarded – undo
61 61
 	$form = false;
62 62
 	$meta = array();
63 63
 
64
-	if ( ! empty( $data['form_id'] ) ) {
65
-		$form = new Give_Donate_Form( $data['form_id'] );
64
+	if ( ! empty($data['form_id'])) {
65
+		$form = new Give_Donate_Form($data['form_id']);
66 66
 		// Add support to older php version.
67 67
 		$form_id = $form->get_ID();
68
-		if ( empty( $form_id ) ) {
68
+		if (empty($form_id)) {
69 69
 			$form = false;
70 70
 		} else {
71
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
71
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
72 72
 		}
73 73
 	}
74 74
 
75
-	if ( false === $form && ! empty( $data['form_title'] ) ) {
76
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
75
+	if (false === $form && ! empty($data['form_title'])) {
76
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
77 77
 
78
-		if ( ! empty( $form->ID ) ) {
78
+		if ( ! empty($form->ID)) {
79 79
 
80
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
80
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
81 81
 
82
-			$form = new Give_Donate_Form( $form->ID );
82
+			$form = new Give_Donate_Form($form->ID);
83 83
 		} else {
84 84
 			$form = new Give_Donate_Form();
85 85
 			$args = array(
@@ -87,43 +87,43 @@  discard block
 block discarded – undo
87 87
 				'post_status' => 'publish',
88 88
 			);
89 89
 
90
-			if ( empty( $dry_run ) ) {
91
-				$form = $form->create( $args );
90
+			if (empty($dry_run)) {
91
+				$form = $form->create($args);
92 92
 			}
93 93
 
94
-			$report['create_form'] = ( ! empty( $report['create_form'] ) ? ( absint( $report['create_form'] ) + 1 ) : 1 );
94
+			$report['create_form'] = ( ! empty($report['create_form']) ? (absint($report['create_form']) + 1) : 1);
95 95
 			$new_form              = true;
96 96
 
97 97
 		}
98 98
 
99
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
100
-		if ( ! empty( $form->ID ) ) {
101
-			$form = new Give_Donate_Form( $form->ID );
99
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
100
+		if ( ! empty($form->ID)) {
101
+			$form = new Give_Donate_Form($form->ID);
102 102
 		}
103 103
 	}
104 104
 
105
-	if ( ! empty( $form ) && $form->get_ID() && ! empty( $data['form_level'] ) && empty( $dry_run ) ) {
105
+	if ( ! empty($form) && $form->get_ID() && ! empty($data['form_level']) && empty($dry_run)) {
106 106
 
107 107
 		$price_option = 'set';
108
-		$form_level   = strtolower( preg_replace( '/\s+/', '', $data['form_level'] ) );
108
+		$form_level   = strtolower(preg_replace('/\s+/', '', $data['form_level']));
109 109
 
110
-		if ( 'custom' !== $form_level ) {
110
+		if ('custom' !== $form_level) {
111 111
 			$prices     = (array) $form->get_prices();
112 112
 			$price_text = array();
113
-			foreach ( $prices as $key => $price ) {
114
-				if ( isset( $price['_give_id']['level_id'] ) ) {
115
-					$price_text[ $price['_give_id']['level_id'] ] = ( ! empty( $price['_give_text'] ) ? strtolower( preg_replace( '/\s+/', '', $price['_give_text'] ) ) : '' );
113
+			foreach ($prices as $key => $price) {
114
+				if (isset($price['_give_id']['level_id'])) {
115
+					$price_text[$price['_give_id']['level_id']] = ( ! empty($price['_give_text']) ? strtolower(preg_replace('/\s+/', '', $price['_give_text'])) : '');
116 116
 				}
117 117
 			}
118 118
 
119
-			if ( ! in_array( $form_level, $price_text ) ) {
119
+			if ( ! in_array($form_level, $price_text)) {
120 120
 
121 121
 				// For generating unquiet level id.
122 122
 				$count     = 1;
123
-				$new_level = count( $prices ) + $count;
124
-				while ( array_key_exists( $new_level, $price_text ) ) {
125
-					$count ++;
126
-					$new_level = count( $prices ) + $count;
123
+				$new_level = count($prices) + $count;
124
+				while (array_key_exists($new_level, $price_text)) {
125
+					$count++;
126
+					$new_level = count($prices) + $count;
127 127
 				}
128 128
 
129 129
 				$multi_level_donations = array(
@@ -131,42 +131,42 @@  discard block
 block discarded – undo
131 131
 						'_give_id'     => array(
132 132
 							'level_id' => $new_level,
133 133
 						),
134
-						'_give_amount' => give_sanitize_amount_for_db( $data['amount'] ),
134
+						'_give_amount' => give_sanitize_amount_for_db($data['amount']),
135 135
 						'_give_text'   => $data['form_level'],
136 136
 					),
137 137
 				);
138 138
 
139
-				$price_text[ $new_level ] = strtolower( preg_replace( '/\s+/', '', $data['form_level'] ) );
139
+				$price_text[$new_level] = strtolower(preg_replace('/\s+/', '', $data['form_level']));
140 140
 
141
-				if ( ! empty( $prices ) && is_array( $prices ) && ! empty( $prices[0] ) ) {
142
-					$prices = wp_parse_args( $multi_level_donations, $prices );
141
+				if ( ! empty($prices) && is_array($prices) && ! empty($prices[0])) {
142
+					$prices = wp_parse_args($multi_level_donations, $prices);
143 143
 
144 144
 					// Sort $prices by amount in ascending order.
145
-					$prices = wp_list_sort( $prices, '_give_amount', 'ASC' );
145
+					$prices = wp_list_sort($prices, '_give_amount', 'ASC');
146 146
 				} else {
147 147
 					$prices = $multi_level_donations;
148 148
 				}
149 149
 
150 150
 				// Unset _give_default key from $prices.
151
-				foreach ( $prices as $key => $price ) {
152
-					if ( isset( $prices[ $key ]['_give_default'] ) ) {
153
-						unset( $prices[ $key ]['_give_default'] );
151
+				foreach ($prices as $key => $price) {
152
+					if (isset($prices[$key]['_give_default'])) {
153
+						unset($prices[$key]['_give_default']);
154 154
 					}
155 155
 				}
156 156
 
157 157
 				// Set the first $price of the $prices as default.
158 158
 				$prices[0]['_give_default'] = 'default';
159 159
 			}
160
-			$form->price_id = array_search( $form_level, $price_text );
160
+			$form->price_id = array_search($form_level, $price_text);
161 161
 
162
-			$donation_levels_amounts = wp_list_pluck( $prices, '_give_amount' );
163
-			$min_amount              = min( $donation_levels_amounts );
164
-			$max_amount              = max( $donation_levels_amounts );
162
+			$donation_levels_amounts = wp_list_pluck($prices, '_give_amount');
163
+			$min_amount              = min($donation_levels_amounts);
164
+			$max_amount              = max($donation_levels_amounts);
165 165
 
166 166
 			$meta = array(
167 167
 				'_give_levels_minimum_amount' => $min_amount,
168 168
 				'_give_levels_maximum_amount' => $max_amount,
169
-				'_give_donation_levels'       => array_values( $prices ),
169
+				'_give_donation_levels'       => array_values($prices),
170 170
 			);
171 171
 
172 172
 			$price_option = 'multi';
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
 		}
176 176
 
177 177
 		$defaults = array(
178
-			'_give_set_price' => give_sanitize_amount_for_db( $data['amount'] ),
178
+			'_give_set_price' => give_sanitize_amount_for_db($data['amount']),
179 179
 		);
180 180
 
181 181
 		// If new form is created.
182
-		if ( ! empty( $new_form ) ) {
182
+		if ( ! empty($new_form)) {
183 183
 			$new_form = array(
184
-				'_give_custom_amount_text'          => ( ! empty( $data['form_custom_amount_text'] ) ? $data['form_custom_amount_text'] : 'custom' ),
184
+				'_give_custom_amount_text'          => ( ! empty($data['form_custom_amount_text']) ? $data['form_custom_amount_text'] : 'custom'),
185 185
 				'_give_logged_in_only'              => 'enabled',
186 186
 				'_give_custom_amount'               => 'enabled',
187 187
 				'_give_payment_import'              => true,
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 				'_give_show_register_form'          => 'both',
195 195
 				'_give_price_option'                => $price_option,
196 196
 			);
197
-			$defaults = wp_parse_args( $defaults, $new_form );
197
+			$defaults = wp_parse_args($defaults, $new_form);
198 198
 		}
199 199
 
200
-		$meta = wp_parse_args( $meta, $defaults );
200
+		$meta = wp_parse_args($meta, $defaults);
201 201
 
202
-		foreach ( $meta as $key => $value ) {
203
-			give_update_meta( $form->get_ID(), $key, $value );
202
+		foreach ($meta as $key => $value) {
203
+			give_update_meta($form->get_ID(), $key, $value);
204 204
 		}
205 205
 	}
206 206
 
207 207
 	// update the report
208
-	give_import_donation_report_update( $report );
208
+	give_import_donation_report_update($report);
209 209
 
210 210
 	return $form;
211 211
 }
@@ -219,36 +219,36 @@  discard block
 block discarded – undo
219 219
  *
220 220
  * @return bool|false|WP_User
221 221
  */
222
-function give_import_get_user_from_csv( $data, $import_setting = array() ) {
222
+function give_import_get_user_from_csv($data, $import_setting = array()) {
223 223
 	$report               = give_import_donation_report();
224
-	$dry_run              = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
224
+	$dry_run              = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
225 225
 	$dry_run_donor_create = false;
226 226
 	$donor_data           = array();
227 227
 	$donor_id             = false;
228 228
 
229 229
 	// check if donor id is not empty
230
-	if ( ! empty( $data['donor_id'] ) ) {
231
-		$donor_data = new Give_Donor( (int) $data['donor_id'] );
232
-		if ( ! empty( $donor_data->id ) ) {
233
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
230
+	if ( ! empty($data['donor_id'])) {
231
+		$donor_data = new Give_Donor((int) $data['donor_id']);
232
+		if ( ! empty($donor_data->id)) {
233
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
234 234
 		}
235 235
 	}
236 236
 
237
-	if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) {
237
+	if (empty($donor_data->id) && ! empty($data['user_id'])) {
238 238
 		$user_id    = (int) $data['user_id'];
239
-		$donor_data = new Give_Donor( $user_id, true );
239
+		$donor_data = new Give_Donor($user_id, true);
240 240
 
241 241
 
242
-		if ( empty( $donor_data->id ) ) {
243
-			$donor_data = get_user_by( 'id', $user_id );
242
+		if (empty($donor_data->id)) {
243
+			$donor_data = get_user_by('id', $user_id);
244 244
 
245 245
 			// if no wp user is found then no donor is create with that user id
246
-			if ( ! empty( $donor_data->ID ) ) {
246
+			if ( ! empty($donor_data->ID)) {
247 247
 
248
-				if ( empty( $dry_run ) ) {
249
-					$first_name = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $donor_data->user_nicename );
250
-					$last_name  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ( $lastname = get_user_meta( $donor_data->ID, 'last_name', true ) ) ? $lastname : '' ) );
251
-					$name       = $first_name . ' ' . $last_name;
248
+				if (empty($dry_run)) {
249
+					$first_name = ( ! empty($data['first_name']) ? $data['first_name'] : $donor_data->user_nicename);
250
+					$last_name  = ( ! empty($data['last_name']) ? $data['last_name'] : (($lastname = get_user_meta($donor_data->ID, 'last_name', true)) ? $lastname : ''));
251
+					$name       = $first_name.' '.$last_name;
252 252
 					$user_email = $donor_data->user_email;
253 253
 					$donor_args = array(
254 254
 						'name'    => $name,
@@ -257,51 +257,51 @@  discard block
 block discarded – undo
257 257
 					);
258 258
 
259 259
 					$donor_data = new Give_Donor();
260
-					$donor_data->create( $donor_args );
260
+					$donor_data->create($donor_args);
261 261
 
262 262
 					// Adding notes that donor is being imported from CSV.
263 263
 					$current_user = wp_get_current_user();
264
-					$donor_data->add_note( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) );
264
+					$donor_data->add_note(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email));
265 265
 
266 266
 					// Add is used to ensure duplicate emails are not added
267
-					if ( $user_email != $data['email'] && ! empty( $data['email'] ) ) {
268
-						$donor_data->add_meta( 'additional_email', $data['email'] );
267
+					if ($user_email != $data['email'] && ! empty($data['email'])) {
268
+						$donor_data->add_meta('additional_email', $data['email']);
269 269
 					}
270 270
 				} else {
271 271
 					$dry_run_donor_create = true;
272
-					$donor_data           = array( 'id' => 1 );
272
+					$donor_data           = array('id' => 1);
273 273
 				}
274 274
 
275
-				$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
276
-			} elseif ( $dry_run ) {
275
+				$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
276
+			} elseif ($dry_run) {
277 277
 				$donor_data = array();
278 278
 			}
279 279
 		} else {
280 280
 			// Add is used to ensure duplicate emails are not added
281
-			if ( $donor_data->email != $data['email'] && empty( $dry_run ) ) {
282
-				$donor_data->add_meta( 'additional_email', ( ! empty( $data['email'] ) ? $data['email'] : $donor_data->email ) );
281
+			if ($donor_data->email != $data['email'] && empty($dry_run)) {
282
+				$donor_data->add_meta('additional_email', ( ! empty($data['email']) ? $data['email'] : $donor_data->email));
283 283
 			}
284
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
284
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
285 285
 		}
286 286
 	}
287 287
 
288
-	if ( empty( $donor_data->id ) && ! empty( $data['email'] ) && empty( $dry_run_donor_create ) ) {
288
+	if (empty($donor_data->id) && ! empty($data['email']) && empty($dry_run_donor_create)) {
289 289
 
290
-		$donor_data = new Give_Donor( $data['email'] );
291
-		if ( empty( $donor_data->id ) ) {
292
-			$donor_data = get_user_by( 'email', $data['email'] );
290
+		$donor_data = new Give_Donor($data['email']);
291
+		if (empty($donor_data->id)) {
292
+			$donor_data = get_user_by('email', $data['email']);
293 293
 
294
-			if ( empty( $donor_data->ID ) && isset( $import_setting['create_user'] ) && 1 === absint( $import_setting['create_user'] ) ) {
295
-				$data['first_name'] = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $data['email'] );
296
-				$data['last_name']  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : '' );
297
-				$give_role          = (array) give_get_option( 'donor_default_user_role', get_option( 'default_role', ( ( $give_donor = wp_roles()->is_role( 'give_donor' ) ) && ! empty( $give_donor ) ? 'give_donor' : 'subscriber' ) ) );
294
+			if (empty($donor_data->ID) && isset($import_setting['create_user']) && 1 === absint($import_setting['create_user'])) {
295
+				$data['first_name'] = ( ! empty($data['first_name']) ? $data['first_name'] : $data['email']);
296
+				$data['last_name']  = ( ! empty($data['last_name']) ? $data['last_name'] : '');
297
+				$give_role          = (array) give_get_option('donor_default_user_role', get_option('default_role', (($give_donor = wp_roles()->is_role('give_donor')) && ! empty($give_donor) ? 'give_donor' : 'subscriber')));
298 298
 				$donor_args         = array(
299 299
 					'user_login'      => $data['email'],
300 300
 					'user_email'      => $data['email'],
301
-					'user_registered' => date( 'Y-m-d H:i:s' ),
301
+					'user_registered' => date('Y-m-d H:i:s'),
302 302
 					'user_first'      => $data['first_name'],
303 303
 					'user_last'       => $data['last_name'],
304
-					'user_pass'       => wp_generate_password( 8, true ),
304
+					'user_pass'       => wp_generate_password(8, true),
305 305
 					'role'            => $give_role,
306 306
 				);
307 307
 
@@ -310,63 +310,63 @@  discard block
 block discarded – undo
310 310
 				 *
311 311
 				 * @since 1.8.13
312 312
 				 */
313
-				$donor_args = (array) apply_filters( 'give_import_insert_user_args', $donor_args, $data, $import_setting );
313
+				$donor_args = (array) apply_filters('give_import_insert_user_args', $donor_args, $data, $import_setting);
314 314
 
315
-				if ( empty( $dry_run ) ) {
315
+				if (empty($dry_run)) {
316 316
 
317 317
 					// This action was added to remove the login when using the give register function.
318
-					add_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
319
-					$donor_id = give_register_and_login_new_user( $donor_args );
320
-					remove_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
318
+					add_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
319
+					$donor_id = give_register_and_login_new_user($donor_args);
320
+					remove_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
321 321
 
322
-					$donor_data = new Give_Donor( $donor_id, true );
323
-					$donor_data->update_meta( '_give_payment_import', true );
322
+					$donor_data = new Give_Donor($donor_id, true);
323
+					$donor_data->update_meta('_give_payment_import', true);
324 324
 
325 325
 				} else {
326 326
 					$dry_run_donor_create   = true;
327
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
327
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
328 328
 				}
329 329
 			} else {
330
-				$donor_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false );
330
+				$donor_id = ( ! empty($donor_data->ID) ? $donor_data->ID : false);
331 331
 			}
332 332
 
333
-			if ( empty( $dry_run_donor_create ) && ( ! empty( $donor_id ) || ( isset( $import_setting['create_user'] ) && 0 === absint( $import_setting['create_user'] ) ) ) ) {
334
-				$donor_data = new Give_Donor( $donor_id, true );
333
+			if (empty($dry_run_donor_create) && ( ! empty($donor_id) || (isset($import_setting['create_user']) && 0 === absint($import_setting['create_user'])))) {
334
+				$donor_data = new Give_Donor($donor_id, true);
335 335
 
336
-				if ( empty( $donor_data->id ) ) {
336
+				if (empty($donor_data->id)) {
337 337
 
338
-					if ( ! empty( $data['form_id'] ) ) {
339
-						$form = new Give_Donate_Form( $data['form_id'] );
338
+					if ( ! empty($data['form_id'])) {
339
+						$form = new Give_Donate_Form($data['form_id']);
340 340
 					}
341 341
 
342
-					if ( empty( $dry_run ) ) {
343
-						$payment_title = ( isset( $data['form_title'] ) ? $data['form_title'] : ( isset( $form ) ? $form->get_name() : __( 'New Form', 'give' ) ) );
342
+					if (empty($dry_run)) {
343
+						$payment_title = (isset($data['form_title']) ? $data['form_title'] : (isset($form) ? $form->get_name() : __('New Form', 'give')));
344 344
 						$donor_args    = array(
345
-							'name'  => ! is_email( $payment_title ) ? $data['first_name'] . ' ' . $data['last_name'] : '',
345
+							'name'  => ! is_email($payment_title) ? $data['first_name'].' '.$data['last_name'] : '',
346 346
 							'email' => $data['email'],
347 347
 						);
348
-						if ( ! empty( $donor_id ) ) {
348
+						if ( ! empty($donor_id)) {
349 349
 							$donor_args['user_id'] = $donor_id;
350 350
 						}
351
-						$donor_data->create( $donor_args );
351
+						$donor_data->create($donor_args);
352 352
 
353 353
 						// Adding notes that donor is being imported from CSV.
354 354
 						$current_user = wp_get_current_user();
355
-						$donor_data->add_note( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) );
355
+						$donor_data->add_note(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email));
356 356
 					} else {
357 357
 						$dry_run_donor_create = true;
358 358
 					}
359
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
359
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
360 360
 				} else {
361
-					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
361
+					$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
362 362
 				}
363 363
 			}
364 364
 		} else {
365
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
365
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
366 366
 		}
367 367
 	}
368 368
 	// update the report
369
-	give_import_donation_report_update( $report );
369
+	give_import_donation_report_update($report);
370 370
 
371 371
 	return $donor_data;
372 372
 }
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	 *
385 385
 	 * @return array
386 386
 	 */
387
-	return (array) apply_filters( 'give_import_default_options', array(
388
-		'' => __( 'Do not import', 'give' ),
389
-	) );
387
+	return (array) apply_filters('give_import_default_options', array(
388
+		'' => __('Do not import', 'give'),
389
+	));
390 390
 }
391 391
 
392 392
 /**
@@ -402,74 +402,74 @@  discard block
 block discarded – undo
402 402
 	 *
403 403
 	 * @return array
404 404
 	 */
405
-	return (array) apply_filters( 'give_import_donations_options', array(
406
-		'id'          => __( 'Donation ID', 'give' ),
405
+	return (array) apply_filters('give_import_donations_options', array(
406
+		'id'          => __('Donation ID', 'give'),
407 407
 		'amount'      => array(
408
-			__( 'Donation Amount', 'give' ),
409
-			__( 'Amount', 'give' )
408
+			__('Donation Amount', 'give'),
409
+			__('Amount', 'give')
410 410
 		),
411 411
 		'currency'      => array(
412
-			__( 'Donation Currencies', 'give' ),
413
-			__( 'Currencies', 'give' )
412
+			__('Donation Currencies', 'give'),
413
+			__('Currencies', 'give')
414 414
 		),
415 415
 		'post_date'   => array(
416
-			__( 'Donation Date', 'give' ),
417
-			__( 'Date', 'give' ),
416
+			__('Donation Date', 'give'),
417
+			__('Date', 'give'),
418 418
 		),
419 419
 		'first_name'  => array(
420
-			__( 'Donor First Name', 'give' ),
421
-			__( 'First Name', 'give' ),
422
-			__( 'Name', 'give' ),
420
+			__('Donor First Name', 'give'),
421
+			__('First Name', 'give'),
422
+			__('Name', 'give'),
423 423
 		),
424 424
 		'last_name'   => array(
425
-			__( 'Donor Last Name', 'give' ),
426
-			__( 'Last Name', 'give' ),
425
+			__('Donor Last Name', 'give'),
426
+			__('Last Name', 'give'),
427 427
 		),
428 428
 		'company_name'   => array(
429
-			__( 'Company Name', 'give' ),
430
-			__( 'Donor Company Name', 'give' ),
431
-			__( 'Donor Company', 'give' ),
432
-			__( 'Company', 'give' ),
429
+			__('Company Name', 'give'),
430
+			__('Donor Company Name', 'give'),
431
+			__('Donor Company', 'give'),
432
+			__('Company', 'give'),
433 433
 		),
434 434
 		'line1'       => array(
435
-			__( 'Address 1', 'give' ),
436
-			__( 'Address', 'give' ),
435
+			__('Address 1', 'give'),
436
+			__('Address', 'give'),
437 437
 		),
438
-		'line2'       => __( 'Address 2', 'give' ),
439
-		'city'        => __( 'City', 'give' ),
438
+		'line2'       => __('Address 2', 'give'),
439
+		'city'        => __('City', 'give'),
440 440
 		'state'       => array(
441
-			__( 'State', 'give' ),
442
-			__( 'Province', 'give' ),
443
-			__( 'County', 'give' ),
444
-			__( 'Region', 'give' ),
441
+			__('State', 'give'),
442
+			__('Province', 'give'),
443
+			__('County', 'give'),
444
+			__('Region', 'give'),
445 445
 		),
446
-		'country'     => __( 'Country', 'give' ),
446
+		'country'     => __('Country', 'give'),
447 447
 		'zip'         => array(
448
-			__( 'Zip Code', 'give' ),
449
-			__( 'Zip', 'give' ),
450
-			__( 'zipcode', 'give' ),
451
-			__( 'Postal Code', 'give' ),
452
-			__( 'Postal', 'give' ),
448
+			__('Zip Code', 'give'),
449
+			__('Zip', 'give'),
450
+			__('zipcode', 'give'),
451
+			__('Postal Code', 'give'),
452
+			__('Postal', 'give'),
453 453
 		),
454 454
 		'email'       => array(
455
-			__( 'Donor Email', 'give' ),
456
-			__( 'Email', 'give' )
455
+			__('Donor Email', 'give'),
456
+			__('Email', 'give')
457 457
 		),
458 458
 		'post_status' => array(
459
-			__( 'Donation Status', 'give' ),
460
-			__( 'Status', 'give' ),
459
+			__('Donation Status', 'give'),
460
+			__('Status', 'give'),
461 461
 		),
462 462
 		'gateway'     => array(
463
-			__( 'Payment Method', 'give' ),
464
-			__( 'Method', 'give' ),
463
+			__('Payment Method', 'give'),
464
+			__('Method', 'give'),
465 465
 		),
466
-		'notes'       => __( 'Notes', 'give' ),
466
+		'notes'       => __('Notes', 'give'),
467 467
 		'mode'        => array(
468
-			__( 'Test Mode', 'give' ),
469
-			__( 'Mode', 'give' ),
468
+			__('Test Mode', 'give'),
469
+			__('Mode', 'give'),
470 470
 		),
471
-		'post_meta'   => __( 'Import as Meta', 'give' ),
472
-	) );
471
+		'post_meta'   => __('Import as Meta', 'give'),
472
+	));
473 473
 }
474 474
 
475 475
 /**
@@ -485,10 +485,10 @@  discard block
 block discarded – undo
485 485
 	 *
486 486
 	 * @return array
487 487
 	 */
488
-	return (array) apply_filters( 'give_import_donor_options', array(
489
-		'donor_id' => __( 'Donor ID', 'give' ),
490
-		'user_id'  => __( 'User ID', 'give' ),
491
-	) );
488
+	return (array) apply_filters('give_import_donor_options', array(
489
+		'donor_id' => __('Donor ID', 'give'),
490
+		'user_id'  => __('User ID', 'give'),
491
+	));
492 492
 }
493 493
 
494 494
 /**
@@ -504,23 +504,23 @@  discard block
 block discarded – undo
504 504
 	 *
505 505
 	 * @return array
506 506
 	 */
507
-	return (array) apply_filters( 'give_import_donation_form_options', array(
507
+	return (array) apply_filters('give_import_donation_form_options', array(
508 508
 		'form_title'              => array(
509
-			__( 'Donation Form Title', 'give' ),
510
-			__( 'Donation Form', 'give' ),
511
-			__( 'Form Name', 'give' ),
512
-			__( 'Title', 'give' ),
509
+			__('Donation Form Title', 'give'),
510
+			__('Donation Form', 'give'),
511
+			__('Form Name', 'give'),
512
+			__('Title', 'give'),
513 513
 		),
514 514
 		'form_id'                 => array(
515
-			__( 'Donation Form ID', 'give' ),
516
-			__( 'Form ID', 'give' )
515
+			__('Donation Form ID', 'give'),
516
+			__('Form ID', 'give')
517 517
 		),
518 518
 		'form_level'              => array(
519
-			__( 'Donation Level', 'give' ),
520
-			__( 'Level', 'give' ),
519
+			__('Donation Level', 'give'),
520
+			__('Level', 'give'),
521 521
 		),
522
-		'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ),
523
-	) );
522
+		'form_custom_amount_text' => __('Custom Amount Text', 'give'),
523
+	));
524 524
 }
525 525
 
526 526
 /**
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
  *
534 534
  * @return array
535 535
  */
536
-function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = 'csv' ) {
536
+function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = 'csv') {
537 537
 	/**
538 538
 	 * Filter to modify delimiter of Import
539 539
 	 *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 	 *
544 544
 	 * @return string $delimiter
545 545
 	 */
546
-	$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
546
+	$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
547 547
 
548
-	$file_dir = give_get_file_data_by_file_id( $file_id );
548
+	$file_dir = give_get_file_data_by_file_id($file_id);
549 549
 
550
-	return give_get_raw_data_from_file( $file_dir, $start, $end, $delimiter );
550
+	return give_get_raw_data_from_file($file_dir, $start, $end, $delimiter);
551 551
 }
552 552
 
553 553
 /**
@@ -562,18 +562,18 @@  discard block
 block discarded – undo
562 562
  *
563 563
  * @return array
564 564
  */
565
-function give_get_raw_data_from_file( $file_dir, $start, $end, $delimiter ) {
565
+function give_get_raw_data_from_file($file_dir, $start, $end, $delimiter) {
566 566
 	$raw_data = array();
567 567
 
568 568
 	$count    = 0;
569
-	if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
570
-		while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) {
571
-			if ( $count >= $start && $count <= $end ) {
569
+	if (false !== ($handle = fopen($file_dir, 'r'))) {
570
+		while (false !== ($row = fgetcsv($handle, 0, $delimiter))) {
571
+			if ($count >= $start && $count <= $end) {
572 572
 				$raw_data[] = $row;
573 573
 			}
574
-			$count ++;
574
+			$count++;
575 575
 		}
576
-		fclose( $handle );
576
+		fclose($handle);
577 577
 	}
578 578
 
579 579
 	return $raw_data;
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
  *
589 589
  * @return false|string file content
590 590
  */
591
-function give_get_file_data_by_file_id( $file_id ) {
592
-	return get_attached_file( $file_id );
591
+function give_get_file_data_by_file_id($file_id) {
592
+	return get_attached_file($file_id);
593 593
 }
594 594
 
595 595
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
  *
603 603
  * @return bool
604 604
  */
605
-function give_log_user_in_on_register_callback( $value ) {
605
+function give_log_user_in_on_register_callback($value) {
606 606
 	return false;
607 607
 }
608 608
 
@@ -618,87 +618,87 @@  discard block
 block discarded – undo
618 618
  *
619 619
  * @return bool
620 620
  */
621
-function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) {
622
-	$data                          = array_combine( $raw_key, $row_data );
621
+function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) {
622
+	$data                          = array_combine($raw_key, $row_data);
623 623
 	$price_id                      = false;
624 624
 	$donor_id                      = 0;
625 625
 	$donor_data                    = array();
626 626
 	$form                          = array();
627
-	$import_setting['create_user'] = isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1;
628
-	$dry_run                       = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
627
+	$import_setting['create_user'] = isset($import_setting['create_user']) ? $import_setting['create_user'] : 1;
628
+	$dry_run                       = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
629 629
 	$_dry_run_is_duplicate         = false;
630 630
 	$dry_run_duplicate_form        = false;
631 631
 	$dry_run_duplicate_donor       = false;
632
-	$donation_key                  = empty( $import_setting['donation_key'] ) ? 1 : (int) $import_setting['donation_key'];
632
+	$donation_key                  = empty($import_setting['donation_key']) ? 1 : (int) $import_setting['donation_key'];
633 633
 	$payment_id = false;
634 634
 
635
-	$data = (array) apply_filters( 'give_save_import_donation_to_db', $data );
635
+	$data = (array) apply_filters('give_save_import_donation_to_db', $data);
636 636
 
637
-	$data['amount'] = give_maybe_sanitize_amount( $data['amount'] );
637
+	$data['amount'] = give_maybe_sanitize_amount($data['amount']);
638 638
 	$diff           = array();
639 639
 
640
-	if ( ! empty( $dry_run ) && 1 !== $donation_key ) {
641
-		$csv_raw_data = empty( $import_setting['csv_raw_data'] ) ? array() : $import_setting['csv_raw_data'];
642
-		$donors_list  = empty( $import_setting['donors_list'] ) ? array() : $import_setting['donors_list'];
640
+	if ( ! empty($dry_run) && 1 !== $donation_key) {
641
+		$csv_raw_data = empty($import_setting['csv_raw_data']) ? array() : $import_setting['csv_raw_data'];
642
+		$donors_list  = empty($import_setting['donors_list']) ? array() : $import_setting['donors_list'];
643 643
 		$key          = $donation_key - 1;
644
-		for ( $i = 0; $i < $key; $i ++ ) {
645
-			$csv_data           = array_combine( $raw_key, $csv_raw_data[ $i ] );
646
-			$csv_data['amount'] = give_maybe_sanitize_amount( $csv_data['amount'] );
644
+		for ($i = 0; $i < $key; $i++) {
645
+			$csv_data           = array_combine($raw_key, $csv_raw_data[$i]);
646
+			$csv_data['amount'] = give_maybe_sanitize_amount($csv_data['amount']);
647 647
 			// check for duplicate donations
648
-			$diff = array_diff( $csv_data, $data );
649
-			if ( empty( $diff ) ) {
648
+			$diff = array_diff($csv_data, $data);
649
+			if (empty($diff)) {
650 650
 				$_dry_run_is_duplicate   = true;
651 651
 				$dry_run_duplicate_form  = true;
652 652
 				$dry_run_duplicate_donor = true;
653 653
 			} else {
654 654
 				// check for duplicate donation form with form id
655
-				if ( ! empty( $csv_data['form_id'] ) && ! empty( $data['form_id'] ) && $csv_data['form_id'] === $data['form_id'] ) {
656
-					$form    = new Give_Donate_Form( $data['form_id'] );
655
+				if ( ! empty($csv_data['form_id']) && ! empty($data['form_id']) && $csv_data['form_id'] === $data['form_id']) {
656
+					$form    = new Give_Donate_Form($data['form_id']);
657 657
 					$form_id = $form->get_ID();
658
-					if ( ! empty( $form_id ) ) {
658
+					if ( ! empty($form_id)) {
659 659
 						$dry_run_duplicate_form = true;
660 660
 					}
661 661
 				}
662 662
 				// check for duplicate donation form with form title
663
-				if ( empty( $dry_run_duplicate_form ) && ! empty( $csv_data['form_title'] ) && ! empty( $data['form_title'] ) && $csv_data['form_title'] === $data['form_title'] ) {
663
+				if (empty($dry_run_duplicate_form) && ! empty($csv_data['form_title']) && ! empty($data['form_title']) && $csv_data['form_title'] === $data['form_title']) {
664 664
 					$dry_run_duplicate_form = true;
665 665
 				}
666 666
 
667 667
 
668 668
 				// check for duplicate donor by donor id
669
-				if ( ! empty( $csv_data['donor_id'] ) && ! empty( $data['donor_id'] ) && $csv_data['donor_id'] === $data['donor_id'] ) {
670
-					$donor = array_search( (int) $data['donor_id'], array_column( 'id', $donors_list ) );
671
-					if ( ! empty( $donor ) ) {
669
+				if ( ! empty($csv_data['donor_id']) && ! empty($data['donor_id']) && $csv_data['donor_id'] === $data['donor_id']) {
670
+					$donor = array_search((int) $data['donor_id'], array_column('id', $donors_list));
671
+					if ( ! empty($donor)) {
672 672
 						$dry_run_duplicate_donor = true;
673 673
 					}
674 674
 				}
675 675
 
676 676
 				// check for duplicate donor by user id
677
-				if ( empty( $dry_run_duplicate_donor ) && ! empty( $csv_data['user_id'] ) && ! empty( $data['user_id'] ) && $csv_data['user_id'] === $data['user_id'] ) {
678
-					$donor = array_search( (int) $data['user_id'], array_column( 'user_id', $donors_list ) );
679
-					if ( ! empty( $donor ) ) {
677
+				if (empty($dry_run_duplicate_donor) && ! empty($csv_data['user_id']) && ! empty($data['user_id']) && $csv_data['user_id'] === $data['user_id']) {
678
+					$donor = array_search((int) $data['user_id'], array_column('user_id', $donors_list));
679
+					if ( ! empty($donor)) {
680 680
 						$dry_run_duplicate_donor = true;
681 681
 					} else {
682
-						$donor = get_user_by( 'id', $csv_data['user_id'] );
683
-						if ( ! empty( $donor->ID ) ) {
682
+						$donor = get_user_by('id', $csv_data['user_id']);
683
+						if ( ! empty($donor->ID)) {
684 684
 							$dry_run_duplicate_donor = true;
685 685
 						}
686 686
 					}
687 687
 				}
688 688
 
689 689
 				// check for duplicate donor by donor id
690
-				if ( empty( $dry_run_duplicate_donor ) && ! empty( $csv_data['email'] ) && ! empty( $data['email'] ) && $csv_data['email'] === $data['email'] ) {
690
+				if (empty($dry_run_duplicate_donor) && ! empty($csv_data['email']) && ! empty($data['email']) && $csv_data['email'] === $data['email']) {
691 691
 					$dry_run_duplicate_donor = true;
692 692
 				}
693 693
 			}
694 694
 		}
695 695
 	}
696 696
 
697
-	if ( empty( $dry_run_duplicate_donor ) ) {
697
+	if (empty($dry_run_duplicate_donor)) {
698 698
 		// Here come the login function.
699
-		$donor_data = give_import_get_user_from_csv( $data, $import_setting );
700
-		if ( empty( $dry_run ) ) {
701
-			if ( ! empty( $donor_data->id ) ) {
699
+		$donor_data = give_import_get_user_from_csv($data, $import_setting);
700
+		if (empty($dry_run)) {
701
+			if ( ! empty($donor_data->id)) {
702 702
 				$donor_id = $donor_data->id;
703 703
 			} else {
704 704
 				return $payment_id;
@@ -707,40 +707,40 @@  discard block
 block discarded – undo
707 707
 	} else {
708 708
 		// Get the report
709 709
 		$report                    = give_import_donation_report();
710
-		$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
710
+		$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
711 711
 		// update the report
712
-		give_import_donation_report_update( $report );
712
+		give_import_donation_report_update($report);
713 713
 	}
714 714
 
715
-	if ( empty( $dry_run_duplicate_form ) ) {
715
+	if (empty($dry_run_duplicate_form)) {
716 716
 		// get form data or register a form data.
717
-		$form = give_import_get_form_data_from_csv( $data, $import_setting );
718
-		if ( false == $form && empty( $dry_run ) ) {
717
+		$form = give_import_get_form_data_from_csv($data, $import_setting);
718
+		if (false == $form && empty($dry_run)) {
719 719
 			return $payment_id;
720 720
 		} else {
721
-			$price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false;
721
+			$price_id = ( ! empty($form->price_id)) ? $form->price_id : false;
722 722
 		}
723 723
 	} else {
724 724
 		// Get the report
725 725
 		$report                   = give_import_donation_report();
726
-		$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
726
+		$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
727 727
 		// update the report
728
-		give_import_donation_report_update( $report );
728
+		give_import_donation_report_update($report);
729 729
 	}
730 730
 
731 731
 	// Get the report
732 732
 	$report = give_import_donation_report();
733 733
 
734 734
 
735
-	$status  = give_import_donation_get_status( $data );
736
-	$country = ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' );
737
-	$state   = ( ! empty( $data['state'] ) ? ( ( $state_code = array_search( $data['state'], give_get_states( $country ) ) ) ? $state_code : $data['state'] ) : '' );
735
+	$status  = give_import_donation_get_status($data);
736
+	$country = ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : '');
737
+	$state   = ( ! empty($data['state']) ? (($state_code = array_search($data['state'], give_get_states($country))) ? $state_code : $data['state']) : '');
738 738
 
739 739
 	$address = array(
740
-		'line1'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ),
741
-		'line2'   => ( ! empty( $data['line2'] ) ? give_clean( $data['line2'] ) : '' ),
742
-		'city'    => ( ! empty( $data['city'] ) ? give_clean( $data['city'] ) : '' ),
743
-		'zip'     => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ),
740
+		'line1'   => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''),
741
+		'line2'   => ( ! empty($data['line2']) ? give_clean($data['line2']) : ''),
742
+		'city'    => ( ! empty($data['city']) ? give_clean($data['city']) : ''),
743
+		'zip'     => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''),
744 744
 		'state'   => $state,
745 745
 		'country' => $country,
746 746
 	);
@@ -750,22 +750,22 @@  discard block
 block discarded – undo
750 750
 		'donor_id'        => $donor_id,
751 751
 		'price'           => $data['amount'],
752 752
 		'status'          => $status,
753
-		'currency'        => ! empty( $data['currency'] ) && array_key_exists( $data['currency'], give_get_currencies_list() ) ? $data['currency'] : give_get_currency(),
753
+		'currency'        => ! empty($data['currency']) && array_key_exists($data['currency'], give_get_currencies_list()) ? $data['currency'] : give_get_currency(),
754 754
 		'user_info'       => array(
755 755
 			'id'         => $donor_id,
756
-			'email'      => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ),
757
-			'first_name' => ( ! empty( $data['first_name'] ) ? $data['first_name'] : ( ! empty( $donor_id ) && ( $first_name = get_user_meta( $donor_id, 'first_name', true ) ) ? $first_name : $donor_data->name ) ),
758
-			'last_name'  => ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ! empty( $donor_id ) && ( $last_name = get_user_meta( $donor_id, 'last_name', true ) ) ? $last_name : $donor_data->name ) ),
756
+			'email'      => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)),
757
+			'first_name' => ( ! empty($data['first_name']) ? $data['first_name'] : ( ! empty($donor_id) && ($first_name = get_user_meta($donor_id, 'first_name', true)) ? $first_name : $donor_data->name)),
758
+			'last_name'  => ( ! empty($data['last_name']) ? $data['last_name'] : ( ! empty($donor_id) && ($last_name = get_user_meta($donor_id, 'last_name', true)) ? $last_name : $donor_data->name)),
759 759
 			'address'    => $address,
760 760
 		),
761
-		'gateway'         => ( ! empty( $data['gateway'] ) && 'offline' != strtolower( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ),
762
-		'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : ( method_exists( $form, 'get_name' ) ? $form->get_name() : '' ) ),
763
-		'give_form_id'    => method_exists( $form, 'get_ID' ) ? $form->get_ID() : '',
761
+		'gateway'         => ( ! empty($data['gateway']) && 'offline' != strtolower($data['gateway']) ? strtolower($data['gateway']) : 'manual'),
762
+		'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : (method_exists($form, 'get_name') ? $form->get_name() : '')),
763
+		'give_form_id'    => method_exists($form, 'get_ID') ? $form->get_ID() : '',
764 764
 		'give_price_id'   => $price_id,
765
-		'purchase_key'    => strtolower( md5( uniqid() ) ),
765
+		'purchase_key'    => strtolower(md5(uniqid())),
766 766
 		'user_email'      => $data['email'],
767
-		'post_date'       => ( ! empty( $data['post_date'] ) ? mysql2date( 'Y-m-d H:i:s', $data['post_date'] ) : current_time( 'mysql' ) ),
768
-		'mode'            => ( ! empty( $data['mode'] ) ? ( 'true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ),
767
+		'post_date'       => ( ! empty($data['post_date']) ? mysql2date('Y-m-d H:i:s', $data['post_date']) : current_time('mysql')),
768
+		'mode'            => ( ! empty($data['mode']) ? ('true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))),
769 769
 	);
770 770
 
771 771
 	/**
@@ -780,74 +780,74 @@  discard block
 block discarded – undo
780 780
 	 *
781 781
 	 * @return array $payment_data payment data
782 782
 	 */
783
-	$payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form );
783
+	$payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form);
784 784
 
785 785
 	// Get the report
786 786
 	$report = give_import_donation_report();
787 787
 
788 788
 	// Check for duplicate code.
789
-	$donation_duplicate = give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data );
790
-	if ( false !== $donation_duplicate || ! empty( $_dry_run_is_duplicate ) ) {
791
-		$report['donation_details'][ $import_setting['donation_key'] ]['duplicate'] = $donation_duplicate;
792
-		$report['duplicate_donation']                                               = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 );
789
+	$donation_duplicate = give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data);
790
+	if (false !== $donation_duplicate || ! empty($_dry_run_is_duplicate)) {
791
+		$report['donation_details'][$import_setting['donation_key']]['duplicate'] = $donation_duplicate;
792
+		$report['duplicate_donation']                                               = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1);
793 793
 	} else {
794 794
 
795
-		if ( empty( $dry_run ) ) {
796
-			add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 );
797
-			add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 );
798
-			add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 );
799
-			add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 );
795
+		if (empty($dry_run)) {
796
+			add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1);
797
+			add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2);
798
+			add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3);
799
+			add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2);
800 800
 
801 801
 			// if it status is other then pending then first change the donation status to pending and after adding the payment meta update the donation status.
802
-			if ( 'pending' !== $status ) {
803
-				unset( $payment_data['status'] );
802
+			if ('pending' !== $status) {
803
+				unset($payment_data['status']);
804 804
 			}
805 805
 
806
-			$payment_id = give_insert_payment( $payment_data );
807
-			remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 );
808
-			remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 );
809
-			remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 );
810
-			remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 );
806
+			$payment_id = give_insert_payment($payment_data);
807
+			remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1);
808
+			remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11);
809
+			remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11);
810
+			remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11);
811 811
 
812
-			if ( $payment_id ) {
812
+			if ($payment_id) {
813 813
 
814
-				$payment = new Give_Payment( $payment_id );
814
+				$payment = new Give_Payment($payment_id);
815 815
 
816
-				$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
816
+				$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
817 817
 
818
-				$payment->update_meta( '_give_payment_import', true );
818
+				$payment->update_meta('_give_payment_import', true);
819 819
 
820
-				if ( ! empty( $import_setting['csv'] ) ) {
821
-					$payment->update_meta( '_give_payment_import_id', $import_setting['csv'] );
820
+				if ( ! empty($import_setting['csv'])) {
821
+					$payment->update_meta('_give_payment_import_id', $import_setting['csv']);
822 822
 				}
823 823
 
824 824
 				// Insert Company Name.
825
-				if ( ! empty( $data['company_name'] ) ) {
826
-					$payment->update_meta( '_give_donation_company', $data['company_name'] );
827
-					$donor_data->update_meta( '_give_donor_company', $data['company_name'] );
825
+				if ( ! empty($data['company_name'])) {
826
+					$payment->update_meta('_give_donation_company', $data['company_name']);
827
+					$donor_data->update_meta('_give_donor_company', $data['company_name']);
828 828
 				}
829 829
 
830 830
 				// Insert Notes.
831
-				if ( ! empty( $data['notes'] ) ) {
832
-					$payment->add_note( $data['notes'] );
831
+				if ( ! empty($data['notes'])) {
832
+					$payment->add_note($data['notes']);
833 833
 				}
834 834
 
835
-				$meta_exists = array_keys( $raw_key, 'post_meta' );
836
-				if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) {
837
-					foreach ( $meta_exists as $meta_exist ) {
838
-						if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) {
839
-							$payment->update_meta( $main_key[ $meta_exist ], $row_data[ $meta_exist ] );
835
+				$meta_exists = array_keys($raw_key, 'post_meta');
836
+				if ( ! empty($main_key) && ! empty($meta_exists)) {
837
+					foreach ($meta_exists as $meta_exist) {
838
+						if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) {
839
+							$payment->update_meta($main_key[$meta_exist], $row_data[$meta_exist]);
840 840
 						}
841 841
 					}
842 842
 				}
843 843
 
844 844
 				// update the donation status if it's other then pending
845
-				if ( 'pending' !== $status ) {
846
-					$payment->update_status( $status );
845
+				if ('pending' !== $status) {
846
+					$payment->update_status($status);
847 847
 				}
848 848
 
849 849
 			} else {
850
-				$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
850
+				$report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1);
851 851
 				$payment_id = false;
852 852
 			}
853 853
 
@@ -862,15 +862,15 @@  discard block
 block discarded – undo
862 862
 			 * @param array $donor_data donor data
863 863
 			 * @param object $donor_data form object
864 864
 			 */
865
-			do_action( 'give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form );
865
+			do_action('give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form);
866 866
 		} else {
867
-			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
867
+			$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
868 868
 			$payment_id = true;
869 869
 		}
870 870
 	}
871 871
 
872 872
 	// update the report
873
-	give_import_donation_report_update( $report );
873
+	give_import_donation_report_update($report);
874 874
 
875 875
 	return $payment_id;
876 876
 }
@@ -884,25 +884,25 @@  discard block
 block discarded – undo
884 884
  *
885 885
  * @return string $status Donation status.
886 886
  */
887
-function give_import_donation_get_status( $data ) {
888
-	if ( empty( $data['post_status'] ) ) {
887
+function give_import_donation_get_status($data) {
888
+	if (empty($data['post_status'])) {
889 889
 		return 'publish';
890 890
 	}
891 891
 
892 892
 	$status = 'publish';
893 893
 
894
-	$donation_status = trim( $data['post_status'] );
895
-	$donation_status_key      = strtolower( preg_replace( '/\s+/', '', $donation_status ) );
894
+	$donation_status = trim($data['post_status']);
895
+	$donation_status_key = strtolower(preg_replace('/\s+/', '', $donation_status));
896 896
 
897
-	foreach ( give_get_payment_statuses() as $key => $value ) {
897
+	foreach (give_get_payment_statuses() as $key => $value) {
898 898
 		$match = false;
899
-		if ( $key === $donation_status_key ) {
899
+		if ($key === $donation_status_key) {
900 900
 			$match = true;
901
-		} else if ( stristr( $donation_status, $value ) ) {
901
+		} else if (stristr($donation_status, $value)) {
902 902
 			$match = true;
903 903
 		}
904 904
 
905
-		if ( ! empty( $match ) ) {
905
+		if ( ! empty($match)) {
906 906
 			$status = $key;
907 907
 			break;
908 908
 		}
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
  *
923 923
  * @return Give_Donor
924 924
  */
925
-function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) {
925
+function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) {
926 926
 	$old_donor = $donor;
927
-	if ( ! empty( $payment_data['donor_id'] ) ) {
928
-		$donor_id = absint( $payment_data['donor_id'] );
929
-		$donor    = new Give_Donor( $donor_id );
930
-		if ( ! empty( $donor->id ) ) {
927
+	if ( ! empty($payment_data['donor_id'])) {
928
+		$donor_id = absint($payment_data['donor_id']);
929
+		$donor    = new Give_Donor($donor_id);
930
+		if ( ! empty($donor->id)) {
931 931
 			return $donor;
932 932
 		}
933 933
 	}
@@ -940,12 +940,12 @@  discard block
 block discarded – undo
940 940
  *
941 941
  * @since 1.8.13
942 942
  */
943
-function give_import_donation_insert_payment( $payment_id, $payment_data ) {
943
+function give_import_donation_insert_payment($payment_id, $payment_data) {
944 944
 	// Update Give Customers purchase_count
945
-	if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) {
946
-		$donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true );
947
-		if ( ! empty( $donor_id ) ) {
948
-			$donor = new Give_Donor( $donor_id );
945
+	if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) {
946
+		$donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true);
947
+		if ( ! empty($donor_id)) {
948
+			$donor = new Give_Donor($donor_id);
949 949
 			$donor->increase_purchase_count();
950 950
 		}
951 951
 	}
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
  *
957 957
  * @since 1.8.13
958 958
  */
959
-function give_donation_import_give_insert_payment_args( $args, $payment_data ) {
960
-	if ( ! empty( $payment_data['user_info']['id'] ) ) {
959
+function give_donation_import_give_insert_payment_args($args, $payment_data) {
960
+	if ( ! empty($payment_data['user_info']['id'])) {
961 961
 		$args['post_author'] = (int) $payment_data['user_info']['id'];
962 962
 	}
963 963
 
@@ -969,11 +969,11 @@  discard block
 block discarded – undo
969 969
  *
970 970
  * @since 1.8.13
971 971
  */
972
-function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
972
+function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) {
973 973
 	$return = false;
974
-	if ( ! empty( $data['post_date'] ) ) {
975
-		$post_date = mysql2date( 'Y-m-d-H-i-s', $payment_data['post_date'] );
976
-		$post_date = explode( '-', $post_date );
974
+	if ( ! empty($data['post_date'])) {
975
+		$post_date = mysql2date('Y-m-d-H-i-s', $payment_data['post_date']);
976
+		$post_date = explode('-', $post_date);
977 977
 		$args      = array(
978 978
 			'output'                 => 'post',
979 979
 			'cache_results'          => false,
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 			'meta_query'             => array(
995 995
 				array(
996 996
 					'key'     => '_give_payment_total',
997
-					'value'   => preg_replace( '/[\$,]/', '', $payment_data['price'] ),
997
+					'value'   => preg_replace('/[\$,]/', '', $payment_data['price']),
998 998
 					'compare' => 'LIKE',
999 999
 				),
1000 1000
 				array(
@@ -1010,15 +1010,15 @@  discard block
 block discarded – undo
1010 1010
 				),
1011 1011
 				array(
1012 1012
 					'key'     => '_give_payment_donor_id',
1013
-					'value'   => isset( $donor_data->id ) ? $donor_data->id : '',
1013
+					'value'   => isset($donor_data->id) ? $donor_data->id : '',
1014 1014
 					'compare' => '=',
1015 1015
 				),
1016 1016
 			),
1017 1017
 		);
1018 1018
 
1019
-		$payments  = new Give_Payments_Query( $args );
1019
+		$payments  = new Give_Payments_Query($args);
1020 1020
 		$donations = $payments->get_payments();
1021
-		if ( ! empty( $donations ) ) {
1021
+		if ( ! empty($donations)) {
1022 1022
 			$return = $donations;
1023 1023
 		}
1024 1024
 	}
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 	 *
1029 1029
 	 * @since 1.8.18
1030 1030
 	 */
1031
-	return apply_filters( 'give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data );
1031
+	return apply_filters('give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data);
1032 1032
 }
1033 1033
 
1034 1034
 /**
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return void
1042 1042
  */
1043
-function give_donation_import_insert_default_payment_note( $payment_id ) {
1043
+function give_donation_import_insert_default_payment_note($payment_id) {
1044 1044
 	$current_user = wp_get_current_user();
1045
-	give_insert_payment_note( $payment_id, wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) );
1045
+	give_insert_payment_note($payment_id, wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email));
1046 1046
 }
1047 1047
 
1048 1048
 /**
@@ -1054,14 +1054,14 @@  discard block
 block discarded – undo
1054 1054
  *
1055 1055
  * @return string URL
1056 1056
  */
1057
-function give_import_page_url( $parameter = array() ) {
1057
+function give_import_page_url($parameter = array()) {
1058 1058
 	$defalut_query_arg = array(
1059 1059
 		'post_type'     => 'give_forms',
1060 1060
 		'page'          => 'give-tools',
1061 1061
 		'tab'           => 'import',
1062 1062
 		'importer-type' => 'import_donations',
1063 1063
 	);
1064
-	$import_query_arg  = wp_parse_args( $parameter, $defalut_query_arg );
1064
+	$import_query_arg = wp_parse_args($parameter, $defalut_query_arg);
1065 1065
 
1066
-	return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) );
1066
+	return add_query_arg($import_query_arg, admin_url('edit.php'));
1067 1067
 }
1068 1068
\ No newline at end of file
Please login to merge, or discard this patch.
includes/payments/class-give-sequential-donation-number.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 	 * @since
198 198
 	 * @access public
199 199
 	 *
200
-	 * @param $serial_number
200
+	 * @param integer $serial_number
201 201
 	 *
202 202
 	 * @return string
203 203
 	 */
Please login to merge, or discard this patch.
Spacing   +47 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if access directly.
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined('ABSPATH')) {
4 4
 	exit;
5 5
 }
6 6
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return Give_Sequential_Donation_Number
41 41
 	 */
42 42
 	public static function get_instance() {
43
-		if ( null === static::$instance ) {
43
+		if (null === static::$instance) {
44 44
 			self::$instance = new static();
45 45
 
46 46
 			self::$instance->init();
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @since 2.1.0
57 57
 	 */
58 58
 	public function init() {
59
-		add_action( 'wp_insert_post', array( $this, '__save_donation_title' ), 10, 3 );
60
-		add_action( 'after_delete_post', array( $this, '__remove_serial_number' ), 10, 1 );
59
+		add_action('wp_insert_post', array($this, '__save_donation_title'), 10, 3);
60
+		add_action('after_delete_post', array($this, '__remove_serial_number'), 10, 1);
61 61
 	}
62 62
 
63 63
 	/**
@@ -73,27 +73,27 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return void
75 75
 	 */
76
-	public function __save_donation_title( $donation_id, $post, $existing_donation_updated ) {
76
+	public function __save_donation_title($donation_id, $post, $existing_donation_updated) {
77 77
 		// Bailout
78 78
 		if (
79
-			! give_is_setting_enabled( give_get_option( 'sequential-ordering_status', 'disabled' ) )
79
+			! give_is_setting_enabled(give_get_option('sequential-ordering_status', 'disabled'))
80 80
 			|| $existing_donation_updated
81 81
 			|| 'give_payment' !== $post->post_type
82 82
 		) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		$serial_number = $this->__set_donation_number( $donation_id );
87
-		$serial_code   = $this->set_number_padding( $serial_number );
86
+		$serial_number = $this->__set_donation_number($donation_id);
87
+		$serial_code   = $this->set_number_padding($serial_number);
88 88
 
89 89
 		// Add prefix.
90
-		if ( $prefix = give_get_option( 'sequential-ordering_number_prefix', '' ) ) {
91
-			$serial_code = $prefix . $serial_code;
90
+		if ($prefix = give_get_option('sequential-ordering_number_prefix', '')) {
91
+			$serial_code = $prefix.$serial_code;
92 92
 		}
93 93
 
94 94
 		// Add suffix.
95
-		if ( $suffix = give_get_option( 'sequential-ordering_number_suffix', '' ) ) {
96
-			$serial_code = $serial_code . $suffix;
95
+		if ($suffix = give_get_option('sequential-ordering_number_suffix', '')) {
96
+			$serial_code = $serial_code.$suffix;
97 97
 		}
98 98
 
99 99
 		/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 */
104 104
 		$serial_code = apply_filters(
105 105
 			'give_set_sequential_donation_title',
106
-			give_time_do_tags( $serial_code ),
106
+			give_time_do_tags($serial_code),
107 107
 			$donation_id,
108 108
 			$post,
109 109
 			$existing_donation_updated,
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 				array(
121 121
 					'ID'         => $donation_id,
122 122
 					'post_name'  => "{$this->donation_title_prefix}-{$serial_number}",
123
-					'post_title' => trim( $serial_code )
123
+					'post_title' => trim($serial_code)
124 124
 				)
125 125
 			);
126 126
 
127
-			if ( is_wp_error( $wp_error ) ) {
128
-				throw new Exception( $wp_error->get_error_message() );
127
+			if (is_wp_error($wp_error)) {
128
+				throw new Exception($wp_error->get_error_message());
129 129
 			}
130 130
 
131
-			give_update_option( 'sequential-ordering_number', ( $serial_number + 1 ) );
132
-		} catch ( Exception $e ) {
133
-			error_log( "Give caught exception: {$e->getMessage()}" );
131
+			give_update_option('sequential-ordering_number', ($serial_number + 1));
132
+		} catch (Exception $e) {
133
+			error_log("Give caught exception: {$e->getMessage()}");
134 134
 		}
135 135
 	}
136 136
 
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @return int
147 147
 	 */
148
-	public function __set_donation_number( $donation_id ) {
148
+	public function __set_donation_number($donation_id) {
149 149
 		$table_data = array(
150 150
 			'payment_id' => $donation_id
151 151
 		);
152 152
 
153 153
 		// Customize sequential donation number starting point if needed.
154 154
 		if (
155
-			get_option( '_give_reset_sequential_number' ) &&
156
-			( $number = give_get_option( 'sequential-ordering_number', 0 ) )
155
+			get_option('_give_reset_sequential_number') &&
156
+			($number = give_get_option('sequential-ordering_number', 0))
157 157
 		) {
158
-			if ( Give()->sequential_donation_db->get_id_auto_increment_val() <= $number ) {
159
-				delete_option( '_give_reset_sequential_number' );
158
+			if (Give()->sequential_donation_db->get_id_auto_increment_val() <= $number) {
159
+				delete_option('_give_reset_sequential_number');
160 160
 			}
161 161
 
162 162
 			$table_data['id'] = $number;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 */
171 171
 		return apply_filters(
172 172
 			'give_set_sequential_donation_number',
173
-			Give()->sequential_donation_db->insert( $table_data ),
173
+			Give()->sequential_donation_db->insert($table_data),
174 174
 			$table_data
175 175
 		);
176 176
 	}
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return bool
189 189
 	 */
190
-	public function __remove_serial_number( $donation_id ) {
191
-		return Give()->sequential_donation_db->delete( $this->get_serial_number( $donation_id ) );
190
+	public function __remove_serial_number($donation_id) {
191
+		return Give()->sequential_donation_db->delete($this->get_serial_number($donation_id));
192 192
 	}
193 193
 
194 194
 	/**
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return string
203 203
 	 */
204
-	public function set_number_padding( $serial_number ) {
205
-		if ( $number_padding = give_get_option( 'sequential-ordering_number_padding', 0 ) ) {
206
-			$serial_number = str_pad( $serial_number, $number_padding, '0', STR_PAD_LEFT );
204
+	public function set_number_padding($serial_number) {
205
+		if ($number_padding = give_get_option('sequential-ordering_number_padding', 0)) {
206
+			$serial_number = str_pad($serial_number, $number_padding, '0', STR_PAD_LEFT);
207 207
 		}
208 208
 
209 209
 		return $serial_number;
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function get_serial_code( $donation, $args = array() ) {
223
+	public function get_serial_code($donation, $args = array()) {
224 224
 		// Get id from object.
225
-		if( ! is_numeric( $donation ) ) {
226
-			if( $donation instanceof Give_Payment ) {
225
+		if ( ! is_numeric($donation)) {
226
+			if ($donation instanceof Give_Payment) {
227 227
 				$donation = $donation->ID;
228
-			} elseif ( $donation instanceof WP_Post ){
228
+			} elseif ($donation instanceof WP_Post) {
229 229
 				$donation = $donation->ID;
230 230
 			}
231 231
 		}
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 
242 242
 		$serial_code = $args['default'] ? $donation : '';
243 243
 
244
-		if ( $donation_number = $this->get_serial_number( $donation ) ) {
245
-			$serial_code = get_the_title( $donation );
244
+		if ($donation_number = $this->get_serial_number($donation)) {
245
+			$serial_code = get_the_title($donation);
246 246
 		}
247 247
 
248 248
 		$serial_code = $args['with_hash'] ? "#{$serial_code}" : $serial_code;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 * @param array $args
258 258
 		 * @param string $donation_number
259 259
 		 */
260
-		return apply_filters( 'give_get_donation_serial_code', $serial_code, $donation, $args, $donation_number );
260
+		return apply_filters('give_get_donation_serial_code', $serial_code, $donation, $args, $donation_number);
261 261
 	}
262 262
 
263 263
 	/**
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return string
272 272
 	 */
273
-	public function get_serial_number( $donation_id_or_serial_code ) {
274
-		if ( is_numeric( $donation_id_or_serial_code ) ) {
275
-			return Give()->sequential_donation_db->get_column_by( 'id', 'payment_id', $donation_id_or_serial_code );
273
+	public function get_serial_number($donation_id_or_serial_code) {
274
+		if (is_numeric($donation_id_or_serial_code)) {
275
+			return Give()->sequential_donation_db->get_column_by('id', 'payment_id', $donation_id_or_serial_code);
276 276
 		}
277 277
 
278
-		return $this->get_serial_number( $this->get_donation_id( $donation_id_or_serial_code ) );
278
+		return $this->get_serial_number($this->get_donation_id($donation_id_or_serial_code));
279 279
 	}
280 280
 
281 281
 
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string
291 291
 	 */
292
-	public function get_donation_id( $donation_number_or_serial_code ) {
292
+	public function get_donation_id($donation_number_or_serial_code) {
293 293
 		global $wpdb;
294 294
 
295
-		if ( is_numeric( $donation_number_or_serial_code ) ) {
295
+		if (is_numeric($donation_number_or_serial_code)) {
296 296
 			return Give()->sequential_donation_db->get_column_by(
297 297
 				'payment_id',
298 298
 				'id',
@@ -377,12 +377,11 @@  discard block
 block discarded – undo
377 377
 		$donation_id = $this->get_max_donation_id();
378 378
 		$next_number = $this->get_max_number();
379 379
 
380
-		if ( ! $this->get_serial_number( $donation_id ) ) {
381
-			$next_number = $donation_id && ( $next_number < $donation_id ) ?
382
-				$donation_id :
383
-				$this->get_max_number();
380
+		if ( ! $this->get_serial_number($donation_id)) {
381
+			$next_number = $donation_id && ($next_number < $donation_id) ?
382
+				$donation_id : $this->get_max_number();
384 383
 		}
385 384
 
386
-		return ( $next_number + 1 );
385
+		return ($next_number + 1);
387 386
 	}
388 387
 }
Please login to merge, or discard this patch.
includes/payments/class-payment-stats.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @param  $end_date   string|bool  The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
37 37
 	 * @param  $status     string|array The sale status(es) to count. Only valid when retrieving global stats
38 38
 	 *
39
-	 * @return float|int                Total amount of donations based on the passed arguments.
39
+	 * @return string                Total amount of donations based on the passed arguments.
40 40
 	 */
41 41
 	public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) {
42 42
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param  $end_date    string|bool The end date for which we'd like to filter the donations stats. If false, method will use the default end date of `this_month`.
85 85
 	 * @param  $gateway_id  string|bool The gateway to get earnings for such as 'paypal' or 'stripe'.
86 86
 	 *
87
-	 * @return float|int                Total amount of donations based on the passed arguments.
87
+	 * @return string                Total amount of donations based on the passed arguments.
88 88
 	 */
89 89
 	public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
90 90
 		global $wpdb;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param  $end_date    string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
208 208
 	 * @param  $gateway_id  string|bool The gateway to get earnings for such as 'paypal' or 'stripe'
209 209
 	 *
210
-	 * @return float|int                Total amount of donations based on the passed arguments.
210
+	 * @return string                Total amount of donations based on the passed arguments.
211 211
 	 */
212 212
 	public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
213 213
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return float|int                Total amount of donations based on the passed arguments.
40 40
 	 */
41
-	public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) {
41
+	public function get_sales($form_id = 0, $start_date = false, $end_date = false, $status = 'publish') {
42 42
 
43
-		$this->setup_dates( $start_date, $end_date );
43
+		$this->setup_dates($start_date, $end_date);
44 44
 
45 45
 		// Make sure start date is valid
46
-		if ( is_wp_error( $this->start_date ) ) {
46
+		if (is_wp_error($this->start_date)) {
47 47
 			return $this->start_date;
48 48
 		}
49 49
 
50 50
 		// Make sure end date is valid
51
-		if ( is_wp_error( $this->end_date ) ) {
51
+		if (is_wp_error($this->end_date)) {
52 52
 			return $this->end_date;
53 53
 		}
54 54
 
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 			'start_date' => $this->start_date,
58 58
 			'end_date'   => $this->end_date,
59 59
 			'fields'     => 'ids',
60
-			'number'     => - 1,
60
+			'number'     => -1,
61 61
 			'output'     => ''
62 62
 		);
63 63
 
64
-		if ( ! empty( $form_id ) ) {
64
+		if ( ! empty($form_id)) {
65 65
 			$args['give_forms'] = $form_id;
66 66
 		}
67 67
 
68 68
 		/* @var Give_Payments_Query $payments */
69
-		$payments = new Give_Payments_Query( $args );
69
+		$payments = new Give_Payments_Query($args);
70 70
 		$payments = $payments->get_payments();
71 71
 
72
-		return count( $payments );
72
+		return count($payments);
73 73
 	}
74 74
 
75 75
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return float|int                Total amount of donations based on the passed arguments.
88 88
 	 */
89
-	public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
89
+	public function get_earnings($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) {
90 90
 		global $wpdb;
91
-		$this->setup_dates( $start_date, $end_date );
91
+		$this->setup_dates($start_date, $end_date);
92 92
 
93 93
 		// Make sure start date is valid
94
-		if ( is_wp_error( $this->start_date ) ) {
94
+		if (is_wp_error($this->start_date)) {
95 95
 			return $this->start_date;
96 96
 		}
97 97
 
98 98
 		// Make sure end date is valid
99
-		if ( is_wp_error( $this->end_date ) ) {
99
+		if (is_wp_error($this->end_date)) {
100 100
 			return $this->end_date;
101 101
 		}
102 102
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 			'start_date' => $this->start_date,
107 107
 			'end_date'   => $this->end_date,
108 108
 			'fields'     => 'ids',
109
-			'number'     => - 1,
109
+			'number'     => -1,
110 110
 			'output'     => '',
111 111
 		);
112 112
 
113 113
 
114 114
 		// Filter by Gateway ID meta_key
115
-		if ( $gateway_id ) {
115
+		if ($gateway_id) {
116 116
 			$args['meta_query'][] = array(
117 117
 				'key'   => '_give_payment_gateway',
118 118
 				'value' => $gateway_id,
@@ -120,40 +120,40 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 
122 122
 		// Filter by Gateway ID meta_key
123
-		if ( $form_id ) {
123
+		if ($form_id) {
124 124
 			$args['meta_query'][] = array(
125 125
 				'key'   => '_give_payment_form_id',
126 126
 				'value' => $form_id,
127 127
 			);
128 128
 		}
129 129
 
130
-		if ( ! empty( $args['meta_query'] ) && 1 < count( $args['meta_query'] ) ) {
130
+		if ( ! empty($args['meta_query']) && 1 < count($args['meta_query'])) {
131 131
 			$args['meta_query']['relation'] = 'AND';
132 132
 		}
133 133
 
134
-		$args = apply_filters( 'give_stats_earnings_args', $args );
135
-		$key  = Give_Cache::get_key( 'give_stats', $args );
134
+		$args = apply_filters('give_stats_earnings_args', $args);
135
+		$key  = Give_Cache::get_key('give_stats', $args);
136 136
 
137 137
 		// Set transient for faster stats.
138
-		$earnings = Give_Cache::get( $key );
138
+		$earnings = Give_Cache::get($key);
139 139
 
140
-		if ( false === $earnings ) {
140
+		if (false === $earnings) {
141 141
 
142 142
 			$this->timestamp = false;
143
-			$payments        = new Give_Payments_Query( $args );
143
+			$payments        = new Give_Payments_Query($args);
144 144
 			$payments        = $payments->get_payments();
145 145
 			$earnings        = 0;
146 146
 
147
-			if ( ! empty( $payments ) ) {
147
+			if ( ! empty($payments)) {
148 148
 				$query = "SELECT payment_id as id, meta_value as total
149 149
 					FROM {$wpdb->paymentmeta}
150 150
 					WHERE meta_key='_give_payment_total'
151
-					AND payment_id IN ('". implode( '\',\'', $payments ) ."')";
151
+					AND payment_id IN ('".implode('\',\'', $payments)."')";
152 152
 
153 153
 				$payments = $wpdb->get_results($query, ARRAY_A);
154 154
 
155
-				if( ! empty( $payments ) ) {
156
-					foreach ( $payments as $payment ) {
155
+				if ( ! empty($payments)) {
156
+					foreach ($payments as $payment) {
157 157
 						/**
158 158
 						 * Filter the donation amount
159 159
 						 * Note: this filter documented in payments/functions.php:give_donation_amount()
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 						 */
163 163
 						$formatted_amount = apply_filters(
164 164
 							'give_donation_amount',
165
-							give_format_amount(  $payment['total'], array( 'donation_id' =>  $payment['id'] ) ),
165
+							give_format_amount($payment['total'], array('donation_id' =>  $payment['id'])),
166 166
 							$payment['total'],
167 167
 							$payment['id'],
168
-							array( 'type' => 'stats', 'currency'=> false, 'amount' => false )
168
+							array('type' => 'stats', 'currency'=> false, 'amount' => false)
169 169
 						);
170 170
 
171
-						$earnings += (float) give_maybe_sanitize_amount( $formatted_amount );
171
+						$earnings += (float) give_maybe_sanitize_amount($formatted_amount);
172 172
 					}
173 173
 				}
174 174
 
175 175
 			}
176 176
 
177 177
 			// Cache the results for one hour.
178
-			Give_Cache::set( $key, give_sanitize_amount_for_db( $earnings ), 60 * 60 );
178
+			Give_Cache::set($key, give_sanitize_amount_for_db($earnings), 60 * 60);
179 179
 		}
180 180
 
181 181
 		/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 		 * @param  string|bool $end_date   Earning end date.
190 190
 		 * @param  string|bool $gateway_id Payment gateway id.
191 191
 		 */
192
-		$earnings = apply_filters( 'give_get_earnings', $earnings, $form_id, $start_date, $end_date, $gateway_id );
192
+		$earnings = apply_filters('give_get_earnings', $earnings, $form_id, $start_date, $end_date, $gateway_id);
193 193
 
194 194
 		//return earnings
195
-		return round( $earnings, give_get_price_decimals( $form_id ) );
195
+		return round($earnings, give_get_price_decimals($form_id));
196 196
 
197 197
 	}
198 198
 
@@ -209,17 +209,17 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return float|int                Total amount of donations based on the passed arguments.
211 211
 	 */
212
-	public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
212
+	public function get_earnings_cache_key($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) {
213 213
 
214
-		$this->setup_dates( $start_date, $end_date );
214
+		$this->setup_dates($start_date, $end_date);
215 215
 
216 216
 		// Make sure start date is valid
217
-		if ( is_wp_error( $this->start_date ) ) {
217
+		if (is_wp_error($this->start_date)) {
218 218
 			return $this->start_date;
219 219
 		}
220 220
 
221 221
 		// Make sure end date is valid
222
-		if ( is_wp_error( $this->end_date ) ) {
222
+		if (is_wp_error($this->end_date)) {
223 223
 			return $this->end_date;
224 224
 		}
225 225
 
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 			'start_date' => $this->start_date,
230 230
 			'end_date'   => $this->end_date,
231 231
 			'fields'     => 'ids',
232
-			'number'     => - 1,
232
+			'number'     => -1,
233 233
 		);
234 234
 
235 235
 
236 236
 		// Filter by Gateway ID meta_key
237
-		if ( $gateway_id ) {
237
+		if ($gateway_id) {
238 238
 			$args['meta_query'][] = array(
239 239
 				'key'   => '_give_payment_gateway',
240 240
 				'value' => $gateway_id,
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
 		}
243 243
 
244 244
 		// Filter by Gateway ID meta_key
245
-		if ( $form_id ) {
245
+		if ($form_id) {
246 246
 			$args['meta_query'][] = array(
247 247
 				'key'   => '_give_payment_form_id',
248 248
 				'value' => $form_id,
249 249
 			);
250 250
 		}
251 251
 
252
-		if ( ! empty( $args['meta_query'] ) && 1 < count( $args['meta_query'] ) ) {
252
+		if ( ! empty($args['meta_query']) && 1 < count($args['meta_query'])) {
253 253
 			$args['meta_query']['relation'] = 'AND';
254 254
 		}
255 255
 
256
-		$args = apply_filters( 'give_stats_earnings_args', $args );
257
-		$key  = Give_Cache::get_key( 'give_stats', $args );
256
+		$args = apply_filters('give_stats_earnings_args', $args);
257
+		$key  = Give_Cache::get_key('give_stats', $args);
258 258
 
259 259
 		//return earnings
260 260
 		return $key;
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return array       Best selling forms
274 274
 	 */
275
-	public function get_best_selling( $number = 10 ) {
275
+	public function get_best_selling($number = 10) {
276 276
 		global $wpdb;
277 277
 
278
-		$meta_table = __give_v20_bc_table_details( 'form' );
278
+		$meta_table = __give_v20_bc_table_details('form');
279 279
 
280
-		$give_forms = $wpdb->get_results( $wpdb->prepare(
280
+		$give_forms = $wpdb->get_results($wpdb->prepare(
281 281
 			"SELECT {$meta_table['column']['id']} as form_id, max(meta_value) as sales
282 282
 				FROM {$meta_table['name']} WHERE meta_key='_give_form_sales' AND meta_value > 0
283 283
 				GROUP BY meta_value+0
284 284
 				DESC LIMIT %d;", $number
285
-		) );
285
+		));
286 286
 
287 287
 		return $give_forms;
288 288
 	}
Please login to merge, or discard this patch.