Test Failed
Push — master ( f49c98...c5285d )
by Devin
01:02
created
includes/payments/backward-compatibility.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
  *                              metadata entries with the specified value.
208 208
  *                              Otherwise, update all entries.
209 209
  *
210
- * @return mixed
210
+ * @return null|boolean
211 211
  */
212 212
 function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
213 213
 	// Bailout.
Please login to merge, or discard this patch.
Spacing   +166 added lines, -171 removed lines patch added patch discarded remove patch
@@ -9,74 +9,74 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @return void
11 11
  */
12
-function _give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value ) {
12
+function _give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value) {
13 13
 	// Bailout
14
-	if ( empty( $meta_value ) ) {
14
+	if (empty($meta_value)) {
15 15
 		return;
16
-	} elseif ( ! is_array( $meta_value ) ) {
16
+	} elseif ( ! is_array($meta_value)) {
17 17
 		$meta_value = array();
18 18
 	}
19 19
 
20
-	remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10 );
20
+	remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10);
21 21
 
22 22
 	// Date payment meta.
23
-	if ( ! empty( $meta_value['date'] ) ) {
24
-		give_update_meta( $object_id, '_give_payment_date', $meta_value['date'] );
23
+	if ( ! empty($meta_value['date'])) {
24
+		give_update_meta($object_id, '_give_payment_date', $meta_value['date']);
25 25
 	}
26 26
 
27 27
 	// Currency payment meta.
28
-	if ( ! empty( $meta_value['currency'] ) ) {
29
-		give_update_meta( $object_id, '_give_payment_currency', $meta_value['currency'] );
28
+	if ( ! empty($meta_value['currency'])) {
29
+		give_update_meta($object_id, '_give_payment_currency', $meta_value['currency']);
30 30
 	}
31 31
 
32 32
 	// User information.
33
-	if ( ! empty( $meta_value['user_info'] ) ) {
33
+	if ( ! empty($meta_value['user_info'])) {
34 34
 		// Donor first name.
35
-		if ( ! empty( $meta_value['user_info']['first_name'] ) ) {
36
-			give_update_meta( $object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name'] );
35
+		if ( ! empty($meta_value['user_info']['first_name'])) {
36
+			give_update_meta($object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name']);
37 37
 		}
38 38
 
39 39
 		// Donor last name.
40
-		if ( ! empty( $meta_value['user_info']['last_name'] ) ) {
41
-			give_update_meta( $object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name'] );
40
+		if ( ! empty($meta_value['user_info']['last_name'])) {
41
+			give_update_meta($object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name']);
42 42
 		}
43 43
 
44 44
 		// Donor address payment meta.
45
-		if ( ! empty( $meta_value['user_info']['address'] ) ) {
45
+		if ( ! empty($meta_value['user_info']['address'])) {
46 46
 
47 47
 			// Address1.
48
-			if ( ! empty( $meta_value['user_info']['address']['line1'] ) ) {
49
-				give_update_meta( $object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1'] );
48
+			if ( ! empty($meta_value['user_info']['address']['line1'])) {
49
+				give_update_meta($object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1']);
50 50
 			}
51 51
 
52 52
 			// Address2.
53
-			if ( ! empty( $meta_value['user_info']['address']['line2'] ) ) {
54
-				give_update_meta( $object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2'] );
53
+			if ( ! empty($meta_value['user_info']['address']['line2'])) {
54
+				give_update_meta($object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2']);
55 55
 			}
56 56
 
57 57
 			// City.
58
-			if ( ! empty( $meta_value['user_info']['address']['city'] ) ) {
59
-				give_update_meta( $object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city'] );
58
+			if ( ! empty($meta_value['user_info']['address']['city'])) {
59
+				give_update_meta($object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city']);
60 60
 			}
61 61
 
62 62
 			// Zip.
63
-			if ( ! empty( $meta_value['user_info']['address']['zip'] ) ) {
64
-				give_update_meta( $object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip'] );
63
+			if ( ! empty($meta_value['user_info']['address']['zip'])) {
64
+				give_update_meta($object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip']);
65 65
 			}
66 66
 
67 67
 			// State.
68
-			if ( ! empty( $meta_value['user_info']['address']['state'] ) ) {
69
-				give_update_meta( $object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state'] );
68
+			if ( ! empty($meta_value['user_info']['address']['state'])) {
69
+				give_update_meta($object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state']);
70 70
 			}
71 71
 
72 72
 			// Country.
73
-			if ( ! empty( $meta_value['user_info']['address']['country'] ) ) {
74
-				give_update_meta( $object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country'] );
73
+			if ( ! empty($meta_value['user_info']['address']['country'])) {
74
+				give_update_meta($object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country']);
75 75
 			}
76 76
 		}
77 77
 	}// End if().
78 78
 
79
-	add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
79
+	add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
80 80
 }
81 81
 
82 82
 /**
@@ -89,103 +89,99 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return array
91 91
  */
92
-function _give_20_bc_give_payment_meta_value( $object_id, $meta_value ) {
92
+function _give_20_bc_give_payment_meta_value($object_id, $meta_value) {
93 93
 	$cache_key = "_give_payment_meta_{$object_id}";
94
-	$cache     = Give_Cache::get_db_query( $cache_key );
94
+	$cache     = Give_Cache::get_db_query($cache_key);
95 95
 
96
-	if ( ! is_null( $cache ) ) {
96
+	if ( ! is_null($cache)) {
97 97
 		return $cache;
98 98
 	}
99 99
 
100 100
 	// Set default value to array.
101
-	if ( ! is_array( $meta_value ) ) {
101
+	if ( ! is_array($meta_value)) {
102 102
 		$meta_value = array();
103 103
 	}
104 104
 
105 105
 	// Donation key.
106
-	$meta_value['key'] = give_get_meta( $object_id, '_give_payment_purchase_key', true );
106
+	$meta_value['key'] = give_get_meta($object_id, '_give_payment_purchase_key', true);
107 107
 
108 108
 	// Donation form.
109
-	$meta_value['form_title'] = give_get_meta( $object_id, '_give_payment_form_title', true );
109
+	$meta_value['form_title'] = give_get_meta($object_id, '_give_payment_form_title', true);
110 110
 
111 111
 	// Donor email.
112
-	$meta_value['email'] = give_get_meta( $object_id, '_give_payment_donor_email', true );
113
-	$meta_value['email'] = ! empty( $meta_value['email'] ) ?
114
-		$meta_value['email'] :
115
-		Give()->donors->get_column( 'email', give_get_payment_donor_id( $object_id ) );
112
+	$meta_value['email'] = give_get_meta($object_id, '_give_payment_donor_email', true);
113
+	$meta_value['email'] = ! empty($meta_value['email']) ?
114
+		$meta_value['email'] : Give()->donors->get_column('email', give_get_payment_donor_id($object_id));
116 115
 
117 116
 	// Form id.
118
-	$meta_value['form_id'] = give_get_meta( $object_id, '_give_payment_form_id', true );
117
+	$meta_value['form_id'] = give_get_meta($object_id, '_give_payment_form_id', true);
119 118
 
120 119
 	// Price id.
121
-	$meta_value['price_id'] = give_get_meta( $object_id, '_give_payment_price_id', true );
120
+	$meta_value['price_id'] = give_get_meta($object_id, '_give_payment_price_id', true);
122 121
 
123 122
 	// Date.
124
-	$meta_value['date'] = give_get_meta( $object_id, '_give_payment_date', true );
125
-	$meta_value['date'] = ! empty( $meta_value['date'] ) ?
126
-		$meta_value['date'] :
127
-		get_post_field( 'post_date', $object_id );
123
+	$meta_value['date'] = give_get_meta($object_id, '_give_payment_date', true);
124
+	$meta_value['date'] = ! empty($meta_value['date']) ?
125
+		$meta_value['date'] : get_post_field('post_date', $object_id);
128 126
 
129 127
 	// Currency.
130
-	$meta_value['currency'] = give_get_meta( $object_id, '_give_payment_currency', true );
128
+	$meta_value['currency'] = give_get_meta($object_id, '_give_payment_currency', true);
131 129
 
132 130
 	// Decode donor data.
133
-	$donor_names = give_get_donor_name_by( give_get_meta( $object_id, '_give_payment_donor_id', true ), 'donor' );
134
-	$donor_names = explode( ' ', $donor_names, 2 );
131
+	$donor_names = give_get_donor_name_by(give_get_meta($object_id, '_give_payment_donor_id', true), 'donor');
132
+	$donor_names = explode(' ', $donor_names, 2);
135 133
 
136 134
 	// Donor first name.
137
-	$donor_data['first_name'] = give_get_meta( $object_id, '_give_donor_billing_first_name', true );
138
-	$donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ?
139
-		$donor_data['first_name'] :
140
-		$donor_names[0];
135
+	$donor_data['first_name'] = give_get_meta($object_id, '_give_donor_billing_first_name', true);
136
+	$donor_data['first_name'] = ! empty($donor_data['first_name']) ?
137
+		$donor_data['first_name'] : $donor_names[0];
141 138
 
142 139
 	// Donor last name.
143
-	$donor_data['last_name'] = give_get_meta( $object_id, '_give_donor_billing_last_name', true );
144
-	$donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ?
145
-		$donor_data['last_name'] :
146
-		( isset( $donor_names[1] ) ? $donor_names[1] : '' );
140
+	$donor_data['last_name'] = give_get_meta($object_id, '_give_donor_billing_last_name', true);
141
+	$donor_data['last_name'] = ! empty($donor_data['last_name']) ?
142
+		$donor_data['last_name'] : (isset($donor_names[1]) ? $donor_names[1] : '');
147 143
 
148 144
 	// Donor email.
149 145
 	$donor_data['email'] = $meta_value['email'];
150 146
 
151 147
 	// User ID.
152
-	$donor_data['id'] = give_get_payment_user_id( $object_id );
148
+	$donor_data['id'] = give_get_payment_user_id($object_id);
153 149
 
154 150
 	$donor_data['address'] = false;
155 151
 
156 152
 	// Address1.
157
-	if ( $address1 = give_get_meta( $object_id, '_give_donor_billing_address1', true ) ) {
153
+	if ($address1 = give_get_meta($object_id, '_give_donor_billing_address1', true)) {
158 154
 		$donor_data['address']['line1'] = $address1;
159 155
 	}
160 156
 
161 157
 	// Address2.
162
-	if ( $address2 = give_get_meta( $object_id, '_give_donor_billing_address2', true ) ) {
158
+	if ($address2 = give_get_meta($object_id, '_give_donor_billing_address2', true)) {
163 159
 		$donor_data['address']['line2'] = $address2;
164 160
 	}
165 161
 
166 162
 	// City.
167
-	if ( $city = give_get_meta( $object_id, '_give_donor_billing_city', true ) ) {
163
+	if ($city = give_get_meta($object_id, '_give_donor_billing_city', true)) {
168 164
 		$donor_data['address']['city'] = $city;
169 165
 	}
170 166
 
171 167
 	// Zip.
172
-	if ( $zip = give_get_meta( $object_id, '_give_donor_billing_zip', true ) ) {
168
+	if ($zip = give_get_meta($object_id, '_give_donor_billing_zip', true)) {
173 169
 		$donor_data['address']['zip'] = $zip;
174 170
 	}
175 171
 
176 172
 	// State.
177
-	if ( $state = give_get_meta( $object_id, '_give_donor_billing_state', true ) ) {
173
+	if ($state = give_get_meta($object_id, '_give_donor_billing_state', true)) {
178 174
 		$donor_data['address']['state'] = $state;
179 175
 	}
180 176
 
181 177
 	// Country.
182
-	if ( $country = give_get_meta( $object_id, '_give_donor_billing_country', true ) ) {
178
+	if ($country = give_get_meta($object_id, '_give_donor_billing_country', true)) {
183 179
 		$donor_data['address']['country'] = $country;
184 180
 	}
185 181
 
186
-	$meta_value['user_info'] = maybe_unserialize( $donor_data );
182
+	$meta_value['user_info'] = maybe_unserialize($donor_data);
187 183
 
188
-	Give_Cache::set_db_query( $cache_key, $meta_value );
184
+	Give_Cache::set_db_query($cache_key, $meta_value);
189 185
 
190 186
 	return $meta_value;
191 187
 }
@@ -209,37 +205,37 @@  discard block
 block discarded – undo
209 205
  *
210 206
  * @return mixed
211 207
  */
212
-function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
208
+function _give_20_bc_saving_old_payment_meta($check, $object_id, $meta_key, $meta_value, $prev_value) {
213 209
 	// Bailout.
214 210
 	if (
215
-		'give_payment' !== get_post_type( $object_id ) ||
216
-		! in_array( $meta_key, array(
211
+		'give_payment' !== get_post_type($object_id) ||
212
+		! in_array($meta_key, array(
217 213
 			'_give_payment_meta',
218 214
 			'_give_payment_user_email',
219 215
 			'_give_payment_customer_id',
220 216
 			'give_payment_user_ip',
221
-		) )
217
+		))
222 218
 	) {
223 219
 		return $check;
224 220
 	}
225 221
 
226
-	if ( '_give_payment_meta' === $meta_key ) {
227
-		_give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value );
228
-	} elseif ( '_give_payment_user_email' === $meta_key ) {
229
-		give_update_meta( $object_id, '_give_payment_donor_email', $meta_value );
222
+	if ('_give_payment_meta' === $meta_key) {
223
+		_give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value);
224
+	} elseif ('_give_payment_user_email' === $meta_key) {
225
+		give_update_meta($object_id, '_give_payment_donor_email', $meta_value);
230 226
 		$check = true;
231
-	} elseif ( '_give_payment_customer_id' === $meta_key ) {
232
-		give_update_meta( $object_id, '_give_payment_donor_id', $meta_value );
227
+	} elseif ('_give_payment_customer_id' === $meta_key) {
228
+		give_update_meta($object_id, '_give_payment_donor_id', $meta_value);
233 229
 		$check = true;
234
-	} elseif ( 'give_payment_user_ip' === $meta_key ) {
235
-		give_update_meta( $object_id, '_give_payment_donor_ip', $meta_value );
230
+	} elseif ('give_payment_user_ip' === $meta_key) {
231
+		give_update_meta($object_id, '_give_payment_donor_ip', $meta_value);
236 232
 		$check = true;
237 233
 	}
238 234
 
239 235
 	return $check;
240 236
 }
241 237
 
242
-add_filter( 'update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5 );
238
+add_filter('update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5);
243 239
 
244 240
 
245 241
 /**
@@ -254,7 +250,7 @@  discard block
 block discarded – undo
254 250
  *
255 251
  * @return mixed
256 252
  */
257
-function _give_20_bc_get_old_payment_meta( $check, $object_id, $meta_key, $single ) {
253
+function _give_20_bc_get_old_payment_meta($check, $object_id, $meta_key, $single) {
258 254
 	global $wpdb;
259 255
 
260 256
 	// Deprecated meta keys.
@@ -265,32 +261,31 @@  discard block
 block discarded – undo
265 261
 	);
266 262
 
267 263
 	// Add _give_payment_meta to backward compatibility
268
-	if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
264
+	if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
269 265
 		$old_meta_keys[] = '_give_payment_meta';
270 266
 	}
271 267
 
272 268
 	// Bailout.
273 269
 	if (
274
-		'give_payment' !== get_post_type( $object_id ) ||
275
-		! in_array( $meta_key, $old_meta_keys )
270
+		'give_payment' !== get_post_type($object_id) ||
271
+		! in_array($meta_key, $old_meta_keys)
276 272
 	) {
277 273
 		return $check;
278 274
 	}
279 275
 
280 276
 	$cache_key = "{$meta_key}_{$object_id}";
281
-	$check     = Give_Cache::get_db_query( $cache_key );
277
+	$check     = Give_Cache::get_db_query($cache_key);
282 278
 
283
-	if ( is_null( $check ) ) {
284
-		switch ( $meta_key ) {
279
+	if (is_null($check)) {
280
+		switch ($meta_key) {
285 281
 
286 282
 			// Handle old meta keys.
287 283
 			case '_give_payment_meta':
288
-				remove_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta' );
284
+				remove_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta');
289 285
 
290 286
 				// if ( $meta_value = give_get_meta( $object_id, '_give_payment_meta' ) ) {
291
-				$meta_value = ! empty( $meta_value ) ?
292
-					current( $meta_value ) :
293
-					(array) maybe_unserialize(
287
+				$meta_value = ! empty($meta_value) ?
288
+					current($meta_value) : (array) maybe_unserialize(
294 289
 						$wpdb->get_var(
295 290
 							$wpdb->prepare(
296 291
 								"
@@ -304,44 +299,44 @@  discard block
 block discarded – undo
304 299
 							)
305 300
 						)
306 301
 					);
307
-				$check      = _give_20_bc_give_payment_meta_value( $object_id, $meta_value );
302
+				$check = _give_20_bc_give_payment_meta_value($object_id, $meta_value);
308 303
 				// }
309 304
 
310
-				add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 );
305
+				add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5);
311 306
 
312 307
 				break;
313 308
 
314 309
 			case '_give_payment_customer_id':
315
-				if ( $donor_id = give_get_meta( $object_id, '_give_payment_donor_id', $single ) ) {
310
+				if ($donor_id = give_get_meta($object_id, '_give_payment_donor_id', $single)) {
316 311
 					$check = $donor_id;
317 312
 				}
318 313
 				break;
319 314
 
320 315
 			case '_give_payment_user_email':
321
-				if ( $donor_email = give_get_meta( $object_id, '_give_payment_donor_email', $single ) ) {
316
+				if ($donor_email = give_get_meta($object_id, '_give_payment_donor_email', $single)) {
322 317
 					$check = $donor_email;
323 318
 				}
324 319
 				break;
325 320
 
326 321
 			case '_give_payment_user_ip':
327
-				if ( $donor_ip = give_get_meta( $object_id, '_give_payment_donor_ip', $single ) ) {
322
+				if ($donor_ip = give_get_meta($object_id, '_give_payment_donor_ip', $single)) {
328 323
 					$check = $donor_ip;
329 324
 				}
330 325
 				break;
331 326
 		}// End switch().
332 327
 
333
-		Give_Cache::set_db_query( $cache_key, $check );
328
+		Give_Cache::set_db_query($cache_key, $check);
334 329
 	}
335 330
 
336 331
 	// Put result in an array on zero index.
337
-	if ( ! is_null( $check ) ) {
338
-		$check = array( $check );
332
+	if ( ! is_null($check)) {
333
+		$check = array($check);
339 334
 	}
340 335
 
341 336
 	return $check;
342 337
 }
343 338
 
344
-add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 );
339
+add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5);
345 340
 
346 341
 
347 342
 /**
@@ -356,9 +351,9 @@  discard block
 block discarded – undo
356 351
  *
357 352
  * @return mixed
358 353
  */
359
-function _give_20_bc_get_new_payment_meta( $check, $object_id, $meta_key, $single ) {
354
+function _give_20_bc_get_new_payment_meta($check, $object_id, $meta_key, $single) {
360 355
 	// Bailout: do not apply backward compatibility if upgrade done.
361
-	if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
356
+	if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
362 357
 		return $check;
363 358
 	}
364 359
 
@@ -380,26 +375,26 @@  discard block
 block discarded – undo
380 375
 	);
381 376
 
382 377
 	// metadata_exists fx will cause of firing get_post_metadata filter again so remove it to prevent infinite loop.
383
-	remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta' );
378
+	remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta');
384 379
 
385 380
 	// Bailout.
386 381
 	if (
387
-		'give_payment' !== get_post_type( $object_id ) ||
388
-		! in_array( $meta_key, $new_meta_keys ) ||
389
-		metadata_exists( 'post', $object_id, $meta_key )
382
+		'give_payment' !== get_post_type($object_id) ||
383
+		! in_array($meta_key, $new_meta_keys) ||
384
+		metadata_exists('post', $object_id, $meta_key)
390 385
 	) {
391
-		add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
386
+		add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
392 387
 
393 388
 		return $check;
394 389
 	}
395 390
 
396
-	add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
391
+	add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
397 392
 
398 393
 	$cache_key = "{$meta_key}_{$object_id}";
399
-	$check    = Give_Cache::get_db_query( $cache_key );
394
+	$check = Give_Cache::get_db_query($cache_key);
400 395
 
401
-	if ( is_null( $check ) ) {
402
-		switch ( $meta_key ) {
396
+	if (is_null($check)) {
397
+		switch ($meta_key) {
403 398
 
404 399
 			// Handle new meta keys.
405 400
 			case '_give_payment_donor_id':
@@ -442,9 +437,9 @@  discard block
 block discarded – undo
442 437
 			case '_give_donor_billing_country':
443 438
 			case '_give_payment_date':
444 439
 			case '_give_payment_currency':
445
-				$donation_meta = Give_Cache::get_db_query( "_give_payment_meta_{$object_id}" );
440
+				$donation_meta = Give_Cache::get_db_query("_give_payment_meta_{$object_id}");
446 441
 
447
-				if ( is_null( $donation_meta ) ) {
442
+				if (is_null($donation_meta)) {
448 443
 					$donation_meta = $wpdb->get_var(
449 444
 						$wpdb->prepare(
450 445
 							"SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id=%d AND meta_key=%s",
@@ -452,51 +447,51 @@  discard block
 block discarded – undo
452 447
 							'_give_payment_meta'
453 448
 						)
454 449
 					);
455
-					$donation_meta = maybe_unserialize( $donation_meta );
456
-					$donation_meta = ! is_array( $donation_meta ) ? array() : $donation_meta;
457
-					Give_Cache::set_db_query( "_give_payment_meta_{$object_id}", $donation_meta );
450
+					$donation_meta = maybe_unserialize($donation_meta);
451
+					$donation_meta = ! is_array($donation_meta) ? array() : $donation_meta;
452
+					Give_Cache::set_db_query("_give_payment_meta_{$object_id}", $donation_meta);
458 453
 				}
459 454
 
460 455
 				// Get results.
461
-				if ( empty( $donation_meta ) ) {
456
+				if (empty($donation_meta)) {
462 457
 					$check = '';
463
-				} elseif ( in_array( $meta_key, array( '_give_payment_date', '_give_payment_currency' ) ) ) {
464
-					$payment_meta_key = str_replace( '_give_payment_', '', $meta_key );
458
+				} elseif (in_array($meta_key, array('_give_payment_date', '_give_payment_currency'))) {
459
+					$payment_meta_key = str_replace('_give_payment_', '', $meta_key);
465 460
 
466
-					if ( isset( $donation_meta[ $payment_meta_key ] ) ) {
467
-						$check = $donation_meta[ $payment_meta_key ];
461
+					if (isset($donation_meta[$payment_meta_key])) {
462
+						$check = $donation_meta[$payment_meta_key];
468 463
 					}
469 464
 				} else {
470
-					$payment_meta_key = str_replace( '_give_donor_billing_', '', $meta_key );
465
+					$payment_meta_key = str_replace('_give_donor_billing_', '', $meta_key);
471 466
 
472
-					switch ( $payment_meta_key ) {
467
+					switch ($payment_meta_key) {
473 468
 						case 'address1':
474
-							if ( isset( $donation_meta['user_info']['address']['line1'] ) ) {
469
+							if (isset($donation_meta['user_info']['address']['line1'])) {
475 470
 								$check = $donation_meta['user_info']['address']['line1'];
476 471
 							}
477 472
 							break;
478 473
 
479 474
 						case 'address2':
480
-							if ( isset( $donation_meta['user_info']['address']['line2'] ) ) {
475
+							if (isset($donation_meta['user_info']['address']['line2'])) {
481 476
 								$check = $donation_meta['user_info']['address']['line2'];
482 477
 							}
483 478
 							break;
484 479
 
485 480
 						case 'first_name':
486
-							if ( isset( $donation_meta['user_info']['first_name'] ) ) {
481
+							if (isset($donation_meta['user_info']['first_name'])) {
487 482
 								$check = $donation_meta['user_info']['first_name'];
488 483
 							}
489 484
 							break;
490 485
 
491 486
 						case 'last_name':
492
-							if ( isset( $donation_meta['user_info']['last_name'] ) ) {
487
+							if (isset($donation_meta['user_info']['last_name'])) {
493 488
 								$check = $donation_meta['user_info']['last_name'];
494 489
 							}
495 490
 							break;
496 491
 
497 492
 						default:
498
-							if ( isset( $donation_meta['user_info']['address'][ $payment_meta_key ] ) ) {
499
-								$check = $donation_meta['user_info']['address'][ $payment_meta_key ];
493
+							if (isset($donation_meta['user_info']['address'][$payment_meta_key])) {
494
+								$check = $donation_meta['user_info']['address'][$payment_meta_key];
500 495
 							}
501 496
 					}
502 497
 				}
@@ -505,19 +500,19 @@  discard block
 block discarded – undo
505 500
 		}// End switch().
506 501
 
507 502
 		// Set cache.
508
-		Give_Cache::set_db_query( $cache_key, $check );
503
+		Give_Cache::set_db_query($cache_key, $check);
509 504
 	}
510 505
 
511 506
 	// Put result in an array on zero index.
512
-	if ( ! $single ) {
513
-		$check = array( $check );
507
+	if ( ! $single) {
508
+		$check = array($check);
514 509
 	}
515 510
 
516 511
 
517 512
 	return $check;
518 513
 }
519 514
 
520
-add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
515
+add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
521 516
 
522 517
 
523 518
 /**
@@ -529,9 +524,9 @@  discard block
 block discarded – undo
529 524
  *
530 525
  * @return void
531 526
  */
532
-function _give_20_bc_support_deprecated_meta_key_query( $query ) {
527
+function _give_20_bc_support_deprecated_meta_key_query($query) {
533 528
 	// Bailout.
534
-	if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
529
+	if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
535 530
 		return;
536 531
 	}
537 532
 
@@ -541,21 +536,21 @@  discard block
 block discarded – undo
541 536
 		// '_give_payment_user_ip'     => '_give_payment_donor_ip',
542 537
 	);
543 538
 
544
-	$deprecated_meta_keys = array_flip( $new_meta_keys );
539
+	$deprecated_meta_keys = array_flip($new_meta_keys);
545 540
 
546 541
 	// Set meta keys.
547 542
 	$meta_keys = array();
548 543
 
549 544
 
550 545
 	// Bailout.
551
-	if ( ! empty( $query->query_vars['meta_key'] ) ) {
552
-		if ( in_array( $query->query_vars['meta_key'], $new_meta_keys ) ) {
546
+	if ( ! empty($query->query_vars['meta_key'])) {
547
+		if (in_array($query->query_vars['meta_key'], $new_meta_keys)) {
553 548
 			$meta_keys = $deprecated_meta_keys;
554
-		} elseif ( in_array( $query->query_vars['meta_key'], $deprecated_meta_keys ) ) {
549
+		} elseif (in_array($query->query_vars['meta_key'], $deprecated_meta_keys)) {
555 550
 			$meta_keys = $new_meta_keys;
556 551
 		}
557 552
 
558
-		if ( ! empty( $meta_keys ) ) {
553
+		if ( ! empty($meta_keys)) {
559 554
 			// Set meta_query
560 555
 			$query->set(
561 556
 				'meta_query',
@@ -566,35 +561,35 @@  discard block
 block discarded – undo
566 561
 						'value' => $query->query_vars['meta_value'],
567 562
 					),
568 563
 					array(
569
-						'key'   => $meta_keys[ $query->query_vars['meta_key'] ],
564
+						'key'   => $meta_keys[$query->query_vars['meta_key']],
570 565
 						'value' => $query->query_vars['meta_value'],
571 566
 					),
572 567
 				)
573 568
 			);
574 569
 
575 570
 			// Unset single meta query.
576
-			unset( $query->query_vars['meta_key'] );
577
-			unset( $query->query_vars['meta_value'] );
571
+			unset($query->query_vars['meta_key']);
572
+			unset($query->query_vars['meta_value']);
578 573
 		}
579 574
 	} elseif (
580
-		! empty( $query->query_vars['meta_query'] ) &&
581
-		( 1 === count( $query->query_vars['meta_query'] ) )
575
+		! empty($query->query_vars['meta_query']) &&
576
+		(1 === count($query->query_vars['meta_query']))
582 577
 	) {
583
-		$meta_query = current( $query->query_vars['meta_query'] );
578
+		$meta_query = current($query->query_vars['meta_query']);
584 579
 
585
-		if ( empty( $meta_query[0]['key'] ) ) {
580
+		if (empty($meta_query[0]['key'])) {
586 581
 			return;
587 582
 		}
588 583
 
589
-		if ( in_array( $meta_query[0]['key'], $new_meta_keys ) ) {
584
+		if (in_array($meta_query[0]['key'], $new_meta_keys)) {
590 585
 			$meta_keys = $deprecated_meta_keys;
591
-		} elseif ( in_array( $meta_query[0]['key'], $deprecated_meta_keys ) ) {
586
+		} elseif (in_array($meta_query[0]['key'], $deprecated_meta_keys)) {
592 587
 			$meta_keys = $new_meta_keys;
593 588
 		} else {
594 589
 			return;
595 590
 		}
596 591
 
597
-		if ( ! empty( $meta_keys ) ) {
592
+		if ( ! empty($meta_keys)) {
598 593
 			// Set meta_query
599 594
 			$query->set(
600 595
 				'meta_query',
@@ -605,7 +600,7 @@  discard block
 block discarded – undo
605 600
 						'value' => $query->query_vars['meta_query'][0]['value'],
606 601
 					),
607 602
 					array(
608
-						'key'   => $meta_keys[ $query->query_vars['meta_query'][0]['key'] ],
603
+						'key'   => $meta_keys[$query->query_vars['meta_query'][0]['key']],
609 604
 						'value' => $query->query_vars['meta_query'][0]['value'],
610 605
 					),
611 606
 				)
@@ -614,7 +609,7 @@  discard block
 block discarded – undo
614 609
 	}
615 610
 }
616 611
 
617
-add_action( 'pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query' );
612
+add_action('pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query');
618 613
 
619 614
 
620 615
 /**
@@ -627,49 +622,49 @@  discard block
 block discarded – undo
627 622
  * @param Give_Payment $payment
628 623
  * @param string       $key
629 624
  */
630
-function _give_20_bc_payment_save( $payment, $key ) {
625
+function _give_20_bc_payment_save($payment, $key) {
631 626
 	// Bailout.
632
-	if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
627
+	if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
633 628
 		return;
634 629
 	}
635 630
 
636
-	switch ( $key ) {
631
+	switch ($key) {
637 632
 		case 'user_info':
638
-			if ( empty( $payment->user_info ) ) {
633
+			if (empty($payment->user_info)) {
639 634
 				// Bailout.
640 635
 				break;
641
-			} elseif ( is_string( $payment->user_info ) ) {
636
+			} elseif (is_string($payment->user_info)) {
642 637
 				// Check if value serialize.
643
-				$payment->user_info = maybe_unserialize( $payment->user_info );
638
+				$payment->user_info = maybe_unserialize($payment->user_info);
644 639
 			}
645 640
 
646 641
 
647 642
 			// Save first name.
648
-			if ( isset( $payment->user_info['first_name'] ) ) {
649
-				$payment->update_meta( '_give_donor_billing_first_name', $payment->user_info['first_name'] );
643
+			if (isset($payment->user_info['first_name'])) {
644
+				$payment->update_meta('_give_donor_billing_first_name', $payment->user_info['first_name']);
650 645
 			}
651 646
 
652 647
 
653 648
 			// Save last name.
654
-			if ( isset( $payment->user_info['last_name'] ) ) {
655
-				$payment->update_meta( '_give_donor_billing_last_name', $payment->user_info['last_name'] );
649
+			if (isset($payment->user_info['last_name'])) {
650
+				$payment->update_meta('_give_donor_billing_last_name', $payment->user_info['last_name']);
656 651
 			}
657 652
 
658 653
 
659 654
 			// Save address.
660
-			if ( ! empty( $payment->user_info['address'] ) ) {
661
-				foreach ( $payment->user_info['address'] as $address_name => $address ) {
662
-					switch ( $address_name ) {
655
+			if ( ! empty($payment->user_info['address'])) {
656
+				foreach ($payment->user_info['address'] as $address_name => $address) {
657
+					switch ($address_name) {
663 658
 						case 'line1':
664
-							$payment->update_meta( '_give_donor_billing_address1', $address );
659
+							$payment->update_meta('_give_donor_billing_address1', $address);
665 660
 							break;
666 661
 
667 662
 						case 'line2':
668
-							$payment->update_meta( '_give_donor_billing_address2', $address );
663
+							$payment->update_meta('_give_donor_billing_address2', $address);
669 664
 							break;
670 665
 
671 666
 						default:
672
-							$payment->update_meta( "_give_donor_billing_{$address_name}", $address );
667
+							$payment->update_meta("_give_donor_billing_{$address_name}", $address);
673 668
 					}
674 669
 				}
675 670
 			}
@@ -678,7 +673,7 @@  discard block
 block discarded – undo
678 673
 	}
679 674
 }
680 675
 
681
-add_action( 'give_payment_save', '_give_20_bc_payment_save', 10, 2 );
676
+add_action('give_payment_save', '_give_20_bc_payment_save', 10, 2);
682 677
 
683 678
 
684 679
 /**
@@ -691,16 +686,16 @@  discard block
 block discarded – undo
691 686
  *
692 687
  * @return mixed
693 688
  */
694
-function __give_20_bc_flush_cache( $check, $object_id ) {
689
+function __give_20_bc_flush_cache($check, $object_id) {
695 690
 	if (
696
-		! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) &&
697
-		'give_payment' === get_post_type( $object_id )
691
+		! give_has_upgrade_completed('v20_move_metadata_into_new_table') &&
692
+		'give_payment' === get_post_type($object_id)
698 693
 	) {
699
-		Give_Cache::delete_group( $object_id, 'give-donations' );
694
+		Give_Cache::delete_group($object_id, 'give-donations');
700 695
 	}
701 696
 
702 697
 	return $check;
703 698
 }
704 699
 
705
-add_action( 'update_post_metadata', '__give_20_bc_flush_cache', 9999, 2 );
706
-add_action( 'add_post_metadata', '__give_20_bc_flush_cache', 9999, 2 );
700
+add_action('update_post_metadata', '__give_20_bc_flush_cache', 9999, 2);
701
+add_action('add_post_metadata', '__give_20_bc_flush_cache', 9999, 2);
Please login to merge, or discard this patch.
includes/payments/class-payments-query.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @since  1.0
108 108
 	 * @access public
109 109
 	 *
110
-	 * @param $query_var
110
+	 * @param string $query_var
111 111
 	 * @param $value
112 112
 	 */
113 113
 	public function __set( $query_var, $value ) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @since  1.0
125 125
 	 * @access public
126 126
 	 *
127
-	 * @param $query_var
127
+	 * @param string $query_var
128 128
 	 */
129 129
 	public function __unset( $query_var ) {
130 130
 		unset( $this->args[ $query_var ] );
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param string   $order
469 469
 	 * @param WP_Query $query
470 470
 	 *
471
-	 * @return mixed
471
+	 * @return string
472 472
 	 */
473 473
 	public function custom_orderby( $order, $query ) {
474 474
 
Please login to merge, or discard this patch.
Spacing   +149 added lines, -149 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
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
68 68
 	 */
69
-	public function __construct( $args = array() ) {
69
+	public function __construct($args = array()) {
70 70
 		$defaults = array(
71 71
 			'output'          => 'payments',
72
-			'post_type'       => array( 'give_payment' ),
72
+			'post_type'       => array('give_payment'),
73 73
 			'start_date'      => false,
74 74
 			'end_date'        => false,
75 75
 			'number'          => 20,
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'count'           => false,
97 97
 		);
98 98
 
99
-		$this->args = $this->_args = wp_parse_args( $args, $defaults );
99
+		$this->args = $this->_args = wp_parse_args($args, $defaults);
100 100
 
101 101
 		$this->init();
102 102
 	}
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	 * @param $query_var
111 111
 	 * @param $value
112 112
 	 */
113
-	public function __set( $query_var, $value ) {
114
-		if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) {
115
-			$this->args[ $query_var ][] = $value;
113
+	public function __set($query_var, $value) {
114
+		if (in_array($query_var, array('meta_query', 'tax_query'))) {
115
+			$this->args[$query_var][] = $value;
116 116
 		} else {
117
-			$this->args[ $query_var ] = $value;
117
+			$this->args[$query_var] = $value;
118 118
 		}
119 119
 	}
120 120
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param $query_var
128 128
 	 */
129
-	public function __unset( $query_var ) {
130
-		unset( $this->args[ $query_var ] );
129
+	public function __unset($query_var) {
130
+		unset($this->args[$query_var]);
131 131
 	}
132 132
 
133 133
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$this->give_forms();
168 168
 		$this->gateway_filter();
169 169
 
170
-		add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 );
170
+		add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2);
171 171
 
172 172
 		/**
173 173
 		 * Fires after setup filters.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 *
177 177
 		 * @param Give_Payments_Query $this Payments query object.
178 178
 		 */
179
-		do_action( 'give_pre_get_payments', $this );
179
+		do_action('give_pre_get_payments', $this);
180 180
 	}
181 181
 
182 182
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access private
187 187
 	 */
188 188
 	private function unset_filters() {
189
-		remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) );
189
+		remove_filter('posts_orderby', array($this, 'custom_orderby'));
190 190
 
191 191
 		/**
192 192
 		 * Fires after retrieving payments.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 *
196 196
 		 * @param Give_Payments_Query $this Payments query object.
197 197
 		 */
198
-		do_action( 'give_post_get_payments', $this );
198
+		do_action('give_post_get_payments', $this);
199 199
 	}
200 200
 
201 201
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 * @return array
213 213
 	 */
214 214
 	public function get_payments() {
215
-		$cache_key      = Give_Cache::get_key( 'give_payment_query', $this->args, false );
216
-		$this->payments = Give_Cache::get_db_query( $cache_key );
215
+		$cache_key      = Give_Cache::get_key('give_payment_query', $this->args, false);
216
+		$this->payments = Give_Cache::get_db_query($cache_key);
217 217
 
218 218
 		// Return cached result.
219
-		if ( ! is_null( $this->payments ) ) {
219
+		if ( ! is_null($this->payments)) {
220 220
 			return $this->payments;
221 221
 		}
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		// Modify the query/query arguments before we retrieve payments.
225 225
 		$this->set_filters();
226 226
 
227
-		$query          = new WP_Query( $this->args );
227
+		$query          = new WP_Query($this->args);
228 228
 		$this->payments = array();
229 229
 
230 230
 		$custom_output = array(
@@ -232,24 +232,24 @@  discard block
 block discarded – undo
232 232
 			'give_payments',
233 233
 		);
234 234
 
235
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
235
+		if ( ! in_array($this->args['output'], $custom_output)) {
236 236
 			return $query->posts;
237 237
 		}
238 238
 
239
-		if ( $query->have_posts() ) {
240
-			while ( $query->have_posts() ) {
239
+		if ($query->have_posts()) {
240
+			while ($query->have_posts()) {
241 241
 				$query->the_post();
242 242
 
243 243
 				$payment_id = get_post()->ID;
244
-				$payment    = new Give_Payment( $payment_id );
244
+				$payment    = new Give_Payment($payment_id);
245 245
 
246
-				$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
246
+				$this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this);
247 247
 			}
248 248
 
249 249
 			wp_reset_postdata();
250 250
 		}
251 251
 
252
-		Give_Cache::set_db_query( $cache_key, $this->payments );
252
+		Give_Cache::set_db_query($cache_key, $this->payments);
253 253
 
254 254
 		// Remove query filters after we retrieve payments.
255 255
 		$this->unset_filters();
@@ -268,31 +268,31 @@  discard block
 block discarded – undo
268 268
 	public function get_payment_by_group() {
269 269
 		global $wpdb;
270 270
 
271
-		$allowed_groups = array( 'post_status' );
271
+		$allowed_groups = array('post_status');
272 272
 		$result         = array();
273 273
 
274 274
 
275
-		if ( in_array( $this->args['group_by'], $allowed_groups ) ) {
275
+		if (in_array($this->args['group_by'], $allowed_groups)) {
276 276
 			// Set only count in result.
277
-			if ( $this->args['count'] ) {
277
+			if ($this->args['count']) {
278 278
 
279 279
 				$this->set_filters();
280 280
 
281
-				$new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N );
281
+				$new_results = $wpdb->get_results($this->get_sql(), ARRAY_N);
282 282
 
283 283
 				$this->unset_filters();
284 284
 
285
-				foreach ( $new_results as $results ) {
286
-					$result[ $results[0] ] = $results[1];
285
+				foreach ($new_results as $results) {
286
+					$result[$results[0]] = $results[1];
287 287
 				}
288 288
 
289
-				switch ( $this->args['group_by'] ) {
289
+				switch ($this->args['group_by']) {
290 290
 					case 'post_status':
291 291
 
292 292
 						/* @var Give_Payment $donation */
293
-						foreach ( give_get_payment_status_keys() as $status ) {
294
-							if ( ! isset( $result[ $status ] ) ) {
295
-								$result[ $status ] = 0;
293
+						foreach (give_get_payment_status_keys() as $status) {
294
+							if ( ! isset($result[$status])) {
295
+								$result[$status] = 0;
296 296
 							}
297 297
 						}
298 298
 
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 				$donations = $this->get_payments();
303 303
 
304 304
 				/* @var $donation Give_Payment */
305
-				foreach ( $donations as $donation ) {
306
-					$result[ $donation->{$this->args['group_by']} ][] = $donation;
305
+				foreach ($donations as $donation) {
306
+					$result[$donation->{$this->args['group_by']}][] = $donation;
307 307
 				}
308 308
 			}
309 309
 		}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		 *
315 315
 		 * @since 1.8.17
316 316
 		 */
317
-		return apply_filters( 'give_get_payment_by_group', $result, $this );
317
+		return apply_filters('give_get_payment_by_group', $result, $this);
318 318
 	}
319 319
 
320 320
 	/**
@@ -326,29 +326,29 @@  discard block
 block discarded – undo
326 326
 	 * @return void
327 327
 	 */
328 328
 	public function date_filter_pre() {
329
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
329
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
330 330
 			return;
331 331
 		}
332 332
 
333
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
334
-		$is_start_date = property_exists( __CLASS__, 'start_date' );
335
-		$is_end_date   = property_exists( __CLASS__, 'end_date' );
333
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
334
+		$is_start_date = property_exists(__CLASS__, 'start_date');
335
+		$is_end_date   = property_exists(__CLASS__, 'end_date');
336 336
 
337
-		if ( $is_start_date || $is_end_date ) {
337
+		if ($is_start_date || $is_end_date) {
338 338
 			$date_query = array();
339 339
 
340
-			if ( $is_start_date && ! is_wp_error( $this->start_date ) ) {
341
-				$date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date );
340
+			if ($is_start_date && ! is_wp_error($this->start_date)) {
341
+				$date_query['after'] = date('Y-m-d H:i:s', $this->start_date);
342 342
 			}
343 343
 
344
-			if ( $is_end_date && ! is_wp_error( $this->end_date ) ) {
345
-				$date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date );
344
+			if ($is_end_date && ! is_wp_error($this->end_date)) {
345
+				$date_query['before'] = date('Y-m-d H:i:s', $this->end_date);
346 346
 			}
347 347
 
348 348
 			// Include Start Date and End Date while querying.
349 349
 			$date_query['inclusive'] = true;
350 350
 
351
-			$this->__set( 'date_query', $date_query );
351
+			$this->__set('date_query', $date_query);
352 352
 
353 353
 		}
354 354
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	 * @return void
364 364
 	 */
365 365
 	public function status() {
366
-		if ( ! isset( $this->args['status'] ) ) {
366
+		if ( ! isset($this->args['status'])) {
367 367
 			return;
368 368
 		}
369 369
 
370
-		$this->__set( 'post_status', $this->args['status'] );
371
-		$this->__unset( 'status' );
370
+		$this->__set('post_status', $this->args['status']);
371
+		$this->__unset('status');
372 372
 	}
373 373
 
374 374
 	/**
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function page() {
383
-		if ( ! isset( $this->args['page'] ) ) {
383
+		if ( ! isset($this->args['page'])) {
384 384
 			return;
385 385
 		}
386 386
 
387
-		$this->__set( 'paged', $this->args['page'] );
388
-		$this->__unset( 'page' );
387
+		$this->__set('paged', $this->args['page']);
388
+		$this->__unset('page');
389 389
 	}
390 390
 
391 391
 	/**
@@ -398,17 +398,17 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	public function per_page() {
400 400
 
401
-		if ( ! isset( $this->args['number'] ) ) {
401
+		if ( ! isset($this->args['number'])) {
402 402
 			return;
403 403
 		}
404 404
 
405
-		if ( $this->args['number'] == - 1 ) {
406
-			$this->__set( 'nopaging', true );
405
+		if ($this->args['number'] == - 1) {
406
+			$this->__set('nopaging', true);
407 407
 		} else {
408
-			$this->__set( 'posts_per_page', $this->args['number'] );
408
+			$this->__set('posts_per_page', $this->args['number']);
409 409
 		}
410 410
 
411
-		$this->__unset( 'number' );
411
+		$this->__unset('number');
412 412
 	}
413 413
 
414 414
 	/**
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
 	 * @return void
421 421
 	 */
422 422
 	public function month() {
423
-		if ( ! isset( $this->args['month'] ) ) {
423
+		if ( ! isset($this->args['month'])) {
424 424
 			return;
425 425
 		}
426 426
 
427
-		$this->__set( 'monthnum', $this->args['month'] );
428
-		$this->__unset( 'month' );
427
+		$this->__set('monthnum', $this->args['month']);
428
+		$this->__unset('month');
429 429
 	}
430 430
 
431 431
 	/**
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 	 * @return void
438 438
 	 */
439 439
 	public function orderby() {
440
-		switch ( $this->args['orderby'] ) {
440
+		switch ($this->args['orderby']) {
441 441
 			case 'amount':
442
-				$this->__set( 'orderby', 'meta_value_num' );
443
-				$this->__set( 'meta_key', '_give_payment_total' );
442
+				$this->__set('orderby', 'meta_value_num');
443
+				$this->__set('meta_key', '_give_payment_total');
444 444
 				break;
445 445
 
446 446
 			case 'status':
447
-				$this->__set( 'orderby', 'post_status' );
447
+				$this->__set('orderby', 'post_status');
448 448
 				break;
449 449
 
450 450
 			case 'donation_form':
451
-				$this->__set( 'orderby', 'meta_value' );
452
-				$this->__set( 'meta_key', '_give_payment_form_title' );
451
+				$this->__set('orderby', 'meta_value');
452
+				$this->__set('meta_key', '_give_payment_form_title');
453 453
 				break;
454 454
 
455 455
 			default:
456
-				$this->__set( 'orderby', $this->args['orderby'] );
456
+				$this->__set('orderby', $this->args['orderby']);
457 457
 				break;
458 458
 		}
459 459
 	}
@@ -470,19 +470,19 @@  discard block
 block discarded – undo
470 470
 	 *
471 471
 	 * @return mixed
472 472
 	 */
473
-	public function custom_orderby( $order, $query ) {
473
+	public function custom_orderby($order, $query) {
474 474
 
475
-		if ( ! empty( $query->query['post_type'] ) ) {
476
-			$post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] );
475
+		if ( ! empty($query->query['post_type'])) {
476
+			$post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']);
477 477
 
478
-			if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) {
478
+			if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) {
479 479
 				return $order;
480 480
 			}
481 481
 
482 482
 			global $wpdb;
483
-			switch ( $query->query['orderby'] ) {
483
+			switch ($query->query['orderby']) {
484 484
 				case 'post_status':
485
-					$order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] );
485
+					$order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']);
486 486
 					break;
487 487
 			}
488 488
 		}
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 	 * @return void
500 500
 	 */
501 501
 	public function user() {
502
-		if ( is_null( $this->args['user'] ) ) {
502
+		if (is_null($this->args['user'])) {
503 503
 			return;
504 504
 		}
505 505
 
506
-		if ( is_numeric( $this->args['user'] ) ) {
506
+		if (is_numeric($this->args['user'])) {
507 507
 			$user_key = '_give_payment_donor_id';
508 508
 		} else {
509 509
 			$user_key = '_give_payment_donor_email';
@@ -525,16 +525,16 @@  discard block
 block discarded – undo
525 525
 	 * @return  void
526 526
 	 */
527 527
 	public function donor() {
528
-		if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) {
528
+		if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) {
529 529
 			return;
530 530
 		}
531 531
 
532 532
 		$donor_meta_type = Give()->donor_meta->meta_type;
533 533
 
534
-		$this->__set( 'meta_query', array(
534
+		$this->__set('meta_query', array(
535 535
 			'key'   => "_give_payment_{$donor_meta_type}_id",
536 536
 			'value' => (int) $this->args['donor'],
537
-		) );
537
+		));
538 538
 	}
539 539
 
540 540
 	/**
@@ -547,33 +547,33 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	public function search() {
549 549
 
550
-		if ( ! isset( $this->args['s'] ) ) {
550
+		if ( ! isset($this->args['s'])) {
551 551
 			return;
552 552
 		}
553 553
 
554
-		$search = trim( $this->args['s'] );
554
+		$search = trim($this->args['s']);
555 555
 
556
-		if ( empty( $search ) ) {
556
+		if (empty($search)) {
557 557
 			return;
558 558
 		}
559 559
 
560
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
561
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
560
+		$is_email = is_email($search) || strpos($search, '@') !== false;
561
+		$is_user  = strpos($search, strtolower('user:')) !== false;
562 562
 
563
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
563
+		if ( ! empty($this->args['search_in_notes'])) {
564 564
 
565
-			$notes = give_get_payment_notes( 0, $search );
565
+			$notes = give_get_payment_notes(0, $search);
566 566
 
567
-			if ( ! empty( $notes ) ) {
567
+			if ( ! empty($notes)) {
568 568
 
569
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
569
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
570 570
 
571
-				$this->__set( 'post__in', $payment_ids );
571
+				$this->__set('post__in', $payment_ids);
572 572
 			}
573 573
 
574
-			$this->__unset( 's' );
574
+			$this->__unset('s');
575 575
 
576
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
576
+		} elseif ($is_email || strlen($search) == 32) {
577 577
 
578 578
 			$key         = $is_email ? '_give_payment_donor_email' : '_give_payment_purchase_key';
579 579
 			$search_meta = array(
@@ -582,19 +582,19 @@  discard block
 block discarded – undo
582 582
 				'compare' => 'LIKE',
583 583
 			);
584 584
 
585
-			$this->__set( 'meta_query', $search_meta );
586
-			$this->__unset( 's' );
585
+			$this->__set('meta_query', $search_meta);
586
+			$this->__unset('s');
587 587
 
588
-		} elseif ( $is_user ) {
588
+		} elseif ($is_user) {
589 589
 
590 590
 			$search_meta = array(
591 591
 				'key'   => '_give_payment_donor_id',
592
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ),
592
+				'value' => trim(str_replace('user:', '', strtolower($search))),
593 593
 			);
594 594
 
595
-			$this->__set( 'meta_query', $search_meta );
595
+			$this->__set('meta_query', $search_meta);
596 596
 
597
-			if ( give_get_option( 'enable_sequential' ) ) {
597
+			if (give_get_option('enable_sequential')) {
598 598
 
599 599
 				$search_meta = array(
600 600
 					'key'     => '_give_payment_number',
@@ -602,19 +602,19 @@  discard block
 block discarded – undo
602 602
 					'compare' => 'LIKE',
603 603
 				);
604 604
 
605
-				$this->__set( 'meta_query', $search_meta );
605
+				$this->__set('meta_query', $search_meta);
606 606
 
607 607
 				$this->args['meta_query']['relation'] = 'OR';
608 608
 
609 609
 			}
610 610
 
611
-			$this->__unset( 's' );
611
+			$this->__unset('s');
612 612
 
613 613
 		} elseif (
614
-			give_get_option( 'enable_sequential' ) &&
614
+			give_get_option('enable_sequential') &&
615 615
 			(
616
-				false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) ||
617
-				false !== strpos( $search, give_get_option( 'sequential_postfix' ) )
616
+				false !== strpos($search, give_get_option('sequential_prefix')) ||
617
+				false !== strpos($search, give_get_option('sequential_postfix'))
618 618
 			)
619 619
 		) {
620 620
 
@@ -624,29 +624,29 @@  discard block
 block discarded – undo
624 624
 				'compare' => 'LIKE',
625 625
 			);
626 626
 
627
-			$this->__set( 'meta_query', $search_meta );
628
-			$this->__unset( 's' );
627
+			$this->__set('meta_query', $search_meta);
628
+			$this->__unset('s');
629 629
 
630
-		} elseif ( is_numeric( $search ) ) {
630
+		} elseif (is_numeric($search)) {
631 631
 
632
-			$post = get_post( $search );
632
+			$post = get_post($search);
633 633
 
634
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
634
+			if (is_object($post) && $post->post_type == 'give_payment') {
635 635
 
636 636
 				$arr   = array();
637 637
 				$arr[] = $search;
638
-				$this->__set( 'post__in', $arr );
639
-				$this->__unset( 's' );
638
+				$this->__set('post__in', $arr);
639
+				$this->__unset('s');
640 640
 			}
641
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
641
+		} elseif ('#' == substr($search, 0, 1)) {
642 642
 
643
-			$search = str_replace( '#:', '', $search );
644
-			$search = str_replace( '#', '', $search );
645
-			$this->__set( 'give_forms', $search );
646
-			$this->__unset( 's' );
643
+			$search = str_replace('#:', '', $search);
644
+			$search = str_replace('#', '', $search);
645
+			$this->__set('give_forms', $search);
646
+			$this->__unset('s');
647 647
 
648 648
 		} else {
649
-			$this->__set( 's', $search );
649
+			$this->__set('s', $search);
650 650
 
651 651
 		}
652 652
 
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 	 * @return void
662 662
 	 */
663 663
 	public function mode() {
664
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
665
-			$this->__unset( 'mode' );
664
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
665
+			$this->__unset('mode');
666 666
 
667 667
 			return;
668 668
 		}
@@ -684,10 +684,10 @@  discard block
 block discarded – undo
684 684
 	 * @return void
685 685
 	 */
686 686
 	public function children() {
687
-		if ( empty( $this->args['children'] ) ) {
688
-			$this->__set( 'post_parent', 0 );
687
+		if (empty($this->args['children'])) {
688
+			$this->__set('post_parent', 0);
689 689
 		}
690
-		$this->__unset( 'children' );
690
+		$this->__unset('children');
691 691
 	}
692 692
 
693 693
 	/**
@@ -700,13 +700,13 @@  discard block
 block discarded – undo
700 700
 	 */
701 701
 	public function give_forms() {
702 702
 
703
-		if ( empty( $this->args['give_forms'] ) ) {
703
+		if (empty($this->args['give_forms'])) {
704 704
 			return;
705 705
 		}
706 706
 
707 707
 		$compare = '=';
708 708
 
709
-		if ( is_array( $this->args['give_forms'] ) ) {
709
+		if (is_array($this->args['give_forms'])) {
710 710
 			$compare = 'IN';
711 711
 		}
712 712
 
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 			)
720 720
 		);
721 721
 
722
-		$this->__unset( 'give_forms' );
722
+		$this->__unset('give_forms');
723 723
 
724 724
 	}
725 725
 
@@ -733,13 +733,13 @@  discard block
 block discarded – undo
733 733
 	 */
734 734
 	public function gateway_filter() {
735 735
 
736
-		if ( empty( $this->args['gateway'] ) ) {
736
+		if (empty($this->args['gateway'])) {
737 737
 			return;
738 738
 		}
739 739
 
740 740
 		$compare = '=';
741 741
 
742
-		if ( is_array( $this->args['gateway'] ) ) {
742
+		if (is_array($this->args['gateway'])) {
743 743
 			$compare = 'IN';
744 744
 		}
745 745
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 			)
754 754
 		);
755 755
 
756
-		$this->__unset( 'gateway' );
756
+		$this->__unset('gateway');
757 757
 
758 758
 	}
759 759
 
@@ -773,9 +773,9 @@  discard block
 block discarded – undo
773 773
 		global $wpdb;
774 774
 
775 775
 		$where = "WHERE {$wpdb->posts}.post_type = 'give_payment'";
776
-		$where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')";
776
+		$where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')";
777 777
 
778
-		if( is_numeric( $this->args['post_parent'] ) ) {
778
+		if (is_numeric($this->args['post_parent'])) {
779 779
 			$where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}";
780 780
 		}
781 781
 
@@ -784,42 +784,42 @@  discard block
 block discarded – undo
784 784
 		$group_by = '';
785 785
 
786 786
 		// Set group by.
787
-		if ( ! empty( $this->args['group_by'] ) ) {
787
+		if ( ! empty($this->args['group_by'])) {
788 788
 			$group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}";
789 789
 		}
790 790
 
791 791
 		// Set offset.
792 792
 		if (
793
-			empty( $this->args['nopaging'] ) &&
794
-			empty( $this->args['offset'] ) &&
795
-			( ! empty( $this->args['page'] ) && 0 < $this->args['page'] )
793
+			empty($this->args['nopaging']) &&
794
+			empty($this->args['offset']) &&
795
+			( ! empty($this->args['page']) && 0 < $this->args['page'])
796 796
 		) {
797
-			$this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 );
797
+			$this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1);
798 798
 		}
799 799
 
800 800
 		// Set fields.
801 801
 		$fields = "{$wpdb->posts}.*";
802
-		if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) {
803
-			if ( is_string( $this->args['fields'] ) ) {
802
+		if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) {
803
+			if (is_string($this->args['fields'])) {
804 804
 				$fields = "{$wpdb->posts}.{$this->args['fields']}";
805
-			} elseif ( is_array( $this->args['fields'] ) ) {
806
-				$fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] );
805
+			} elseif (is_array($this->args['fields'])) {
806
+				$fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']);
807 807
 			}
808 808
 		}
809 809
 
810 810
 		// Set count.
811
-		if ( ! empty( $this->args['count'] ) ) {
811
+		if ( ! empty($this->args['count'])) {
812 812
 			$fields = "COUNT({$wpdb->posts}.ID)";
813 813
 
814
-			if ( ! empty( $this->args['group_by'] ) ) {
814
+			if ( ! empty($this->args['group_by'])) {
815 815
 				$fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}";
816 816
 			}
817 817
 		}
818 818
 
819 819
 		// Date query.
820
-		if ( ! empty( $this->args['date_query'] ) ) {
821
-			$date_query_obj = new WP_Date_Query( $this->args['date_query'] );
822
-			$where          .= str_replace(
820
+		if ( ! empty($this->args['date_query'])) {
821
+			$date_query_obj = new WP_Date_Query($this->args['date_query']);
822
+			$where .= str_replace(
823 823
 				array(
824 824
 					"\n",
825 825
 					'(   (',
@@ -835,22 +835,22 @@  discard block
 block discarded – undo
835 835
 		}
836 836
 
837 837
 		// Meta query.
838
-		if ( ! empty( $this->args['meta_query'] ) ) {
839
-			$meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] );
840
-			$where          = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}";
841
-			$where          = Give()->payment_meta->__rename_meta_table_name( $where, 'posts_where' );
838
+		if ( ! empty($this->args['meta_query'])) {
839
+			$meta_query_obj = new WP_Meta_Query($this->args['meta_query']);
840
+			$where          = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}";
841
+			$where          = Give()->payment_meta->__rename_meta_table_name($where, 'posts_where');
842 842
 		}
843 843
 
844 844
 		// Set sql query.
845 845
 		$sql = $wpdb->prepare(
846 846
 			"SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;",
847
-			absint( $this->args['offset'] ),
848
-			( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 99999999999 )
847
+			absint($this->args['offset']),
848
+			(empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 99999999999)
849 849
 		);
850 850
 
851 851
 		// $where, $orderby and order already prepared query they can generate notice if you re prepare them in above.
852 852
 		// WordPress consider LIKE condition as placeholder if start with s,f, or d.
853
-		$sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql );
853
+		$sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql);
854 854
 
855 855
 		return $sql;
856 856
 	}
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.0
567 567
  *
568
- * @return int $earnings Earnings
568
+ * @return double $earnings Earnings
569 569
  */
570 570
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @since 1.0
883 883
  *
884
- * @return int $form_id Form ID.
884
+ * @return string $form_id Form ID.
885 885
  */
886 886
 function give_get_payment_form_id( $payment_id ) {
887 887
 	$payment = new Give_Payment( $payment_id );
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
  *
1730 1730
  * Retrieves the form title and appends the level name if present.
1731 1731
  *
1732
- * @param int|Give_Payment $donation Donation Data Object.
1732
+ * @param Give_Payment $donation Donation Data Object.
1733 1733
  * @param array            $args     a. only_level = If set to true will only return the level name if multi-level enabled.
1734 1734
  *                                   b. separator  = The separator between the Form Title and the Donation Level.
1735 1735
  *
Please login to merge, or discard this patch.
Spacing   +380 added lines, -382 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
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array $payments Payments retrieved from the database
46 46
  */
47
-function give_get_payments( $args = array() ) {
47
+function give_get_payments($args = array()) {
48 48
 
49 49
 	// Fallback to post objects to ensure backwards compatibility.
50
-	if ( ! isset( $args['output'] ) ) {
50
+	if ( ! isset($args['output'])) {
51 51
 		$args['output'] = 'posts';
52 52
 	}
53 53
 
54
-	$args     = apply_filters( 'give_get_payments_args', $args );
55
-	$payments = new Give_Payments_Query( $args );
54
+	$args     = apply_filters('give_get_payments_args', $args);
55
+	$payments = new Give_Payments_Query($args);
56 56
 
57 57
 	return $payments->get_payments();
58 58
 }
@@ -67,48 +67,48 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed
69 69
  */
70
-function give_get_payment_by( $field = '', $value = '' ) {
70
+function give_get_payment_by($field = '', $value = '') {
71 71
 
72
-	if ( empty( $field ) || empty( $value ) ) {
72
+	if (empty($field) || empty($value)) {
73 73
 		return false;
74 74
 	}
75 75
 
76
-	switch ( strtolower( $field ) ) {
76
+	switch (strtolower($field)) {
77 77
 
78 78
 		case 'id':
79
-			$payment = new Give_Payment( $value );
79
+			$payment = new Give_Payment($value);
80 80
 			$id      = $payment->ID;
81 81
 
82
-			if ( empty( $id ) ) {
82
+			if (empty($id)) {
83 83
 				return false;
84 84
 			}
85 85
 
86 86
 			break;
87 87
 
88 88
 		case 'key':
89
-			$payment = give_get_payments( array(
89
+			$payment = give_get_payments(array(
90 90
 				'meta_key'       => '_give_payment_purchase_key',
91 91
 				'meta_value'     => $value,
92 92
 				'posts_per_page' => 1,
93 93
 				'fields'         => 'ids',
94
-			) );
94
+			));
95 95
 
96
-			if ( $payment ) {
97
-				$payment = new Give_Payment( $payment[0] );
96
+			if ($payment) {
97
+				$payment = new Give_Payment($payment[0]);
98 98
 			}
99 99
 
100 100
 			break;
101 101
 
102 102
 		case 'payment_number':
103
-			$payment = give_get_payments( array(
103
+			$payment = give_get_payments(array(
104 104
 				'meta_key'       => '_give_payment_number',
105 105
 				'meta_value'     => $value,
106 106
 				'posts_per_page' => 1,
107 107
 				'fields'         => 'ids',
108
-			) );
108
+			));
109 109
 
110
-			if ( $payment ) {
111
-				$payment = new Give_Payment( $payment[0] );
110
+			if ($payment) {
111
+				$payment = new Give_Payment($payment[0]);
112 112
 			}
113 113
 
114 114
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			return false;
118 118
 	}// End switch().
119 119
 
120
-	if ( $payment ) {
120
+	if ($payment) {
121 121
 		return $payment;
122 122
 	}
123 123
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return int|bool Payment ID if payment is inserted, false otherwise.
135 135
  */
136
-function give_insert_payment( $payment_data = array() ) {
136
+function give_insert_payment($payment_data = array()) {
137 137
 
138
-	if ( empty( $payment_data ) ) {
138
+	if (empty($payment_data)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $payment_data Arguments passed.
148 148
 	 */
149
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
149
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
150 150
 
151 151
 	$payment    = new Give_Payment();
152
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
153
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
154
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
155
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
156
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
152
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
153
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
154
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
155
+	$price_id   = give_get_payment_meta_price_id($payment_data);
156
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
157 157
 
158 158
 	// Set properties.
159 159
 	$payment->total          = $payment_data['price'];
160
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
161
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
160
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
161
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
162 162
 	$payment->user_info      = $payment_data['user_info'];
163 163
 	$payment->gateway        = $gateway;
164 164
 	$payment->form_title     = $form_title;
165 165
 	$payment->form_id        = $form_id;
166 166
 	$payment->price_id       = $price_id;
167
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
167
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
168 168
 	$payment->user_id        = $payment_data['user_info']['id'];
169 169
 	$payment->email          = $payment_data['user_email'];
170 170
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	$payment->email          = $payment_data['user_info']['email'];
173 173
 	$payment->ip             = give_get_ip();
174 174
 	$payment->key            = $payment_data['purchase_key'];
175
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
176
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
175
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
176
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
177 177
 
178 178
 	// Add the donation.
179 179
 	$args = array(
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 		'price_id' => $payment->price_id,
182 182
 	);
183 183
 
184
-	$payment->add_donation( $payment->form_id, $args );
184
+	$payment->add_donation($payment->form_id, $args);
185 185
 
186 186
 
187 187
 	// Set date if present.
188
-	if ( isset( $payment_data['post_date'] ) ) {
188
+	if (isset($payment_data['post_date'])) {
189 189
 		$payment->date = $payment_data['post_date'];
190 190
 	}
191 191
 
192 192
 	// Handle sequential payments.
193
-	if ( give_get_option( 'enable_sequential' ) ) {
193
+	if (give_get_option('enable_sequential')) {
194 194
 		$number          = give_get_next_payment_number();
195
-		$payment->number = give_format_payment_number( $number );
196
-		update_option( 'give_last_payment_number', $number );
195
+		$payment->number = give_format_payment_number($number);
196
+		update_option('give_last_payment_number', $number);
197 197
 	}
198 198
 
199 199
 	// Save payment.
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int   $payment_id   The payment ID.
208 208
 	 * @param array $payment_data Arguments passed.
209 209
 	 */
210
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
210
+	do_action('give_insert_payment', $payment->ID, $payment_data);
211 211
 
212 212
 	// Return payment ID upon success.
213
-	if ( ! empty( $payment->ID ) ) {
213
+	if ( ! empty($payment->ID)) {
214 214
 		return $payment->ID;
215 215
 	}
216 216
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool|int
228 228
  */
229
-function give_create_payment( $payment_data ) {
229
+function give_create_payment($payment_data) {
230 230
 
231
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
232
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
231
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
232
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
233 233
 
234 234
 	// Collect payment data.
235 235
 	$insert_payment_data = array(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		'date'            => $payment_data['date'],
241 241
 		'user_email'      => $payment_data['user_email'],
242 242
 		'purchase_key'    => $payment_data['purchase_key'],
243
-		'currency'        => give_get_currency( $form_id, $payment_data ),
243
+		'currency'        => give_get_currency($form_id, $payment_data),
244 244
 		'user_info'       => $payment_data['user_info'],
245 245
 		'status'          => 'pending',
246 246
 		'gateway'         => 'paypal',
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param array $insert_payment_data
255 255
 	 */
256
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
256
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
257 257
 
258 258
 	// Record the pending payment.
259
-	return give_insert_payment( $insert_payment_data );
259
+	return give_insert_payment($insert_payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return bool
271 271
  */
272
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
272
+function give_update_payment_status($payment_id, $new_status = 'publish') {
273 273
 
274 274
 	$updated = false;
275
-	$payment = new Give_Payment( $payment_id );
275
+	$payment = new Give_Payment($payment_id);
276 276
 
277
-	if ( $payment && $payment->ID > 0 ) {
277
+	if ($payment && $payment->ID > 0) {
278 278
 
279 279
 		$payment->status = $new_status;
280 280
 		$updated         = $payment->save();
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
299
-	$payment = new Give_Payment( $payment_id );
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299
+	$payment = new Give_Payment($payment_id);
300 300
 
301 301
 	// Bailout.
302
-	if ( ! $payment->ID ) {
302
+	if ( ! $payment->ID) {
303 303
 		return;
304 304
 	}
305 305
 
306
-	$amount   = give_donation_amount( $payment_id );
306
+	$amount   = give_donation_amount($payment_id);
307 307
 	$status   = $payment->post_status;
308
-	$donor_id = give_get_payment_donor_id( $payment_id );
309
-	$donor    = new Give_Donor( $donor_id );
308
+	$donor_id = give_get_payment_donor_id($payment_id);
309
+	$donor    = new Give_Donor($donor_id);
310 310
 
311 311
 	// Only undo donations that aren't these statuses.
312
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
312
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
313 313
 		'pending',
314 314
 		'cancelled',
315
-	) );
315
+	));
316 316
 
317
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
318
-		give_undo_donation( $payment_id );
317
+	if ( ! in_array($status, $dont_undo_statuses)) {
318
+		give_undo_donation($payment_id);
319 319
 	}
320 320
 
321 321
 	// Only undo donations that aren't these statuses.
322
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
322
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
323 323
 
324
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
324
+	if (in_array($status, $status_to_decrease_stats)) {
325 325
 
326 326
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
327
-		give_decrease_total_earnings( $amount );
327
+		give_decrease_total_earnings($amount);
328 328
 
329 329
 		// @todo: Refresh only range related stat cache
330 330
 		give_delete_donation_stats();
331 331
 
332
-		if ( $donor->id && $update_donor ) {
332
+		if ($donor->id && $update_donor) {
333 333
 
334 334
 			// Decrement the stats for the donor.
335 335
 			$donor->decrease_donation_count();
336
-			$donor->decrease_value( $amount );
336
+			$donor->decrease_value($amount);
337 337
 
338 338
 		}
339 339
 	}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @since 1.0
347 347
 	 */
348
-	do_action( 'give_payment_delete', $payment_id );
348
+	do_action('give_payment_delete', $payment_id);
349 349
 
350
-	if ( $donor->id && $update_donor ) {
350
+	if ($donor->id && $update_donor) {
351 351
 		// Remove the payment ID from the donor.
352
-		$donor->remove_payment( $payment_id );
352
+		$donor->remove_payment($payment_id);
353 353
 	}
354 354
 
355 355
 	// Remove the payment.
356
-	wp_delete_post( $payment_id, true );
356
+	wp_delete_post($payment_id, true);
357 357
 
358 358
 	// Remove related sale log entries.
359
-	Give()->logs->delete_logs( $payment_id );
359
+	Give()->logs->delete_logs($payment_id);
360 360
 
361 361
 	/**
362 362
 	 * Fires after payment deleted.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @since 1.0
367 367
 	 */
368
-	do_action( 'give_payment_deleted', $payment_id );
368
+	do_action('give_payment_deleted', $payment_id);
369 369
 }
370 370
 
371 371
 /**
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @return void
382 382
  */
383
-function give_undo_donation( $payment_id ) {
383
+function give_undo_donation($payment_id) {
384 384
 
385
-	$payment = new Give_Payment( $payment_id );
385
+	$payment = new Give_Payment($payment_id);
386 386
 
387
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
388
-	if ( true === $maybe_decrease_earnings ) {
387
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
388
+	if (true === $maybe_decrease_earnings) {
389 389
 		// Decrease earnings.
390
-		give_decrease_form_earnings( $payment->form_id, $payment->total );
390
+		give_decrease_form_earnings($payment->form_id, $payment->total);
391 391
 	}
392 392
 
393
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
394
-	if ( true === $maybe_decrease_donations ) {
393
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
394
+	if (true === $maybe_decrease_donations) {
395 395
 		// Decrease donation count.
396
-		give_decrease_donation_count( $payment->form_id );
396
+		give_decrease_donation_count($payment->form_id);
397 397
 	}
398 398
 
399 399
 }
@@ -410,21 +410,21 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return object $stats Contains the number of payments per payment status.
412 412
  */
413
-function give_count_payments( $args = array() ) {
413
+function give_count_payments($args = array()) {
414 414
 	// Backward compatibility.
415
-	if ( ! empty( $args['start-date'] ) ) {
415
+	if ( ! empty($args['start-date'])) {
416 416
 		$args['start_date'] = $args['start-date'];
417
-		unset( $args['start-date'] );
417
+		unset($args['start-date']);
418 418
 	}
419 419
 
420
-	if ( ! empty( $args['end-date'] ) ) {
420
+	if ( ! empty($args['end-date'])) {
421 421
 		$args['end_date'] = $args['end-date'];
422
-		unset( $args['end-date'] );
422
+		unset($args['end-date']);
423 423
 	}
424 424
 
425
-	if ( ! empty( $args['form_id'] ) ) {
425
+	if ( ! empty($args['form_id'])) {
426 426
 		$args['give_forms'] = $args['form_id'];
427
-		unset( $args['form_id'] );
427
+		unset($args['form_id']);
428 428
 	}
429 429
 
430 430
 	// Extract all donations
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	$args['group_by']    = 'post_status';
433 433
 	$args['count']       = 'true';
434 434
 
435
-	$donations_obj   = new Give_Payments_Query( $args );
435
+	$donations_obj   = new Give_Payments_Query($args);
436 436
 	$donations_count = $donations_obj->get_payment_by_group();
437 437
 
438 438
 	/**
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @since 1.0
442 442
 	 */
443
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
443
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
444 444
 }
445 445
 
446 446
 
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool $exists True if payment exists, false otherwise.
455 455
  */
456
-function give_check_for_existing_payment( $payment_id ) {
456
+function give_check_for_existing_payment($payment_id) {
457 457
 	$exists  = false;
458
-	$payment = new Give_Payment( $payment_id );
458
+	$payment = new Give_Payment($payment_id);
459 459
 
460
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
460
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
461 461
 		$exists = true;
462 462
 	}
463 463
 
@@ -475,41 +475,41 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return bool|mixed True if payment status exists, false otherwise.
477 477
  */
478
-function give_get_payment_status( $payment, $return_label = false ) {
478
+function give_get_payment_status($payment, $return_label = false) {
479 479
 
480
-	if ( is_numeric( $payment ) ) {
480
+	if (is_numeric($payment)) {
481 481
 
482
-		$payment = new Give_Payment( $payment );
482
+		$payment = new Give_Payment($payment);
483 483
 
484
-		if ( ! $payment->ID > 0 ) {
484
+		if ( ! $payment->ID > 0) {
485 485
 			return false;
486 486
 		}
487 487
 
488 488
 	}
489 489
 
490
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
490
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
491 491
 		return false;
492 492
 	}
493 493
 
494 494
 	$statuses = give_get_payment_statuses();
495 495
 
496
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
496
+	if ( ! is_array($statuses) || empty($statuses)) {
497 497
 		return false;
498 498
 	}
499 499
 
500 500
 	// Get payment object if not already given.
501
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
501
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
502 502
 
503
-	if ( array_key_exists( $payment->status, $statuses ) ) {
504
-		if ( true === $return_label ) {
503
+	if (array_key_exists($payment->status, $statuses)) {
504
+		if (true === $return_label) {
505 505
 			// Return translated status label.
506
-			return $statuses[ $payment->status ];
506
+			return $statuses[$payment->status];
507 507
 		} else {
508 508
 			// Account that our 'publish' status is labeled 'Complete'
509 509
 			$post_status = 'publish' === $payment->status ? 'Complete' : $payment->post_status;
510 510
 
511 511
 			// Make sure we're matching cases, since they matter
512
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
512
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
513 513
 		}
514 514
 	}
515 515
 
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
  */
526 526
 function give_get_payment_statuses() {
527 527
 	$payment_statuses = array(
528
-		'pending'     => __( 'Pending', 'give' ),
529
-		'publish'     => __( 'Complete', 'give' ),
530
-		'refunded'    => __( 'Refunded', 'give' ),
531
-		'failed'      => __( 'Failed', 'give' ),
532
-		'cancelled'   => __( 'Cancelled', 'give' ),
533
-		'abandoned'   => __( 'Abandoned', 'give' ),
534
-		'preapproval' => __( 'Pre-Approved', 'give' ),
535
-		'processing'  => __( 'Processing', 'give' ),
536
-		'revoked'     => __( 'Revoked', 'give' ),
528
+		'pending'     => __('Pending', 'give'),
529
+		'publish'     => __('Complete', 'give'),
530
+		'refunded'    => __('Refunded', 'give'),
531
+		'failed'      => __('Failed', 'give'),
532
+		'cancelled'   => __('Cancelled', 'give'),
533
+		'abandoned'   => __('Abandoned', 'give'),
534
+		'preapproval' => __('Pre-Approved', 'give'),
535
+		'processing'  => __('Processing', 'give'),
536
+		'revoked'     => __('Revoked', 'give'),
537 537
 	);
538 538
 
539
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
539
+	return apply_filters('give_payment_statuses', $payment_statuses);
540 540
 }
541 541
 
542 542
 /**
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
  * @return array $payment_status All the available payment statuses.
550 550
  */
551 551
 function give_get_payment_status_keys() {
552
-	$statuses = array_keys( give_get_payment_statuses() );
553
-	asort( $statuses );
552
+	$statuses = array_keys(give_get_payment_statuses());
553
+	asort($statuses);
554 554
 
555
-	return array_values( $statuses );
555
+	return array_values($statuses);
556 556
 }
557 557
 
558 558
 /**
@@ -567,44 +567,44 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return int $earnings Earnings
569 569
  */
570
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
570
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
572 572
 
573 573
 	global $wpdb;
574
-	$meta_table = __give_v20_bc_table_details( 'payment' );
574
+	$meta_table = __give_v20_bc_table_details('payment');
575 575
 
576 576
 	$args = array(
577 577
 		'post_type'              => 'give_payment',
578 578
 		'nopaging'               => true,
579 579
 		'year'                   => $year,
580 580
 		'monthnum'               => $month_num,
581
-		'post_status'            => array( 'publish' ),
581
+		'post_status'            => array('publish'),
582 582
 		'fields'                 => 'ids',
583 583
 		'update_post_term_cache' => false,
584 584
 	);
585
-	if ( ! empty( $day ) ) {
585
+	if ( ! empty($day)) {
586 586
 		$args['day'] = $day;
587 587
 	}
588 588
 
589
-	if ( isset( $hour ) ) {
589
+	if (isset($hour)) {
590 590
 		$args['hour'] = $hour;
591 591
 	}
592 592
 
593
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
594
-	$key  = Give_Cache::get_key( 'give_stats', $args );
593
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
594
+	$key  = Give_Cache::get_key('give_stats', $args);
595 595
 
596
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
596
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
597 597
 		$earnings = false;
598 598
 	} else {
599
-		$earnings = Give_Cache::get( $key );
599
+		$earnings = Give_Cache::get($key);
600 600
 	}
601 601
 
602
-	if ( false === $earnings ) {
603
-		$donations = get_posts( $args );
602
+	if (false === $earnings) {
603
+		$donations = get_posts($args);
604 604
 		$earnings  = 0;
605
-		if ( $donations ) {
606
-			$donations      = implode( ',', $donations );
607
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
605
+		if ($donations) {
606
+			$donations      = implode(',', $donations);
607
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
608 608
 
609 609
 			/**
610 610
 			 * Filter The earnings by dates.
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 			 * @param array $donations      Donations lists.
616 616
 			 * @param array $args           Donation query args.
617 617
 			 */
618
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
618
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
619 619
 		}
620 620
 		// Cache the results for one hour.
621
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
621
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
622 622
 	}
623 623
 
624
-	return round( $earnings, 2 );
624
+	return round($earnings, 2);
625 625
 }
626 626
 
627 627
 /**
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
  *
637 637
  * @return int $count Sales
638 638
  */
639
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
639
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
640 640
 
641 641
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
642 642
 	$args = array(
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 		'nopaging'               => true,
645 645
 		'year'                   => $year,
646 646
 		'fields'                 => 'ids',
647
-		'post_status'            => array( 'publish' ),
647
+		'post_status'            => array('publish'),
648 648
 		'update_post_meta_cache' => false,
649 649
 		'update_post_term_cache' => false,
650 650
 	);
651 651
 
652
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
652
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
653 653
 
654
-	if ( false === $show_free ) {
654
+	if (false === $show_free) {
655 655
 		$args['meta_query'] = array(
656 656
 			array(
657 657
 				'key'     => '_give_payment_total',
@@ -662,33 +662,33 @@  discard block
 block discarded – undo
662 662
 		);
663 663
 	}
664 664
 
665
-	if ( ! empty( $month_num ) ) {
665
+	if ( ! empty($month_num)) {
666 666
 		$args['monthnum'] = $month_num;
667 667
 	}
668 668
 
669
-	if ( ! empty( $day ) ) {
669
+	if ( ! empty($day)) {
670 670
 		$args['day'] = $day;
671 671
 	}
672 672
 
673
-	if ( isset( $hour ) ) {
673
+	if (isset($hour)) {
674 674
 		$args['hour'] = $hour;
675 675
 	}
676 676
 
677
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
677
+	$args = apply_filters('give_get_sales_by_date_args', $args);
678 678
 
679
-	$key = Give_Cache::get_key( 'give_stats', $args );
679
+	$key = Give_Cache::get_key('give_stats', $args);
680 680
 
681
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
681
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
682 682
 		$count = false;
683 683
 	} else {
684
-		$count = Give_Cache::get( $key );
684
+		$count = Give_Cache::get($key);
685 685
 	}
686 686
 
687
-	if ( false === $count ) {
688
-		$donations = new WP_Query( $args );
687
+	if (false === $count) {
688
+		$donations = new WP_Query($args);
689 689
 		$count     = (int) $donations->post_count;
690 690
 		// Cache the results for one hour.
691
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
691
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
692 692
 	}
693 693
 
694 694
 	return $count;
@@ -703,19 +703,19 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return bool $ret True if complete, false otherwise.
705 705
  */
706
-function give_is_payment_complete( $payment_id ) {
707
-	$payment = new Give_Payment( $payment_id );
706
+function give_is_payment_complete($payment_id) {
707
+	$payment = new Give_Payment($payment_id);
708 708
 
709 709
 	$ret = false;
710 710
 
711
-	if ( $payment->ID > 0 ) {
711
+	if ($payment->ID > 0) {
712 712
 
713
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
713
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
714 714
 			$ret = true;
715 715
 		}
716 716
 	}
717 717
 
718
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
718
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
719 719
 }
720 720
 
721 721
 /**
@@ -741,50 +741,50 @@  discard block
 block discarded – undo
741 741
  *
742 742
  * @return float $total Total earnings.
743 743
  */
744
-function give_get_total_earnings( $recalculate = false ) {
744
+function give_get_total_earnings($recalculate = false) {
745 745
 
746
-	$total      = get_option( 'give_earnings_total', 0 );
747
-	$meta_table = __give_v20_bc_table_details( 'payment' );
746
+	$total      = get_option('give_earnings_total', 0);
747
+	$meta_table = __give_v20_bc_table_details('payment');
748 748
 
749 749
 	// Calculate total earnings.
750
-	if ( ! $total || $recalculate ) {
750
+	if ( ! $total || $recalculate) {
751 751
 		global $wpdb;
752 752
 
753 753
 		$total = (float) 0;
754 754
 
755
-		$args = apply_filters( 'give_get_total_earnings_args', array(
755
+		$args = apply_filters('give_get_total_earnings_args', array(
756 756
 			'offset' => 0,
757
-			'number' => - 1,
758
-			'status' => array( 'publish' ),
757
+			'number' => -1,
758
+			'status' => array('publish'),
759 759
 			'fields' => 'ids',
760
-		) );
760
+		));
761 761
 
762
-		$payments = give_get_payments( $args );
763
-		if ( $payments ) {
762
+		$payments = give_get_payments($args);
763
+		if ($payments) {
764 764
 
765 765
 			/**
766 766
 			 * If performing a donation, we need to skip the very last payment in the database,
767 767
 			 * since it calls give_increase_total_earnings() on completion,
768 768
 			 * which results in duplicated earnings for the very first donation.
769 769
 			 */
770
-			if ( did_action( 'give_update_payment_status' ) ) {
771
-				array_pop( $payments );
770
+			if (did_action('give_update_payment_status')) {
771
+				array_pop($payments);
772 772
 			}
773 773
 
774
-			if ( ! empty( $payments ) ) {
775
-				$payments = implode( ',', $payments );
776
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})" );
774
+			if ( ! empty($payments)) {
775
+				$payments = implode(',', $payments);
776
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})");
777 777
 			}
778 778
 		}
779 779
 
780
-		update_option( 'give_earnings_total', $total, 'no' );
780
+		update_option('give_earnings_total', $total, 'no');
781 781
 	}
782 782
 
783
-	if ( $total < 0 ) {
783
+	if ($total < 0) {
784 784
 		$total = 0; // Don't ever show negative earnings.
785 785
 	}
786 786
 
787
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
787
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
788 788
 }
789 789
 
790 790
 /**
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
  *
797 797
  * @return float $total Total earnings.
798 798
  */
799
-function give_increase_total_earnings( $amount = 0 ) {
799
+function give_increase_total_earnings($amount = 0) {
800 800
 	$total = give_get_total_earnings();
801 801
 	$total += $amount;
802
-	update_option( 'give_earnings_total', $total );
802
+	update_option('give_earnings_total', $total);
803 803
 
804 804
 	return $total;
805 805
 }
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
  *
814 814
  * @return float $total Total earnings.
815 815
  */
816
-function give_decrease_total_earnings( $amount = 0 ) {
816
+function give_decrease_total_earnings($amount = 0) {
817 817
 	$total = give_get_total_earnings();
818 818
 	$total -= $amount;
819
-	if ( $total < 0 ) {
819
+	if ($total < 0) {
820 820
 		$total = 0;
821 821
 	}
822
-	update_option( 'give_earnings_total', $total );
822
+	update_option('give_earnings_total', $total);
823 823
 
824 824
 	return $total;
825 825
 }
@@ -835,10 +835,10 @@  discard block
 block discarded – undo
835 835
  *
836 836
  * @return mixed $meta Payment Meta.
837 837
  */
838
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
839
-	$payment = new Give_Payment( $payment_id );
838
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
839
+	$payment = new Give_Payment($payment_id);
840 840
 
841
-	return $payment->get_meta( $meta_key, $single );
841
+	return $payment->get_meta($meta_key, $single);
842 842
 }
843 843
 
844 844
 /**
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return mixed Meta ID if successful, false if unsuccessful.
853 853
  */
854
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
855
-	$payment = new Give_Payment( $payment_id );
854
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
855
+	$payment = new Give_Payment($payment_id);
856 856
 
857
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
857
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
858 858
 }
859 859
 
860 860
 /**
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return array $user_info User Info Meta Values.
868 868
  */
869
-function give_get_payment_meta_user_info( $payment_id ) {
870
-	$payment = new Give_Payment( $payment_id );
869
+function give_get_payment_meta_user_info($payment_id) {
870
+	$payment = new Give_Payment($payment_id);
871 871
 
872 872
 	return $payment->user_info;
873 873
 }
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return int $form_id Form ID.
885 885
  */
886
-function give_get_payment_form_id( $payment_id ) {
887
-	$payment = new Give_Payment( $payment_id );
886
+function give_get_payment_form_id($payment_id) {
887
+	$payment = new Give_Payment($payment_id);
888 888
 
889 889
 	return $payment->form_id;
890 890
 }
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return string $email User email.
900 900
  */
901
-function give_get_payment_user_email( $payment_id ) {
902
-	$payment = new Give_Payment( $payment_id );
901
+function give_get_payment_user_email($payment_id) {
902
+	$payment = new Give_Payment($payment_id);
903 903
 
904 904
 	return $payment->email;
905 905
 }
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
  *
914 914
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
915 915
  */
916
-function give_is_guest_payment( $payment_id ) {
917
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
918
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
916
+function give_is_guest_payment($payment_id) {
917
+	$payment_user_id  = give_get_payment_user_id($payment_id);
918
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
919 919
 
920
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
920
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
921 921
 }
922 922
 
923 923
 /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
  *
930 930
  * @return int $user_id User ID.
931 931
  */
932
-function give_get_payment_user_id( $payment_id ) {
933
-	$payment = new Give_Payment( $payment_id );
932
+function give_get_payment_user_id($payment_id) {
933
+	$payment = new Give_Payment($payment_id);
934 934
 
935 935
 	return $payment->user_id;
936 936
 }
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return int $payment->customer_id Donor ID.
946 946
  */
947
-function give_get_payment_donor_id( $payment_id ) {
948
-	$payment = new Give_Payment( $payment_id );
947
+function give_get_payment_donor_id($payment_id) {
948
+	$payment = new Give_Payment($payment_id);
949 949
 
950 950
 	return $payment->customer_id;
951 951
 }
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @return string $ip User IP.
961 961
  */
962
-function give_get_payment_user_ip( $payment_id ) {
963
-	$payment = new Give_Payment( $payment_id );
962
+function give_get_payment_user_ip($payment_id) {
963
+	$payment = new Give_Payment($payment_id);
964 964
 
965 965
 	return $payment->ip;
966 966
 }
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
  *
975 975
  * @return string $date The date the payment was completed.
976 976
  */
977
-function give_get_payment_completed_date( $payment_id = 0 ) {
978
-	$payment = new Give_Payment( $payment_id );
977
+function give_get_payment_completed_date($payment_id = 0) {
978
+	$payment = new Give_Payment($payment_id);
979 979
 
980 980
 	return $payment->completed_date;
981 981
 }
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
  *
990 990
  * @return string $gateway Gateway.
991 991
  */
992
-function give_get_payment_gateway( $payment_id ) {
993
-	$payment = new Give_Payment( $payment_id );
992
+function give_get_payment_gateway($payment_id) {
993
+	$payment = new Give_Payment($payment_id);
994 994
 
995 995
 	return $payment->gateway;
996 996
 }
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
  *
1005 1005
  * @return string $currency The currency code.
1006 1006
  */
1007
-function give_get_payment_currency_code( $payment_id = 0 ) {
1008
-	$payment = new Give_Payment( $payment_id );
1007
+function give_get_payment_currency_code($payment_id = 0) {
1008
+	$payment = new Give_Payment($payment_id);
1009 1009
 
1010 1010
 	return $payment->currency;
1011 1011
 }
@@ -1019,10 +1019,10 @@  discard block
 block discarded – undo
1019 1019
  *
1020 1020
  * @return string $currency The currency name.
1021 1021
  */
1022
-function give_get_payment_currency( $payment_id = 0 ) {
1023
-	$currency = give_get_payment_currency_code( $payment_id );
1022
+function give_get_payment_currency($payment_id = 0) {
1023
+	$currency = give_get_payment_currency_code($payment_id);
1024 1024
 
1025
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1025
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
  *
1035 1035
  * @return string $key Donation key.
1036 1036
  */
1037
-function give_get_payment_key( $payment_id = 0 ) {
1038
-	$payment = new Give_Payment( $payment_id );
1037
+function give_get_payment_key($payment_id = 0) {
1038
+	$payment = new Give_Payment($payment_id);
1039 1039
 
1040 1040
 	return $payment->key;
1041 1041
 }
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return string $number Payment order number.
1053 1053
  */
1054
-function give_get_payment_number( $payment_id = 0 ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_number($payment_id = 0) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->number;
1058 1058
 }
@@ -1066,23 +1066,23 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return string      The formatted payment number.
1068 1068
  */
1069
-function give_format_payment_number( $number ) {
1069
+function give_format_payment_number($number) {
1070 1070
 
1071
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1071
+	if ( ! give_get_option('enable_sequential')) {
1072 1072
 		return $number;
1073 1073
 	}
1074 1074
 
1075
-	if ( ! is_numeric( $number ) ) {
1075
+	if ( ! is_numeric($number)) {
1076 1076
 		return $number;
1077 1077
 	}
1078 1078
 
1079
-	$prefix  = give_get_option( 'sequential_prefix' );
1080
-	$number  = absint( $number );
1081
-	$postfix = give_get_option( 'sequential_postfix' );
1079
+	$prefix  = give_get_option('sequential_prefix');
1080
+	$number  = absint($number);
1081
+	$postfix = give_get_option('sequential_postfix');
1082 1082
 
1083
-	$formatted_number = $prefix . $number . $postfix;
1083
+	$formatted_number = $prefix.$number.$postfix;
1084 1084
 
1085
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1085
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1086 1086
 }
1087 1087
 
1088 1088
 /**
@@ -1096,17 +1096,17 @@  discard block
 block discarded – undo
1096 1096
  */
1097 1097
 function give_get_next_payment_number() {
1098 1098
 
1099
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1099
+	if ( ! give_get_option('enable_sequential')) {
1100 1100
 		return false;
1101 1101
 	}
1102 1102
 
1103
-	$number           = get_option( 'give_last_payment_number' );
1104
-	$start            = give_get_option( 'sequential_start', 1 );
1103
+	$number           = get_option('give_last_payment_number');
1104
+	$start            = give_get_option('sequential_start', 1);
1105 1105
 	$increment_number = true;
1106 1106
 
1107
-	if ( false !== $number ) {
1107
+	if (false !== $number) {
1108 1108
 
1109
-		if ( empty( $number ) ) {
1109
+		if (empty($number)) {
1110 1110
 
1111 1111
 			$number           = $start;
1112 1112
 			$increment_number = false;
@@ -1115,24 +1115,24 @@  discard block
 block discarded – undo
1115 1115
 	} else {
1116 1116
 
1117 1117
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1118
-		$payments     = new Give_Payments_Query( array(
1118
+		$payments = new Give_Payments_Query(array(
1119 1119
 			'number'  => 1,
1120 1120
 			'order'   => 'DESC',
1121 1121
 			'orderby' => 'ID',
1122 1122
 			'output'  => 'posts',
1123 1123
 			'fields'  => 'ids',
1124
-		) );
1124
+		));
1125 1125
 		$last_payment = $payments->get_payments();
1126 1126
 
1127
-		if ( ! empty( $last_payment ) ) {
1127
+		if ( ! empty($last_payment)) {
1128 1128
 
1129
-			$number = give_get_payment_number( $last_payment[0] );
1129
+			$number = give_get_payment_number($last_payment[0]);
1130 1130
 
1131 1131
 		}
1132 1132
 
1133
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1133
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1134 1134
 
1135
-			$number = give_remove_payment_prefix_postfix( $number );
1135
+			$number = give_remove_payment_prefix_postfix($number);
1136 1136
 
1137 1137
 		} else {
1138 1138
 
@@ -1141,13 +1141,13 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 	}// End if().
1143 1143
 
1144
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1144
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1145 1145
 
1146
-	if ( $increment_number ) {
1147
-		$number ++;
1146
+	if ($increment_number) {
1147
+		$number++;
1148 1148
 	}
1149 1149
 
1150
-	return apply_filters( 'give_get_next_payment_number', $number );
1150
+	return apply_filters('give_get_next_payment_number', $number);
1151 1151
 }
1152 1152
 
1153 1153
 /**
@@ -1159,25 +1159,25 @@  discard block
 block discarded – undo
1159 1159
  *
1160 1160
  * @return string The new Payment number without prefix and postfix.
1161 1161
  */
1162
-function give_remove_payment_prefix_postfix( $number ) {
1162
+function give_remove_payment_prefix_postfix($number) {
1163 1163
 
1164
-	$prefix  = give_get_option( 'sequential_prefix' );
1165
-	$postfix = give_get_option( 'sequential_postfix' );
1164
+	$prefix  = give_get_option('sequential_prefix');
1165
+	$postfix = give_get_option('sequential_postfix');
1166 1166
 
1167 1167
 	// Remove prefix.
1168
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1168
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1169 1169
 
1170 1170
 	// Remove the postfix.
1171
-	$length      = strlen( $number );
1172
-	$postfix_pos = strrpos( $number, $postfix );
1173
-	if ( false !== $postfix_pos ) {
1174
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1171
+	$length      = strlen($number);
1172
+	$postfix_pos = strrpos($number, $postfix);
1173
+	if (false !== $postfix_pos) {
1174
+		$number = substr_replace($number, '', $postfix_pos, $length);
1175 1175
 	}
1176 1176
 
1177 1177
 	// Ensure it's a whole number.
1178
-	$number = intval( $number );
1178
+	$number = intval($number);
1179 1179
 
1180
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1180
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1181 1181
 
1182 1182
 }
1183 1183
 
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
  *
1196 1196
  * @return string $amount Fully formatted donation amount.
1197 1197
  */
1198
-function give_donation_amount( $donation, $format_args = array() ) {
1198
+function give_donation_amount($donation, $format_args = array()) {
1199 1199
 	/* @var Give_Payment $donation */
1200
-	if ( ! ( $donation instanceof Give_Payment ) ) {
1201
-		$donation = new Give_Payment( absint( $donation ) );
1200
+	if ( ! ($donation instanceof Give_Payment)) {
1201
+		$donation = new Give_Payment(absint($donation));
1202 1202
 	}
1203 1203
 
1204 1204
 	$amount           = $donation->total;
1205 1205
 	$formatted_amount = $amount;
1206 1206
 
1207
-	if ( is_bool( $format_args ) ) {
1207
+	if (is_bool($format_args)) {
1208 1208
 		$format_args = array(
1209 1209
 			'currency' => (bool) $format_args,
1210 1210
 			'amount'   => (bool) $format_args,
@@ -1227,27 +1227,25 @@  discard block
 block discarded – undo
1227 1227
 		)
1228 1228
 	);
1229 1229
 
1230
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1230
+	if ($format_args['amount'] || $format_args['currency']) {
1231 1231
 
1232
-		if ( $format_args['amount'] ) {
1232
+		if ($format_args['amount']) {
1233 1233
 
1234 1234
 			$formatted_amount = give_format_amount(
1235 1235
 				$amount,
1236
-				! is_array( $format_args['amount'] ) ?
1236
+				! is_array($format_args['amount']) ?
1237 1237
 					array(
1238 1238
 						'sanitize' => false,
1239 1239
 						'currency' => $donation->currency,
1240
-					) :
1241
-					$format_args['amount']
1240
+					) : $format_args['amount']
1242 1241
 			);
1243 1242
 		}
1244 1243
 
1245
-		if ( $format_args['currency'] ) {
1244
+		if ($format_args['currency']) {
1246 1245
 			$formatted_amount = give_currency_filter(
1247 1246
 				$formatted_amount,
1248
-				! is_array( $format_args['currency'] ) ?
1249
-					array( 'currency_code' => $donation->currency ) :
1250
-					$format_args['currency']
1247
+				! is_array($format_args['currency']) ?
1248
+					array('currency_code' => $donation->currency) : $format_args['currency']
1251 1249
 			);
1252 1250
 		}
1253 1251
 	}
@@ -1262,7 +1260,7 @@  discard block
 block discarded – undo
1262 1260
 	 * @param int    $donation_id      Donation ID.
1263 1261
 	 * @param string $type             Donation amount type.
1264 1262
 	 */
1265
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args );
1263
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args);
1266 1264
 }
1267 1265
 
1268 1266
 /**
@@ -1279,10 +1277,10 @@  discard block
 block discarded – undo
1279 1277
  *
1280 1278
  * @return array Fully formatted payment subtotal.
1281 1279
  */
1282
-function give_payment_subtotal( $payment_id = 0 ) {
1283
-	$subtotal = give_get_payment_subtotal( $payment_id );
1280
+function give_payment_subtotal($payment_id = 0) {
1281
+	$subtotal = give_get_payment_subtotal($payment_id);
1284 1282
 
1285
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1283
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1286 1284
 }
1287 1285
 
1288 1286
 /**
@@ -1296,8 +1294,8 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return float $subtotal Subtotal for payment (non formatted).
1298 1296
  */
1299
-function give_get_payment_subtotal( $payment_id = 0 ) {
1300
-	$payment = new Give_Payment( $payment_id );
1297
+function give_get_payment_subtotal($payment_id = 0) {
1298
+	$payment = new Give_Payment($payment_id);
1301 1299
 
1302 1300
 	return $payment->subtotal;
1303 1301
 }
@@ -1311,8 +1309,8 @@  discard block
 block discarded – undo
1311 1309
  *
1312 1310
  * @return string The donation ID.
1313 1311
  */
1314
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1315
-	$payment = new Give_Payment( $payment_id );
1312
+function give_get_payment_transaction_id($payment_id = 0) {
1313
+	$payment = new Give_Payment($payment_id);
1316 1314
 
1317 1315
 	return $payment->transaction_id;
1318 1316
 }
@@ -1327,15 +1325,15 @@  discard block
 block discarded – undo
1327 1325
  *
1328 1326
  * @return bool|mixed
1329 1327
  */
1330
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1328
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1331 1329
 
1332
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1330
+	if (empty($payment_id) || empty($transaction_id)) {
1333 1331
 		return false;
1334 1332
 	}
1335 1333
 
1336
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1334
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1337 1335
 
1338
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1336
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1339 1337
 }
1340 1338
 
1341 1339
 /**
@@ -1348,10 +1346,10 @@  discard block
 block discarded – undo
1348 1346
  *
1349 1347
  * @return int $purchase Donation ID.
1350 1348
  */
1351
-function give_get_donation_id_by_key( $key ) {
1349
+function give_get_donation_id_by_key($key) {
1352 1350
 	global $wpdb;
1353 1351
 
1354
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1352
+	$meta_table = __give_v20_bc_table_details('payment');
1355 1353
 
1356 1354
 	$purchase = $wpdb->get_var(
1357 1355
 		$wpdb->prepare(
@@ -1367,7 +1365,7 @@  discard block
 block discarded – undo
1367 1365
 		)
1368 1366
 	);
1369 1367
 
1370
-	if ( $purchase != null ) {
1368
+	if ($purchase != null) {
1371 1369
 		return $purchase;
1372 1370
 	}
1373 1371
 
@@ -1385,13 +1383,13 @@  discard block
 block discarded – undo
1385 1383
  *
1386 1384
  * @return int $purchase Donation ID.
1387 1385
  */
1388
-function give_get_purchase_id_by_transaction_id( $key ) {
1386
+function give_get_purchase_id_by_transaction_id($key) {
1389 1387
 	global $wpdb;
1390
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1388
+	$meta_table = __give_v20_bc_table_details('payment');
1391 1389
 
1392
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1390
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1393 1391
 
1394
-	if ( $purchase != null ) {
1392
+	if ($purchase != null) {
1395 1393
 		return $purchase;
1396 1394
 	}
1397 1395
 
@@ -1408,23 +1406,23 @@  discard block
 block discarded – undo
1408 1406
  *
1409 1407
  * @return array $notes Donation Notes
1410 1408
  */
1411
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1409
+function give_get_payment_notes($payment_id = 0, $search = '') {
1412 1410
 
1413
-	if ( empty( $payment_id ) && empty( $search ) ) {
1411
+	if (empty($payment_id) && empty($search)) {
1414 1412
 		return false;
1415 1413
 	}
1416 1414
 
1417
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1418
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1415
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1416
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1419 1417
 
1420
-	$notes = get_comments( array(
1418
+	$notes = get_comments(array(
1421 1419
 		'post_id' => $payment_id,
1422 1420
 		'order'   => 'ASC',
1423 1421
 		'search'  => $search,
1424
-	) );
1422
+	));
1425 1423
 
1426
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1427
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1424
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1425
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1428 1426
 
1429 1427
 	return $notes;
1430 1428
 }
@@ -1440,8 +1438,8 @@  discard block
 block discarded – undo
1440 1438
  *
1441 1439
  * @return int The new note ID
1442 1440
  */
1443
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1444
-	if ( empty( $payment_id ) ) {
1441
+function give_insert_payment_note($payment_id = 0, $note = '') {
1442
+	if (empty($payment_id)) {
1445 1443
 		return false;
1446 1444
 	}
1447 1445
 
@@ -1453,14 +1451,14 @@  discard block
 block discarded – undo
1453 1451
 	 *
1454 1452
 	 * @since 1.0
1455 1453
 	 */
1456
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1454
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1457 1455
 
1458
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1456
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1459 1457
 		'comment_post_ID'      => $payment_id,
1460 1458
 		'comment_content'      => $note,
1461 1459
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1462
-		'comment_date'         => current_time( 'mysql' ),
1463
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1460
+		'comment_date'         => current_time('mysql'),
1461
+		'comment_date_gmt'     => current_time('mysql', 1),
1464 1462
 		'comment_approved'     => 1,
1465 1463
 		'comment_parent'       => 0,
1466 1464
 		'comment_author'       => '',
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 		'comment_author_email' => '',
1470 1468
 		'comment_type'         => 'give_payment_note',
1471 1469
 
1472
-	) ) );
1470
+	)));
1473 1471
 
1474 1472
 	/**
1475 1473
 	 * Fires after payment note inserted.
@@ -1480,7 +1478,7 @@  discard block
 block discarded – undo
1480 1478
 	 *
1481 1479
 	 * @since 1.0
1482 1480
 	 */
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1481
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1482
 
1485 1483
 	return $note_id;
1486 1484
 }
@@ -1495,8 +1493,8 @@  discard block
 block discarded – undo
1495 1493
  *
1496 1494
  * @return bool True on success, false otherwise.
1497 1495
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1496
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1497
+	if (empty($comment_id)) {
1500 1498
 		return false;
1501 1499
 	}
1502 1500
 
@@ -1508,9 +1506,9 @@  discard block
 block discarded – undo
1508 1506
 	 *
1509 1507
 	 * @since 1.0
1510 1508
 	 */
1511
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1509
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1512 1510
 
1513
-	$ret = wp_delete_comment( $comment_id, true );
1511
+	$ret = wp_delete_comment($comment_id, true);
1514 1512
 
1515 1513
 	/**
1516 1514
 	 * Fires after donation note deleted.
@@ -1520,7 +1518,7 @@  discard block
 block discarded – undo
1520 1518
 	 *
1521 1519
 	 * @since 1.0
1522 1520
 	 */
1523
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1521
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1524 1522
 
1525 1523
 	return $ret;
1526 1524
 }
@@ -1535,32 +1533,32 @@  discard block
 block discarded – undo
1535 1533
  *
1536 1534
  * @return string
1537 1535
  */
1538
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1536
+function give_get_payment_note_html($note, $payment_id = 0) {
1539 1537
 
1540
-	if ( is_numeric( $note ) ) {
1541
-		$note = get_comment( $note );
1538
+	if (is_numeric($note)) {
1539
+		$note = get_comment($note);
1542 1540
 	}
1543 1541
 
1544
-	if ( ! empty( $note->user_id ) ) {
1545
-		$user = get_userdata( $note->user_id );
1542
+	if ( ! empty($note->user_id)) {
1543
+		$user = get_userdata($note->user_id);
1546 1544
 		$user = $user->display_name;
1547 1545
 	} else {
1548
-		$user = __( 'System', 'give' );
1546
+		$user = __('System', 'give');
1549 1547
 	}
1550 1548
 
1551
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1549
+	$date_format = give_date_format().', '.get_option('time_format');
1552 1550
 
1553
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1551
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1554 1552
 		'give-action' => 'delete_payment_note',
1555 1553
 		'note_id'     => $note->comment_ID,
1556 1554
 		'payment_id'  => $payment_id,
1557
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1555
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1558 1556
 
1559
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1557
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1560 1558
 	$note_html .= '<p>';
1561
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1559
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1562 1560
 	$note_html .= $note->comment_content;
1563
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . __( 'Delete this donation note.', 'give' ) . '">' . __( 'Delete', 'give' ) . '</a>';
1561
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.__('Delete this donation note.', 'give').'">'.__('Delete', 'give').'</a>';
1564 1562
 	$note_html .= '</p>';
1565 1563
 	$note_html .= '</div>';
1566 1564
 
@@ -1578,18 +1576,18 @@  discard block
 block discarded – undo
1578 1576
  *
1579 1577
  * @return void
1580 1578
  */
1581
-function give_hide_payment_notes( $query ) {
1582
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1583
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1584
-		if ( ! is_array( $types ) ) {
1585
-			$types = array( $types );
1579
+function give_hide_payment_notes($query) {
1580
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1581
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1582
+		if ( ! is_array($types)) {
1583
+			$types = array($types);
1586 1584
 		}
1587 1585
 		$types[]                           = 'give_payment_note';
1588 1586
 		$query->query_vars['type__not_in'] = $types;
1589 1587
 	}
1590 1588
 }
1591 1589
 
1592
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1590
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1593 1591
 
1594 1592
 /**
1595 1593
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1601,15 +1599,15 @@  discard block
 block discarded – undo
1601 1599
  *
1602 1600
  * @return array $clauses Updated comment clauses.
1603 1601
  */
1604
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1605
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1602
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1603
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1606 1604
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1607 1605
 	}
1608 1606
 
1609 1607
 	return $clauses;
1610 1608
 }
1611 1609
 
1612
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1610
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1613 1611
 
1614 1612
 
1615 1613
 /**
@@ -1622,15 +1620,15 @@  discard block
 block discarded – undo
1622 1620
  *
1623 1621
  * @return string $where
1624 1622
  */
1625
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1623
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1626 1624
 	global $wpdb;
1627 1625
 
1628
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1626
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1629 1627
 
1630 1628
 	return $where;
1631 1629
 }
1632 1630
 
1633
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1631
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1634 1632
 
1635 1633
 
1636 1634
 /**
@@ -1644,32 +1642,32 @@  discard block
 block discarded – undo
1644 1642
  *
1645 1643
  * @return array|object Array of comment counts.
1646 1644
  */
1647
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1645
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1648 1646
 	global $wpdb, $pagenow;
1649 1647
 
1650
-	if ( 'index.php' != $pagenow ) {
1648
+	if ('index.php' != $pagenow) {
1651 1649
 		return $stats;
1652 1650
 	}
1653 1651
 
1654 1652
 	$post_id = (int) $post_id;
1655 1653
 
1656
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1654
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1657 1655
 		return $stats;
1658 1656
 	}
1659 1657
 
1660
-	$stats = Give_Cache::get_group( "comments-{$post_id}", 'counts' );
1658
+	$stats = Give_Cache::get_group("comments-{$post_id}", 'counts');
1661 1659
 
1662
-	if ( ! is_null( $stats ) ) {
1660
+	if ( ! is_null($stats)) {
1663 1661
 		return $stats;
1664 1662
 	}
1665 1663
 
1666 1664
 	$where = 'WHERE comment_type != "give_payment_note"';
1667 1665
 
1668
-	if ( $post_id > 0 ) {
1669
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1666
+	if ($post_id > 0) {
1667
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1670 1668
 	}
1671 1669
 
1672
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1670
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1673 1671
 
1674 1672
 	$total    = 0;
1675 1673
 	$approved = array(
@@ -1679,30 +1677,30 @@  discard block
 block discarded – undo
1679 1677
 		'trash'        => 'trash',
1680 1678
 		'post-trashed' => 'post-trashed',
1681 1679
 	);
1682
-	foreach ( (array) $count as $row ) {
1680
+	foreach ((array) $count as $row) {
1683 1681
 		// Don't count post-trashed toward totals.
1684
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1682
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1685 1683
 			$total += $row['num_comments'];
1686 1684
 		}
1687
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1688
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1685
+		if (isset($approved[$row['comment_approved']])) {
1686
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1689 1687
 		}
1690 1688
 	}
1691 1689
 
1692 1690
 	$stats['total_comments'] = $total;
1693
-	foreach ( $approved as $key ) {
1694
-		if ( empty( $stats[ $key ] ) ) {
1695
-			$stats[ $key ] = 0;
1691
+	foreach ($approved as $key) {
1692
+		if (empty($stats[$key])) {
1693
+			$stats[$key] = 0;
1696 1694
 		}
1697 1695
 	}
1698 1696
 
1699 1697
 	$stats = (object) $stats;
1700
-	Give_Cache::set_group( "comments-{$post_id}", $stats, 'counts' );
1698
+	Give_Cache::set_group("comments-{$post_id}", $stats, 'counts');
1701 1699
 
1702 1700
 	return $stats;
1703 1701
 }
1704 1702
 
1705
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1703
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1706 1704
 
1707 1705
 
1708 1706
 /**
@@ -1715,9 +1713,9 @@  discard block
 block discarded – undo
1715 1713
  *
1716 1714
  * @return string $where Modified where clause.
1717 1715
  */
1718
-function give_filter_where_older_than_week( $where = '' ) {
1716
+function give_filter_where_older_than_week($where = '') {
1719 1717
 	// Payments older than one week.
1720
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1718
+	$start = date('Y-m-d', strtotime('-7 days'));
1721 1719
 	$where .= " AND post_date <= '{$start}'";
1722 1720
 
1723 1721
 	return $where;
@@ -1737,13 +1735,13 @@  discard block
 block discarded – undo
1737 1735
  *
1738 1736
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1739 1737
  */
1740
-function give_get_donation_form_title( $donation, $args = array() ) {
1738
+function give_get_donation_form_title($donation, $args = array()) {
1741 1739
 
1742
-	if ( ! $donation instanceof Give_Payment ) {
1743
-		$donation = new Give_Payment( $donation );
1740
+	if ( ! $donation instanceof Give_Payment) {
1741
+		$donation = new Give_Payment($donation);
1744 1742
 	}
1745 1743
 
1746
-	if( ! $donation->ID ) {
1744
+	if ( ! $donation->ID) {
1747 1745
 		return '';
1748 1746
 	}
1749 1747
 
@@ -1752,7 +1750,7 @@  discard block
 block discarded – undo
1752 1750
 		'separator'  => '',
1753 1751
 	);
1754 1752
 
1755
-	$args = wp_parse_args( $args, $defaults );
1753
+	$args = wp_parse_args($args, $defaults);
1756 1754
 
1757 1755
 	$form_id     = $donation->form_id;
1758 1756
 	$price_id    = $donation->price_id;
@@ -1773,32 +1771,32 @@  discard block
 block discarded – undo
1773 1771
 		, false
1774 1772
 	);
1775 1773
 
1776
-	$form_title_html = Give_Cache::get_db_query( $cache_key );
1774
+	$form_title_html = Give_Cache::get_db_query($cache_key);
1777 1775
 
1778
-	if ( is_null( $form_title_html ) ) {
1779
-		if ( true === $only_level ) {
1776
+	if (is_null($form_title_html)) {
1777
+		if (true === $only_level) {
1780 1778
 			$form_title = '';
1781 1779
 		}
1782 1780
 
1783 1781
 		$form_title_html = $form_title;
1784 1782
 
1785
-		if ( 'custom' === $price_id ) {
1786
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1787
-			$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1788
-		} elseif ( give_has_variable_prices( $form_id ) ) {
1789
-			$level_label = give_get_price_option_name( $form_id, $price_id );
1783
+		if ('custom' === $price_id) {
1784
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1785
+			$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1786
+		} elseif (give_has_variable_prices($form_id)) {
1787
+			$level_label = give_get_price_option_name($form_id, $price_id);
1790 1788
 		}
1791 1789
 
1792 1790
 		// Only add separator if there is a form title.
1793 1791
 		if (
1794
-			! empty( $form_title_html ) &&
1795
-			! empty( $level_label )
1792
+			! empty($form_title_html) &&
1793
+			! empty($level_label)
1796 1794
 		) {
1797 1795
 			$form_title_html .= " {$separator} ";
1798 1796
 		}
1799 1797
 
1800 1798
 		$form_title_html .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1801
-		Give_Cache::set_db_query( $cache_key, $form_title_html );
1799
+		Give_Cache::set_db_query($cache_key, $form_title_html);
1802 1800
 	}
1803 1801
 
1804 1802
 	/**
@@ -1806,7 +1804,7 @@  discard block
 block discarded – undo
1806 1804
 	 *
1807 1805
 	 * @since 1.0
1808 1806
 	 */
1809
-	return apply_filters( 'give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation );
1807
+	return apply_filters('give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation);
1810 1808
 }
1811 1809
 
1812 1810
 /**
@@ -1819,19 +1817,19 @@  discard block
 block discarded – undo
1819 1817
  *
1820 1818
  * @return string $price_id
1821 1819
  */
1822
-function give_get_price_id( $form_id, $price ) {
1820
+function give_get_price_id($form_id, $price) {
1823 1821
 	$price_id = null;
1824 1822
 
1825
-	if ( give_has_variable_prices( $form_id ) ) {
1823
+	if (give_has_variable_prices($form_id)) {
1826 1824
 
1827
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1825
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1828 1826
 
1829
-		foreach ( $levels as $level ) {
1827
+		foreach ($levels as $level) {
1830 1828
 
1831
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1829
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1832 1830
 
1833 1831
 			// Check that this indeed the recurring price.
1834
-			if ( $level_amount == $price ) {
1832
+			if ($level_amount == $price) {
1835 1833
 
1836 1834
 				$price_id = $level['_give_id']['level_id'];
1837 1835
 				break;
@@ -1839,13 +1837,13 @@  discard block
 block discarded – undo
1839 1837
 			}
1840 1838
 		}
1841 1839
 
1842
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1840
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1843 1841
 			$price_id = 'custom';
1844 1842
 		}
1845 1843
 	}
1846 1844
 
1847 1845
 	// Price ID must be numeric or string.
1848
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1846
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1849 1847
 
1850 1848
 	/**
1851 1849
 	 * Filter the price id
@@ -1855,7 +1853,7 @@  discard block
 block discarded – undo
1855 1853
 	 * @param string $price_id
1856 1854
 	 * @param int    $form_id
1857 1855
 	 */
1858
-	return apply_filters( 'give_get_price_id', $price_id, $form_id );
1856
+	return apply_filters('give_get_price_id', $price_id, $form_id);
1859 1857
 }
1860 1858
 
1861 1859
 /**
@@ -1871,10 +1869,10 @@  discard block
 block discarded – undo
1871 1869
  *
1872 1870
  * @return string
1873 1871
  */
1874
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1875
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1872
+function give_get_form_dropdown($args = array(), $echo = false) {
1873
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1876 1874
 
1877
-	if ( ! $echo ) {
1875
+	if ( ! $echo) {
1878 1876
 		return $form_dropdown_html;
1879 1877
 	}
1880 1878
 
@@ -1891,17 +1889,17 @@  discard block
 block discarded – undo
1891 1889
  *
1892 1890
  * @return string|bool
1893 1891
  */
1894
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1892
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1895 1893
 
1896 1894
 	// Check for give form id.
1897
-	if ( empty( $args['id'] ) ) {
1895
+	if (empty($args['id'])) {
1898 1896
 		return false;
1899 1897
 	}
1900 1898
 
1901
-	$form = new Give_Donate_Form( $args['id'] );
1899
+	$form = new Give_Donate_Form($args['id']);
1902 1900
 
1903 1901
 	// Check if form has variable prices or not.
1904
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1902
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1905 1903
 		return false;
1906 1904
 	}
1907 1905
 
@@ -1909,24 +1907,24 @@  discard block
 block discarded – undo
1909 1907
 	$variable_price_options = array();
1910 1908
 
1911 1909
 	// Check if multi donation form support custom donation or not.
1912
-	if ( $form->is_custom_price_mode() ) {
1913
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1910
+	if ($form->is_custom_price_mode()) {
1911
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1914 1912
 	}
1915 1913
 
1916 1914
 	// Get variable price and ID from variable price array.
1917
-	foreach ( $variable_prices as $variable_price ) {
1918
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1915
+	foreach ($variable_prices as $variable_price) {
1916
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1919 1917
 	}
1920 1918
 
1921 1919
 	// Update options.
1922
-	$args = array_merge( $args, array(
1920
+	$args = array_merge($args, array(
1923 1921
 		'options' => $variable_price_options,
1924
-	) );
1922
+	));
1925 1923
 
1926 1924
 	// Generate select html.
1927
-	$form_dropdown_html = Give()->html->select( $args );
1925
+	$form_dropdown_html = Give()->html->select($args);
1928 1926
 
1929
-	if ( ! $echo ) {
1927
+	if ( ! $echo) {
1930 1928
 		return $form_dropdown_html;
1931 1929
 	}
1932 1930
 
@@ -1945,14 +1943,14 @@  discard block
 block discarded – undo
1945 1943
  *
1946 1944
  * @return string
1947 1945
  */
1948
-function give_get_payment_meta_price_id( $payment_meta ) {
1946
+function give_get_payment_meta_price_id($payment_meta) {
1949 1947
 
1950
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1948
+	if (isset($payment_meta['give_price_id'])) {
1951 1949
 		$price_id = $payment_meta['give_price_id'];
1952
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1950
+	} elseif (isset($payment_meta['price_id'])) {
1953 1951
 		$price_id = $payment_meta['price_id'];
1954 1952
 	} else {
1955
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1953
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1956 1954
 	}
1957 1955
 
1958 1956
 	/**
@@ -1963,6 +1961,6 @@  discard block
 block discarded – undo
1963 1961
 	 * @param string $price_id
1964 1962
 	 * @param array  $payment_meta
1965 1963
 	 */
1966
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id, $payment_meta );
1964
+	return apply_filters('give_get_payment_meta_price_id', $price_id, $payment_meta);
1967 1965
 
1968 1966
 }
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @return    Give
238 238
 		 */
239 239
 		public static function instance() {
240
-			if ( is_null( self::$_instance ) ) {
240
+			if (is_null(self::$_instance)) {
241 241
 				self::$_instance = new self();
242 242
 			}
243 243
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function __construct() {
251 251
 			// PHP version
252
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
253
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
252
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
253
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
254 254
 			}
255 255
 
256 256
 			// Bailout: Need minimum php version to load plugin.
257
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
258
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
257
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
258
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
259 259
 
260 260
 				return;
261 261
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->includes();
266 266
 			$this->init_hooks();
267 267
 
268
-			do_action( 'give_loaded' );
268
+			do_action('give_loaded');
269 269
 		}
270 270
 
271 271
 		/**
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 		 * @since  1.8.9
275 275
 		 */
276 276
 		private function init_hooks() {
277
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
278
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
277
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
278
+			add_action('plugins_loaded', array($this, 'init'), 0);
279 279
 		}
280 280
 
281 281
 		/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			 *
291 291
 			 * @since 1.8.9
292 292
 			 */
293
-			do_action( 'before_give_init' );
293
+			do_action('before_give_init');
294 294
 
295 295
 			// Set up localization.
296 296
 			$this->load_textdomain();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			 *
321 321
 			 * @since 1.8.7
322 322
 			 */
323
-			do_action( 'give_init', $this );
323
+			do_action('give_init', $this);
324 324
 
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 */
338 338
 		public function __clone() {
339 339
 			// Cloning instances of the class is forbidden.
340
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
340
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
341 341
 		}
342 342
 
343 343
 		/**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 */
351 351
 		public function __wakeup() {
352 352
 			// Unserializing instances of the class is forbidden.
353
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
353
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
354 354
 		}
355 355
 
356 356
 		/**
@@ -364,33 +364,33 @@  discard block
 block discarded – undo
364 364
 		private function setup_constants() {
365 365
 
366 366
 			// Plugin version
367
-			if ( ! defined( 'GIVE_VERSION' ) ) {
368
-				define( 'GIVE_VERSION', '2.0.0' );
367
+			if ( ! defined('GIVE_VERSION')) {
368
+				define('GIVE_VERSION', '2.0.0');
369 369
 			}
370 370
 
371 371
 			// Plugin Root File
372
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
373
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
372
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
373
+				define('GIVE_PLUGIN_FILE', __FILE__);
374 374
 			}
375 375
 
376 376
 			// Plugin Folder Path
377
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
378
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
377
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
378
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
379 379
 			}
380 380
 
381 381
 			// Plugin Folder URL
382
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
383
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
382
+			if ( ! defined('GIVE_PLUGIN_URL')) {
383
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
384 384
 			}
385 385
 
386 386
 			// Plugin Basename aka: "give/give.php"
387
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
388
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
387
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
388
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
389 389
 			}
390 390
 
391 391
 			// Make sure CAL_GREGORIAN is defined
392
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
393
-				define( 'CAL_GREGORIAN', 1 );
392
+			if ( ! defined('CAL_GREGORIAN')) {
393
+				define('CAL_GREGORIAN', 1);
394 394
 			}
395 395
 		}
396 396
 
@@ -408,152 +408,152 @@  discard block
 block discarded – undo
408 408
 			/**
409 409
 			 * Load libraries.
410 410
 			 */
411
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
412
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
411
+			if ( ! class_exists('WP_Async_Request')) {
412
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
413 413
 			}
414 414
 
415
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
416
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
415
+			if ( ! class_exists('WP_Background_Process')) {
416
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
417 417
 			}
418 418
 
419 419
 			/**
420 420
 			 * Load plugin files
421 421
 			 */
422
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
423
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
422
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
423
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
424 424
 			$give_options = give_get_settings();
425 425
 
426
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
427
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
428
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
429
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
434
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
435
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
436
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
437
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
438
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
439
-
440
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
441
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
442
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
443
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
444
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
445
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
446
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
447
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
448
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
449
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
450
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
451
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
452
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
454
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
455
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
456
-
457
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
470
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
477
-
478
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
484
-
485
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
490
-
491
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
497
-
498
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
500
-
501
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
502
-
503
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
504
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
426
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
428
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
429
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
434
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
435
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
436
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
437
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
438
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
439
+
440
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
441
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
442
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
443
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
444
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
445
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
446
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
447
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
448
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
449
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
450
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
451
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
454
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
455
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
456
+
457
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
470
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
477
+
478
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
484
+
485
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
490
+
491
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
497
+
498
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
500
+
501
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
502
+
503
+			if (defined('WP_CLI') && WP_CLI) {
504
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
505 505
 			}
506 506
 
507
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
508
-
509
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
510
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
511
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
512
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
513
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
514
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
515
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
516
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
517
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
518
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
519
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
520
-
521
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
522
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
523
-
524
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
525
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
526
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
527
-
528
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
529
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
530
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
531
-
532
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
533
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
534
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
535
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
536
-
537
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
538
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
539
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
540
-
541
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
542
-
543
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
544
-
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
507
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
508
+
509
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
510
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
511
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
512
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
513
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
514
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
515
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
516
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
517
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
518
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
519
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
520
+
521
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
522
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
523
+
524
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
525
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
526
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
527
+
528
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
529
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
530
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
531
+
532
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
533
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
534
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
535
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
536
+
537
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
538
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
539
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
540
+
541
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
542
+
543
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
544
+
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
554 554
 			}// End if().
555 555
 
556
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
556
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
557 557
 
558 558
 		}
559 559
 
@@ -568,16 +568,16 @@  discard block
 block discarded – undo
568 568
 		public function load_textdomain() {
569 569
 
570 570
 			// Set filter for Give's languages directory
571
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
572
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
571
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
572
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
573 573
 
574 574
 			// Traditional WordPress plugin locale filter.
575
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
576
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
575
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
576
+			$locale = apply_filters('plugin_locale', $locale, 'give');
577 577
 
578
-			unload_textdomain( 'give' );
579
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
580
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
578
+			unload_textdomain('give');
579
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
580
+			load_plugin_textdomain('give', false, $give_lang_dir);
581 581
 
582 582
 		}
583 583
 
@@ -590,17 +590,17 @@  discard block
 block discarded – undo
590 590
 		 */
591 591
 		public function minmum_phpversion_notice() {
592 592
 			// Bailout.
593
-			if ( ! is_admin() ) {
593
+			if ( ! is_admin()) {
594 594
 				return;
595 595
 			}
596 596
 
597
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
598
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
599
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
600
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
601
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
602
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
603
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
597
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
598
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
599
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
600
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
601
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
602
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
603
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
604 604
 
605 605
 			echo sprintf(
606 606
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.
includes/class-give-db-payment-meta.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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta';
53
+		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 			KEY meta_key (meta_key)
100 100
 			) {$charset_collate};";
101 101
 
102
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
103
-		dbDelta( $sql );
102
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
103
+		dbDelta($sql);
104 104
 
105
-		update_option( $this->table_name . '_db_version', $this->version );
105
+		update_option($this->table_name.'_db_version', $this->version);
106 106
 	}
107 107
 
108 108
 	/**
@@ -113,6 +113,6 @@  discard block
 block discarded – undo
113 113
 	 * @return bool
114 114
 	 */
115 115
 	protected function is_custom_meta_table_active() {
116
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
116
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 			// Get current setting page.
71 71
 			$this->current_setting_page = give_get_current_setting_page();
72 72
 
73
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
74
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
75
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
73
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
74
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
75
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
76 76
 
77 77
 			// Output section only if exist.
78 78
 			$sections = $this->get_sections();
79
-			if ( ! empty( $sections ) ) {
80
-				add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array(
79
+			if ( ! empty($sections)) {
80
+				add_action("{$this->current_setting_page}_sections_{$this->id}_page", array(
81 81
 					$this,
82 82
 					'output_sections',
83
-				) );
83
+				));
84 84
 			}
85 85
 
86 86
 			// Save hide button by default.
87 87
 			$GLOBALS['give_hide_save_button'] = true;
88 88
 
89 89
 			// Enable saving feature.
90
-			if ( $this->enable_save ) {
91
-				add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
90
+			if ($this->enable_save) {
91
+				add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
92 92
 			}
93 93
 		}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		function set_default_setting_tab( $setting_tab ) {
116
+		function set_default_setting_tab($setting_tab) {
117 117
 			return $this->default_tab;
118 118
 		}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return array
128 128
 		 */
129
-		public function add_settings_page( $pages ) {
130
-			$pages[ $this->id ] = $this->label;
129
+		public function add_settings_page($pages) {
130
+			$pages[$this->id] = $this->label;
131 131
 
132 132
 			return $pages;
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			 *
147 147
 			 * @param  array $settings
148 148
 			 */
149
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
149
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
150 150
 
151 151
 			// Output.
152 152
 			return $settings;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @return array
160 160
 		 */
161 161
 		public function get_sections() {
162
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
162
+			return apply_filters('give_get_sections_'.$this->id, array());
163 163
 		}
164 164
 
165 165
 		/**
@@ -176,39 +176,39 @@  discard block
 block discarded – undo
176 176
 			$sections = $this->get_sections();
177 177
 
178 178
 			// Bailout.
179
-			if ( empty( $sections ) ) {
179
+			if (empty($sections)) {
180 180
 				return;
181 181
 			}
182 182
 
183 183
 			// Show section settings only if setting section exist.
184
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) {
185
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
184
+			if ($current_section && ! in_array($current_section, array_keys($sections))) {
185
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
186 186
 				$GLOBALS['give_hide_save_button'] = true;
187 187
 
188 188
 				return;
189 189
 			}
190 190
 
191
-			if ( is_null( $this->current_setting_page ) ) {
191
+			if (is_null($this->current_setting_page)) {
192 192
 				$this->current_setting_page = give_get_current_setting_page();
193 193
 			}
194 194
 
195 195
 			$section_list = array();
196
-			foreach ( $sections as $id => $label ) {
196
+			foreach ($sections as $id => $label) {
197 197
 				/**
198 198
 				 * Fire the filter to hide particular section on tab.
199 199
 				 *
200 200
 				 * @since 2.0
201 201
 				 */
202
-				if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) {
202
+				if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) {
203 203
 					continue;
204 204
 				}
205 205
 
206
-				$section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a>';
206
+				$section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a>';
207 207
 			}
208 208
 
209 209
 			echo sprintf(
210 210
 				'<ul class="subsubsub">%s</ul><br class="clear" /><hr>',
211
-				implode( ' | </li>', $section_list )
211
+				implode(' | </li>', $section_list)
212 212
 			);
213 213
 		}
214 214
 
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		 * @return void
222 222
 		 */
223 223
 		public function output() {
224
-			if ( $this->enable_save ) {
224
+			if ($this->enable_save) {
225 225
 				$GLOBALS['give_hide_save_button'] = false;
226 226
 			}
227 227
 
228 228
 			$settings = $this->get_settings();
229 229
 
230
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
230
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
231 231
 		}
232 232
 
233 233
 		/**
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 			$settings        = $this->get_settings();
241 241
 			$current_section = give_get_current_setting_section();
242 242
 
243
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
243
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
244 244
 
245 245
 			/**
246 246
 			 * Trigger Action
247 247
 			 *
248 248
 			 * @since 1.8
249 249
 			 */
250
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
250
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
251 251
 		}
252 252
 
253 253
 		/**
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 			$section         = $this->get_sections();
265 265
 			$current_section = give_get_current_setting_section();
266 266
 
267
-			if ( array_key_exists( $current_section, $section ) ) {
268
-				$heading[] = $section[ $current_section ];
267
+			if (array_key_exists($current_section, $section)) {
268
+				$heading[] = $section[$current_section];
269 269
 			}
270 270
 
271
-			return array_unique( $heading );
271
+			return array_unique($heading);
272 272
 		}
273 273
 
274 274
 		/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		public function get_heading_html() {
283 283
 			return sprintf(
284 284
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
285
-				implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() )
285
+				implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading())
286 286
 			);
287 287
 		}
288 288
 	}
Please login to merge, or discard this patch.
includes/admin/donors/donors.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -402,8 +402,11 @@
 block discarded – undo
402 402
 								<span class="donor-user-id info-item editable">
403 403
 										<?php if ( ! empty( $userdata ) ) : ?>
404 404
 											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
405
-										<?php else: ?>
406
-											<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
405
+										<?php else {
406
+	: ?>
407
+											<span data-key="user_id"><?php _e( 'None', 'give' );
408
+}
409
+?></span>
407 410
 										<?php endif; ?>
408 411
 									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
409 412
 
Please login to merge, or discard this patch.
Spacing   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string
27 27
  */
28
-function __give_get_format_address( $address, $address_args = array() ) {
28
+function __give_get_format_address($address, $address_args = array()) {
29 29
 	$address_html = '';
30 30
 	$address_args = wp_parse_args(
31 31
 		$address_args,
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	$address_id = $address_args['type'];
41 41
 
42 42
 	// Bailout.
43
-	if ( empty( $address ) || ! is_array( $address ) ) {
43
+	if (empty($address) || ! is_array($address)) {
44 44
 		return $address_html;
45 45
 	}
46 46
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 	$address_html .= sprintf(
50 50
 		'<span data-address-type="line1">%1$s</span>%2$s',
51 51
 		$address['line1'],
52
-		( ! empty( $address['line2'] ) ? '<br>' : '' )
52
+		( ! empty($address['line2']) ? '<br>' : '')
53 53
 	);
54 54
 	$address_html .= sprintf(
55 55
 		'<span data-address-type="line2">%1$s</span>%2$s',
56 56
 		$address['line2'],
57
-		( ! empty( $address['city'] ) ? '<br>' : '' )
57
+		( ! empty($address['city']) ? '<br>' : '')
58 58
 	);
59 59
 	$address_html .= sprintf(
60 60
 		'<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s',
61 61
 		$address['city'],
62
-		( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ),
63
-		( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ),
64
-		( ! empty( $address['country'] ) ? '<br>' : '' )
62
+		( ! empty($address['state']) ? ", {$address['state']}" : ''),
63
+		( ! empty($address['zip']) ? " {$address['zip']}" : ''),
64
+		( ! empty($address['country']) ? '<br>' : '')
65 65
 	);
66 66
 	$address_html .= sprintf(
67 67
 		'<span data-address-type="country">%s</span><br>',
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	// Address action.
72 72
 	$address_html .= sprintf(
73 73
 		'<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>',
74
-		__( 'Edit', 'give' ),
75
-		__( 'Remove', 'give' )
74
+		__('Edit', 'give'),
75
+		__('Remove', 'give')
76 76
 	);
77 77
 
78 78
 	/**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @since 2.0
82 82
 	 */
83
-	$address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args );
83
+	$address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args);
84 84
 
85 85
 	// Set unique id and index for multi type address.
86
-	if ( isset( $address_args['index'] ) ) {
86
+	if (isset($address_args['index'])) {
87 87
 		$address_label = "{$address_label} #{$address_args['index']}";
88 88
 	}
89 89
 
90
-	if ( isset( $address_args['id'] ) ) {
90
+	if (isset($address_args['id'])) {
91 91
 		$address_id = "{$address_id}_{$address_args['id']}";
92 92
 	}
93 93
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function give_donors_page() {
114 114
 	$default_views  = give_donor_views();
115
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
116
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
117
-		give_render_donor_view( $requested_view, $default_views );
115
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors';
116
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
117
+		give_render_donor_view($requested_view, $default_views);
118 118
 	} else {
119 119
 		give_donors_list();
120 120
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 	$views = array();
132 132
 
133
-	return apply_filters( 'give_donor_views', $views );
133
+	return apply_filters('give_donor_views', $views);
134 134
 
135 135
 }
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	$tabs = array();
146 146
 
147
-	return apply_filters( 'give_donor_tabs', $tabs );
147
+	return apply_filters('give_donor_tabs', $tabs);
148 148
 
149 149
 }
150 150
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function give_donors_list() {
158 158
 
159
-	include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php';
159
+	include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php';
160 160
 
161 161
 	$donors_table = new Give_Donor_List_Table();
162 162
 	$donors_table->prepare_items();
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 		 *
170 170
 		 * @since 1.0
171 171
 		 */
172
-		do_action( 'give_donors_table_top' );
172
+		do_action('give_donors_table_top');
173 173
 		?>
174 174
 
175 175
 		<hr class="wp-header-end">
176
-		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
177
-			<?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?>
176
+		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
177
+			<?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?>
178 178
 			<input type="hidden" name="post_type" value="give_forms" />
179 179
 			<input type="hidden" name="page" value="give-donors" />
180 180
 			<input type="hidden" name="view" value="donors" />
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		 *
192 192
 		 * @since 1.0
193 193
 		 */
194
-		do_action( 'give_donors_table_bottom' );
194
+		do_action('give_donors_table_bottom');
195 195
 		?>
196 196
 	</div>
197 197
 	<?php
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return void
209 209
  */
210
-function give_render_donor_view( $view, $callbacks ) {
210
+function give_render_donor_view($view, $callbacks) {
211 211
 
212 212
 	$render = true;
213 213
 
214
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
214
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
215 215
 
216
-	if ( ! current_user_can( $donor_view_role ) ) {
217
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
216
+	if ( ! current_user_can($donor_view_role)) {
217
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
218 218
 		$render = false;
219 219
 	}
220 220
 
221
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
222
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
221
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
222
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
223 223
 		$render = false;
224 224
 	}
225 225
 
226 226
 	$donor_id          = (int) $_GET['id'];
227
-	$reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : '';
228
-	$donor             = new Give_Donor( $donor_id );
227
+	$reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : '';
228
+	$donor             = new Give_Donor($donor_id);
229 229
 
230 230
 	// Reconnect User with Donor profile.
231
-	if ( $reconnect_user_id ) {
232
-		give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() );
231
+	if ($reconnect_user_id) {
232
+		give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array());
233 233
 	}
234 234
 
235
-	if ( empty( $donor->id ) ) {
236
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
235
+	if (empty($donor->id)) {
236
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
237 237
 		$render = false;
238 238
 	}
239 239
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 
243 243
 	<div class='wrap'>
244 244
 
245
-		<?php if ( give_get_errors() ) : ?>
245
+		<?php if (give_get_errors()) : ?>
246 246
 			<div class="error settings-error">
247
-				<?php Give()->notices->render_frontend_notices( 0 ); ?>
247
+				<?php Give()->notices->render_frontend_notices(0); ?>
248 248
 			</div>
249 249
 		<?php endif; ?>
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			<?php
253 253
 			printf(
254 254
 			/* translators: %s: donor number */
255
-				esc_html__( 'Donor %s', 'give' ),
255
+				esc_html__('Donor %s', 'give'),
256 256
 				$donor_id
257 257
 			);
258 258
 			?>
@@ -260,26 +260,26 @@  discard block
 block discarded – undo
260 260
 
261 261
 		<hr class="wp-header-end">
262 262
 
263
-		<?php if ( $donor && $render ) : ?>
263
+		<?php if ($donor && $render) : ?>
264 264
 
265 265
 			<h2 class="nav-tab-wrapper">
266 266
 				<?php
267
-				foreach ( $donor_tabs as $key => $tab ) :
267
+				foreach ($donor_tabs as $key => $tab) :
268 268
 					$active = $key === $view ? true : false;
269 269
 					$class  = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
270 270
 					printf(
271
-						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n",
272
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
273
-						esc_attr( $class ),
274
-						sanitize_html_class( $tab['dashicon'] ),
275
-						esc_html( $tab['title'] )
271
+						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
272
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)),
273
+						esc_attr($class),
274
+						sanitize_html_class($tab['dashicon']),
275
+						esc_html($tab['title'])
276 276
 					);
277 277
 				endforeach;
278 278
 				?>
279 279
 			</h2>
280 280
 
281 281
 			<div id="give-donor-card-wrapper">
282
-				<?php $callbacks[ $view ]( $donor ) ?>
282
+				<?php $callbacks[$view]($donor) ?>
283 283
 			</div>
284 284
 
285 285
 		<?php endif; ?>
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
  *
300 300
  * @return void
301 301
  */
302
-function give_donor_view( $donor ) {
302
+function give_donor_view($donor) {
303 303
 
304
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
304
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
305 305
 
306 306
 	/**
307 307
 	 * Fires in donor profile screen, above the donor card.
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @param object $donor The donor object being displayed.
312 312
 	 */
313
-	do_action( 'give_donor_card_top', $donor );
313
+	do_action('give_donor_card_top', $donor);
314 314
 
315 315
 	// Set Read only to the fields which needs to be locked.
316 316
 	$read_only = '';
317
-	if ( $donor->user_id ) {
317
+	if ($donor->user_id) {
318 318
 		$read_only = 'readonly="readonly"';
319 319
 	}
320 320
 	?>
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
 	<div id="donor-summary" class="info-wrapper donor-section postbox">
323 323
 
324 324
 		<form id="edit-donor-info" method="post"
325
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
325
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
326 326
 
327 327
 			<div class="donor-info">
328 328
 
329 329
 				<div class="donor-bio-header clearfix">
330 330
 
331 331
 					<div class="avatar-wrap left" id="donor-avatar">
332
-						<?php echo get_avatar( $donor->email ); ?>
332
+						<?php echo get_avatar($donor->email); ?>
333 333
 					</div>
334 334
 
335 335
 					<div id="donor-name-wrap" class="left">
@@ -337,18 +337,18 @@  discard block
 block discarded – undo
337 337
 						<span class="donor-name info-item edit-item">
338 338
 							<input <?php echo $read_only; ?> size="15" data-key="first_name"
339 339
 							                                 name="customerinfo[first_name]" type="text"
340
-							                                 value="<?php esc_attr_e( $donor->get_first_name() ); ?>"
341
-							                                 placeholder="<?php _e( 'First Name', 'give' ); ?>"/>
342
-							<?php if ( $donor->user_id ) : ?>
340
+							                                 value="<?php esc_attr_e($donor->get_first_name()); ?>"
341
+							                                 placeholder="<?php _e('First Name', 'give'); ?>"/>
342
+							<?php if ($donor->user_id) : ?>
343 343
 								<a href="#" class="give-lock-block">
344 344
 									<i class="give-icon give-icon-locked"></i>
345 345
 								</a>
346 346
 							<?php endif; ?>
347 347
 							<input <?php echo $read_only; ?> size="15" data-key="last_name"
348 348
 							                                 name="customerinfo[last_name]" type="text"
349
-							                                 value="<?php esc_attr_e( $donor->get_last_name() ); ?>"
350
-							                                 placeholder="<?php _e( 'Last Name', 'give' ); ?>"/>
351
-							<?php if ( $donor->user_id ) : ?>
349
+							                                 value="<?php esc_attr_e($donor->get_last_name()); ?>"
350
+							                                 placeholder="<?php _e('Last Name', 'give'); ?>"/>
351
+							<?php if ($donor->user_id) : ?>
352 352
 								<a href="#" class="give-lock-block">
353 353
 									<i class="give-icon give-icon-locked"></i>
354 354
 								</a>
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 									data-key="name"><?php echo $donor->name; ?></span></span>
359 359
 					</div>
360 360
 					<p class="donor-since info-item">
361
-						<?php _e( 'Donor since', 'give' ); ?>
362
-						<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
361
+						<?php _e('Donor since', 'give'); ?>
362
+						<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
363 363
 					</p>
364
-					<?php if ( current_user_can( $donor_edit_role ) ) : ?>
364
+					<?php if (current_user_can($donor_edit_role)) : ?>
365 365
 						<a href="#" id="edit-donor"
366
-						   class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
366
+						   class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
367 367
 					<?php endif; ?>
368 368
 				</div>
369 369
 				<!-- /donor-bio-header -->
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					<table class="widefat">
374 374
 						<tbody>
375 375
 						<tr class="alternate">
376
-							<th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th>
376
+							<th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th>
377 377
 							<td>
378 378
 									<span class="donor-user-id info-item edit-item">
379 379
 										<?php
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
 											'data'  => $data_atts,
391 391
 										);
392 392
 
393
-										if ( ! empty( $user_id ) ) {
394
-											$userdata              = get_userdata( $user_id );
393
+										if ( ! empty($user_id)) {
394
+											$userdata              = get_userdata($user_id);
395 395
 											$user_args['selected'] = $user_id;
396 396
 										}
397 397
 
398
-										echo Give()->html->ajax_user_search( $user_args );
398
+										echo Give()->html->ajax_user_search($user_args);
399 399
 										?>
400 400
 									</span>
401 401
 
402 402
 								<span class="donor-user-id info-item editable">
403
-										<?php if ( ! empty( $userdata ) ) : ?>
404
-											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
403
+										<?php if ( ! empty($userdata)) : ?>
404
+											<span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span>
405 405
 										<?php else: ?>
406
-											<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
406
+											<span data-key="user_id"><?php _e('None', 'give'); ?></span>
407 407
 										<?php endif; ?>
408
-									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
408
+									<?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0):
409 409
 
410 410
 										echo sprintf(
411 411
 											'- <span class="disconnect-user">
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 				                                       | <span class="view-user-profile">
415 415
  											                <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a>
416 416
  										               </span>',
417
-											__( 'Disconnects the current user ID from this donor record.', 'give' ),
418
-											__( 'Disconnect User', 'give' ),
419
-											'user-edit.php?user_id=' . $donor->user_id,
420
-											__( 'View User Profile of current user ID.', 'give' ),
421
-											__( 'View User Profile', 'give' )
417
+											__('Disconnects the current user ID from this donor record.', 'give'),
418
+											__('Disconnect User', 'give'),
419
+											'user-edit.php?user_id='.$donor->user_id,
420
+											__('View User Profile of current user ID.', 'give'),
421
+											__('View User Profile', 'give')
422 422
 										);
423 423
 
424 424
 										endif; ?>
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 
435 435
 			<span id="donor-edit-actions" class="edit-item">
436 436
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/>
437
-				<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?>
437
+				<?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?>
438 438
 				<input type="hidden" name="give_action" value="edit-donor"/>
439 439
 				<input type="submit" id="give-edit-donor-save" class="button-secondary"
440
-				       value="<?php _e( 'Update Donor', 'give' ); ?>"/>
441
-				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
440
+				       value="<?php _e('Update Donor', 'give'); ?>"/>
441
+				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
442 442
 			</span>
443 443
 
444 444
 		</form>
@@ -453,24 +453,24 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @param Give_Donor $donor The donor object being displayed.
455 455
 	 */
456
-	do_action( 'give_donor_before_stats', $donor );
456
+	do_action('give_donor_before_stats', $donor);
457 457
 	?>
458 458
 
459 459
 	<div id="donor-stats-wrapper" class="donor-section postbox clear">
460 460
 		<ul>
461 461
 			<li>
462
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor=' . absint( $donor->id ) ); ?>">
462
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor='.absint($donor->id)); ?>">
463 463
 					<span class="dashicons dashicons-heart"></span>
464 464
 					<?php
465 465
 					// Completed Donations.
466
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count );
467
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor );
466
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count);
467
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor);
468 468
 					?>
469 469
 				</a>
470 470
 			</li>
471 471
 			<li>
472 472
 				<span class="dashicons dashicons-chart-area"></span>
473
-				<?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
473
+				<?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?>
474 474
 			</li>
475 475
 			<?php
476 476
 			/**
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			 *
483 483
 			 * @param object $donor The donor object being displayed.
484 484
 			 */
485
-			do_action( 'give_donor_stats_list', $donor );
485
+			do_action('give_donor_stats_list', $donor);
486 486
 			?>
487 487
 		</ul>
488 488
 	</div>
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @param Give_Donor $donor The donor object being displayed.
497 497
 	 */
498
-	do_action( 'give_donor_before_address', $donor );
498
+	do_action('give_donor_before_address', $donor);
499 499
 	?>
500 500
 
501 501
 	<div id="donor-address-wrapper" class="donor-section clear">
502
-		<h3><?php _e( 'Addresses', 'give' ); ?></h3>
502
+		<h3><?php _e('Addresses', 'give'); ?></h3>
503 503
 
504 504
 		<div class="postbox">
505 505
 			<div class="give-spinner-wrapper">
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
 				<div class="all-address">
510 510
 					<div class="give-grid-row">
511 511
 						<?php
512
-						if ( ! empty( $donor->address ) ) :
512
+						if ( ! empty($donor->address)) :
513 513
 							// Default address always will be at zero array index.
514 514
 							$is_set_as_default = null;
515 515
 
516
-							foreach ( $donor->address as $address_type => $addresses ) {
516
+							foreach ($donor->address as $address_type => $addresses) {
517 517
 
518
-								switch ( true ) {
519
-									case is_array( end( $addresses ) ):
518
+								switch (true) {
519
+									case is_array(end($addresses)):
520 520
 										$index = 1;
521
-										foreach ( $addresses as $id => $address ) {
521
+										foreach ($addresses as $id => $address) {
522 522
 											echo __give_get_format_address(
523 523
 												$address,
524 524
 												array(
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
 												)
529 529
 											);
530 530
 
531
-											$index ++;
531
+											$index++;
532 532
 										}
533 533
 										break;
534 534
 
535
-									case is_string( end( $addresses ) ):
535
+									case is_string(end($addresses)):
536 536
 										echo __give_get_format_address(
537 537
 											$addresses,
538 538
 											array(
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
 						endif;
546 546
 						?>
547 547
 					</div>
548
-					<span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) {
548
+					<span class="give-no-address-message<?php if ( ! empty($donor->address)) {
549 549
 						echo ' give-hidden';
550 550
 					} ?>">
551
-						<?php _e( 'This donor does not have any addresses saved.', 'give' ); ?>
551
+						<?php _e('This donor does not have any addresses saved.', 'give'); ?>
552 552
 					</span>
553 553
 					<button class="button add-new-address">
554
-						<?php _e( 'Add Address', 'give' ); ?>
554
+						<?php _e('Add Address', 'give'); ?>
555 555
 					</button>
556 556
 				</div>
557 557
 
@@ -561,26 +561,26 @@  discard block
 block discarded – undo
561 561
 							<tbody>
562 562
 							<tr>
563 563
 								<th class="col">
564
-									<label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label>
564
+									<label class="country"><?php esc_html_e('Country:', 'give'); ?></label>
565 565
 								</th>
566 566
 								<td>
567 567
 									<?php
568
-									echo Give()->html->select( array(
568
+									echo Give()->html->select(array(
569 569
 										'options'          => give_get_country_list(),
570 570
 										'name'             => 'country',
571
-										'selected'         => give_get_option( 'base_country' ),
571
+										'selected'         => give_get_option('base_country'),
572 572
 										'show_option_all'  => false,
573 573
 										'show_option_none' => false,
574 574
 										'chosen'           => true,
575
-										'placeholder'      => esc_attr__( 'Select a country', 'give' ),
576
-										'data'             => array( 'search-type' => 'no_ajax' ),
577
-									) );
575
+										'placeholder'      => esc_attr__('Select a country', 'give'),
576
+										'data'             => array('search-type' => 'no_ajax'),
577
+									));
578 578
 									?>
579 579
 								</td>
580 580
 							</tr>
581 581
 							<tr>
582 582
 								<th class="col">
583
-									<label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
583
+									<label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label>
584 584
 								</th>
585 585
 								<td>
586 586
 									<input id="line1" name="line1" type="text" class="medium-text"/>
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 							</tr>
589 589
 							<tr>
590 590
 								<th class="col">
591
-									<label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
591
+									<label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label>
592 592
 								</th>
593 593
 								<td>
594 594
 									<input id="line2" type="text" name="line2" value="" class="medium-text"/>
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 							</tr>
598 598
 							<tr>
599 599
 								<th class="col">
600
-									<label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label>
600
+									<label for="city"><?php esc_html_e('City:', 'give'); ?></label>
601 601
 								</th>
602 602
 								<td>
603 603
 									<input id="city" type="text" name="city" value="" class="medium-text"/>
@@ -605,41 +605,41 @@  discard block
 block discarded – undo
605 605
 							</tr>
606 606
 							<?php
607 607
 							$no_states_country = give_no_states_country_list();
608
-							$base_country      = give_get_option( 'base_country' );
609
-							if ( ! array_key_exists( $base_country, $no_states_country ) ) {
608
+							$base_country      = give_get_option('base_country');
609
+							if ( ! array_key_exists($base_country, $no_states_country)) {
610 610
 								?>
611 611
 								<tr class="give-field-wrap">
612 612
 									<th class="col">
613
-										<label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
613
+										<label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
614 614
 									</th>
615 615
 									<td>
616 616
 										<?php
617
-										$states     = give_get_states( $base_country );
617
+										$states     = give_get_states($base_country);
618 618
 										$state_args = array(
619 619
 											'name'  => 'state',
620 620
 											'class' => 'regular-text',
621 621
 										);
622 622
 
623
-										if ( empty( $states ) ) {
623
+										if (empty($states)) {
624 624
 
625 625
 											// Show Text field, if empty states.
626
-											$state_args = wp_parse_args( $state_args, array(
627
-												'value' => give_get_option( 'base_state' ),
628
-											) );
629
-											echo Give()->html->text( $state_args );
626
+											$state_args = wp_parse_args($state_args, array(
627
+												'value' => give_get_option('base_state'),
628
+											));
629
+											echo Give()->html->text($state_args);
630 630
 										} else {
631 631
 
632 632
 											// Show Chosen DropDown, if states are not empty.
633
-											$state_args = wp_parse_args( $state_args, array(
633
+											$state_args = wp_parse_args($state_args, array(
634 634
 												'options'          => $states,
635
-												'selected'         => give_get_option( 'base_state' ),
635
+												'selected'         => give_get_option('base_state'),
636 636
 												'show_option_all'  => false,
637 637
 												'show_option_none' => false,
638 638
 												'chosen'           => true,
639
-												'placeholder'      => __( 'Select a state', 'give' ),
640
-												'data'             => array( 'search-type' => 'no_ajax' ),
641
-											) );
642
-											echo Give()->html->select( $state_args );
639
+												'placeholder'      => __('Select a state', 'give'),
640
+												'data'             => array('search-type' => 'no_ajax'),
641
+											));
642
+											echo Give()->html->select($state_args);
643 643
 										}
644 644
 										?>
645 645
 									</td>
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 							?>
650 650
 							<tr>
651 651
 								<th class="col">
652
-									<label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
652
+									<label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
653 653
 								</th>
654 654
 								<td>
655 655
 									<input id="zip" type="text" name="zip" value="" class="medium-text"/>
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
 							</tr>
658 658
 							<tr>
659 659
 								<td colspan="2">
660
-									<?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?>
660
+									<?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?>
661 661
 									<input type="hidden" name="address-action" value="add">
662 662
 									<input type="hidden" name="address-id" value="">
663 663
 									<input type="submit" class="button button-primary js-save"
664
-									       value="<?php _e( 'Save', 'give' ); ?>">&nbsp;&nbsp;<button
665
-											class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button>
664
+									       value="<?php _e('Save', 'give'); ?>">&nbsp;&nbsp;<button
665
+											class="button js-cancel"><?php _e('Cancel', 'give'); ?></button>
666 666
 								</td>
667 667
 							</tr>
668 668
 							</tbody>
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 *
682 682
 	 * @param Give_Donor $donor The donor object being displayed.
683 683
 	 */
684
-	do_action( 'give_donor_before_tables_wrapper', $donor );
684
+	do_action('give_donor_before_tables_wrapper', $donor);
685 685
 	?>
686 686
 
687 687
 	<div id="donor-tables-wrapper" class="donor-section">
@@ -694,46 +694,46 @@  discard block
 block discarded – undo
694 694
 		 *
695 695
 		 * @param object $donor The donor object being displayed.
696 696
 		 */
697
-		do_action( 'give_donor_before_tables', $donor );
697
+		do_action('give_donor_before_tables', $donor);
698 698
 		?>
699 699
 
700
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
700
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
701 701
 
702 702
 		<table class="wp-list-table widefat striped emails">
703 703
 			<thead>
704 704
 			<tr>
705
-				<th><?php _e( 'Email', 'give' ); ?></th>
706
-				<th><?php _e( 'Actions', 'give' ); ?></th>
705
+				<th><?php _e('Email', 'give'); ?></th>
706
+				<th><?php _e('Actions', 'give'); ?></th>
707 707
 			</tr>
708 708
 			</thead>
709 709
 
710 710
 			<tbody>
711
-			<?php if ( ! empty( $donor->emails ) ) { ?>
711
+			<?php if ( ! empty($donor->emails)) { ?>
712 712
 
713
-				<?php foreach ( $donor->emails as $key => $email ) : ?>
713
+				<?php foreach ($donor->emails as $key => $email) : ?>
714 714
 					<tr data-key="<?php echo $key; ?>">
715 715
 						<td>
716 716
 							<?php echo $email; ?>
717
-							<?php if ( 'primary' === $key ) : ?>
717
+							<?php if ('primary' === $key) : ?>
718 718
 								<span class="dashicons dashicons-star-filled primary-email-icon"></span>
719 719
 							<?php endif; ?>
720 720
 						</td>
721 721
 						<td>
722
-							<?php if ( 'primary' !== $key ) : ?>
722
+							<?php if ('primary' !== $key) : ?>
723 723
 								<?php
724
-								$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id );
725
-								$promote_url = wp_nonce_url( add_query_arg( array(
726
-									'email'       => rawurlencode( $email ),
724
+								$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id);
725
+								$promote_url = wp_nonce_url(add_query_arg(array(
726
+									'email'       => rawurlencode($email),
727 727
 									'give_action' => 'set_donor_primary_email',
728
-								), $base_url ), 'give-set-donor-primary-email' );
729
-								$remove_url  = wp_nonce_url( add_query_arg( array(
730
-									'email'       => rawurlencode( $email ),
728
+								), $base_url), 'give-set-donor-primary-email');
729
+								$remove_url = wp_nonce_url(add_query_arg(array(
730
+									'email'       => rawurlencode($email),
731 731
 									'give_action' => 'remove_donor_email',
732
-								), $base_url ), 'give-remove-donor-email' );
732
+								), $base_url), 'give-remove-donor-email');
733 733
 								?>
734
-								<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
734
+								<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
735 735
 								&nbsp;|&nbsp;
736
-								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
736
+								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
737 737
 							<?php endif; ?>
738 738
 						</td>
739 739
 					</tr>
@@ -743,14 +743,14 @@  discard block
 block discarded – undo
743 743
 					<td colspan="2" class="add-donor-email-td">
744 744
 						<div class="add-donor-email-wrapper">
745 745
 							<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/>
746
-							<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
746
+							<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
747 747
 							<input type="email" name="additional-email" value=""
748
-							       placeholder="<?php _e( 'Email Address', 'give' ); ?>"/>&nbsp;
748
+							       placeholder="<?php _e('Email Address', 'give'); ?>"/>&nbsp;
749 749
 							<input type="checkbox" name="make-additional-primary" value="1"
750 750
 							       id="make-additional-primary"/>&nbsp;<label
751
-									for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
751
+									for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
752 752
 							<button class="button-secondary give-add-donor-email"
753
-							        id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button>
753
+							        id="add-donor-email"><?php _e('Add Email', 'give'); ?></button>
754 754
 							<span class="spinner"></span>
755 755
 						</div>
756 756
 						<div class="notice-wrap"></div>
@@ -758,50 +758,50 @@  discard block
 block discarded – undo
758 758
 				</tr>
759 759
 			<?php } else { ?>
760 760
 				<tr>
761
-					<td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td>
761
+					<td colspan="2"><?php _e('No Emails Found', 'give'); ?></td>
762 762
 				</tr>
763 763
 			<?php }// End if().
764 764
 			?>
765 765
 			</tbody>
766 766
 		</table>
767 767
 
768
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
768
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
769 769
 		<?php
770
-		$payment_ids = explode( ',', $donor->payment_ids );
771
-		$payments    = give_get_payments( array(
770
+		$payment_ids = explode(',', $donor->payment_ids);
771
+		$payments    = give_get_payments(array(
772 772
 			'post__in' => $payment_ids,
773
-		) );
774
-		$payments    = array_slice( $payments, 0, 10 );
773
+		));
774
+		$payments    = array_slice($payments, 0, 10);
775 775
 		?>
776 776
 		<table class="wp-list-table widefat striped payments">
777 777
 			<thead>
778 778
 			<tr>
779
-				<th scope="col"><?php _e( 'ID', 'give' ); ?></th>
780
-				<th scope="col"><?php _e( 'Amount', 'give' ); ?></th>
781
-				<th scope="col"><?php _e( 'Date', 'give' ); ?></th>
782
-				<th scope="col"><?php _e( 'Status', 'give' ); ?></th>
783
-				<th scope="col"><?php _e( 'Actions', 'give' ); ?></th>
779
+				<th scope="col"><?php _e('ID', 'give'); ?></th>
780
+				<th scope="col"><?php _e('Amount', 'give'); ?></th>
781
+				<th scope="col"><?php _e('Date', 'give'); ?></th>
782
+				<th scope="col"><?php _e('Status', 'give'); ?></th>
783
+				<th scope="col"><?php _e('Actions', 'give'); ?></th>
784 784
 			</tr>
785 785
 			</thead>
786 786
 			<tbody>
787
-			<?php if ( ! empty( $payments ) ) { ?>
788
-				<?php foreach ( $payments as $payment ) : ?>
787
+			<?php if ( ! empty($payments)) { ?>
788
+				<?php foreach ($payments as $payment) : ?>
789 789
 					<tr>
790 790
 						<td><?php echo $payment->ID; ?></td>
791
-						<td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td>
792
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
793
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
791
+						<td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td>
792
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
793
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
794 794
 						<td>
795 795
 							<?php
796 796
 							printf(
797 797
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
798
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
798
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID),
799 799
 								sprintf(
800 800
 								/* translators: %s: Donation ID */
801
-									esc_attr__( 'View Donation %s.', 'give' ),
801
+									esc_attr__('View Donation %s.', 'give'),
802 802
 									$payment->ID
803 803
 								),
804
-								__( 'View Donation', 'give' )
804
+								__('View Donation', 'give')
805 805
 							);
806 806
 							?>
807 807
 
@@ -816,47 +816,47 @@  discard block
 block discarded – undo
816 816
 							 * @param object $donor   The donor object being displayed.
817 817
 							 * @param object $payment The payment object being displayed.
818 818
 							 */
819
-							do_action( 'give_donor_recent_purchases_actions', $donor, $payment );
819
+							do_action('give_donor_recent_purchases_actions', $donor, $payment);
820 820
 							?>
821 821
 						</td>
822 822
 					</tr>
823 823
 				<?php endforeach; ?>
824 824
 			<?php } else { ?>
825 825
 				<tr>
826
-					<td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td>
826
+					<td colspan="5"><?php _e('No donations found.', 'give'); ?></td>
827 827
 				</tr>
828 828
 			<?php }// End if().
829 829
 			?>
830 830
 			</tbody>
831 831
 		</table>
832 832
 
833
-		<h3><?php _e( 'Completed Forms', 'give' ); ?></h3>
833
+		<h3><?php _e('Completed Forms', 'give'); ?></h3>
834 834
 		<?php
835
-		$donations = give_get_users_completed_donations( $donor->email );
835
+		$donations = give_get_users_completed_donations($donor->email);
836 836
 		?>
837 837
 		<table class="wp-list-table widefat striped donations">
838 838
 			<thead>
839 839
 			<tr>
840
-				<th scope="col"><?php _e( 'Form', 'give' ); ?></th>
841
-				<th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th>
840
+				<th scope="col"><?php _e('Form', 'give'); ?></th>
841
+				<th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th>
842 842
 			</tr>
843 843
 			</thead>
844 844
 			<tbody>
845
-			<?php if ( ! empty( $donations ) ) { ?>
846
-				<?php foreach ( $donations as $donation ) : ?>
845
+			<?php if ( ! empty($donations)) { ?>
846
+				<?php foreach ($donations as $donation) : ?>
847 847
 					<tr>
848 848
 						<td><?php echo $donation->post_title; ?></td>
849 849
 						<td>
850 850
 							<?php
851 851
 							printf(
852 852
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
853
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
853
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
854 854
 								sprintf(
855 855
 								/* translators: %s: form name */
856
-									esc_attr__( 'View Form %s.', 'give' ),
856
+									esc_attr__('View Form %s.', 'give'),
857 857
 									$donation->post_title
858 858
 								),
859
-								__( 'View Form', 'give' )
859
+								__('View Form', 'give')
860 860
 							);
861 861
 							?>
862 862
 						</td>
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 				<?php endforeach; ?>
865 865
 			<?php } else { ?>
866 866
 				<tr>
867
-					<td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td>
867
+					<td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td>
868 868
 				</tr>
869 869
 			<?php } ?>
870 870
 			</tbody>
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		 *
879 879
 		 * @param object $donor The donor object being displayed.
880 880
 		 */
881
-		do_action( 'give_donor_after_tables', $donor );
881
+		do_action('give_donor_after_tables', $donor);
882 882
 		?>
883 883
 
884 884
 	</div>
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 	 *
892 892
 	 * @param object $donor The donor object being displayed.
893 893
 	 */
894
-	do_action( 'give_donor_card_bottom', $donor );
894
+	do_action('give_donor_card_bottom', $donor);
895 895
 
896 896
 }
897 897
 
@@ -904,31 +904,31 @@  discard block
 block discarded – undo
904 904
  *
905 905
  * @return void
906 906
  */
907
-function give_donor_notes_view( $donor ) {
907
+function give_donor_notes_view($donor) {
908 908
 
909
-	$paged       = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
910
-	$paged       = absint( $paged );
909
+	$paged       = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
910
+	$paged       = absint($paged);
911 911
 	$note_count  = $donor->get_notes_count();
912
-	$per_page    = apply_filters( 'give_donor_notes_per_page', 20 );
913
-	$total_pages = ceil( $note_count / $per_page );
914
-	$donor_notes = $donor->get_notes( $per_page, $paged );
912
+	$per_page    = apply_filters('give_donor_notes_per_page', 20);
913
+	$total_pages = ceil($note_count / $per_page);
914
+	$donor_notes = $donor->get_notes($per_page, $paged);
915 915
 	?>
916 916
 
917 917
 	<div id="donor-notes-wrapper">
918 918
 		<div class="donor-notes-header">
919
-			<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
919
+			<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
920 920
 		</div>
921
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
921
+		<h3><?php _e('Notes', 'give'); ?></h3>
922 922
 
923
-		<?php if ( 1 == $paged ) : ?>
923
+		<?php if (1 == $paged) : ?>
924 924
 			<div style="display: block; margin-bottom: 55px;">
925 925
 				<form id="give-add-donor-note" method="post"
926
-				      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>">
926
+				      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>">
927 927
 					<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea>
928 928
 					<br/>
929 929
 					<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/>
930 930
 					<input type="hidden" name="give_action" value="add-donor-note"/>
931
-					<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?>
931
+					<?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?>
932 932
 					<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/>
933 933
 				</form>
934 934
 			</div>
@@ -943,26 +943,26 @@  discard block
 block discarded – undo
943 943
 			'show_all' => true,
944 944
 		);
945 945
 
946
-		echo paginate_links( $pagination_args );
946
+		echo paginate_links($pagination_args);
947 947
 		?>
948 948
 
949 949
 		<div id="give-donor-notes" class="postbox">
950
-			<?php if ( count( $donor_notes ) > 0 ) { ?>
951
-				<?php foreach ( $donor_notes as $key => $note ) : ?>
950
+			<?php if (count($donor_notes) > 0) { ?>
951
+				<?php foreach ($donor_notes as $key => $note) : ?>
952 952
 					<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
953 953
 					<span class="note-content-wrap">
954
-						<?php echo stripslashes( $note ); ?>
954
+						<?php echo stripslashes($note); ?>
955 955
 					</span>
956 956
 					</div>
957 957
 				<?php endforeach; ?>
958 958
 			<?php } else { ?>
959 959
 				<div class="give-no-donor-notes">
960
-					<?php _e( 'No donor notes found.', 'give' ); ?>
960
+					<?php _e('No donor notes found.', 'give'); ?>
961 961
 				</div>
962 962
 			<?php } ?>
963 963
 		</div>
964 964
 
965
-		<?php echo paginate_links( $pagination_args ); ?>
965
+		<?php echo paginate_links($pagination_args); ?>
966 966
 
967 967
 	</div>
968 968
 
@@ -978,9 +978,9 @@  discard block
 block discarded – undo
978 978
  *
979 979
  * @return void
980 980
  */
981
-function give_donor_delete_view( $donor ) {
981
+function give_donor_delete_view($donor) {
982 982
 
983
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
983
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
984 984
 
985 985
 	/**
986 986
 	 * Fires in donor delete screen, above the content.
@@ -989,16 +989,16 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @param object $donor The donor object being displayed.
991 991
 	 */
992
-	do_action( 'give_donor_delete_top', $donor );
992
+	do_action('give_donor_delete_top', $donor);
993 993
 	?>
994 994
 
995 995
 	<div class="info-wrapper donor-section">
996 996
 
997 997
 		<form id="delete-donor" method="post"
998
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>">
998
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>">
999 999
 
1000 1000
 			<div class="donor-notes-header">
1001
-				<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
1001
+				<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
1002 1002
 			</div>
1003 1003
 
1004 1004
 
@@ -1006,20 +1006,20 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 				<span class="delete-donor-options">
1008 1008
 					<p>
1009
-						<?php echo Give()->html->checkbox( array(
1009
+						<?php echo Give()->html->checkbox(array(
1010 1010
 							'name' => 'give-donor-delete-confirm',
1011
-						) ); ?>
1012
-						<label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
1011
+						)); ?>
1012
+						<label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
1013 1013
 					</p>
1014 1014
 
1015 1015
 					<p>
1016
-						<?php echo Give()->html->checkbox( array(
1016
+						<?php echo Give()->html->checkbox(array(
1017 1017
 							'name'    => 'give-donor-delete-records',
1018 1018
 							'options' => array(
1019 1019
 								'disabled' => true,
1020 1020
 							),
1021
-						) ); ?>
1022
-						<label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label>
1021
+						)); ?>
1022
+						<label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label>
1023 1023
 					</p>
1024 1024
 
1025 1025
 					<?php
@@ -1032,19 +1032,19 @@  discard block
 block discarded – undo
1032 1032
 					 *
1033 1033
 					 * @param object $donor The donor object being displayed.
1034 1034
 					 */
1035
-					do_action( 'give_donor_delete_inputs', $donor );
1035
+					do_action('give_donor_delete_inputs', $donor);
1036 1036
 					?>
1037 1037
 				</span>
1038 1038
 
1039 1039
 				<span id="donor-edit-actions">
1040 1040
 					<input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/>
1041
-					<?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?>
1041
+					<?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?>
1042 1042
 					<input type="hidden" name="give_action" value="delete-donor"/>
1043 1043
 					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary"
1044
-					       value="<?php _e( 'Delete Donor', 'give' ); ?>"/>
1044
+					       value="<?php _e('Delete Donor', 'give'); ?>"/>
1045 1045
 					<a id="give-delete-donor-cancel"
1046
-					   href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"
1047
-					   class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
1046
+					   href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"
1047
+					   class="delete"><?php _e('Cancel', 'give'); ?></a>
1048 1048
 				</span>
1049 1049
 
1050 1050
 			</div>
@@ -1060,5 +1060,5 @@  discard block
 block discarded – undo
1060 1060
 	 *
1061 1061
 	 * @param object $donor The donor object being displayed.
1062 1062
 	 */
1063
-	do_action( 'give_donor_delete_bottom', $donor );
1063
+	do_action('give_donor_delete_bottom', $donor);
1064 1064
 }
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 								'disabled' => __( 'Disabled', 'give' ),
98 98
 							)
99 99
 						),
100
-                        array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
102
-                            'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
105
-                            'type'  => 'give_docs_link',
106
-                        ),
100
+						array(
101
+							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
102
+							'id'    => 'paypal_standard_gateway_settings_docs_link',
103
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
+							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
105
+							'type'  => 'give_docs_link',
106
+						),
107 107
 						array(
108 108
 							'type' => 'sectionend',
109 109
 							'id'   => 'give_title_gateway_settings_2',
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
 							'id'   => 'default_gateway',
184 184
 							'type' => 'default_gateway'
185 185
 						),
186
-                        array(
187
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
188
-                            'id'    => 'gateway_settings_docs_link',
189
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
190
-                            'title' => __( 'Gateway Settings', 'give' ),
191
-                            'type'  => 'give_docs_link',
192
-                        ),
186
+						array(
187
+							'name'  => __( 'Gateways Docs Link', 'give' ),
188
+							'id'    => 'gateway_settings_docs_link',
189
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
190
+							'title' => __( 'Gateway Settings', 'give' ),
191
+							'type'  => 'give_docs_link',
192
+						),
193 193
 						array(
194 194
 							'id'   => 'give_title_gateway_settings_1',
195 195
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'paypal-standard':
49 49
 					$settings = array(
50 50
 						// Section 2: PayPal Standard.
@@ -53,55 +53,55 @@  discard block
 block discarded – undo
53 53
 							'id'   => 'give_title_gateway_settings_2',
54 54
 						),
55 55
 						array(
56
-							'name' => __( 'PayPal Email', 'give' ),
57
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
56
+							'name' => __('PayPal Email', 'give'),
57
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
58 58
 							'id'   => 'paypal_email',
59 59
 							'type' => 'email',
60 60
 						),
61 61
 						array(
62
-							'name' => __( 'PayPal Page Style', 'give' ),
63
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
62
+							'name' => __('PayPal Page Style', 'give'),
63
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
64 64
 							'id'   => 'paypal_page_style',
65 65
 							'type' => 'text',
66 66
 						),
67 67
 						array(
68
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
69
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
68
+							'name'    => __('PayPal Transaction Type', 'give'),
69
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
70 70
 							'id'      => 'paypal_button_type',
71 71
 							'type'    => 'radio_inline',
72 72
 							'options' => array(
73
-								'donation' => __( 'Donation', 'give' ),
74
-								'standard' => __( 'Standard Transaction', 'give' )
73
+								'donation' => __('Donation', 'give'),
74
+								'standard' => __('Standard Transaction', 'give')
75 75
 							),
76 76
 							'default' => 'donation',
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Billing Details', 'give' ),
80
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
79
+							'name'    => __('Billing Details', 'give'),
80
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
81 81
 							'id'      => 'paypal_standard_billing_details',
82 82
 							'type'    => 'radio_inline',
83 83
 							'default' => 'disabled',
84 84
 							'options' => array(
85
-								'enabled'  => __( 'Enabled', 'give' ),
86
-								'disabled' => __( 'Disabled', 'give' ),
85
+								'enabled'  => __('Enabled', 'give'),
86
+								'disabled' => __('Disabled', 'give'),
87 87
 							)
88 88
 						),
89 89
 						array(
90
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
91
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
90
+							'name'    => __('PayPal IPN Verification', 'give'),
91
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
92 92
 							'id'      => 'paypal_verification',
93 93
 							'type'    => 'radio_inline',
94 94
 							'default' => 'enabled',
95 95
 							'options' => array(
96
-								'enabled'  => __( 'Enabled', 'give' ),
97
-								'disabled' => __( 'Disabled', 'give' ),
96
+								'enabled'  => __('Enabled', 'give'),
97
+								'disabled' => __('Disabled', 'give'),
98 98
 							)
99 99
 						),
100 100
                         array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
101
+                            'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
102 102
                             'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
103
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
104
+                            'title' => __('PayPal Standard Gateway Settings', 'give'),
105 105
                             'type'  => 'give_docs_link',
106 106
                         ),
107 107
 						array(
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 							'id'   => 'give_title_gateway_settings_3',
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Collect Billing Details', 'give' ),
123
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
122
+							'name'    => __('Collect Billing Details', 'give'),
123
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
124 124
 							'id'      => 'give_offline_donation_enable_billing_fields',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'disabled',
127 127
 							'options' => array(
128
-								'enabled'  => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' )
128
+								'enabled'  => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give')
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
134
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
133
+							'name'    => __('Offline Donation Instructions', 'give'),
134
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
135 135
 							'id'      => 'global_offline_donation_content',
136 136
 							'default' => give_get_default_offline_donation_content(),
137 137
 							'type'    => 'wysiwyg',
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 							)
141 141
 						),
142 142
 						array(
143
-							'name'  => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
143
+							'name'  => esc_html__('Offline Donations Settings Docs Link', 'give'),
144 144
 							'id'    => 'offline_gateway_settings_docs_link',
145
-							'url'   => esc_url( 'http://docs.givewp.com/offlinegateway' ),
146
-							'title' => __( 'Offline Gateway Settings', 'give' ),
145
+							'url'   => esc_url('http://docs.givewp.com/offlinegateway'),
146
+							'title' => __('Offline Gateway Settings', 'give'),
147 147
 							'type'  => 'give_docs_link',
148 148
 						),
149 149
 						array(
@@ -161,33 +161,33 @@  discard block
 block discarded – undo
161 161
 							'type' => 'title'
162 162
 						),
163 163
 						array(
164
-							'name'    => __( 'Test Mode', 'give' ),
165
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
164
+							'name'    => __('Test Mode', 'give'),
165
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
166 166
 							'id'      => 'test_mode',
167 167
 							'type'    => 'radio_inline',
168 168
 							'default' => 'disabled',
169 169
 							'options' => array(
170
-								'enabled'  => __( 'Enabled', 'give' ),
171
-								'disabled' => __( 'Disabled', 'give' ),
170
+								'enabled'  => __('Enabled', 'give'),
171
+								'disabled' => __('Disabled', 'give'),
172 172
 							)
173 173
 						),
174 174
 						array(
175
-							'name' => __( 'Enabled Gateways', 'give' ),
176
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
175
+							'name' => __('Enabled Gateways', 'give'),
176
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
177 177
 							'id'   => 'gateways',
178 178
 							'type' => 'enabled_gateways'
179 179
 						),
180 180
 						array(
181
-							'name' => __( 'Default Gateway', 'give' ),
182
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
181
+							'name' => __('Default Gateway', 'give'),
182
+							'desc' => __('The gateway that will be selected by default.', 'give'),
183 183
 							'id'   => 'default_gateway',
184 184
 							'type' => 'default_gateway'
185 185
 						),
186 186
                         array(
187
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
187
+                            'name'  => __('Gateways Docs Link', 'give'),
188 188
                             'id'    => 'gateway_settings_docs_link',
189
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
190
-                            'title' => __( 'Gateway Settings', 'give' ),
189
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
190
+                            'title' => __('Gateway Settings', 'give'),
191 191
                             'type'  => 'give_docs_link',
192 192
                         ),
193 193
 						array(
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			 * Filter the payment gateways settings.
203 203
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
204 204
 			 */
205
-			$settings = apply_filters( 'give_settings_gateways', $settings );
205
+			$settings = apply_filters('give_settings_gateways', $settings);
206 206
 
207 207
 			/**
208 208
 			 * Filter the settings.
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			 *
212 212
 			 * @param  array $settings
213 213
 			 */
214
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
214
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
215 215
 
216 216
 			// Output.
217 217
 			return $settings;
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 		 */
226 226
 		public function get_sections() {
227 227
 			$sections = array(
228
-				'gateways-settings' => __( 'Gateways', 'give' ),
229
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
230
-				'offline-donations' => __( 'Offline Donations', 'give' )
228
+				'gateways-settings' => __('Gateways', 'give'),
229
+				'paypal-standard'   => __('PayPal Standard', 'give'),
230
+				'offline-donations' => __('Offline Donations', 'give')
231 231
 			);
232 232
 
233
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
233
+			return apply_filters('give_get_sections_'.$this->id, $sections);
234 234
 		}
235 235
 	}
236 236
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-email.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Email' ) ) :
16
+if ( ! class_exists('Give_Settings_Email')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Email.
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'emails';
30
-			$this->label = esc_html__( 'Emails', 'give' );
30
+			$this->label = esc_html__('Emails', 'give');
31 31
 
32 32
 			$this->default_tab = 'email-settings';
33 33
 
34 34
 			parent::__construct();
35 35
 
36
-			add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) );
36
+			add_action('give_admin_field_email_notification', array($this, 'email_notification_setting'));
37 37
 		}
38 38
 
39 39
 		/**
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 			$settings        = array();
47 47
 			$current_section = give_get_current_setting_section();
48 48
 
49
-			switch ( $current_section ) {
49
+			switch ($current_section) {
50 50
 				case 'email-settings' :
51 51
 					$settings = array(
52 52
 
53 53
 						// Section 1: Email Notification Listing.
54 54
 						array(
55
-							'desc'       => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ),
55
+							'desc'       => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'),
56 56
 							'type'       => 'title',
57 57
 							'id'         => 'give_email_notification_settings',
58 58
 							'table_html' => false,
@@ -67,42 +67,42 @@  discard block
 block discarded – undo
67 67
 
68 68
 						// Section 2: Email Sender Setting
69 69
 						array(
70
-							'title' => __( 'Email Sender Options', 'give' ),
70
+							'title' => __('Email Sender Options', 'give'),
71 71
 							'id'    => 'give_title_email_settings_1',
72 72
 							'type'  => 'title',
73 73
 						),
74 74
 						array(
75 75
 							'id'      => 'email_template',
76
-							'name'    => esc_html__( 'Email Template', 'give' ),
77
-							'desc'    => esc_html__( 'Choose your template from the available registered template types.', 'give' ),
76
+							'name'    => esc_html__('Email Template', 'give'),
77
+							'desc'    => esc_html__('Choose your template from the available registered template types.', 'give'),
78 78
 							'type'    => 'select',
79 79
 							'options' => give_get_email_templates(),
80 80
 						),
81 81
 						array(
82 82
 							'id'   => 'email_logo',
83
-							'name' => esc_html__( 'Logo', 'give' ),
84
-							'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' ),
83
+							'name' => esc_html__('Logo', 'give'),
84
+							'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'),
85 85
 							'type' => 'file',
86 86
 						),
87 87
 						array(
88 88
 							'id'      => 'from_name',
89
-							'name'    => esc_html__( 'From Name', 'give' ),
90
-							'desc'    => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ),
91
-							'default' => get_bloginfo( 'name' ),
89
+							'name'    => esc_html__('From Name', 'give'),
90
+							'desc'    => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'),
91
+							'default' => get_bloginfo('name'),
92 92
 							'type'    => 'text',
93 93
 						),
94 94
 						array(
95 95
 							'id'      => 'from_email',
96
-							'name'    => esc_html__( 'From Email', 'give' ),
97
-							'desc'    => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ),
98
-							'default' => get_bloginfo( 'admin_email' ),
96
+							'name'    => esc_html__('From Email', 'give'),
97
+							'desc'    => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'),
98
+							'default' => get_bloginfo('admin_email'),
99 99
 							'type'    => 'text',
100 100
 						),
101 101
 						array(
102
-							'name'  => esc_html__( 'Donation Notification Settings Docs Link', 'give' ),
102
+							'name'  => esc_html__('Donation Notification Settings Docs Link', 'give'),
103 103
 							'id'    => 'donation_notification_settings_docs_link',
104
-							'url'   => esc_url( 'http://docs.givewp.com/settings-donation-notification' ),
105
-							'title' => __( 'Donation Notification Settings', 'give' ),
104
+							'url'   => esc_url('http://docs.givewp.com/settings-donation-notification'),
105
+							'title' => __('Donation Notification Settings', 'give'),
106 106
 							'type'  => 'give_docs_link',
107 107
 						),
108 108
 						array(
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			 * Filter the emails settings.
118 118
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
119 119
 			 */
120
-			$settings = apply_filters( 'give_settings_emails', $settings );
120
+			$settings = apply_filters('give_settings_emails', $settings);
121 121
 
122 122
 			/**
123 123
 			 * Filter the settings.
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @param  array $settings
128 128
 			 */
129
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
129
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
130 130
 
131 131
 			// Output.
132 132
 			return $settings;
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		 */
141 141
 		public function get_sections() {
142 142
 			$sections = array(
143
-				'email-settings' => esc_html__( 'Email Settings', 'give' ),
143
+				'email-settings' => esc_html__('Email Settings', 'give'),
144 144
 			);
145 145
 
146
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
146
+			return apply_filters('give_get_sections_'.$this->id, $sections);
147 147
 		}
148 148
 
149 149
 		/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		 */
155 155
 		public function email_notification_setting() {
156 156
 			// Load email notification table.
157
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php';
157
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php';
158 158
 
159 159
 			// Init table.
160 160
 			$email_notifications_table = new Give_Email_Notification_Table();
Please login to merge, or discard this patch.