Completed
Pull Request — master (#1055)
by Rami
19:01
created
includes/admin/customers/customer-functions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views
25 25
  */
26
-function give_register_default_customer_views( $views ) {
26
+function give_register_default_customer_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_customers_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_customer_notes_view'
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 );
38
+add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single customer view
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_customer_tabs( $tabs ) {
49
+function give_register_default_customer_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52
-		'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => esc_html__( 'Donor Profile', 'give' ) ),
53
-		'notes'    => array( 'dashicon' => 'dashicons-admin-comments', 'title' => esc_html__( 'Donor Notes', 'give' ) )
52
+		'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => esc_html__('Donor Profile', 'give')),
53
+		'notes'    => array('dashicon' => 'dashicons-admin-comments', 'title' => esc_html__('Donor Notes', 'give'))
54 54
 	);
55 55
 
56
-	return array_merge( $tabs, $default_tabs );
56
+	return array_merge($tabs, $default_tabs);
57 57
 }
58 58
 
59
-add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 );
59
+add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1);
60 60
 
61 61
 /**
62 62
  * Register the Delete icon as late as possible so it's at the bottom
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return array       The altered list of tabs, with 'delete' at the bottom
69 69
  */
70
-function give_register_delete_customer_tab( $tabs ) {
70
+function give_register_delete_customer_tab($tabs) {
71 71
 
72
-	$tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => esc_html__( 'Delete Donor', 'give' ) );
72
+	$tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => esc_html__('Delete Donor', 'give'));
73 73
 
74 74
 	return $tabs;
75 75
 }
76 76
 
77
-add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 );
77
+add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1);
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @see   Give_Cron::weekly_events()
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
33
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
32
+		add_filter('cron_schedules', array($this, 'add_schedules'));
33
+		add_action('wp', array($this, 'schedule_Events'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array
44 44
 	 */
45
-	public function add_schedules( $schedules = array() ) {
45
+	public function add_schedules($schedules = array()) {
46 46
 		// Adds once weekly to the existing schedules.
47 47
 		$schedules['weekly'] = array(
48 48
 			'interval' => 604800,
49
-			'display'  => esc_html__( 'Once Weekly', 'give' )
49
+			'display'  => esc_html__('Once Weekly', 'give')
50 50
 		);
51 51
 
52 52
 		return $schedules;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	private function weekly_events() {
75
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
76
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
75
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
76
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
77 77
 		}
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return void
86 86
 	 */
87 87
 	private function daily_events() {
88
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
89
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
88
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
89
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param $url
91 91
 	 *
92
-	 * @return mixed
92
+	 * @return string
93 93
 	 */
94 94
 	public function give_update_cmb_meta_box_url( $url ) {
95 95
 		//Path to Give's CMB
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
  * @since 1.0
874 874
  *
875 875
  * @param string          $key The Key to update
876
- * @param string|bool|int $value The value to set the key to
876
+ * @param integer $value The value to set the key to
877 877
  *
878 878
  * @return boolean True if updated, false if not.
879 879
  */
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  * @since      1.3.5
975 975
  *
976 976
  * @param $array
977
- * @param $position |int|string Expects an array key or 'id' of the settings field to appear after
977
+ * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after
978 978
  * @param $insert |array a valid array of options to insert
979 979
  *
980 980
  * @return array
Please login to merge, or discard this patch.
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -1169,26 +1169,26 @@  discard block
 block discarded – undo
1169 1169
  * @return void
1170 1170
  */
1171 1171
 function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1172
-    /* @var CMB2_Types $field_type_object*/
1172
+	/* @var CMB2_Types $field_type_object*/
1173 1173
 
1174
-    $id                   = $field_type_object->field->args['id'];
1174
+	$id                   = $field_type_object->field->args['id'];
1175 1175
 	$field_description    = $field_type_object->field->args['desc'];
1176 1176
 	$license              = $field_type_object->field->args['options']['license'];
1177
-    $license_key          = $escaped_value;
1178
-    $is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1179
-    $is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1180
-    $shortname            = $field_type_object->field->args['options']['shortname'];
1177
+	$license_key          = $escaped_value;
1178
+	$is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1179
+	$is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1180
+	$shortname            = $field_type_object->field->args['options']['shortname'];
1181 1181
 	$field_classes        = 'regular-text give-license-field';
1182 1182
 	$type                 = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1183
-    $custom_html          = '';
1184
-    $value                = $escaped_value;
1185
-    $messages             = array();
1186
-    $class                = '';
1187
-    $account_page_link    = $field_type_object->field->args['options']['account_url'];
1188
-    $checkout_page_link   = $field_type_object->field->args['options']['checkout_url'];
1189
-    $addon_name           = $field_type_object->field->args['options']['item_name'];
1190
-    $license_status       = null;
1191
-    $is_in_subscription   = null;
1183
+	$custom_html          = '';
1184
+	$value                = $escaped_value;
1185
+	$messages             = array();
1186
+	$class                = '';
1187
+	$account_page_link    = $field_type_object->field->args['options']['account_url'];
1188
+	$checkout_page_link   = $field_type_object->field->args['options']['checkout_url'];
1189
+	$addon_name           = $field_type_object->field->args['options']['item_name'];
1190
+	$license_status       = null;
1191
+	$is_in_subscription   = null;
1192 1192
 
1193 1193
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1194 1194
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
@@ -1197,142 +1197,142 @@  discard block
 block discarded – undo
1197 1197
 	}
1198 1198
 
1199 1199
 
1200
-    // Check if current license is part of subscription or not.
1201
-    $subscriptions = get_option( 'give_subscriptions' );
1202
-
1203
-    if( $is_license_key && $subscriptions ) {
1204
-        foreach ( $subscriptions as $subscription ) {
1205
-            if( in_array( $license_key, $subscription['licenses'] ) ) {
1206
-                $is_in_subscription = $subscription['id'];
1207
-                break;
1208
-            }
1209
-        }
1210
-    }
1211
-
1212
-
1213
-    if( $is_license_key ) {
1214
-        if( $is_in_subscription ) {
1215
-            $subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1216
-            $subscription_status  = __( 'renew', 'give' );
1217
-
1218
-            if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1219
-                $subscription_status = __( 'expire', 'give' );
1220
-            }
1221
-
1222
-            if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1223
-                $messages[] = sprintf(
1224
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1225
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1226
-                    $subscriptions[$is_in_subscription]['payment_id'],
1227
-                    $checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1228
-                );
1229
-                $license_status = 'license-expired';
1230
-            } elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1231
-                $messages[] = sprintf(
1232
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1233
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1234
-                    $subscriptions[$is_in_subscription]['payment_id'],
1235
-                    $subscription_status,
1236
-                    human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1237
-                );
1238
-                $license_status = 'license-expires-soon';
1239
-            } else {
1240
-                $messages[] = sprintf(
1241
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1242
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1243
-                    $subscriptions[$is_in_subscription]['payment_id'],
1244
-                    $subscription_status,
1245
-                    date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1246
-                );
1247
-                $license_status = 'license-expiration-date';
1248
-            }
1249
-
1250
-
1251
-        } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1252
-
1253
-            // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1254
-            switch(   $license->error ) {
1255
-                case 'expired' :
1200
+	// Check if current license is part of subscription or not.
1201
+	$subscriptions = get_option( 'give_subscriptions' );
1202
+
1203
+	if( $is_license_key && $subscriptions ) {
1204
+		foreach ( $subscriptions as $subscription ) {
1205
+			if( in_array( $license_key, $subscription['licenses'] ) ) {
1206
+				$is_in_subscription = $subscription['id'];
1207
+				break;
1208
+			}
1209
+		}
1210
+	}
1211
+
1212
+
1213
+	if( $is_license_key ) {
1214
+		if( $is_in_subscription ) {
1215
+			$subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1216
+			$subscription_status  = __( 'renew', 'give' );
1217
+
1218
+			if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1219
+				$subscription_status = __( 'expire', 'give' );
1220
+			}
1221
+
1222
+			if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1223
+				$messages[] = sprintf(
1224
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1225
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1226
+					$subscriptions[$is_in_subscription]['payment_id'],
1227
+					$checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1228
+				);
1229
+				$license_status = 'license-expired';
1230
+			} elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1231
+				$messages[] = sprintf(
1232
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1233
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1234
+					$subscriptions[$is_in_subscription]['payment_id'],
1235
+					$subscription_status,
1236
+					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1237
+				);
1238
+				$license_status = 'license-expires-soon';
1239
+			} else {
1240
+				$messages[] = sprintf(
1241
+					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1242
+					urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1243
+					$subscriptions[$is_in_subscription]['payment_id'],
1244
+					$subscription_status,
1245
+					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1246
+				);
1247
+				$license_status = 'license-expiration-date';
1248
+			}
1249
+
1250
+
1251
+		} elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1252
+
1253
+			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1254
+			switch(   $license->error ) {
1255
+				case 'expired' :
1256 1256
 					error_log(print_r( $license->error, true) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log');
1257
-                    $class = $license->error;
1258
-                    $messages[] = sprintf(
1259
-                        __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1260
-                        date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1261
-                        $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1262
-                    );
1263
-                    $license_status = 'license-' . $class;
1264
-                    break;
1265
-
1266
-                case 'missing' :
1267
-                    $class = $license->error;
1268
-                    $messages[] = sprintf(
1269
-                        __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1270
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1271
-                    );
1272
-                    $license_status = 'license-' . $class;
1273
-                    break;
1274
-
1275
-                case 'invalid' :
1276
-                    $class = $license->error;
1277
-                    $messages[] = sprintf(
1278
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1279
-                        $addon_name,
1280
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1281
-                    );
1282
-                    $license_status = 'license-' . $class;
1283
-                    break;
1284
-
1285
-                case 'site_inactive' :
1286
-                    $class = $license->error;
1287
-                    $messages[] = sprintf(
1288
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1289
-                        $addon_name,
1290
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1291
-                    );
1292
-                    $license_status = 'license-' . $class;
1293
-                    break;
1294
-
1295
-                case 'item_name_mismatch' :
1296
-                    $class = $license->error;
1297
-                    $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1298
-                    $license_status = 'license-' . $class;
1299
-                    break;
1300
-
1301
-                case 'no_activations_left':
1302
-                    $class = $license->error;
1303
-                    $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1304
-                    $license_status = 'license-' . $class;
1305
-                    break;
1306
-            }
1307
-        } else {
1308
-            switch( $license->license ) {
1309
-                case 'valid' :
1310
-                default:
1311
-                    $class = 'valid';
1312
-                    $now        = current_time( 'timestamp' );
1313
-                    $expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1314
-
1315
-                    if( 'lifetime' === $license->expires ) {
1316
-                        $messages[] = __( 'License key never expires.', 'give' );
1317
-                        $license_status = 'license-lifetime-notice';
1318
-                    } elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1319
-                        $messages[] = sprintf(
1320
-                            __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1321
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1322
-                            $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1323
-                        );
1324
-                        $license_status = 'license-expires-soon';
1325
-                    } else {
1326
-                        $messages[] = sprintf(
1327
-                            __( 'Your license key expires on %s.', 'give' ),
1328
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1329
-                        );
1330
-                        $license_status = 'license-expiration-date';
1331
-                    }
1332
-                    break;
1333
-            }
1334
-        }
1335
-    } else{
1257
+					$class = $license->error;
1258
+					$messages[] = sprintf(
1259
+						__( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1260
+						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1261
+						$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1262
+					);
1263
+					$license_status = 'license-' . $class;
1264
+					break;
1265
+
1266
+				case 'missing' :
1267
+					$class = $license->error;
1268
+					$messages[] = sprintf(
1269
+						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1270
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1271
+					);
1272
+					$license_status = 'license-' . $class;
1273
+					break;
1274
+
1275
+				case 'invalid' :
1276
+					$class = $license->error;
1277
+					$messages[] = sprintf(
1278
+						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1279
+						$addon_name,
1280
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1281
+					);
1282
+					$license_status = 'license-' . $class;
1283
+					break;
1284
+
1285
+				case 'site_inactive' :
1286
+					$class = $license->error;
1287
+					$messages[] = sprintf(
1288
+						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1289
+						$addon_name,
1290
+						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1291
+					);
1292
+					$license_status = 'license-' . $class;
1293
+					break;
1294
+
1295
+				case 'item_name_mismatch' :
1296
+					$class = $license->error;
1297
+					$messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1298
+					$license_status = 'license-' . $class;
1299
+					break;
1300
+
1301
+				case 'no_activations_left':
1302
+					$class = $license->error;
1303
+					$messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1304
+					$license_status = 'license-' . $class;
1305
+					break;
1306
+			}
1307
+		} else {
1308
+			switch( $license->license ) {
1309
+				case 'valid' :
1310
+				default:
1311
+					$class = 'valid';
1312
+					$now        = current_time( 'timestamp' );
1313
+					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1314
+
1315
+					if( 'lifetime' === $license->expires ) {
1316
+						$messages[] = __( 'License key never expires.', 'give' );
1317
+						$license_status = 'license-lifetime-notice';
1318
+					} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1319
+						$messages[] = sprintf(
1320
+							__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1321
+							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1322
+							$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1323
+						);
1324
+						$license_status = 'license-expires-soon';
1325
+					} else {
1326
+						$messages[] = sprintf(
1327
+							__( 'Your license key expires on %s.', 'give' ),
1328
+							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1329
+						);
1330
+						$license_status = 'license-expiration-date';
1331
+					}
1332
+					break;
1333
+			}
1334
+		}
1335
+	} else{
1336 1336
 		$class = 'empty';
1337 1337
 		$messages[] = sprintf(
1338 1338
 			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 	}
1343 1343
 
1344 1344
 
1345
-    // Add class for input field if license is active.
1345
+	// Add class for input field if license is active.
1346 1346
 	if ( $is_valid_license ) {
1347 1347
 		$field_classes .= ' give-license-active';
1348 1348
 	}
@@ -1355,12 +1355,12 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
 	// If license is active so show deactivate button
1357 1357
 	if ( $is_valid_license ) {
1358
-        // Get input filed html.
1359
-        $input_field_html = $field_type_object->input( array(
1360
-            'class' => $field_classes,
1361
-            'type'  => $type,
1362
-            'readonly' => 'readonly',
1363
-        ) );
1358
+		// Get input filed html.
1359
+		$input_field_html = $field_type_object->input( array(
1360
+			'class' => $field_classes,
1361
+			'type'  => $type,
1362
+			'readonly' => 'readonly',
1363
+		) );
1364 1364
 
1365 1365
 		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1366 1366
 	}
@@ -1368,27 +1368,27 @@  discard block
 block discarded – undo
1368 1368
 	// Field description.
1369 1369
 	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1370 1370
 
1371
-    // If no messages found then inform user that to get updated in future register yourself.
1372
-    if ( empty( $messages ) ) {
1373
-        $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1374
-    }
1371
+	// If no messages found then inform user that to get updated in future register yourself.
1372
+	if ( empty( $messages ) ) {
1373
+		$messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1374
+	}
1375 1375
 
1376
-    foreach( $messages as $message ) {
1377
-        $custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1378
-        $custom_html .= '<p>' . $message . '</p>';
1379
-        $custom_html .= '</div>';
1380
-    }
1376
+	foreach( $messages as $message ) {
1377
+		$custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1378
+		$custom_html .= '<p>' . $message . '</p>';
1379
+		$custom_html .= '</div>';
1380
+	}
1381 1381
 
1382 1382
 
1383 1383
 
1384
-    // Field html.
1385
-    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1384
+	// Field html.
1385
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1386 1386
 
1387
-    // Nonce.
1387
+	// Nonce.
1388 1388
 	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1389 1389
 
1390
-    // Print field html.
1391
-    echo '<div>' . $custom_html . '</div>';
1390
+	// Print field html.
1391
+	echo '<div>' . $custom_html . '</div>';
1392 1392
 }
1393 1393
 
1394 1394
 
Please login to merge, or discard this patch.
Spacing   +374 added lines, -374 removed lines patch added patch discarded remove patch
@@ -41,26 +41,26 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function __construct() {
43 43
 
44
-		add_action( 'admin_init', array( $this, 'init' ) );
44
+		add_action('admin_init', array($this, 'init'));
45 45
 
46 46
 		//Customize CMB2 URL
47
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
47
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
48 48
 
49 49
 		//Custom CMB2 Settings Fields
50
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
51
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
52
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
53
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
54
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
55
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
56
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
57
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
58
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
50
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
51
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
52
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
53
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
54
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
55
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
56
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
57
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
58
+		add_action('admin_notices', array($this, 'settings_notices'));
59 59
 
60 60
 		// Include CMB CSS in the head to avoid FOUC
61
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
61
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
62 62
 
63
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
63
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
64 64
 
65 65
 	}
66 66
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @since  1.0
72 72
 	 */
73 73
 	public function init() {
74
-		register_setting( $this->key, $this->key );
74
+		register_setting($this->key, $this->key);
75 75
 
76 76
 	}
77 77
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return mixed
87 87
 	 */
