Test Failed
Push — master ( bb0b3f...21ce85 )
by Devin
06:53 queued 01:10
created
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, false );
171
+				if ( ! $user_id) {
172
+					update_option(self::get_banner_user_meta_key($banner_addon_name), $this->user_id, false);
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, false );
861
+	$options[$key] = $value;
862
+	$did_update      = update_option('give_settings', $options, false);
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, false );
901
+	$did_update = update_option('give_settings', $options, false);
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   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
 	global $wpdb;
17 17
 	$post_type = 'give_payment';
18 18
 	$responses = array();
19
-	$donationmeta_table_key = Give()->payment_meta->get_meta_type() . '_id';
19
+	$donationmeta_table_key = Give()->payment_meta->get_meta_type().'_id';
20 20
 
21
-	$form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : '';
21
+	$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : '';
22 22
 
23
-	if ( empty( $form_id ) ) {
23
+	if (empty($form_id)) {
24 24
 		return false;
25 25
 	}
26 26
 
27
-	$args          = array(
28
-		'give_forms'     => array( $form_id ),
29
-		'posts_per_page' => - 1,
27
+	$args = array(
28
+		'give_forms'     => array($form_id),
29
+		'posts_per_page' => -1,
30 30
 		'fields'         => 'ids',
31 31
 	);
32
-	$donation_list = implode( ',', (array) give_get_payments( $args ) );
32
+	$donation_list = implode(',', (array) give_get_payments($args));
33 33
 
34 34
 	$query_and = sprintf(
35 35
 		"AND $wpdb->posts.ID IN (%s) 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
         LEFT JOIN $wpdb->donationmeta 
45 45
         ON $wpdb->posts.ID = {$wpdb->donationmeta}.{$donationmeta_table_key}
46 46
         WHERE $wpdb->posts.post_type = '%s'
47
-    " . $query_and;
47
+    ".$query_and;
48 48
 
49
-	$meta_keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
49
+	$meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
50 50
 
51
-	if ( ! empty( $meta_keys ) ) {
52
-		$responses['standard_fields'] = array_values( $meta_keys );
51
+	if ( ! empty($meta_keys)) {
52
+		$responses['standard_fields'] = array_values($meta_keys);
53 53
 	}
54 54
 
55 55
 	$query_and = sprintf(
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
         LEFT JOIN $wpdb->donationmeta 
66 66
         ON $wpdb->posts.ID = {$wpdb->donationmeta}.{$donationmeta_table_key} 
67 67
         WHERE $wpdb->posts.post_type = '%s'
68
-    " . $query_and;
68
+    ".$query_and;
69 69
 
70
-	$hidden_meta_keys   = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
70
+	$hidden_meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
71 71
 
72 72
 	/**
73 73
 	 * Filter to modify hidden keys that are going to be ignore when displaying the hidden keys
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return array $ignore_hidden_keys Hidden keys that are going to be ignore
81 81
 	 */
82
-	$ignore_hidden_keys = apply_filters( 'give_export_donations_ignore_hidden_keys', array(
82
+	$ignore_hidden_keys = apply_filters('give_export_donations_ignore_hidden_keys', array(
83 83
 		'_give_payment_meta',
84 84
 		'_give_payment_gateway',
85 85
 		'_give_payment_mode',
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	);
115 115
 
116 116
 	// Unset ignored hidden keys.
117
-	foreach ( $ignore_hidden_keys as $key ) {
118
-		if ( ( $key = array_search( $key, $hidden_meta_keys ) ) !== false ) {
119
-			unset( $hidden_meta_keys[ $key ] );
117
+	foreach ($ignore_hidden_keys as $key) {
118
+		if (($key = array_search($key, $hidden_meta_keys)) !== false) {
119
+			unset($hidden_meta_keys[$key]);
120 120
 		}
121 121
 	}
122 122
 
123
-	if ( ! empty( $hidden_meta_keys ) ) {
124
-		$responses['hidden_fields'] = array_values( $hidden_meta_keys );
123
+	if ( ! empty($hidden_meta_keys)) {
124
+		$responses['hidden_fields'] = array_values($hidden_meta_keys);
125 125
 	}
126 126
 
127 127
 	/**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return array $responses
136 136
 	 */
137
-	wp_send_json( (array) apply_filters( 'give_export_donations_get_custom_fields', $responses, $form_id ) );
137
+	wp_send_json((array) apply_filters('give_export_donations_get_custom_fields', $responses, $form_id));
138 138
 
139 139
 }
140 140
 
141
-add_action( 'wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields' );
141
+add_action('wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields');
142 142
 
143 143
 /**
144 144
  * Register the payments batch exporter
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
  * @since  1.0
147 147
  */
148 148
 function give_register_export_donations_batch_export() {
149
-	add_action( 'give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1 );
149
+	add_action('give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1);
150 150
 }
151 151
 
152
-add_action( 'give_register_batch_exporter', 'give_register_export_donations_batch_export', 10 );
152
+add_action('give_register_batch_exporter', 'give_register_export_donations_batch_export', 10);
153 153
 
154 154
 
155 155
 /**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
  *
158 158
  * @param $class Give_Export_Donations_CSV
159 159
  */
160
-function give_export_donations_include_export_class( $class ) {
161
-	if ( 'Give_Export_Donations_CSV' === $class ) {
162
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-exporter.php';
160
+function give_export_donations_include_export_class($class) {
161
+	if ('Give_Export_Donations_CSV' === $class) {
162
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-exporter.php';
163 163
 	}
164 164
 }
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @return string
173 173
  */
174
-function give_export_donations_create_column_key( $string ) {
175
-	return sanitize_key( str_replace( ' ', '_', $string ) );
174
+function give_export_donations_create_column_key($string) {
175
+	return sanitize_key(str_replace(' ', '_', $string));
176 176
 }
177 177
 
178 178
 /**
@@ -184,23 +184,23 @@  discard block
 block discarded – undo
184 184
  *
185 185
  * @return array
186 186
  */
187
-function give_export_donation_form_search_args( $args ) {
188
-	if ( empty( $_POST['fields'] ) ) {
187
+function give_export_donation_form_search_args($args) {
188
+	if (empty($_POST['fields'])) {
189 189
 		return $args;
190 190
 	}
191 191
 
192
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
193
-	parse_str( $fields );
192
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
193
+	parse_str($fields);
194 194
 
195
-	if ( ! empty( $give_forms_categories ) || ! empty( $give_forms_tags ) ) {
195
+	if ( ! empty($give_forms_categories) || ! empty($give_forms_tags)) {
196 196
 		$args['posts_per_page'] = -1;
197 197
 	}
198 198
 
199
-	if ( ! empty( $give_forms_categories ) && ! empty( $give_forms_tags ) ) {
199
+	if ( ! empty($give_forms_categories) && ! empty($give_forms_tags)) {
200 200
 		$args['tax_query']['relation'] = 'AND';
201 201
 	}
202 202
 
203
-	if ( ! empty( $give_forms_categories ) ) {
203
+	if ( ! empty($give_forms_categories)) {
204 204
 		$args['tax_query'][] = array(
205 205
 			'taxonomy' => 'give_forms_category',
206 206
 			'field'    => 'term_id',
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		);
210 210
 	}
211 211
 
212
-	if ( ! empty( $give_forms_tags ) ) {
212
+	if ( ! empty($give_forms_tags)) {
213 213
 		$args['tax_query'][] = array(
214 214
 			'taxonomy' => 'give_forms_tag',
215 215
 			'field'    => 'term_id',
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	return $args;
222 222
 }
223 223
 
224
-add_filter( 'give_ajax_form_search_args', 'give_export_donation_form_search_args' );
224
+add_filter('give_ajax_form_search_args', 'give_export_donation_form_search_args');
225 225
 
226 226
 /**
227 227
  * Add Donation standard fields in export donation page
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	?>
233 233
 	<tr>
234 234
 		<td scope="row" class="row-title">
235
-			<label><?php _e( 'Standard Columns:', 'give' ); ?></label>
235
+			<label><?php _e('Standard Columns:', 'give'); ?></label>
236 236
 		</td>
237 237
 		<td>
238 238
 			<div class="give-clearfix">
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 							<li class="give-export-option-label give-export-option-donation-label">
244 244
 								<span>
245
-									<?php _e( 'Donation Payment Fields', 'give' ); ?>
245
+									<?php _e('Donation Payment Fields', 'give'); ?>
246 246
 								</span>
247 247
 							</li>
248 248
 
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 								<label for="give-export-donation-id">
251 251
 									<input type="checkbox" checked
252 252
 									       name="give_give_donations_export_option[donation_id]"
253
-									       id="give-export-donation-id"><?php _e( 'Donation ID', 'give' ); ?>
253
+									       id="give-export-donation-id"><?php _e('Donation ID', 'give'); ?>
254 254
 								</label>
255 255
 							</li>
256 256
 
257 257
 							<?php
258
-							if ( give_is_setting_enabled( give_get_option( 'sequential-ordering_status', 'disabled' ) ) ) {
258
+							if (give_is_setting_enabled(give_get_option('sequential-ordering_status', 'disabled'))) {
259 259
 								?>
260 260
 								<li>
261 261
 									<label for="give-export-seq-id">
262 262
 										<input type="checkbox" checked
263 263
 										       name="give_give_donations_export_option[seq_id]"
264
-										       id="give-export-seq-id"><?php _e( 'Donation Number', 'give' ); ?>
264
+										       id="give-export-seq-id"><?php _e('Donation Number', 'give'); ?>
265 265
 									</label>
266 266
 								</li>
267 267
 								<?php
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 								<label for="give-export-donation-sum">
273 273
 									<input type="checkbox" checked
274 274
 									       name="give_give_donations_export_option[donation_total]"
275
-									       id="give-export-donation-sum"><?php _e( 'Donation Total', 'give' ); ?>
275
+									       id="give-export-donation-sum"><?php _e('Donation Total', 'give'); ?>
276 276
 								</label>
277 277
 							</li>
278 278
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 								<label for="give-export-donation-currency_code">
281 281
 									<input type="checkbox" checked
282 282
 									       name="give_give_donations_export_option[currency_code]"
283
-									       id="give-export-donation-currency_code"><?php _e( 'Currency Code', 'give' ); ?>
283
+									       id="give-export-donation-currency_code"><?php _e('Currency Code', 'give'); ?>
284 284
 								</label>
285 285
 							</li>
286 286
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 								<label for="give-export-donation-currency_symbol">
289 289
 									<input type="checkbox" checked
290 290
 									       name="give_give_donations_export_option[currency_symbol]"
291
-									       id="give-export-donation-currency_symbol"><?php _e( 'Currency Symbol', 'give' ); ?>
291
+									       id="give-export-donation-currency_symbol"><?php _e('Currency Symbol', 'give'); ?>
292 292
 								</label>
293 293
 							</li>
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 								<label for="give-export-donation-status">
297 297
 									<input type="checkbox" checked
298 298
 									       name="give_give_donations_export_option[donation_status]"
299
-									       id="give-export-donation-status"><?php _e( 'Donation Status', 'give' ); ?>
299
+									       id="give-export-donation-status"><?php _e('Donation Status', 'give'); ?>
300 300
 								</label>
301 301
 							</li>
302 302
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 								<label for="give-export-donation-date">
305 305
 									<input type="checkbox" checked
306 306
 									       name="give_give_donations_export_option[donation_date]"
307
-									       id="give-export-donation-date"><?php _e( 'Donation Date', 'give' ); ?>
307
+									       id="give-export-donation-date"><?php _e('Donation Date', 'give'); ?>
308 308
 								</label>
309 309
 							</li>
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 								<label for="give-export-donation-time">
313 313
 									<input type="checkbox" checked
314 314
 									       name="give_give_donations_export_option[donation_time]"
315
-									       id="give-export-donation-time"><?php _e( 'Donation Time', 'give' ); ?>
315
+									       id="give-export-donation-time"><?php _e('Donation Time', 'give'); ?>
316 316
 								</label>
317 317
 							</li>
318 318
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 								<label for="give-export-payment-gateway">
321 321
 									<input type="checkbox" checked
322 322
 									       name="give_give_donations_export_option[payment_gateway]"
323
-									       id="give-export-payment-gateway"><?php _e( 'Payment Gateway', 'give' ); ?>
323
+									       id="give-export-payment-gateway"><?php _e('Payment Gateway', 'give'); ?>
324 324
 								</label>
325 325
 							</li>
326 326
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 								<label for="give-export-payment-mode">
329 329
 									<input type="checkbox" checked
330 330
 									       name="give_give_donations_export_option[payment_mode]"
331
-									       id="give-export-payment-mode"><?php _e( 'Payment Mode', 'give' ); ?>
331
+									       id="give-export-payment-mode"><?php _e('Payment Mode', 'give'); ?>
332 332
 								</label>
333 333
 							</li>
334 334
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 							 *
339 339
 							 * @since 2.1
340 340
 							 */
341
-							do_action( 'give_export_donation_standard_payment_fields' );
341
+							do_action('give_export_donation_standard_payment_fields');
342 342
 							?>
343 343
 						</ul>
344 344
 					</li>
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 							<li class="give-export-option-label give-export-option-Form-label">
350 350
 								<span>
351
-									<?php _e( 'Donation Form Fields', 'give' ); ?>
351
+									<?php _e('Donation Form Fields', 'give'); ?>
352 352
 								</span>
353 353
 							</li>
354 354
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 								<label for="give-export-donation-form-id">
358 358
 									<input type="checkbox" checked
359 359
 									       name="give_give_donations_export_option[form_id]"
360
-									       id="give-export-donation-form-id"><?php _e( 'Donation Form ID', 'give' ); ?>
360
+									       id="give-export-donation-form-id"><?php _e('Donation Form ID', 'give'); ?>
361 361
 								</label>
362 362
 							</li>
363 363
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 								<label for="give-export-donation-form-title">
366 366
 									<input type="checkbox" checked
367 367
 									       name="give_give_donations_export_option[form_title]"
368
-									       id="give-export-donation-form-title"><?php _e( 'Donation Form Title', 'give' ); ?>
368
+									       id="give-export-donation-form-title"><?php _e('Donation Form Title', 'give'); ?>
369 369
 								</label>
370 370
 							</li>
371 371
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 								<label for="give-export-donation-form-level-id">
374 374
 									<input type="checkbox" checked
375 375
 									       name="give_give_donations_export_option[form_level_id]"
376
-									       id="give-export-donation-form-level-id"><?php _e( 'Donation Form Level ID', 'give' ); ?>
376
+									       id="give-export-donation-form-level-id"><?php _e('Donation Form Level ID', 'give'); ?>
377 377
 								</label>
378 378
 							</li>
379 379
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 								<label for="give-export-donation-form-level-title">
382 382
 									<input type="checkbox" checked
383 383
 									       name="give_give_donations_export_option[form_level_title]"
384
-									       id="give-export-donation-form-level-title"><?php _e( 'Donation Form Level Title', 'give' ); ?>
384
+									       id="give-export-donation-form-level-title"><?php _e('Donation Form Level Title', 'give'); ?>
385 385
 								</label>
386 386
 							</li>
387 387
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 							 *
392 392
 							 * @since 2.1
393 393
 							 */
394
-							do_action( 'give_export_donation_standard_form_fields' );
394
+							do_action('give_export_donation_standard_form_fields');
395 395
 							?>
396 396
 						</ul>
397 397
 					</li>
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 							<li class="give-export-option-label give-export-option-donor-label">
403 403
 								<span>
404
-									<?php _e( 'Donor Fields', 'give' ); ?>
404
+									<?php _e('Donor Fields', 'give'); ?>
405 405
 								</span>
406 406
 							</li>
407 407
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 								<label for="give-export-title-prefix">
410 410
 									<input type="checkbox" checked
411 411
 											name="give_give_donations_export_option[title_prefix]"
412
-											id="give-export-title-prefix"><?php esc_html_e( 'Donor\'s Title Prefix', 'give' ); ?>
412
+											id="give-export-title-prefix"><?php esc_html_e('Donor\'s Title Prefix', 'give'); ?>
413 413
 								</label>
414 414
 							</li>
415 415
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 								<label for="give-export-first-name">
418 418
 									<input type="checkbox" checked
419 419
 									       name="give_give_donations_export_option[first_name]"
420
-									       id="give-export-first-name"><?php _e( 'Donor\'s First Name', 'give' ); ?>
420
+									       id="give-export-first-name"><?php _e('Donor\'s First Name', 'give'); ?>
421 421
 								</label>
422 422
 							</li>
423 423
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 								<label for="give-export-last-name">
426 426
 									<input type="checkbox" checked
427 427
 									       name="give_give_donations_export_option[last_name]"
428
-									       id="give-export-last-name"><?php _e( 'Donor\'s Last Name', 'give' ); ?>
428
+									       id="give-export-last-name"><?php _e('Donor\'s Last Name', 'give'); ?>
429 429
 								</label>
430 430
 							</li>
431 431
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 								<label for="give-export-email">
434 434
 									<input type="checkbox" checked
435 435
 									       name="give_give_donations_export_option[email]"
436
-									       id="give-export-email"><?php _e( 'Donor\'s Email', 'give' ); ?>
436
+									       id="give-export-email"><?php _e('Donor\'s Email', 'give'); ?>
437 437
 								</label>
438 438
 							</li>
439 439
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 								<label for="give-export-company">
442 442
 									<input type="checkbox" checked
443 443
 									       name="give_give_donations_export_option[company]"
444
-									       id="give-export-company"><?php _e( 'Company Name', 'give' ); ?>
444
+									       id="give-export-company"><?php _e('Company Name', 'give'); ?>
445 445
 								</label>
446 446
 							</li>
447 447
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 								<label for="give-export-address">
450 450
 									<input type="checkbox" checked
451 451
 									       name="give_give_donations_export_option[address]"
452
-									       id="give-export-address"><?php _e( 'Donor\'s Billing Address', 'give' ); ?>
452
+									       id="give-export-address"><?php _e('Donor\'s Billing Address', 'give'); ?>
453 453
 								</label>
454 454
 							</li>
455 455
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 								<label for="give-export-userid">
458 458
 									<input type="checkbox" checked
459 459
 									       name="give_give_donations_export_option[userid]"
460
-									       id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
460
+									       id="give-export-userid"><?php _e('User ID', 'give'); ?>
461 461
 								</label>
462 462
 							</li>
463 463
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 								<label for="give-export-donorid">
466 466
 									<input type="checkbox" checked
467 467
 									       name="give_give_donations_export_option[donorid]"
468
-									       id="give-export-donorid"><?php _e( 'Donor ID', 'give' ); ?>
468
+									       id="give-export-donorid"><?php _e('Donor ID', 'give'); ?>
469 469
 								</label>
470 470
 							</li>
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 								<label for="give-export-donor-ip">
474 474
 									<input type="checkbox" checked
475 475
 									       name="give_give_donations_export_option[donor_ip]"
476
-									       id="give-export-donor-ip"><?php _e( 'Donor IP Address', 'give' ); ?>
476
+									       id="give-export-donor-ip"><?php _e('Donor IP Address', 'give'); ?>
477 477
 								</label>
478 478
 							</li>
479 479
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 							 *
484 484
 							 * @since 2.1
485 485
 							 */
486
-							do_action( 'give_export_donation_standard_donor_fields' );
486
+							do_action('give_export_donation_standard_donor_fields');
487 487
 							?>
488 488
 						</ul>
489 489
 					</li>
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					 *
495 495
 					 * @since 2.1.4
496 496
 					 */
497
-					do_action( 'give_export_donation_add_custom_column' );
497
+					do_action('give_export_donation_add_custom_column');
498 498
 					?>
499 499
 				</ul>
500 500
 			</div>
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	<?php
504 504
 }
505 505
 
506
-add_action( 'give_export_donation_fields', 'give_export_donation_standard_fields', 10 );
506
+add_action('give_export_donation_fields', 'give_export_donation_standard_fields', 10);
507 507
 
508 508
 /**
509 509
  * Add Donation Custom fields in export donation page
@@ -515,19 +515,19 @@  discard block
 block discarded – undo
515 515
 	<tr
516 516
 		class="give-hidden give-export-donations-hide give-export-donations-standard-fields">
517 517
 		<td scope="row" class="row-title">
518
-			<label><?php _e( 'Custom Field Columns:', 'give' ); ?></label>
518
+			<label><?php _e('Custom Field Columns:', 'give'); ?></label>
519 519
 		</td>
520 520
 		<td class="give-field-wrap">
521 521
 			<div class="give-clearfix">
522 522
 				<ul class="give-export-option-ul"></ul>
523
-				<p class="give-field-description"><?php _e( 'The following fields may have been created by custom code, or another plugin.', 'give' ); ?></p>
523
+				<p class="give-field-description"><?php _e('The following fields may have been created by custom code, or another plugin.', 'give'); ?></p>
524 524
 			</div>
525 525
 		</td>
526 526
 	</tr>
527 527
 	<?php
528 528
 }
529 529
 
530
-add_action( 'give_export_donation_fields', 'give_export_donation_custom_fields', 30 );
530
+add_action('give_export_donation_fields', 'give_export_donation_custom_fields', 30);
531 531
 
532 532
 
533 533
 /**
@@ -540,17 +540,17 @@  discard block
 block discarded – undo
540 540
 
541 541
 	<tr class="give-hidden give-export-donations-hide give-export-donations-hidden-fields">
542 542
 		<td scope="row" class="row-title">
543
-			<label><?php _e( 'Hidden Custom Field Columns:', 'give' ); ?></label>
543
+			<label><?php _e('Hidden Custom Field Columns:', 'give'); ?></label>
544 544
 		</td>
545 545
 		<td class="give-field-wrap">
546 546
 			<div class="give-clearfix">
547 547
 				<ul class="give-export-option-ul"></ul>
548
-				<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>
548
+				<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>
549 549
 			</div>
550 550
 		</td>
551 551
 	</tr>
552 552
 	<?php
553 553
 }
554 554
 
555
-add_action( 'give_export_donation_fields', 'give_export_donation_hidden_fields', 40 );
555
+add_action('give_export_donation_fields', 'give_export_donation_hidden_fields', 40);
556 556
 
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/forms/template.php 3 patches
Doc Comments   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @since 1.0
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
  *
1483 1483
  * @param  int $form_id The form ID.
1484 1484
  *
1485
- * @return bool
1485
+ * @return false|null
1486 1486
  */
1487 1487
 function give_terms_agreement( $form_id ) {
1488 1488
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
  * @param  int   $form_id The form ID.
1677 1677
  * @param  array $args    An array of form arguments.
1678 1678
  *
1679
- * @return mixed
1679
+ * @return boolean
1680 1680
  */
1681 1681
 function give_show_goal_progress( $form_id, $args = array() ) {
1682 1682
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
  * @param  int $total      Total amount based on shortcode parameter.
1704 1704
  * @param  int $total_goal Total Goal amount passed by Admin.
1705 1705
  *
1706
- * @return mixed
1706
+ * @return boolean
1707 1707
  */
1708 1708
 function give_show_goal_totals_progress( $total, $total_goal ) {
1709 1709
 
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
  *
1728 1728
  * @since  1.8
1729 1729
  *
1730
- * @param  $form_id
1730
+ * @param  integer $form_id
1731 1731
  * @param  $args
1732 1732
  *
1733 1733
  * @return mixed|string
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
  * @param  int   $form_id The form ID.
1769 1769
  * @param  array $args    An array of form arguments.
1770 1770
  *
1771
- * @return void|bool
1771
+ * @return false|null
1772 1772
  */
1773 1773
 function give_form_content( $form_id, $args ) {
1774 1774
 
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
  *
2059 2059
  * @since 2.1
2060 2060
  *
2061
- * @return array
2061
+ * @return string[]
2062 2062
  */
2063 2063
 function add_class_for_form_grid( $class, $id, $args ) {
2064 2064
 	$class[] = 'give-form-grid-wrap';
@@ -2069,7 +2069,6 @@  discard block
 block discarded – undo
2069 2069
 /**
2070 2070
  * Add hidden field to Form Grid page
2071 2071
  *
2072
- * @param int              $form_id The form ID.
2073 2072
  * @param array            $args    An array of form arguments.
2074 2073
  * @param Give_Donate_Form $form    Form object.
2075 2074
  *
Please login to merge, or discard this patch.
Spacing   +475 added lines, -477 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 	static $count = 1;
30 30
 
31
-	$form_id = is_object( $post ) ? $post->ID : 0;
31
+	$form_id = is_object($post) ? $post->ID : 0;
32 32
 
33
-	if ( isset( $args['id'] ) ) {
33
+	if (isset($args['id'])) {
34 34
 		$form_id = $args['id'];
35 35
 	}
36 36
 
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 		)
41 41
 	);
42 42
 
43
-	$args = wp_parse_args( $args, $defaults );
43
+	$args = wp_parse_args($args, $defaults);
44 44
 
45
-	$form = new Give_Donate_Form( $args['form_id'] );
45
+	$form = new Give_Donate_Form($args['form_id']);
46 46
 
47 47
 	// Bail out, if no form ID.
48
-	if ( empty( $form->ID ) ) {
48
+	if (empty($form->ID)) {
49 49
 		return false;
50 50
 	}
51 51
 
52 52
 	$args['id_prefix'] = "{$form_id}-{$count}";
53
-	$payment_mode      = give_get_chosen_gateway( $form->ID );
53
+	$payment_mode      = give_get_chosen_gateway($form->ID);
54 54
 
55 55
 	$form_action = add_query_arg(
56 56
 		apply_filters(
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
 
64 64
 	// Sanity Check: Donation form not published or user doesn't have permission to view drafts.
65 65
 	if (
66
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
67
-		|| ( 'trash' === $form->post_status )
66
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
67
+		|| ('trash' === $form->post_status)
68 68
 	) {
69 69
 		return false;
70 70
 	}
71 71
 
72 72
 	// Get the form wrap CSS classes.
73
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
73
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
74 74
 
75 75
 	// Get the <form> tag wrap CSS classes.
76
-	$form_classes = $form->get_form_classes( $args );
76
+	$form_classes = $form->get_form_classes($args);
77 77
 
78 78
 	ob_start();
79 79
 
@@ -85,21 +85,21 @@  discard block
 block discarded – undo
85 85
 	 * @param int   $form_id The form ID.
86 86
 	 * @param array $args    An array of form arguments.
87 87
 	 */
88
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
88
+	do_action('give_pre_form_output', $form->ID, $args, $form);
89 89
 
90 90
 	?>
91 91
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
92 92
 		<?php
93
-		if ( $form->is_close_donation_form() ) {
93
+		if ($form->is_close_donation_form()) {
94 94
 
95
-			$form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : '';
95
+			$form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : '';
96 96
 
97 97
 			// Get Goal thank you message.
98
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
99
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : '';
98
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
99
+			$goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : '';
100 100
 
101 101
 			// Print thank you message.
102
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
102
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
103 103
 
104 104
 		} else {
105 105
 			/**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 			 * 1. if show_title params set to true
108 108
 			 * 2. if admin set form display_style to button
109 109
 			 */
110
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
110
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
111 111
 			if (
112 112
 				(
113
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
114
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
113
+					(isset($args['show_title']) && $args['show_title'] == true)
114
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
115 115
 				)
116
-				&& ! doing_action( 'give_single_form_summary' )
116
+				&& ! doing_action('give_single_form_summary')
117 117
 			) {
118 118
 				echo $form_title;
119 119
 			}
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 			 * @param array            $args    An array of form arguments.
128 128
 			 * @param Give_Donate_Form $form    Form object.
129 129
 			 */
130
-			do_action( 'give_pre_form', $form->ID, $args, $form );
130
+			do_action('give_pre_form', $form->ID, $args, $form);
131 131
 
132 132
 			// Set form html tags.
133 133
 			$form_html_tags = array(
134 134
 				'id'      => "give-form-{$args['id_prefix']}",
135 135
 				'class'   => $form_classes,
136
-				'action'  => esc_url_raw( $form_action ),
136
+				'action'  => esc_url_raw($form_action),
137 137
 				'data-id' => $args['id_prefix'],
138 138
 			);
139 139
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 			 * @param array            $form_html_tags Array of form html tags.
146 146
 			 * @param Give_Donate_Form $form           Form object.
147 147
 			 */
148
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
148
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
149 149
 			?>
150
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
150
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
151 151
 				<!-- The following field is for robots only, invisible to humans: -->
152 152
 				<span class="give-hidden" style="display: none !important;">
153 153
 					<label for="give-form-honeypot-<?php echo $form_id; ?>"></label>
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 				 * @param array            $args    An array of form arguments.
166 166
 				 * @param Give_Donate_Form $form    Form object.
167 167
 				 */
168
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
168
+				do_action('give_donation_form_top', $form->ID, $args, $form);
169 169
 
170 170
 				/**
171 171
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 				 * @param array            $args    An array of form arguments.
177 177
 				 * @param Give_Donate_Form $form    Form object.
178 178
 				 */
179
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
179
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
180 180
 
181 181
 				/**
182 182
 				 * Fires while outputting donation form, after all other fields.
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				 * @param array            $args    An array of form arguments.
188 188
 				 * @param Give_Donate_Form $form    Form object.
189 189
 				 */
190
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
190
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
191 191
 
192 192
 				?>
193 193
 			</form>
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 			 * @param array            $args    An array of form arguments.
203 203
 			 * @param Give_Donate_Form $form    Form object.
204 204
 			 */
205
-			do_action( 'give_post_form', $form->ID, $args, $form );
205
+			do_action('give_post_form', $form->ID, $args, $form);
206 206
 
207 207
 		}
208 208
 		?>
209 209
 
210
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
210
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
211 211
 	<?php
212 212
 
213 213
 	/**
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 * @param int   $form_id The form ID.
219 219
 	 * @param array $args    An array of form arguments.
220 220
 	 */
221
-	do_action( 'give_post_form_output', $form->ID, $args );
221
+	do_action('give_post_form_output', $form->ID, $args);
222 222
 
223 223
 	$final_output = ob_get_clean();
224
-	$count ++;
224
+	$count++;
225 225
 
226
-	echo apply_filters( 'give_donate_form', $final_output, $args );
226
+	echo apply_filters('give_donate_form', $final_output, $args);
227 227
 }
228 228
 
229 229
 /**
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return string
242 242
  */
243
-function give_show_purchase_form( $form_id, $args ) {
243
+function give_show_purchase_form($form_id, $args) {
244 244
 
245
-	$payment_mode = give_get_chosen_gateway( $form_id );
245
+	$payment_mode = give_get_chosen_gateway($form_id);
246 246
 
247
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
247
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
248 248
 		$form_id = $_POST['give_form_id'];
249 249
 	}
250 250
 
@@ -253,33 +253,33 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @since 1.7
255 255
 	 */
256
-	do_action( 'give_payment_fields_top', $form_id );
256
+	do_action('give_payment_fields_top', $form_id);
257 257
 
258
-	if ( give_can_checkout() && isset( $form_id ) ) {
258
+	if (give_can_checkout() && isset($form_id)) {
259 259
 
260 260
 		/**
261 261
 		 * Fires while displaying donation form, before registration login.
262 262
 		 *
263 263
 		 * @since 1.7
264 264
 		 */
265
-		do_action( 'give_donation_form_before_register_login', $form_id, $args );
265
+		do_action('give_donation_form_before_register_login', $form_id, $args);
266 266
 
267 267
 		/**
268 268
 		 * Fire when register/login form fields render.
269 269
 		 *
270 270
 		 * @since 1.7
271 271
 		 */
272
-		do_action( 'give_donation_form_register_login_fields', $form_id, $args );
272
+		do_action('give_donation_form_register_login_fields', $form_id, $args);
273 273
 
274 274
 		/**
275 275
 		 * Fire when credit card form fields render.
276 276
 		 *
277 277
 		 * @since 1.7
278 278
 		 */
279
-		do_action( 'give_donation_form_before_cc_form', $form_id, $args );
279
+		do_action('give_donation_form_before_cc_form', $form_id, $args);
280 280
 
281 281
 		// Load the credit card form and allow gateways to load their own if they wish.
282
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
282
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
283 283
 			/**
284 284
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
285 285
 			 *
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			 *
288 288
 			 * @param int $form_id The form ID.
289 289
 			 */
290
-			do_action( "give_{$payment_mode}_cc_form", $form_id, $args );
290
+			do_action("give_{$payment_mode}_cc_form", $form_id, $args);
291 291
 		} else {
292 292
 			/**
293 293
 			 * Fires while displaying donation form, credit card form fields.
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 			 *
297 297
 			 * @param int $form_id The form ID.
298 298
 			 */
299
-			do_action( 'give_cc_form', $form_id, $args );
299
+			do_action('give_cc_form', $form_id, $args);
300 300
 		}
301 301
 
302 302
 		/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		 *
305 305
 		 * @since 1.7
306 306
 		 */
307
-		do_action( 'give_donation_form_after_cc_form', $form_id, $args );
307
+		do_action('give_donation_form_after_cc_form', $form_id, $args);
308 308
 
309 309
 	} else {
310 310
 		/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		 *
313 313
 		 * @since 1.7
314 314
 		 */
315
-		do_action( 'give_donation_form_no_access', $form_id );
315
+		do_action('give_donation_form_no_access', $form_id);
316 316
 
317 317
 	}
318 318
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @since 1.7
323 323
 	 */
324
-	do_action( 'give_payment_fields_bottom', $form_id, $args );
324
+	do_action('give_payment_fields_bottom', $form_id, $args);
325 325
 }
326 326
 
327
-add_action( 'give_donation_form', 'give_show_purchase_form', 10, 2 );
327
+add_action('give_donation_form', 'give_show_purchase_form', 10, 2);
328 328
 
329 329
 /**
330 330
  * Give Show Login/Register Form Fields.
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
  *
336 336
  * @return void
337 337
  */
338
-function give_show_register_login_fields( $form_id ) {
338
+function give_show_register_login_fields($form_id) {
339 339
 
340
-	$show_register_form = give_show_login_register_option( $form_id );
340
+	$show_register_form = give_show_login_register_option($form_id);
341 341
 
342
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
342
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
343 343
 		?>
344 344
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
345 345
 			<?php
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 			 *
349 349
 			 * @since 1.7
350 350
 			 */
351
-			do_action( 'give_donation_form_register_fields', $form_id );
351
+			do_action('give_donation_form_register_fields', $form_id);
352 352
 			?>
353 353
 		</div>
354 354
 	<?php
355
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
355
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
356 356
 		?>
357 357
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
358 358
 			<?php
@@ -361,23 +361,23 @@  discard block
 block discarded – undo
361 361
 			 *
362 362
 			 * @since 1.7
363 363
 			 */
364
-			do_action( 'give_donation_form_login_fields', $form_id );
364
+			do_action('give_donation_form_login_fields', $form_id);
365 365
 			?>
366 366
 		</div>
367 367
 	<?php
368 368
 	endif;
369 369
 
370
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
370
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
371 371
 		/**
372 372
 		 * Fire when user info render.
373 373
 		 *
374 374
 		 * @since 1.7
375 375
 		 */
376
-		do_action( 'give_donation_form_after_user_info', $form_id );
376
+		do_action('give_donation_form_after_user_info', $form_id);
377 377
 	}
378 378
 }
379 379
 
380
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
380
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
381 381
 
382 382
 /**
383 383
  * Donation Amount Field.
@@ -392,21 +392,21 @@  discard block
 block discarded – undo
392 392
  *
393 393
  * @return void
394 394
  */
395
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
395
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
396 396
 
397 397
 	$give_options        = give_get_settings();
398
-	$variable_pricing    = give_has_variable_prices( $form_id );
399
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
400
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
401
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
402
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
398
+	$variable_pricing    = give_has_variable_prices($form_id);
399
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
400
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
401
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
402
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
403 403
 	$default_amount      = give_format_amount(
404
-		give_get_default_form_amount( $form_id ), array(
404
+		give_get_default_form_amount($form_id), array(
405 405
 			'sanitize' => false,
406
-			'currency' => give_get_currency( $form_id ),
406
+			'currency' => give_get_currency($form_id),
407 407
 		)
408 408
 	);
409
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
409
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
410 410
 
411 411
 	/**
412 412
 	 * Fires while displaying donation form, before donation level fields.
@@ -416,23 +416,23 @@  discard block
 block discarded – undo
416 416
 	 * @param int   $form_id The form ID.
417 417
 	 * @param array $args    An array of form arguments.
418 418
 	 */
419
-	do_action( 'give_before_donation_levels', $form_id, $args );
419
+	do_action('give_before_donation_levels', $form_id, $args);
420 420
 
421 421
 	// Set Price, No Custom Amount Allowed means hidden price field.
422
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
422
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
423 423
 		?>
424
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
424
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
425 425
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
426 426
 		       value="<?php echo $default_amount; ?>" required aria-required="true"/>
427 427
 		<div class="set-price give-donation-amount form-row-wide">
428 428
 			<?php
429
-			if ( 'before' === $currency_position ) {
429
+			if ('before' === $currency_position) {
430 430
 				echo $currency_output;
431 431
 			}
432 432
 			?>
433 433
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
434 434
 			<?php
435
-			if ( 'after' === $currency_position ) {
435
+			if ('after' === $currency_position) {
436 436
 				echo $currency_output;
437 437
 			}
438 438
 			?>
@@ -444,15 +444,15 @@  discard block
 block discarded – undo
444 444
 		<div class="give-total-wrap">
445 445
 			<div class="give-donation-amount form-row-wide">
446 446
 				<?php
447
-				if ( 'before' === $currency_position ) {
447
+				if ('before' === $currency_position) {
448 448
 					echo $currency_output;
449 449
 				}
450 450
 				?>
451
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
451
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
452 452
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
453 453
 				       placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
454 454
 				<?php
455
-				if ( 'after' === $currency_position ) {
455
+				if ('after' === $currency_position) {
456 456
 					echo $currency_output;
457 457
 				}
458 458
 				?>
@@ -469,18 +469,18 @@  discard block
 block discarded – undo
469 469
 	 * @param int   $form_id The form ID.
470 470
 	 * @param array $args    An array of form arguments.
471 471
 	 */
472
-	do_action( 'give_after_donation_amount', $form_id, $args );
472
+	do_action('give_after_donation_amount', $form_id, $args);
473 473
 
474 474
 	// Custom Amount Text
475
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) {
475
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) {
476 476
 		?>
477 477
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
478 478
 		<?php
479 479
 	}
480 480
 
481 481
 	// Output Variable Pricing Levels.
482
-	if ( $variable_pricing ) {
483
-		give_output_levels( $form_id );
482
+	if ($variable_pricing) {
483
+		give_output_levels($form_id);
484 484
 	}
485 485
 
486 486
 	/**
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	 * @param int   $form_id The form ID.
492 492
 	 * @param array $args    An array of form arguments.
493 493
 	 */
494
-	do_action( 'give_after_donation_levels', $form_id, $args );
494
+	do_action('give_after_donation_levels', $form_id, $args);
495 495
 }
496 496
 
497
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
497
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
498 498
 
499 499
 /**
500 500
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
  *
506 506
  * @return string Donation levels.
507 507
  */
508
-function give_output_levels( $form_id ) {
508
+function give_output_levels($form_id) {
509 509
 
510 510
 	/**
511 511
 	 * Filter the variable pricing
@@ -517,30 +517,30 @@  discard block
 block discarded – undo
517 517
 	 * @param array $prices Array of variable prices.
518 518
 	 * @param int   $form   Form ID.
519 519
 	 */
520
-	$prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
520
+	$prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
521 521
 
522
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
523
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
524
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
522
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
523
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
524
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
525 525
 
526
-	if ( empty( $custom_amount_text ) ) {
527
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
526
+	if (empty($custom_amount_text)) {
527
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
528 528
 	}
529 529
 
530 530
 	$output = '';
531 531
 
532
-	switch ( $display_style ) {
532
+	switch ($display_style) {
533 533
 		case 'buttons':
534 534
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
535 535
 
536
-			foreach ( $prices as $price ) {
537
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
538
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price );
536
+			foreach ($prices as $price) {
537
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price);
538
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.(give_is_default_level_id($price) ? 'give-default-level' : ''), $form_id, $price);
539 539
 
540 540
 				$formatted_amount = give_format_amount(
541 541
 					$price['_give_amount'], array(
542 542
 						'sanitize' => false,
543
-						'currency' => give_get_currency( $form_id ),
543
+						'currency' => give_get_currency($form_id),
544 544
 					)
545 545
 				);
546 546
 
@@ -549,15 +549,15 @@  discard block
 block discarded – undo
549 549
 					$price['_give_id']['level_id'],
550 550
 					$level_classes,
551 551
 					$formatted_amount,
552
-					array_key_exists( '_give_default', $price ) ? 1 : 0,
552
+					array_key_exists('_give_default', $price) ? 1 : 0,
553 553
 					$level_text
554 554
 				);
555 555
 			}
556 556
 
557 557
 			// Custom Amount.
558 558
 			if (
559
-				give_is_setting_enabled( $custom_amount )
560
-				&& ! empty( $custom_amount_text )
559
+				give_is_setting_enabled($custom_amount)
560
+				&& ! empty($custom_amount_text)
561 561
 			) {
562 562
 
563 563
 				$output .= sprintf(
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
 		case 'radios':
574 574
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
575 575
 
576
-			foreach ( $prices as $price ) {
577
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
578
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price );
576
+			foreach ($prices as $price) {
577
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price);
578
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, $price);
579 579
 
580 580
 				$formatted_amount = give_format_amount(
581 581
 					$price['_give_amount'], array(
582 582
 						'sanitize' => false,
583
-						'currency' => give_get_currency( $form_id ),
583
+						'currency' => give_get_currency($form_id),
584 584
 					)
585 585
 				);
586 586
 
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 					$price['_give_id']['level_id'],
590 590
 					$level_classes,
591 591
 					$formatted_amount,
592
-					( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ),
593
-					array_key_exists( '_give_default', $price ) ? 1 : 0,
592
+					(give_is_default_level_id($price) ? 'checked="checked"' : ''),
593
+					array_key_exists('_give_default', $price) ? 1 : 0,
594 594
 					$level_text
595 595
 				);
596 596
 			}
597 597
 
598 598
 			// Custom Amount.
599 599
 			if (
600
-				give_is_setting_enabled( $custom_amount )
601
-				&& ! empty( $custom_amount_text )
600
+				give_is_setting_enabled($custom_amount)
601
+				&& ! empty($custom_amount_text)
602 602
 			) {
603 603
 				$output .= sprintf(
604 604
 					'<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>',
@@ -611,21 +611,21 @@  discard block
 block discarded – undo
611 611
 			break;
612 612
 
613 613
 		case 'dropdown':
614
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
615
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
614
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
615
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
616 616
 
617 617
 			// first loop through prices.
618
-			foreach ( $prices as $price ) {
619
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
618
+			foreach ($prices as $price) {
619
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price);
620 620
 				$level_classes = apply_filters(
621
-					'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id,
621
+					'give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id,
622 622
 					$price
623 623
 				);
624 624
 
625 625
 				$formatted_amount = give_format_amount(
626 626
 					$price['_give_amount'], array(
627 627
 						'sanitize' => false,
628
-						'currency' => give_get_currency( $form_id ),
628
+						'currency' => give_get_currency($form_id),
629 629
 					)
630 630
 				);
631 631
 
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
 					$price['_give_id']['level_id'],
635 635
 					$level_classes,
636 636
 					$formatted_amount,
637
-					( give_is_default_level_id( $price ) ? 'selected="selected"' : '' ),
638
-					array_key_exists( '_give_default', $price ) ? 1 : 0,
637
+					(give_is_default_level_id($price) ? 'selected="selected"' : ''),
638
+					array_key_exists('_give_default', $price) ? 1 : 0,
639 639
 					$level_text
640 640
 				);
641 641
 			}
642 642
 
643 643
 			// Custom Amount.
644
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
644
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
645 645
 				$output .= sprintf(
646 646
 					'<option data-price-id="custom" class="give-donation-level-custom" value="custom">%1$s</option>',
647 647
 					$custom_amount_text
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			break;
654 654
 	}
655 655
 
656
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
656
+	echo apply_filters('give_form_level_output', $output, $form_id);
657 657
 }
658 658
 
659 659
 /**
@@ -668,27 +668,27 @@  discard block
 block discarded – undo
668 668
  *
669 669
  * @return string Checkout button.
670 670
  */
671
-function give_display_checkout_button( $form_id, $args ) {
671
+function give_display_checkout_button($form_id, $args) {
672 672
 
673
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
673
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
674 674
 		? $args['display_style']
675
-		: give_get_meta( $form_id, '_give_payment_display', true );
675
+		: give_get_meta($form_id, '_give_payment_display', true);
676 676
 
677
-	if ( 'button' === $display_option ) {
677
+	if ('button' === $display_option) {
678 678
 		$display_option = 'modal';
679
-	} elseif ( $display_option === 'onpage' ) {
679
+	} elseif ($display_option === 'onpage') {
680 680
 		return '';
681 681
 	}
682 682
 
683
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
684
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
683
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
684
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
685 685
 
686
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
686
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
687 687
 
688
-	echo apply_filters( 'give_display_checkout_button', $output );
688
+	echo apply_filters('give_display_checkout_button', $output);
689 689
 }
690 690
 
691
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
691
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
692 692
 
693 693
 /**
694 694
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -701,53 +701,53 @@  discard block
 block discarded – undo
701 701
  *
702 702
  * @return void
703 703
  */
704
-function give_user_info_fields( $form_id ) {
704
+function give_user_info_fields($form_id) {
705 705
 
706 706
 	// Get user info.
707
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
708
-	$title          = ! empty( $give_user_info['give_title'] ) ? $give_user_info['give_title'] : '';
709
-	$first_name     = ! empty( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : '';
710
-	$last_name      = ! empty( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : '';
711
-	$company_name   = ! empty( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : '';
712
-	$email          = ! empty( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : '';
713
-	$title_prefixes = give_get_name_title_prefixes( $form_id );
707
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
708
+	$title          = ! empty($give_user_info['give_title']) ? $give_user_info['give_title'] : '';
709
+	$first_name     = ! empty($give_user_info['give_first']) ? $give_user_info['give_first'] : '';
710
+	$last_name      = ! empty($give_user_info['give_last']) ? $give_user_info['give_last'] : '';
711
+	$company_name   = ! empty($give_user_info['company_name']) ? $give_user_info['company_name'] : '';
712
+	$email          = ! empty($give_user_info['give_email']) ? $give_user_info['give_email'] : '';
713
+	$title_prefixes = give_get_name_title_prefixes($form_id);
714 714
 
715 715
 	/**
716 716
 	 * Fire before user personal information fields
717 717
 	 *
718 718
 	 * @since 1.7
719 719
 	 */
720
-	do_action( 'give_donation_form_before_personal_info', $form_id );
720
+	do_action('give_donation_form_before_personal_info', $form_id);
721 721
 
722 722
 	$title_prefix_classes = '';
723
-	if ( give_is_name_title_prefix_enabled( $form_id ) ) {
723
+	if (give_is_name_title_prefix_enabled($form_id)) {
724 724
 		$title_prefix_classes = 'give-title-prefix-wrap';
725 725
 	}
726 726
 	?>
727
-	<fieldset id="give_checkout_user_info" class="<?php echo esc_html( $title_prefix_classes ); ?>">
727
+	<fieldset id="give_checkout_user_info" class="<?php echo esc_html($title_prefix_classes); ?>">
728 728
 		<legend>
729
-			<?php echo esc_html( apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ) ); ?>
729
+			<?php echo esc_html(apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give'))); ?>
730 730
 		</legend>
731 731
 
732
-		<?php if ( give_is_name_title_prefix_enabled( $form_id ) && is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { ?>
732
+		<?php if (give_is_name_title_prefix_enabled($form_id) && is_array($title_prefixes) && count($title_prefixes) > 0) { ?>
733 733
 			<p id="give-title-wrap" class="form-row form-row-title form-row-responsive">
734 734
 				<label class="give-label" for="give-title">
735
-					<?php esc_attr_e( 'Title', 'give' ); ?>
736
-					<?php if ( give_field_is_required( 'give_title', $form_id ) ) : ?>
735
+					<?php esc_attr_e('Title', 'give'); ?>
736
+					<?php if (give_field_is_required('give_title', $form_id)) : ?>
737 737
 						<span class="give-required-indicator">*</span>
738 738
 					<?php endif ?>
739
-					<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
739
+					<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
740 740
 				</label>
741 741
 				<select
742 742
 					class="give-input required"
743 743
 					type="text"
744 744
 					name="give_title"
745 745
 					id="give-title"
746
-					<?php echo( give_field_is_required( 'give_title', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
746
+					<?php echo(give_field_is_required('give_title', $form_id) ? ' required aria-required="true" ' : ''); ?>
747 747
 				>
748
-					<?php foreach ( $title_prefixes as $key => $value ) { ?>
748
+					<?php foreach ($title_prefixes as $key => $value) { ?>
749 749
 						<option
750
-							value="<?php echo esc_html( $value ); ?>" <?php selected( $value, $title, true ); ?>><?php echo esc_html( $value ); ?></option>
750
+							value="<?php echo esc_html($value); ?>" <?php selected($value, $title, true); ?>><?php echo esc_html($value); ?></option>
751 751
 					<?php } ?>
752 752
 				</select>
753 753
 			</p>
@@ -755,63 +755,63 @@  discard block
 block discarded – undo
755 755
 
756 756
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
757 757
 			<label class="give-label" for="give-first">
758
-				<?php esc_attr_e( 'First Name', 'give' ); ?>
759
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
758
+				<?php esc_attr_e('First Name', 'give'); ?>
759
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
760 760
 					<span class="give-required-indicator">*</span>
761 761
 				<?php endif ?>
762
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
762
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
763 763
 			</label>
764 764
 			<input
765 765
 				class="give-input required"
766 766
 				type="text"
767 767
 				name="give_first"
768 768
 				autocomplete="given-name"
769
-				placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
769
+				placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
770 770
 				id="give-first"
771
-				value="<?php echo esc_html( $first_name ); ?>"
772
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
771
+				value="<?php echo esc_html($first_name); ?>"
772
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
773 773
 			/>
774 774
 		</p>
775 775
 
776 776
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
777 777
 			<label class="give-label" for="give-last">
778
-				<?php esc_attr_e( 'Last Name', 'give' ); ?>
779
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
778
+				<?php esc_attr_e('Last Name', 'give'); ?>
779
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
780 780
 					<span class="give-required-indicator">*</span>
781 781
 				<?php endif ?>
782
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
782
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
783 783
 			</label>
784 784
 
785 785
 			<input
786
-				class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
786
+				class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
787 787
 				type="text"
788 788
 				name="give_last"
789 789
 				autocomplete="family-name"
790 790
 				id="give-last"
791
-				placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
792
-				value="<?php echo esc_html( $last_name ); ?>"
793
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
791
+				placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
792
+				value="<?php echo esc_html($last_name); ?>"
793
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
794 794
 			/>
795 795
 		</p>
796 796
 
797
-		<?php if ( give_is_company_field_enabled( $form_id ) ) : ?>
798
-			<?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?>
797
+		<?php if (give_is_company_field_enabled($form_id)) : ?>
798
+			<?php $give_company = give_field_is_required('give_company_name', $form_id); ?>
799 799
 			<p id="give-company-wrap" class="form-row form-row-wide">
800 800
 				<label class="give-label" for="give-company">
801
-					<?php esc_attr_e( 'Company Name', 'give' ); ?>
802
-					<?php if ( $give_company ) : ?>
801
+					<?php esc_attr_e('Company Name', 'give'); ?>
802
+					<?php if ($give_company) : ?>
803 803
 						<span class="give-required-indicator">*</span>
804 804
 					<?php endif; ?>
805
-					<?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?>
805
+					<?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?>
806 806
 				</label>
807 807
 				<input
808
-					class="give-input<?php echo( $give_company ? ' required' : '' ); ?>"
808
+					class="give-input<?php echo($give_company ? ' required' : ''); ?>"
809 809
 					type="text"
810 810
 					name="give_company_name"
811
-					placeholder="<?php esc_attr_e( 'Company Name', 'give' ); ?>"
811
+					placeholder="<?php esc_attr_e('Company Name', 'give'); ?>"
812 812
 					id="give-company"
813
-					value="<?php echo esc_html( $company_name ); ?>"
814
-					<?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?>
813
+					value="<?php echo esc_html($company_name); ?>"
814
+					<?php echo($give_company ? ' required aria-required="true" ' : ''); ?>
815 815
 				/>
816 816
 			</p>
817 817
 		<?php endif ?>
@@ -822,31 +822,31 @@  discard block
 block discarded – undo
822 822
 		 *
823 823
 		 * @since 1.7
824 824
 		 */
825
-		do_action( 'give_donation_form_before_email', $form_id );
825
+		do_action('give_donation_form_before_email', $form_id);
826 826
 		?>
827 827
 		<p id="give-email-wrap" class="form-row form-row-wide">
828 828
 			<label class="give-label" for="give-email">
829
-				<?php esc_attr_e( 'Email Address', 'give' ); ?>
830
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
829
+				<?php esc_attr_e('Email Address', 'give'); ?>
830
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
831 831
 					<span class="give-required-indicator">*</span>
832 832
 				<?php } ?>
833
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
833
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
834 834
 			</label>
835 835
 			<input
836 836
 				class="give-input required"
837 837
 				type="email"
838 838
 				name="give_email"
839 839
 				autocomplete="email"
840
-				placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
840
+				placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
841 841
 				id="give-email"
842
-				value="<?php echo esc_html( $email ); ?>"
843
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
842
+				value="<?php echo esc_html($email); ?>"
843
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
844 844
 			/>
845 845
 
846 846
 		</p>
847 847
 
848
-		<?php if ( give_is_anonymous_donation_field_enabled( $form_id ) ) : ?>
849
-			<?php $is_anonymous_donation = isset( $_POST['give_anonymous_donation'] ) ? absint( $_POST['give_anonymous_donation'] ) : 0; ?>
848
+		<?php if (give_is_anonymous_donation_field_enabled($form_id)) : ?>
849
+			<?php $is_anonymous_donation = isset($_POST['give_anonymous_donation']) ? absint($_POST['give_anonymous_donation']) : 0; ?>
850 850
 			<p id="give-anonymous-donation-wrap" class="form-row form-row-wide">
851 851
 				<label class="give-label" for="give-anonymous-donation">
852 852
 					<input
@@ -855,35 +855,35 @@  discard block
 block discarded – undo
855 855
 						name="give_anonymous_donation"
856 856
 						id="give-anonymous-donation"
857 857
 						value="1"
858
-						<?php echo( give_field_is_required( 'give_anonymous_donation', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
859
-						<?php checked( 1, $is_anonymous_donation ); ?>
858
+						<?php echo(give_field_is_required('give_anonymous_donation', $form_id) ? ' required aria-required="true" ' : ''); ?>
859
+						<?php checked(1, $is_anonymous_donation); ?>
860 860
 					>
861
-					<?php _e( 'Make this an anonymous donation', 'give' ); ?>
862
-					<?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?>
861
+					<?php _e('Make this an anonymous donation', 'give'); ?>
862
+					<?php if (give_field_is_required('give_comment', $form_id)) { ?>
863 863
 						<span class="give-required-indicator">*</span>
864 864
 					<?php } ?>
865
-					<?php echo Give()->tooltips->render_help( esc_html__( 'Would you like to prevent this donation from being displayed publicy?', 'give' ) ); ?>
865
+					<?php echo Give()->tooltips->render_help(esc_html__('Would you like to prevent this donation from being displayed publicy?', 'give')); ?>
866 866
 				</label>
867 867
 			</p>
868 868
 		<?php endif; ?>
869 869
 
870
-		<?php if ( give_is_donor_comment_field_enabled( $form_id ) ) : ?>
870
+		<?php if (give_is_donor_comment_field_enabled($form_id)) : ?>
871 871
 			<p id="give-comment-wrap" class="form-row form-row-wide">
872 872
 				<label class="give-label" for="give-comment">
873
-					<?php _e( 'Comment', 'give' ); ?>
874
-					<?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?>
873
+					<?php _e('Comment', 'give'); ?>
874
+					<?php if (give_field_is_required('give_comment', $form_id)) { ?>
875 875
 						<span class="give-required-indicator">*</span>
876 876
 					<?php } ?>
877
-					<?php echo Give()->tooltips->render_help( __( 'Would you like to add a comment to this donation?', 'give' ) ); ?>
877
+					<?php echo Give()->tooltips->render_help(__('Would you like to add a comment to this donation?', 'give')); ?>
878 878
 				</label>
879 879
 
880 880
 				<textarea
881 881
 					class="give-input required"
882 882
 					name="give_comment"
883
-					placeholder="<?php _e( 'Leave a comment', 'give' ); ?>"
883
+					placeholder="<?php _e('Leave a comment', 'give'); ?>"
884 884
 					id="give-comment"
885
-					<?php echo( give_field_is_required( 'give_comment', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
886
-				><?php echo isset( $_POST['give_comment'] ) ? give_clean( $_POST['give_comment'] ) : ''; ?></textarea>
885
+					<?php echo(give_field_is_required('give_comment', $form_id) ? ' required aria-required="true" ' : ''); ?>
886
+				><?php echo isset($_POST['give_comment']) ? give_clean($_POST['give_comment']) : ''; ?></textarea>
887 887
 
888 888
 			</p>
889 889
 		<?php endif; ?>
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 		 *
894 894
 		 * @since 1.7
895 895
 		 */
896
-		do_action( 'give_donation_form_after_email', $form_id );
896
+		do_action('give_donation_form_after_email', $form_id);
897 897
 
898 898
 		/**
899 899
 		 * Fire after personal email field
900 900
 		 *
901 901
 		 * @since 1.7
902 902
 		 */
903
-		do_action( 'give_donation_form_user_info', $form_id );
903
+		do_action('give_donation_form_user_info', $form_id);
904 904
 		?>
905 905
 	</fieldset>
906 906
 	<?php
@@ -909,11 +909,11 @@  discard block
 block discarded – undo
909 909
 	 *
910 910
 	 * @since 1.7
911 911
 	 */
912
-	do_action( 'give_donation_form_after_personal_info', $form_id );
912
+	do_action('give_donation_form_after_personal_info', $form_id);
913 913
 }
914 914
 
915
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
916
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
915
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
916
+add_action('give_register_fields_before', 'give_user_info_fields');
917 917
 
918 918
 /**
919 919
  * Renders the credit card info form.
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
  *
925 925
  * @return void
926 926
  */
927
-function give_get_cc_form( $form_id ) {
927
+function give_get_cc_form($form_id) {
928 928
 
929 929
 	ob_start();
930 930
 
@@ -935,50 +935,50 @@  discard block
 block discarded – undo
935 935
 	 *
936 936
 	 * @param int $form_id The form ID.
937 937
 	 */
938
-	do_action( 'give_before_cc_fields', $form_id );
938
+	do_action('give_before_cc_fields', $form_id);
939 939
 	?>
940 940
 	<fieldset id="give_cc_fields-<?php echo $form_id; ?>" class="give-do-validate">
941
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
942
-		<?php if ( is_ssl() ) : ?>
941
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
942
+		<?php if (is_ssl()) : ?>
943 943
 			<div id="give_secure_site_wrapper-<?php echo $form_id; ?>">
944 944
 				<span class="give-icon padlock"></span>
945
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
945
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
946 946
 			</div>
947 947
 		<?php endif; ?>
948 948
 		<p id="give-card-number-wrap-<?php echo $form_id; ?>" class="form-row form-row-two-thirds form-row-responsive">
949 949
 			<label for="card_number-<?php echo $form_id; ?>" class="give-label">
950
-				<?php _e( 'Card Number', 'give' ); ?>
950
+				<?php _e('Card Number', 'give'); ?>
951 951
 				<span class="give-required-indicator">*</span>
952
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
952
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
953 953
 				<span class="card-type"></span>
954 954
 			</label>
955 955
 
956 956
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id; ?>"
957
-			       class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
957
+			       class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
958 958
 			       required aria-required="true"/>
959 959
 		</p>
960 960
 
961 961
 		<p id="give-card-cvc-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-responsive">
962 962
 			<label for="card_cvc-<?php echo $form_id; ?>" class="give-label">
963
-				<?php _e( 'CVC', 'give' ); ?>
963
+				<?php _e('CVC', 'give'); ?>
964 964
 				<span class="give-required-indicator">*</span>
965
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
965
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
966 966
 			</label>
967 967
 
968 968
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id; ?>"
969
-			       class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
969
+			       class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
970 970
 			       required aria-required="true"/>
971 971
 		</p>
972 972
 
973 973
 		<p id="give-card-name-wrap-<?php echo $form_id; ?>" class="form-row form-row-two-thirds form-row-responsive">
974 974
 			<label for="card_name-<?php echo $form_id; ?>" class="give-label">
975
-				<?php _e( 'Name on the Card', 'give' ); ?>
975
+				<?php _e('Name on the Card', 'give'); ?>
976 976
 				<span class="give-required-indicator">*</span>
977
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
977
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
978 978
 			</label>
979 979
 
980 980
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id; ?>"
981
-			       class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
981
+			       class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
982 982
 			       required aria-required="true"/>
983 983
 		</p>
984 984
 		<?php
@@ -989,13 +989,13 @@  discard block
 block discarded – undo
989 989
 		 *
990 990
 		 * @param int $form_id The form ID.
991 991
 		 */
992
-		do_action( 'give_before_cc_expiration' );
992
+		do_action('give_before_cc_expiration');
993 993
 		?>
994 994
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
995 995
 			<label for="card_expiry-<?php echo $form_id; ?>" class="give-label">
996
-				<?php _e( 'Expiration', 'give' ); ?>
996
+				<?php _e('Expiration', 'give'); ?>
997 997
 				<span class="give-required-indicator">*</span>
998
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
998
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
999 999
 			</label>
1000 1000
 
1001 1001
 			<input type="hidden" id="card_exp_month-<?php echo $form_id; ?>" name="card_exp_month"
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			       class="card-expiry-year"/>
1005 1005
 
1006 1006
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id; ?>"
1007
-			       class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
1007
+			       class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
1008 1008
 			       required aria-required="true"/>
1009 1009
 		</p>
1010 1010
 		<?php
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 		 *
1016 1016
 		 * @param int $form_id The form ID.
1017 1017
 		 */
1018
-		do_action( 'give_after_cc_expiration', $form_id );
1018
+		do_action('give_after_cc_expiration', $form_id);
1019 1019
 		?>
1020 1020
 	</fieldset>
1021 1021
 	<?php
@@ -1026,12 +1026,12 @@  discard block
 block discarded – undo
1026 1026
 	 *
1027 1027
 	 * @param int $form_id The form ID.
1028 1028
 	 */
1029
-	do_action( 'give_after_cc_fields', $form_id );
1029
+	do_action('give_after_cc_fields', $form_id);
1030 1030
 
1031 1031
 	echo ob_get_clean();
1032 1032
 }
1033 1033
 
1034
-add_action( 'give_cc_form', 'give_get_cc_form' );
1034
+add_action('give_cc_form', 'give_get_cc_form');
1035 1035
 
1036 1036
 /**
1037 1037
  * Outputs the default credit card address fields.
@@ -1042,20 +1042,20 @@  discard block
 block discarded – undo
1042 1042
  *
1043 1043
  * @return void
1044 1044
  */
1045
-function give_default_cc_address_fields( $form_id ) {
1045
+function give_default_cc_address_fields($form_id) {
1046 1046
 	// Get user info.
1047
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
1047
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
1048 1048
 
1049 1049
 	$logged_in = is_user_logged_in();
1050 1050
 
1051
-	if ( $logged_in ) {
1052
-		$user_address = give_get_donor_address( get_current_user_id() );
1051
+	if ($logged_in) {
1052
+		$user_address = give_get_donor_address(get_current_user_id());
1053 1053
 	}
1054 1054
 
1055 1055
 	ob_start();
1056 1056
 	?>
1057 1057
 	<fieldset id="give_cc_address" class="cc-address">
1058
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
1058
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
1059 1059
 		<?php
1060 1060
 		/**
1061 1061
 		 * Fires while rendering credit card billing form, before address fields.
@@ -1064,36 +1064,36 @@  discard block
 block discarded – undo
1064 1064
 		 *
1065 1065
 		 * @param int $form_id The form ID.
1066 1066
 		 */
1067
-		do_action( 'give_cc_billing_top' );
1067
+		do_action('give_cc_billing_top');
1068 1068
 
1069 1069
 		// For Country.
1070 1070
 		$selected_country = give_get_country();
1071
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1071
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1072 1072
 			$selected_country = $give_user_info['billing_country'];
1073 1073
 		}
1074 1074
 		$countries = give_get_country_list();
1075 1075
 
1076 1076
 		// For state.
1077 1077
 		$selected_state = '';
1078
-		if ( $selected_country === give_get_country() ) {
1078
+		if ($selected_country === give_get_country()) {
1079 1079
 			// Get default selected state by admin.
1080 1080
 			$selected_state = give_get_state();
1081 1081
 		}
1082 1082
 		// Get the last payment made by user states.
1083
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
1083
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
1084 1084
 			$selected_state = $give_user_info['card_state'];
1085 1085
 		}
1086 1086
 		// Get the country code.
1087
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1087
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1088 1088
 			$selected_country = $give_user_info['billing_country'];
1089 1089
 		}
1090
-		$label        = __( 'State', 'give' );
1090
+		$label        = __('State', 'give');
1091 1091
 		$states_label = give_get_states_label();
1092 1092
 		// Check if $country code exists in the array key for states label.
1093
-		if ( array_key_exists( $selected_country, $states_label ) ) {
1094
-			$label = $states_label[ $selected_country ];
1093
+		if (array_key_exists($selected_country, $states_label)) {
1094
+			$label = $states_label[$selected_country];
1095 1095
 		}
1096
-		$states = give_get_states( $selected_country );
1096
+		$states = give_get_states($selected_country);
1097 1097
 		// Get the country list that do not have any states init.
1098 1098
 		$no_states_country = give_no_states_country_list();
1099 1099
 		// Get the country list that does not require states.
@@ -1101,24 +1101,24 @@  discard block
 block discarded – undo
1101 1101
 		?>
1102 1102
 		<p id="give-card-country-wrap" class="form-row form-row-wide">
1103 1103
 			<label for="billing_country" class="give-label">
1104
-				<?php esc_html_e( 'Country', 'give' ); ?>
1105
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
1104
+				<?php esc_html_e('Country', 'give'); ?>
1105
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
1106 1106
 					<span class="give-required-indicator">*</span>
1107 1107
 				<?php endif; ?>
1108 1108
 				<span class="give-tooltip give-icon give-icon-question"
1109
-				      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
1109
+				      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
1110 1110
 			</label>
1111 1111
 
1112 1112
 			<select
1113 1113
 				name="billing_country"
1114 1114
 				autocomplete="country-name"
1115 1115
 				id="billing_country"
1116
-				class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
1117
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1116
+				class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
1117
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
1118 1118
 			>
1119 1119
 				<?php
1120
-				foreach ( $countries as $country_code => $country ) {
1121
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
1120
+				foreach ($countries as $country_code => $country) {
1121
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1122 1122
 				}
1123 1123
 				?>
1124 1124
 			</select>
@@ -1126,13 +1126,13 @@  discard block
 block discarded – undo
1126 1126
 
1127 1127
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
1128 1128
 			<label for="card_address" class="give-label">
1129
-				<?php _e( 'Address 1', 'give' ); ?>
1129
+				<?php _e('Address 1', 'give'); ?>
1130 1130
 				<?php
1131
-				if ( give_field_is_required( 'card_address', $form_id ) ) :
1131
+				if (give_field_is_required('card_address', $form_id)) :
1132 1132
 					?>
1133 1133
 					<span class="give-required-indicator">*</span>
1134 1134
 				<?php endif; ?>
1135
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
1135
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
1136 1136
 			</label>
1137 1137
 
1138 1138
 			<input
@@ -1140,20 +1140,20 @@  discard block
 block discarded – undo
1140 1140
 				id="card_address"
1141 1141
 				name="card_address"
1142 1142
 				autocomplete="address-line1"
1143
-				class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
1144
-				placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
1145
-				value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
1146
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
1143
+				class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
1144
+				placeholder="<?php _e('Address line 1', 'give'); ?>"
1145
+				value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
1146
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
1147 1147
 			/>
1148 1148
 		</p>
1149 1149
 
1150 1150
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
1151 1151
 			<label for="card_address_2" class="give-label">
1152
-				<?php _e( 'Address 2', 'give' ); ?>
1153
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
1152
+				<?php _e('Address 2', 'give'); ?>
1153
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
1154 1154
 					<span class="give-required-indicator">*</span>
1155 1155
 				<?php endif; ?>
1156
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
1156
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
1157 1157
 			</label>
1158 1158
 
1159 1159
 			<input
@@ -1161,59 +1161,59 @@  discard block
 block discarded – undo
1161 1161
 				id="card_address_2"
1162 1162
 				name="card_address_2"
1163 1163
 				autocomplete="address-line2"
1164
-				class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
1165
-				placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
1166
-				value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
1167
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1164
+				class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
1165
+				placeholder="<?php _e('Address line 2', 'give'); ?>"
1166
+				value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
1167
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
1168 1168
 			/>
1169 1169
 		</p>
1170 1170
 
1171 1171
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
1172 1172
 			<label for="card_city" class="give-label">
1173
-				<?php _e( 'City', 'give' ); ?>
1174
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
1173
+				<?php _e('City', 'give'); ?>
1174
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
1175 1175
 					<span class="give-required-indicator">*</span>
1176 1176
 				<?php endif; ?>
1177
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
1177
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
1178 1178
 			</label>
1179 1179
 			<input
1180 1180
 				type="text"
1181 1181
 				id="card_city"
1182 1182
 				name="card_city"
1183 1183
 				autocomplete="address-level3"
1184
-				class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1185
-				placeholder="<?php _e( 'City', 'give' ); ?>"
1186
-				value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1187
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1184
+				class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1185
+				placeholder="<?php _e('City', 'give'); ?>"
1186
+				value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1187
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1188 1188
 			/>
1189 1189
 		</p>
1190 1190
 
1191 1191
 		<p id="give-card-state-wrap"
1192
-		   class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
1192
+		   class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1193 1193
 			<label for="card_state" class="give-label">
1194 1194
 				<span class="state-label-text"><?php echo $label; ?></span>
1195 1195
 				<?php
1196
-				if ( give_field_is_required( 'card_state', $form_id ) ) :
1196
+				if (give_field_is_required('card_state', $form_id)) :
1197 1197
 					?>
1198 1198
 					<span
1199
-						class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ); ?> ">*</span>
1199
+						class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : ''); ?> ">*</span>
1200 1200
 				<?php endif; ?>
1201 1201
 				<span class="give-tooltip give-icon give-icon-question"
1202
-				      data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1202
+				      data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1203 1203
 			</label>
1204 1204
 			<?php
1205 1205
 
1206
-			if ( ! empty( $states ) ) :
1206
+			if ( ! empty($states)) :
1207 1207
 				?>
1208 1208
 				<select
1209 1209
 					name="card_state"
1210 1210
 					autocomplete="address-level4"
1211 1211
 					id="card_state"
1212
-					class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1213
-					<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1212
+					class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1213
+					<?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1214 1214
 					<?php
1215
-					foreach ( $states as $state_code => $state ) {
1216
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1215
+					foreach ($states as $state_code => $state) {
1216
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1217 1217
 					}
1218 1218
 					?>
1219 1219
 				</select>
@@ -1225,11 +1225,11 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1227 1227
 			<label for="card_zip" class="give-label">
1228
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1229
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1228
+				<?php _e('Zip / Postal Code', 'give'); ?>
1229
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1230 1230
 					<span class="give-required-indicator">*</span>
1231 1231
 				<?php endif; ?>
1232
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1232
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1233 1233
 			</label>
1234 1234
 
1235 1235
 			<input
@@ -1238,10 +1238,10 @@  discard block
 block discarded – undo
1238 1238
 				id="card_zip"
1239 1239
 				name="card_zip"
1240 1240
 				autocomplete="postal-code"
1241
-				class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1242
-				placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1243
-				value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1244
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1241
+				class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1242
+				placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1243
+				value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1244
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1245 1245
 			/>
1246 1246
 		</p>
1247 1247
 		<?php
@@ -1252,14 +1252,14 @@  discard block
 block discarded – undo
1252 1252
 		 *
1253 1253
 		 * @param int $form_id The form ID.
1254 1254
 		 */
1255
-		do_action( 'give_cc_billing_bottom' );
1255
+		do_action('give_cc_billing_bottom');
1256 1256
 		?>
1257 1257
 	</fieldset>
1258 1258
 	<?php
1259 1259
 	echo ob_get_clean();
1260 1260
 }
1261 1261
 
1262
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1262
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1263 1263
 
1264 1264
 
1265 1265
 /**
@@ -1272,15 +1272,15 @@  discard block
 block discarded – undo
1272 1272
  *
1273 1273
  * @return string
1274 1274
  */
1275
-function give_get_register_fields( $form_id ) {
1275
+function give_get_register_fields($form_id) {
1276 1276
 
1277 1277
 	global $user_ID;
1278 1278
 
1279
-	if ( is_user_logged_in() ) {
1280
-		$user_data = get_userdata( $user_ID );
1279
+	if (is_user_logged_in()) {
1280
+		$user_data = get_userdata($user_ID);
1281 1281
 	}
1282 1282
 
1283
-	$show_register_form = give_show_login_register_option( $form_id );
1283
+	$show_register_form = give_show_login_register_option($form_id);
1284 1284
 
1285 1285
 	ob_start();
1286 1286
 	?>
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 		 *
1295 1295
 		 * @param int $form_id The form ID.
1296 1296
 		 */
1297
-		do_action( 'give_register_fields_before', $form_id );
1297
+		do_action('give_register_fields_before', $form_id);
1298 1298
 		?>
1299 1299
 
1300 1300
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1306,25 +1306,25 @@  discard block
 block discarded – undo
1306 1306
 			 *
1307 1307
 			 * @param int $form_id The form ID.
1308 1308
 			 */
1309
-			do_action( 'give_register_account_fields_before', $form_id );
1309
+			do_action('give_register_account_fields_before', $form_id);
1310 1310
 
1311
-			$class = ( 'registration' === $show_register_form ) ? 'form-row-wide' : 'form-row-first';
1311
+			$class = ('registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first';
1312 1312
 			?>
1313 1313
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>"
1314
-			     class="form-row <?php echo esc_attr( $class ); ?> form-row-responsive">
1314
+			     class="form-row <?php echo esc_attr($class); ?> form-row-responsive">
1315 1315
 				<label for="give-create-account-<?php echo $form_id; ?>">
1316 1316
 					<?php
1317 1317
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1318
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1319
-					$id                = 'give-create-account-' . $form_id;
1320
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1318
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1319
+					$id                = 'give-create-account-'.$form_id;
1320
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1321 1321
 						echo Give()->tooltips->render(
1322 1322
 							array(
1323 1323
 								'tag_content' => sprintf(
1324 1324
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1325 1325
 									$id
1326 1326
 								),
1327
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1327
+								'label'       => __('Registration is required to donate.', 'give'),
1328 1328
 							)
1329 1329
 						);
1330 1330
 					} else {
@@ -1334,22 +1334,22 @@  discard block
 block discarded – undo
1334 1334
 						<?php
1335 1335
 					}
1336 1336
 
1337
-					_e( 'Create an account', 'give' );
1338
-					echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) );
1337
+					_e('Create an account', 'give');
1338
+					echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give'));
1339 1339
 					echo str_replace(
1340 1340
 						'/>',
1341
-						'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>',
1342
-						give_get_nonce_field( "give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false )
1341
+						'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>',
1342
+						give_get_nonce_field("give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false)
1343 1343
 					);
1344 1344
 					?>
1345 1345
 				</label>
1346 1346
 			</div>
1347 1347
 
1348
-			<?php if ( 'both' === $show_register_form ) { ?>
1348
+			<?php if ('both' === $show_register_form) { ?>
1349 1349
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1350
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1351
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1352
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1350
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1351
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1352
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1353 1353
 					</p>
1354 1354
 					<p class="give-loading-text">
1355 1355
 						<span class="give-loading-animation"></span>
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
 			 *
1366 1366
 			 * @param int $form_id The form ID.
1367 1367
 			 */
1368
-			do_action( 'give_register_account_fields_after', $form_id );
1368
+			do_action('give_register_account_fields_after', $form_id);
1369 1369
 			?>
1370 1370
 		</fieldset>
1371 1371
 
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		 *
1378 1378
 		 * @param int $form_id The form ID.
1379 1379
 		 */
1380
-		do_action( 'give_register_fields_after', $form_id );
1380
+		do_action('give_register_fields_after', $form_id);
1381 1381
 		?>
1382 1382
 
1383 1383
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 		 *
1389 1389
 		 * @since 1.7
1390 1390
 		 */
1391
-		do_action( 'give_donation_form_user_info', $form_id );
1391
+		do_action('give_donation_form_user_info', $form_id);
1392 1392
 		?>
1393 1393
 
1394 1394
 	</fieldset>
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 	echo ob_get_clean();
1397 1397
 }
1398 1398
 
1399
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1399
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1400 1400
 
1401 1401
 /**
1402 1402
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1409,32 +1409,32 @@  discard block
 block discarded – undo
1409 1409
  *
1410 1410
  * @return string
1411 1411
  */
1412
-function give_get_login_fields( $form_id ) {
1412
+function give_get_login_fields($form_id) {
1413 1413
 
1414
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1415
-	$show_register_form = give_show_login_register_option( $form_id );
1414
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1415
+	$show_register_form = give_show_login_register_option($form_id);
1416 1416
 
1417 1417
 	ob_start();
1418 1418
 	?>
1419 1419
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1420 1420
 		<legend>
1421 1421
 			<?php
1422
-			echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1423
-			if ( ! give_logged_in_only( $form_id ) ) {
1424
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1422
+			echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1423
+			if ( ! give_logged_in_only($form_id)) {
1424
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1425 1425
 			}
1426 1426
 			?>
1427 1427
 		</legend>
1428
-		<?php if ( $show_register_form == 'both' ) { ?>
1428
+		<?php if ($show_register_form == 'both') { ?>
1429 1429
 			<p class="give-new-account-link">
1430
-				<?php _e( 'Don\'t have an account?', 'give' ); ?>&nbsp;
1431
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1430
+				<?php _e('Don\'t have an account?', 'give'); ?>&nbsp;
1431
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1432 1432
 				   data-action="give_checkout_register">
1433 1433
 					<?php
1434
-					if ( give_logged_in_only( $form_id ) ) {
1435
-						_e( 'Register as a part of your donation &raquo;', 'give' );
1434
+					if (give_logged_in_only($form_id)) {
1435
+						_e('Register as a part of your donation &raquo;', 'give');
1436 1436
 					} else {
1437
-						_e( 'Register or donate as a guest &raquo;', 'give' );
1437
+						_e('Register or donate as a guest &raquo;', 'give');
1438 1438
 					}
1439 1439
 					?>
1440 1440
 				</a>
@@ -1451,41 +1451,41 @@  discard block
 block discarded – undo
1451 1451
 		 *
1452 1452
 		 * @param int $form_id The form ID.
1453 1453
 		 */
1454
-		do_action( 'give_donation_form_login_fields_before', $form_id );
1454
+		do_action('give_donation_form_login_fields_before', $form_id);
1455 1455
 		?>
1456 1456
 		<div class="give-user-login-fields-container">
1457 1457
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1458 1458
 				<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1459
-					<?php _e( 'Username', 'give' ); ?>
1460
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1459
+					<?php _e('Username', 'give'); ?>
1460
+					<?php if (give_logged_in_only($form_id)) { ?>
1461 1461
 						<span class="give-required-indicator">*</span>
1462 1462
 					<?php } ?>
1463 1463
 				</label>
1464 1464
 
1465
-				<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1465
+				<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1466 1466
 				       type="text"
1467 1467
 				       name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1468
-				       placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1468
+				       placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1469 1469
 			</div>
1470 1470
 
1471 1471
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1472 1472
 			     class="give_login_password form-row form-row-last form-row-responsive">
1473 1473
 				<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1474
-					<?php _e( 'Password', 'give' ); ?>
1475
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1474
+					<?php _e('Password', 'give'); ?>
1475
+					<?php if (give_logged_in_only($form_id)) { ?>
1476 1476
 						<span class="give-required-indicator">*</span>
1477 1477
 					<?php } ?>
1478 1478
 				</label>
1479
-				<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1479
+				<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1480 1480
 				       type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1481
-				       placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1481
+				       placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1482 1482
 				<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1483 1483
 			</div>
1484 1484
 
1485 1485
 			<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1486 1486
 				 <span class="give-forgot-password ">
1487 1487
 					 <a href="<?php echo wp_lostpassword_url(); ?>"
1488
-					    target="_blank"><?php _e( 'Reset Password', 'give' ); ?></a>
1488
+					    target="_blank"><?php _e('Reset Password', 'give'); ?></a>
1489 1489
 				 </span>
1490 1490
 			</div>
1491 1491
 		</div>
@@ -1493,11 +1493,11 @@  discard block
 block discarded – undo
1493 1493
 
1494 1494
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1495 1495
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1496
-			       value="<?php _e( 'Login', 'give' ); ?>"/>
1497
-			<?php if ( $show_register_form !== 'login' ) { ?>
1496
+			       value="<?php _e('Login', 'give'); ?>"/>
1497
+			<?php if ($show_register_form !== 'login') { ?>
1498 1498
 				<input type="button" data-action="give_cancel_login"
1499 1499
 				       class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1500
-				       value="<?php _e( 'Cancel', 'give' ); ?>"/>
1500
+				       value="<?php _e('Cancel', 'give'); ?>"/>
1501 1501
 			<?php } ?>
1502 1502
 			<span class="give-loading-animation"></span>
1503 1503
 		</div>
@@ -1509,14 +1509,14 @@  discard block
 block discarded – undo
1509 1509
 		 *
1510 1510
 		 * @param int $form_id The form ID.
1511 1511
 		 */
1512
-		do_action( 'give_donation_form_login_fields_after', $form_id );
1512
+		do_action('give_donation_form_login_fields_after', $form_id);
1513 1513
 		?>
1514 1514
 	</fieldset><!--end #give-login-fields-->
1515 1515
 	<?php
1516 1516
 	echo ob_get_clean();
1517 1517
 }
1518 1518
 
1519
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1519
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1520 1520
 
1521 1521
 /**
1522 1522
  * Payment Mode Select.
@@ -1532,10 +1532,10 @@  discard block
 block discarded – undo
1532 1532
  *
1533 1533
  * @return void
1534 1534
  */
1535
-function give_payment_mode_select( $form_id, $args ) {
1535
+function give_payment_mode_select($form_id, $args) {
1536 1536
 
1537
-	$gateways  = give_get_enabled_payment_gateways( $form_id );
1538
-	$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : '';
1537
+	$gateways  = give_get_enabled_payment_gateways($form_id);
1538
+	$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : '';
1539 1539
 
1540 1540
 	/**
1541 1541
 	 * Fires while selecting payment gateways, before the fields.
@@ -1544,12 +1544,12 @@  discard block
 block discarded – undo
1544 1544
 	 *
1545 1545
 	 * @param int $form_id The form ID.
1546 1546
 	 */
1547
-	do_action( 'give_payment_mode_top', $form_id );
1547
+	do_action('give_payment_mode_top', $form_id);
1548 1548
 	?>
1549 1549
 
1550 1550
 	<fieldset id="give-payment-mode-select"
1551 1551
 		<?php
1552
-		if ( count( $gateways ) <= 1 ) {
1552
+		if (count($gateways) <= 1) {
1553 1553
 			echo 'style="display: none;"';
1554 1554
 		}
1555 1555
 		?>
@@ -1562,10 +1562,10 @@  discard block
 block discarded – undo
1562 1562
 		 *
1563 1563
 		 * @param int $form_id The form ID.
1564 1564
 		 */
1565
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1565
+		do_action('give_payment_mode_before_gateways_wrap');
1566 1566
 		?>
1567 1567
 		<legend
1568
-			class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1568
+			class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1569 1569
 			<span class="give-loading-text"><span
1570 1570
 					class="give-loading-animation"></span>
1571 1571
 			</span>
@@ -1578,38 +1578,37 @@  discard block
 block discarded – undo
1578 1578
 			 *
1579 1579
 			 * @since 1.7
1580 1580
 			 */
1581
-			do_action( 'give_payment_mode_before_gateways' )
1581
+			do_action('give_payment_mode_before_gateways')
1582 1582
 			?>
1583 1583
 			<ul id="give-gateway-radio-list">
1584 1584
 				<?php
1585 1585
 				/**
1586 1586
 				 * Loop through the active payment gateways.
1587 1587
 				 */
1588
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1588
+				$selected_gateway  = give_get_chosen_gateway($form_id);
1589 1589
 				$give_settings     = give_get_settings();
1590
-				$gateways_label    = array_key_exists( 'gateways_label', $give_settings ) ?
1591
-					$give_settings['gateways_label'] :
1592
-					array();
1590
+				$gateways_label    = array_key_exists('gateways_label', $give_settings) ?
1591
+					$give_settings['gateways_label'] : array();
1593 1592
 
1594
-				foreach ( $gateways as $gateway_id => $gateway ) :
1593
+				foreach ($gateways as $gateway_id => $gateway) :
1595 1594
 					// Determine the default gateway.
1596
-					$checked = checked( $gateway_id, $selected_gateway, false );
1595
+					$checked = checked($gateway_id, $selected_gateway, false);
1597 1596
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : '';
1598 1597
 					?>
1599 1598
 					<li<?php echo $checked_class; ?>>
1600 1599
 						<input type="radio" name="payment-mode" class="give-gateway"
1601
-						       id="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>"
1602
-						       value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1600
+						       id="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>"
1601
+						       value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1603 1602
 
1604 1603
 						<?php
1605 1604
 						$label = $gateway['checkout_label'];
1606
-						if ( ! empty( $gateways_label[ $gateway_id ] ) ) {
1607
-							$label = $gateways_label[ $gateway_id ];
1605
+						if ( ! empty($gateways_label[$gateway_id])) {
1606
+							$label = $gateways_label[$gateway_id];
1608 1607
 						}
1609 1608
 						?>
1610
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>"
1609
+						<label for="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>"
1611 1610
 						       class="give-gateway-option"
1612
-						       id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label>
1611
+						       id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label>
1613 1612
 					</li>
1614 1613
 				<?php
1615 1614
 				endforeach;
@@ -1621,7 +1620,7 @@  discard block
 block discarded – undo
1621 1620
 			 *
1622 1621
 			 * @since 1.7
1623 1622
 			 */
1624
-			do_action( 'give_payment_mode_after_gateways' );
1623
+			do_action('give_payment_mode_after_gateways');
1625 1624
 			?>
1626 1625
 		</div>
1627 1626
 		<?php
@@ -1632,7 +1631,7 @@  discard block
 block discarded – undo
1632 1631
 		 *
1633 1632
 		 * @param int $form_id The form ID.
1634 1633
 		 */
1635
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1634
+		do_action('give_payment_mode_after_gateways_wrap');
1636 1635
 		?>
1637 1636
 	</fieldset>
1638 1637
 
@@ -1644,7 +1643,7 @@  discard block
 block discarded – undo
1644 1643
 	 *
1645 1644
 	 * @param int $form_id The form ID.
1646 1645
 	 */
1647
-	do_action( 'give_payment_mode_bottom', $form_id );
1646
+	do_action('give_payment_mode_bottom', $form_id);
1648 1647
 	?>
1649 1648
 
1650 1649
 	<div id="give_purchase_form_wrap">
@@ -1655,7 +1654,7 @@  discard block
 block discarded – undo
1655 1654
 		 *
1656 1655
 		 * @since 1.7
1657 1656
 		 */
1658
-		do_action( 'give_donation_form', $form_id, $args );
1657
+		do_action('give_donation_form', $form_id, $args);
1659 1658
 		?>
1660 1659
 
1661 1660
 	</div>
@@ -1666,10 +1665,10 @@  discard block
 block discarded – undo
1666 1665
 	 *
1667 1666
 	 * @since 1.7
1668 1667
 	 */
1669
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1668
+	do_action('give_donation_form_wrap_bottom', $form_id);
1670 1669
 }
1671 1670
 
1672
-add_action( 'give_payment_mode_select', 'give_payment_mode_select', 10, 2 );
1671
+add_action('give_payment_mode_select', 'give_payment_mode_select', 10, 2);
1673 1672
 
1674 1673
 /**
1675 1674
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1682,31 +1681,31 @@  discard block
 block discarded – undo
1682 1681
  *
1683 1682
  * @return bool
1684 1683
  */
1685
-function give_terms_agreement( $form_id ) {
1686
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1684
+function give_terms_agreement($form_id) {
1685
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1687 1686
 
1688 1687
 	// Bailout if per form and global term and conditions is not setup.
1689 1688
 	if (
1690
-		give_is_setting_enabled( $form_option, 'global' )
1691
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1689
+		give_is_setting_enabled($form_option, 'global')
1690
+		&& give_is_setting_enabled(give_get_option('terms'))
1692 1691
 	) {
1693
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1694
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1695
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1692
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1693
+		$terms         = $terms = give_get_option('agreement_text', '');
1694
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1696 1695
 
1697
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1698
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1699
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1700
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1696
+	} elseif (give_is_setting_enabled($form_option)) {
1697
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1698
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1699
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1701 1700
 
1702 1701
 	} else {
1703 1702
 		return false;
1704 1703
 	}
1705 1704
 
1706 1705
 	// Bailout: Check if term and conditions text is empty or not.
1707
-	if ( empty( $terms ) ) {
1708
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1709
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1706
+	if (empty($terms)) {
1707
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1708
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1710 1709
 		}
1711 1710
 
1712 1711
 		return false;
@@ -1717,11 +1716,11 @@  discard block
 block discarded – undo
1717 1716
 	 *
1718 1717
 	 * @since  2.1.5
1719 1718
 	 */
1720
-	$terms = apply_filters( 'give_the_term_content', wpautop( do_shortcode( $terms ) ), $terms, $form_id );
1719
+	$terms = apply_filters('give_the_term_content', wpautop(do_shortcode($terms)), $terms, $form_id);
1721 1720
 
1722 1721
 	?>
1723 1722
 	<fieldset id="give_terms_agreement">
1724
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1723
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1725 1724
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1726 1725
 			<?php
1727 1726
 			/**
@@ -1729,7 +1728,7 @@  discard block
 block discarded – undo
1729 1728
 			 *
1730 1729
 			 * @since 1.0
1731 1730
 			 */
1732
-			do_action( 'give_before_terms' );
1731
+			do_action('give_before_terms');
1733 1732
 
1734 1733
 			echo $terms;
1735 1734
 			/**
@@ -1737,14 +1736,14 @@  discard block
 block discarded – undo
1737 1736
 			 *
1738 1737
 			 * @since 1.0
1739 1738
 			 */
1740
-			do_action( 'give_after_terms' );
1739
+			do_action('give_after_terms');
1741 1740
 			?>
1742 1741
 		</div>
1743 1742
 		<div id="give_show_terms">
1744 1743
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1745
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1744
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1746 1745
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1747
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1746
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1748 1747
 		</div>
1749 1748
 
1750 1749
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1755,7 +1754,7 @@  discard block
 block discarded – undo
1755 1754
 	<?php
1756 1755
 }
1757 1756
 
1758
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1757
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1759 1758
 
1760 1759
 /**
1761 1760
  * Checkout Final Total.
@@ -1768,14 +1767,13 @@  discard block
 block discarded – undo
1768 1767
  *
1769 1768
  * @return void
1770 1769
  */
1771
-function give_checkout_final_total( $form_id ) {
1770
+function give_checkout_final_total($form_id) {
1772 1771
 
1773
-	$total = isset( $_POST['give_total'] ) ?
1774
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1775
-		give_get_default_form_amount( $form_id );
1772
+	$total = isset($_POST['give_total']) ?
1773
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1776 1774
 
1777 1775
 	// Only proceed if give_total available.
1778
-	if ( empty( $total ) ) {
1776
+	if (empty($total)) {
1779 1777
 		return;
1780 1778
 	}
1781 1779
 	?>
@@ -1786,21 +1784,21 @@  discard block
 block discarded – undo
1786 1784
 		 *
1787 1785
 		 * @since 2.0.5
1788 1786
 		 */
1789
-		do_action( 'give_donation_final_total_label_before', $form_id );
1787
+		do_action('give_donation_final_total_label_before', $form_id);
1790 1788
 		?>
1791 1789
 		<span class="give-donation-total-label">
1792
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1790
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1793 1791
 		</span>
1794 1792
 		<span class="give-final-total-amount"
1795
-		      data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1793
+		      data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1796 1794
 			<?php
1797 1795
 			echo give_currency_filter(
1798 1796
 				give_format_amount(
1799 1797
 					$total, array(
1800 1798
 						'sanitize' => false,
1801
-						'currency' => give_get_currency( $form_id ),
1799
+						'currency' => give_get_currency($form_id),
1802 1800
 					)
1803
-				), array( 'currency_code' => give_get_currency( $form_id ) )
1801
+				), array('currency_code' => give_get_currency($form_id))
1804 1802
 			);
1805 1803
 			?>
1806 1804
 		</span>
@@ -1810,13 +1808,13 @@  discard block
 block discarded – undo
1810 1808
 		 *
1811 1809
 		 * @since 2.0.5
1812 1810
 		 */
1813
-		do_action( 'give_donation_final_total_label_after', $form_id );
1811
+		do_action('give_donation_final_total_label_after', $form_id);
1814 1812
 		?>
1815 1813
 	</p>
1816 1814
 	<?php
1817 1815
 }
1818 1816
 
1819
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1817
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1820 1818
 
1821 1819
 /**
1822 1820
  * Renders the Checkout Submit section.
@@ -1828,7 +1826,7 @@  discard block
 block discarded – undo
1828 1826
  *
1829 1827
  * @return void
1830 1828
  */
1831
-function give_checkout_submit( $form_id, $args ) {
1829
+function give_checkout_submit($form_id, $args) {
1832 1830
 	?>
1833 1831
 	<fieldset id="give_purchase_submit" class="give-donation-submit">
1834 1832
 		<?php
@@ -1837,24 +1835,24 @@  discard block
 block discarded – undo
1837 1835
 		 *
1838 1836
 		 * @since 1.7
1839 1837
 		 */
1840
-		do_action( 'give_donation_form_before_submit', $form_id, $args );
1838
+		do_action('give_donation_form_before_submit', $form_id, $args);
1841 1839
 
1842
-		give_checkout_hidden_fields( $form_id );
1840
+		give_checkout_hidden_fields($form_id);
1843 1841
 
1844
-		echo give_get_donation_form_submit_button( $form_id );
1842
+		echo give_get_donation_form_submit_button($form_id);
1845 1843
 
1846 1844
 		/**
1847 1845
 		 * Fire after donation form submit.
1848 1846
 		 *
1849 1847
 		 * @since 1.7
1850 1848
 		 */
1851
-		do_action( 'give_donation_form_after_submit', $form_id, $args );
1849
+		do_action('give_donation_form_after_submit', $form_id, $args);
1852 1850
 		?>
1853 1851
 	</fieldset>
1854 1852
 	<?php
1855 1853
 }
1856 1854
 
1857
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2 );
1855
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2);
1858 1856
 
1859 1857
 /**
1860 1858
  * Give Donation form submit button.
@@ -1865,10 +1863,10 @@  discard block
 block discarded – undo
1865 1863
  *
1866 1864
  * @return string
1867 1865
  */
1868
-function give_get_donation_form_submit_button( $form_id ) {
1866
+function give_get_donation_form_submit_button($form_id) {
1869 1867
 
1870
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1871
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1868
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1869
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1872 1870
 	ob_start();
1873 1871
 	?>
1874 1872
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1877,7 +1875,7 @@  discard block
 block discarded – undo
1877 1875
 		<span class="give-loading-animation"></span>
1878 1876
 	</div>
1879 1877
 	<?php
1880
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1878
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1881 1879
 }
1882 1880
 
1883 1881
 /**
@@ -1892,7 +1890,7 @@  discard block
 block discarded – undo
1892 1890
  *
1893 1891
  * @return mixed
1894 1892
  */
1895
-function give_show_goal_progress( $form_id, $args = array() ) {
1893
+function give_show_goal_progress($form_id, $args = array()) {
1896 1894
 
1897 1895
 	ob_start();
1898 1896
 	give_get_template(
@@ -1907,12 +1905,12 @@  discard block
 block discarded – undo
1907 1905
 	 *
1908 1906
 	 * @since 2.0
1909 1907
 	 */
1910
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1908
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1911 1909
 
1912 1910
 	return true;
1913 1911
 }
1914 1912
 
1915
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1913
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1916 1914
 
1917 1915
 /**
1918 1916
  * Show Give Totals Progress.
@@ -1924,10 +1922,10 @@  discard block
 block discarded – undo
1924 1922
  *
1925 1923
  * @return mixed
1926 1924
  */
1927
-function give_show_goal_totals_progress( $total, $total_goal ) {
1925
+function give_show_goal_totals_progress($total, $total_goal) {
1928 1926
 
1929 1927
 	// Bail out if total goal is set as an array.
1930
-	if ( isset( $total_goal ) && is_array( $total_goal ) ) {
1928
+	if (isset($total_goal) && is_array($total_goal)) {
1931 1929
 		return false;
1932 1930
 	}
1933 1931
 
@@ -1939,12 +1937,12 @@  discard block
 block discarded – undo
1939 1937
 		)
1940 1938
 	);
1941 1939
 
1942
-	echo apply_filters( 'give_total_progress_output', ob_get_clean() );
1940
+	echo apply_filters('give_total_progress_output', ob_get_clean());
1943 1941
 
1944 1942
 	return true;
1945 1943
 }
1946 1944
 
1947
-add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 );
1945
+add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2);
1948 1946
 
1949 1947
 /**
1950 1948
  * Get form content position.
@@ -1956,10 +1954,10 @@  discard block
 block discarded – undo
1956 1954
  *
1957 1955
  * @return mixed|string
1958 1956
  */
1959
-function give_get_form_content_placement( $form_id, $args ) {
1957
+function give_get_form_content_placement($form_id, $args) {
1960 1958
 	$show_content = '';
1961 1959
 
1962
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1960
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1963 1961
 		// Content positions.
1964 1962
 		$content_placement = array(
1965 1963
 			'above' => 'give_pre_form',
@@ -1967,18 +1965,18 @@  discard block
 block discarded – undo
1967 1965
 		);
1968 1966
 
1969 1967
 		// Check if content position already decoded.
1970
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1968
+		if (in_array($args['show_content'], $content_placement)) {
1971 1969
 			return $args['show_content'];
1972 1970
 		}
1973 1971
 
1974
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1972
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1975 1973
 
1976
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1977
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1974
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1975
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1978 1976
 
1979
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1977
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1980 1978
 		// Backward compatibility for _give_content_option for v18.
1981
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1979
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1982 1980
 	}
1983 1981
 
1984 1982
 	return $show_content;
@@ -1994,20 +1992,20 @@  discard block
 block discarded – undo
1994 1992
  *
1995 1993
  * @return void|bool
1996 1994
  */
1997
-function give_form_content( $form_id, $args ) {
1995
+function give_form_content($form_id, $args) {
1998 1996
 
1999
-	$show_content = give_get_form_content_placement( $form_id, $args );
1997
+	$show_content = give_get_form_content_placement($form_id, $args);
2000 1998
 
2001 1999
 	// Bailout.
2002
-	if ( empty( $show_content ) ) {
2000
+	if (empty($show_content)) {
2003 2001
 		return false;
2004 2002
 	}
2005 2003
 
2006 2004
 	// Add action according to value.
2007
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
2005
+	add_action($show_content, 'give_form_display_content', 10, 2);
2008 2006
 }
2009 2007
 
2010
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
2008
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
2011 2009
 
2012 2010
 /**
2013 2011
  * Renders Post Form Content.
@@ -2021,14 +2019,14 @@  discard block
 block discarded – undo
2021 2019
  *
2022 2020
  * @return void
2023 2021
  */
2024
-function give_form_display_content( $form_id, $args ) {
2025
-	$content      = give_get_meta( $form_id, '_give_form_content', true );
2026
-	$show_content = give_get_form_content_placement( $form_id, $args );
2022
+function give_form_display_content($form_id, $args) {
2023
+	$content      = give_get_meta($form_id, '_give_form_content', true);
2024
+	$show_content = give_get_form_content_placement($form_id, $args);
2027 2025
 
2028
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
2029
-		$content = apply_filters( 'the_content', $content );
2026
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
2027
+		$content = apply_filters('the_content', $content);
2030 2028
 	} else {
2031
-		$content = wpautop( do_shortcode( $content ) );
2029
+		$content = wpautop(do_shortcode($content));
2032 2030
 	}
2033 2031
 
2034 2032
 	$output = sprintf(
@@ -2047,11 +2045,11 @@  discard block
 block discarded – undo
2047 2045
 	 * @param int    $form_id
2048 2046
 	 * @param array  $args
2049 2047
 	 */
2050
-	echo apply_filters( 'give_form_content_output', $output, $form_id, $args );
2048
+	echo apply_filters('give_form_content_output', $output, $form_id, $args);
2051 2049
 
2052 2050
 	// remove action to prevent content output on addition forms on page.
2053 2051
 	// @see: https://github.com/WordImpress/Give/issues/634.
2054
-	remove_action( $show_content, 'give_form_display_content' );
2052
+	remove_action($show_content, 'give_form_display_content');
2055 2053
 }
2056 2054
 
2057 2055
 /**
@@ -2063,7 +2061,7 @@  discard block
 block discarded – undo
2063 2061
  *
2064 2062
  * @return void
2065 2063
  */
2066
-function give_checkout_hidden_fields( $form_id ) {
2064
+function give_checkout_hidden_fields($form_id) {
2067 2065
 
2068 2066
 	/**
2069 2067
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -2072,14 +2070,14 @@  discard block
 block discarded – undo
2072 2070
 	 *
2073 2071
 	 * @param int $form_id The form ID.
2074 2072
 	 */
2075
-	do_action( 'give_hidden_fields_before', $form_id );
2073
+	do_action('give_hidden_fields_before', $form_id);
2076 2074
 
2077
-	if ( is_user_logged_in() ) {
2075
+	if (is_user_logged_in()) {
2078 2076
 		?>
2079 2077
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
2080 2078
 	<?php } ?>
2081 2079
 	<input type="hidden" name="give_action" value="purchase"/>
2082
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
2080
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
2083 2081
 	<?php
2084 2082
 	/**
2085 2083
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -2088,7 +2086,7 @@  discard block
 block discarded – undo
2088 2086
 	 *
2089 2087
 	 * @param int $form_id The form ID.
2090 2088
 	 */
2091
-	do_action( 'give_hidden_fields_after', $form_id );
2089
+	do_action('give_hidden_fields_after', $form_id);
2092 2090
 
2093 2091
 }
2094 2092
 
@@ -2103,20 +2101,20 @@  discard block
 block discarded – undo
2103 2101
  *
2104 2102
  * @return string $content Filtered content.
2105 2103
  */
2106
-function give_filter_success_page_content( $content ) {
2104
+function give_filter_success_page_content($content) {
2107 2105
 
2108 2106
 	$give_options = give_get_settings();
2109 2107
 
2110
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
2111
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
2112
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
2108
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
2109
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
2110
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
2113 2111
 		}
2114 2112
 	}
2115 2113
 
2116 2114
 	return $content;
2117 2115
 }
2118 2116
 
2119
-add_filter( 'the_content', 'give_filter_success_page_content' );
2117
+add_filter('the_content', 'give_filter_success_page_content');
2120 2118
 
2121 2119
 /**
2122 2120
  * Test Mode Frontend Warning.
@@ -2127,12 +2125,12 @@  discard block
 block discarded – undo
2127 2125
  */
2128 2126
 function give_test_mode_frontend_warning() {
2129 2127
 
2130
-	if ( give_is_test_mode() ) {
2131
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
2128
+	if (give_is_test_mode()) {
2129
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
2132 2130
 	}
2133 2131
 }
2134 2132
 
2135
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
2133
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
2136 2134
 
2137 2135
 /**
2138 2136
  * Members-only Form.
@@ -2146,21 +2144,21 @@  discard block
 block discarded – undo
2146 2144
  *
2147 2145
  * @return string
2148 2146
  */
2149
-function give_members_only_form( $final_output, $args ) {
2147
+function give_members_only_form($final_output, $args) {
2150 2148
 
2151
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
2149
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
2152 2150
 
2153 2151
 	// Sanity Check: Must have form_id & not be logged in.
2154
-	if ( empty( $form_id ) || is_user_logged_in() ) {
2152
+	if (empty($form_id) || is_user_logged_in()) {
2155 2153
 		return $final_output;
2156 2154
 	}
2157 2155
 
2158 2156
 	// Logged in only and Register / Login set to none.
2159
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
2157
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
2160 2158
 
2161
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
2159
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
2162 2160
 
2163
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
2161
+		return apply_filters('give_members_only_output', $final_output, $form_id);
2164 2162
 
2165 2163
 	}
2166 2164
 
@@ -2168,7 +2166,7 @@  discard block
 block discarded – undo
2168 2166
 
2169 2167
 }
2170 2168
 
2171
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
2169
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
2172 2170
 
2173 2171
 
2174 2172
 /**
@@ -2180,40 +2178,40 @@  discard block
 block discarded – undo
2180 2178
  * @param array            $args
2181 2179
  * @param Give_Donate_Form $form
2182 2180
  */
2183
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
2184
-	$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : '';
2181
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
2182
+	$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : '';
2185 2183
 	?>
2186 2184
 	<input type="hidden" name="give-form-id-prefix" value="<?php echo $id_prefix; ?>"/>
2187
-	<input type="hidden" name="give-form-id" value="<?php echo intval( $form_id ); ?>"/>
2188
-	<input type="hidden" name="give-form-title" value="<?php echo esc_html( $form->post_title ); ?>"/>
2189
-	<input type="hidden" name="give-current-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
2190
-	<input type="hidden" name="give-form-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
2185
+	<input type="hidden" name="give-form-id" value="<?php echo intval($form_id); ?>"/>
2186
+	<input type="hidden" name="give-form-title" value="<?php echo esc_html($form->post_title); ?>"/>
2187
+	<input type="hidden" name="give-current-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
2188
+	<input type="hidden" name="give-form-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
2191 2189
 	<?php
2192 2190
 	// Get the custom option amount.
2193
-	$custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
2191
+	$custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
2194 2192
 
2195 2193
 	// If custom amount enabled.
2196
-	if ( give_is_setting_enabled( $custom_amount ) ) {
2194
+	if (give_is_setting_enabled($custom_amount)) {
2197 2195
 		?>
2198 2196
 		<input type="hidden" name="give-form-minimum"
2199
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/>
2197
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/>
2200 2198
 		<input type="hidden" name="give-form-maximum"
2201
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/>
2199
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/>
2202 2200
 		<?php
2203 2201
 	}
2204 2202
 
2205 2203
 	// WP nonce field.
2206 2204
 	echo str_replace(
2207 2205
 		'/>',
2208
-		'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>',
2209
-		give_get_nonce_field( "give_donation_form_nonce_{$form_id}", 'give-form-hash', false )
2206
+		'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>',
2207
+		give_get_nonce_field("give_donation_form_nonce_{$form_id}", 'give-form-hash', false)
2210 2208
 	);
2211 2209
 
2212 2210
 	// Price ID hidden field for variable (multi-level) donation forms.
2213
-	if ( give_has_variable_prices( $form_id ) ) {
2211
+	if (give_has_variable_prices($form_id)) {
2214 2212
 		// Get the default price ID.
2215
-		$default_price = give_form_get_default_level( $form_id );
2216
-		$price_id      = isset( $default_price['_give_id']['level_id'] ) ? $default_price['_give_id']['level_id'] : 0;
2213
+		$default_price = give_form_get_default_level($form_id);
2214
+		$price_id      = isset($default_price['_give_id']['level_id']) ? $default_price['_give_id']['level_id'] : 0;
2217 2215
 
2218 2216
 		echo sprintf(
2219 2217
 			'<input type="hidden" name="give-price-id" value="%s"/>',
@@ -2222,7 +2220,7 @@  discard block
 block discarded – undo
2222 2220
 	}
2223 2221
 }
2224 2222
 
2225
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
2223
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
2226 2224
 
2227 2225
 /**
2228 2226
  * Add currency settings on donation form.
@@ -2234,20 +2232,20 @@  discard block
 block discarded – undo
2234 2232
  *
2235 2233
  * @return array
2236 2234
  */
2237
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
2238
-	$form_currency     = give_get_currency( $form->ID );
2239
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
2235
+function __give_form_add_currency_settings($form_html_tags, $form) {
2236
+	$form_currency     = give_get_currency($form->ID);
2237
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
2240 2238
 
2241 2239
 	// Check if currency exist.
2242
-	if ( empty( $currency_settings ) ) {
2240
+	if (empty($currency_settings)) {
2243 2241
 		return $form_html_tags;
2244 2242
 	}
2245 2243
 
2246
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
2244
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
2247 2245
 	$form_html_tags['data-currency_code']   = $form_currency;
2248 2246
 
2249
-	if ( ! empty( $currency_settings ) ) {
2250
-		foreach ( $currency_settings as $key => $value ) {
2247
+	if ( ! empty($currency_settings)) {
2248
+		foreach ($currency_settings as $key => $value) {
2251 2249
 			$form_html_tags["data-{$key}"] = $value;
2252 2250
 		}
2253 2251
 	}
@@ -2255,7 +2253,7 @@  discard block
 block discarded – undo
2255 2253
 	return $form_html_tags;
2256 2254
 }
2257 2255
 
2258
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
2256
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
2259 2257
 
2260 2258
 /**
2261 2259
  * Adds classes to progress bar container.
@@ -2266,7 +2264,7 @@  discard block
 block discarded – undo
2266 2264
  *
2267 2265
  * @return string
2268 2266
  */
2269
-function add_give_goal_progress_class( $class_goal ) {
2267
+function add_give_goal_progress_class($class_goal) {
2270 2268
 	$class_goal = 'progress progress-striped active';
2271 2269
 
2272 2270
 	return $class_goal;
@@ -2281,7 +2279,7 @@  discard block
 block discarded – undo
2281 2279
  *
2282 2280
  * @return string
2283 2281
  */
2284
-function add_give_goal_progress_bar_class( $class_bar ) {
2282
+function add_give_goal_progress_bar_class($class_bar) {
2285 2283
 	$class_bar = 'bar';
2286 2284
 
2287 2285
 	return $class_bar;
@@ -2298,12 +2296,12 @@  discard block
 block discarded – undo
2298 2296
  *
2299 2297
  * @return array
2300 2298
  */
2301
-function add_class_for_form_grid( $class, $id, $args ) {
2299
+function add_class_for_form_grid($class, $id, $args) {
2302 2300
 	$class[] = 'give-form-grid-wrap';
2303 2301
 
2304
-	foreach ( $class as $index => $item ) {
2305
-		if ( false !== strpos( $item, 'give-display-' ) ) {
2306
-			unset( $class[ $index ] );
2302
+	foreach ($class as $index => $item) {
2303
+		if (false !== strpos($item, 'give-display-')) {
2304
+			unset($class[$index]);
2307 2305
 		}
2308 2306
 	}
2309 2307
 
@@ -2319,7 +2317,7 @@  discard block
 block discarded – undo
2319 2317
  *
2320 2318
  * @since 2.1
2321 2319
  */
2322
-function give_is_form_grid_page_hidden_field( $id, $args, $form ) {
2320
+function give_is_form_grid_page_hidden_field($id, $args, $form) {
2323 2321
 	echo '<input type="hidden" name="is-form-grid" value="true" />';
2324 2322
 }
2325 2323
 
@@ -2334,18 +2332,18 @@  discard block
 block discarded – undo
2334 2332
  * @since 2.1
2335 2333
  * @return string
2336 2334
  */
2337
-function give_redirect_and_popup_form( $redirect, $args ) {
2335
+function give_redirect_and_popup_form($redirect, $args) {
2338 2336
 
2339 2337
 	// Check the page has Form Grid.
2340
-	$is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : '';
2338
+	$is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : '';
2341 2339
 
2342
-	if ( 'true' === $is_form_grid ) {
2340
+	if ('true' === $is_form_grid) {
2343 2341
 
2344
-		$payment_mode = give_clean( $_POST['payment-mode'] );
2342
+		$payment_mode = give_clean($_POST['payment-mode']);
2345 2343
 		$form_id      = $args['form-id'];
2346 2344
 
2347 2345
 		// Get the URL without Query parameters.
2348
-		$redirect = strtok( $redirect, '?' );
2346
+		$redirect = strtok($redirect, '?');
2349 2347
 
2350 2348
 		// Add query parameters 'form-id' and 'payment-mode'.
2351 2349
 		$redirect = add_query_arg(
@@ -2360,4 +2358,4 @@  discard block
 block discarded – undo
2360 2358
 	return $redirect;
2361 2359
 }
2362 2360
 
2363
-add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 );
2361
+add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1217,9 +1217,12 @@
 block discarded – undo
1217 1217
 					}
1218 1218
 					?>
1219 1219
 				</select>
1220
-			<?php else : ?>
1220
+			<?php else {
1221
+	: ?>
1221 1222
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1222
-				       placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/>
1223
+				       placeholder="<?php echo $label;
1224
+}
1225
+?>" value="<?php echo $selected_state; ?>"/>
1223 1226
 			<?php endif; ?>
1224 1227
 		</p>
1225 1228
 
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   +344 added lines, -344 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, false );
32
+function give_import_donation_report_update($value = array()) {
33
+	update_option('give_import_donation_report', $value, false);
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(), false );
42
+	update_option('give_import_donation_report', array(), false);
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,64 +310,64 @@  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
 
369 369
 	// update the report
370
-	give_import_donation_report_update( $report );
370
+	give_import_donation_report_update($report);
371 371
 
372 372
 	return $donor_data;
373 373
 }
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	 *
386 386
 	 * @return array
387 387
 	 */
388
-	return (array) apply_filters( 'give_import_default_options', array(
389
-		'' => __( 'Do not import', 'give' ),
390
-	) );
388
+	return (array) apply_filters('give_import_default_options', array(
389
+		'' => __('Do not import', 'give'),
390
+	));
391 391
 }
392 392
 
393 393
 /**
@@ -403,93 +403,93 @@  discard block
 block discarded – undo
403 403
 	 *
404 404
 	 * @return array
405 405
 	 */
406
-	return (array) apply_filters( 'give_import_donations_options', array(
407
-		'id'           => __( 'Donation ID', 'give' ),
406
+	return (array) apply_filters('give_import_donations_options', array(
407
+		'id'           => __('Donation ID', 'give'),
408 408
 		'amount'       => array(
409
-			__( 'Donation Amount', 'give' ),
410
-			__( 'Amount', 'give' ),
411
-			__( 'Donation Total', 'give' ),
412
-			__( 'Total', 'give' ),
409
+			__('Donation Amount', 'give'),
410
+			__('Amount', 'give'),
411
+			__('Donation Total', 'give'),
412
+			__('Total', 'give'),
413 413
 		),
414 414
 		'currency'     => array(
415
-			__( 'Donation Currencies', 'give' ),
416
-			__( 'Currencies', 'give' ),
417
-			__( 'Currencies Code', 'give' ),
418
-			__( 'Currency Code', 'give' ),
419
-			__( 'Code', 'give' ),
415
+			__('Donation Currencies', 'give'),
416
+			__('Currencies', 'give'),
417
+			__('Currencies Code', 'give'),
418
+			__('Currency Code', 'give'),
419
+			__('Code', 'give'),
420 420
 		),
421 421
 		'post_date'    => array(
422
-			__( 'Donation Date', 'give' ),
423
-			__( 'Date', 'give' ),
422
+			__('Donation Date', 'give'),
423
+			__('Date', 'give'),
424 424
 		),
425 425
 		'post_time'    => array(
426
-			__( 'Donation Time', 'give' ),
427
-			__( 'Time', 'give' ),
426
+			__('Donation Time', 'give'),
427
+			__('Time', 'give'),
428 428
 		),
429 429
 		'title_prefix' => array(
430
-			__( 'Title Prefix', 'give' ),
431
-			__( 'Prefix', 'give' ),
430
+			__('Title Prefix', 'give'),
431
+			__('Prefix', 'give'),
432 432
 		),
433 433
 		'first_name'   => array(
434
-			__( 'Donor First Name', 'give' ),
435
-			__( 'First Name', 'give' ),
436
-			__( 'Name', 'give' ),
437
-			__( 'First', 'give' ),
434
+			__('Donor First Name', 'give'),
435
+			__('First Name', 'give'),
436
+			__('Name', 'give'),
437
+			__('First', 'give'),
438 438
 		),
439 439
 		'last_name'    => array(
440
-			__( 'Donor Last Name', 'give' ),
441
-			__( 'Last Name', 'give' ),
442
-			__( 'Last', 'give' ),
440
+			__('Donor Last Name', 'give'),
441
+			__('Last Name', 'give'),
442
+			__('Last', 'give'),
443 443
 		),
444 444
 		'company_name' => array(
445
-			__( 'Company Name', 'give' ),
446
-			__( 'Donor Company Name', 'give' ),
447
-			__( 'Donor Company', 'give' ),
448
-			__( 'Company', 'give' ),
445
+			__('Company Name', 'give'),
446
+			__('Donor Company Name', 'give'),
447
+			__('Donor Company', 'give'),
448
+			__('Company', 'give'),
449 449
 		),
450 450
 		'line1'        => array(
451
-			__( 'Address 1', 'give' ),
452
-			__( 'Address', 'give' ),
451
+			__('Address 1', 'give'),
452
+			__('Address', 'give'),
453 453
 		),
454
-		'line2'        => __( 'Address 2', 'give' ),
455
-		'city'         => __( 'City', 'give' ),
454
+		'line2'        => __('Address 2', 'give'),
455
+		'city'         => __('City', 'give'),
456 456
 		'state'        => array(
457
-			__( 'State', 'give' ),
458
-			__( 'Province', 'give' ),
459
-			__( 'County', 'give' ),
460
-			__( 'Region', 'give' ),
457
+			__('State', 'give'),
458
+			__('Province', 'give'),
459
+			__('County', 'give'),
460
+			__('Region', 'give'),
461 461
 		),
462
-		'country'      => __( 'Country', 'give' ),
462
+		'country'      => __('Country', 'give'),
463 463
 		'zip'          => array(
464
-			__( 'Zip Code', 'give' ),
465
-			__( 'Zip', 'give' ),
466
-			__( 'zipcode', 'give' ),
467
-			__( 'Postal Code', 'give' ),
468
-			__( 'Postal', 'give' ),
464
+			__('Zip Code', 'give'),
465
+			__('Zip', 'give'),
466
+			__('zipcode', 'give'),
467
+			__('Postal Code', 'give'),
468
+			__('Postal', 'give'),
469 469
 		),
470 470
 		'email'        => array(
471
-			__( 'Donor Email', 'give' ),
472
-			__( 'Email', 'give' ),
473
-			__( 'Email Address', 'give' ),
471
+			__('Donor Email', 'give'),
472
+			__('Email', 'give'),
473
+			__('Email Address', 'give'),
474 474
 		),
475 475
 		'post_status'  => array(
476
-			__( 'Donation Status', 'give' ),
477
-			__( 'Status', 'give' ),
476
+			__('Donation Status', 'give'),
477
+			__('Status', 'give'),
478 478
 		),
479 479
 		'gateway'      => array(
480
-			__( 'Payment Method', 'give' ),
481
-			__( 'Method', 'give' ),
482
-			__( 'Payment Gateway', 'give' ),
483
-			__( 'Gateway', 'give' ),
480
+			__('Payment Method', 'give'),
481
+			__('Method', 'give'),
482
+			__('Payment Gateway', 'give'),
483
+			__('Gateway', 'give'),
484 484
 		),
485
-		'notes'        => __( 'Notes', 'give' ),
485
+		'notes'        => __('Notes', 'give'),
486 486
 		'mode'         => array(
487
-			__( 'Payment Mode', 'give' ),
488
-			__( 'Mode', 'give' ),
489
-			__( 'Test Mode', 'give' ),
487
+			__('Payment Mode', 'give'),
488
+			__('Mode', 'give'),
489
+			__('Test Mode', 'give'),
490 490
 		),
491
-		'post_meta'    => __( 'Import as Meta', 'give' ),
492
-	) );
491
+		'post_meta'    => __('Import as Meta', 'give'),
492
+	));
493 493
 }
494 494
 
495 495
 /**
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @return array
507 507
 	 */
508
-	return (array) apply_filters( 'give_import_donor_options', array(
509
-		'donor_id' => __( 'Donor ID', 'give' ),
510
-		'user_id'  => __( 'User ID', 'give' ),
511
-	) );
508
+	return (array) apply_filters('give_import_donor_options', array(
509
+		'donor_id' => __('Donor ID', 'give'),
510
+		'user_id'  => __('User ID', 'give'),
511
+	));
512 512
 }
513 513
 
514 514
 /**
@@ -524,29 +524,29 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @return array
526 526
 	 */
527
-	return (array) apply_filters( 'give_import_donation_form_options', array(
527
+	return (array) apply_filters('give_import_donation_form_options', array(
528 528
 		'form_title'              => array(
529
-			__( 'Donation Form Title', 'give' ),
530
-			__( 'Donation Form', 'give' ),
531
-			__( 'Form Name', 'give' ),
532
-			__( 'Title', 'give' ),
533
-			__( 'Form Title', 'give' ),
529
+			__('Donation Form Title', 'give'),
530
+			__('Donation Form', 'give'),
531
+			__('Form Name', 'give'),
532
+			__('Title', 'give'),
533
+			__('Form Title', 'give'),
534 534
 			'ignore' => array(
535
-				__( 'Title Prefix', 'give' ),
536
-				__( 'Prefix', 'give' ),
535
+				__('Title Prefix', 'give'),
536
+				__('Prefix', 'give'),
537 537
 			),
538 538
 		),
539 539
 		'form_id'                 => array(
540
-			__( 'Donation Form ID', 'give' ),
541
-			__( 'Form ID', 'give' ),
540
+			__('Donation Form ID', 'give'),
541
+			__('Form ID', 'give'),
542 542
 		),
543 543
 		'form_level'              => array(
544
-			__( 'Donation Level', 'give' ),
545
-			__( 'Level', 'give' ),
546
-			__( 'Level Title', 'give' ),
544
+			__('Donation Level', 'give'),
545
+			__('Level', 'give'),
546
+			__('Level Title', 'give'),
547 547
 		),
548
-		'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ),
549
-	) );
548
+		'form_custom_amount_text' => __('Custom Amount Text', 'give'),
549
+	));
550 550
 }
551 551
 
552 552
 /**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
  *
560 560
  * @return array
561 561
  */
562
-function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = 'csv' ) {
562
+function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = 'csv') {
563 563
 	/**
564 564
 	 * Filter to modify delimiter of Import
565 565
 	 *
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 * @return string $delimiter
571 571
 	 */
572
-	$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
572
+	$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
573 573
 
574
-	$file_dir = give_get_file_data_by_file_id( $file_id );
574
+	$file_dir = give_get_file_data_by_file_id($file_id);
575 575
 
576
-	return give_get_raw_data_from_file( $file_dir, $start, $end, $delimiter );
576
+	return give_get_raw_data_from_file($file_dir, $start, $end, $delimiter);
577 577
 }
578 578
 
579 579
 /**
@@ -588,18 +588,18 @@  discard block
 block discarded – undo
588 588
  *
589 589
  * @return array
590 590
  */
591
-function give_get_raw_data_from_file( $file_dir, $start, $end, $delimiter ) {
591
+function give_get_raw_data_from_file($file_dir, $start, $end, $delimiter) {
592 592
 	$raw_data = array();
593 593
 
594 594
 	$count    = 0;
595
-	if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
596
-		while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) {
597
-			if ( $count >= $start && $count <= $end ) {
595
+	if (false !== ($handle = fopen($file_dir, 'r'))) {
596
+		while (false !== ($row = fgetcsv($handle, 0, $delimiter))) {
597
+			if ($count >= $start && $count <= $end) {
598 598
 				$raw_data[] = $row;
599 599
 			}
600
-			$count ++;
600
+			$count++;
601 601
 		}
602
-		fclose( $handle );
602
+		fclose($handle);
603 603
 	}
604 604
 
605 605
 	return $raw_data;
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
  *
615 615
  * @return false|string file content
616 616
  */
617
-function give_get_file_data_by_file_id( $file_id ) {
618
-	return get_attached_file( $file_id );
617
+function give_get_file_data_by_file_id($file_id) {
618
+	return get_attached_file($file_id);
619 619
 }
620 620
 
621 621
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
  *
629 629
  * @return bool
630 630
  */
631
-function give_log_user_in_on_register_callback( $value ) {
631
+function give_log_user_in_on_register_callback($value) {
632 632
 	return false;
633 633
 }
634 634
 
@@ -644,87 +644,87 @@  discard block
 block discarded – undo
644 644
  *
645 645
  * @return bool
646 646
  */
647
-function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) {
648
-	$data                          = array_combine( $raw_key, $row_data );
647
+function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) {
648
+	$data                          = array_combine($raw_key, $row_data);
649 649
 	$price_id                      = false;
650 650
 	$donor_id                      = 0;
651 651
 	$donor_data                    = array();
652 652
 	$form                          = array();
653
-	$import_setting['create_user'] = isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1;
654
-	$dry_run                       = isset( $import_setting['dry_run'] ) ? $import_setting['dry_run'] : false;
653
+	$import_setting['create_user'] = isset($import_setting['create_user']) ? $import_setting['create_user'] : 1;
654
+	$dry_run                       = isset($import_setting['dry_run']) ? $import_setting['dry_run'] : false;
655 655
 	$_dry_run_is_duplicate         = false;
656 656
 	$dry_run_duplicate_form        = false;
657 657
 	$dry_run_duplicate_donor       = false;
658
-	$donation_key                  = empty( $import_setting['donation_key'] ) ? 1 : (int) $import_setting['donation_key'];
658
+	$donation_key                  = empty($import_setting['donation_key']) ? 1 : (int) $import_setting['donation_key'];
659 659
 	$payment_id                    = false;
660 660
 
661
-	$data = (array) apply_filters( 'give_save_import_donation_to_db', $data );
661
+	$data = (array) apply_filters('give_save_import_donation_to_db', $data);
662 662
 
663
-	$data['amount'] = give_maybe_sanitize_amount( $data['amount'] );
663
+	$data['amount'] = give_maybe_sanitize_amount($data['amount']);
664 664
 	$diff           = array();
665 665
 
666
-	if ( ! empty( $dry_run ) && 1 !== $donation_key ) {
667
-		$csv_raw_data = empty( $import_setting['csv_raw_data'] ) ? array() : $import_setting['csv_raw_data'];
668
-		$donors_list  = empty( $import_setting['donors_list'] ) ? array() : $import_setting['donors_list'];
666
+	if ( ! empty($dry_run) && 1 !== $donation_key) {
667
+		$csv_raw_data = empty($import_setting['csv_raw_data']) ? array() : $import_setting['csv_raw_data'];
668
+		$donors_list  = empty($import_setting['donors_list']) ? array() : $import_setting['donors_list'];
669 669
 		$key          = $donation_key - 1;
670
-		for ( $i = 0; $i < $key; $i ++ ) {
671
-			$csv_data           = array_combine( $raw_key, $csv_raw_data[ $i ] );
672
-			$csv_data['amount'] = give_maybe_sanitize_amount( $csv_data['amount'] );
670
+		for ($i = 0; $i < $key; $i++) {
671
+			$csv_data           = array_combine($raw_key, $csv_raw_data[$i]);
672
+			$csv_data['amount'] = give_maybe_sanitize_amount($csv_data['amount']);
673 673
 			// check for duplicate donations
674
-			$diff = array_diff( $csv_data, $data );
675
-			if ( empty( $diff ) ) {
674
+			$diff = array_diff($csv_data, $data);
675
+			if (empty($diff)) {
676 676
 				$_dry_run_is_duplicate   = true;
677 677
 				$dry_run_duplicate_form  = true;
678 678
 				$dry_run_duplicate_donor = true;
679 679
 			} else {
680 680
 				// check for duplicate donation form with form id
681
-				if ( ! empty( $csv_data['form_id'] ) && ! empty( $data['form_id'] ) && $csv_data['form_id'] === $data['form_id'] ) {
682
-					$form    = new Give_Donate_Form( $data['form_id'] );
681
+				if ( ! empty($csv_data['form_id']) && ! empty($data['form_id']) && $csv_data['form_id'] === $data['form_id']) {
682
+					$form    = new Give_Donate_Form($data['form_id']);
683 683
 					$form_id = $form->get_ID();
684
-					if ( ! empty( $form_id ) ) {
684
+					if ( ! empty($form_id)) {
685 685
 						$dry_run_duplicate_form = true;
686 686
 					}
687 687
 				}
688 688
 				// check for duplicate donation form with form title
689
-				if ( empty( $dry_run_duplicate_form ) && ! empty( $csv_data['form_title'] ) && ! empty( $data['form_title'] ) && $csv_data['form_title'] === $data['form_title'] ) {
689
+				if (empty($dry_run_duplicate_form) && ! empty($csv_data['form_title']) && ! empty($data['form_title']) && $csv_data['form_title'] === $data['form_title']) {
690 690
 					$dry_run_duplicate_form = true;
691 691
 				}
692 692
 
693 693
 
694 694
 				// check for duplicate donor by donor id
695
-				if ( ! empty( $csv_data['donor_id'] ) && ! empty( $data['donor_id'] ) && $csv_data['donor_id'] === $data['donor_id'] ) {
696
-					$donor = array_search( (int) $data['donor_id'], array_column( 'id', $donors_list ) );
697
-					if ( ! empty( $donor ) ) {
695
+				if ( ! empty($csv_data['donor_id']) && ! empty($data['donor_id']) && $csv_data['donor_id'] === $data['donor_id']) {
696
+					$donor = array_search((int) $data['donor_id'], array_column('id', $donors_list));
697
+					if ( ! empty($donor)) {
698 698
 						$dry_run_duplicate_donor = true;
699 699
 					}
700 700
 				}
701 701
 
702 702
 				// check for duplicate donor by user id
703
-				if ( empty( $dry_run_duplicate_donor ) && ! empty( $csv_data['user_id'] ) && ! empty( $data['user_id'] ) && $csv_data['user_id'] === $data['user_id'] ) {
704
-					$donor = array_search( (int) $data['user_id'], array_column( 'user_id', $donors_list ) );
705
-					if ( ! empty( $donor ) ) {
703
+				if (empty($dry_run_duplicate_donor) && ! empty($csv_data['user_id']) && ! empty($data['user_id']) && $csv_data['user_id'] === $data['user_id']) {
704
+					$donor = array_search((int) $data['user_id'], array_column('user_id', $donors_list));
705
+					if ( ! empty($donor)) {
706 706
 						$dry_run_duplicate_donor = true;
707 707
 					} else {
708
-						$donor = get_user_by( 'id', $csv_data['user_id'] );
709
-						if ( ! empty( $donor->ID ) ) {
708
+						$donor = get_user_by('id', $csv_data['user_id']);
709
+						if ( ! empty($donor->ID)) {
710 710
 							$dry_run_duplicate_donor = true;
711 711
 						}
712 712
 					}
713 713
 				}
714 714
 
715 715
 				// check for duplicate donor by donor id
716
-				if ( empty( $dry_run_duplicate_donor ) && ! empty( $csv_data['email'] ) && ! empty( $data['email'] ) && $csv_data['email'] === $data['email'] ) {
716
+				if (empty($dry_run_duplicate_donor) && ! empty($csv_data['email']) && ! empty($data['email']) && $csv_data['email'] === $data['email']) {
717 717
 					$dry_run_duplicate_donor = true;
718 718
 				}
719 719
 			}
720 720
 		}
721 721
 	}
722 722
 
723
-	if ( empty( $dry_run_duplicate_donor ) ) {
723
+	if (empty($dry_run_duplicate_donor)) {
724 724
 		// Here come the login function.
725
-		$donor_data = give_import_get_user_from_csv( $data, $import_setting );
726
-		if ( empty( $dry_run ) ) {
727
-			if ( ! empty( $donor_data->id ) ) {
725
+		$donor_data = give_import_get_user_from_csv($data, $import_setting);
726
+		if (empty($dry_run)) {
727
+			if ( ! empty($donor_data->id)) {
728 728
 				$donor_id = $donor_data->id;
729 729
 			} else {
730 730
 				return $payment_id;
@@ -733,52 +733,52 @@  discard block
 block discarded – undo
733 733
 	} else {
734 734
 		// Get the report
735 735
 		$report                    = give_import_donation_report();
736
-		$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
736
+		$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
737 737
 		// update the report
738
-		give_import_donation_report_update( $report );
738
+		give_import_donation_report_update($report);
739 739
 	}
740 740
 
741
-	if ( empty( $dry_run_duplicate_form ) ) {
741
+	if (empty($dry_run_duplicate_form)) {
742 742
 		// get form data or register a form data.
743
-		$form = give_import_get_form_data_from_csv( $data, $import_setting );
744
-		if ( false == $form && empty( $dry_run ) ) {
743
+		$form = give_import_get_form_data_from_csv($data, $import_setting);
744
+		if (false == $form && empty($dry_run)) {
745 745
 			return $payment_id;
746 746
 		} else {
747
-			$price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false;
747
+			$price_id = ( ! empty($form->price_id)) ? $form->price_id : false;
748 748
 		}
749 749
 	} else {
750 750
 		// Get the report
751 751
 		$report                   = give_import_donation_report();
752
-		$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
752
+		$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
753 753
 		// update the report
754
-		give_import_donation_report_update( $report );
754
+		give_import_donation_report_update($report);
755 755
 	}
756 756
 
757 757
 	// Get the report
758 758
 	$report = give_import_donation_report();
759 759
 
760 760
 
761
-	$status  = give_import_donation_get_status( $data );
762
-	$country = ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' );
763
-	$state   = ( ! empty( $data['state'] ) ? ( ( $state_code = array_search( $data['state'], give_get_states( $country ) ) ) ? $state_code : $data['state'] ) : '' );
761
+	$status  = give_import_donation_get_status($data);
762
+	$country = ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : '');
763
+	$state   = ( ! empty($data['state']) ? (($state_code = array_search($data['state'], give_get_states($country))) ? $state_code : $data['state']) : '');
764 764
 
765 765
 	$address = array(
766
-		'line1'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ),
767
-		'line2'   => ( ! empty( $data['line2'] ) ? give_clean( $data['line2'] ) : '' ),
768
-		'city'    => ( ! empty( $data['city'] ) ? give_clean( $data['city'] ) : '' ),
769
-		'zip'     => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ),
766
+		'line1'   => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''),
767
+		'line2'   => ( ! empty($data['line2']) ? give_clean($data['line2']) : ''),
768
+		'city'    => ( ! empty($data['city']) ? give_clean($data['city']) : ''),
769
+		'zip'     => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''),
770 770
 		'state'   => $state,
771 771
 		'country' => $country,
772 772
 	);
773 773
 
774
-	$test_mode = array( 'test', 'true', );
775
-	$post_date = current_time( 'mysql' );
776
-	if ( ! empty( $data['post_date'] ) ) {
777
-		if ( ! empty( $data['post_time'] ) ) {
778
-			$post_date = mysql2date( 'Y-m-d', $data['post_date'] );
779
-			$post_date = mysql2date( 'Y-m-d H:i:s', $post_date . ' ' . $data['post_time'] );
774
+	$test_mode = array('test', 'true',);
775
+	$post_date = current_time('mysql');
776
+	if ( ! empty($data['post_date'])) {
777
+		if ( ! empty($data['post_time'])) {
778
+			$post_date = mysql2date('Y-m-d', $data['post_date']);
779
+			$post_date = mysql2date('Y-m-d H:i:s', $post_date.' '.$data['post_time']);
780 780
 		} else {
781
-			$post_date = mysql2date( 'Y-m-d H:i:s', $data['post_date'] );
781
+			$post_date = mysql2date('Y-m-d H:i:s', $data['post_date']);
782 782
 		}
783 783
 	}
784 784
 
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 		'donor_id'        => $donor_id,
788 788
 		'price'           => $data['amount'],
789 789
 		'status'          => $status,
790
-		'currency'        => ! empty( $data['currency'] ) && array_key_exists( $data['currency'], give_get_currencies_list() ) ? $data['currency'] : give_get_currency(),
790
+		'currency'        => ! empty($data['currency']) && array_key_exists($data['currency'], give_get_currencies_list()) ? $data['currency'] : give_get_currency(),
791 791
 		'user_info'       => array(
792 792
 			'id'         => $donor_id,
793
-			'email'      => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ),
794
-			'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 ) ),
795
-			'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 ) ),
793
+			'email'      => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)),
794
+			'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)),
795
+			'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)),
796 796
 			'address'    => $address,
797
-			'title'      => ! empty( $data['title_prefix'] ) ? $data['title_prefix'] : '',
797
+			'title'      => ! empty($data['title_prefix']) ? $data['title_prefix'] : '',
798 798
 		),
799
-		'gateway'         => ( ! empty( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ),
800
-		'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : ( method_exists( $form, 'get_name' ) ? $form->get_name() : '' ) ),
801
-		'give_form_id'    => method_exists( $form, 'get_ID' ) ? $form->get_ID() : '',
799
+		'gateway'         => ( ! empty($data['gateway']) ? strtolower($data['gateway']) : 'manual'),
800
+		'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : (method_exists($form, 'get_name') ? $form->get_name() : '')),
801
+		'give_form_id'    => method_exists($form, 'get_ID') ? $form->get_ID() : '',
802 802
 		'give_price_id'   => $price_id,
803
-		'purchase_key'    => strtolower( md5( uniqid() ) ),
803
+		'purchase_key'    => strtolower(md5(uniqid())),
804 804
 		'user_email'      => $data['email'],
805 805
 		'post_date'       => $post_date,
806
-		'mode'            => ( ! empty( $data['mode'] ) ? ( in_array( strtolower( $data['mode'] ), $test_mode ) ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ),
806
+		'mode'            => ( ! empty($data['mode']) ? (in_array(strtolower($data['mode']), $test_mode) ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))),
807 807
 	);
808 808
 
809 809
 	/**
@@ -818,76 +818,76 @@  discard block
 block discarded – undo
818 818
 	 *
819 819
 	 * @return array $payment_data payment data
820 820
 	 */
821
-	$payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form );
821
+	$payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form);
822 822
 
823 823
 	// Get the report
824 824
 	$report = give_import_donation_report();
825 825
 
826 826
 	// Check for duplicate code.
827
-	$donation_duplicate = give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data );
828
-	if ( false !== $donation_duplicate || ! empty( $_dry_run_is_duplicate ) ) {
829
-		$report['donation_details'][ $import_setting['donation_key'] ]['duplicate'] = $donation_duplicate;
830
-		$report['duplicate_donation']                                               = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 );
827
+	$donation_duplicate = give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data);
828
+	if (false !== $donation_duplicate || ! empty($_dry_run_is_duplicate)) {
829
+		$report['donation_details'][$import_setting['donation_key']]['duplicate'] = $donation_duplicate;
830
+		$report['duplicate_donation']                                               = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1);
831 831
 	} else {
832 832
 
833
-		if ( empty( $dry_run ) ) {
834
-			add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 );
835
-			add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 );
836
-			add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 );
837
-			add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 );
838
-			add_filter( 'give_is_stop_email_notification', '__return_true' );
833
+		if (empty($dry_run)) {
834
+			add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1);
835
+			add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2);
836
+			add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3);
837
+			add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2);
838
+			add_filter('give_is_stop_email_notification', '__return_true');
839 839
 
840 840
 			// 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.
841
-			if ( 'pending' !== $status ) {
842
-				unset( $payment_data['status'] );
841
+			if ('pending' !== $status) {
842
+				unset($payment_data['status']);
843 843
 			}
844 844
 
845
-			$payment_id = give_insert_payment( $payment_data );
846
-			remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 );
847
-			remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 );
848
-			remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 );
849
-			remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 );
850
-			remove_filter( 'give_is_stop_email_notification', '__return_true' );
845
+			$payment_id = give_insert_payment($payment_data);
846
+			remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1);
847
+			remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11);
848
+			remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11);
849
+			remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11);
850
+			remove_filter('give_is_stop_email_notification', '__return_true');
851 851
 
852
-			if ( $payment_id ) {
852
+			if ($payment_id) {
853 853
 
854
-				$payment = new Give_Payment( $payment_id );
854
+				$payment = new Give_Payment($payment_id);
855 855
 
856
-				$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
856
+				$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
857 857
 
858
-				$payment->update_meta( '_give_payment_import', true );
858
+				$payment->update_meta('_give_payment_import', true);
859 859
 
860
-				if ( ! empty( $import_setting['csv'] ) ) {
861
-					$payment->update_meta( '_give_payment_import_id', $import_setting['csv'] );
860
+				if ( ! empty($import_setting['csv'])) {
861
+					$payment->update_meta('_give_payment_import_id', $import_setting['csv']);
862 862
 				}
863 863
 
864 864
 				// Insert Company Name.
865
-				if ( ! empty( $data['company_name'] ) ) {
866
-					$payment->update_meta( '_give_donation_company', $data['company_name'] );
867
-					$donor_data->update_meta( '_give_donor_company', $data['company_name'] );
865
+				if ( ! empty($data['company_name'])) {
866
+					$payment->update_meta('_give_donation_company', $data['company_name']);
867
+					$donor_data->update_meta('_give_donor_company', $data['company_name']);
868 868
 				}
869 869
 
870 870
 				// Insert Notes.
871
-				if ( ! empty( $data['notes'] ) ) {
872
-					$payment->add_note( $data['notes'] );
871
+				if ( ! empty($data['notes'])) {
872
+					$payment->add_note($data['notes']);
873 873
 				}
874 874
 
875
-				$meta_exists = array_keys( $raw_key, 'post_meta' );
876
-				if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) {
877
-					foreach ( $meta_exists as $meta_exist ) {
878
-						if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) {
879
-							$payment->update_meta( $main_key[ $meta_exist ], $row_data[ $meta_exist ] );
875
+				$meta_exists = array_keys($raw_key, 'post_meta');
876
+				if ( ! empty($main_key) && ! empty($meta_exists)) {
877
+					foreach ($meta_exists as $meta_exist) {
878
+						if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) {
879
+							$payment->update_meta($main_key[$meta_exist], $row_data[$meta_exist]);
880 880
 						}
881 881
 					}
882 882
 				}
883 883
 
884 884
 				// update the donation status if it's other then pending
885
-				if ( 'pending' !== $status ) {
886
-					$payment->update_status( $status );
885
+				if ('pending' !== $status) {
886
+					$payment->update_status($status);
887 887
 				}
888 888
 
889 889
 			} else {
890
-				$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
890
+				$report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1);
891 891
 				$payment_id                = false;
892 892
 			}
893 893
 
@@ -902,15 +902,15 @@  discard block
 block discarded – undo
902 902
 			 * @param array $donor_data donor data
903 903
 			 * @param object $donor_data form object
904 904
 			 */
905
-			do_action( 'give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form );
905
+			do_action('give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form);
906 906
 		} else {
907
-			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
907
+			$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
908 908
 			$payment_id                = true;
909 909
 		}
910 910
 	}
911 911
 
912 912
 	// update the report
913
-	give_import_donation_report_update( $report );
913
+	give_import_donation_report_update($report);
914 914
 
915 915
 	return $payment_id;
916 916
 }
@@ -924,25 +924,25 @@  discard block
 block discarded – undo
924 924
  *
925 925
  * @return string $status Donation status.
926 926
  */
927
-function give_import_donation_get_status( $data ) {
928
-	if ( empty( $data['post_status'] ) ) {
927
+function give_import_donation_get_status($data) {
928
+	if (empty($data['post_status'])) {
929 929
 		return 'publish';
930 930
 	}
931 931
 
932 932
 	$status = 'publish';
933 933
 
934
-	$donation_status = trim( $data['post_status'] );
935
-	$donation_status_key      = strtolower( preg_replace( '/\s+/', '', $donation_status ) );
934
+	$donation_status = trim($data['post_status']);
935
+	$donation_status_key = strtolower(preg_replace('/\s+/', '', $donation_status));
936 936
 
937
-	foreach ( give_get_payment_statuses() as $key => $value ) {
937
+	foreach (give_get_payment_statuses() as $key => $value) {
938 938
 		$match = false;
939
-		if ( $key === $donation_status_key ) {
939
+		if ($key === $donation_status_key) {
940 940
 			$match = true;
941
-		} else if ( stristr( $donation_status, $value ) ) {
941
+		} else if (stristr($donation_status, $value)) {
942 942
 			$match = true;
943 943
 		}
944 944
 
945
-		if ( ! empty( $match ) ) {
945
+		if ( ! empty($match)) {
946 946
 			$status = $key;
947 947
 			break;
948 948
 		}
@@ -962,12 +962,12 @@  discard block
 block discarded – undo
962 962
  *
963 963
  * @return Give_Donor
964 964
  */
965
-function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) {
965
+function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) {
966 966
 	$old_donor = $donor;
967
-	if ( ! empty( $payment_data['donor_id'] ) ) {
968
-		$donor_id = absint( $payment_data['donor_id'] );
969
-		$donor    = new Give_Donor( $donor_id );
970
-		if ( ! empty( $donor->id ) ) {
967
+	if ( ! empty($payment_data['donor_id'])) {
968
+		$donor_id = absint($payment_data['donor_id']);
969
+		$donor    = new Give_Donor($donor_id);
970
+		if ( ! empty($donor->id)) {
971 971
 			return $donor;
972 972
 		}
973 973
 	}
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
  *
981 981
  * @since 1.8.13
982 982
  */
983
-function give_import_donation_insert_payment( $payment_id, $payment_data ) {
983
+function give_import_donation_insert_payment($payment_id, $payment_data) {
984 984
 	// Update Give Customers purchase_count
985
-	if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) {
986
-		$donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true );
987
-		if ( ! empty( $donor_id ) ) {
988
-			$donor = new Give_Donor( $donor_id );
985
+	if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) {
986
+		$donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true);
987
+		if ( ! empty($donor_id)) {
988
+			$donor = new Give_Donor($donor_id);
989 989
 			$donor->increase_purchase_count();
990 990
 		}
991 991
 	}
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
  *
997 997
  * @since 1.8.13
998 998
  */
999
-function give_donation_import_give_insert_payment_args( $args, $payment_data ) {
1000
-	if ( ! empty( $payment_data['user_info']['id'] ) ) {
999
+function give_donation_import_give_insert_payment_args($args, $payment_data) {
1000
+	if ( ! empty($payment_data['user_info']['id'])) {
1001 1001
 		$args['post_author'] = (int) $payment_data['user_info']['id'];
1002 1002
 	}
1003 1003
 
@@ -1009,11 +1009,11 @@  discard block
 block discarded – undo
1009 1009
  *
1010 1010
  * @since 1.8.13
1011 1011
  */
1012
-function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
1012
+function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) {
1013 1013
 	$return = false;
1014
-	if ( ! empty( $data['post_date'] ) ) {
1015
-		$post_date = mysql2date( 'Y-m-d-H-i-s', $payment_data['post_date'] );
1016
-		$post_date = explode( '-', $post_date );
1014
+	if ( ! empty($data['post_date'])) {
1015
+		$post_date = mysql2date('Y-m-d-H-i-s', $payment_data['post_date']);
1016
+		$post_date = explode('-', $post_date);
1017 1017
 		$args      = array(
1018 1018
 			'output'                 => 'post',
1019 1019
 			'cache_results'          => false,
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 			'meta_query'             => array(
1035 1035
 				array(
1036 1036
 					'key'     => '_give_payment_total',
1037
-					'value'   => preg_replace( '/[\$,]/', '', $payment_data['price'] ),
1037
+					'value'   => preg_replace('/[\$,]/', '', $payment_data['price']),
1038 1038
 					'compare' => 'LIKE',
1039 1039
 				),
1040 1040
 				array(
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 				),
1051 1051
 				array(
1052 1052
 					'key'     => '_give_payment_donor_id',
1053
-					'value'   => isset( $donor_data->id ) ? $donor_data->id : '',
1053
+					'value'   => isset($donor_data->id) ? $donor_data->id : '',
1054 1054
 					'compare' => '=',
1055 1055
 				),
1056 1056
 				array(
@@ -1061,9 +1061,9 @@  discard block
 block discarded – undo
1061 1061
 			),
1062 1062
 		);
1063 1063
 
1064
-		$payments  = new Give_Payments_Query( $args );
1064
+		$payments  = new Give_Payments_Query($args);
1065 1065
 		$donations = $payments->get_payments();
1066
-		if ( ! empty( $donations ) ) {
1066
+		if ( ! empty($donations)) {
1067 1067
 			$return = $donations;
1068 1068
 		}
1069 1069
 	}
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 *
1074 1074
 	 * @since 1.8.18
1075 1075
 	 */
1076
-	return apply_filters( 'give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data );
1076
+	return apply_filters('give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data);
1077 1077
 }
1078 1078
 
1079 1079
 /**
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
  *
1086 1086
  * @return void
1087 1087
  */
1088
-function give_donation_import_insert_default_payment_note( $payment_id ) {
1088
+function give_donation_import_insert_default_payment_note($payment_id) {
1089 1089
 	$current_user = wp_get_current_user();
1090
-	give_insert_payment_note( $payment_id, wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) );
1090
+	give_insert_payment_note($payment_id, wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email));
1091 1091
 }
1092 1092
 
1093 1093
 /**
@@ -1099,14 +1099,14 @@  discard block
 block discarded – undo
1099 1099
  *
1100 1100
  * @return string URL
1101 1101
  */
1102
-function give_import_page_url( $parameter = array() ) {
1102
+function give_import_page_url($parameter = array()) {
1103 1103
 	$defalut_query_arg = array(
1104 1104
 		'post_type'     => 'give_forms',
1105 1105
 		'page'          => 'give-tools',
1106 1106
 		'tab'           => 'import',
1107 1107
 		'importer-type' => 'import_donations',
1108 1108
 	);
1109
-	$import_query_arg  = wp_parse_args( $parameter, $defalut_query_arg );
1109
+	$import_query_arg = wp_parse_args($parameter, $defalut_query_arg);
1110 1110
 
1111
-	return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) );
1111
+	return add_query_arg($import_query_arg, admin_url('edit.php'));
1112 1112
 }
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   +48 added lines, -48 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,42 +120,42 @@  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 ) ) {
148
-				$donation_id_col = Give()->payment_meta->get_meta_type() . '_id';
147
+			if ( ! empty($payments)) {
148
+				$donation_id_col = Give()->payment_meta->get_meta_type().'_id';
149 149
 				$query = "SELECT {$donation_id_col} as id, meta_value as total
150 150
 					FROM {$wpdb->donationmeta}
151 151
 					WHERE meta_key='_give_payment_total'
152
-					AND {$donation_id_col} IN ('". implode( '\',\'', $payments ) ."')";
152
+					AND {$donation_id_col} IN ('".implode('\',\'', $payments)."')";
153 153
 
154 154
 				$payments = $wpdb->get_results($query, ARRAY_A);
155 155
 
156
-				if( ! empty( $payments ) ) {
157
-					foreach ( $payments as $payment ) {
158
-						$currency_code = give_get_payment_currency_code( $payment['id'] );
156
+				if ( ! empty($payments)) {
157
+					foreach ($payments as $payment) {
158
+						$currency_code = give_get_payment_currency_code($payment['id']);
159 159
 
160 160
 						/**
161 161
 						 * Filter the donation amount
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 						 */
166 166
 						$formatted_amount = apply_filters(
167 167
 							'give_donation_amount',
168
-							give_format_amount(  $payment['total'], array( 'donation_id' =>  $payment['id'] ) ),
168
+							give_format_amount($payment['total'], array('donation_id' =>  $payment['id'])),
169 169
 							$payment['total'],
170 170
 							$payment['id'],
171
-							array( 'type' => 'stats', 'currency'=> false, 'amount' => false )
171
+							array('type' => 'stats', 'currency'=> false, 'amount' => false)
172 172
 						);
173 173
 
174
-						$earnings += (float) give_maybe_sanitize_amount( $formatted_amount, array( 'currency' => $currency_code  ) );
174
+						$earnings += (float) give_maybe_sanitize_amount($formatted_amount, array('currency' => $currency_code));
175 175
 					}
176 176
 				}
177 177
 
178 178
 			}
179 179
 
180 180
 			// Cache the results for one hour.
181
-			Give_Cache::set( $key, give_sanitize_amount_for_db( $earnings ), 60 * 60 );
181
+			Give_Cache::set($key, give_sanitize_amount_for_db($earnings), 60 * 60);
182 182
 		}
183 183
 
184 184
 		/**
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 		 * @param  string|bool $end_date   Earning end date.
193 193
 		 * @param  string|bool $gateway_id Payment gateway id.
194 194
 		 */
195
-		$earnings = apply_filters( 'give_get_earnings', $earnings, $form_id, $start_date, $end_date, $gateway_id );
195
+		$earnings = apply_filters('give_get_earnings', $earnings, $form_id, $start_date, $end_date, $gateway_id);
196 196
 
197 197
 		//return earnings
198
-		return round( $earnings, give_get_price_decimals( $form_id ) );
198
+		return round($earnings, give_get_price_decimals($form_id));
199 199
 
200 200
 	}
201 201
 
@@ -212,17 +212,17 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return float|int                Total amount of donations based on the passed arguments.
214 214
 	 */
215
-	public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
215
+	public function get_earnings_cache_key($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) {
216 216
 
217
-		$this->setup_dates( $start_date, $end_date );
217
+		$this->setup_dates($start_date, $end_date);
218 218
 
219 219
 		// Make sure start date is valid
220
-		if ( is_wp_error( $this->start_date ) ) {
220
+		if (is_wp_error($this->start_date)) {
221 221
 			return $this->start_date;
222 222
 		}
223 223
 
224 224
 		// Make sure end date is valid
225
-		if ( is_wp_error( $this->end_date ) ) {
225
+		if (is_wp_error($this->end_date)) {
226 226
 			return $this->end_date;
227 227
 		}
228 228
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 			'start_date' => $this->start_date,
233 233
 			'end_date'   => $this->end_date,
234 234
 			'fields'     => 'ids',
235
-			'number'     => - 1,
235
+			'number'     => -1,
236 236
 		);
237 237
 
238 238
 
239 239
 		// Filter by Gateway ID meta_key
240
-		if ( $gateway_id ) {
240
+		if ($gateway_id) {
241 241
 			$args['meta_query'][] = array(
242 242
 				'key'   => '_give_payment_gateway',
243 243
 				'value' => $gateway_id,
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 		}
246 246
 
247 247
 		// Filter by Gateway ID meta_key
248
-		if ( $form_id ) {
248
+		if ($form_id) {
249 249
 			$args['meta_query'][] = array(
250 250
 				'key'   => '_give_payment_form_id',
251 251
 				'value' => $form_id,
252 252
 			);
253 253
 		}
254 254
 
255
-		if ( ! empty( $args['meta_query'] ) && 1 < count( $args['meta_query'] ) ) {
255
+		if ( ! empty($args['meta_query']) && 1 < count($args['meta_query'])) {
256 256
 			$args['meta_query']['relation'] = 'AND';
257 257
 		}
258 258
 
259
-		$args = apply_filters( 'give_stats_earnings_args', $args );
260
-		$key  = Give_Cache::get_key( 'give_stats', $args );
259
+		$args = apply_filters('give_stats_earnings_args', $args);
260
+		$key  = Give_Cache::get_key('give_stats', $args);
261 261
 
262 262
 		//return earnings
263 263
 		return $key;
@@ -275,17 +275,17 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return array       Best selling forms
277 277
 	 */
278
-	public function get_best_selling( $number = 10 ) {
278
+	public function get_best_selling($number = 10) {
279 279
 		global $wpdb;
280 280
 
281
-		$meta_table = __give_v20_bc_table_details( 'form' );
281
+		$meta_table = __give_v20_bc_table_details('form');
282 282
 
283
-		$give_forms = $wpdb->get_results( $wpdb->prepare(
283
+		$give_forms = $wpdb->get_results($wpdb->prepare(
284 284
 			"SELECT {$meta_table['column']['id']} as form_id, max(meta_value) as sales
285 285
 				FROM {$meta_table['name']} WHERE meta_key='_give_form_sales' AND meta_value > 0
286 286
 				GROUP BY meta_value+0
287 287
 				DESC LIMIT %d;", $number
288
-		) );
288
+		));
289 289
 
290 290
 		return $give_forms;
291 291
 	}
Please login to merge, or discard this patch.