Completed
Branch master (34b06a)
by Devin
20:06
created
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_do_automatic_upgrades() {
28 28
 	$did_upgrade  = false;
29
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
29
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
30 30
 
31
-	if ( ! $give_version ) {
31
+	if ( ! $give_version) {
32 32
 		// 1.0 is the first version to use this option so we must add it.
33 33
 		$give_version = '1.0';
34 34
 	}
35 35
 
36
-	switch ( true ) {
36
+	switch (true) {
37 37
 
38
-		case version_compare( $give_version, '1.6', '<' ) :
38
+		case version_compare($give_version, '1.6', '<') :
39 39
 			give_v16_upgrades();
40 40
 			$did_upgrade = true;
41 41
 
42
-		case version_compare( $give_version, '1.7', '<' ) :
42
+		case version_compare($give_version, '1.7', '<') :
43 43
 			give_v17_upgrades();
44 44
 			$did_upgrade = true;
45 45
 	}
46 46
 
47
-	if ( $did_upgrade ) {
48
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
47
+	if ($did_upgrade) {
48
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
49 49
 	}
50 50
 }
51 51
 
52
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
52
+add_action('admin_init', 'give_do_automatic_upgrades');
53 53
 
54 54
 /**
55 55
  * Display Upgrade Notices
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function give_show_upgrade_notices() {
61 61
 
62
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
62
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
63 63
 		return;
64 64
 	} // Don't show notices on the upgrades page
65 65
 
66
-	$give_version = get_option( 'give_version' );
66
+	$give_version = get_option('give_version');
67 67
 
68
-	if ( ! $give_version ) {
68
+	if ( ! $give_version) {
69 69
 		// 1.0 is the first version to use this option so we must add it
70 70
 		$give_version = '1.0';
71 71
 	}
72 72
 
73
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
73
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
74 74
 
75 75
 	/*
76 76
 	 *  NOTICE:
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 
83 83
 	//v1.3.2 Upgrades
84
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
84
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
85 85
 		printf(
86 86
 		/* translators: %s: upgrade URL */
87
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
88
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
87
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
88
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
89 89
 		);
90 90
 	}
91 91
 
92 92
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
93
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
93
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
94 94
 		printf(
95 95
 		/* translators: %s: upgrade URL */
96
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
97
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
96
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
97
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
98 98
 		);
99 99
 	}
100 100
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 }
106 106
 
107
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
107
+add_action('admin_notices', 'give_show_upgrade_notices');
108 108
 
109 109
 /**
110 110
  * Triggers all upgrade functions
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function give_trigger_upgrades() {
118 118
 
119
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
120
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
119
+	if ( ! current_user_can('manage_give_settings')) {
120
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
121 121
 	}
122 122
 
123
-	$give_version = get_option( 'give_version' );
123
+	$give_version = get_option('give_version');
124 124
 
125
-	if ( ! $give_version ) {
125
+	if ( ! $give_version) {
126 126
 		// 1.0 is the first version to use this option so we must add it
127 127
 		$give_version = '1.0';
128
-		add_option( 'give_version', $give_version );
128
+		add_option('give_version', $give_version);
129 129
 	}
130 130
 
131
-	update_option( 'give_version', GIVE_VERSION );
131
+	update_option('give_version', GIVE_VERSION);
132 132
 
133
-	if ( DOING_AJAX ) {
134
-		die( 'complete' );
133
+	if (DOING_AJAX) {
134
+		die('complete');
135 135
 	} // Let AJAX know that the upgrade is complete
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
138
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
139 139
 
140 140
 /**
141 141
  * Check if the upgrade routine has been run for a specific action
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool                   If the action has been added to the completed actions array
148 148
  */