88
-	public function give_update_cmb_meta_box_url( $url ) {
88
+	public function give_update_cmb_meta_box_url($url) {
89 89
 		//Path to Give's CMB
90
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
90
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
91 91
 	}
92 92
 
93 93
 
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function give_get_settings_tabs() {
101 101
 
102
-		$settings = $this->give_settings( null );
102
+		$settings = $this->give_settings(null);
103 103
 
104 104
 		$tabs             = array();
105
-		$tabs['general']  = esc_html__( 'General', 'give' );
106
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
107
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
108
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
105
+		$tabs['general']  = esc_html__('General', 'give');
106
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
107
+		$tabs['display']  = esc_html__('Display Options', 'give');
108
+		$tabs['emails']   = esc_html__('Emails', 'give');
109 109
 
110
-		if ( ! empty( $settings['addons']['fields'] ) ) {
111
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
110
+		if ( ! empty($settings['addons']['fields'])) {
111
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
112 112
 		}
113 113
 
114
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
115
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
114
+		if ( ! empty($settings['licenses']['fields'])) {
115
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
116 116
 		}
117 117
 
118
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
119
-		$tabs['api']         = esc_html__( 'API', 'give' );
120
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
118
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
119
+		$tabs['api']         = esc_html__('API', 'give');
120
+		$tabs['system_info'] = esc_html__('System Info', 'give');
121 121
 
122
-		return apply_filters( 'give_settings_tabs', $tabs );
122
+		return apply_filters('give_settings_tabs', $tabs);
123 123
 	}
124 124
 
125 125
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function admin_page_display() {
131 131
 
132
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
132
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
133 133
 
134 134
 		?>
135 135
 
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
 
140 140
 			<h2 class="nav-tab-wrapper">
141 141
 				<?php
142
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
142
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
143 143
 
144
-					$tab_url = esc_url( add_query_arg( array(
144
+					$tab_url = esc_url(add_query_arg(array(
145 145
 						'settings-updated' => false,
146 146
 						'tab'              => $tab_id
147
-					) ) );
147
+					)));
148 148
 
149 149
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
150 150
 
151
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
151
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
152 152
 
153 153
 				}
154 154
 				?>
155 155
 			</h2>
156 156
 
157
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
157
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
158 158
 
159 159
 		</div><!-- .wrap -->
160 160
 
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string
178 178
 	 */
179
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
179
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
180 180
 
181 181
 		//only modify the give settings form
182
-		if ( 'give_settings' == $object_id ) {
182
+		if ('give_settings' == $object_id) {
183 183
 
184
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
184
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>';
185 185
 
186 186
 		}
187 187
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return array
200 200
 	 */
201
-	public function give_settings( $active_tab ) {
201
+	public function give_settings($active_tab) {
202 202
 
203 203
 		$give_settings = array(
204 204
 			/**
@@ -206,99 +206,99 @@  discard block
 block discarded – undo
206 206
 			 */
207 207
 			'general'     => array(
208 208
 				'id'         => 'general_settings',
209
-				'give_title' => esc_html__( 'General Settings', 'give' ),
210
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
211
-				'fields'     => apply_filters( 'give_settings_general', array(
209
+				'give_title' => esc_html__('General Settings', 'give'),
210
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
211
+				'fields'     => apply_filters('give_settings_general', array(
212 212
 						array(
213
-							'name' => esc_html__( 'General Settings', 'give' ),
213
+							'name' => esc_html__('General Settings', 'give'),
214 214
 							'desc' => '',
215 215
 							'type' => 'give_title',
216 216
 							'id'   => 'give_title_general_settings_1'
217 217
 						),
218 218
 						array(
219
-							'name'    => esc_html__( 'Success Page', 'give' ),
219
+							'name'    => esc_html__('Success Page', 'give'),
220 220
 							/* translators: %s: [give_receipt] */
221
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
221
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
222 222
 							'id'      => 'success_page',
223 223
 							'type'    => 'select',
224
-							'options' => give_cmb2_get_post_options( array(
224
+							'options' => give_cmb2_get_post_options(array(
225 225
 								'post_type'   => 'page',
226
-								'numberposts' => - 1
227
-							) ),
226
+								'numberposts' => -1
227
+							)),
228 228
 						),
229 229
 						array(
230
-							'name'    => esc_html__( 'Failed Donation Page', 'give' ),
231
-							'desc'    => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
230
+							'name'    => esc_html__('Failed Donation Page', 'give'),
231
+							'desc'    => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'),
232 232
 							'id'      => 'failure_page',
233 233
 							'type'    => 'select',
234
-							'options' => give_cmb2_get_post_options( array(
234
+							'options' => give_cmb2_get_post_options(array(
235 235
 								'post_type'   => 'page',
236
-								'numberposts' => - 1
237
-							) ),
236
+								'numberposts' => -1
237
+							)),
238 238
 						),
239 239
 						array(
240
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
240
+							'name'    => esc_html__('Donation History Page', 'give'),
241 241
 							/* translators: %s: [donation_history] */
242
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
242
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
243 243
 							'id'      => 'history_page',
244 244
 							'type'    => 'select',
245
-							'options' => give_cmb2_get_post_options( array(
245
+							'options' => give_cmb2_get_post_options(array(
246 246
 								'post_type'   => 'page',
247
-								'numberposts' => - 1
248
-							) ),
247
+								'numberposts' => -1
248
+							)),
249 249
 						),
250 250
 						array(
251
-							'name'    => esc_html__( 'Base Country', 'give' ),
252
-							'desc'    => esc_html__( 'The country your site operates from.', 'give' ),
251
+							'name'    => esc_html__('Base Country', 'give'),
252
+							'desc'    => esc_html__('The country your site operates from.', 'give'),
253 253
 							'id'      => 'base_country',
254 254
 							'type'    => 'select',
255 255
 							'options' => give_get_country_list(),
256 256
 						),
257 257
 						array(
258
-							'name' => esc_html__( 'Currency Settings', 'give' ),
258
+							'name' => esc_html__('Currency Settings', 'give'),
259 259
 							'desc' => '',
260 260
 							'type' => 'give_title',
261 261
 							'id'   => 'give_title_general_settings_2'
262 262
 						),
263 263
 						array(
264
-							'name'    => esc_html__( 'Currency', 'give' ),
265
-							'desc'    => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
264
+							'name'    => esc_html__('Currency', 'give'),
265
+							'desc'    => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
266 266
 							'id'      => 'currency',
267 267
 							'type'    => 'select',
268 268
 							'options' => give_get_currencies(),
269 269
 							'default' => 'USD',
270 270
 						),
271 271
 						array(
272
-							'name'    => esc_html__( 'Currency Position', 'give' ),
273
-							'desc'    => esc_html__( 'The position of the currency symbol.', 'give' ),
272
+							'name'    => esc_html__('Currency Position', 'give'),
273
+							'desc'    => esc_html__('The position of the currency symbol.', 'give'),
274 274
 							'id'      => 'currency_position',
275 275
 							'type'    => 'select',
276 276
 							'options' => array(
277 277
 								/* translators: %s: currency symbol */
278
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
278
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
279 279
 								/* translators: %s: currency symbol */
280
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
280
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
281 281
 							),
282 282
 							'default' => 'before',
283 283
 						),
284 284
 						array(
285
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
286
-							'desc'            => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
285
+							'name'            => esc_html__('Thousands Separator', 'give'),
286
+							'desc'            => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
287 287
 							'id'              => 'thousands_separator',
288 288
 							'type'            => 'text_small',
289 289
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
290 290
 							'default'         => ',',
291 291
 						),
292 292
 						array(
293
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
294
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
293
+							'name'    => esc_html__('Decimal Separator', 'give'),
294
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
295 295
 							'id'      => 'decimal_separator',
296 296
 							'type'    => 'text_small',
297 297
 							'default' => '.',
298 298
 						),
299 299
 						array(
300
-							'name'            => __( 'Number of Decimals', 'give' ),
301
-							'desc'            => __( 'The number of decimal points displayed in amounts.', 'give' ),
300
+							'name'            => __('Number of Decimals', 'give'),
301
+							'desc'            => __('The number of decimal points displayed in amounts.', 'give'),
302 302
 							'id'              => 'number_decimals',
303 303
 							'type'            => 'text_small',
304 304
 							'default'         => 2,
@@ -312,83 +312,83 @@  discard block
 block discarded – undo
312 312
 			 */
313 313
 			'gateways'    => array(
314 314
 				'id'         => 'payment_gateways',
315
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
316
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
317
-				'fields'     => apply_filters( 'give_settings_gateways', array(
315
+				'give_title' => esc_html__('Payment Gateways', 'give'),
316
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
317
+				'fields'     => apply_filters('give_settings_gateways', array(
318 318
 						array(
319
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
319
+							'name' => esc_html__('Gateways Settings', 'give'),
320 320
 							'desc' => '',
321 321
 							'id'   => 'give_title_gateway_settings_1',
322 322
 							'type' => 'give_title'
323 323
 						),
324 324
 						array(
325
-							'name' => esc_html__( 'Test Mode', 'give' ),
326
-							'desc' => esc_html__( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
325
+							'name' => esc_html__('Test Mode', 'give'),
326
+							'desc' => esc_html__('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
327 327
 							'id'   => 'test_mode',
328 328
 							'type' => 'checkbox'
329 329
 						),
330 330
 						array(
331
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
332
-							'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
331
+							'name' => esc_html__('Enabled Gateways', 'give'),
332
+							'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'),
333 333
 							'id'   => 'gateways',
334 334
 							'type' => 'enabled_gateways'
335 335
 						),
336 336
 						array(
337
-							'name' => esc_html__( 'Default Gateway', 'give' ),
338
-							'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ),
337
+							'name' => esc_html__('Default Gateway', 'give'),
338
+							'desc' => esc_html__('The gateway that will be selected by default.', 'give'),
339 339
 							'id'   => 'default_gateway',
340 340
 							'type' => 'default_gateway'
341 341
 						),
342 342
 						array(
343
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
343
+							'name' => esc_html__('PayPal Standard', 'give'),
344 344
 							'desc' => '',
345 345
 							'type' => 'give_title',
346 346
 							'id'   => 'give_title_gateway_settings_2',
347 347
 						),
348 348
 						array(
349
-							'name' => esc_html__( 'PayPal Email', 'give' ),
350
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
349
+							'name' => esc_html__('PayPal Email', 'give'),
350
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
351 351
 							'id'   => 'paypal_email',
352 352
 							'type' => 'text_email',
353 353
 						),
354 354
 						array(
355
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
356
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
355
+							'name' => esc_html__('PayPal Page Style', 'give'),
356
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
357 357
 							'id'   => 'paypal_page_style',
358 358
 							'type' => 'text',
359 359
 						),
360 360
 						array(
361
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
362
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
361
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
362
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
363 363
 							'id'      => 'paypal_button_type',
364 364
 							'type'    => 'radio_inline',
365 365
 							'options' => array(
366
-								'donation' => esc_html__( 'Donation', 'give' ),
367
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
366
+								'donation' => esc_html__('Donation', 'give'),
367
+								'standard' => esc_html__('Standard Transaction', 'give')
368 368
 							),
369 369
 							'default' => 'donation',
370 370
 						),
371 371
 						array(
372
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
373
-							'desc' => esc_html__( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
372
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
373
+							'desc' => esc_html__('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
374 374
 							'id'   => 'disable_paypal_verification',
375 375
 							'type' => 'checkbox'
376 376
 						),
377 377
 						array(
378
-							'name' => esc_html__( 'Offline Donations', 'give' ),
378
+							'name' => esc_html__('Offline Donations', 'give'),
379 379
 							'desc' => '',
380 380
 							'type' => 'give_title',
381 381
 							'id'   => 'give_title_gateway_settings_3',
382 382
 						),
383 383
 						array(
384
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
385
-							'desc' => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
384
+							'name' => esc_html__('Collect Billing Details', 'give'),
385
+							'desc' => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
386 386
 							'id'   => 'give_offline_donation_enable_billing_fields',
387 387
 							'type' => 'checkbox'
388 388
 						),
389 389
 						array(
390
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
391
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
390
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
391
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
392 392
 							'id'      => 'global_offline_donation_content',
393 393
 							'default' => give_get_default_offline_donation_content(),
394 394
 							'type'    => 'wysiwyg',
@@ -397,15 +397,15 @@  discard block
 block discarded – undo
397 397
 							)
398 398
 						),
399 399
 						array(
400
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
401
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
400
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
401
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
402 402
 							'id'      => 'offline_donation_subject',
403
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
403
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
404 404
 							'type'    => 'text'
405 405
 						),
406 406
 						array(
407
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
408
-							'desc'    => esc_html__( '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' ),
407
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
408
+							'desc'    => esc_html__('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'),
409 409
 							'id'      => 'global_offline_donation_email',
410 410
 							'default' => give_get_default_offline_donation_email_content(),
411 411
 							'type'    => 'wysiwyg',
@@ -419,116 +419,116 @@  discard block
 block discarded – undo
419 419
 			/** Display Settings */
420 420
 			'display'     => array(
421 421
 				'id'         => 'display_settings',
422
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
423
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
424
-				'fields'     => apply_filters( 'give_settings_display', array(
422
+				'give_title' => esc_html__('Display Settings', 'give'),
423
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
424
+				'fields'     => apply_filters('give_settings_display', array(
425 425
 						array(
426
-							'name' => esc_html__( 'Display Settings', 'give' ),
426
+							'name' => esc_html__('Display Settings', 'give'),
427 427
 							'desc' => '',
428 428
 							'id'   => 'give_title_display_settings_1',
429 429
 							'type' => 'give_title'
430 430
 						),
431 431
 						array(
432
-							'name' => esc_html__( 'Disable CSS', 'give' ),
433
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
432
+							'name' => esc_html__('Disable CSS', 'give'),
433
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
434 434
 							'id'   => 'disable_css',
435 435
 							'type' => 'checkbox'
436 436
 						),
437 437
 						array(
438
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
438
+							'name' => esc_html__('Enable Floating Labels', 'give'),
439 439
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
440
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
440
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
441 441
 							'id'   => 'enable_floatlabels',
442 442
 							'type' => 'checkbox'
443 443
 						),
444 444
 						array(
445
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
445
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
446 446
 							/* translators: %s: about page URL */
447
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
447
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
448 448
 							'id'   => 'disable_welcome',
449 449
 							'type' => 'checkbox'
450 450
 						),
451 451
 						array(
452
-							'name' => esc_html__( 'Post Types', 'give' ),
452
+							'name' => esc_html__('Post Types', 'give'),
453 453
 							'desc' => '',
454 454
 							'id'   => 'give_title_display_settings_2',
455 455
 							'type' => 'give_title'
456 456
 						),
457 457
 						array(
458
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
459
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
458
+							'name' => esc_html__('Disable Form Single Views', 'give'),
459
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
460 460
 							'id'   => 'disable_forms_singular',
461 461
 							'type' => 'checkbox'
462 462
 						),
463 463
 						array(
464
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
465
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
464
+							'name' => esc_html__('Disable Form Archives', 'give'),
465
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
466 466
 							'id'   => 'disable_forms_archives',
467 467
 							'type' => 'checkbox'
468 468
 						),
469 469
 						array(
470
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
471
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
470
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
471
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
472 472
 							'id'   => 'disable_forms_excerpt',
473 473
 							'type' => 'checkbox'
474 474
 						),
475 475
 
476 476
 						array(
477
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
478
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
477
+							'name'    => esc_html__('Featured Image Size', 'give'),
478
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
479 479
 							'id'      => 'featured_image_size',
480 480
 							'type'    => 'select',
481 481
 							'default' => 'large',
482 482
 							'options' => give_get_featured_image_sizes()
483 483
 						),
484 484
 						array(
485
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
486
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
485
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
486
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
487 487
 							'id'   => 'disable_form_featured_img',
488 488
 							'type' => 'checkbox'
489 489
 						),
490 490
 						array(
491
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
492
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
491
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
492
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
493 493
 							'id'   => 'disable_form_sidebar',
494 494
 							'type' => 'checkbox'
495 495
 						),
496 496
 						array(
497
-							'name' => esc_html__( 'Taxonomies', 'give' ),
497
+							'name' => esc_html__('Taxonomies', 'give'),
498 498
 							'desc' => '',
499 499
 							'id'   => 'give_title_display_settings_3',
500 500
 							'type' => 'give_title'
501 501
 						),
502 502
 						array(
503
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
504
-							'desc' => esc_html__( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
503
+							'name' => esc_html__('Enable Form Categories', 'give'),
504
+							'desc' => esc_html__('Enables the "Category" taxonomy for all Give forms.', 'give'),
505 505
 							'id'   => 'enable_categories',
506 506
 							'type' => 'checkbox'
507 507
 						),
508 508
 						array(
509
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
510
-							'desc' => esc_html__( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
509
+							'name' => esc_html__('Enable Form Tags', 'give'),
510
+							'desc' => esc_html__('Enables the "Tag" taxonomy for all Give forms.', 'give'),
511 511
 							'id'   => 'enable_tags',
512 512
 							'type' => 'checkbox'
513 513
 						),
514 514
 						array(
515
-							'name' => esc_html__( 'Term and Conditions', 'give' ),
515
+							'name' => esc_html__('Term and Conditions', 'give'),
516 516
 							'desc' => '',
517 517
 							'id'   => 'give_title_display_settings_4',
518 518
 							'type' => 'give_title'
519 519
 						),
520 520
 						array(
521
-							'name' => esc_html__( 'Agree to Terms Label', 'give' ),
522
-							'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder. Note: You can customize the label per form as needed.', 'give' ),
521
+							'name' => esc_html__('Agree to Terms Label', 'give'),
522
+							'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder. Note: You can customize the label per form as needed.', 'give'),
523 523
 							'id'   => 'agree_to_terms_label',
524 524
 							'attributes'  => array(
525
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
525
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
526 526
 							),
527 527
 							'type' => 'text'
528 528
 						),
529 529
 						array(
530
-							'name' => esc_html__( 'Agreement Text', 'give' ),
531
-							'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation. Note: You can customize the content per form as needed.', 'give' ),
530
+							'name' => esc_html__('Agreement Text', 'give'),
531
+							'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation. Note: You can customize the content per form as needed.', 'give'),
532 532
 							'id'   => 'agreement_text',
533 533
 							'type' => 'wysiwyg'
534 534
 						),
@@ -541,85 +541,85 @@  discard block
 block discarded – undo
541 541
 			 */
542 542
 			'emails'      => array(
543 543
 				'id'         => 'email_settings',
544
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
545
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
546
-				'fields'     => apply_filters( 'give_settings_emails', array(
544
+				'give_title' => esc_html__('Email Settings', 'give'),
545
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
546
+				'fields'     => apply_filters('give_settings_emails', array(
547 547
 						array(
548
-							'name' => esc_html__( 'Email Settings', 'give' ),
548
+							'name' => esc_html__('Email Settings', 'give'),
549 549
 							'desc' => '',
550 550
 							'id'   => 'give_title_email_settings_1',
551 551
 							'type' => 'give_title'
552 552
 						),
553 553
 						array(
554 554
 							'id'      => 'email_template',
555
-							'name'    => esc_html__( 'Email Template', 'give' ),
556
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
555
+							'name'    => esc_html__('Email Template', 'give'),
556
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
557 557
 							'type'    => 'select',
558 558
 							'options' => give_get_email_templates()
559 559
 						),
560 560
 						array(
561 561
 							'id'   => 'email_logo',
562
-							'name' => esc_html__( 'Logo', 'give' ),
563
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
562
+							'name' => esc_html__('Logo', 'give'),
563
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
564 564
 							'type' => 'file'
565 565
 						),
566 566
 						array(
567 567
 							'id'      => 'from_name',
568
-							'name'    => esc_html__( 'From Name', 'give' ),
569
-							'desc'    => esc_html__( 'The name which appears in the "From" field in donation receipt emails.', 'give' ),
570
-							'default' => get_bloginfo( 'name' ),
568
+							'name'    => esc_html__('From Name', 'give'),
569
+							'desc'    => esc_html__('The name which appears in the "From" field in donation receipt emails.', 'give'),
570
+							'default' => get_bloginfo('name'),
571 571
 							'type'    => 'text'
572 572
 						),
573 573
 						array(
574 574
 							'id'      => 'from_email',
575
-							'name'    => esc_html__( 'From Email', 'give' ),
576
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
577
-							'default' => get_bloginfo( 'admin_email' ),
575
+							'name'    => esc_html__('From Email', 'give'),
576
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
577
+							'default' => get_bloginfo('admin_email'),
578 578
 							'type'    => 'text'
579 579
 						),
580 580
 						array(
581
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
581
+							'name' => esc_html__('Donation Receipt', 'give'),
582 582
 							'desc' => '',
583 583
 							'id'   => 'give_title_email_settings_2',
584 584
 							'type' => 'give_title'
585 585
 						),
586 586
 						array(
587 587
 							'id'      => 'donation_subject',
588
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
589
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
590
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
588
+							'name'    => esc_html__('Donation Email Subject', 'give'),
589
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
590
+							'default' => esc_attr__('Donation Receipt', 'give'),
591 591
 							'type'    => 'text'
592 592
 						),
593 593
 						array(
594 594
 							'id'      => 'donation_receipt',
595
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
595
+							'name'    => esc_html__('Donation Receipt', 'give'),
596 596
 							'desc'    => sprintf(
597 597
 								/* translators: %s: emails tags list */
598
-								esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
598
+								esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
599 599
 								'<br/>'.give_get_emails_tags_list()
600 600
 							),
601 601
 							'type'    => 'wysiwyg',
602 602
 							'default' => give_get_default_donation_receipt_email()
603 603
 						),
604 604
 						array(
605
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
605
+							'name' => esc_html__('New Donation Notification', 'give'),
606 606
 							'desc' => '',
607 607
 							'id'   => 'give_title_email_settings_3',
608 608
 							'type' => 'give_title'
609 609
 						),
610 610
 						array(
611 611
 							'id'      => 'donation_notification_subject',
612
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
613
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
612
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
613
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
614 614
 							'type'    => 'text',
615
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
615
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
616 616
 						),
617 617
 						array(
618 618
 							'id'      => 'donation_notification',
619
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
619
+							'name'    => esc_html__('Donation Notification', 'give'),
620 620
 							'desc'    => sprintf(
621 621
 								/* translators: %s: emails tags list */
622
-								esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
622
+								esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
623 623
 								'<br/>'.give_get_emails_tags_list()
624 624
 							),
625 625
 							'type'    => 'wysiwyg',
@@ -627,15 +627,15 @@  discard block
 block discarded – undo
627 627
 						),
628 628
 						array(
629 629
 							'id'      => 'admin_notice_emails',
630
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
631
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
630
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
631
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
632 632
 							'type'    => 'textarea',
633
-							'default' => get_bloginfo( 'admin_email' )
633
+							'default' => get_bloginfo('admin_email')
634 634
 						),
635 635
 						array(
636 636
 							'id'   => 'disable_admin_notices',
637
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
638
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
637
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
638
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
639 639
 							'type' => 'checkbox'
640 640
 						)
641 641
 					)
@@ -644,99 +644,99 @@  discard block
 block discarded – undo
644 644
 			/** Extension Settings */
645 645
 			'addons'      => array(
646 646
 				'id'         => 'addons',
647
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
648
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
649
-				'fields'     => apply_filters( 'give_settings_addons', array()
647
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
648
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
649
+				'fields'     => apply_filters('give_settings_addons', array()
650 650
 				)
651 651
 			),
652 652
 			/** Licenses Settings */
653 653
 			'licenses'    => array(
654 654
 				'id'         => 'licenses',
655
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
656
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
657
-				'fields'     => apply_filters( 'give_settings_licenses', array()
655
+				'give_title' => esc_html__('Give Licenses', 'give'),
656
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
657
+				'fields'     => apply_filters('give_settings_licenses', array()
658 658
 				)
659 659
 			),
660 660
 			/** Advanced Options */
661 661
 			'advanced'    => array(
662 662
 				'id'         => 'advanced_options',
663
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
664
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
665
-				'fields'     => apply_filters( 'give_settings_advanced', array(
663
+				'give_title' => esc_html__('Advanced Options', 'give'),
664
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
665
+				'fields'     => apply_filters('give_settings_advanced', array(
666 666
 						array(
667
-							'name' => esc_html__( 'Access Control', 'give' ),
667
+							'name' => esc_html__('Access Control', 'give'),
668 668
 							'desc' => '',
669 669
 							'id'   => 'give_title_session_control_1',
670 670
 							'type' => 'give_title'
671 671
 						),
672 672
 						array(
673 673
 							'id'      => 'session_lifetime',
674
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
675
-							'desc'    => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
674
+							'name'    => esc_html__('Session Lifetime', 'give'),
675
+							'desc'    => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
676 676
 							'type'    => 'select',
677 677
 							'options' => array(
678
-								'86400'  => esc_html__( '24 Hours', 'give' ),
679
-								'172800' => esc_html__( '48 Hours', 'give' ),
680
-								'259200' => esc_html__( '72 Hours', 'give' ),
681
-								'604800' => esc_html__( '1 Week', 'give' ),
678
+								'86400'  => esc_html__('24 Hours', 'give'),
679
+								'172800' => esc_html__('48 Hours', 'give'),
680
+								'259200' => esc_html__('72 Hours', 'give'),
681
+								'604800' => esc_html__('1 Week', 'give'),
682 682
 							)
683 683
 						),
684 684
 						array(
685
-							'name' => esc_html__( 'Email Access', 'give' ),
686
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
685
+							'name' => esc_html__('Email Access', 'give'),
686
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
687 687
 							'id'   => 'email_access',
688 688
 							'type' => 'checkbox',
689 689
 						),
690 690
 						array(
691 691
 							'id'      => 'recaptcha_key',
692
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
692
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
693 693
 							/* translators: %s: https://www.google.com/recaptcha/ */
694
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
694
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
695 695
 							'default' => '',
696 696
 							'type'    => 'text'
697 697
 						),
698 698
 						array(
699 699
 							'id'      => 'recaptcha_secret',
700
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
701
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
700
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
701
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
702 702
 							'default' => '',
703 703
 							'type'    => 'text'
704 704
 						),
705 705
 						array(
706
-							'name' => esc_html__( 'Data Control', 'give' ),
706
+							'name' => esc_html__('Data Control', 'give'),
707 707
 							'desc' => '',
708 708
 							'id'   => 'give_title_data_control_2',
709 709
 							'type' => 'give_title'
710 710
 						),
711 711
 						array(
712
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
713
-							'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
712
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
713
+							'desc' => esc_html__('When the plugin is deleted, completely remove all Give data.', 'give'),
714 714
 							'id'   => 'uninstall_on_delete',
715 715
 							'type' => 'checkbox'
716 716
 						),
717 717
 						array(
718
-							'name' => esc_html__( 'Filter Control', 'give' ),
718
+							'name' => esc_html__('Filter Control', 'give'),
719 719
 							'desc' => '',
720 720
 							'id'   => 'give_title_filter_control',
721 721
 							'type' => 'give_title'
722 722
 						),
723 723
 						array(
724 724
 							/* translators: %s: the_content */
725
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
725
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
726 726
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
727
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
727
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
728 728
 							'id'   => 'disable_the_content_filter',
729 729
 							'type' => 'checkbox'
730 730
 						),
731 731
 						array(
732
-							'name' => esc_html__( 'Script Loading', 'give' ),
732
+							'name' => esc_html__('Script Loading', 'give'),
733 733
 							'desc' => '',
734 734
 							'id'   => 'give_title_script_control',
735 735
 							'type' => 'give_title'
736 736
 						),
737 737
 						array(
738
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
739
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
738
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
739
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
740 740
 							'id'   => 'scripts_footer',
741 741
 							'type' => 'checkbox'
742 742
 						)
@@ -746,13 +746,13 @@  discard block
 block discarded – undo
746 746
 			/** API Settings */
747 747
 			'api'         => array(
748 748
 				'id'         => 'api',
749
-				'give_title' => esc_html__( 'API', 'give' ),
750
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
749
+				'give_title' => esc_html__('API', 'give'),
750
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
751 751
 				'show_names' => false, // Hide field names on the left
752
-				'fields'     => apply_filters( 'give_settings_system', array(
752
+				'fields'     => apply_filters('give_settings_system', array(
753 753
 						array(
754 754
 							'id'   => 'api',
755
-							'name' => esc_html__( 'API', 'give' ),
755
+							'name' => esc_html__('API', 'give'),
756 756
 							'type' => 'api'
757 757
 						)
758 758
 					)
@@ -761,13 +761,13 @@  discard block
 block discarded – undo
761 761
 			/** Licenses Settings */
762 762
 			'system_info' => array(
763 763
 				'id'         => 'system_info',
764
-				'give_title' => esc_html__( 'System Info', 'give' ),
765
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
766
-				'fields'     => apply_filters( 'give_settings_system', array(
764
+				'give_title' => esc_html__('System Info', 'give'),
765
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
766
+				'fields'     => apply_filters('give_settings_system', array(
767 767
 						array(
768 768
 							'id'   => 'system-info-textarea',
769
-							'name' => esc_html__( 'System Info', 'give' ),
770
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
769
+							'name' => esc_html__('System Info', 'give'),
770
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
771 771
 							'type' => 'system_info'
772 772
 						)
773 773
 					)
@@ -776,15 +776,15 @@  discard block
 block discarded – undo
776 776
 		);
777 777
 
778 778
 		//Return all settings array if no active tab
779
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
779
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
780 780
 
781
-			return apply_filters( 'give_registered_settings', $give_settings );
781
+			return apply_filters('give_registered_settings', $give_settings);
782 782
 
783 783
 		}
784 784
 
785 785
 
786 786
 		// Add other tabs and settings fields as needed
787
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
787
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
788 788
 
789 789
 	}
790 790
 
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
 	 */
794 794
 	public function settings_notices() {
795 795
 
796
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
796
+		if ( ! isset($_POST['give_settings_saved'])) {
797 797
 			return;
798 798
 		}
799 799
 
800
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
800
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
801 801
 
802 802
 	}
803 803
 
@@ -812,17 +812,17 @@  discard block
 block discarded – undo
812 812
 	 * @return mixed         Field value or exception is thrown.
813 813
 	 * @throws Exception     Throws an exception if the field is invalid.
814 814
 	 */
815
-	public function __get( $field ) {
815
+	public function __get($field) {
816 816
 
817 817
 		// Allowed fields to retrieve
818
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
818
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
819 819
 			return $this->{$field};
820 820
 		}
821
-		if ( 'option_metabox' === $field ) {
821
+		if ('option_metabox' === $field) {
822 822
 			return $this->option_metabox();
823 823
 		}
824 824
 
825
-		throw new Exception( sprintf( esc_html__( 'Invalid property: %s', 'give' ), $field ) );
825
+		throw new Exception(sprintf(esc_html__('Invalid property: %s', 'give'), $field));
826 826
 	}
827 827
 
828 828
 
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
  *
841 841
  * @return mixed        Option value
842 842
  */
843
-function give_get_option( $key = '', $default = false ) {
843
+function give_get_option($key = '', $default = false) {
844 844
 	$give_options = give_get_settings();
845
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
846
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
845
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
846
+	$value = apply_filters('give_get_option', $value, $key, $default);
847 847
 
848
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
848
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
849 849
 }
850 850
 
851 851
 
@@ -865,33 +865,33 @@  discard block
 block discarded – undo
865 865
  *
866 866
  * @return boolean True if updated, false if not.
867 867
  */
868
-function give_update_option( $key = '', $value = false ) {
868
+function give_update_option($key = '', $value = false) {
869 869
 
870 870
 	// If no key, exit
871
-	if ( empty( $key ) ) {
871
+	if (empty($key)) {
872 872
 		return false;
873 873
 	}
874 874
 
875
-	if ( empty( $value ) ) {
876
-		$remove_option = give_delete_option( $key );
875
+	if (empty($value)) {
876
+		$remove_option = give_delete_option($key);
877 877
 
878 878
 		return $remove_option;
879 879
 	}
880 880
 
881 881
 	// First let's grab the current settings
882
-	$options = get_option( 'give_settings' );
882
+	$options = get_option('give_settings');
883 883
 
884 884
 	// Let's let devs alter that value coming in
885
-	$value = apply_filters( 'give_update_option', $value, $key );
885
+	$value = apply_filters('give_update_option', $value, $key);
886 886
 
887 887
 	// Next let's try to update the value
888
-	$options[ $key ] = $value;
889
-	$did_update      = update_option( 'give_settings', $options );
888
+	$options[$key] = $value;
889
+	$did_update      = update_option('give_settings', $options);
890 890
 
891 891
 	// If it updated, let's update the global variable
892
-	if ( $did_update ) {
892
+	if ($did_update) {
893 893
 		global $give_options;
894
-		$give_options[ $key ] = $value;
894
+		$give_options[$key] = $value;
895 895
 	}
896 896
 
897 897
 	return $did_update;
@@ -910,27 +910,27 @@  discard block
 block discarded – undo
910 910
  *
911 911
  * @return boolean True if updated, false if not.
912 912
  */
913
-function give_delete_option( $key = '' ) {
913
+function give_delete_option($key = '') {
914 914
 
915 915
 	// If no key, exit
916
-	if ( empty( $key ) ) {
916
+	if (empty($key)) {
917 917
 		return false;
918 918
 	}
919 919
 
920 920
 	// First let's grab the current settings
921
-	$options = get_option( 'give_settings' );
921
+	$options = get_option('give_settings');
922 922
 
923 923
 	// Next let's try to update the value
924
-	if ( isset( $options[ $key ] ) ) {
924
+	if (isset($options[$key])) {
925 925
 
926
-		unset( $options[ $key ] );
926
+		unset($options[$key]);
927 927
 
928 928
 	}
929 929
 
930
-	$did_update = update_option( 'give_settings', $options );
930
+	$did_update = update_option('give_settings', $options);
931 931
 
932 932
 	// If it updated, let's update the global variable
933
-	if ( $did_update ) {
933
+	if ($did_update) {
934 934
 		global $give_options;
935 935
 		$give_options = $options;
936 936
 	}
@@ -949,9 +949,9 @@  discard block
 block discarded – undo
949 949
  */
950 950
 function give_get_settings() {
951 951
 
952
-	$settings = get_option( 'give_settings' );
952
+	$settings = get_option('give_settings');
953 953
 
954
-	return (array) apply_filters( 'give_get_settings', $settings );
954
+	return (array) apply_filters('give_get_settings', $settings);
955 955
 
956 956
 }
957 957
 
@@ -969,25 +969,25 @@  discard block
 block discarded – undo
969 969
  *
970 970
  * @return array
971 971
  */
972
-function give_settings_array_insert( $array, $position, $insert ) {
973
-	if ( is_int( $position ) ) {
974
-		array_splice( $array, $position, 0, $insert );
972
+function give_settings_array_insert($array, $position, $insert) {
973
+	if (is_int($position)) {
974
+		array_splice($array, $position, 0, $insert);
975 975
 	} else {
976 976
 
977
-		foreach ( $array as $index => $subarray ) {
978
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
977
+		foreach ($array as $index => $subarray) {
978
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
979 979
 				$pos = $index;
980 980
 			}
981 981
 		}
982 982
 
983
-		if ( ! isset( $pos ) ) {
983
+		if ( ! isset($pos)) {
984 984
 			return $array;
985 985
 		}
986 986
 
987 987
 		$array = array_merge(
988
-			array_slice( $array, 0, $pos ),
988
+			array_slice($array, 0, $pos),
989 989
 			$insert,
990
-			array_slice( $array, $pos )
990
+			array_slice($array, $pos)
991 991
 		);
992 992
 	}
993 993
 
@@ -1010,31 +1010,31 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @return void
1012 1012
  */
1013
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1013
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1014 1014
 
1015 1015
 	$id                = $field_type_object->field->args['id'];
1016 1016
 	$field_description = $field_type_object->field->args['desc'];
1017
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1017
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1018 1018
 
1019 1019
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1020 1020
 
1021
-	foreach ( $gateways as $key => $option ) :
1021
+	foreach ($gateways as $key => $option) :
1022 1022
 
1023
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1023
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1024 1024
 			$enabled = '1';
1025 1025
 		} else {
1026 1026
 			$enabled = null;
1027 1027
 		}
1028 1028
 
1029
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1030
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1029
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1030
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1031 1031
 
1032 1032
 	endforeach;
1033 1033
 
1034 1034
 	echo '</ul>';
1035 1035
 
1036
-	if ( $field_description ) {
1037
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1036
+	if ($field_description) {
1037
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1038 1038
 	}
1039 1039
 
1040 1040
 }
@@ -1050,31 +1050,31 @@  discard block
 block discarded – undo
1050 1050
  *
1051 1051
  * @return void
1052 1052
  */
1053
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1053
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1054 1054
 
1055 1055
 	$id                = $field_type_object->field->args['id'];
1056 1056
 	$field_description = $field_type_object->field->args['desc'];
1057 1057
 	$gateways          = give_get_enabled_payment_gateways();
1058 1058
 
1059
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1059
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1060 1060
 
1061 1061
 	//Add a field to the Give Form admin single post view of this field
1062
-	if ( $field_type_object->field->object_type === 'post' ) {
1063
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1062
+	if ($field_type_object->field->object_type === 'post') {
1063
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1064 1064
 	}
1065 1065
 
1066
-	foreach ( $gateways as $key => $option ) :
1066
+	foreach ($gateways as $key => $option) :
1067 1067
 
1068
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1068
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1069 1069
 
1070 1070
 
1071
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1071
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1072 1072
 
1073 1073
 	endforeach;
1074 1074
 
1075 1075
 	echo '</select>';
1076 1076
 
1077
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1077
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1078 1078
 
1079 1079
 }
1080 1080
 
@@ -1089,13 +1089,13 @@  discard block
 block discarded – undo
1089 1089
  *
1090 1090
  * @return void
1091 1091
  */
1092
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1092
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1093 1093
 
1094 1094
 	$id                = $field_type_object->field->args['id'];
1095 1095
 	$title             = $field_type_object->field->args['name'];
1096 1096
 	$field_description = $field_type_object->field->args['desc'];
1097 1097
 
1098
-	echo '<hr>' . $field_description;
1098
+	echo '<hr>'.$field_description;
1099 1099
 
1100 1100
 }
1101 1101
 
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
  *
1111 1111
  * @return void
1112 1112
  */
1113
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1113
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1114 1114
 
1115 1115
 	$id                = $field_type_object->field->args['id'];
1116 1116
 	$title             = $field_type_object->field->args['name'];
@@ -1130,25 +1130,25 @@  discard block
 block discarded – undo
1130 1130
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1131 1131
  * @return array An array of options that matches the CMB2 options array
1132 1132
  */
1133
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1133
+function give_cmb2_get_post_options($query_args, $force = false) {
1134 1134
 
1135
-	$post_options = array( '' => '' ); // Blank option
1135
+	$post_options = array('' => ''); // Blank option
1136 1136
 
1137
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1137
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1138 1138
 		return $post_options;
1139 1139
 	}
1140 1140
 
1141
-	$args = wp_parse_args( $query_args, array(
1141
+	$args = wp_parse_args($query_args, array(
1142 1142
 		'post_type'   => 'page',
1143 1143
 		'numberposts' => 10,
1144
-	) );
1144
+	));
1145 1145
 
1146
-	$posts = get_posts( $args );
1146
+	$posts = get_posts($args);
1147 1147
 
1148
-	if ( $posts ) {
1149
-		foreach ( $posts as $post ) {
1148
+	if ($posts) {
1149
+		foreach ($posts as $post) {
1150 1150
 
1151
-			$post_options[ $post->ID ] = $post->post_title;
1151
+			$post_options[$post->ID] = $post->post_title;
1152 1152
 
1153 1153
 		}
1154 1154
 	}
@@ -1170,17 +1170,17 @@  discard block
 block discarded – undo
1170 1170
 	global $_wp_additional_image_sizes;
1171 1171
 	$sizes = array();
1172 1172
 
1173
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1173
+	foreach (get_intermediate_image_sizes() as $_size) {
1174 1174
 
1175
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1176
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1177
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1178
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1175
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1176
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1177
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1178
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1179 1179
 		}
1180 1180
 
1181 1181
 	}
1182 1182
 
1183
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1183
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1184 1184
 }
1185 1185
 
1186 1186
 
@@ -1195,18 +1195,18 @@  discard block
 block discarded – undo
1195 1195
  *
1196 1196
  * @return void
1197 1197
  */
1198
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1198
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1199 1199
     /* @var CMB2_Types $field_type_object*/
1200 1200
 
1201 1201
     $id                   = $field_type_object->field->args['id'];
1202 1202
 	$field_description    = $field_type_object->field->args['desc'];
1203 1203
 	$license              = $field_type_object->field->args['options']['license'];
1204 1204
     $license_key          = $escaped_value;
1205
-    $is_license_key       = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1206
-    $is_valid_license     = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1205
+    $is_license_key       = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1206
+    $is_valid_license     = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1207 1207
     $shortname            = $field_type_object->field->args['options']['shortname'];
1208 1208
 	$field_classes        = 'regular-text give-license-field';
1209
-	$type                 = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1209
+	$type                 = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1210 1210
     $custom_html          = '';
1211 1211
     $value                = $escaped_value;
1212 1212
     $messages             = array();
@@ -1219,17 +1219,17 @@  discard block
 block discarded – undo
1219 1219
 
1220 1220
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1221 1221
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1222
-	if( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1222
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1223 1223
 		$is_license_key = false;
1224 1224
 	}
1225 1225
 
1226 1226
 
1227 1227
     // Check if current license is part of subscription or not.
1228
-    $subscriptions = get_option( 'give_subscriptions' );
1228
+    $subscriptions = get_option('give_subscriptions');
1229 1229
 
1230
-    if( $is_license_key && $subscriptions ) {
1231
-        foreach ( $subscriptions as $subscription ) {
1232
-            if( in_array( $license_key, $subscription['licenses'] ) ) {
1230
+    if ($is_license_key && $subscriptions) {
1231
+        foreach ($subscriptions as $subscription) {
1232
+            if (in_array($license_key, $subscription['licenses'])) {
1233 1233
                 $is_in_subscription = $subscription['id'];
1234 1234
                 break;
1235 1235
             }
@@ -1237,132 +1237,132 @@  discard block
 block discarded – undo
1237 1237
     }
1238 1238
 
1239 1239
 
1240
-    if( $is_license_key ) {
1241
-        if( $is_in_subscription ) {
1242
-            $subscription_expires = strtotime( $subscriptions[$is_in_subscription]['expires'] );
1243
-            $subscription_status  = __( 'renew', 'give' );
1240
+    if ($is_license_key) {
1241
+        if ($is_in_subscription) {
1242
+            $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1243
+            $subscription_status  = __('renew', 'give');
1244 1244
 
1245
-            if( ( 'active' !== $subscriptions[$is_in_subscription]['status'] ) ){
1246
-                $subscription_status = __( 'expire', 'give' );
1245
+            if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1246
+                $subscription_status = __('expire', 'give');
1247 1247
             }
1248 1248
 
1249
-            if( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1249
+            if ($subscription_expires < current_time('timestamp', 1)) {
1250 1250
                 $messages[] = sprintf(
1251
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1252
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1251
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1252
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1253 1253
                     $subscriptions[$is_in_subscription]['payment_id'],
1254
-                    $checkout_page_link . '?edd_license_key=' . $subscriptions[$is_in_subscription]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1254
+                    $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1255 1255
                 );
1256 1256
                 $license_status = 'license-expired';
1257
-            } elseif( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1257
+            } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1258 1258
                 $messages[] = sprintf(
1259
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1260
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1259
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give'),
1260
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1261 1261
                     $subscriptions[$is_in_subscription]['payment_id'],
1262 1262
                     $subscription_status,
1263
-                    human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[$is_in_subscription]['expires'] ) )
1263
+                    human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1264 1264
                 );
1265 1265
                 $license_status = 'license-expires-soon';
1266 1266
             } else {
1267 1267
                 $messages[] = sprintf(
1268
-                    __( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1269
-                    urldecode( $subscriptions[$is_in_subscription]['invoice_url'] ),
1268
+                    __('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give'),
1269
+                    urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1270 1270
                     $subscriptions[$is_in_subscription]['payment_id'],
1271 1271
                     $subscription_status,
1272
-                    date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[$is_in_subscription]['expires'], current_time( 'timestamp' ) ) )
1272
+                    date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1273 1273
                 );
1274 1274
                 $license_status = 'license-expiration-date';
1275 1275
             }
1276 1276
 
1277 1277
 
1278
-        } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1278
+        } elseif (empty($license->success) && property_exists($license, 'error')) {
1279 1279
 
1280 1280
             // activate_license 'invalid' on anything other than valid, so if there was an error capture it
1281
-            switch(   $license->error ) {
1281
+            switch ($license->error) {
1282 1282
                 case 'expired' :
1283
-					error_log(print_r( $license->error, true) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log');
1283
+					error_log(print_r($license->error, true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log');
1284 1284
                     $class = $license->error;
1285 1285
                     $messages[] = sprintf(
1286
-                        __( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1287
-                        date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1288
-                        $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1286
+                        __('Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1287
+                        date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1288
+                        $checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1289 1289
                     );
1290
-                    $license_status = 'license-' . $class;
1290
+                    $license_status = 'license-'.$class;
1291 1291
                     break;
1292 1292
 
1293 1293
                 case 'missing' :
1294 1294
                     $class = $license->error;
1295 1295
                     $messages[] = sprintf(
1296
-                        __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1297
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1296
+                        __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1297
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1298 1298
                     );
1299
-                    $license_status = 'license-' . $class;
1299
+                    $license_status = 'license-'.$class;
1300 1300
                     break;
1301 1301
 
1302 1302
                 case 'invalid' :
1303 1303
                     $class = $license->error;
1304 1304
                     $messages[] = sprintf(
1305
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1305
+                        __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1306 1306
                         $addon_name,
1307
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1307
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1308 1308
                     );
1309
-                    $license_status = 'license-' . $class;
1309
+                    $license_status = 'license-'.$class;
1310 1310
                     break;
1311 1311
 
1312 1312
                 case 'site_inactive' :
1313 1313
                     $class = $license->error;
1314 1314
                     $messages[] = sprintf(
1315
-                        __( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1315
+                        __('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1316 1316
                         $addon_name,
1317
-                        $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1317
+                        $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1318 1318
                     );
1319
-                    $license_status = 'license-' . $class;
1319
+                    $license_status = 'license-'.$class;
1320 1320
                     break;
1321 1321
 
1322 1322
                 case 'item_name_mismatch' :
1323 1323
                     $class = $license->error;
1324
-                    $messages[] = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1325
-                    $license_status = 'license-' . $class;
1324
+                    $messages[] = sprintf(__('This license %s does not belong to %s.', 'give'), $value, $addon_name);
1325
+                    $license_status = 'license-'.$class;
1326 1326
                     break;
1327 1327
 
1328 1328
                 case 'no_activations_left':
1329 1329
                     $class = $license->error;
1330
-                    $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1331
-                    $license_status = 'license-' . $class;
1330
+                    $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1331
+                    $license_status = 'license-'.$class;
1332 1332
                     break;
1333 1333
             }
1334 1334
         } else {
1335
-            switch( $license->license ) {
1335
+            switch ($license->license) {
1336 1336
                 case 'valid' :
1337 1337
                 default:
1338 1338
                     $class = 'valid';
1339
-                    $now        = current_time( 'timestamp' );
1340
-                    $expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1339
+                    $now        = current_time('timestamp');
1340
+                    $expiration = strtotime($license->expires, current_time('timestamp'));
1341 1341
 
1342
-                    if( 'lifetime' === $license->expires ) {
1343
-                        $messages[] = __( 'License key never expires.', 'give' );
1342
+                    if ('lifetime' === $license->expires) {
1343
+                        $messages[] = __('License key never expires.', 'give');
1344 1344
                         $license_status = 'license-lifetime-notice';
1345
-                    } elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1345
+                    } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1346 1346
                         $messages[] = sprintf(
1347
-                            __( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1348
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1349
-                            $checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1347
+                            __('Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1348
+                            date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1349
+                            $checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1350 1350
                         );
1351 1351
                         $license_status = 'license-expires-soon';
1352 1352
                     } else {
1353 1353
                         $messages[] = sprintf(
1354
-                            __( 'Your license key expires on %s.', 'give' ),
1355
-                            date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1354
+                            __('Your license key expires on %s.', 'give'),
1355
+                            date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1356 1356
                         );
1357 1357
                         $license_status = 'license-expiration-date';
1358 1358
                     }
1359 1359
                     break;
1360 1360
             }
1361 1361
         }
1362
-    } else{
1362
+    } else {
1363 1363
 		$class = 'empty';
1364 1364
 		$messages[] = sprintf(
1365
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1365
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1366 1366
 			$addon_name
1367 1367
 		);
1368 1368
 		$license_status = null;
@@ -1370,52 +1370,52 @@  discard block
 block discarded – undo
1370 1370
 
1371 1371
 
1372 1372
     // Add class for input field if license is active.
1373
-	if ( $is_valid_license ) {
1373
+	if ($is_valid_license) {
1374 1374
 		$field_classes .= ' give-license-active';
1375 1375
 	}
1376 1376
 
1377 1377
 	// Get input filed html.
1378
-	$input_field_html = $field_type_object->input( array(
1378
+	$input_field_html = $field_type_object->input(array(
1379 1379
 		'class' => $field_classes,
1380 1380
 		'type'  => $type
1381
-	) );
1381
+	));
1382 1382
 
1383 1383
 	// If license is active so show deactivate button
1384
-	if ( $is_valid_license ) {
1384
+	if ($is_valid_license) {
1385 1385
         // Get input filed html.
1386
-        $input_field_html = $field_type_object->input( array(
1386
+        $input_field_html = $field_type_object->input(array(
1387 1387
             'class' => $field_classes,
1388 1388
             'type'  => $type,
1389 1389
             'readonly' => 'readonly',
1390
-        ) );
1390
+        ));
1391 1391
 
1392
-		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1392
+		$custom_html = '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1393 1393
 	}
1394 1394
 
1395 1395
 	// Field description.
1396
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1396
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1397 1397
 
1398 1398
     // If no messages found then inform user that to get updated in future register yourself.
1399
-    if ( empty( $messages ) ) {
1400
-        $messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid Software Licensing license key.', 'give' ) );
1399
+    if (empty($messages)) {
1400
+        $messages[] = apply_filters("{$shortname}_default_addon_notice", esc_html__('To receive updates, please enter your valid Software Licensing license key.', 'give'));
1401 1401
     }
1402 1402
 
1403
-    foreach( $messages as $message ) {
1404
-        $custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1405
-        $custom_html .= '<p>' . $message . '</p>';
1403
+    foreach ($messages as $message) {
1404
+        $custom_html .= '<div class="give-license-notice give-'.$license_status.'">';
1405
+        $custom_html .= '<p>'.$message.'</p>';
1406 1406
         $custom_html .= '</div>';
1407 1407
     }
1408 1408
 
1409 1409
 
1410 1410
 
1411 1411
     // Field html.
1412
-    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object );
1412
+    $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1413 1413
 
1414 1414
     // Nonce.
1415
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1415
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1416 1416
 
1417 1417
     // Print field html.
1418
-    echo '<div>' . $custom_html . '</div>';
1418
+    echo '<div>'.$custom_html.'</div>';
1419 1419
 }
1420 1420
 
1421 1421
 
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
  */
1428 1428
 function give_api_callback() {
1429 1429
 
1430
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1430
+	if ( ! current_user_can('manage_give_settings')) {
1431 1431
 		return;
1432 1432
 	}
1433 1433
 
@@ -1436,9 +1436,9 @@  discard block
 block discarded – undo
1436 1436
 	 *
1437 1437
 	 * @since 1.0
1438 1438
 	 */
1439
-	do_action( 'give_tools_api_keys_before' );
1439
+	do_action('give_tools_api_keys_before');
1440 1440
 
1441
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1441
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1442 1442
 
1443 1443
 	$api_keys_table = new Give_API_Keys_Table();
1444 1444
 	$api_keys_table->prepare_items();
@@ -1447,9 +1447,9 @@  discard block
 block discarded – undo
1447 1447
 	<span class="cmb2-metabox-description api-description">
1448 1448
 		<?php echo sprintf(
1449 1449
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1450
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1451
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1452
-			esc_url( 'https://givewp.com/addons/zapier/' )
1450
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1451
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1452
+			esc_url('https://givewp.com/addons/zapier/')
1453 1453
 		); ?>
1454 1454
 	</span>
1455 1455
 	<?php
@@ -1459,10 +1459,10 @@  discard block
 block discarded – undo
1459 1459
 	 *
1460 1460
 	 * @since 1.0
1461 1461
 	 */
1462
-	do_action( 'give_tools_api_keys_after' );
1462
+	do_action('give_tools_api_keys_after');
1463 1463
 }
1464 1464
 
1465
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1465
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1466 1466
 
1467 1467
 /**
1468 1468
  * Hook Callback
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
  *
1476 1476
  * @return void
1477 1477
  */
1478
-function give_hook_callback( $args ) {
1478
+function give_hook_callback($args) {
1479 1479
 
1480 1480
 	$id = $args['id'];
1481 1481
 
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 	 *
1485 1485
 	 * @since 1.0
1486 1486
 	 */
1487
-	do_action( "give_{$id}" );
1487
+	do_action("give_{$id}");
1488 1488
 
1489 1489
 }
1490 1490
 
@@ -1496,10 +1496,10 @@  discard block
 block discarded – undo
1496 1496
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1497 1497
  */
1498 1498
 
1499
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1500
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1501
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1502
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1503
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1504
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1499
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1500
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1501
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1502
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1503
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1504
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1505 1505
 }
1506 1506
\ No newline at end of file
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -408,30 +408,30 @@
 block discarded – undo
408 408
 		die( '-2' );
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        esc_html_e( 'n/a', 'give' );
413
-    } else {
414
-        // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
416
-
417
-        // Payment meta.
418
-        $payment_meta = $payment->get_meta();
419
-
420
-
421
-        // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
423
-            'id'                => $form_id,
424
-            'name'              => 'give-variable-price',
425
-            'chosen'            => true,
426
-            'show_option_all'   => '',
427
-            'selected'          => $payment_meta['price_id'],
428
-        );
429
-
430
-        // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
-    }
433
-
434
-    give_die();
411
+	if ( ! give_has_variable_prices( $form_id ) ) {
412
+		esc_html_e( 'n/a', 'give' );
413
+	} else {
414
+		// Payment object.
415
+		$payment = new Give_Payment( $payment_id );
416
+
417
+		// Payment meta.
418
+		$payment_meta = $payment->get_meta();
419
+
420
+
421
+		// Variable price dropdown options.
422
+		$variable_price_dropdown_option =  array(
423
+			'id'                => $form_id,
424
+			'name'              => 'give-variable-price',
425
+			'chosen'            => true,
426
+			'show_option_all'   => '',
427
+			'selected'          => $payment_meta['price_id'],
428
+		);
429
+
430
+		// Render variable prices select tag html.
431
+		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
+	}
433
+
434
+	give_die();
435 435
 }
436 436
 
437 437
 add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 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
 
@@ -26,27 +26,27 @@  discard block
 block discarded – undo
26 26
 function give_test_ajax_works() {
27 27
 
28 28
 	// Check if the Airplane Mode plugin is installed
29
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31 31
 		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-		if ( method_exists( $airplane, 'enabled' ) ) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-			if ( $airplane->enabled() ) {
35
+			if ($airplane->enabled()) {
36 36
 				return true;
37 37
 			}
38 38
 
39 39
 		} else {
40 40
 
41
-			if ( $airplane->check_status() == 'on' ) {
41
+			if ($airplane->check_status() == 'on') {
42 42
 				return true;
43 43
 			}
44 44
 		}
45 45
 	}
46 46
 
47
-	add_filter( 'block_local_requests', '__return_false' );
47
+	add_filter('block_local_requests', '__return_false');
48 48
 
49
-	if ( get_transient( '_give_ajax_works' ) ) {
49
+	if (get_transient('_give_ajax_works')) {
50 50
 		return true;
51 51
 	}
52 52
 
@@ -58,35 +58,35 @@  discard block
 block discarded – undo
58 58
 		)
59 59
 	);
60 60
 
61
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
61
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
62 62
 	$works = true;
63 63
 
64
-	if ( is_wp_error( $ajax ) ) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66 66
 		$works = false;
67 67
 
68 68
 	} else {
69 69
 
70
-		if ( empty( $ajax['response'] ) ) {
70
+		if (empty($ajax['response'])) {
71 71
 			$works = false;
72 72
 		}
73 73
 
74
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
74
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
 			$works = false;
76 76
 		}
77 77
 
78
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79 79
 			$works = false;
80 80
 		}
81 81
 
82
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
82
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
 			$works = false;
84 84
 		}
85 85
 
86 86
 	}
87 87
 
88
-	if ( $works ) {
89
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
88
+	if ($works) {
89
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
90 90
 	}
91 91
 
92 92
 	return $works;
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
  * @return string
102 102
  */
103 103
 function give_get_ajax_url() {
104
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
104
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
105 105
 
106 106
 	$current_url = give_get_current_page_url();
107
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
107
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
108 108
 
109
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
110
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
109
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
110
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
111 111
 	}
112 112
 
113
-	return apply_filters( 'give_ajax_url', $ajax_url );
113
+	return apply_filters('give_ajax_url', $ajax_url);
114 114
 }
115 115
 
116 116
 /**
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @since 1.7
128 128
 	 */
129
-	do_action( 'give_donation_form_login_fields' );
129
+	do_action('give_donation_form_login_fields');
130 130
 
131 131
 	give_die();
132 132
 }
133 133
 
134
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
134
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
135 135
 
136 136
 /**
137 137
  * Load Checkout Fields
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
  * @return void
142 142
  */
143 143
 function give_load_checkout_fields() {
144
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
144
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
145 145
 
146 146
 	ob_start();
147 147
 
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @since 1.7
152 152
 	 */
153
-	do_action( 'give_donation_form_register_login_fields', $form_id );
153
+	do_action('give_donation_form_register_login_fields', $form_id);
154 154
 
155 155
 	$fields = ob_get_clean();
156 156
 
157
-	wp_send_json( array(
158
-		'fields' => wp_json_encode( $fields ),
159
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
160
-	) );
157
+	wp_send_json(array(
158
+		'fields' => wp_json_encode($fields),
159
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
160
+	));
161 161
 }
162 162
 
163
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
164
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
163
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
164
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
165 165
 
166 166
 /**
167 167
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
  * @return void
172 172
  */
173 173
 function give_ajax_get_form_title() {
174
-	if ( isset( $_POST['form_id'] ) ) {
175
-		$title = get_the_title( $_POST['form_id'] );
176
-		if ( $title ) {
174
+	if (isset($_POST['form_id'])) {
175
+		$title = get_the_title($_POST['form_id']);
176
+		if ($title) {
177 177
 			echo $title;
178 178
 		} else {
179 179
 			echo 'fail';
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	give_die();
183 183
 }
184 184
 
185
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
186
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
185
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
186
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
187 187
 
188 188
 /**
189 189
  * Retrieve a states drop down
@@ -194,23 +194,23 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_ajax_get_states_field() {
196 196
 
197
-	if ( empty( $_POST['country'] ) ) {
197
+	if (empty($_POST['country'])) {
198 198
 		$_POST['country'] = give_get_country();
199 199
 	}
200
-	$states = give_get_states( $_POST['country'] );
200
+	$states = give_get_states($_POST['country']);
201 201
 
202
-	if ( ! empty( $states ) ) {
202
+	if ( ! empty($states)) {
203 203
 
204 204
 		$args = array(
205 205
 			'name'             => $_POST['field_name'],
206 206
 			'id'               => $_POST['field_name'],
207
-			'class'            => $_POST['field_name'] . '  give-select',
208
-			'options'          => give_get_states( $_POST['country'] ),
207
+			'class'            => $_POST['field_name'].'  give-select',
208
+			'options'          => give_get_states($_POST['country']),
209 209
 			'show_option_all'  => false,
210 210
 			'show_option_none' => false
211 211
 		);
212 212
 
213
-		$response = Give()->html->select( $args );
213
+		$response = Give()->html->select($args);
214 214
 
215 215
 	} else {
216 216
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	give_die();
223 223
 }
224 224
 
225
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
226
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
225
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
226
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
227 227
 
228 228
 /**
229 229
  * Retrieve a states drop down
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 function give_ajax_form_search() {
236 236
 	global $wpdb;
237 237
 
238
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
238
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
239 239
 	$results = array();
240
-	if ( current_user_can( 'edit_give_forms' ) ) {
241
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
240
+	if (current_user_can('edit_give_forms')) {
241
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
242 242
 	} else {
243
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
243
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
244 244
 	}
245 245
 
246
-	if ( $items ) {
246
+	if ($items) {
247 247
 
248
-		foreach ( $items as $item ) {
248
+		foreach ($items as $item) {
249 249
 
250 250
 			$results[] = array(
251 251
 				'id'   => $item->ID,
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$items[] = array(
259 259
 			'id'   => 0,
260
-			'name' => esc_html__( 'No forms found.', 'give' )
260
+			'name' => esc_html__('No forms found.', 'give')
261 261
 		);
262 262
 
263 263
 	}
264 264
 
265
-	echo json_encode( $results );
265
+	echo json_encode($results);
266 266
 
267 267
 	give_die();
268 268
 }
269 269
 
270
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
271
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
270
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
271
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
272 272
 
273 273
 /**
274 274
  * Search the donors database via Ajax
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 function give_ajax_donor_search() {
281 281
 	global $wpdb;
282 282
 
283
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
283
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
284 284
 	$results = array();
285
-	if ( ! current_user_can( 'view_give_reports' ) ) {
285
+	if ( ! current_user_can('view_give_reports')) {
286 286
 		$donors = array();
287 287
 	} else {
288
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
288
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
289 289
 	}
290 290
 
291
-	if ( $donors ) {
291
+	if ($donors) {
292 292
 
293
-		foreach ( $donors as $donor ) {
293
+		foreach ($donors as $donor) {
294 294
 
295 295
 			$results[] = array(
296 296
 				'id'   => $donor->id,
297
-				'name' => $donor->name . '(' . $donor->email . ')'
297
+				'name' => $donor->name.'('.$donor->email.')'
298 298
 			);
299 299
 		}
300 300
 
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$donors[] = array(
304 304
 			'id'   => 0,
305
-			'name' => esc_html__( 'No donors found.', 'give' )
305
+			'name' => esc_html__('No donors found.', 'give')
306 306
 		);
307 307
 
308 308
 	}
309 309
 
310
-	echo json_encode( $results );
310
+	echo json_encode($results);
311 311
 
312 312
 	give_die();
313 313
 }
314 314
 
315
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
315
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
316 316
 
317 317
 
318 318
 /**
@@ -324,42 +324,42 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function give_ajax_search_users() {
326 326
 
327
-	if ( current_user_can( 'manage_give_settings' ) ) {
327
+	if (current_user_can('manage_give_settings')) {
328 328
 
329
-		$search_query = trim( $_POST['user_name'] );
330
-		$exclude      = trim( $_POST['exclude'] );
329
+		$search_query = trim($_POST['user_name']);
330
+		$exclude      = trim($_POST['exclude']);
331 331
 
332 332
 		$get_users_args = array(
333 333
 			'number' => 9999,
334
-			'search' => $search_query . '*'
334
+			'search' => $search_query.'*'
335 335
 		);
336 336
 
337
-		if ( ! empty( $exclude ) ) {
338
-			$exclude_array             = explode( ',', $exclude );
337
+		if ( ! empty($exclude)) {
338
+			$exclude_array             = explode(',', $exclude);
339 339
 			$get_users_args['exclude'] = $exclude_array;
340 340
 		}
341 341
 
342
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
342
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
343 343
 
344
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
344
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
345 345
 
346 346
 		$user_list = '<ul>';
347
-		if ( $found_users ) {
348
-			foreach ( $found_users as $user ) {
349
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
347
+		if ($found_users) {
348
+			foreach ($found_users as $user) {
349
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
350 350
 			}
351 351
 		} else {
352
-			$user_list .= '<li>' . esc_html__( 'No users found.', 'give' ) . '</li>';
352
+			$user_list .= '<li>'.esc_html__('No users found.', 'give').'</li>';
353 353
 		}
354 354
 		$user_list .= '</ul>';
355 355
 
356
-		echo json_encode( array( 'results' => $user_list ) );
356
+		echo json_encode(array('results' => $user_list));
357 357
 
358 358
 	}
359 359
 	die();
360 360
 }
361 361
 
362
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
362
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
363 363
 
364 364
 
365 365
 /**
@@ -371,32 +371,32 @@  discard block
 block discarded – undo
371 371
  */
372 372
 function give_check_for_form_price_variations() {
373 373
 
374
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
375
-		die( '-1' );
374
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
375
+		die('-1');
376 376
 	}
377 377
 
378
-	$form_id = intval( $_POST['form_id'] );
379
-	$form    = get_post( $form_id );
378
+	$form_id = intval($_POST['form_id']);
379
+	$form    = get_post($form_id);
380 380
 
381
-	if ( 'give_forms' != $form->post_type ) {
382
-		die( '-2' );
381
+	if ('give_forms' != $form->post_type) {
382
+		die('-2');
383 383
 	}
384 384
 
385
-	if ( give_has_variable_prices( $form_id ) ) {
386
-		$variable_prices = give_get_variable_prices( $form_id );
385
+	if (give_has_variable_prices($form_id)) {
386
+		$variable_prices = give_get_variable_prices($form_id);
387 387
 
388
-		if ( $variable_prices ) {
388
+		if ($variable_prices) {
389 389
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
390 390
 
391
-			if ( isset( $_POST['all_prices'] ) ) {
392
-				$ajax_response .= '<option value="">' . esc_html__( 'All Levels', 'give' ) . '</option>';
391
+			if (isset($_POST['all_prices'])) {
392
+				$ajax_response .= '<option value="">'.esc_html__('All Levels', 'give').'</option>';
393 393
 			}
394 394
 
395
-			foreach ( $variable_prices as $key => $price ) {
395
+			foreach ($variable_prices as $key => $price) {
396 396
 
397
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
397
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
398 398
 				
399
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
399
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
400 400
 			}
401 401
 			$ajax_response .= '</select>';
402 402
 			echo $ajax_response;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	give_die();
408 408
 }
409 409
 
410
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
410
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
411 411
 
412 412
 
413 413
 /**
@@ -418,30 +418,30 @@  discard block
 block discarded – undo
418 418
  * @return void
419 419
  */
420 420
 function give_check_for_form_price_variations_html() {
421
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
421
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
422 422
 		wp_die();
423 423
 	}
424 424
 
425
-	$form_id = intval( $_POST['form_id'] );
426
-	$payment_id = intval( $_POST['payment_id'] );
427
-	$form    = get_post( $form_id );
425
+	$form_id = intval($_POST['form_id']);
426
+	$payment_id = intval($_POST['payment_id']);
427
+	$form    = get_post($form_id);
428 428
 
429
-	if ( 'give_forms' != $form->post_type ) {
429
+	if ('give_forms' != $form->post_type) {
430 430
 		wp_die();
431 431
 	}
432 432
 
433
-    if ( ! give_has_variable_prices( $form_id ) ) {
434
-        esc_html_e( 'n/a', 'give' );
433
+    if ( ! give_has_variable_prices($form_id)) {
434
+        esc_html_e('n/a', 'give');
435 435
     } else {
436 436
         // Payment object.
437
-        $payment = new Give_Payment( $payment_id );
437
+        $payment = new Give_Payment($payment_id);
438 438
 
439 439
         // Payment meta.
440 440
         $payment_meta = $payment->get_meta();
441 441
 
442 442
 
443 443
         // Variable price dropdown options.
444
-        $variable_price_dropdown_option =  array(
444
+        $variable_price_dropdown_option = array(
445 445
             'id'                => $form_id,
446 446
             'name'              => 'give-variable-price',
447 447
             'chosen'            => true,
@@ -450,10 +450,10 @@  discard block
 block discarded – undo
450 450
         );
451 451
 
452 452
         // Render variable prices select tag html.
453
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
453
+        give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
454 454
     }
455 455
 
456 456
     give_die();
457 457
 }
458 458
 
459
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
459
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/process-purchase.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1070,58 +1070,58 @@
 block discarded – undo
1070 1070
  * @return bool
1071 1071
  */
1072 1072
 function give_validate_multi_donation_form_level(  $valid_data, $data ) {
1073
-    /* @var Give_Donate_Form $form*/
1074
-    $form = new Give_Donate_Form( $data['give-form-id'] );
1073
+	/* @var Give_Donate_Form $form*/
1074
+	$form = new Give_Donate_Form( $data['give-form-id'] );
1075 1075
 
1076
-    $donation_level_matched = false;
1076
+	$donation_level_matched = false;
1077 1077
 
1078
-    if( $form->is_multi_type_donation_form() ) {
1078
+	if( $form->is_multi_type_donation_form() ) {
1079 1079
 
1080
-        // Bailout.
1081
-        if( ! ( $variable_prices = $form->get_prices() ) ) {
1082
-            return false;
1083
-        }
1080
+		// Bailout.
1081
+		if( ! ( $variable_prices = $form->get_prices() ) ) {
1082
+			return false;
1083
+		}
1084 1084
 
1085
-        // Sanitize donation amount.
1086
-        $data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1085
+		// Sanitize donation amount.
1086
+		$data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1087 1087
 
1088
-        // Get number of decimals.
1089
-        $default_decimals = give_get_price_decimals();
1088
+		// Get number of decimals.
1089
+		$default_decimals = give_get_price_decimals();
1090 1090
 
1091
-        if( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ){
1092
-            return true;
1093
-        }
1091
+		if( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ){
1092
+			return true;
1093
+		}
1094 1094
 
1095 1095
         
1096
-        // Find correct donation level from all donation levels.
1097
-        foreach ( $variable_prices as $variable_price ) {
1098
-            // Sanitize level amount.
1099
-            $variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1100
-
1101
-            // Set first match donation level ID.
1102
-            if( $data['give-amount'] === $variable_price['_give_amount'] ) {
1103
-                $_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1104
-                $donation_level_matched = true;
1105
-                break;
1106
-            }
1107
-        }
1108
-
1109
-        // If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1110
-        // If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1111
-        if(
1112
-            ! $donation_level_matched
1113
-            && ( 'yes' === get_post_meta( $data['give-form-id'], '_give_custom_amount', true ) )
1114
-        ) {
1115
-            // Sanitize custom minimum amount.
1116
-            $custom_minimum_amount = give_sanitize_amount( get_post_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1117
-
1118
-            if( $data['give-amount'] >= $custom_minimum_amount ) {
1119
-                $_POST['give-price-id'] = 'custom';
1120
-                $donation_level_matched  = true;
1121
-            }
1122
-        }
1123
-    }
1124
-
1125
-    return ( $donation_level_matched ? true : false );
1096
+		// Find correct donation level from all donation levels.
1097
+		foreach ( $variable_prices as $variable_price ) {
1098
+			// Sanitize level amount.
1099
+			$variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1100
+
1101
+			// Set first match donation level ID.
1102
+			if( $data['give-amount'] === $variable_price['_give_amount'] ) {
1103
+				$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1104
+				$donation_level_matched = true;
1105
+				break;
1106
+			}
1107
+		}
1108
+
1109
+		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1110
+		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1111
+		if(
1112
+			! $donation_level_matched
1113
+			&& ( 'yes' === get_post_meta( $data['give-form-id'], '_give_custom_amount', true ) )
1114
+		) {
1115
+			// Sanitize custom minimum amount.
1116
+			$custom_minimum_amount = give_sanitize_amount( get_post_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1117
+
1118
+			if( $data['give-amount'] >= $custom_minimum_amount ) {
1119
+				$_POST['give-price-id'] = 'custom';
1120
+				$donation_level_matched  = true;
1121
+			}
1122
+		}
1123
+	}
1124
+
1125
+	return ( $donation_level_matched ? true : false );
1126 1126
 }
1127 1127
 add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1128 1128
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +260 added lines, -260 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_purchase' );
33
+	do_action('give_pre_process_purchase');
34 34
 
35 35
 	// Validate the form $_POST data
36 36
 	$valid_data = give_purchase_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array      $_POST      Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user
58
-	$user = give_get_purchase_form_user( $valid_data );
58
+	$user = give_get_purchase_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_checkout_errors' );
67
+			do_action('give_ajax_checkout_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	//If AJAX send back success to proceed with form submission
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	//After AJAX: Setup session if not using php_sessions
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		//Double-check that set_cookie is publicly accessible;
83 83
 		// we're using a slightly modified class-wp-sessions.php
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address']
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
103
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
103
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
104 104
 
105 105
 	// Setup donation information
106 106
 	$purchase_data = array(
107 107
 		'price'        => $price,
108 108
 		'purchase_key' => $purchase_key,
109 109
 		'user_email'   => $user['user_email'],
110
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
111
-		'user_info'    => stripslashes_deep( $user_info ),
110
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
111
+		'user_info'    => stripslashes_deep($user_info),
112 112
 		'post_data'    => $_POST,
113 113
 		'gateway'      => $valid_data['gateway'],
114 114
 		'card_info'    => $valid_data['cc_info']
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param array      $user_info  Array containing basic user information.
129 129
 	 * @param bool|array $valid_data Validate fields.
130 130
 	 */
131
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
131
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
132 132
 
133 133
 	//Sanity check for price
134
-	if ( ! $purchase_data['price'] ) {
134
+	if ( ! $purchase_data['price']) {
135 135
 		// Revert to manual
136 136
 		$purchase_data['gateway'] = 'manual';
137 137
 		$_POST['give-gateway']    = 'manual';
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @since 1.7
144 144
 	 */
145
-	$purchase_data = apply_filters( 'give_donation_data_before_gateway', $purchase_data, $valid_data );
145
+	$purchase_data = apply_filters('give_donation_data_before_gateway', $purchase_data, $valid_data);
146 146
 
147 147
 	// Setup the data we're storing in the donation session
148 148
 	$session_data = $purchase_data;
149 149
 
150 150
 	// Make sure credit card numbers are never stored in sessions
151
-	unset( $session_data['card_info']['card_number'] );
152
-	unset( $session_data['post_data']['card_number'] );
151
+	unset($session_data['card_info']['card_number']);
152
+	unset($session_data['post_data']['card_number']);
153 153
 
154 154
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
155
-	give_set_purchase_session( $session_data );
155
+	give_set_purchase_session($session_data);
156 156
 
157 157
 	// Send info to the gateway for payment processing
158
-	give_send_to_gateway( $purchase_data['gateway'], $purchase_data );
158
+	give_send_to_gateway($purchase_data['gateway'], $purchase_data);
159 159
 	give_die();
160 160
 
161 161
 }
162 162
 
163
-add_action( 'give_purchase', 'give_process_purchase_form' );
164
-add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' );
165
-add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' );
163
+add_action('give_purchase', 'give_process_purchase_form');
164
+add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form');
165
+add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form');
166 166
 
167 167
 
168 168
 /**
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
  * @param  array $post       Additional $_POST data submitted
174 174
  * @return void
175 175
  */
176
-function give_checkout_check_existing_email( $valid_data, $post ) {
176
+function give_checkout_check_existing_email($valid_data, $post) {
177 177
 	
178 178
 	// Verify that the email address belongs to this customer
179
-	if ( is_user_logged_in() ) {
179
+	if (is_user_logged_in()) {
180 180
 
181 181
 		$email    = $valid_data['logged_in_user']['user_email'];
182
-		$customer = new Give_Customer( get_current_user_id(), true );
182
+		$customer = new Give_Customer(get_current_user_id(), true);
183 183
 
184 184
 		// If this email address is not registered with this customer, see if it belongs to any other customer
185
-		if ( $email !== $customer->email && ( is_array( $customer->emails ) && ! in_array( $email, $customer->emails ) ) ) {
186
-			$found_customer = new Give_Customer( $email );
185
+		if ($email !== $customer->email && (is_array($customer->emails) && ! in_array($email, $customer->emails))) {
186
+			$found_customer = new Give_Customer($email);
187 187
 			
188
-			if ( $found_customer->id > 0 ) {
189
-				give_set_error( 'give-customer-email-exists', __( sprintf( 'The email address %s is already in use.', $email ), 'give' ) );
188
+			if ($found_customer->id > 0) {
189
+				give_set_error('give-customer-email-exists', __(sprintf('The email address %s is already in use.', $email), 'give'));
190 190
 			}
191 191
 		}
192 192
 	}
193 193
 }
194
-add_action( 'give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2 );
194
+add_action('give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2);
195 195
 
196 196
 /**
197 197
  * Process the checkout login form
@@ -202,37 +202,37 @@  discard block
 block discarded – undo
202 202
  */
203 203
 function give_process_form_login() {
204 204
 
205
-	$is_ajax = isset( $_POST['give_ajax'] );
205
+	$is_ajax = isset($_POST['give_ajax']);
206 206
 
207 207
 	$user_data = give_purchase_form_validate_user_login();
208 208
 
209
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
210
-		if ( $is_ajax ) {
209
+	if (give_get_errors() || $user_data['user_id'] < 1) {
210
+		if ($is_ajax) {
211 211
 			/**
212 212
 			 * Fires when AJAX sends back errors from the donation form.
213 213
 			 *
214 214
 			 * @since 1.0
215 215
 			 */
216
-			do_action( 'give_ajax_checkout_errors' );
216
+			do_action('give_ajax_checkout_errors');
217 217
 			give_die();
218 218
 		} else {
219
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
219
+			wp_redirect($_SERVER['HTTP_REFERER']);
220 220
 			exit;
221 221
 		}
222 222
 	}
223 223
 
224
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
224
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
225 225
 
226
-	if ( $is_ajax ) {
226
+	if ($is_ajax) {
227 227
 		echo 'success';
228 228
 		give_die();
229 229
 	} else {
230
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
230
+		wp_redirect($_SERVER['HTTP_REFERER']);
231 231
 	}
232 232
 }
233 233
 
234
-add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' );
235
-add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' );
234
+add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login');
235
+add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login');
236 236
 
237 237
 /**
238 238
  * Donation Form Validate Fields
@@ -244,45 +244,45 @@  discard block
 block discarded – undo
244 244
 function give_purchase_form_validate_fields() {
245 245
 
246 246
 	// Check if there is $_POST
247
-	if ( empty( $_POST ) ) {
247
+	if (empty($_POST)) {
248 248
 		return false;
249 249
 	}
250 250
 
251
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
251
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
252 252
 
253 253
 	// Start an array to collect valid data
254 254
 	$valid_data = array(
255 255
 		'gateway'          => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here)
256
-		'need_new_user'    => false,     // New user flag
257
-		'need_user_login'  => false,     // Login user flag
258
-		'logged_user_data' => array(),   // Logged user collected data
259
-		'new_user_data'    => array(),   // New user collected data
260
-		'login_user_data'  => array(),   // Login user collected data
261
-		'guest_user_data'  => array(),   // Guest user collected data
256
+		'need_new_user'    => false, // New user flag
257
+		'need_user_login'  => false, // Login user flag
258
+		'logged_user_data' => array(), // Logged user collected data
259
+		'new_user_data'    => array(), // New user collected data
260
+		'login_user_data'  => array(), // Login user collected data
261
+		'guest_user_data'  => array(), // Guest user collected data
262 262
 		'cc_info'          => give_purchase_form_validate_cc()    // Credit card info
263 263
 	);
264 264
 
265 265
 	//Validate Honeypot First
266
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
267
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
266
+	if ( ! empty($_POST['give-honeypot'])) {
267
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
268 268
 	}
269 269
 
270 270
 	// Validate agree to terms
271
-	$terms_option = get_post_meta( $form_id, '_give_terms_option', true );
272
-	if ( isset( $terms_option ) && $terms_option === 'yes' ) {
271
+	$terms_option = get_post_meta($form_id, '_give_terms_option', true);
272
+	if (isset($terms_option) && $terms_option === 'yes') {
273 273
 		give_purchase_form_validate_agree_to_terms();
274 274
 	}
275 275
 
276
-	if ( is_user_logged_in() ) {
276
+	if (is_user_logged_in()) {
277 277
 		// Collect logged in user data
278 278
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
279
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
279
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
280 280
 		// Set new user registration as required
281 281
 		$valid_data['need_new_user'] = true;
282 282
 		// Validate new user data
283 283
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
284 284
 		// Check if login validation is needed
285
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
285
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
286 286
 		// Set user login as required
287 287
 		$valid_data['need_user_login'] = true;
288 288
 		// Validate users login info
@@ -307,41 +307,41 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function give_purchase_form_validate_gateway() {
309 309
 
310
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
311
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
312
-	$gateway = give_get_default_gateway( $form_id );
310
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
311
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
312
+	$gateway = give_get_default_gateway($form_id);
313 313
 
314 314
 	// Check if a gateway value is present
315
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
315
+	if ( ! empty($_REQUEST['give-gateway'])) {
316 316
 
317
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
317
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
318 318
 
319 319
 		//Is amount being donated in LIVE mode 0.00? If so, error:
320
-		if ( $amount == 0 && ! give_is_test_mode() ) {
320
+		if ($amount == 0 && ! give_is_test_mode()) {
321 321
 
322
-			give_set_error( 'invalid_donation_amount', esc_html__( 'Please insert a valid donation amount.', 'give' ) );
322
+			give_set_error('invalid_donation_amount', esc_html__('Please insert a valid donation amount.', 'give'));
323 323
 
324 324
 		} //Check for a minimum custom amount
325
-		elseif ( ! give_verify_minimum_price() ) {
325
+		elseif ( ! give_verify_minimum_price()) {
326 326
 
327 327
 			give_set_error(
328 328
 				'invalid_donation_minimum',
329 329
 				sprintf(
330 330
 					/* translators: %s: minimum donation amount */
331
-					esc_html__( 'This form has a minimum donation amount of %s.', 'give' ),
332
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) )
331
+					esc_html__('This form has a minimum donation amount of %s.', 'give'),
332
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)))
333 333
 				)
334 334
 			);
335 335
 
336 336
 		} //Is this test mode zero donation? Let it through but set to manual gateway
337
-		elseif ( $amount == 0 && give_is_test_mode() ) {
337
+		elseif ($amount == 0 && give_is_test_mode()) {
338 338
 
339 339
 			$gateway = 'manual';
340 340
 
341 341
 		} //Check if this gateway is active
342
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
342
+		elseif ( ! give_is_gateway_active($gateway)) {
343 343
 
344
-			give_set_error( 'invalid_gateway', esc_html__( 'The selected payment gateway is not enabled.', 'give' ) );
344
+			give_set_error('invalid_gateway', esc_html__('The selected payment gateway is not enabled.', 'give'));
345 345
 
346 346
 		}
347 347
 
@@ -360,23 +360,23 @@  discard block
 block discarded – undo
360 360
  */
361 361
 function give_verify_minimum_price() {
362 362
 
363
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
364
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
365
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
366
-	$variable_prices = give_has_variable_prices( $form_id );
363
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
364
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
365
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
366
+	$variable_prices = give_has_variable_prices($form_id);
367 367
 
368
-	if ( $variable_prices && ! empty( $price_id ) ) {
368
+	if ($variable_prices && ! empty($price_id)) {
369 369
 
370
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
370
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
371 371
 
372
-		if ( $price_level_amount == $amount ) {
372
+		if ($price_level_amount == $amount) {
373 373
 			return true;
374 374
 		}
375 375
 	}
376 376
 
377
-	$minimum = give_get_form_minimum_price( $form_id );
377
+	$minimum = give_get_form_minimum_price($form_id);
378 378
 
379
-	if ( $minimum > $amount ) {
379
+	if ($minimum > $amount) {
380 380
 		return false;
381 381
 	}
382 382
 
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
  */
393 393
 function give_purchase_form_validate_agree_to_terms() {
394 394
 	// Validate agree to terms
395
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
395
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
396 396
 		// User did not agree
397
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', esc_html__( 'You must agree to the terms of use.', 'give' ) ) );
397
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', esc_html__('You must agree to the terms of use.', 'give')));
398 398
 	}
399 399
 }
400 400
 
@@ -408,43 +408,43 @@  discard block
 block discarded – undo
408 408
  *
409 409
  * @return      array
410 410
  */
411
-function give_purchase_form_required_fields( $form_id ) {
411
+function give_purchase_form_required_fields($form_id) {
412 412
 
413
-	$payment_mode = give_get_chosen_gateway( $form_id );
413
+	$payment_mode = give_get_chosen_gateway($form_id);
414 414
 
415 415
 	$required_fields = array(
416 416
 		'give_email' => array(
417 417
 			'error_id'      => 'invalid_email',
418
-			'error_message' => esc_html__( 'Please enter a valid email address.', 'give' )
418
+			'error_message' => esc_html__('Please enter a valid email address.', 'give')
419 419
 		),
420 420
 		'give_first' => array(
421 421
 			'error_id'      => 'invalid_first_name',
422
-			'error_message' => esc_html__( 'Please enter your first name.', 'give' )
422
+			'error_message' => esc_html__('Please enter your first name.', 'give')
423 423
 		)
424 424
 	);
425 425
 
426
-	$require_address = give_require_billing_address( $payment_mode );
426
+	$require_address = give_require_billing_address($payment_mode);
427 427
 
428
-	if ( $require_address ) {
429
-		$required_fields['card_address']    = array(
428
+	if ($require_address) {
429
+		$required_fields['card_address'] = array(
430 430
 			'error_id'      => 'invalid_card_address',
431
-			'error_message' => esc_html__( 'Please enter your primary billing address.', 'give' )
431
+			'error_message' => esc_html__('Please enter your primary billing address.', 'give')
432 432
 		);
433
-		$required_fields['card_zip']        = array(
433
+		$required_fields['card_zip'] = array(
434 434
 			'error_id'      => 'invalid_zip_code',
435
-			'error_message' => esc_html__( 'Please enter your zip / postal code.', 'give' )
435
+			'error_message' => esc_html__('Please enter your zip / postal code.', 'give')
436 436
 		);
437
-		$required_fields['card_city']       = array(
437
+		$required_fields['card_city'] = array(
438 438
 			'error_id'      => 'invalid_city',
439
-			'error_message' => esc_html__( 'Please enter your billing city.', 'give' )
439
+			'error_message' => esc_html__('Please enter your billing city.', 'give')
440 440
 		);
441 441
 		$required_fields['billing_country'] = array(
442 442
 			'error_id'      => 'invalid_country',
443
-			'error_message' => esc_html__( 'Please select your billing country.', 'give' )
443
+			'error_message' => esc_html__('Please select your billing country.', 'give')
444 444
 		);
445
-		$required_fields['card_state']      = array(
445
+		$required_fields['card_state'] = array(
446 446
 			'error_id'      => 'invalid_state',
447
-			'error_message' => esc_html__( 'Please enter billing state / province.', 'give' )
447
+			'error_message' => esc_html__('Please enter billing state / province.', 'give')
448 448
 		);
449 449
 	}
450 450
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @since 1.7
455 455
 	 */
456
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
456
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
457 457
 
458 458
 	return $required_fields;
459 459
 
@@ -468,16 +468,16 @@  discard block
 block discarded – undo
468 468
  *
469 469
  * @return mixed|void
470 470
  */
471
-function give_require_billing_address( $payment_mode ) {
471
+function give_require_billing_address($payment_mode) {
472 472
 
473 473
 	$return = false;
474 474
 
475
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
475
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
476 476
 		$return = true;
477 477
 	}
478 478
 
479 479
 	// Let payment gateways and other extensions determine if address fields should be required
480
-	return apply_filters( 'give_require_billing_address', $return );
480
+	return apply_filters('give_require_billing_address', $return);
481 481
 
482 482
 }
483 483
 
@@ -491,43 +491,43 @@  discard block
 block discarded – undo
491 491
 function give_purchase_form_validate_logged_in_user() {
492 492
 	global $user_ID;
493 493
 
494
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
494
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
495 495
 
496 496
 	// Start empty array to collect valid user data
497 497
 	$valid_user_data = array(
498 498
 		// Assume there will be errors
499
-		'user_id' => - 1
499
+		'user_id' => -1
500 500
 	);
501 501
 
502 502
 	// Verify there is a user_ID
503
-	if ( $user_ID > 0 ) {
503
+	if ($user_ID > 0) {
504 504
 		// Get the logged in user data
505
-		$user_data = get_userdata( $user_ID );
505
+		$user_data = get_userdata($user_ID);
506 506
 
507 507
 		// Loop through required fields and show error messages
508
-		foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
509
-			if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
510
-				give_set_error( $value['error_id'], $value['error_message'] );
508
+		foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
509
+			if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
510
+				give_set_error($value['error_id'], $value['error_message']);
511 511
 			}
512 512
 		}
513 513
 
514 514
 		// Verify data
515
-		if ( $user_data ) {
515
+		if ($user_data) {
516 516
 			// Collected logged in user data
517 517
 			$valid_user_data = array(
518 518
 				'user_id'    => $user_ID,
519
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
520
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
521
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
519
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
520
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
521
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
522 522
 			);
523 523
 
524
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
525
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
524
+			if ( ! is_email($valid_user_data['user_email'])) {
525
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
526 526
 			}
527 527
 
528 528
 		} else {
529 529
 			// Set invalid user error
530
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
530
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
531 531
 		}
532 532
 	}
533 533
 
@@ -545,90 +545,90 @@  discard block
 block discarded – undo
545 545
 function give_purchase_form_validate_new_user() {
546 546
 
547 547
 	$registering_new_user = false;
548
-	$form_id              = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
548
+	$form_id              = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
549 549
 
550 550
 	// Start an empty array to collect valid user data
551 551
 	$valid_user_data = array(
552 552
 		// Assume there will be errors
553
-		'user_id'    => - 1,
553
+		'user_id'    => -1,
554 554
 		// Get first name
555
-		'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '',
555
+		'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '',
556 556
 		// Get last name
557
-		'user_last'  => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '',
557
+		'user_last'  => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '',
558 558
 	);
559 559
 
560 560
 	// Check the new user's credentials against existing ones
561
-	$user_login   = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false;
562
-	$user_email   = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false;
563
-	$user_pass    = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false;
564
-	$pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false;
561
+	$user_login   = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false;
562
+	$user_email   = isset($_POST['give_email']) ? trim($_POST['give_email']) : false;
563
+	$user_pass    = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false;
564
+	$pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false;
565 565
 
566 566
 	// Loop through required fields and show error messages
567
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
568
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
569
-			give_set_error( $value['error_id'], $value['error_message'] );
567
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
568
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
569
+			give_set_error($value['error_id'], $value['error_message']);
570 570
 		}
571 571
 	}
572 572
 
573 573
 	// Check if we have an username to register
574
-	if ( $user_login && strlen( $user_login ) > 0 ) {
574
+	if ($user_login && strlen($user_login) > 0) {
575 575
 		$registering_new_user = true;
576 576
 
577 577
 		// We have an user name, check if it already exists
578
-		if ( username_exists( $user_login ) ) {
578
+		if (username_exists($user_login)) {
579 579
 			// Username already registered
580
-			give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
580
+			give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
581 581
 			// Check if it's valid
582
-		} else if ( ! give_validate_username( $user_login ) ) {
582
+		} else if ( ! give_validate_username($user_login)) {
583 583
 			// Invalid username
584
-			if ( is_multisite() ) {
585
-				give_set_error( 'username_invalid', esc_html__( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) );
584
+			if (is_multisite()) {
585
+				give_set_error('username_invalid', esc_html__('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'));
586 586
 			} else {
587
-				give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
587
+				give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
588 588
 			}
589 589
 		} else {
590 590
 			// All the checks have run and it's good to go
591 591
 			$valid_user_data['user_login'] = $user_login;
592 592
 		}
593
-	} elseif ( give_logged_in_only( $form_id ) ) {
594
-		give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation.', 'give' ) );
593
+	} elseif (give_logged_in_only($form_id)) {
594
+		give_set_error('registration_required', esc_html__('You must register or login to complete your donation.', 'give'));
595 595
 	}
596 596
 
597 597
 	// Check if we have an email to verify
598
-	if ( $user_email && strlen( $user_email ) > 0 ) {
598
+	if ($user_email && strlen($user_email) > 0) {
599 599
 		// Validate email
600
-		if ( ! is_email( $user_email ) ) {
601
-			give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
600
+		if ( ! is_email($user_email)) {
601
+			give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
602 602
 			// Check if email exists
603
-		} else if ( email_exists( $user_email ) && $registering_new_user ) {
604
-			give_set_error( 'email_used', esc_html__( 'The email already active for another user.', 'give' ) );
603
+		} else if (email_exists($user_email) && $registering_new_user) {
604
+			give_set_error('email_used', esc_html__('The email already active for another user.', 'give'));
605 605
 		} else {
606 606
 			// All the checks have run and it's good to go
607 607
 			$valid_user_data['user_email'] = $user_email;
608 608
 		}
609 609
 	} else {
610 610
 		// No email
611
-		give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) );
611
+		give_set_error('email_empty', esc_html__('Enter an email.', 'give'));
612 612
 	}
613 613
 
614 614
 	// Check password
615
-	if ( $user_pass && $pass_confirm ) {
615
+	if ($user_pass && $pass_confirm) {
616 616
 		// Verify confirmation matches
617
-		if ( $user_pass != $pass_confirm ) {
617
+		if ($user_pass != $pass_confirm) {
618 618
 			// Passwords do not match
619
-			give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
619
+			give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
620 620
 		} else {
621 621
 			// All is good to go
622 622
 			$valid_user_data['user_pass'] = $user_pass;
623 623
 		}
624 624
 	} else {
625 625
 		// Password or confirmation missing
626
-		if ( ! $user_pass && $registering_new_user ) {
626
+		if ( ! $user_pass && $registering_new_user) {
627 627
 			// The password is invalid
628
-			give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) );
629
-		} else if ( ! $pass_confirm && $registering_new_user ) {
628
+			give_set_error('password_empty', esc_html__('Enter a password.', 'give'));
629
+		} else if ( ! $pass_confirm && $registering_new_user) {
630 630
 			// Confirmation password is invalid
631
-			give_set_error( 'confirmation_empty', esc_html__( 'Enter the password confirmation.', 'give' ) );
631
+			give_set_error('confirmation_empty', esc_html__('Enter the password confirmation.', 'give'));
632 632
 		}
633 633
 	}
634 634
 
@@ -647,36 +647,36 @@  discard block
 block discarded – undo
647 647
 	// Start an array to collect valid user data
648 648
 	$valid_user_data = array(
649 649
 		// Assume there will be errors
650
-		'user_id' => - 1
650
+		'user_id' => -1
651 651
 	);
652 652
 
653 653
 	// Username
654
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
655
-		give_set_error( 'must_log_in', esc_html__( 'You must register or login to complete your donation.', 'give' ) );
654
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
655
+		give_set_error('must_log_in', esc_html__('You must register or login to complete your donation.', 'give'));
656 656
 
657 657
 		return $valid_user_data;
658 658
 	}
659 659
 
660 660
 	// Get the user by login
661
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
661
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
662 662
 
663 663
 	// Check if user exists
664
-	if ( $user_data ) {
664
+	if ($user_data) {
665 665
 		// Get password
666
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
666
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
667 667
 
668 668
 		// Check user_pass
669
-		if ( $user_pass ) {
669
+		if ($user_pass) {
670 670
 			// Check if password is valid
671
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
671
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
672 672
 				// Incorrect password
673 673
 				give_set_error(
674 674
 					'password_incorrect',
675 675
 					sprintf(
676 676
 						'%1$s <a href="%2$s">%3$s</a>',
677
-						esc_html__( 'The password you entered is incorrect.', 'give' ),
678
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
679
-						esc_html__( 'Reset Password', 'give' )
677
+						esc_html__('The password you entered is incorrect.', 'give'),
678
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
679
+						esc_html__('Reset Password', 'give')
680 680
 					)
681 681
 				);
682 682
 				// All is correct
@@ -693,11 +693,11 @@  discard block
 block discarded – undo
693 693
 			}
694 694
 		} else {
695 695
 			// Empty password
696
-			give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) );
696
+			give_set_error('password_empty', esc_html__('Enter a password.', 'give'));
697 697
 		}
698 698
 	} else {
699 699
 		// no username
700
-		give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
700
+		give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
701 701
 	}
702 702
 
703 703
 	return $valid_user_data;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
  */
713 713
 function give_purchase_form_validate_guest_user() {
714 714
 
715
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
715
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
716 716
 
717 717
 	// Start an array to collect valid user data
718 718
 	$valid_user_data = array(
@@ -721,38 +721,38 @@  discard block
 block discarded – undo
721 721
 	);
722 722
 
723 723
 	// Show error message if user must be logged in
724
-	if ( give_logged_in_only( $form_id ) ) {
725
-		give_set_error( 'logged_in_only', esc_html__( 'You must be logged in to donate.', 'give' ) );
724
+	if (give_logged_in_only($form_id)) {
725
+		give_set_error('logged_in_only', esc_html__('You must be logged in to donate.', 'give'));
726 726
 	}
727 727
 
728 728
 	// Get the guest email
729
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
729
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
730 730
 
731 731
 	// Check email
732
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
732
+	if ($guest_email && strlen($guest_email) > 0) {
733 733
 		// Validate email
734
-		if ( ! is_email( $guest_email ) ) {
734
+		if ( ! is_email($guest_email)) {
735 735
 			// Invalid email
736
-			give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
736
+			give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
737 737
 		} else {
738 738
 			// All is good to go
739 739
 			$valid_user_data['user_email'] = $guest_email;
740 740
 
741 741
 			// Get user_id from donor if exist.
742
-			$donor = new Give_Customer( $guest_email );
743
-			if( $donor->id && $donor->user_id ) {
742
+			$donor = new Give_Customer($guest_email);
743
+			if ($donor->id && $donor->user_id) {
744 744
 				$valid_user_data['user_id'] = $donor->user_id;
745 745
 			}
746 746
 		}
747 747
 	} else {
748 748
 		// No email
749
-		give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) );
749
+		give_set_error('email_empty', esc_html__('Enter an email.', 'give'));
750 750
 	}
751 751
 
752 752
 	// Loop through required fields and show error messages
753
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
754
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
755
-			give_set_error( $value['error_id'], $value['error_message'] );
753
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
754
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
755
+			give_set_error($value['error_id'], $value['error_message']);
756 756
 		}
757 757
 	}
758 758
 
@@ -768,36 +768,36 @@  discard block
 block discarded – undo
768 768
  * @since   1.0
769 769
  * @return  integer
770 770
  */
771
-function give_register_and_login_new_user( $user_data = array() ) {
771
+function give_register_and_login_new_user($user_data = array()) {
772 772
 	// Verify the array
773
-	if ( empty( $user_data ) ) {
774
-		return - 1;
773
+	if (empty($user_data)) {
774
+		return -1;
775 775
 	}
776 776
 
777
-	if ( give_get_errors() ) {
778
-		return - 1;
777
+	if (give_get_errors()) {
778
+		return -1;
779 779
 	}
780 780
 
781
-	$user_args = apply_filters( 'give_insert_user_args', array(
782
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
783
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
784
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
785
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
786
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
787
-		'user_registered' => date( 'Y-m-d H:i:s' ),
788
-		'role'            => get_option( 'default_role' )
789
-	), $user_data );
781
+	$user_args = apply_filters('give_insert_user_args', array(
782
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
783
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
784
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
785
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
786
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
787
+		'user_registered' => date('Y-m-d H:i:s'),
788
+		'role'            => get_option('default_role')
789
+	), $user_data);
790 790
 
791 791
 	// Insert new user
792
-	$user_id = wp_insert_user( $user_args );
792
+	$user_id = wp_insert_user($user_args);
793 793
 
794 794
 	// Validate inserted user
795
-	if ( is_wp_error( $user_id ) ) {
796
-		return - 1;
795
+	if (is_wp_error($user_id)) {
796
+		return -1;
797 797
 	}
798 798
 
799 799
 	// Allow themes and plugins to filter the user data
800
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
800
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
801 801
 
802 802
 	/**
803 803
 	 * Fires after inserting user.
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
 	 * @param int   $user_id   User id.
808 808
 	 * @param array $user_data Array containing user data.
809 809
 	 */
810
-	do_action( 'give_insert_user', $user_id, $user_data );
810
+	do_action('give_insert_user', $user_id, $user_data);
811 811
 
812 812
 	// Login new user
813
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
813
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
814 814
 
815 815
 	// Return user id
816 816
 	return $user_id;
@@ -825,27 +825,27 @@  discard block
 block discarded – undo
825 825
  * @since   1.0
826 826
  * @return  array
827 827
  */
828
-function give_get_purchase_form_user( $valid_data = array() ) {
828
+function give_get_purchase_form_user($valid_data = array()) {
829 829
 
830 830
 	// Initialize user
831 831
 	$user    = false;
832
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
832
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
833 833
 
834
-	if ( $is_ajax ) {
834
+	if ($is_ajax) {
835 835
 		// Do not create or login the user during the ajax submission (check for errors only)
836 836
 		return true;
837
-	} else if ( is_user_logged_in() ) {
837
+	} else if (is_user_logged_in()) {
838 838
 		// Set the valid user as the logged in collected data
839 839
 		$user = $valid_data['logged_in_user'];
840
-	} else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
840
+	} else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
841 841
 		// New user registration
842
-		if ( $valid_data['need_new_user'] === true ) {
842
+		if ($valid_data['need_new_user'] === true) {
843 843
 			// Set user
844 844
 			$user = $valid_data['new_user_data'];
845 845
 			// Register and login new user
846
-			$user['user_id'] = give_register_and_login_new_user( $user );
846
+			$user['user_id'] = give_register_and_login_new_user($user);
847 847
 			// User login
848
-		} else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
848
+		} else if ($valid_data['need_user_login'] === true && ! $is_ajax) {
849 849
 
850 850
 			/*
851 851
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -860,48 +860,48 @@  discard block
 block discarded – undo
860 860
 			// Set user
861 861
 			$user = $valid_data['login_user_data'];
862 862
 			// Login user
863
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
863
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
864 864
 		}
865 865
 	}
866 866
 
867 867
 	// Check guest checkout
868
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
868
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
869 869
 		// Set user
870 870
 		$user = $valid_data['guest_user_data'];
871 871
 	}
872 872
 
873 873
 	// Verify we have an user
874
-	if ( false === $user || empty( $user ) ) {
874
+	if (false === $user || empty($user)) {
875 875
 		// Return false
876 876
 		return false;
877 877
 	}
878 878
 
879 879
 	// Get user first name
880
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
881
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
880
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
881
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
882 882
 	}
883 883
 
884 884
 	// Get user last name
885
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
886
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
885
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
886
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
887 887
 	}
888 888
 
889 889
 	// Get the user's billing address details
890 890
 	$user['address']            = array();
891
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
892
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
893
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
894
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
895
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
896
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
897
-
898
-	if ( empty( $user['address']['country'] ) ) {
891
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
892
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
893
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
894
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
895
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
896
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
897
+
898
+	if (empty($user['address']['country'])) {
899 899
 		$user['address'] = false;
900 900
 	} // Country will always be set if address fields are present
901 901
 
902
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
902
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
903 903
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases
904
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
904
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
905 905
 	}
906 906
 
907 907
 	// Return valid user
@@ -920,16 +920,16 @@  discard block
 block discarded – undo
920 920
 	$card_data = give_get_purchase_cc_info();
921 921
 
922 922
 	// Validate the card zip
923
-	if ( ! empty( $card_data['card_zip'] ) ) {
924
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
925
-			give_set_error( 'invalid_cc_zip', esc_html__( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
923
+	if ( ! empty($card_data['card_zip'])) {
924
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
925
+			give_set_error('invalid_cc_zip', esc_html__('The zip / postal code you entered for your billing address is invalid.', 'give'));
926 926
 		}
927 927
 	}
928 928
 
929 929
 	//Ensure no spaces
930
-	if ( ! empty( $card_data['card_number'] ) ) {
931
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs
932
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
930
+	if ( ! empty($card_data['card_number'])) {
931
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs
932
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
933 933
 	}
934 934
 
935 935
 	// This should validate card numbers at some point too
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
  */
946 946
 function give_get_purchase_cc_info() {
947 947
 	$cc_info                   = array();
948
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
949
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
950
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
951
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
952
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
953
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
954
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
955
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
956
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
957
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
958
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
948
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
949
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
950
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
951
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
952
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
953
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
954
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
955
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
956
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
957
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
958
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
959 959
 
960 960
 	// Return cc info
961 961
 	return $cc_info;
@@ -971,14 +971,14 @@  discard block
 block discarded – undo
971 971
  *
972 972
  * @return bool|mixed|void
973 973
  */
974
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
974
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
975 975
 	$ret = false;
976 976
 
977
-	if ( empty( $zip ) || empty( $country_code ) ) {
977
+	if (empty($zip) || empty($country_code)) {
978 978
 		return $ret;
979 979
 	}
980 980
 
981
-	$country_code = strtoupper( $country_code );
981
+	$country_code = strtoupper($country_code);
982 982
 
983 983
 	$zip_regex = array(
984 984
 		"AD" => "AD\d{3}",
@@ -1138,11 +1138,11 @@  discard block
 block discarded – undo
1138 1138
 		"ZM" => "\d{5}"
1139 1139
 	);
1140 1140
 
1141
-	if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) {
1141
+	if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) {
1142 1142
 		$ret = true;
1143 1143
 	}
1144 1144
 
1145
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1145
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1146 1146
 }
1147 1147
 
1148 1148
 
@@ -1156,37 +1156,37 @@  discard block
 block discarded – undo
1156 1156
  *
1157 1157
  * @return bool
1158 1158
  */
1159
-function give_validate_multi_donation_form_level(  $valid_data, $data ) {
1159
+function give_validate_multi_donation_form_level($valid_data, $data) {
1160 1160
     /* @var Give_Donate_Form $form*/
1161
-    $form = new Give_Donate_Form( $data['give-form-id'] );
1161
+    $form = new Give_Donate_Form($data['give-form-id']);
1162 1162
 
1163 1163
     $donation_level_matched = false;
1164 1164
 
1165
-    if( $form->is_multi_type_donation_form() ) {
1165
+    if ($form->is_multi_type_donation_form()) {
1166 1166
 
1167 1167
         // Bailout.
1168
-        if( ! ( $variable_prices = $form->get_prices() ) ) {
1168
+        if ( ! ($variable_prices = $form->get_prices())) {
1169 1169
             return false;
1170 1170
         }
1171 1171
 
1172 1172
         // Sanitize donation amount.
1173
-        $data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1173
+        $data['give-amount'] = give_sanitize_amount($data['give-amount']);
1174 1174
 
1175 1175
         // Get number of decimals.
1176 1176
         $default_decimals = give_get_price_decimals();
1177 1177
 
1178
-        if( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ){
1178
+        if ($data['give-amount'] === give_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']), $default_decimals)) {
1179 1179
             return true;
1180 1180
         }
1181 1181
 
1182 1182
         
1183 1183
         // Find correct donation level from all donation levels.
1184
-        foreach ( $variable_prices as $variable_price ) {
1184
+        foreach ($variable_prices as $variable_price) {
1185 1185
             // Sanitize level amount.
1186
-            $variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1186
+            $variable_price['_give_amount'] = give_sanitize_amount($variable_price['_give_amount'], $default_decimals);
1187 1187
 
1188 1188
             // Set first match donation level ID.
1189
-            if( $data['give-amount'] === $variable_price['_give_amount'] ) {
1189
+            if ($data['give-amount'] === $variable_price['_give_amount']) {
1190 1190
                 $_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1191 1191
                 $donation_level_matched = true;
1192 1192
                 break;
@@ -1195,20 +1195,20 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
         // If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1197 1197
         // If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1198
-        if(
1198
+        if (
1199 1199
             ! $donation_level_matched
1200
-            && ( 'yes' === get_post_meta( $data['give-form-id'], '_give_custom_amount', true ) )
1200
+            && ('yes' === get_post_meta($data['give-form-id'], '_give_custom_amount', true))
1201 1201
         ) {
1202 1202
             // Sanitize custom minimum amount.
1203
-            $custom_minimum_amount = give_sanitize_amount( get_post_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1203
+            $custom_minimum_amount = give_sanitize_amount(get_post_meta($data['give-form-id'], '_give_custom_amount_minimum', true), $default_decimals);
1204 1204
 
1205
-            if( $data['give-amount'] >= $custom_minimum_amount ) {
1205
+            if ($data['give-amount'] >= $custom_minimum_amount) {
1206 1206
                 $_POST['give-price-id'] = 'custom';
1207
-                $donation_level_matched  = true;
1207
+                $donation_level_matched = true;
1208 1208
             }
1209 1209
         }
1210 1210
     }
1211 1211
 
1212
-    return ( $donation_level_matched ? true : false );
1212
+    return ($donation_level_matched ? true : false);
1213 1213
 }
1214
-add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1215 1214
\ No newline at end of file
1215
+add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2);
1216 1216
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-db-customer-meta.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		/* @var WPDB $wpdb */
32 32
 		global $wpdb;
33 33
 
34
-		$this->table_name  = $wpdb->prefix . 'give_customermeta';
34
+		$this->table_name  = $wpdb->prefix.'give_customermeta';
35 35
 		$this->primary_key = 'meta_id';
36 36
 		$this->version     = '1.0';
37 37
 
38
-		add_action( 'plugins_loaded', array( $this, 'register_table' ), 11 );
38
+		add_action('plugins_loaded', array($this, 'register_table'), 11);
39 39
 
40 40
 	}
41 41
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 * @access  private
80 80
 	 * @since   1.6
81 81
 	 */
82
-	public function get_meta( $customer_id = 0, $meta_key = '', $single = false ) {
83
-		$customer_id = $this->sanitize_customer_id( $customer_id );
84
-		if ( false === $customer_id ) {
82
+	public function get_meta($customer_id = 0, $meta_key = '', $single = false) {
83
+		$customer_id = $this->sanitize_customer_id($customer_id);
84
+		if (false === $customer_id) {
85 85
 			return false;
86 86
 		}
87 87
 
88
-		return get_metadata( 'customer', $customer_id, $meta_key, $single );
88
+		return get_metadata('customer', $customer_id, $meta_key, $single);
89 89
 	}
90 90
 
91 91
 	/**
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 * @access  private
104 104
 	 * @since   1.6
105 105
 	 */
106
-	public function add_meta( $customer_id = 0, $meta_key = '', $meta_value, $unique = false ) {
107
-		$customer_id = $this->sanitize_customer_id( $customer_id );
108
-		if ( false === $customer_id ) {
106
+	public function add_meta($customer_id = 0, $meta_key = '', $meta_value, $unique = false) {
107
+		$customer_id = $this->sanitize_customer_id($customer_id);
108
+		if (false === $customer_id) {
109 109
 			return false;
110 110
 		}
111 111
 
112
-		return add_metadata( 'customer', $customer_id, $meta_key, $meta_value, $unique );
112
+		return add_metadata('customer', $customer_id, $meta_key, $meta_value, $unique);
113 113
 	}
114 114
 
115 115
 	/**
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 	 * @access  private
133 133
 	 * @since   1.6
134 134
 	 */
135
-	public function update_meta( $customer_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
136
-		$customer_id = $this->sanitize_customer_id( $customer_id );
137
-		if ( false === $customer_id ) {
135
+	public function update_meta($customer_id = 0, $meta_key = '', $meta_value, $prev_value = '') {
136
+		$customer_id = $this->sanitize_customer_id($customer_id);
137
+		if (false === $customer_id) {
138 138
 			return false;
139 139
 		}
140 140
 
141
-		return update_metadata( 'customer', $customer_id, $meta_key, $meta_value, $prev_value );
141
+		return update_metadata('customer', $customer_id, $meta_key, $meta_value, $prev_value);
142 142
 	}
143 143
 
144 144
 	/**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @access  private
160 160
 	 * @since   1.6
161 161
 	 */
162
-	public function delete_meta( $customer_id = 0, $meta_key = '', $meta_value = '' ) {
163
-		return delete_metadata( 'customer', $customer_id, $meta_key, $meta_value );
162
+	public function delete_meta($customer_id = 0, $meta_key = '', $meta_value = '') {
163
+		return delete_metadata('customer', $customer_id, $meta_key, $meta_value);
164 164
 	}
165 165
 
166 166
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function create_table() {
173 173
 
174
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
174
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
175 175
 
176 176
 		$sql = "CREATE TABLE {$this->table_name} (
177 177
 			meta_id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 			KEY meta_key (meta_key)
184 184
 			) CHARACTER SET utf8 COLLATE utf8_general_ci;";
185 185
 
186
-		dbDelta( $sql );
186
+		dbDelta($sql);
187 187
 
188
-		update_option( $this->table_name . '_db_version', $this->version );
188
+		update_option($this->table_name.'_db_version', $this->version);
189 189
 	}
190 190
 
191 191
 	/**
@@ -197,23 +197,23 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return int|bool                The normalized customer ID or false if it's found to not be valid.
199 199
 	 */
200
-	private function sanitize_customer_id( $customer_id ) {
201
-		if ( ! is_numeric( $customer_id ) ) {
200
+	private function sanitize_customer_id($customer_id) {
201
+		if ( ! is_numeric($customer_id)) {
202 202
 			return false;
203 203
 		}
204 204
 
205 205
 		$customer_id = (int) $customer_id;
206 206
 
207 207
 		// We were given a non positive number
208
-		if ( absint( $customer_id ) !== $customer_id ) {
208
+		if (absint($customer_id) !== $customer_id) {
209 209
 			return false;
210 210
 		}
211 211
 
212
-		if ( empty( $customer_id ) ) {
212
+		if (empty($customer_id)) {
213 213
 			return false;
214 214
 		}
215 215
 
216
-		return absint( $customer_id );
216
+		return absint($customer_id);
217 217
 
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
includes/payments/actions.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -209,14 +209,14 @@
 block discarded – undo
209 209
 	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
210 210
 
211 211
 	if ( $payments ) {
212
-        /**
213
-         * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214
-         *
215
-         * @since 1.6
216
-         *
217
-         * @param array $skip_payment_gateways Array of payment gateways
218
-         */
219
-	    $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
212
+		/**
213
+		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214
+		 *
215
+		 * @since 1.6
216
+		 *
217
+		 * @param array $skip_payment_gateways Array of payment gateways
218
+		 */
219
+		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
220 220
 
221 221
 		foreach ( $payments as $payment ) {
222 222
 			$gateway = give_get_payment_gateway( $payment );
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 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
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 	
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_purchase', $payment_id );
61
+	do_action('give_pre_complete_purchase', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,32 +74,32 @@  discard block
 block discarded – undo
74 74
 		 * @param int   $payment_id   The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID
82
-	give_increase_earnings( $form_id, $amount );
83
-	give_increase_purchase_count( $form_id );
82
+	give_increase_earnings($form_id, $amount);
83
+	give_increase_purchase_count($form_id);
84 84
 
85 85
 	// Clear the total earnings cache
86
-	delete_transient( 'give_earnings_total' );
86
+	delete_transient('give_earnings_total');
87 87
 	// Clear the This Month earnings (this_monththis_month is NOT a typo)
88
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
89
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
88
+	delete_transient(md5('give_earnings_this_monththis_month'));
89
+	delete_transient(md5('give_earnings_todaytoday'));
90 90
 	
91 91
 	// Increase the donor's donation stats
92
-	$customer = new Give_Customer( $customer_id );
92
+	$customer = new Give_Customer($customer_id);
93 93
 	$customer->increase_purchase_count();
94
-	$customer->increase_value( $amount );
94
+	$customer->increase_value($amount);
95 95
 
96
-	give_increase_total_earnings( $amount );
96
+	give_increase_total_earnings($amount);
97 97
 
98 98
 	// Ensure this action only runs once ever
99
-	if ( empty( $completed_date ) ) {
99
+	if (empty($completed_date)) {
100 100
 
101 101
 		// Save the completed date
102
-		$payment->completed_date = current_time( 'mysql' );
102
+		$payment->completed_date = current_time('mysql');
103 103
 		$payment->save();
104 104
 
105 105
 		/**
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 		 *
110 110
 		 * @param int $payment_id The ID of the payment.
111 111
 		 */
112
-		do_action( 'give_complete_purchase', $payment_id );
112
+		do_action('give_complete_purchase', $payment_id);
113 113
 	}
114 114
 
115 115
 }
116 116
 
117
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
117
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
118 118
 
119 119
 
120 120
 /**
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
  *
129 129
  * @return void
130 130
  */
131
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
131
+function give_record_status_change($payment_id, $new_status, $old_status) {
132 132
 
133 133
 	// Get the list of statuses so that status in the payment note can be translated
134 134
 	$stati      = give_get_payment_statuses();
135
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
136
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
135
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
136
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
137 137
 
138 138
 	$status_change = sprintf(
139 139
 		/* translators: 1: old status 2: new status */
140
-		esc_html__( 'Status changed from %1$s to %2$s.', 'give' ),
140
+		esc_html__('Status changed from %1$s to %2$s.', 'give'),
141 141
 		$old_status,
142 142
 		$new_status
143 143
 	);
144 144
 
145
-	give_insert_payment_note( $payment_id, $status_change );
145
+	give_insert_payment_note($payment_id, $status_change);
146 146
 }
147 147
 
148
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
148
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
149 149
 
150 150
 
151 151
 /**
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return void
164 164
  */
165
-function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) {
165
+function give_clear_user_history_cache($payment_id, $new_status, $old_status) {
166 166
 
167
-	$payment = new Give_Payment( $payment_id );
167
+	$payment = new Give_Payment($payment_id);
168 168
 
169
-	if ( ! empty( $payment->user_id ) ) {
170
-		delete_transient( 'give_user_' . $payment->user_id . '_purchases' );
169
+	if ( ! empty($payment->user_id)) {
170
+		delete_transient('give_user_'.$payment->user_id.'_purchases');
171 171
 	}
172 172
 
173 173
 }
174 174
 
175
-add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 );
175
+add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3);
176 176
 
177 177
 /**
178 178
  * Update Old Payments Totals
@@ -187,25 +187,25 @@  discard block
 block discarded – undo
187 187
  *
188 188
  * @return void
189 189
  */
190
-function give_update_old_payments_with_totals( $data ) {
191
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
190
+function give_update_old_payments_with_totals($data) {
191
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
192 192
 		return;
193 193
 	}
194 194
 
195
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
195
+	if (get_option('give_payment_totals_upgraded')) {
196 196
 		return;
197 197
 	}
198 198
 
199
-	$payments = give_get_payments( array(
199
+	$payments = give_get_payments(array(
200 200
 		'offset' => 0,
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'mode'   => 'all'
203
-	) );
203
+	));
204 204
 
205
-	if ( $payments ) {
206
-		foreach ( $payments as $payment ) {
205
+	if ($payments) {
206
+		foreach ($payments as $payment) {
207 207
 
208
-			$payment = new Give_Payment( $payment->ID );
208
+			$payment = new Give_Payment($payment->ID);
209 209
 			$meta    = $payment->get_meta();
210 210
 
211 211
 			$payment->total = $meta['amount'];
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 	}
216 216
 
217
-	add_option( 'give_payment_totals_upgraded', 1 );
217
+	add_option('give_payment_totals_upgraded', 1);
218 218
 }
219 219
 
220
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
220
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
221 221
 
222 222
 /**
223 223
  * Mark Abandoned Donations
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 function give_mark_abandoned_donations() {
232 232
 	$args = array(
233 233
 		'status' => 'pending',
234
-		'number' => - 1,
234
+		'number' => -1,
235 235
 		'output' => 'give_payments',
236 236
 	);
237 237
 
238
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
238
+	add_filter('posts_where', 'give_filter_where_older_than_week');
239 239
 
240
-	$payments = give_get_payments( $args );
240
+	$payments = give_get_payments($args);
241 241
 
242
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
242
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
243 243
 
244
-	if ( $payments ) {
244
+	if ($payments) {
245 245
         /**
246 246
          * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
247 247
          *
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
          *
250 250
          * @param array $skip_payment_gateways Array of payment gateways
251 251
          */
252
-	    $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
252
+	    $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
253 253
 
254
-		foreach ( $payments as $payment ) {
255
-			$gateway = give_get_payment_gateway( $payment );
254
+		foreach ($payments as $payment) {
255
+			$gateway = give_get_payment_gateway($payment);
256 256
 
257 257
 			// Skip payment gateways.
258
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
258
+			if (in_array($gateway, $skip_payment_gateways)) {
259 259
 				continue;
260 260
 			}
261 261
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	}
266 266
 }
267 267
 
268
-add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' );
268
+add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations');
269 269
 
270 270
 
271 271
 /**
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return void
279 279
  */
280
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
280
+function give_refresh_thismonth_stat_transients($payment_ID) {
281 281
 
282 282
 	/* @var Give_Payment_Stats $stats */
283 283
 	$stats = new Give_Payment_Stats();
284 284
 
285 285
 	// Delete transients.
286
-	delete_transient( 'give_estimated_monthly_stats' );
287
-	delete_transient( 'give_earnings_total' );
288
-	delete_transient( $stats->get_earnings_cache_key( 0, 'this_month') );
286
+	delete_transient('give_estimated_monthly_stats');
287
+	delete_transient('give_earnings_total');
288
+	delete_transient($stats->get_earnings_cache_key(0, 'this_month'));
289 289
 }
290 290
 
291
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
291
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 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,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/class-give-db-customers.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @since  1.0
159 159
 	 * @access public
160 160
 	 *
161
-	 * @param  bool|string|int $_id_or_email
161
+	 * @param  integer $_id_or_email
162 162
 	 *
163 163
 	 * @return bool|int
164 164
 	 */
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @param  int     $user_id       User ID.
314 314
 	 * @param  WP_User $old_user_data User data.
315 315
 	 *
316
-	 * @return bool
316
+	 * @return false|null
317 317
 	 */
318 318
 	public function update_customer_email_on_user_update( $user_id = 0, $old_user_data ) {
319 319
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 * @access public
363 363
 	 *
364 364
 	 * @param  string $field ID or email. Default is 'id'.
365
-	 * @param  mixed  $value The Customer ID or email to search. Default is 0.
365
+	 * @param  integer  $value The Customer ID or email to search. Default is 0.
366 366
 	 *
367 367
 	 * @return mixed         Upon success, an object of the customer. Upon failure, NULL
368 368
 	 */
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @since  1.0
429 429
 	 * @access public
430
-     *
431
-     * @param  array $args
432
-     *
433
-     * @return array|object|null Customers array or object. Null if not found.
430
+	 *
431
+	 * @param  array $args
432
+	 *
433
+	 * @return array|object|null Customers array or object. Null if not found.
434 434
 	 */
435 435
 	public function get_customers( $args = array() ) {
436
-        /* @var WPDB $wpdb */
436
+		/* @var WPDB $wpdb */
437 437
 		global $wpdb;
438 438
 
439 439
 		$defaults = array(
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @since  1.0
560 560
 	 * @access public
561
-     *
562
-     * @param  array $args
563
-     *
564
-     * @return int         Total number of customers.
561
+	 *
562
+	 * @param  array $args
563
+	 *
564
+	 * @return int         Total number of customers.
565 565
 	 */
566 566
 	public function count( $args = array() ) {
567
-        /* @var WPDB $wpdb */
567
+		/* @var WPDB $wpdb */
568 568
 		global $wpdb;
569 569
 
570 570
 		$where = ' WHERE 1=1 ';
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 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,11 +35,11 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_customers';
38
+		$this->table_name  = $wpdb->prefix.'give_customers';
39 39
 		$this->primary_key = 'id';
40 40
 		$this->version     = '1.0';
41 41
 		
42
-		add_action( 'profile_update', array( $this, 'update_customer_email_on_user_update' ), 10, 2 );
42
+		add_action('profile_update', array($this, 'update_customer_email_on_user_update'), 10, 2);
43 43
 
44 44
 	}
45 45
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			'purchase_value' => 0.00,
83 83
 			'purchase_count' => 0,
84 84
 			'notes'          => '',
85
-			'date_created'   => date( 'Y-m-d H:i:s' ),
85
+			'date_created'   => date('Y-m-d H:i:s'),
86 86
 		);
87 87
 	}
88 88
 
@@ -96,40 +96,40 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return int|bool
98 98
 	 */
99
-	public function add( $data = array() ) {
99
+	public function add($data = array()) {
100 100
 
101 101
 		$defaults = array(
102 102
 			'payment_ids' => ''
103 103
 		);
104 104
 
105
-		$args = wp_parse_args( $data, $defaults );
105
+		$args = wp_parse_args($data, $defaults);
106 106
 
107
-		if ( empty( $args['email'] ) ) {
107
+		if (empty($args['email'])) {
108 108
 			return false;
109 109
 		}
110 110
 
111
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
112
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
111
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
112
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
113 113
 		}
114 114
 
115
-		$customer = $this->get_customer_by( 'email', $args['email'] );
115
+		$customer = $this->get_customer_by('email', $args['email']);
116 116
 
117
-		if ( $customer ) {
117
+		if ($customer) {
118 118
 			// update an existing customer
119 119
 
120 120
 			// Update the payment IDs attached to the customer
121
-			if ( ! empty( $args['payment_ids'] ) ) {
121
+			if ( ! empty($args['payment_ids'])) {
122 122
 
123
-				if ( empty( $customer->payment_ids ) ) {
123
+				if (empty($customer->payment_ids)) {
124 124
 
125 125
 					$customer->payment_ids = $args['payment_ids'];
126 126
 
127 127
 				} else {
128 128
 
129
-					$existing_ids          = array_map( 'absint', explode( ',', $customer->payment_ids ) );
130
-					$payment_ids           = array_map( 'absint', explode( ',', $args['payment_ids'] ) );
131
-					$payment_ids           = array_merge( $payment_ids, $existing_ids );
132
-					$customer->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
129
+					$existing_ids          = array_map('absint', explode(',', $customer->payment_ids));
130
+					$payment_ids           = array_map('absint', explode(',', $args['payment_ids']));
131
+					$payment_ids           = array_merge($payment_ids, $existing_ids);
132
+					$customer->payment_ids = implode(',', array_unique(array_values($payment_ids)));
133 133
 
134 134
 				}
135 135
 
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 
138 138
 			}
139 139
 
140
-			$this->update( $customer->id, $args );
140
+			$this->update($customer->id, $args);
141 141
 
142 142
 			return $customer->id;
143 143
 
144 144
 		} else {
145 145
 
146
-			return $this->insert( $args, 'customer' );
146
+			return $this->insert($args, 'customer');
147 147
 
148 148
 		}
149 149
 
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return bool|int
164 164
 	 */
165
-	public function delete( $_id_or_email = false ) {
165
+	public function delete($_id_or_email = false) {
166 166
 
167
-		if ( empty( $_id_or_email ) ) {
167
+		if (empty($_id_or_email)) {
168 168
 			return false;
169 169
 		}
170 170
 
171
-		$column   = is_email( $_id_or_email ) ? 'email' : 'id';
172
-		$customer = $this->get_customer_by( $column, $_id_or_email );
171
+		$column   = is_email($_id_or_email) ? 'email' : 'id';
172
+		$customer = $this->get_customer_by($column, $_id_or_email);
173 173
 
174
-		if ( $customer->id > 0 ) {
174
+		if ($customer->id > 0) {
175 175
 
176 176
 			global $wpdb;
177 177
 
178
-			return $wpdb->delete( $this->table_name, array( 'id' => $customer->id ), array( '%d' ) );
178
+			return $wpdb->delete($this->table_name, array('id' => $customer->id), array('%d'));
179 179
 
180 180
 		} else {
181 181
 			return false;
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return bool          True is exists, false otherwise.
196 196
 	 */
197
-	public function exists( $value = '', $field = 'email' ) {
197
+	public function exists($value = '', $field = 'email') {
198 198
 		
199 199
 		$columns = $this->get_columns();
200
-		if ( ! array_key_exists( $field, $columns ) ) {
200
+		if ( ! array_key_exists($field, $columns)) {
201 201
 			return false;
202 202
 		}
203 203
 
204
-		return (bool) $this->get_column_by( 'id', $field, $value );
204
+		return (bool) $this->get_column_by('id', $field, $value);
205 205
 
206 206
 	}
207 207
 
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return bool
218 218
 	 */
219
-	public function attach_payment( $customer_id = 0, $payment_id = 0 ) {
219
+	public function attach_payment($customer_id = 0, $payment_id = 0) {
220 220
 
221
-		$customer = new Give_Customer( $customer_id );
221
+		$customer = new Give_Customer($customer_id);
222 222
 
223
-		if ( empty( $customer->id ) ) {
223
+		if (empty($customer->id)) {
224 224
 			return false;
225 225
 		}
226 226
 
227 227
 		// Attach the payment, but don't increment stats, as this function previously did not
228
-		return $customer->attach_payment( $payment_id, false );
228
+		return $customer->attach_payment($payment_id, false);
229 229
 
230 230
 	}
231 231
 
@@ -240,16 +240,16 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool
242 242
 	 */
243
-	public function remove_payment( $customer_id = 0, $payment_id = 0 ) {
243
+	public function remove_payment($customer_id = 0, $payment_id = 0) {
244 244
 
245
-		$customer = new Give_Customer( $customer_id );
245
+		$customer = new Give_Customer($customer_id);
246 246
 
247
-		if ( ! $customer ) {
247
+		if ( ! $customer) {
248 248
 			return false;
249 249
 		}
250 250
 
251 251
 		// Remove the payment, but don't decrease stats, as this function previously did not
252
-		return $customer->remove_payment( $payment_id, false );
252
+		return $customer->remove_payment($payment_id, false);
253 253
 
254 254
 	}
255 255
 
@@ -263,18 +263,18 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return bool
265 265
 	 */
266
-	public function increment_stats( $customer_id = 0, $amount = 0.00 ) {
266
+	public function increment_stats($customer_id = 0, $amount = 0.00) {
267 267
 
268
-		$customer = new Give_Customer( $customer_id );
268
+		$customer = new Give_Customer($customer_id);
269 269
 
270
-		if ( empty( $customer->id ) ) {
270
+		if (empty($customer->id)) {
271 271
 			return false;
272 272
 		}
273 273
 
274 274
 		$increased_count = $customer->increase_purchase_count();
275
-		$increased_value = $customer->increase_value( $amount );
275
+		$increased_value = $customer->increase_value($amount);
276 276
 
277
-		return ( $increased_count && $increased_value ) ? true : false;
277
+		return ($increased_count && $increased_value) ? true : false;
278 278
 
279 279
 	}
280 280
 
@@ -289,18 +289,18 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return bool
291 291
 	 */
292
-	public function decrement_stats( $customer_id = 0, $amount = 0.00 ) {
292
+	public function decrement_stats($customer_id = 0, $amount = 0.00) {
293 293
 
294
-		$customer = new Give_Customer( $customer_id );
294
+		$customer = new Give_Customer($customer_id);
295 295
 
296
-		if ( ! $customer ) {
296
+		if ( ! $customer) {
297 297
 			return false;
298 298
 		}
299 299
 
300 300
 		$decreased_count = $customer->decrease_purchase_count();
301
-		$decreased_value = $customer->decrease_value( $amount );
301
+		$decreased_value = $customer->decrease_value($amount);
302 302
 
303
-		return ( $decreased_count && $decreased_value ) ? true : false;
303
+		return ($decreased_count && $decreased_value) ? true : false;
304 304
 
305 305
 	}
306 306
 
@@ -315,31 +315,31 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return bool
317 317
 	 */
318
-	public function update_customer_email_on_user_update( $user_id = 0, $old_user_data ) {
318
+	public function update_customer_email_on_user_update($user_id = 0, $old_user_data) {
319 319
 
320
-		$customer = new Give_Customer( $user_id, true );
320
+		$customer = new Give_Customer($user_id, true);
321 321
 
322
-		if( ! $customer ) {
322
+		if ( ! $customer) {
323 323
 			return false;
324 324
 		}
325 325
 
326
-		$user = get_userdata( $user_id );
326
+		$user = get_userdata($user_id);
327 327
 
328
-		if( ! empty( $user ) && $user->user_email !== $customer->email ) {
328
+		if ( ! empty($user) && $user->user_email !== $customer->email) {
329 329
 
330
-			if( ! $this->get_customer_by( 'email', $user->user_email ) ) {
330
+			if ( ! $this->get_customer_by('email', $user->user_email)) {
331 331
 
332
-				$success = $this->update( $customer->id, array( 'email' => $user->user_email ) );
332
+				$success = $this->update($customer->id, array('email' => $user->user_email));
333 333
 
334
-				if( $success ) {
334
+				if ($success) {
335 335
 					// Update some payment meta if we need to
336
-					$payments_array = explode( ',', $customer->payment_ids );
336
+					$payments_array = explode(',', $customer->payment_ids);
337 337
 
338
-					if( ! empty( $payments_array ) ) {
338
+					if ( ! empty($payments_array)) {
339 339
 
340
-						foreach ( $payments_array as $payment_id ) {
340
+						foreach ($payments_array as $payment_id) {
341 341
 
342
-							give_update_payment_meta( $payment_id, 'email', $user->user_email );
342
+							give_update_payment_meta($payment_id, 'email', $user->user_email);
343 343
 
344 344
 						}
345 345
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 					 * @param  WP_User       $user     WordPress User object.
354 354
 					 * @param  Give_Customer $customer Give customer object.
355 355
 					 */
356
-					do_action( 'give_update_customer_email_on_user_update', $user, $customer );
356
+					do_action('give_update_customer_email_on_user_update', $user, $customer);
357 357
 
358 358
 				}
359 359
 
@@ -374,46 +374,46 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return mixed         Upon success, an object of the customer. Upon failure, NULL
376 376
 	 */
377
-	public function get_customer_by( $field = 'id', $value = 0 ) {
377
+	public function get_customer_by($field = 'id', $value = 0) {
378 378
 		/* @var WPDB $wpdb */
379 379
 		global $wpdb;
380 380
 
381
-		if ( empty( $field ) || empty( $value ) ) {
381
+		if (empty($field) || empty($value)) {
382 382
 			return null;
383 383
 		}
384 384
 
385
-		if ( 'id' == $field || 'user_id' == $field ) {
385
+		if ('id' == $field || 'user_id' == $field) {
386 386
 			// Make sure the value is numeric to avoid casting objects, for example,
387 387
 			// to int 1.
388
-			if ( ! is_numeric( $value ) ) {
388
+			if ( ! is_numeric($value)) {
389 389
 				return false;
390 390
 			}
391 391
 
392
-			$value = intval( $value );
392
+			$value = intval($value);
393 393
 
394
-			if ( $value < 1 ) {
394
+			if ($value < 1) {
395 395
 				return false;
396 396
 			}
397 397
 
398
-		} elseif ( 'email' === $field ) {
398
+		} elseif ('email' === $field) {
399 399
 
400
-			if ( ! is_email( $value ) ) {
400
+			if ( ! is_email($value)) {
401 401
 				return false;
402 402
 			}
403 403
 
404
-			$value = trim( $value );
404
+			$value = trim($value);
405 405
 		}
406 406
 
407
-		if ( ! $value ) {
407
+		if ( ! $value) {
408 408
 			return false;
409 409
 		}
410 410
 
411
-		switch ( $field ) {
411
+		switch ($field) {
412 412
 			case 'id':
413 413
 				$db_field = 'id';
414 414
 				break;
415 415
 			case 'email':
416
-				$value    = sanitize_text_field( $value );
416
+				$value    = sanitize_text_field($value);
417 417
 				$db_field = 'email';
418 418
 				break;
419 419
 			case 'user_id':
@@ -423,15 +423,15 @@  discard block
 block discarded – undo
423 423
 				return false;
424 424
 		}
425 425
 
426
-		if ( ! $customer = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value ) ) ) {
426
+		if ( ! $customer = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value))) {
427 427
 
428 428
 			// Look for customer from an additional email
429
-			if( 'email' === $field ) {
429
+			if ('email' === $field) {
430 430
 				$meta_table  = Give()->customer_meta->table_name;
431
-				$customer_id = $wpdb->get_var( $wpdb->prepare( "SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value ) );
431
+				$customer_id = $wpdb->get_var($wpdb->prepare("SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value));
432 432
 
433
-				if( ! empty( $customer_id ) ) {
434
-					return $this->get( $customer_id );
433
+				if ( ! empty($customer_id)) {
434
+					return $this->get($customer_id);
435 435
  				}
436 436
  			}
437 437
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
      *
452 452
      * @return array|object|null Customers array or object. Null if not found.
453 453
 	 */
454
-	public function get_customers( $args = array() ) {
454
+	public function get_customers($args = array()) {
455 455
         /* @var WPDB $wpdb */
456 456
 		global $wpdb;
457 457
 
@@ -463,21 +463,21 @@  discard block
 block discarded – undo
463 463
 			'order'   => 'DESC'
464 464
 		);
465 465
 
466
-		$args = wp_parse_args( $args, $defaults );
466
+		$args = wp_parse_args($args, $defaults);
467 467
 
468
-		if ( $args['number'] < 1 ) {
468
+		if ($args['number'] < 1) {
469 469
 			$args['number'] = 999999999999;
470 470
 		}
471 471
 
472 472
 		$where = ' WHERE 1=1 ';
473 473
 
474 474
 		// specific customers
475
-		if ( ! empty( $args['id'] ) ) {
475
+		if ( ! empty($args['id'])) {
476 476
 
477
-			if ( is_array( $args['id'] ) ) {
478
-				$ids = implode( ',', array_map( 'intval', $args['id'] ) );
477
+			if (is_array($args['id'])) {
478
+				$ids = implode(',', array_map('intval', $args['id']));
479 479
 			} else {
480
-				$ids = intval( $args['id'] );
480
+				$ids = intval($args['id']);
481 481
 			}
482 482
 
483 483
 			$where .= " AND `id` IN( {$ids} ) ";
@@ -485,12 +485,12 @@  discard block
 block discarded – undo
485 485
 		}
486 486
 
487 487
 		// customers for specific user accounts
488
-		if ( ! empty( $args['user_id'] ) ) {
488
+		if ( ! empty($args['user_id'])) {
489 489
 
490
-			if ( is_array( $args['user_id'] ) ) {
491
-				$user_ids = implode( ',', array_map( 'intval', $args['user_id'] ) );
490
+			if (is_array($args['user_id'])) {
491
+				$user_ids = implode(',', array_map('intval', $args['user_id']));
492 492
 			} else {
493
-				$user_ids = intval( $args['user_id'] );
493
+				$user_ids = intval($args['user_id']);
494 494
 			}
495 495
 
496 496
 			$where .= " AND `user_id` IN( {$user_ids} ) ";
@@ -498,41 +498,41 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 
500 500
 		//specific customers by email
501
-		if( ! empty( $args['email'] ) ) {
501
+		if ( ! empty($args['email'])) {
502 502
 
503
-			if( is_array( $args['email'] ) ) {
503
+			if (is_array($args['email'])) {
504 504
 
505
-				$emails_count       = count( $args['email'] );
506
-				$emails_placeholder = array_fill( 0, $emails_count, '%s' );
507
-				$emails             = implode( ', ', $emails_placeholder );
505
+				$emails_count       = count($args['email']);
506
+				$emails_placeholder = array_fill(0, $emails_count, '%s');
507
+				$emails             = implode(', ', $emails_placeholder);
508 508
 
509
-				$where .= $wpdb->prepare( " AND `email` IN( $emails ) ", $args['email'] );
509
+				$where .= $wpdb->prepare(" AND `email` IN( $emails ) ", $args['email']);
510 510
 			} else {
511
-				$where .= $wpdb->prepare( " AND `email` = %s ", $args['email'] );
511
+				$where .= $wpdb->prepare(" AND `email` = %s ", $args['email']);
512 512
 			}
513 513
 		}
514 514
 
515 515
 		// specific customers by name
516
-		if( ! empty( $args['name'] ) ) {
517
-			$where .= $wpdb->prepare( " AND `name` LIKE '%%%%" . '%s' . "%%%%' ", $args['name'] );
516
+		if ( ! empty($args['name'])) {
517
+			$where .= $wpdb->prepare(" AND `name` LIKE '%%%%".'%s'."%%%%' ", $args['name']);
518 518
 		}
519 519
 
520 520
 		// Customers created for a specific date or in a date range
521
-		if ( ! empty( $args['date'] ) ) {
521
+		if ( ! empty($args['date'])) {
522 522
 
523
-			if ( is_array( $args['date'] ) ) {
523
+			if (is_array($args['date'])) {
524 524
 
525
-				if ( ! empty( $args['date']['start'] ) ) {
525
+				if ( ! empty($args['date']['start'])) {
526 526
 
527
-					$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
527
+					$start = date('Y-m-d H:i:s', strtotime($args['date']['start']));
528 528
 
529 529
 					$where .= " AND `date_created` >= '{$start}'";
530 530
 
531 531
 				}
532 532
 
533
-				if ( ! empty( $args['date']['end'] ) ) {
533
+				if ( ! empty($args['date']['end'])) {
534 534
 
535
-					$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
535
+					$end = date('Y-m-d H:i:s', strtotime($args['date']['end']));
536 536
 
537 537
 					$where .= " AND `date_created` <= '{$end}'";
538 538
 
@@ -540,31 +540,31 @@  discard block
 block discarded – undo
540 540
 
541 541
 			} else {
542 542
 
543
-				$year  = date( 'Y', strtotime( $args['date'] ) );
544
-				$month = date( 'm', strtotime( $args['date'] ) );
545
-				$day   = date( 'd', strtotime( $args['date'] ) );
543
+				$year  = date('Y', strtotime($args['date']));
544
+				$month = date('m', strtotime($args['date']));
545
+				$day   = date('d', strtotime($args['date']));
546 546
 
547 547
 				$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
548 548
 			}
549 549
 
550 550
 		}
551 551
 
552
-		$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby'];
552
+		$args['orderby'] = ! array_key_exists($args['orderby'], $this->get_columns()) ? 'id' : $args['orderby'];
553 553
 
554
-		if ( 'purchase_value' == $args['orderby'] ) {
554
+		if ('purchase_value' == $args['orderby']) {
555 555
 			$args['orderby'] = 'purchase_value+0';
556 556
 		}
557 557
 
558
-		$cache_key = md5( 'give_customers_' . serialize( $args ) );
558
+		$cache_key = md5('give_customers_'.serialize($args));
559 559
 
560
-		$customers = wp_cache_get( $cache_key, 'customers' );
560
+		$customers = wp_cache_get($cache_key, 'customers');
561 561
 
562
-		$args['orderby'] = esc_sql( $args['orderby'] );
563
-		$args['order']   = esc_sql( $args['order'] );
562
+		$args['orderby'] = esc_sql($args['orderby']);
563
+		$args['order']   = esc_sql($args['order']);
564 564
 
565
-		if ( $customers === false ) {
566
-			$customers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM  $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ) );
567
-			wp_cache_set( $cache_key, $customers, 'customers', 3600 );
565
+		if ($customers === false) {
566
+			$customers = $wpdb->get_results($wpdb->prepare("SELECT * FROM  $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint($args['offset']), absint($args['number'])));
567
+			wp_cache_set($cache_key, $customers, 'customers', 3600);
568 568
 		}
569 569
 
570 570
 		return $customers;
@@ -582,26 +582,26 @@  discard block
 block discarded – undo
582 582
      *
583 583
      * @return int         Total number of customers.
584 584
 	 */
585
-	public function count( $args = array() ) {
585
+	public function count($args = array()) {
586 586
         /* @var WPDB $wpdb */
587 587
 		global $wpdb;
588 588
 
589 589
 		$where = ' WHERE 1=1 ';
590 590
 
591
-		if ( ! empty( $args['date'] ) ) {
591
+		if ( ! empty($args['date'])) {
592 592
 
593
-			if ( is_array( $args['date'] ) ) {
593
+			if (is_array($args['date'])) {
594 594
 
595
-				$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
596
-				$end   = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
595
+				$start = date('Y-m-d H:i:s', strtotime($args['date']['start']));
596
+				$end   = date('Y-m-d H:i:s', strtotime($args['date']['end']));
597 597
 
598 598
 				$where .= " AND `date_created` >= '{$start}' AND `date_created` <= '{$end}'";
599 599
 
600 600
 			} else {
601 601
 
602
-				$year  = date( 'Y', strtotime( $args['date'] ) );
603
-				$month = date( 'm', strtotime( $args['date'] ) );
604
-				$day   = date( 'd', strtotime( $args['date'] ) );
602
+				$year  = date('Y', strtotime($args['date']));
603
+				$month = date('m', strtotime($args['date']));
604
+				$day   = date('d', strtotime($args['date']));
605 605
 
606 606
 				$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
607 607
 			}
@@ -609,16 +609,16 @@  discard block
 block discarded – undo
609 609
 		}
610 610
 
611 611
 
612
-		$cache_key = md5( 'give_customers_count' . serialize( $args ) );
612
+		$cache_key = md5('give_customers_count'.serialize($args));
613 613
 
614
-		$count = wp_cache_get( $cache_key, 'customers' );
614
+		$count = wp_cache_get($cache_key, 'customers');
615 615
 
616
-		if ( $count === false ) {
617
-			$count = $wpdb->get_var( "SELECT COUNT($this->primary_key) FROM " . $this->table_name . "{$where};" );
618
-			wp_cache_set( $cache_key, $count, 'customers', 3600 );
616
+		if ($count === false) {
617
+			$count = $wpdb->get_var("SELECT COUNT($this->primary_key) FROM ".$this->table_name."{$where};");
618
+			wp_cache_set($cache_key, $count, 'customers', 3600);
619 619
 		}
620 620
 
621
-		return absint( $count );
621
+		return absint($count);
622 622
 
623 623
 	}
624 624
 
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 	 */
633 633
 	public function create_table() {
634 634
 
635
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
635
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
636 636
 
637
-		$sql = "CREATE TABLE " . $this->table_name . " (
637
+		$sql = "CREATE TABLE ".$this->table_name." (
638 638
 		id bigint(20) NOT NULL AUTO_INCREMENT,
639 639
 		user_id bigint(20) NOT NULL,
640 640
 		email varchar(50) NOT NULL,
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
 		KEY user (user_id)
650 650
 		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
651 651
 
652
-		dbDelta( $sql );
652
+		dbDelta($sql);
653 653
 
654
-		update_option( $this->table_name . '_db_version', $this->version );
654
+		update_option($this->table_name.'_db_version', $this->version);
655 655
 	}
656 656
 	
657 657
 	/**
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
664 664
 	 */
665 665
 	public function installed() {
666
-		return $this->table_exists( $this->table_name );
666
+		return $this->table_exists($this->table_name);
667 667
 	}
668 668
 
669 669
 }
Please login to merge, or discard this patch.