149
-function give_has_upgrade_completed( $upgrade_action = '' ) {
149
+function give_has_upgrade_completed($upgrade_action = '') {
150 150
 
151
-	if ( empty( $upgrade_action ) ) {
151
+	if (empty($upgrade_action)) {
152 152
 		return false;
153 153
 	}
154 154
 
155 155
 	$completed_upgrades = give_get_completed_upgrades();
156 156
 
157
-	return in_array( $upgrade_action, $completed_upgrades );
157
+	return in_array($upgrade_action, $completed_upgrades);
158 158
 
159 159
 }
160 160
 
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return bool                   If the function was successfully added
169 169
  */
170
-function give_set_upgrade_complete( $upgrade_action = '' ) {
170
+function give_set_upgrade_complete($upgrade_action = '') {
171 171
 
172
-	if ( empty( $upgrade_action ) ) {
172
+	if (empty($upgrade_action)) {
173 173
 		return false;
174 174
 	}
175 175
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	$completed_upgrades[] = $upgrade_action;
178 178
 
179 179
 	// Remove any blanks, and only show uniques
180
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
180
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
181 181
 
182
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
182
+	return update_option('give_completed_upgrades', $completed_upgrades);
183 183
 }
184 184
 
185 185
 /**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function give_get_completed_upgrades() {
192 192
 
193
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
193
+	$completed_upgrades = get_option('give_completed_upgrades');
194 194
 
195
-	if ( false === $completed_upgrades ) {
195
+	if (false === $completed_upgrades) {
196 196
 		$completed_upgrades = array();
197 197
 	}
198 198
 
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function give_v132_upgrade_give_payment_customer_id() {
212 212
 	global $wpdb;
213
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
214
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
213
+	if ( ! current_user_can('manage_give_settings')) {
214
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
215 215
 	}
216 216
 
217
-	ignore_user_abort( true );
217
+	ignore_user_abort(true);
218 218
 
219
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-		@set_time_limit( 0 );
219
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+		@set_time_limit(0);
221 221
 	}
222 222
 
223 223
 	//UPDATE DB METAKEYS
224 224
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
225
-	$query = $wpdb->query( $sql );
225
+	$query = $wpdb->query($sql);
226 226
 
227
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
228
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
229
-	delete_option( 'give_doing_upgrade' );
230
-	wp_redirect( admin_url() );
227
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
228
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
229
+	delete_option('give_doing_upgrade');
230
+	wp_redirect(admin_url());
231 231
 	exit;
232 232
 
233 233
 
234 234
 }
235 235
 
236
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
236
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
237 237
 
238 238
 /**
239 239
  * Upgrades the Offline Status
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
 
248 248
 	global $wpdb;
249 249
 
250
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
251
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
250
+	if ( ! current_user_can('manage_give_settings')) {
251
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
252 252
 	}
253 253
 
254
-	ignore_user_abort( true );
254
+	ignore_user_abort(true);
255 255
 
256
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
257
-		@set_time_limit( 0 );
256
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
257
+		@set_time_limit(0);
258 258
 	}
259 259
 
260 260
 	// Get abandoned offline payments
@@ -264,35 +264,35 @@  discard block
 block discarded – undo
264 264
 	$where .= "AND ( p.post_status = 'abandoned' )";
265 265
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
266 266
 
267
-	$sql            = $select . $join . $where;
268
-	$found_payments = $wpdb->get_col( $sql );
267
+	$sql            = $select.$join.$where;
268
+	$found_payments = $wpdb->get_col($sql);
269 269
 
270 270
 
271
-	foreach ( $found_payments as $payment ) {
271
+	foreach ($found_payments as $payment) {
272 272
 
273 273
 		//Only change ones marked abandoned since our release last week
274 274
 		//because the admin may have marked some abandoned themselves
275
-		$modified_time = get_post_modified_time( 'U', false, $payment );
275
+		$modified_time = get_post_modified_time('U', false, $payment);
276 276
 
277 277
 		//1450124863 =  12/10/2015 20:42:25
278
-		if ( $modified_time >= 1450124863 ) {
278
+		if ($modified_time >= 1450124863) {
279 279
 
280
-			give_update_payment_status( $payment, 'pending' );
280
+			give_update_payment_status($payment, 'pending');
281 281
 
282 282
 		}
283 283
 
284 284
 	}
285 285
 
286
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
287
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
288
-	delete_option( 'give_doing_upgrade' );
289
-	wp_redirect( admin_url() );
286
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
287
+	give_set_upgrade_complete('upgrade_give_offline_status');
288
+	delete_option('give_doing_upgrade');
289
+	wp_redirect(admin_url());
290 290
 	exit;
291 291
 
292 292
 
293 293
 }
294 294
 
295
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
295
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
296 296
 
297 297
 /**
298 298
  * Cleanup User Roles
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
  */
304 304
 function give_v152_cleanup_users() {
305 305
 
306
-	$give_version = get_option( 'give_version' );
306
+	$give_version = get_option('give_version');
307 307
 
308
-	if ( ! $give_version ) {
308
+	if ( ! $give_version) {
309 309
 		// 1.0 is the first version to use this option so we must add it
310 310
 		$give_version = '1.0';
311 311
 	}
312 312
 
313
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
313
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
314 314
 
315 315
 	//v1.5.2 Upgrades
316
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
316
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
317 317
 
318 318
 		//Delete all caps with "ss"
319 319
 		//Also delete all unused "campaign" roles
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		global $wp_roles;
363
-		foreach ( $delete_caps as $cap ) {
364
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
365
-				$wp_roles->remove_cap( $role, $cap );
363
+		foreach ($delete_caps as $cap) {
364
+			foreach (array_keys($wp_roles->roles) as $role) {
365
+				$wp_roles->remove_cap($role, $cap);
366 366
 			}
367 367
 		}
368 368
 
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 		$roles->add_caps();
373 373
 
374 374
 		//The Update Ran
375
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
376
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
377
-		delete_option( 'give_doing_upgrade' );
375
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
376
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
377
+		delete_option('give_doing_upgrade');
378 378
 
379 379
 	}
380 380
 
381 381
 }
382 382
 
383
-add_action( 'admin_init', 'give_v152_cleanup_users' );
383
+add_action('admin_init', 'give_v152_cleanup_users');
384 384
 
385 385
 /**
386 386
  * 1.6 Upgrade routine to create the customer meta table.
@@ -418,53 +418,53 @@  discard block
 block discarded – undo
418 418
 
419 419
 	// Get addons license key.
420 420
 	$addons = array();
421
-	foreach ( $give_options as $key => $value ) {
422
-		if ( false !== strpos( $key, '_license_key' ) ) {
423
-			$addons[ $key ] = $value;
421
+	foreach ($give_options as $key => $value) {
422
+		if (false !== strpos($key, '_license_key')) {
423
+			$addons[$key] = $value;
424 424
 		}
425 425
 	}
426 426
 
427 427
 	// Bailout: We do not have any addon license data to upgrade.
428
-	if ( empty( $addons ) ) {
428
+	if (empty($addons)) {
429 429
 		return false;
430 430
 	}
431 431
 
432
-	foreach ( $addons as $key => $addon_license ) {
432
+	foreach ($addons as $key => $addon_license) {
433 433
 
434 434
 		// Get addon shortname.
435
-		$shortname = str_replace( '_license_key', '', $key );
435
+		$shortname = str_replace('_license_key', '', $key);
436 436
 
437 437
 		// Addon license option name.
438
-		$addon_license_option_name = $shortname . '_license_active';
438
+		$addon_license_option_name = $shortname.'_license_active';
439 439
 
440 440
 		// bailout if license is empty.
441
-		if ( empty( $addon_license ) ) {
442
-			delete_option( $addon_license_option_name );
441
+		if (empty($addon_license)) {
442
+			delete_option($addon_license_option_name);
443 443
 			continue;
444 444
 		}
445 445
 
446 446
 		// Get addon name.
447 447
 		$addon_name       = array();
448
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
449
-		foreach ( $addon_name_parts as $name_part ) {
448
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
449
+		foreach ($addon_name_parts as $name_part) {
450 450
 
451 451
 			// Fix addon name
452
-			switch ( $name_part ) {
452
+			switch ($name_part) {
453 453
 				case 'authorizenet' :
454 454
 					$name_part = 'authorize.net';
455 455
 					break;
456 456
 			}
457 457
 
458
-			$addon_name[] = ucfirst( $name_part );
458
+			$addon_name[] = ucfirst($name_part);
459 459
 		}
460 460
 
461
-		$addon_name = implode( ' ', $addon_name );
461
+		$addon_name = implode(' ', $addon_name);
462 462
 
463 463
 		// Data to send to the API
464 464
 		$api_params = array(
465 465
 			'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
466 466
 			'license'    => $addon_license,
467
-			'item_name'  => urlencode( $addon_name ),
467
+			'item_name'  => urlencode($addon_name),
468 468
 			'url'        => home_url()
469 469
 		);
470 470
 
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
 		);
480 480
 
481 481
 		// Make sure there are no errors
482
-		if ( is_wp_error( $response ) ) {
483
-			delete_option( $addon_license_option_name );
482
+		if (is_wp_error($response)) {
483
+			delete_option($addon_license_option_name);
484 484
 			continue;
485 485
 		}
486 486
 
487 487
 		// Tell WordPress to look for updates
488
-		set_site_transient( 'update_plugins', null );
488
+		set_site_transient('update_plugins', null);
489 489
 
490 490
 		// Decode license data
491
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
492
-		update_option( $addon_license_option_name, $license_data );
491
+		$license_data = json_decode(wp_remote_retrieve_body($response));
492
+		update_option($addon_license_option_name, $license_data);
493 493
 	}
494 494
 }
495 495
 
@@ -519,9 +519,9 @@  discard block
 block discarded – undo
519 519
 	);
520 520
 
521 521
 	global $wp_roles;
522
-	foreach ( $delete_caps as $cap ) {
523
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
524
-			$wp_roles->remove_cap( $role, $cap );
522
+	foreach ($delete_caps as $cap) {
523
+		foreach (array_keys($wp_roles->roles) as $role) {
524
+			$wp_roles->remove_cap($role, $cap);
525 525
 		}
526 526
 	}
527 527
 
Please login to merge, or discard this patch.
includes/user-functions.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|object List of all user donations
32 32
  */
33
-function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 
45
-	if ( $pagination ) {
46
-		if ( get_query_var( 'paged' ) ) {
47
-			$paged = get_query_var( 'paged' );
48
-		} else if ( get_query_var( 'page' ) ) {
49
-			$paged = get_query_var( 'page' );
45
+	if ($pagination) {
46
+		if (get_query_var('paged')) {
47
+			$paged = get_query_var('paged');
48
+		} else if (get_query_var('page')) {
49
+			$paged = get_query_var('page');
50 50
 		} else {
51 51
 			$paged = 1;
52 52
 		}
53 53
 	}
54 54
 
55
-	$args = apply_filters( 'give_get_users_donations_args', array(
55
+	$args = apply_filters('give_get_users_donations_args', array(
56 56
 		'user'    => $user,
57 57
 		'number'  => $number,
58 58
 		'status'  => $status,
59 59
 		'orderby' => 'date'
60
-	) );
60
+	));
61 61
 
62
-	if ( $pagination ) {
62
+	if ($pagination) {
63 63
 
64 64
 		$args['page'] = $paged;
65 65
 
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
 
70 70
 	}
71 71
 
72
-	$by_user_id = is_numeric( $user ) ? true : false;
73
-	$customer   = new Give_Customer( $user, $by_user_id );
72
+	$by_user_id = is_numeric($user) ? true : false;
73
+	$customer   = new Give_Customer($user, $by_user_id);
74 74
 
75
-	if ( ! empty( $customer->payment_ids ) ) {
75
+	if ( ! empty($customer->payment_ids)) {
76 76
 
77
-		unset( $args['user'] );
78
-		$args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) );
77
+		unset($args['user']);
78
+		$args['post__in'] = array_map('absint', explode(',', $customer->payment_ids));
79 79
 
80 80
 	}
81 81
 
82
-	$purchases = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) );
82
+	$purchases = give_get_payments(apply_filters('give_get_users_donations_args', $args));
83 83
 
84 84
 	// No donations
85
-	if ( ! $purchases ) {
85
+	if ( ! $purchases) {
86 86
 		return false;
87 87
 	}
88 88
 
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return bool|object List of unique forms donated by user
103 103
  */
104
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
105
-	if ( empty( $user ) ) {
104
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
105
+	if (empty($user)) {
106 106
 		$user = get_current_user_id();
107 107
 	}
108 108
 
109
-	if ( empty( $user ) ) {
109
+	if (empty($user)) {
110 110
 		return false;
111 111
 	}
112 112
 
113
-	$by_user_id = is_numeric( $user ) ? true : false;
113
+	$by_user_id = is_numeric($user) ? true : false;
114 114
 
115
-	$customer = new Give_Customer( $user, $by_user_id );
115
+	$customer = new Give_Customer($user, $by_user_id);
116 116
 
117
-	if ( empty( $customer->payment_ids ) ) {
117
+	if (empty($customer->payment_ids)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	// Get all the items donated
122
-	$payment_ids    = array_reverse( explode( ',', $customer->payment_ids ) );
123
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
124
-	if ( ! empty( $limit_payments ) ) {
125
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
122
+	$payment_ids    = array_reverse(explode(',', $customer->payment_ids));
123
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
124
+	if ( ! empty($limit_payments)) {
125
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
126 126
 	}
127 127
 	$donation_data = array();
128
-	foreach ( $payment_ids as $payment_id ) {
129
-		$donation_data[] = give_get_payment_meta( $payment_id );
128
+	foreach ($payment_ids as $payment_id) {
129
+		$donation_data[] = give_get_payment_meta($payment_id);
130 130
 	}
131 131
 
132
-	if ( empty( $donation_data ) ) {
132
+	if (empty($donation_data)) {
133 133
 		return false;
134 134
 	}
135 135
 
136 136
 	// Grab only the post ids "form_id" of the forms donated on this order
137 137
 	$completed_donations_ids = array();
138
-	foreach ( $donation_data as $purchase_meta ) {
138
+	foreach ($donation_data as $purchase_meta) {
139 139
 		$completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : '';
140 140
 	}
141 141
 
142
-	if ( empty( $completed_donations_ids ) ) {
142
+	if (empty($completed_donations_ids)) {
143 143
 		return false;
144 144
 	}
145 145
 
146 146
 	// Only include each donation once
147
-	$form_ids = array_unique( $completed_donations_ids );
147
+	$form_ids = array_unique($completed_donations_ids);
148 148
 
149 149
 	// Make sure we still have some products and a first item
150
-	if ( empty ( $form_ids ) || ! isset( $form_ids[0] ) ) {
150
+	if (empty ($form_ids) || ! isset($form_ids[0])) {
151 151
 		return false;
152 152
 	}
153 153
 
154
-	$post_type = get_post_type( $form_ids[0] );
154
+	$post_type = get_post_type($form_ids[0]);
155 155
 
156
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
156
+	$args = apply_filters('give_get_users_completed_donations_args', array(
157 157
 		'include'        => $form_ids,
158 158
 		'post_type'      => $post_type,
159
-		'posts_per_page' => - 1
160
-	) );
159
+		'posts_per_page' => -1
160
+	));
161 161
 
162
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
162
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
163 163
 }
164 164
 
165 165
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return      bool True if has donated, false other wise.
177 177
  */
178
-function give_has_purchases( $user_id = null ) {
179
-	if ( empty( $user_id ) ) {
178
+function give_has_purchases($user_id = null) {
179
+	if (empty($user_id)) {
180 180
 		$user_id = get_current_user_id();
181 181
 	}
182 182
 
183
-	if ( give_get_users_purchases( $user_id, 1 ) ) {
183
+	if (give_get_users_purchases($user_id, 1)) {
184 184
 		return true; // User has at least one donation
185 185
 	}
186 186
 
@@ -200,27 +200,27 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return      array
202 202
  */
203
-function give_get_purchase_stats_by_user( $user = '' ) {
203
+function give_get_purchase_stats_by_user($user = '') {
204 204
 
205
-	if ( is_email( $user ) ) {
205
+	if (is_email($user)) {
206 206
 
207 207
 		$field = 'email';
208 208
 
209
-	} elseif ( is_numeric( $user ) ) {
209
+	} elseif (is_numeric($user)) {
210 210
 
211 211
 		$field = 'user_id';
212 212
 
213 213
 	}
214 214
 
215 215
 	$stats    = array();
216
-	$customer = Give()->customers->get_customer_by( $field, $user );
216
+	$customer = Give()->customers->get_customer_by($field, $user);
217 217
 
218
-	if ( $customer ) {
218
+	if ($customer) {
219 219
 
220
-		$customer = new Give_Customer( $customer->id );
220
+		$customer = new Give_Customer($customer->id);
221 221
 
222
-		$stats['purchases']   = absint( $customer->purchase_count );
223
-		$stats['total_spent'] = give_sanitize_amount( $customer->purchase_value );
222
+		$stats['purchases']   = absint($customer->purchase_count);
223
+		$stats['total_spent'] = give_sanitize_amount($customer->purchase_value);
224 224
 
225 225
 	}
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @since 1.7
231 231
 	 */
232
-	$stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user );
232
+	$stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user);
233 233
 
234 234
 	return $stats;
235 235
 }
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return      int The total number of donations
249 249
  */
250
-function give_count_purchases_of_customer( $user = null ) {
250
+function give_count_purchases_of_customer($user = null) {
251 251
 
252 252
 	//Logged in?
253
-	if ( empty( $user ) ) {
253
+	if (empty($user)) {
254 254
 		$user = get_current_user_id();
255 255
 	}
256 256
 
257 257
 	//Email access?
258
-	if ( empty( $user ) && Give()->email_access->token_email ) {
258
+	if (empty($user) && Give()->email_access->token_email) {
259 259
 		$user = Give()->email_access->token_email;
260 260
 	}
261 261
 
262 262
 
263
-	$stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false;
263
+	$stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false;
264 264
 
265
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
265
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
266 266
 }
267 267
 
268 268
 /**
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
  *
276 276
  * @return      float The total amount the user has spent
277 277
  */
278
-function give_purchase_total_of_user( $user = null ) {
278
+function give_purchase_total_of_user($user = null) {
279 279
 
280
-	$stats = give_get_purchase_stats_by_user( $user );
280
+	$stats = give_get_purchase_stats_by_user($user);
281 281
 
282 282
 	return $stats['total_spent'];
283 283
 }
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
  *
294 294
  * @return      bool
295 295
  */
296
-function give_validate_username( $username ) {
297
-	$sanitized = sanitize_user( $username, false );
298
-	$valid     = ( $sanitized == $username );
296
+function give_validate_username($username) {
297
+	$sanitized = sanitize_user($username, false);
298
+	$valid     = ($sanitized == $username);
299 299
 
300
-	return (bool) apply_filters( 'give_validate_username', $valid, $username );
300
+	return (bool) apply_filters('give_validate_username', $valid, $username);
301 301
 }
302 302
 
303 303
 
@@ -314,32 +314,32 @@  discard block
 block discarded – undo
314 314
  *
315 315
  * @return      void
316 316
  */
317
-function give_add_past_purchases_to_new_user( $user_id ) {
317
+function give_add_past_purchases_to_new_user($user_id) {
318 318
 
319
-	$email = get_the_author_meta( 'user_email', $user_id );
319
+	$email = get_the_author_meta('user_email', $user_id);
320 320
 
321
-	$payments = give_get_payments( array( 's' => $email ) );
321
+	$payments = give_get_payments(array('s' => $email));
322 322
 
323
-	if ( $payments ) {
324
-		foreach ( $payments as $payment ) {
325
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
323
+	if ($payments) {
324
+		foreach ($payments as $payment) {
325
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
326 326
 				continue;
327 327
 			} // This payment already associated with an account
328 328
 
329
-			$meta                    = give_get_payment_meta( $payment->ID );
330
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
329
+			$meta                    = give_get_payment_meta($payment->ID);
330
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
331 331
 			$meta['user_info']['id'] = $user_id;
332 332
 			$meta['user_info']       = $meta['user_info'];
333 333
 
334 334
 			// Store the updated user ID in the payment meta
335
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
336
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
335
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
336
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
337 337
 		}
338 338
 	}
339 339
 
340 340
 }
341 341
 
342
-add_action( 'user_register', 'give_add_past_purchases_to_new_user' );
342
+add_action('user_register', 'give_add_past_purchases_to_new_user');
343 343
 
344 344
 
345 345
 /**
@@ -365,34 +365,34 @@  discard block
 block discarded – undo
365 365
  *
366 366
  * @return        array The donor's address, if any
367 367
  */
368
-function give_get_donor_address( $user_id = 0 ) {
369
-	if ( empty( $user_id ) ) {
368
+function give_get_donor_address($user_id = 0) {
369
+	if (empty($user_id)) {
370 370
 		$user_id = get_current_user_id();
371 371
 	}
372 372
 
373
-	$address = get_user_meta( $user_id, '_give_user_address', true );
373
+	$address = get_user_meta($user_id, '_give_user_address', true);
374 374
 
375
-	if ( ! isset( $address['line1'] ) ) {
375
+	if ( ! isset($address['line1'])) {
376 376
 		$address['line1'] = '';
377 377
 	}
378 378
 
379
-	if ( ! isset( $address['line2'] ) ) {
379
+	if ( ! isset($address['line2'])) {
380 380
 		$address['line2'] = '';
381 381
 	}
382 382
 
383
-	if ( ! isset( $address['city'] ) ) {
383
+	if ( ! isset($address['city'])) {
384 384
 		$address['city'] = '';
385 385
 	}
386 386
 
387
-	if ( ! isset( $address['zip'] ) ) {
387
+	if ( ! isset($address['zip'])) {
388 388
 		$address['zip'] = '';
389 389
 	}
390 390
 
391
-	if ( ! isset( $address['country'] ) ) {
391
+	if ( ! isset($address['country'])) {
392 392
 		$address['country'] = '';
393 393
 	}
394 394
 
395
-	if ( ! isset( $address['state'] ) ) {
395
+	if ( ! isset($address['state'])) {
396 396
 		$address['state'] = '';
397 397
 	}
398 398
 
@@ -412,42 +412,42 @@  discard block
 block discarded – undo
412 412
  *
413 413
  * @return        void
414 414
  */
415
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
415
+function give_new_user_notification($user_id = 0, $user_data = array()) {
416 416
 
417
-	if ( empty( $user_id ) || empty( $user_data ) ) {
417
+	if (empty($user_id) || empty($user_data)) {
418 418
 		return;
419 419
 	}
420
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
420
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
421 421
 
422 422
 	/* translators: %s: site name */
423
-	$message  = sprintf( esc_attr__( 'New user registration on your site %s:', 'give' ), $blogname ) . "\r\n\r\n";
423
+	$message  = sprintf(esc_attr__('New user registration on your site %s:', 'give'), $blogname)."\r\n\r\n";
424 424
 	/* translators: %s: user login */
425
-	$message .= sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n\r\n";
425
+	$message .= sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n\r\n";
426 426
 	/* translators: %s: user email */
427
-	$message .= sprintf( esc_attr__( 'E-mail: %s', 'give' ), $user_data['user_email'] ) . "\r\n";
427
+	$message .= sprintf(esc_attr__('E-mail: %s', 'give'), $user_data['user_email'])."\r\n";
428 428
 
429 429
 	@wp_mail(
430
-		get_option( 'admin_email' ),
430
+		get_option('admin_email'),
431 431
 		sprintf(
432 432
 			/* translators: %s: site name */
433
-			esc_attr__( '[%s] New User Registration', 'give' ),
433
+			esc_attr__('[%s] New User Registration', 'give'),
434 434
 			$blogname
435 435
 		),
436 436
 		$message
437 437
 	);
438 438
 
439 439
 	/* translators: %s: user login */
440
-	$message  = sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n";
440
+	$message  = sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n";
441 441
 	/* translators: %s: paswword */
442
-	$message .= sprintf( esc_attr__( 'Password: %s', 'give' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n";
442
+	$message .= sprintf(esc_attr__('Password: %s', 'give'), esc_attr__('[Password entered during donation]', 'give'))."\r\n";
443 443
 
444
-	$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login &raquo;', 'give' ) . '</a>' . "\r\n";
444
+	$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login &raquo;', 'give').'</a>'."\r\n";
445 445
 
446 446
 	wp_mail(
447 447
 		$user_data['user_email'],
448 448
 		sprintf(
449 449
 			/* translators: %s: site name */
450
-			esc_attr__( '[%s] Your username and password', 'give' ),
450
+			esc_attr__('[%s] Your username and password', 'give'),
451 451
 			$blogname
452 452
 		),
453 453
 		$message
@@ -455,4 +455,4 @@  discard block
 block discarded – undo
455 455
 
456 456
 }
457 457
 
458
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
458
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -464,7 +464,7 @@
 block discarded – undo
464 464
  *
465 465
  * @param WP_Post $payment
466 466
  *
467
- * @return mixed
467
+ * @return false|null
468 468
  */
469 469
 function give_offline_payment_receipt_after( $payment ) {
470 470
 	// Get payment object.
Please login to merge, or discard this patch.
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 	// Get offline payment instruction.
45
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
45
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
46 46
 
47 47
 	ob_start();
48 48
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param int $form_id Give form id.
55 55
 	 */
56
-	do_action( 'give_before_offline_info_fields', $form_id );
56
+	do_action('give_before_offline_info_fields', $form_id);
57 57
 	?>
58 58
 	<fieldset id="give_offline_payment_info">
59
-		<?php echo stripslashes( $offline_instructions ); ?>
59
+		<?php echo stripslashes($offline_instructions); ?>
60 60
 	</fieldset>
61 61
 	<?php
62 62
 	/**
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $form_id Give form id.
68 68
 	 */
69
-	do_action( 'give_after_offline_info_fields', $form_id );
69
+	do_action('give_after_offline_info_fields', $form_id);
70 70
 
71 71
 	echo ob_get_clean();
72 72
 }
73 73
 
74
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
74
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
75 75
 
76 76
 /**
77 77
  * Give Offline Billing Field
78 78
  *
79 79
  * @param $form_id
80 80
  */
81
-function give_offline_billing_fields( $form_id ) {
81
+function give_offline_billing_fields($form_id) {
82 82
 	//Enable Default CC fields (billing info)
83
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
84
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
83
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
84
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
85 85
 
86
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
86
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
87 87
 
88 88
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
89
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
90
-		give_default_cc_address_fields( $form_id );
91
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
92
-		give_default_cc_address_fields( $form_id );
89
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
90
+		give_default_cc_address_fields($form_id);
91
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
92
+		give_default_cc_address_fields($form_id);
93 93
 	}
94 94
 }
95 95
 
96
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
96
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
97 97
 
98 98
 /**
99 99
  * Process the payment
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
  *
105 105
  * @return void
106 106
  */
107
-function give_offline_process_payment( $purchase_data ) {
107
+function give_offline_process_payment($purchase_data) {
108 108
 
109
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
109
+	$purchase_summary = give_get_purchase_summary($purchase_data);
110 110
 
111 111
 	// setup the payment details
112 112
 	$payment_data = array(
113 113
 		'price'           => $purchase_data['price'],
114 114
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
115
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
116
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
115
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
116
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
117 117
 		'date'            => $purchase_data['date'],
118 118
 		'user_email'      => $purchase_data['user_email'],
119 119
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
 
126 126
 
127 127
 	// record the pending payment
128
-	$payment = give_insert_payment( $payment_data );
128
+	$payment = give_insert_payment($payment_data);
129 129
 
130
-	if ( $payment ) {
131
-		give_offline_send_admin_notice( $payment );
132
-		give_offline_send_donor_instructions( $payment );
130
+	if ($payment) {
131
+		give_offline_send_admin_notice($payment);
132
+		give_offline_send_donor_instructions($payment);
133 133
 		give_send_to_success_page();
134 134
 	} else {
135 135
 		// if errors are present, send the user back to the donation form so they can be corrected
136
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
136
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
137 137
 	}
138 138
 
139 139
 }
140 140
 
141
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
141
+add_action('give_gateway_offline', 'give_offline_process_payment');
142 142
 
143 143
 
144 144
 /**
@@ -151,59 +151,59 @@  discard block
 block discarded – undo
151 151
  * @since       1.0
152 152
  * @return void
153 153
  */
154
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
154
+function give_offline_send_donor_instructions($payment_id = 0) {
155 155
 
156
-	$payment_data                      = give_get_payment_meta( $payment_id );
157
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
156
+	$payment_data                      = give_get_payment_meta($payment_id);
157
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
158 158
 
159 159
 	//Customize email content depending on whether the single form has been customized
160
-	$email_content = give_get_option( 'global_offline_donation_email' );
160
+	$email_content = give_get_option('global_offline_donation_email');
161 161
 
162
-	if ( $post_offline_customization_option === 'yes' ) {
163
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
162
+	if ($post_offline_customization_option === 'yes') {
163
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
164 164
 	}
165 165
 
166
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
166
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
167 167
 
168 168
 	/**
169 169
 	 * Filters the from name.
170 170
 	 *
171 171
 	 * @since 1.7
172 172
 	 */
173
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
173
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
174 174
 
175
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
175
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
176 176
 
177 177
 	/**
178 178
 	 * Filters the from email.
179 179
 	 *
180 180
 	 * @since 1.7
181 181
 	 */
182
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
182
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
183 183
 
184
-	$to_email = give_get_payment_user_email( $payment_id );
184
+	$to_email = give_get_payment_user_email($payment_id);
185 185
 
186
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
187
-	if ( $post_offline_customization_option === 'yes' ) {
188
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
186
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
187
+	if ($post_offline_customization_option === 'yes') {
188
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
189 189
 	}
190 190
 
191
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
192
-	$subject = give_do_email_tags( $subject, $payment_id );
191
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
192
+	$subject = give_do_email_tags($subject, $payment_id);
193 193
 
194
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
195
-	$message     = give_do_email_tags( $email_content, $payment_id );
194
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
195
+	$message     = give_do_email_tags($email_content, $payment_id);
196 196
 
197 197
 	$emails = Give()->emails;
198 198
 
199
-	$emails->__set( 'from_name', $from_name );
200
-	$emails->__set( 'from_email', $from_email );
201
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
199
+	$emails->__set('from_name', $from_name);
200
+	$emails->__set('from_email', $from_email);
201
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
202 202
 
203
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
204
-	$emails->__set( 'headers', $headers );
203
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
204
+	$emails->__set('headers', $headers);
205 205
 
206
-	$emails->send( $to_email, $subject, $message, $attachments );
206
+	$emails->send($to_email, $subject, $message, $attachments);
207 207
 
208 208
 }
209 209
 
@@ -220,52 +220,52 @@  discard block
 block discarded – undo
220 220
  * @return void
221 221
  *
222 222
  */
223
-function give_offline_send_admin_notice( $payment_id = 0 ) {
223
+function give_offline_send_admin_notice($payment_id = 0) {
224 224
 
225 225
 	/* Send an email notification to the admin */
226 226
 	$admin_email = give_get_admin_notice_emails();
227
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
227
+	$user_info   = give_get_payment_meta_user_info($payment_id);
228 228
 
229
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
230
-		$user_data = get_userdata( $user_info['id'] );
229
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
230
+		$user_data = get_userdata($user_info['id']);
231 231
 		$name      = $user_data->display_name;
232
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
233
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
232
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
233
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
234 234
 	} else {
235 235
 		$name = $user_info['email'];
236 236
 	}
237 237
 
238
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
238
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
239 239
 
240
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
240
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
241 241
 
242
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
243
-	$admin_message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
244
-	$admin_message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
242
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
243
+	$admin_message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
244
+	$admin_message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
245 245
 
246 246
 
247
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
248
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
247
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
248
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
249 249
 
250 250
 	$admin_message .= sprintf(
251 251
 		'<a href="%1$s">%2$s</a>',
252
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
253
-		__( 'Click Here to View and/or Update Donation Details', 'give' )
254
-	) . "\n\n";
252
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
253
+		__('Click Here to View and/or Update Donation Details', 'give')
254
+	)."\n\n";
255 255
 
256
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
257
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
256
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
257
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
258 258
 
259
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
260
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
259
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
260
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
261 261
 
262 262
 	//Send Email
263 263
 	$emails = Give()->emails;
264
-	if ( ! empty( $admin_headers ) ) {
265
-		$emails->__set( 'headers', $admin_headers );
264
+	if ( ! empty($admin_headers)) {
265
+		$emails->__set('headers', $admin_headers);
266 266
 	}
267 267
 
268
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
268
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
269 269
 
270 270
 }
271 271
 
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return array
279 279
  */
280
-function give_offline_add_settings( $settings ) {
280
+function give_offline_add_settings($settings) {
281 281
 
282 282
 	//Vars
283 283
 	$prefix = '_give_';
284 284
 
285
-	$is_gateway_active = give_is_gateway_active( 'offline' );
285
+	$is_gateway_active = give_is_gateway_active('offline');
286 286
 
287 287
 	//this gateway isn't active
288
-	if ( ! $is_gateway_active ) {
288
+	if ( ! $is_gateway_active) {
289 289
 		//return settings and bounce
290 290
 		return $settings;
291 291
 	}
@@ -294,27 +294,27 @@  discard block
 block discarded – undo
294 294
 	$check_settings = array(
295 295
 
296 296
 		array(
297
-			'name'    => __( 'Customize Offline Donations', 'give' ),
298
-			'desc'    => __( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
299
-			'id'      => $prefix . 'customize_offline_donations',
297
+			'name'    => __('Customize Offline Donations', 'give'),
298
+			'desc'    => __('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
299
+			'id'      => $prefix.'customize_offline_donations',
300 300
 			'type'    => 'radio_inline',
301 301
 			'default' => 'no',
302 302
 			'options' => array(
303
-				'yes' => __( 'Yes', 'give' ),
304
-				'no'  => __( 'No', 'give' ),
303
+				'yes' => __('Yes', 'give'),
304
+				'no'  => __('No', 'give'),
305 305
 			),
306 306
 		),
307 307
 		array(
308
-			'name'        => __( 'Request Billing Information', 'give' ),
309
-			'desc'        => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
310
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
308
+			'name'        => __('Request Billing Information', 'give'),
309
+			'desc'        => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
310
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
311 311
 			'row_classes' => 'give-subfield',
312 312
 			'type'        => 'checkbox'
313 313
 		),
314 314
 		array(
315
-			'id'          => $prefix . 'offline_checkout_notes',
316
-			'name'        => __( 'Offline Donation Instructions', 'give' ),
317
-			'desc'        => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
315
+			'id'          => $prefix.'offline_checkout_notes',
316
+			'name'        => __('Offline Donation Instructions', 'give'),
317
+			'desc'        => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
318 318
 			'default'     => give_get_default_offline_donation_content(),
319 319
 			'type'        => 'wysiwyg',
320 320
 			'row_classes' => 'give-subfield',
@@ -323,17 +323,17 @@  discard block
 block discarded – undo
323 323
 			)
324 324
 		),
325 325
 		array(
326
-			'id'          => $prefix . 'offline_donation_subject',
327
-			'name'        => __( 'Offline Donation Email Instructions Subject', 'give' ),
328
-			'desc'        => __( 'Enter the subject line for the donation receipt email.', 'give' ),
329
-			'default'     => __( '{form_title} - Offline Donation Instructions', 'give' ),
326
+			'id'          => $prefix.'offline_donation_subject',
327
+			'name'        => __('Offline Donation Email Instructions Subject', 'give'),
328
+			'desc'        => __('Enter the subject line for the donation receipt email.', 'give'),
329
+			'default'     => __('{form_title} - Offline Donation Instructions', 'give'),
330 330
 			'row_classes' => 'give-subfield',
331 331
 			'type'        => 'text'
332 332
 		),
333 333
 		array(
334
-			'id'          => $prefix . 'offline_donation_email',
335
-			'name'        => __( 'Offline Donation Email Instructions', 'give' ),
336
-			'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' ),
334
+			'id'          => $prefix.'offline_donation_email',
335
+			'name'        => __('Offline Donation Email Instructions', 'give'),
336
+			'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'),
337 337
 			'default'     => give_get_default_offline_donation_email_content(),
338 338
 			'type'        => 'wysiwyg',
339 339
 			'row_classes' => 'give-subfield',
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 		)
344 344
 	);
345 345
 
346
-	return array_merge( $settings, $check_settings );
346
+	return array_merge($settings, $check_settings);
347 347
 }
348 348
 
349
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
349
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
350 350
 
351 351
 
352 352
 /**
@@ -358,32 +358,32 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function give_get_default_offline_donation_content() {
360 360
 
361
-	$sitename = get_bloginfo( 'sitename' );
361
+	$sitename = get_bloginfo('sitename');
362 362
 
363
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
363
+	$default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
364 364
 	$default_text .= '<ol>';
365 365
 	$default_text .= '<li>';
366 366
 	$default_text .= sprintf(
367 367
 		/* translators: %s: site name */
368
-		__( 'Make a check payable to "%s"', 'give' ),
368
+		__('Make a check payable to "%s"', 'give'),
369 369
 		$sitename
370 370
 	);
371 371
 	$default_text .= '</li>';
372 372
 	$default_text .= '<li>';
373 373
 	$default_text .= sprintf(
374 374
 		/* translators: %s: site name */
375
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
375
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
376 376
 		$sitename
377 377
 	);
378 378
 	$default_text .= '</li>';
379
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
379
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
380 380
 	$default_text .= '</ol>';
381
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
381
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
382 382
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
383 383
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
384
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
384
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
385 385
 
386
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
386
+	return apply_filters('give_default_offline_donation_content', $default_text);
387 387
 
388 388
 }
389 389
 
@@ -396,34 +396,34 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function give_get_default_offline_donation_email_content() {
398 398
 
399
-	$sitename      = get_bloginfo( 'sitename' );
400
-	$default_text  = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
401
-	$default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>';
399
+	$sitename      = get_bloginfo('sitename');
400
+	$default_text  = '<p>'.__('Dear {name},', 'give').'</p>';
401
+	$default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>';
402 402
 	$default_text .= '<ol>';
403 403
 	$default_text .= '<li>';
404 404
 	$default_text .= sprintf(
405 405
 		/* translators: %s: site name */
406
-		__( 'Make a check payable to "%s"', 'give' ),
406
+		__('Make a check payable to "%s"', 'give'),
407 407
 		$sitename
408 408
 	);
409 409
 	$default_text .= '</li>';
410 410
 	$default_text .= '<li>';
411 411
 	$default_text .= sprintf(
412 412
 		/* translators: %s: site name */
413
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
413
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
414 414
 		$sitename
415 415
 	);
416 416
 	$default_text .= '</li>';
417
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
417
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
418 418
 	$default_text .= '</ol>';
419
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
419
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
420 420
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
421 421
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
422
-	$default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
423
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
424
-	$default_text .= '<p>' . $sitename . '</p>';
422
+	$default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
423
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
424
+	$default_text .= '<p>'.$sitename.'</p>';
425 425
 
426
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
426
+	return apply_filters('give_default_offline_donation_content', $default_text);
427 427
 
428 428
 }
429 429
 
@@ -437,17 +437,17 @@  discard block
 block discarded – undo
437 437
  *
438 438
  * @return string
439 439
  */
440
-function give_offline_donation_receipt_status_notice( $notice, $id ) {
441
-	$payment = new Give_Payment( $id );
440
+function give_offline_donation_receipt_status_notice($notice, $id) {
441
+	$payment = new Give_Payment($id);
442 442
 
443
-	if ( 'offline' !== $payment->gateway ) {
443
+	if ('offline' !== $payment->gateway) {
444 444
 		return $notice;
445 445
 	}
446 446
 
447
-	return give_output_error( 'Payment Pending: Please follow the instructions below to complete your donation.', false, 'warning' );
447
+	return give_output_error('Payment Pending: Please follow the instructions below to complete your donation.', false, 'warning');
448 448
 }
449 449
 
450
-add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 );
450
+add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2);
451 451
 
452 452
 /**
453 453
  * Add offline payment instruction on payment receipt.
@@ -458,26 +458,26 @@  discard block
 block discarded – undo
458 458
  *
459 459
  * @return mixed
460 460
  */
461
-function give_offline_payment_receipt_after( $payment ) {
461
+function give_offline_payment_receipt_after($payment) {
462 462
 	// Get payment object.
463
-	$payment = new Give_Payment( $payment->ID );
463
+	$payment = new Give_Payment($payment->ID);
464 464
 
465 465
 	// Bailout.
466
-	if ( 'offline' !== $payment->gateway ) {
466
+	if ('offline' !== $payment->gateway) {
467 467
 		return false;
468 468
 	}
469 469
 
470 470
 	?>
471 471
 	<tr>
472
-		<td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td>
472
+		<td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td>
473 473
 		<td>
474
-			<?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?>
474
+			<?php echo give_get_offline_payment_instruction($payment->form_id, true); ?>
475 475
 		</td>
476 476
 	</tr>
477 477
 	<?php
478 478
 }
479 479
 
480
-add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' );
480
+add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after');
481 481
 
482 482
 /**
483 483
  * Get offline payment instructions.
@@ -489,25 +489,25 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @return string
491 491
  */
492
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
492
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
493 493
 	// Bailout.
494
-	if ( ! $form_id ) {
494
+	if ( ! $form_id) {
495 495
 		return '';
496 496
 	}
497 497
 
498
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
499
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
500
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
498
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
499
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
500
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
501 501
 	$offline_instructions              = $global_offline_instruction;
502 502
 
503
-	if ( $post_offline_customization_option == 'yes' ) {
503
+	if ($post_offline_customization_option == 'yes') {
504 504
 		$offline_instructions = $post_offline_instructions;
505 505
 	}
506 506
 
507
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
507
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
508 508
 
509 509
 	/* translators: %s: form settings url */
510
-	$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
510
+	$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
511 511
 
512
-	return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions );
512
+	return ($wpautop ? wpautop($offline_instructions) : $offline_instructions);
513 513
 }
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1028,10 +1028,10 @@
 block discarded – undo
1028 1028
 	 */
1029 1029
 	public function is_close_donation_form() {
1030 1030
 		return (
1031
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1032
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1033
-		       && ( $this->get_goal() <= $this->get_earnings()
1034
-		       );
1031
+				   'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1032
+			   && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1033
+			   && ( $this->get_goal() <= $this->get_earnings()
1034
+			   );
1035 1035
 	}
1036 1036
 
1037 1037
 	/**
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param  bool  $_id   Post id. Default is false.
338 338
 	 * @param  array $_args Arguments passed.
339 339
 	 */
340
-	public function __construct( $_id = false, $_args = array() ) {
340
+	public function __construct($_id = false, $_args = array()) {
341 341
 
342
-		$donation_form = WP_Post::get_instance( $_id );
342
+		$donation_form = WP_Post::get_instance($_id);
343 343
 
344
-		return $this->setup_donation_form( $donation_form );
344
+		return $this->setup_donation_form($donation_form);
345 345
 	}
346 346
 
347 347
 	/**
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool                   If the setup was successful or not.
356 356
 	 */
357
-	private function setup_donation_form( $donation_form ) {
357
+	private function setup_donation_form($donation_form) {
358 358
 
359
-		if ( ! is_object( $donation_form ) ) {
359
+		if ( ! is_object($donation_form)) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
363
+		if ( ! is_a($donation_form, 'WP_Post')) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		if ( 'give_forms' !== $donation_form->post_type ) {
367
+		if ('give_forms' !== $donation_form->post_type) {
368 368
 			return false;
369 369
 		}
370 370
 
371
-		foreach ( $donation_form as $key => $value ) {
371
+		foreach ($donation_form as $key => $value) {
372 372
 
373
-			switch ( $key ) {
373
+			switch ($key) {
374 374
 
375 375
 				default:
376 376
 					$this->$key = $value;
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed
396 396
 	 */
397
-	public function __get( $key ) {
397
+	public function __get($key) {
398 398
 
399
-		if ( method_exists( $this, 'get_' . $key ) ) {
399
+		if (method_exists($this, 'get_'.$key)) {
400 400
 
401
-			return call_user_func( array( $this, 'get_' . $key ) );
401
+			return call_user_func(array($this, 'get_'.$key));
402 402
 
403 403
 		} else {
404 404
 
405 405
 			/* translators: %s: property key */
406
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
406
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
407 407
 
408 408
 		}
409 409
 
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
421 421
 	 */
422
-	public function create( $data = array() ) {
422
+	public function create($data = array()) {
423 423
 
424
-		if ( $this->id != 0 ) {
424
+		if ($this->id != 0) {
425 425
 			return false;
426 426
 		}
427 427
 
428 428
 		$defaults = array(
429 429
 			'post_type'   => 'give_forms',
430 430
 			'post_status' => 'draft',
431
-			'post_title'  => esc_html__( 'New Donation Form', 'give' )
431
+			'post_title'  => esc_html__('New Donation Form', 'give')
432 432
 		);
433 433
 
434
-		$args = wp_parse_args( $data, $defaults );
434
+		$args = wp_parse_args($data, $defaults);
435 435
 
436 436
 		/**
437 437
 		 * Fired before a donation form is created
438 438
 		 *
439 439
 		 * @param array $args The post object arguments used for creation.
440 440
 		 */
441
-		do_action( 'give_form_pre_create', $args );
441
+		do_action('give_form_pre_create', $args);
442 442
 
443
-		$id = wp_insert_post( $args, true );
443
+		$id = wp_insert_post($args, true);
444 444
 
445
-		$donation_form = WP_Post::get_instance( $id );
445
+		$donation_form = WP_Post::get_instance($id);
446 446
 
447 447
 		/**
448 448
 		 * Fired after a donation form is created
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $id   The post ID of the created item.
451 451
 		 * @param array $args The post object arguments used for creation.
452 452
 		 */
453
-		do_action( 'give_form_post_create', $id, $args );
453
+		do_action('give_form_post_create', $id, $args);
454 454
 
455
-		return $this->setup_donation_form( $donation_form );
455
+		return $this->setup_donation_form($donation_form);
456 456
 
457 457
 	}
458 458
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return string Donation form name.
478 478
 	 */
479 479
 	public function get_name() {
480
-		return get_the_title( $this->ID );
480
+		return get_the_title($this->ID);
481 481
 	}
482 482
 
483 483
 	/**
@@ -490,13 +490,13 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function get_price() {
492 492
 
493
-		if ( ! isset( $this->price ) ) {
493
+		if ( ! isset($this->price)) {
494 494
 
495
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
495
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
496 496
 
497
-			if ( $this->price ) {
497
+			if ($this->price) {
498 498
 
499
-				$this->price = give_sanitize_amount( $this->price );
499
+				$this->price = give_sanitize_amount($this->price);
500 500
 
501 501
 			} else {
502 502
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param string     $price The donation form price.
515 515
 		 * @param string|int $id    The form ID.
516 516
 		 */
517
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
517
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function get_minimum_price() {
529 529
 
530
-		if ( ! isset( $this->minimum_price ) ) {
530
+		if ( ! isset($this->minimum_price)) {
531 531
 
532
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
533
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
532
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
533
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
534 534
 
535
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
535
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
536 536
 
537
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
537
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
538 538
 
539 539
 			} else {
540 540
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
 		}
546 546
 
547
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
547
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
548 548
 	}
549 549
 
550 550
 	/**
@@ -557,9 +557,9 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	public function get_prices() {
559 559
 
560
-		if ( ! isset( $this->prices ) ) {
560
+		if ( ! isset($this->prices)) {
561 561
 
562
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
562
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
563 563
 
564 564
 		}
565 565
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		 * @param array      $prices The array of mulit-level prices.
572 572
 		 * @param int|string The     ID of the form.
573 573
 		 */
574
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
574
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
575 575
 
576 576
 	}
577 577
 
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	public function get_goal() {
587 587
 
588
-		if ( ! isset( $this->goal ) ) {
588
+		if ( ! isset($this->goal)) {
589 589
 
590
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
590
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
591 591
 
592
-			if ( $this->goal ) {
592
+			if ($this->goal) {
593 593
 
594
-				$this->goal = give_sanitize_amount( $this->goal );
594
+				$this->goal = give_sanitize_amount($this->goal);
595 595
 
596 596
 			} else {
597 597
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 		}
603 603
 
604
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
604
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
605 605
 
606 606
 	}
607 607
 
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 	 */
616 616
 	public function is_single_price_mode() {
617 617
 
618
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
618
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
619 619
 		$ret    = 0;
620 620
 
621
-		if ( empty( $option ) || $option === 'set' ) {
621
+		if (empty($option) || $option === 'set') {
622 622
 			$ret = 1;
623 623
 		}
624 624
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		 * @param bool       $ret Is donation form in single price mode?
631 631
 		 * @param int|string The  ID of the donation form.
632 632
 		 */
633
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
633
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
634 634
 
635 635
 	}
636 636
 
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 	 */
645 645
 	public function is_custom_price_mode() {
646 646
 
647
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
647
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
648 648
 		$ret    = 0;
649 649
 
650
-		if ( $option === 'yes' ) {
650
+		if ($option === 'yes') {
651 651
 			$ret = 1;
652 652
 		}
653 653
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		 * @param bool       $ret Is donation form in custom price mode?
660 660
 		 * @param int|string The  ID of the donation form.
661 661
 		 */
662
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
662
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
663 663
 
664 664
 	}
665 665
 
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 	 */
676 676
 	public function has_variable_prices() {
677 677
 
678
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
678
+		$option = get_post_meta($this->ID, '_give_price_option', true);
679 679
 		$ret    = 0;
680 680
 
681
-		if ( $option === 'multi' ) {
681
+		if ($option === 'multi') {
682 682
 			$ret = 1;
683 683
 		}
684 684
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		 * @param bool       $ret Does donation form have variable prices?
689 689
 		 * @param int|string The  ID of the donation form.
690 690
 		 */
691
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
691
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
692 692
 
693 693
 	}
694 694
 
@@ -702,17 +702,17 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function get_type() {
704 704
 
705
-		if ( ! isset( $this->type ) ) {
705
+		if ( ! isset($this->type)) {
706 706
 
707
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
707
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
708 708
 
709
-			if ( empty( $this->type ) ) {
709
+			if (empty($this->type)) {
710 710
 				$this->type = 'set';
711 711
 			}
712 712
 
713 713
 		}
714 714
 
715
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
715
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
716 716
 
717 717
 	}
718 718
 
@@ -728,23 +728,23 @@  discard block
 block discarded – undo
728 728
 	 *
729 729
 	 * @return string
730 730
 	 */
731
-	public function get_form_classes( $args ) {
731
+	public function get_form_classes($args) {
732 732
 
733
-		$float_labels_option = give_is_float_labels_enabled( $args )
733
+		$float_labels_option = give_is_float_labels_enabled($args)
734 734
 			? 'float-labels-enabled'
735 735
 			: '';
736 736
 
737
-		$form_classes_array = apply_filters( 'give_form_classes', array(
737
+		$form_classes_array = apply_filters('give_form_classes', array(
738 738
 			'give-form',
739
-			'give-form-' . $this->ID,
740
-			'give-form-type-' . $this->get_type(),
739
+			'give-form-'.$this->ID,
740
+			'give-form-type-'.$this->get_type(),
741 741
 			$float_labels_option
742
-		), $this->ID, $args );
742
+		), $this->ID, $args);
743 743
 
744 744
 		// Remove empty class names.
745
-		$form_classes_array = array_filter( $form_classes_array );
745
+		$form_classes_array = array_filter($form_classes_array);
746 746
 
747
-		return implode( ' ', $form_classes_array );
747
+		return implode(' ', $form_classes_array);
748 748
 
749 749
 	}
750 750
 
@@ -759,19 +759,19 @@  discard block
 block discarded – undo
759 759
 	 *
760 760
 	 * @return string
761 761
 	 */
762
-	public function get_form_wrap_classes( $args ) {
762
+	public function get_form_wrap_classes($args) {
763 763
 
764
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
764
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
765 765
 			? $args['display_style']
766
-			: get_post_meta( $this->ID, '_give_payment_display', true );
766
+			: get_post_meta($this->ID, '_give_payment_display', true);
767 767
 
768
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
768
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
769 769
 			'give-form-wrap',
770
-			'give-display-' . $display_option
771
-		), $this->ID, $args );
770
+			'give-display-'.$display_option
771
+		), $this->ID, $args);
772 772
 
773 773
 
774
-		return implode( ' ', $form_wrap_classes_array );
774
+		return implode(' ', $form_wrap_classes_array);
775 775
 
776 776
 	}
777 777
 
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 	public function is_set_type_donation_form() {
787 787
 		$form_type = $this->get_type();
788 788
 
789
-		return ( 'set' === $form_type ? true : false );
789
+		return ('set' === $form_type ? true : false);
790 790
 
791 791
 	}
792 792
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	public function is_multi_type_donation_form() {
802 802
 		$form_type = $this->get_type();
803 803
 
804
-		return ( 'multi' === $form_type ? true : false );
804
+		return ('multi' === $form_type ? true : false);
805 805
 
806 806
 	}
807 807
 
@@ -815,15 +815,15 @@  discard block
 block discarded – undo
815 815
 	 */
816 816
 	public function get_sales() {
817 817
 
818
-		if ( ! isset( $this->sales ) ) {
818
+		if ( ! isset($this->sales)) {
819 819
 
820
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
821
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
820
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
821
+				add_post_meta($this->ID, '_give_form_sales', 0);
822 822
 			} // End if
823 823
 
824
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
824
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
825 825
 
826
-			if ( $this->sales < 0 ) {
826
+			if ($this->sales < 0) {
827 827
 				// Never let sales be less than zero
828 828
 				$this->sales = 0;
829 829
 			}
@@ -844,13 +844,13 @@  discard block
 block discarded – undo
844 844
 	 *
845 845
 	 * @return int|false     New number of total sales.
846 846
 	 */
847
-	public function increase_sales( $quantity = 1 ) {
847
+	public function increase_sales($quantity = 1) {
848 848
 
849
-		$sales       = give_get_form_sales_stats( $this->ID );
850
-		$quantity    = absint( $quantity );
849
+		$sales       = give_get_form_sales_stats($this->ID);
850
+		$quantity    = absint($quantity);
851 851
 		$total_sales = $sales + $quantity;
852 852
 
853
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
853
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
854 854
 
855 855
 			$this->sales = $total_sales;
856 856
 
@@ -871,17 +871,17 @@  discard block
 block discarded – undo
871 871
 	 *
872 872
 	 * @return int|false     New number of total sales.
873 873
 	 */
874
-	public function decrease_sales( $quantity = 1 ) {
874
+	public function decrease_sales($quantity = 1) {
875 875
 
876
-		$sales = give_get_form_sales_stats( $this->ID );
876
+		$sales = give_get_form_sales_stats($this->ID);
877 877
 
878 878
 		// Only decrease if not already zero
879
-		if ( $sales > 0 ) {
879
+		if ($sales > 0) {
880 880
 
881
-			$quantity    = absint( $quantity );
881
+			$quantity    = absint($quantity);
882 882
 			$total_sales = $sales - $quantity;
883 883
 
884
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
884
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
885 885
 
886 886
 				$this->sales = $sales;
887 887
 
@@ -905,15 +905,15 @@  discard block
 block discarded – undo
905 905
 	 */
906 906
 	public function get_earnings() {
907 907
 
908
-		if ( ! isset( $this->earnings ) ) {
908
+		if ( ! isset($this->earnings)) {
909 909
 
910
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
911
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
910
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
911
+				add_post_meta($this->ID, '_give_form_earnings', 0);
912 912
 			}
913 913
 
914
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
914
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
915 915
 
916
-			if ( $this->earnings < 0 ) {
916
+			if ($this->earnings < 0) {
917 917
 				// Never let earnings be less than zero
918 918
 				$this->earnings = 0;
919 919
 			}
@@ -934,12 +934,12 @@  discard block
 block discarded – undo
934 934
 	 *
935 935
 	 * @return float|false
936 936
 	 */
937
-	public function increase_earnings( $amount = 0 ) {
937
+	public function increase_earnings($amount = 0) {
938 938
 
939
-		$earnings   = give_get_form_earnings_stats( $this->ID );
939
+		$earnings   = give_get_form_earnings_stats($this->ID);
940 940
 		$new_amount = $earnings + (float) $amount;
941 941
 
942
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
942
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
943 943
 
944 944
 			$this->earnings = $new_amount;
945 945
 
@@ -961,16 +961,16 @@  discard block
 block discarded – undo
961 961
 	 *
962 962
 	 * @return float|false
963 963
 	 */
964
-	public function decrease_earnings( $amount ) {
964
+	public function decrease_earnings($amount) {
965 965
 
966
-		$earnings = give_get_form_earnings_stats( $this->ID );
966
+		$earnings = give_get_form_earnings_stats($this->ID);
967 967
 
968
-		if ( $earnings > 0 ) {
968
+		if ($earnings > 0) {
969 969
 			// Only decrease if greater than zero
970 970
 			$new_amount = $earnings - (float) $amount;
971 971
 
972 972
 
973
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
973
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
974 974
 
975 975
 				$this->earnings = $new_amount;
976 976
 
@@ -994,22 +994,22 @@  discard block
 block discarded – undo
994 994
 	 *
995 995
 	 * @return bool
996 996
 	 */
997
-	public function is_free( $price_id = false ) {
997
+	public function is_free($price_id = false) {
998 998
 
999 999
 		$is_free          = false;
1000
-		$variable_pricing = give_has_variable_prices( $this->ID );
1000
+		$variable_pricing = give_has_variable_prices($this->ID);
1001 1001
 
1002
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
1003
-			$price = give_get_price_option_amount( $this->ID, $price_id );
1004
-		} elseif ( ! $variable_pricing ) {
1005
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
1002
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
1003
+			$price = give_get_price_option_amount($this->ID, $price_id);
1004
+		} elseif ( ! $variable_pricing) {
1005
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1006 1006
 		}
1007 1007
 
1008
-		if ( isset( $price ) && (float) $price == 0 ) {
1008
+		if (isset($price) && (float) $price == 0) {
1009 1009
 			$is_free = true;
1010 1010
 		}
1011 1011
 
1012
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1012
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1013 1013
 
1014 1014
 	}
1015 1015
 
@@ -1028,9 +1028,9 @@  discard block
 block discarded – undo
1028 1028
 	 */
1029 1029
 	public function is_close_donation_form() {
1030 1030
 		return (
1031
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1032
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1033
-		       && ( $this->get_goal() <= $this->get_earnings()
1031
+			       'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
1032
+		       && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1033
+		       && ($this->get_goal() <= $this->get_earnings()
1034 1034
 		       );
1035 1035
 	}
1036 1036
 
@@ -1045,29 +1045,29 @@  discard block
 block discarded – undo
1045 1045
 	 *
1046 1046
 	 * @return bool                            The result of the update query.
1047 1047
 	 */
1048
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1048
+	private function update_meta($meta_key = '', $meta_value = '') {
1049 1049
 
1050 1050
 		/* @var WPDB $wpdb */
1051 1051
 		global $wpdb;
1052 1052
 
1053
-		if ( empty( $meta_key ) ) {
1053
+		if (empty($meta_key)) {
1054 1054
 			return false;
1055 1055
 		}
1056 1056
 
1057 1057
 		// Make sure if it needs to be serialized, we do
1058
-		$meta_value = maybe_serialize( $meta_value );
1058
+		$meta_value = maybe_serialize($meta_value);
1059 1059
 
1060
-		if ( is_numeric( $meta_value ) ) {
1061
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1060
+		if (is_numeric($meta_value)) {
1061
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1062 1062
 		} else {
1063 1063
 			$value_type = "'%s'";
1064 1064
 		}
1065 1065
 
1066
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1066
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1067 1067
 
1068
-		if ( $wpdb->query( $sql ) ) {
1068
+		if ($wpdb->query($sql)) {
1069 1069
 
1070
-			clean_post_cache( $this->ID );
1070
+			clean_post_cache($this->ID);
1071 1071
 
1072 1072
 			return true;
1073 1073
 
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 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.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the donation data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the donation page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function transactions_dropdown( $args = array() ) {
38
+	public function transactions_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'transactions',
@@ -45,33 +45,33 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => esc_html__( 'Select a transaction', 'give' )
48
+			'placeholder' => esc_html__('Select a transaction', 'give')
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53
-		$payments = new Give_Payments_Query( array(
53
+		$payments = new Give_Payments_Query(array(
54 54
 			'number' => $args['number']
55
-		) );
55
+		));
56 56
 
57 57
 		$payments = $payments->get_payments();
58 58
 
59 59
 		$options = array();
60 60
 
61 61
 		//Provide nice human readable options.
62
-		if ( $payments ) {
63
-			$options[0] = esc_html__( 'Select a donation', 'give' );
64
-			foreach ( $payments as $payment ) {
62
+		if ($payments) {
63
+			$options[0] = esc_html__('Select a donation', 'give');
64
+			foreach ($payments as $payment) {
65 65
 
66
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title);
66
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
67 67
 
68 68
 			}
69 69
 		} else {
70
-			$options[0] = esc_html__( 'No donations found.', 'give' );
70
+			$options[0] = esc_html__('No donations found.', 'give');
71 71
 		}
72 72
 
73 73
 
74
-		$output = $this->select( array(
74
+		$output = $this->select(array(
75 75
 			'name'             => $args['name'],
76 76
 			'selected'         => $args['selected'],
77 77
 			'id'               => $args['id'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'select_atts'      => $args['select_atts'],
84 84
 			'show_option_all'  => false,
85 85
 			'show_option_none' => false
86
-		) );
86
+		));
87 87
 
88 88
 		return $output;
89 89
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string      Give forms dropdown.
102 102
 	 */
103
-	public function forms_dropdown( $args = array() ) {
103
+	public function forms_dropdown($args = array()) {
104 104
 
105 105
 		$defaults = array(
106 106
 			'name'        => 'forms',
@@ -110,43 +110,43 @@  discard block
 block discarded – undo
110 110
 			'selected'    => 0,
111 111
 			'chosen'      => false,
112 112
 			'number'      => 30,
113
-			'placeholder' => esc_attr__( 'Select a Donation Form', 'give' )
113
+			'placeholder' => esc_attr__('Select a Donation Form', 'give')
114 114
 		);
115 115
 
116
-		$args = wp_parse_args( $args, $defaults );
116
+		$args = wp_parse_args($args, $defaults);
117 117
 
118
-		$forms = get_posts( array(
118
+		$forms = get_posts(array(
119 119
 			'post_type'      => 'give_forms',
120 120
 			'orderby'        => 'title',
121 121
 			'order'          => 'ASC',
122 122
 			'posts_per_page' => $args['number']
123
-		) );
123
+		));
124 124
 
125 125
 		$options = array();
126 126
 
127
-		if ( $forms ) {
128
-			$options[0] = esc_attr__( 'Select a Donation Form', 'give' );
129
-			foreach ( $forms as $form ) {
130
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
127
+		if ($forms) {
128
+			$options[0] = esc_attr__('Select a Donation Form', 'give');
129
+			foreach ($forms as $form) {
130
+				$options[absint($form->ID)] = esc_html($form->post_title);
131 131
 			}
132 132
 		} else {
133
-			$options[0] = esc_html__( 'No forms found.', 'give' );
133
+			$options[0] = esc_html__('No forms found.', 'give');
134 134
 		}
135 135
 
136 136
 		// This ensures that any selected forms are included in the drop down
137
-		if ( is_array( $args['selected'] ) ) {
138
-			foreach ( $args['selected'] as $item ) {
139
-				if ( ! in_array( $item, $options ) ) {
140
-					$options[ $item ] = get_the_title( $item );
137
+		if (is_array($args['selected'])) {
138
+			foreach ($args['selected'] as $item) {
139
+				if ( ! in_array($item, $options)) {
140
+					$options[$item] = get_the_title($item);
141 141
 				}
142 142
 			}
143
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
144
-			if ( ! in_array( $args['selected'], $options ) ) {
145
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
143
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
144
+			if ( ! in_array($args['selected'], $options)) {
145
+				$options[$args['selected']] = get_the_title($args['selected']);
146 146
 			}
147 147
 		}
148 148
 
149
-		$output = $this->select( array(
149
+		$output = $this->select(array(
150 150
 			'name'             => $args['name'],
151 151
 			'selected'         => $args['selected'],
152 152
 			'id'               => $args['id'],
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			'placeholder'      => $args['placeholder'],
158 158
 			'show_option_all'  => false,
159 159
 			'show_option_none' => false
160
-		) );
160
+		));
161 161
 
162 162
 		return $output;
163 163
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @return string      Donors dropdown.
176 176
 	 */
177
-	public function donor_dropdown( $args = array() ) {
177
+	public function donor_dropdown($args = array()) {
178 178
 
179 179
 		$defaults = array(
180 180
 			'name'        => 'customers',
@@ -183,38 +183,38 @@  discard block
 block discarded – undo
183 183
 			'multiple'    => false,
184 184
 			'selected'    => 0,
185 185
 			'chosen'      => true,
186
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
186
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
187 187
 			'number'      => 30
188 188
 		);
189 189
 
190
-		$args = wp_parse_args( $args, $defaults );
190
+		$args = wp_parse_args($args, $defaults);
191 191
 
192
-		$customers = Give()->customers->get_customers( array(
192
+		$customers = Give()->customers->get_customers(array(
193 193
 			'number' => $args['number']
194
-		) );
194
+		));
195 195
 
196 196
 		$options = array();
197 197
 
198
-		if ( $customers ) {
199
-			$options[0] = esc_html__( 'No donor attached', 'give' );
200
-			foreach ( $customers as $customer ) {
201
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
198
+		if ($customers) {
199
+			$options[0] = esc_html__('No donor attached', 'give');
200
+			foreach ($customers as $customer) {
201
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
202 202
 			}
203 203
 		} else {
204
-			$options[0] = esc_html__( 'No donors found.', 'give' );
204
+			$options[0] = esc_html__('No donors found.', 'give');
205 205
 		}
206 206
 
207
-		if ( ! empty( $args['selected'] ) ) {
207
+		if ( ! empty($args['selected'])) {
208 208
 
209 209
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
210 210
 
211
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
211
+			if ( ! array_key_exists($args['selected'], $options)) {
212 212
 
213
-				$customer = new Give_Customer( $args['selected'] );
213
+				$customer = new Give_Customer($args['selected']);
214 214
 
215
-				if ( $customer ) {
215
+				if ($customer) {
216 216
 
217
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
217
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
218 218
 
219 219
 				}
220 220
 
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
 
223 223
 		}
224 224
 
225
-		$output = $this->select( array(
225
+		$output = $this->select(array(
226 226
 			'name'             => $args['name'],
227 227
 			'selected'         => $args['selected'],
228 228
 			'id'               => $args['id'],
229
-			'class'            => $args['class'] . ' give-customer-select',
229
+			'class'            => $args['class'].' give-customer-select',
230 230
 			'options'          => $options,
231 231
 			'multiple'         => $args['multiple'],
232 232
 			'chosen'           => $args['chosen'],
233 233
 			'show_option_all'  => false,
234 234
 			'show_option_none' => false
235
-		) );
235
+		));
236 236
 
237 237
 		return $output;
238 238
 	}
@@ -250,21 +250,21 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return string           Categories dropdown.
252 252
 	 */
253
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
254
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
253
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
254
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
255 255
 		$options    = array();
256 256
 
257
-		foreach ( $categories as $category ) {
258
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
257
+		foreach ($categories as $category) {
258
+			$options[absint($category->term_id)] = esc_html($category->name);
259 259
 		}
260 260
 
261
-		$output = $this->select( array(
261
+		$output = $this->select(array(
262 262
 			'name'             => $name,
263 263
 			'selected'         => $selected,
264 264
 			'options'          => $options,
265
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
265
+			'show_option_all'  => esc_html__('All Categories', 'give'),
266 266
 			'show_option_none' => false
267
-		) );
267
+		));
268 268
 
269 269
 		return $output;
270 270
 	}
@@ -284,25 +284,25 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return string               Years dropdown.
286 286
 	 */
287
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
288
-		$current    = date( 'Y' );
289
-		$start_year = $current - absint( $years_before );
290
-		$end_year   = $current + absint( $years_after );
291
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
287
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
288
+		$current    = date('Y');
289
+		$start_year = $current - absint($years_before);
290
+		$end_year   = $current + absint($years_after);
291
+		$selected   = empty($selected) ? date('Y') : $selected;
292 292
 		$options    = array();
293 293
 
294
-		while ( $start_year <= $end_year ) {
295
-			$options[ absint( $start_year ) ] = $start_year;
296
-			$start_year ++;
294
+		while ($start_year <= $end_year) {
295
+			$options[absint($start_year)] = $start_year;
296
+			$start_year++;
297 297
 		}
298 298
 
299
-		$output = $this->select( array(
299
+		$output = $this->select(array(
300 300
 			'name'             => $name,
301 301
 			'selected'         => $selected,
302 302
 			'options'          => $options,
303 303
 			'show_option_all'  => false,
304 304
 			'show_option_none' => false
305
-		) );
305
+		));
306 306
 
307 307
 		return $output;
308 308
 	}
@@ -320,23 +320,23 @@  discard block
 block discarded – undo
320 320
 	 *
321 321
 	 * @return string           Months dropdown.
322 322
 	 */
323
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
323
+	public function month_dropdown($name = 'month', $selected = 0) {
324 324
 		$month    = 1;
325 325
 		$options  = array();
326
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
326
+		$selected = empty($selected) ? date('n') : $selected;
327 327
 
328
-		while ( $month <= 12 ) {
329
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
330
-			$month ++;
328
+		while ($month <= 12) {
329
+			$options[absint($month)] = give_month_num_to_name($month);
330
+			$month++;
331 331
 		}
332 332
 
333
-		$output = $this->select( array(
333
+		$output = $this->select(array(
334 334
 			'name'             => $name,
335 335
 			'selected'         => $selected,
336 336
 			'options'          => $options,
337 337
 			'show_option_all'  => false,
338 338
 			'show_option_none' => false
339
-		) );
339
+		));
340 340
 
341 341
 		return $output;
342 342
 	}
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return string      The dropdown.
355 355
 	 */
356
-	public function select( $args = array() ) {
356
+	public function select($args = array()) {
357 357
 		$defaults = array(
358 358
 			'options'          => array(),
359 359
 			'name'             => null,
@@ -364,60 +364,60 @@  discard block
 block discarded – undo
364 364
 			'placeholder'      => null,
365 365
 			'multiple'         => false,
366 366
 			'select_atts'      => false,
367
-			'show_option_all'  => esc_html__( 'All', 'give' ),
368
-			'show_option_none' => esc_html__( 'None', 'give' )
367
+			'show_option_all'  => esc_html__('All', 'give'),
368
+			'show_option_none' => esc_html__('None', 'give')
369 369
 		);
370 370
 
371
-		$args = wp_parse_args( $args, $defaults );
371
+		$args = wp_parse_args($args, $defaults);
372 372
 
373
-		if ( $args['multiple'] ) {
373
+		if ($args['multiple']) {
374 374
 			$multiple = ' MULTIPLE';
375 375
 		} else {
376 376
 			$multiple = '';
377 377
 		}
378 378
 
379
-		if ( $args['chosen'] ) {
379
+		if ($args['chosen']) {
380 380
 			$args['class'] .= ' give-select-chosen';
381 381
 		}
382 382
 
383
-		if ( $args['placeholder'] ) {
383
+		if ($args['placeholder']) {
384 384
 			$placeholder = $args['placeholder'];
385 385
 		} else {
386 386
 			$placeholder = '';
387 387
 		}
388 388
 
389 389
 
390
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">';
390
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">';
391 391
 
392
-		if ( $args['show_option_all'] ) {
393
-			if ( $args['multiple'] ) {
394
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
392
+		if ($args['show_option_all']) {
393
+			if ($args['multiple']) {
394
+				$selected = selected(true, in_array(0, $args['selected']), false);
395 395
 			} else {
396
-				$selected = selected( $args['selected'], 0, false );
396
+				$selected = selected($args['selected'], 0, false);
397 397
 			}
398
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
398
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
399 399
 		}
400 400
 
401
-		if ( ! empty( $args['options'] ) ) {
401
+		if ( ! empty($args['options'])) {
402 402
 
403
-			if ( $args['show_option_none'] ) {
404
-				if ( $args['multiple'] ) {
405
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
403
+			if ($args['show_option_none']) {
404
+				if ($args['multiple']) {
405
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
406 406
 				} else {
407
-					$selected = selected( $args['selected'], - 1, false );
407
+					$selected = selected($args['selected'], - 1, false);
408 408
 				}
409
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
409
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
410 410
 			}
411 411
 
412
-			foreach ( $args['options'] as $key => $option ) {
412
+			foreach ($args['options'] as $key => $option) {
413 413
 
414
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
415
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
414
+				if ($args['multiple'] && is_array($args['selected'])) {
415
+					$selected = selected(true, in_array($key, $args['selected']), false);
416 416
 				} else {
417
-					$selected = selected( $args['selected'], $key, false );
417
+					$selected = selected($args['selected'], $key, false);
418 418
 				}
419 419
 
420
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
420
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
421 421
 			}
422 422
 		}
423 423
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 *
439 439
 	 * @return string      The checkbox.
440 440
 	 */
441
-	public function checkbox( $args = array() ) {
441
+	public function checkbox($args = array()) {
442 442
 		$defaults = array(
443 443
 			'name'    => null,
444 444
 			'current' => null,
@@ -449,16 +449,16 @@  discard block
 block discarded – undo
449 449
 			)
450 450
 		);
451 451
 
452
-		$args = wp_parse_args( $args, $defaults );
452
+		$args = wp_parse_args($args, $defaults);
453 453
 
454 454
 		$options = '';
455
-		if ( ! empty( $args['options']['disabled'] ) ) {
455
+		if ( ! empty($args['options']['disabled'])) {
456 456
 			$options .= ' disabled="disabled"';
457
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
457
+		} elseif ( ! empty($args['options']['readonly'])) {
458 458
 			$options .= ' readonly';
459 459
 		}
460 460
 
461
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
461
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
462 462
 
463 463
 		return $output;
464 464
 	}
@@ -475,22 +475,22 @@  discard block
 block discarded – undo
475 475
 	 *
476 476
 	 * @return string      The text field.
477 477
 	 */
478
-	public function text( $args = array() ) {
478
+	public function text($args = array()) {
479 479
 		// Backwards compatibility
480
-		if ( func_num_args() > 1 ) {
480
+		if (func_num_args() > 1) {
481 481
 			$args = func_get_args();
482 482
 
483 483
 			$name  = $args[0];
484
-			$value = isset( $args[1] ) ? $args[1] : '';
485
-			$label = isset( $args[2] ) ? $args[2] : '';
486
-			$desc  = isset( $args[3] ) ? $args[3] : '';
484
+			$value = isset($args[1]) ? $args[1] : '';
485
+			$label = isset($args[2]) ? $args[2] : '';
486
+			$desc  = isset($args[3]) ? $args[3] : '';
487 487
 		}
488 488
 
489 489
 		$defaults = array(
490
-			'name'         => isset( $name ) ? $name : 'text',
491
-			'value'        => isset( $value ) ? $value : null,
492
-			'label'        => isset( $label ) ? $label : null,
493
-			'desc'         => isset( $desc ) ? $desc : null,
490
+			'name'         => isset($name) ? $name : 'text',
491
+			'value'        => isset($value) ? $value : null,
492
+			'label'        => isset($label) ? $label : null,
493
+			'desc'         => isset($desc) ? $desc : null,
494 494
 			'placeholder'  => '',
495 495
 			'class'        => 'regular-text',
496 496
 			'disabled'     => false,
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
 			'data'         => false
499 499
 		);
500 500
 
501
-		$args = wp_parse_args( $args, $defaults );
501
+		$args = wp_parse_args($args, $defaults);
502 502
 
503 503
 		$disabled = '';
504
-		if ( $args['disabled'] ) {
504
+		if ($args['disabled']) {
505 505
 			$disabled = ' disabled="disabled"';
506 506
 		}
507 507
 
508 508
 		$data = '';
509
-		if ( ! empty( $args['data'] ) ) {
510
-			foreach ( $args['data'] as $key => $value ) {
511
-				$data .= 'data-' . $key . '="' . $value . '" ';
509
+		if ( ! empty($args['data'])) {
510
+			foreach ($args['data'] as $key => $value) {
511
+				$data .= 'data-'.$key.'="'.$value.'" ';
512 512
 			}
513 513
 		}
514 514
 
515
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
515
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
516 516
 
517
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
517
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
518 518
 
519
-		if ( ! empty( $args['desc'] ) ) {
520
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
519
+		if ( ! empty($args['desc'])) {
520
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
521 521
 		}
522 522
 
523
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
523
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
524 524
 
525 525
 		$output .= '</span>';
526 526
 
@@ -539,15 +539,15 @@  discard block
 block discarded – undo
539 539
 	 *
540 540
 	 * @return string      The date picker.
541 541
 	 */
542
-	public function date_field( $args = array() ) {
542
+	public function date_field($args = array()) {
543 543
 
544
-		if ( empty( $args['class'] ) ) {
544
+		if (empty($args['class'])) {
545 545
 			$args['class'] = 'give_datepicker';
546
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
546
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
547 547
 			$args['class'] .= ' give_datepicker';
548 548
 		}
549 549
 
550
-		return $this->text( $args );
550
+		return $this->text($args);
551 551
 	}
552 552
 
553 553
 	/**
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return string      The textarea.
564 564
 	 */
565
-	public function textarea( $args = array() ) {
565
+	public function textarea($args = array()) {
566 566
 		$defaults = array(
567 567
 			'name'     => 'textarea',
568 568
 			'value'    => null,
@@ -572,21 +572,21 @@  discard block
 block discarded – undo
572 572
 			'disabled' => false
573 573
 		);
574 574
 
575
-		$args = wp_parse_args( $args, $defaults );
575
+		$args = wp_parse_args($args, $defaults);
576 576
 
577 577
 		$disabled = '';
578
-		if ( $args['disabled'] ) {
578
+		if ($args['disabled']) {
579 579
 			$disabled = ' disabled="disabled"';
580 580
 		}
581 581
 
582
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
582
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
583 583
 
584
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
584
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
585 585
 
586
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
586
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
587 587
 
588
-		if ( ! empty( $args['desc'] ) ) {
589
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
588
+		if ( ! empty($args['desc'])) {
589
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
590 590
 		}
591 591
 
592 592
 		$output .= '</span>';
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 *
607 607
 	 * @return string      The text field with ajax search.
608 608
 	 */
609
-	public function ajax_user_search( $args = array() ) {
609
+	public function ajax_user_search($args = array()) {
610 610
 
611 611
 		$defaults = array(
612 612
 			'name'         => 'user_id',
613 613
 			'value'        => null,
614
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
614
+			'placeholder'  => esc_attr__('Enter username', 'give'),
615 615
 			'label'        => null,
616 616
 			'desc'         => null,
617 617
 			'class'        => '',
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 			'data'         => false
621 621
 		);
622 622
 
623
-		$args = wp_parse_args( $args, $defaults );
623
+		$args = wp_parse_args($args, $defaults);
624 624
 
625
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
625
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
626 626
 
627 627
 		$output = '<span class="give_user_search_wrap">';
628
-		$output .= $this->text( $args );
629
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
628
+		$output .= $this->text($args);
629
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
630 630
 		$output .= '</span>';
631 631
 
632 632
 		return $output;
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
28
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
27
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
28
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
29 29
 
30
-		parent::__construct( 'give_form' );
30
+		parent::__construct('give_form');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$create_form_link = sprintf(
41 41
 			/* translators: %s: create new form URL */
42
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43
-			admin_url( 'post-new.php?post_type=give_forms' )
42
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
43
+			admin_url('post-new.php?post_type=give_forms')
44 44
 		);
45 45
 
46 46
 		return array(
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
 					'post_type' => 'give_forms',
51 51
 				),
52 52
 				'name'        => 'id',
53
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
54
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
53
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
54
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
55 55
 				'required'    => array(
56
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
56
+					'alert' => esc_html__('You must first select a Form!', 'give'),
57
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
58 58
 				),
59 59
 			),
60 60
 			array(
61 61
 				'type' => 'container',
62
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
62
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_title',
67
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
68
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
67
+				'label'   => esc_attr__('Show Title:', 'give'),
68
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_goal',
77
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
77
+				'label'   => esc_attr__('Show Goal:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'show_content',
87 87
 				'minWidth' => 240,
88
-				'label'   => esc_attr__( 'Display Content:', 'give' ),
89
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
88
+				'label'   => esc_attr__('Display Content:', 'give'),
89
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
90 90
 				'options' => array(
91
-					'none'  => esc_html__( 'No Content', 'give' ),
92
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
93
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
91
+					'none'  => esc_html__('No Content', 'give'),
92
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
93
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
94 94
 				),
95 95
 			),
96 96
 			array(
97 97
 				'type'    => 'listbox',
98 98
 				'name'    => 'display_style',
99
-				'label'   => esc_attr__( 'Donation Fields:', 'give' ),
100
-				'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
99
+				'label'   => esc_attr__('Donation Fields:', 'give'),
100
+				'tooltip' => esc_attr__('How would you like to display donation information?', 'give'),
101 101
 				'options' => array(
102
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
103
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
104
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
102
+					'onpage' => esc_html__('Show on Page', 'give'),
103
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
104
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
105 105
 				),
106 106
 			),
107 107
 			array(
108 108
 				'type'    => 'listbox',
109 109
 				'name'    => 'float_labels',
110
-				'label'   => esc_attr__( 'Floating Labels:', 'give' ),
111
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form.', 'give' ),
110
+				'label'   => esc_attr__('Floating Labels:', 'give'),
111
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form.', 'give'),
112 112
 				'options' => array(
113
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
114
-					'disabled' => esc_html__( 'Disabled', 'give' ),
113
+					'enabled'  => esc_html__('Enabled', 'give'),
114
+					'disabled' => esc_html__('Disabled', 'give'),
115 115
 				),
116 116
 			),
117 117
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
28 28
 
29
-		parent::__construct( 'give_goal' );
29
+		parent::__construct('give_goal');
30 30
 	}
31 31
 
32 32
 	/**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$create_form_link = sprintf(
40 40
 		/* translators: %s: create new form URL */
41
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42
-			admin_url( 'post-new.php?post_type=give_forms' )
41
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
42
+			admin_url('post-new.php?post_type=give_forms')
43 43
 		);
44 44
 
45 45
 		return array(
@@ -49,35 +49,35 @@  discard block
 block discarded – undo
49 49
 					'post_type' => 'give_forms',
50 50
 				),
51 51
 				'name'        => 'id',
52
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
53
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
52
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
53
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
54 54
 				'required'    => array(
55
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
56
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
55
+					'alert' => esc_html__('You must first select a Form!', 'give'),
56
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
57 57
 				),
58 58
 			),
59 59
 			array(
60 60
 				'type' => 'container',
61
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
61
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
62 62
 			),
63 63
 			array(
64 64
 				'type'    => 'listbox',
65 65
 				'name'    => 'show_text',
66
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
67
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
66
+				'label'   => esc_attr__('Show Text:', 'give'),
67
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
68 68
 				'options' => array(
69
-					'true'  => esc_html__( 'Show', 'give' ),
70
-					'false' => esc_html__( 'Hide', 'give' ),
69
+					'true'  => esc_html__('Show', 'give'),
70
+					'false' => esc_html__('Hide', 'give'),
71 71
 				),
72 72
 			),
73 73
 			array(
74 74
 				'type'    => 'listbox',
75 75
 				'name'    => 'show_bar',
76
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
77
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
76
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
77
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
78 78
 				'options' => array(
79
-					'true'  => esc_html__( 'Show', 'give' ),
80
-					'false' => esc_html__( 'Hide', 'give' ),
79
+					'true'  => esc_html__('Show', 'give'),
80
+					'false' => esc_html__('Hide', 'give'),
81 81
 				),
82 82
 			),
83 83
 		);
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +136 added lines, -136 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,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if donation ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	<h1 id="transaction-details-heading"><?php
54 54
 		printf(
55 55
 			/* translators: %s: donation number */
56
-			esc_html__( 'Donation %s', 'give' ),
56
+			esc_html__('Donation %s', 'give'),
57 57
 			$number
58 58
 		);
59
-		if ( $payment_mode == 'test' ) {
60
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
59
+		if ($payment_mode == 'test') {
60
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
61 61
 		}
62 62
 		?></h1>
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param int $payment_id Payment id.
71 71
 	 */
72
-	do_action( 'give_view_order_details_before', $payment_id );
72
+	do_action('give_view_order_details_before', $payment_id);
73 73
 	?>
74 74
 	<form id="give-edit-order-form" method="post">
75 75
 		<?php
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @param int $payment_id Payment id.
82 82
 		 */
83
-		do_action( 'give_view_order_details_form_top', $payment_id );
83
+		do_action('give_view_order_details_form_top', $payment_id);
84 84
 		?>
85 85
 		<div id="poststuff">
86 86
 			<div id="give-dashboard-widgets-wrap">
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 							 *
97 97
 							 * @param int $payment_id Payment id.
98 98
 							 */
99
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
99
+							do_action('give_view_order_details_sidebar_before', $payment_id);
100 100
 							?>
101 101
 
102 102
 							<div id="give-order-update" class="postbox give-order-data">
103 103
 
104
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
104
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
105 105
 
106 106
 								<div class="inside">
107 107
 									<div class="give-admin-box">
@@ -114,33 +114,33 @@  discard block
 block discarded – undo
114 114
 										 *
115 115
 										 * @param int $payment_id Payment id.
116 116
 										 */
117
-										do_action( 'give_view_order_details_totals_before', $payment_id );
117
+										do_action('give_view_order_details_totals_before', $payment_id);
118 118
 										?>
119 119
 
120 120
 										<div class="give-admin-box-inside">
121 121
 											<p>
122
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
122
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
123 123
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
124
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
125
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
124
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
125
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
126 126
 													<?php endforeach; ?>
127 127
 												</select>
128
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
128
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
129 129
 											</p>
130 130
 										</div>
131 131
 
132 132
 										<div class="give-admin-box-inside">
133 133
 											<p>
134
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
135
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
134
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
135
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
136 136
 											</p>
137 137
 										</div>
138 138
 
139 139
 										<div class="give-admin-box-inside">
140 140
 											<p>
141
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
142
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
143
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
141
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
142
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
143
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
144 144
 											</p>
145 145
 										</div>
146 146
 
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 										 *
155 155
 										 * @param int $payment_id Payment id.
156 156
 										 */
157
-										do_action( 'give_view_order_details_update_inner', $payment_id );
157
+										do_action('give_view_order_details_update_inner', $payment_id);
158 158
 
159 159
 										// @TODO: Fees
160
-										$fees = give_get_payment_fees( $payment_id );
161
-										if ( ! empty( $fees ) ) : ?>
160
+										$fees = give_get_payment_fees($payment_id);
161
+										if ( ! empty($fees)) : ?>
162 162
 											<div class="give-order-fees give-admin-box-inside">
163
-												<p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p>
163
+												<p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p>
164 164
 												<ul class="give-payment-fees">
165
-													<?php foreach ( $fees as $fee ) : ?>
165
+													<?php foreach ($fees as $fee) : ?>
166 166
 														<li>
167 167
 															<span class="fee-label"><?php echo $fee['label']; ?>:</span>
168
-															<span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span>
168
+															<span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span>
169 169
 														</li>
170 170
 													<?php endforeach; ?>
171 171
 												</ul>
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 
175 175
 										<div class="give-order-payment give-admin-box-inside">
176 176
 											<p>
177
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
178
-												<?php echo give_currency_symbol( $payment->currency ); ?>
179
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
177
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
178
+												<?php echo give_currency_symbol($payment->currency); ?>
179
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
180 180
 											</p>
181 181
 										</div>
182 182
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 										 *
189 189
 										 * @param int $payment_id Payment id.
190 190
 										 */
191
-										do_action( 'give_view_order_details_totals_after', $payment_id );
191
+										do_action('give_view_order_details_totals_after', $payment_id);
192 192
 										?>
193 193
 
194 194
 									</div>
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
 									 *
207 207
 									 * @param int $payment_id Payment id.
208 208
 									 */
209
-									do_action( 'give_view_order_details_update_before', $payment_id );
209
+									do_action('give_view_order_details_update_before', $payment_id);
210 210
 									?>
211 211
 
212 212
 									<div id="major-publishing-actions">
213 213
 										<div id="publishing-action">
214
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
215
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
216
-												<a href="<?php echo esc_url( add_query_arg( array(
214
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
215
+											<?php if (give_is_payment_complete($payment_id)) : ?>
216
+												<a href="<?php echo esc_url(add_query_arg(array(
217 217
 													'give-action' => 'email_links',
218 218
 													'purchase_id' => $payment_id,
219
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
219
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
220 220
 											<?php endif; ?>
221 221
 										</div>
222 222
 										<div class="clear"></div>
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 									 *
231 231
 									 * @param int $payment_id Payment id.
232 232
 									 */
233
-									do_action( 'give_view_order_details_update_after', $payment_id );
233
+									do_action('give_view_order_details_update_after', $payment_id);
234 234
 									?>
235 235
 
236 236
 								</div>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 							<div id="give-order-details" class="postbox give-order-data">
243 243
 
244
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
244
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
245 245
 
246 246
 								<div class="inside">
247 247
 									<div class="give-admin-box">
@@ -254,44 +254,44 @@  discard block
 block discarded – undo
254 254
 										 *
255 255
 										 * @param int $payment_id Payment id.
256 256
 										 */
257
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
257
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
258 258
 
259
-										$gateway = give_get_payment_gateway( $payment_id );
260
-										if ( $gateway ) : ?>
259
+										$gateway = give_get_payment_gateway($payment_id);
260
+										if ($gateway) : ?>
261 261
 											<div class="give-order-gateway give-admin-box-inside">
262 262
 												<p>
263
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
264
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
263
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
264
+													<?php echo give_get_gateway_admin_label($gateway); ?>
265 265
 												</p>
266 266
 											</div>
267 267
 										<?php endif; ?>
268 268
 
269 269
 										<div class="give-order-payment-key give-admin-box-inside">
270 270
 											<p>
271
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
272
-												<?php echo give_get_payment_key( $payment_id ); ?>
271
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
272
+												<?php echo give_get_payment_key($payment_id); ?>
273 273
 											</p>
274 274
 										</div>
275 275
 
276 276
 										<div class="give-order-ip give-admin-box-inside">
277 277
 											<p>
278
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
279
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
278
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
279
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
280 280
 											</p>
281 281
 										</div>
282 282
 
283
-										<?php if ( $transaction_id ) : ?>
283
+										<?php if ($transaction_id) : ?>
284 284
 											<div class="give-order-tx-id give-admin-box-inside">
285 285
 												<p>
286
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
287
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
286
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
287
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
288 288
 												</p>
289 289
 											</div>
290 290
 										<?php endif; ?>
291 291
 
292 292
 										<div class="give-admin-box-inside">
293
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
294
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
293
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
294
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
295 295
 											</p>
296 296
 										</div>
297 297
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 										 *
304 304
 										 * @param int $payment_id Payment id.
305 305
 										 */
306
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
306
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
307 307
 										?>
308 308
 
309 309
 									</div>
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 							 *
324 324
 							 * @param int $payment_id Payment id.
325 325
 							 */
326
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
326
+							do_action('give_view_order_details_sidebar_after', $payment_id);
327 327
 							?>
328 328
 
329 329
 						</div>
@@ -343,50 +343,50 @@  discard block
 block discarded – undo
343 343
 							 *
344 344
 							 * @param int $payment_id Payment id.
345 345
 							 */
346
-							do_action( 'give_view_order_details_main_before', $payment_id );
346
+							do_action('give_view_order_details_main_before', $payment_id);
347 347
 							?>
348 348
 
349 349
 							<?php $column_count = 'columns-3'; ?>
350 350
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
351
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
351
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
352 352
 
353 353
 								<div class="inside">
354 354
 
355 355
 									<div class="column-container">
356 356
 										<div class="column">
357 357
 											<p>
358
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
358
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
359 359
 												<?php
360
-												if ( $payment_meta['form_id'] ) :
360
+												if ($payment_meta['form_id']) :
361 361
 													printf(
362 362
 														'<a href="%1$s" target="_blank">#%2$s</a>',
363
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
363
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
364 364
 														$payment_meta['form_id']
365 365
 													);
366 366
 												endif;
367 367
 												?>
368 368
 											</p>
369 369
 											<p>
370
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
371
-												<?php give_get_form_dropdown( array(
370
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
371
+												<?php give_get_form_dropdown(array(
372 372
 													'id'       => $payment_meta['form_id'],
373 373
 													'selected' => $payment_meta['form_id'],
374 374
 													'chosen'   => true,
375
-												), true ); ?>
375
+												), true); ?>
376 376
 											</p>
377 377
 										</div>
378 378
 										<div class="column">
379 379
 											<p>
380
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
381
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
380
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
381
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
382 382
 											</p>
383 383
 											<p>
384
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
384
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
385 385
 												<span class="give-donation-level">
386 386
 													<?php
387
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
388
-													if ( empty( $var_prices ) ) {
389
-														esc_html_e( 'n/a', 'give' );
387
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
388
+													if (empty($var_prices)) {
389
+														esc_html_e('n/a', 'give');
390 390
 													} else {
391 391
 														// Variable price dropdown options.
392 392
 														$variable_price_dropdown_option = array(
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 															'selected'        => $payment_meta['price_id'],
398 398
 														);
399 399
 														// Render variable prices select tag html.
400
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
400
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
401 401
 													}
402 402
 													?>
403 403
 												</span>
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 										</div>
406 406
 										<div class="column">
407 407
 											<p>
408
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
409
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?>
408
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
409
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?>
410 410
 											</p>
411 411
 											<p>
412 412
 												<?php
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 												 *
420 420
 												 * @param int $payment_id Payment id.
421 421
 												 */
422
-												do_action( 'give_donation_details_thead_before', $payment_id );
422
+												do_action('give_donation_details_thead_before', $payment_id);
423 423
 
424 424
 
425 425
 												/**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 												 *
432 432
 												 * @param int $payment_id Payment id.
433 433
 												 */
434
-												do_action( 'give_donation_details_thead_after', $payment_id );
434
+												do_action('give_donation_details_thead_after', $payment_id);
435 435
 
436 436
 												/**
437 437
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 												 *
443 443
 												 * @param int $payment_id Payment id.
444 444
 												 */
445
-												do_action( 'give_donation_details_tbody_before', $payment_id );
445
+												do_action('give_donation_details_tbody_before', $payment_id);
446 446
 
447 447
 												/**
448 448
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 												 *
454 454
 												 * @param int $payment_id Payment id.
455 455
 												 */
456
-												do_action( 'give_donation_details_tbody_after', $payment_id );
456
+												do_action('give_donation_details_tbody_after', $payment_id);
457 457
 												?>
458 458
 											</p>
459 459
 										</div>
@@ -473,57 +473,57 @@  discard block
 block discarded – undo
473 473
 							 *
474 474
 							 * @param int $payment_id Payment id.
475 475
 							 */
476
-							do_action( 'give_view_order_details_files_after', $payment_id );
476
+							do_action('give_view_order_details_files_after', $payment_id);
477 477
 							?>
478 478
 
479 479
 							<div id="give-donor-details" class="postbox">
480
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
480
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
481 481
 
482 482
 								<div class="inside">
483 483
 
484
-									<?php $customer = new Give_Customer( $customer_id ); ?>
484
+									<?php $customer = new Give_Customer($customer_id); ?>
485 485
 
486 486
 									<div class="column-container customer-info">
487 487
 										<div class="column">
488 488
 											<p>
489
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
489
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
490 490
 												<?php
491
-												if ( ! empty( $customer->id ) ) {
491
+												if ( ! empty($customer->id)) {
492 492
 													printf(
493 493
 														'<a href="%1$s" target="_blank">#%2$s</a>',
494
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ),
494
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id),
495 495
 														$customer->id
496 496
 													);
497 497
 												}
498 498
 												?>
499 499
 											</p>
500 500
 											<p>
501
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
502
-												<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
501
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
502
+												<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
503 503
 											</p>
504 504
 										</div>
505 505
 										<div class="column">
506 506
 											<p>
507
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
507
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
508 508
 												<?php echo $customer->name; ?>
509 509
 											</p>
510 510
 											<p>
511
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
511
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
512 512
 												<?php echo $customer->email; ?>
513 513
 											</p>
514 514
 										</div>
515 515
 										<div class="column">
516 516
 											<p>
517
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
517
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
518 518
 												<?php
519
-												echo Give()->html->donor_dropdown( array(
519
+												echo Give()->html->donor_dropdown(array(
520 520
 													'selected' => $customer->id,
521 521
 													'name'     => 'customer-id',
522
-												) );
522
+												));
523 523
 												?>
524 524
 											</p>
525 525
 											<p>
526
-												<a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
526
+												<a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a>
527 527
 											</p>
528 528
 										</div>
529 529
 									</div>
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 									<div class="column-container new-customer" style="display: none">
532 532
 										<div class="column">
533 533
 											<p>
534
-												<label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
534
+												<label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
535 535
 												<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
536 536
 											</p>
537 537
 										</div>
538 538
 										<div class="column">
539 539
 											<p>
540
-												<label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
540
+												<label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
541 541
 												<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
542 542
 											</p>
543 543
 										</div>
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
 											<p>
546 546
 												<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
547 547
 												<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
548
-												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
548
+												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
549 549
 												<br>
550
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
550
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
551 551
 											</p>
552 552
 										</div>
553 553
 									</div>
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 									 * @param array $payment_meta Payment meta.
564 564
 									 * @param array $user_info    User information.
565 565
 									 */
566
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
566
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
567 567
 
568 568
 									/**
569 569
 									 * Fires in order details page, in the donor-details metabox.
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 									 *
573 573
 									 * @param int $payment_id Payment id.
574 574
 									 */
575
-									do_action( 'give_payment_view_details', $payment_id );
575
+									do_action('give_payment_view_details', $payment_id);
576 576
 									?>
577 577
 
578 578
 								</div>
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
 							 *
589 589
 							 * @param int $payment_id Payment id.
590 590
 							 */
591
-							do_action( 'give_view_order_details_billing_before', $payment_id );
591
+							do_action('give_view_order_details_billing_before', $payment_id);
592 592
 							?>
593 593
 
594 594
 							<div id="give-billing-details" class="postbox">
595
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
595
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
596 596
 
597 597
 								<div class="inside">
598 598
 
@@ -602,57 +602,57 @@  discard block
 block discarded – undo
602 602
 											<div class="data column-container">
603 603
 												<div class="column">
604 604
 													<div class="give-wrap-address-line1">
605
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1', 'give' ); ?>:</label>
606
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
605
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1', 'give'); ?>:</label>
606
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
607 607
 													</div>
608 608
 													<div class="give-wrap-address-line2">
609
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2', 'give' ); ?>:</label>
610
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
609
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2', 'give'); ?>:</label>
610
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
611 611
 													</div>
612 612
 												</div>
613 613
 												<div class="column">
614 614
 													<div class="give-wrap-address-city">
615
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
616
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
615
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
616
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
617 617
 													</div>
618 618
 													<div class="give-wrap-address-zip">
619
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
620
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
619
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
620
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
621 621
 
622 622
 													</div>
623 623
 												</div>
624 624
 												<div class="column">
625 625
 													<div id="give-order-address-country-wrap">
626
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
626
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
627 627
 														<?php
628
-														echo Give()->html->select( array(
628
+														echo Give()->html->select(array(
629 629
 															'options'          => give_get_country_list(),
630 630
 															'name'             => 'give-payment-address[0][country]',
631 631
 															'selected'         => $address['country'],
632 632
 															'show_option_all'  => false,
633 633
 															'show_option_none' => false,
634 634
 															'chosen'           => true,
635
-															'placeholder'      => esc_attr__( 'Select a country', 'give' ),
636
-														) );
635
+															'placeholder'      => esc_attr__('Select a country', 'give'),
636
+														));
637 637
 														?>
638 638
 													</div>
639 639
 													<div id="give-order-address-state-wrap">
640
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label>
640
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label>
641 641
 														<?php
642
-														$states = give_get_states( $address['country'] );
643
-														if ( ! empty( $states ) ) {
644
-															echo Give()->html->select( array(
642
+														$states = give_get_states($address['country']);
643
+														if ( ! empty($states)) {
644
+															echo Give()->html->select(array(
645 645
 																'options'          => $states,
646 646
 																'name'             => 'give-payment-address[0][state]',
647 647
 																'selected'         => $address['state'],
648 648
 																'show_option_all'  => false,
649 649
 																'show_option_none' => false,
650 650
 																'chosen'           => true,
651
-																'placeholder'      => esc_attr__( 'Select a state', 'give' ),
652
-															) );
651
+																'placeholder'      => esc_attr__('Select a state', 'give'),
652
+															));
653 653
 														} else {
654 654
 															?>
655
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
655
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
656 656
 															<?php
657 657
 														} ?>
658 658
 													</div>
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 									 *
673 673
 									 * @param int $payment_id Payment id.
674 674
 									 */
675
-									do_action( 'give_payment_billing_details', $payment_id );
675
+									do_action('give_payment_billing_details', $payment_id);
676 676
 									?>
677 677
 
678 678
 								</div>
@@ -688,32 +688,32 @@  discard block
 block discarded – undo
688 688
 							 *
689 689
 							 * @param int $payment_id Payment id.
690 690
 							 */
691
-							do_action( 'give_view_order_details_billing_after', $payment_id );
691
+							do_action('give_view_order_details_billing_after', $payment_id);
692 692
 							?>
693 693
 
694 694
 							<div id="give-payment-notes" class="postbox">
695
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
695
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
696 696
 
697 697
 								<div class="inside">
698 698
 									<div id="give-payment-notes-inner">
699 699
 										<?php
700
-										$notes = give_get_payment_notes( $payment_id );
701
-										if ( ! empty( $notes ) ) {
700
+										$notes = give_get_payment_notes($payment_id);
701
+										if ( ! empty($notes)) {
702 702
 											$no_notes_display = ' style="display:none;"';
703
-											foreach ( $notes as $note ) :
703
+											foreach ($notes as $note) :
704 704
 
705
-												echo give_get_payment_note_html( $note, $payment_id );
705
+												echo give_get_payment_note_html($note, $payment_id);
706 706
 
707 707
 											endforeach;
708 708
 										} else {
709 709
 											$no_notes_display = '';
710 710
 										}
711
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
711
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?>
712 712
 									</div>
713 713
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
714 714
 
715 715
 									<div class="give-clearfix">
716
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
716
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
717 717
 									</div>
718 718
 
719 719
 								</div>
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 							 *
730 730
 							 * @param int $payment_id Payment id.
731 731
 							 */
732
-							do_action( 'give_view_order_details_main_after', $payment_id );
732
+							do_action('give_view_order_details_main_after', $payment_id);
733 733
 							?>
734 734
 
735 735
 						</div>
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
 		 *
752 752
 		 * @param int $payment_id Payment id.
753 753
 		 */
754
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
754
+		do_action('give_view_order_details_form_bottom', $payment_id);
755 755
 
756
-		wp_nonce_field( 'give_update_payment_details_nonce' );
756
+		wp_nonce_field('give_update_payment_details_nonce');
757 757
 		?>
758
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
758
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
759 759
 		<input type="hidden" name="give_action" value="update_payment_details"/>
760 760
 	</form>
761 761
 	<?php
@@ -766,6 +766,6 @@  discard block
 block discarded – undo
766 766
 	 *
767 767
 	 * @param int $payment_id Payment id.
768 768
 	 */
769
-	do_action( 'give_view_order_details_after', $payment_id );
769
+	do_action('give_view_order_details_after', $payment_id);
770 770
 	?>
771 771
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.