Test Failed
Pull Request — master (#3324)
by Devin
07:59
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   +144 added lines, -144 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
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	public function get_payments() {
215 215
 		global $post;
216 216
 
217
-		$cache_key      = Give_Cache::get_key( 'give_payment_query', $this->args, false );
218
-		$this->payments = Give_Cache::get_db_query( $cache_key );
217
+		$cache_key      = Give_Cache::get_key('give_payment_query', $this->args, false);
218
+		$this->payments = Give_Cache::get_db_query($cache_key);
219 219
 
220 220
 		// Return cached result.
221
-		if ( ! is_null( $this->payments ) ) {
221
+		if ( ! is_null($this->payments)) {
222 222
 			return $this->payments;
223 223
 		}
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		// Modify the query/query arguments before we retrieve payments.
227 227
 		$this->set_filters();
228 228
 
229
-		$query          = new WP_Query( $this->args );
229
+		$query          = new WP_Query($this->args);
230 230
 		$this->payments = array();
231 231
 
232 232
 		$custom_output = array(
@@ -234,32 +234,32 @@  discard block
 block discarded – undo
234 234
 			'give_payments',
235 235
 		);
236 236
 
237
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
237
+		if ( ! in_array($this->args['output'], $custom_output)) {
238 238
 			return $query->posts;
239 239
 		}
240 240
 
241
-		if ( $query->have_posts() ) {
241
+		if ($query->have_posts()) {
242 242
 			$previous_post = $post;
243 243
 
244
-			while ( $query->have_posts() ) {
244
+			while ($query->have_posts()) {
245 245
 				$query->the_post();
246 246
 
247 247
 				$payment_id = get_post()->ID;
248
-				$payment    = new Give_Payment( $payment_id );
248
+				$payment    = new Give_Payment($payment_id);
249 249
 
250
-				$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
250
+				$this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this);
251 251
 			}
252 252
 
253 253
 			wp_reset_postdata();
254 254
 
255 255
 			// Prevent nest loop from producing unexpected results.
256
-			if( $previous_post instanceof WP_Post ) {
256
+			if ($previous_post instanceof WP_Post) {
257 257
 				$post = $previous_post;
258
-				setup_postdata( $post );
258
+				setup_postdata($post);
259 259
 			}
260 260
 		}
261 261
 
262
-		Give_Cache::set_db_query( $cache_key, $this->payments );
262
+		Give_Cache::set_db_query($cache_key, $this->payments);
263 263
 
264 264
 		// Remove query filters after we retrieve payments.
265 265
 		$this->unset_filters();
@@ -278,31 +278,31 @@  discard block
 block discarded – undo
278 278
 	public function get_payment_by_group() {
279 279
 		global $wpdb;
280 280
 
281
-		$allowed_groups = array( 'post_status' );
281
+		$allowed_groups = array('post_status');
282 282
 		$result         = array();
283 283
 
284 284
 
285
-		if ( in_array( $this->args['group_by'], $allowed_groups ) ) {
285
+		if (in_array($this->args['group_by'], $allowed_groups)) {
286 286
 			// Set only count in result.
287
-			if ( $this->args['count'] ) {
287
+			if ($this->args['count']) {
288 288
 
289 289
 				$this->set_filters();
290 290
 
291
-				$new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N );
291
+				$new_results = $wpdb->get_results($this->get_sql(), ARRAY_N);
292 292
 
293 293
 				$this->unset_filters();
294 294
 
295
-				foreach ( $new_results as $results ) {
296
-					$result[ $results[0] ] = $results[1];
295
+				foreach ($new_results as $results) {
296
+					$result[$results[0]] = $results[1];
297 297
 				}
298 298
 
299
-				switch ( $this->args['group_by'] ) {
299
+				switch ($this->args['group_by']) {
300 300
 					case 'post_status':
301 301
 
302 302
 						/* @var Give_Payment $donation */
303
-						foreach ( give_get_payment_status_keys() as $status ) {
304
-							if ( ! isset( $result[ $status ] ) ) {
305
-								$result[ $status ] = 0;
303
+						foreach (give_get_payment_status_keys() as $status) {
304
+							if ( ! isset($result[$status])) {
305
+								$result[$status] = 0;
306 306
 							}
307 307
 						}
308 308
 
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 				$donations = $this->get_payments();
313 313
 
314 314
 				/* @var $donation Give_Payment */
315
-				foreach ( $donations as $donation ) {
316
-					$result[ $donation->{$this->args['group_by']} ][] = $donation;
315
+				foreach ($donations as $donation) {
316
+					$result[$donation->{$this->args['group_by']}][] = $donation;
317 317
 				}
318 318
 			}
319 319
 		}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 		 *
325 325
 		 * @since 1.8.17
326 326
 		 */
327
-		return apply_filters( 'give_get_payment_by_group', $result, $this );
327
+		return apply_filters('give_get_payment_by_group', $result, $this);
328 328
 	}
329 329
 
330 330
 	/**
@@ -336,29 +336,29 @@  discard block
 block discarded – undo
336 336
 	 * @return void
337 337
 	 */
338 338
 	public function date_filter_pre() {
339
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
339
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
340 340
 			return;
341 341
 		}
342 342
 
343
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
344
-		$is_start_date = property_exists( __CLASS__, 'start_date' );
345
-		$is_end_date   = property_exists( __CLASS__, 'end_date' );
343
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
344
+		$is_start_date = property_exists(__CLASS__, 'start_date');
345
+		$is_end_date   = property_exists(__CLASS__, 'end_date');
346 346
 
347
-		if ( $is_start_date || $is_end_date ) {
347
+		if ($is_start_date || $is_end_date) {
348 348
 			$date_query = array();
349 349
 
350
-			if ( $is_start_date && ! is_wp_error( $this->start_date ) ) {
351
-				$date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date );
350
+			if ($is_start_date && ! is_wp_error($this->start_date)) {
351
+				$date_query['after'] = date('Y-m-d H:i:s', $this->start_date);
352 352
 			}
353 353
 
354
-			if ( $is_end_date && ! is_wp_error( $this->end_date ) ) {
355
-				$date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date );
354
+			if ($is_end_date && ! is_wp_error($this->end_date)) {
355
+				$date_query['before'] = date('Y-m-d H:i:s', $this->end_date);
356 356
 			}
357 357
 
358 358
 			// Include Start Date and End Date while querying.
359 359
 			$date_query['inclusive'] = true;
360 360
 
361
-			$this->__set( 'date_query', $date_query );
361
+			$this->__set('date_query', $date_query);
362 362
 
363 363
 		}
364 364
 	}
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @return void
373 373
 	 */
374 374
 	public function status() {
375
-		if ( ! isset( $this->args['status'] ) ) {
375
+		if ( ! isset($this->args['status'])) {
376 376
 			return;
377 377
 		}
378 378
 
379
-		$this->__set( 'post_status', $this->args['status'] );
380
-		$this->__unset( 'status' );
379
+		$this->__set('post_status', $this->args['status']);
380
+		$this->__unset('status');
381 381
 	}
382 382
 
383 383
 	/**
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @return void
390 390
 	 */
391 391
 	public function page() {
392
-		if ( ! isset( $this->args['page'] ) ) {
392
+		if ( ! isset($this->args['page'])) {
393 393
 			return;
394 394
 		}
395 395
 
396
-		$this->__set( 'paged', $this->args['page'] );
397
-		$this->__unset( 'page' );
396
+		$this->__set('paged', $this->args['page']);
397
+		$this->__unset('page');
398 398
 	}
399 399
 
400 400
 	/**
@@ -407,17 +407,17 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	public function per_page() {
409 409
 
410
-		if ( ! isset( $this->args['number'] ) ) {
410
+		if ( ! isset($this->args['number'])) {
411 411
 			return;
412 412
 		}
413 413
 
414
-		if ( $this->args['number'] == - 1 ) {
415
-			$this->__set( 'nopaging', true );
414
+		if ($this->args['number'] == - 1) {
415
+			$this->__set('nopaging', true);
416 416
 		} else {
417
-			$this->__set( 'posts_per_page', $this->args['number'] );
417
+			$this->__set('posts_per_page', $this->args['number']);
418 418
 		}
419 419
 
420
-		$this->__unset( 'number' );
420
+		$this->__unset('number');
421 421
 	}
422 422
 
423 423
 	/**
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 * @return void
430 430
 	 */
431 431
 	public function month() {
432
-		if ( ! isset( $this->args['month'] ) ) {
432
+		if ( ! isset($this->args['month'])) {
433 433
 			return;
434 434
 		}
435 435
 
436
-		$this->__set( 'monthnum', $this->args['month'] );
437
-		$this->__unset( 'month' );
436
+		$this->__set('monthnum', $this->args['month']);
437
+		$this->__unset('month');
438 438
 	}
439 439
 
440 440
 	/**
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 	 * @return void
447 447
 	 */
448 448
 	public function orderby() {
449
-		switch ( $this->args['orderby'] ) {
449
+		switch ($this->args['orderby']) {
450 450
 			case 'amount':
451
-				$this->__set( 'orderby', 'meta_value_num' );
452
-				$this->__set( 'meta_key', '_give_payment_total' );
451
+				$this->__set('orderby', 'meta_value_num');
452
+				$this->__set('meta_key', '_give_payment_total');
453 453
 				break;
454 454
 
455 455
 			case 'status':
456
-				$this->__set( 'orderby', 'post_status' );
456
+				$this->__set('orderby', 'post_status');
457 457
 				break;
458 458
 
459 459
 			case 'donation_form':
460
-				$this->__set( 'orderby', 'meta_value' );
461
-				$this->__set( 'meta_key', '_give_payment_form_title' );
460
+				$this->__set('orderby', 'meta_value');
461
+				$this->__set('meta_key', '_give_payment_form_title');
462 462
 				break;
463 463
 
464 464
 			default:
465
-				$this->__set( 'orderby', $this->args['orderby'] );
465
+				$this->__set('orderby', $this->args['orderby']);
466 466
 				break;
467 467
 		}
468 468
 	}
@@ -479,19 +479,19 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return mixed
481 481
 	 */
482
-	public function custom_orderby( $order, $query ) {
482
+	public function custom_orderby($order, $query) {
483 483
 
484
-		if ( ! empty( $query->query['post_type'] ) ) {
485
-			$post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] );
484
+		if ( ! empty($query->query['post_type'])) {
485
+			$post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']);
486 486
 
487
-			if ( ! in_array( 'give_payment', $post_types ) || ! isset( $query->query['orderby'] ) || is_array( $query->query['orderby'] ) ) {
487
+			if ( ! in_array('give_payment', $post_types) || ! isset($query->query['orderby']) || is_array($query->query['orderby'])) {
488 488
 				return $order;
489 489
 			}
490 490
 
491 491
 			global $wpdb;
492
-			switch ( $query->query['orderby'] ) {
492
+			switch ($query->query['orderby']) {
493 493
 				case 'post_status':
494
-					$order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] );
494
+					$order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']);
495 495
 					break;
496 496
 			}
497 497
 		}
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 * @return void
509 509
 	 */
510 510
 	public function user() {
511
-		if ( is_null( $this->args['user'] ) ) {
511
+		if (is_null($this->args['user'])) {
512 512
 			return;
513 513
 		}
514 514
 
515
-		if ( is_numeric( $this->args['user'] ) ) {
515
+		if (is_numeric($this->args['user'])) {
516 516
 			$user_key = '_give_payment_donor_id';
517 517
 		} else {
518 518
 			$user_key = '_give_payment_donor_email';
@@ -534,16 +534,16 @@  discard block
 block discarded – undo
534 534
 	 * @return  void
535 535
 	 */
536 536
 	public function donor() {
537
-		if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) {
537
+		if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) {
538 538
 			return;
539 539
 		}
540 540
 
541 541
 		$donor_meta_type = Give()->donor_meta->meta_type;
542 542
 
543
-		$this->__set( 'meta_query', array(
543
+		$this->__set('meta_query', array(
544 544
 			'key'   => "_give_payment_{$donor_meta_type}_id",
545 545
 			'value' => (int) $this->args['donor'],
546
-		) );
546
+		));
547 547
 	}
548 548
 
549 549
 	/**
@@ -556,33 +556,33 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public function search() {
558 558
 
559
-		if ( ! isset( $this->args['s'] ) ) {
559
+		if ( ! isset($this->args['s'])) {
560 560
 			return;
561 561
 		}
562 562
 
563
-		$search = trim( $this->args['s'] );
563
+		$search = trim($this->args['s']);
564 564
 
565
-		if ( empty( $search ) ) {
565
+		if (empty($search)) {
566 566
 			return;
567 567
 		}
568 568
 
569
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
570
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
569
+		$is_email = is_email($search) || strpos($search, '@') !== false;
570
+		$is_user  = strpos($search, strtolower('user:')) !== false;
571 571
 
572
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
572
+		if ( ! empty($this->args['search_in_notes'])) {
573 573
 
574
-			$notes = give_get_payment_notes( 0, $search );
574
+			$notes = give_get_payment_notes(0, $search);
575 575
 
576
-			if ( ! empty( $notes ) ) {
576
+			if ( ! empty($notes)) {
577 577
 
578
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
578
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
579 579
 
580
-				$this->__set( 'post__in', $payment_ids );
580
+				$this->__set('post__in', $payment_ids);
581 581
 			}
582 582
 
583
-			$this->__unset( 's' );
583
+			$this->__unset('s');
584 584
 
585
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
585
+		} elseif ($is_email || strlen($search) == 32) {
586 586
 
587 587
 			$key         = $is_email ? '_give_payment_donor_email' : '_give_payment_purchase_key';
588 588
 			$search_meta = array(
@@ -591,40 +591,40 @@  discard block
 block discarded – undo
591 591
 				'compare' => 'LIKE',
592 592
 			);
593 593
 
594
-			$this->__set( 'meta_query', $search_meta );
595
-			$this->__unset( 's' );
594
+			$this->__set('meta_query', $search_meta);
595
+			$this->__unset('s');
596 596
 
597
-		} elseif ( $is_user ) {
597
+		} elseif ($is_user) {
598 598
 
599 599
 			$search_meta = array(
600 600
 				'key'   => '_give_payment_donor_id',
601
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ),
601
+				'value' => trim(str_replace('user:', '', strtolower($search))),
602 602
 			);
603 603
 
604
-			$this->__set( 'meta_query', $search_meta );
604
+			$this->__set('meta_query', $search_meta);
605 605
 
606
-			$this->__unset( 's' );
606
+			$this->__unset('s');
607 607
 
608
-		} elseif ( is_numeric( $search ) ) {
608
+		} elseif (is_numeric($search)) {
609 609
 
610
-			$post = get_post( $search );
610
+			$post = get_post($search);
611 611
 
612
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
612
+			if (is_object($post) && $post->post_type == 'give_payment') {
613 613
 
614 614
 				$arr   = array();
615 615
 				$arr[] = $search;
616
-				$this->__set( 'post__in', $arr );
617
-				$this->__unset( 's' );
616
+				$this->__set('post__in', $arr);
617
+				$this->__unset('s');
618 618
 			}
619
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
619
+		} elseif ('#' == substr($search, 0, 1)) {
620 620
 
621
-			$search = str_replace( '#:', '', $search );
622
-			$search = str_replace( '#', '', $search );
623
-			$this->__set( 'give_forms', $search );
624
-			$this->__unset( 's' );
621
+			$search = str_replace('#:', '', $search);
622
+			$search = str_replace('#', '', $search);
623
+			$this->__set('give_forms', $search);
624
+			$this->__unset('s');
625 625
 
626 626
 		} else {
627
-			$this->__set( 's', $search );
627
+			$this->__set('s', $search);
628 628
 
629 629
 		}
630 630
 
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @return void
640 640
 	 */
641 641
 	public function mode() {
642
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
643
-			$this->__unset( 'mode' );
642
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
643
+			$this->__unset('mode');
644 644
 
645 645
 			return;
646 646
 		}
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
 	 * @return void
663 663
 	 */
664 664
 	public function children() {
665
-		if ( empty( $this->args['children'] ) ) {
666
-			$this->__set( 'post_parent', 0 );
665
+		if (empty($this->args['children'])) {
666
+			$this->__set('post_parent', 0);
667 667
 		}
668
-		$this->__unset( 'children' );
668
+		$this->__unset('children');
669 669
 	}
670 670
 
671 671
 	/**
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	 */
679 679
 	public function give_forms() {
680 680
 
681
-		if ( empty( $this->args['give_forms'] ) ) {
681
+		if (empty($this->args['give_forms'])) {
682 682
 			return;
683 683
 		}
684 684
 
685 685
 		$compare = '=';
686 686
 
687
-		if ( is_array( $this->args['give_forms'] ) ) {
687
+		if (is_array($this->args['give_forms'])) {
688 688
 			$compare = 'IN';
689 689
 		}
690 690
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			)
698 698
 		);
699 699
 
700
-		$this->__unset( 'give_forms' );
700
+		$this->__unset('give_forms');
701 701
 
702 702
 	}
703 703
 
@@ -711,13 +711,13 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function gateway_filter() {
713 713
 
714
-		if ( empty( $this->args['gateway'] ) ) {
714
+		if (empty($this->args['gateway'])) {
715 715
 			return;
716 716
 		}
717 717
 
718 718
 		$compare = '=';
719 719
 
720
-		if ( is_array( $this->args['gateway'] ) ) {
720
+		if (is_array($this->args['gateway'])) {
721 721
 			$compare = 'IN';
722 722
 		}
723 723
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 			)
732 732
 		);
733 733
 
734
-		$this->__unset( 'gateway' );
734
+		$this->__unset('gateway');
735 735
 
736 736
 	}
737 737
 
@@ -751,9 +751,9 @@  discard block
 block discarded – undo
751 751
 		global $wpdb;
752 752
 
753 753
 		$where = "WHERE {$wpdb->posts}.post_type = 'give_payment'";
754
-		$where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')";
754
+		$where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')";
755 755
 
756
-		if( is_numeric( $this->args['post_parent'] ) ) {
756
+		if (is_numeric($this->args['post_parent'])) {
757 757
 			$where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}";
758 758
 		}
759 759
 
@@ -762,42 +762,42 @@  discard block
 block discarded – undo
762 762
 		$group_by = '';
763 763
 
764 764
 		// Set group by.
765
-		if ( ! empty( $this->args['group_by'] ) ) {
765
+		if ( ! empty($this->args['group_by'])) {
766 766
 			$group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}";
767 767
 		}
768 768
 
769 769
 		// Set offset.
770 770
 		if (
771
-			empty( $this->args['nopaging'] ) &&
772
-			empty( $this->args['offset'] ) &&
773
-			( ! empty( $this->args['page'] ) && 0 < $this->args['page'] )
771
+			empty($this->args['nopaging']) &&
772
+			empty($this->args['offset']) &&
773
+			( ! empty($this->args['page']) && 0 < $this->args['page'])
774 774
 		) {
775
-			$this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 );
775
+			$this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1);
776 776
 		}
777 777
 
778 778
 		// Set fields.
779 779
 		$fields = "{$wpdb->posts}.*";
780
-		if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) {
781
-			if ( is_string( $this->args['fields'] ) ) {
780
+		if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) {
781
+			if (is_string($this->args['fields'])) {
782 782
 				$fields = "{$wpdb->posts}.{$this->args['fields']}";
783
-			} elseif ( is_array( $this->args['fields'] ) ) {
784
-				$fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] );
783
+			} elseif (is_array($this->args['fields'])) {
784
+				$fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']);
785 785
 			}
786 786
 		}
787 787
 
788 788
 		// Set count.
789
-		if ( ! empty( $this->args['count'] ) ) {
789
+		if ( ! empty($this->args['count'])) {
790 790
 			$fields = "COUNT({$wpdb->posts}.ID)";
791 791
 
792
-			if ( ! empty( $this->args['group_by'] ) ) {
792
+			if ( ! empty($this->args['group_by'])) {
793 793
 				$fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}";
794 794
 			}
795 795
 		}
796 796
 
797 797
 		// Date query.
798
-		if ( ! empty( $this->args['date_query'] ) ) {
799
-			$date_query_obj = new WP_Date_Query( $this->args['date_query'] );
800
-			$where          .= str_replace(
798
+		if ( ! empty($this->args['date_query'])) {
799
+			$date_query_obj = new WP_Date_Query($this->args['date_query']);
800
+			$where .= str_replace(
801 801
 				array(
802 802
 					"\n",
803 803
 					'(   (',
@@ -813,22 +813,22 @@  discard block
 block discarded – undo
813 813
 		}
814 814
 
815 815
 		// Meta query.
816
-		if ( ! empty( $this->args['meta_query'] ) ) {
817
-			$meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] );
818
-			$where          = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}";
819
-			$where          = Give()->payment_meta->__rename_meta_table_name( $where, 'posts_where' );
816
+		if ( ! empty($this->args['meta_query'])) {
817
+			$meta_query_obj = new WP_Meta_Query($this->args['meta_query']);
818
+			$where          = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}";
819
+			$where          = Give()->payment_meta->__rename_meta_table_name($where, 'posts_where');
820 820
 		}
821 821
 
822 822
 		// Set sql query.
823 823
 		$sql = $wpdb->prepare(
824 824
 			"SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;",
825
-			absint( $this->args['offset'] ),
826
-			( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 99999999999 )
825
+			absint($this->args['offset']),
826
+			(empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 99999999999)
827 827
 		);
828 828
 
829 829
 		// $where, $orderby and order already prepared query they can generate notice if you re prepare them in above.
830 830
 		// WordPress consider LIKE condition as placeholder if start with s,f, or d.
831
-		$sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql );
831
+		$sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql);
832 832
 
833 833
 		return $sql;
834 834
 	}
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-gateway-error-logs-list-table.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
50
-			'ajax'     => false,// Does this table support ajax?.
51
-		) );
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50
+			'ajax'     => false, // Does this table support ajax?.
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) );
71
+				return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id']));
72 72
 			case 'gateway' :
73
-				return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway'];
73
+				return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway'];
74 74
 			case 'error' :
75
-				return esc_html( $item['log_title'] );
75
+				return esc_html($item['log_title']);
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,35 +88,35 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) {
91
+	public function column_message($item) {
92 92
 		?>
93 93
 		<?php
94
-		echo Give()->tooltips->render_link( array(
95
-			'label'       => __( 'View Log Message', 'give' ),
94
+		echo Give()->tooltips->render_link(array(
95
+			'label'       => __('View Log Message', 'give'),
96 96
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
97 97
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-message-{$item['ID']}",
98 98
 			'attributes'  => array(
99 99
 				'class' => 'thickbox give-error-log-details-link button button-small',
100 100
 			),
101
-		) );
101
+		));
102 102
 		?>
103 103
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
104 104
 			<?php
105 105
 
106
-			$serialized = strpos( $item['log_content'], '{"' );
106
+			$serialized = strpos($item['log_content'], '{"');
107 107
 
108 108
 			// Check to see if the log message contains serialized information
109
-			if ( $serialized !== false ) {
110
-				$length = strlen( $item['log_content'] ) - $serialized;
111
-				$intro  = substr( $item['log_content'], 0, - $length );
112
-				$data   = substr( $item['log_content'], $serialized, strlen( $item['log_content'] ) - 1 );
109
+			if ($serialized !== false) {
110
+				$length = strlen($item['log_content']) - $serialized;
111
+				$intro  = substr($item['log_content'], 0, - $length);
112
+				$data   = substr($item['log_content'], $serialized, strlen($item['log_content']) - 1);
113 113
 
114
-				echo wpautop( $intro );
115
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
116
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
114
+				echo wpautop($intro);
115
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
116
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
117 117
 			} else {
118 118
 				// No serialized data found
119
-				echo wpautop( $item['log_content'] );
119
+				echo wpautop($item['log_content']);
120 120
 			}
121 121
 			?>
122 122
 		</div>
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function get_columns() {
134 134
 		$columns = array(
135
-			'ID'         => esc_html__( 'Log ID', 'give' ),
136
-			'error'      => esc_html__( 'Error', 'give' ),
137
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
138
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
139
-			'date'       => esc_html__( 'Date', 'give' ),
140
-			'message'    => esc_html__( 'Details', 'give' ),
135
+			'ID'         => esc_html__('Log ID', 'give'),
136
+			'error'      => esc_html__('Error', 'give'),
137
+			'gateway'    => esc_html__('Gateway', 'give'),
138
+			'payment_id' => esc_html__('Donation ID', 'give'),
139
+			'date'       => esc_html__('Date', 'give'),
140
+			'message'    => esc_html__('Details', 'give'),
141 141
 		);
142 142
 
143 143
 		return $columns;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @return int Current page number
152 152
 	 */
153 153
 	public function get_paged() {
154
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
154
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
155 155
 	}
156 156
 
157 157
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @since  1.0
162 162
 	 * @return void
163 163
 	 */
164
-	public function bulk_actions( $which = '' ) {
164
+	public function bulk_actions($which = '') {
165 165
 		give_log_views();
166 166
 	}
167 167
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	public function get_logs() {
177 177
 		// Prevent the queries from getting cached.
178 178
 		// Without this there are occasional memory issues for some installs.
179
-		wp_suspend_cache_addition( true );
179
+		wp_suspend_cache_addition(true);
180 180
 
181 181
 		$logs_data = array();
182 182
 		$paged     = $this->get_paged();
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
 			'posts_per_page' => $this->per_page,
187 187
 		);
188 188
 
189
-		$logs = Give()->logs->get_connected_logs( $log_query );
189
+		$logs = Give()->logs->get_connected_logs($log_query);
190 190
 
191
-		if ( $logs ) {
192
-			foreach ( $logs as $log ) {
191
+		if ($logs) {
192
+			foreach ($logs as $log) {
193 193
 
194 194
 				$logs_data[] = array(
195 195
 					'ID'          => $log->ID,
196
-					'ID_label'    => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
196
+					'ID_label'    => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
197 197
 					'payment_id'  => $log->log_parent,
198 198
 					'error'       => 'error',
199
-					'gateway'     => give_get_payment_gateway( $log->log_parent ),
199
+					'gateway'     => give_get_payment_gateway($log->log_parent),
200 200
 					'date'        => $log->log_date,
201 201
 					'log_content' => $log->log_content,
202 202
 					'log_title'   => $log->log_title,
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @param string $which
222 222
 	 */
223
-	protected function display_tablenav( $which ) {
224
-		if ( 'top' === $which ) {
225
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
223
+	protected function display_tablenav($which) {
224
+		if ('top' === $which) {
225
+			wp_nonce_field('bulk-'.$this->_args['plural']);
226 226
 		}
227 227
 		?>
228
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
228
+		<div class="tablenav <?php echo esc_attr($which); ?>">
229 229
 
230 230
 			<div class="alignleft actions bulkactions">
231
-				<?php $this->bulk_actions( $which ); ?>
231
+				<?php $this->bulk_actions($which); ?>
232 232
 			</div>
233 233
 			<?php
234
-			$this->extra_tablenav( $which );
235
-			$this->pagination( $which );
234
+			$this->extra_tablenav($which);
235
+			$this->pagination($which);
236 236
 			?>
237 237
 
238 238
 			<br class="clear"/>
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 		$columns               = $this->get_columns();
259 259
 		$hidden                = array(); // No hidden columns
260 260
 		$sortable              = $this->get_sortable_columns();
261
-		$this->_column_headers = array( $columns, $hidden, $sortable );
261
+		$this->_column_headers = array($columns, $hidden, $sortable);
262 262
 		$this->items           = $this->get_logs();
263
-		$total_items           = Give()->logs->get_log_count( 0, 'gateway_error' );
263
+		$total_items           = Give()->logs->get_log_count(0, 'gateway_error');
264 264
 
265
-		$this->set_pagination_args( array(
265
+		$this->set_pagination_args(array(
266 266
 				'total_items' => $total_items,
267 267
 				'per_page'    => $this->per_page,
268
-				'total_pages' => ceil( $total_items / $this->per_page ),
268
+				'total_pages' => ceil($total_items / $this->per_page),
269 269
 			)
270 270
 		);
271 271
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-email-access-email.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -175,10 +175,10 @@
 block discarded – undo
175 175
 		 */
176 176
 		public function get_default_email_message() {
177 177
 			$message = sprintf(
178
-				           __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ),
179
-				           get_bloginfo( 'url' ),
180
-				           get_bloginfo( 'admin_email' )
181
-			           ) . "\n\n";
178
+						   __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ),
179
+						   get_bloginfo( 'url' ),
180
+						   get_bloginfo( 'admin_email' )
181
+					   ) . "\n\n";
182 182
 			$message .= '{email_access_link}' . "\n\n";
183 183
 			$message .= "\n\n";
184 184
 			$message .= __( 'Sincerely,', 'give' ) . "\n";
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Email_Access_Email' ) ) :
18
+if ( ! class_exists('Give_Email_Access_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Email_Access_Email
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
 		 * @since  2.0
32 32
 		 */
33 33
 		public function init() {
34
-			$this->load( array(
34
+			$this->load(array(
35 35
 				'id'                           => 'email-access',
36
-				'label'                        => __( 'Email access', 'give' ),
37
-				'description'                  => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ),
38
-				'notification_status'          => give_get_option( 'email_access', 'disabled' ),
36
+				'label'                        => __('Email access', 'give'),
37
+				'description'                  => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'),
38
+				'notification_status'          => give_get_option('email_access', 'disabled'),
39 39
 				'form_metabox_setting'         => false,
40 40
 				'notification_status_editable' => false,
41 41
 				'email_tag_context'            => 'donor',
42
-				'recipient_group_name'         => __( 'Donor', 'give' ),
43
-				'default_email_subject'        => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ),
42
+				'recipient_group_name'         => __('Donor', 'give'),
43
+				'default_email_subject'        => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')),
44 44
 				'default_email_message'        => $this->get_default_email_message(),
45
-				'default_email_header'         => __( 'Confirm Email', 'give' ),
45
+				'default_email_header'         => __('Confirm Email', 'give'),
46 46
 				'notices' => array(
47 47
 					'non-notification-status-editable' => sprintf(
48 48
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
49
-						__( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ),
50
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control') ),
51
-						__( 'Edit Setting', 'give' )
49
+						__('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'),
50
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control')),
51
+						__('Edit Setting', 'give')
52 52
 					)
53 53
 				),
54
-			) );
54
+			));
55 55
 
56
-			add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 );
57
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
58
-			add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 );
56
+			add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2);
57
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
58
+			add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2);
59 59
 		}
60 60
 
61 61
 		/**
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 		 *
69 69
 		 * @return string
70 70
 		 */
71
-		public function get_email_subject( $form_id = null ) {
71
+		public function get_email_subject($form_id = null) {
72 72
 			$subject = wp_strip_all_tags(
73 73
 				Give_Email_Notification_Util::get_value(
74 74
 					$this,
75
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
75
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
76 76
 					$form_id,
77 77
 					$this->config['default_email_subject']
78 78
 				)
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 			 *
85 85
 			 * @since 1.0
86 86
 			 */
87
-			$subject = apply_filters( 'give_email_access_token_subject', $subject );
87
+			$subject = apply_filters('give_email_access_token_subject', $subject);
88 88
 
89 89
 			/**
90 90
 			 * Filters the donation notification subject.
91 91
 			 *
92 92
 			 * @since 2.0
93 93
 			 */
94
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
94
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
95 95
 
96 96
 			return $subject;
97 97
 		}
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 		 *
108 108
 		 * @return string
109 109
 		 */
110
-		public function get_email_message( $form_id = null ) {
110
+		public function get_email_message($form_id = null) {
111 111
 			$message = Give_Email_Notification_Util::get_value(
112 112
 				$this,
113
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
113
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
114 114
 				$form_id,
115 115
 				$this->config['default_email_message']
116 116
 			);
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 			 *
122 122
 			 * @since 1.0
123 123
 			 */
124
-			$message = apply_filters( 'give_email_access_token_message', $message );
124
+			$message = apply_filters('give_email_access_token_message', $message);
125 125
 
126 126
 			/**
127 127
 			 * Filter the email message
128 128
 			 *
129 129
 			 * @since 2.0
130 130
 			 */
131
-			$message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id );
131
+			$message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id);
132 132
 
133 133
 			return $message;
134 134
 		}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param int $form_id
144 144
 		 * @return array
145 145
 		 */
146
-		public function get_email_attachments( $form_id = null ) {
146
+		public function get_email_attachments($form_id = null) {
147 147
 			/**
148 148
 			 * Filters the donation notification email attachments.
149 149
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			 *
152 152
 			 * @since 1.0
153 153
 			 */
154
-			$attachments = apply_filters( 'give_admin_donation_notification_attachments', array() );
154
+			$attachments = apply_filters('give_admin_donation_notification_attachments', array());
155 155
 
156 156
 			/**
157 157
 			 * Filters the donation notification email attachments.
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			 *
160 160
 			 * @since 2.0
161 161
 			 */
162
-			$attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id );
162
+			$attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id);
163 163
 
164 164
 			return $attachments;
165 165
 		}
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 		 */
176 176
 		public function get_default_email_message() {
177 177
 			$message = sprintf(
178
-				           __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ),
179
-				           get_bloginfo( 'url' ),
180
-				           get_bloginfo( 'admin_email' )
181
-			           ) . "\n\n";
182
-			$message .= '{email_access_link}' . "\n\n";
178
+				           __('Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give'),
179
+				           get_bloginfo('url'),
180
+				           get_bloginfo('admin_email')
181
+			           )."\n\n";
182
+			$message .= '{email_access_link}'."\n\n";
183 183
 			$message .= "\n\n";
184
-			$message .= __( 'Sincerely,', 'give' ) . "\n";
185
-			$message .= get_bloginfo( 'name' ) . "\n";
184
+			$message .= __('Sincerely,', 'give')."\n";
185
+			$message .= get_bloginfo('name')."\n";
186 186
 
187 187
 			/**
188 188
 			 * Filter the new donation email message
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			 *
192 192
 			 * @param string $message
193 193
 			 */
194
-			return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this );
194
+			return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this);
195 195
 		}
196 196
 
197 197
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			 *
208 208
 			 * @since 1.0
209 209
 			 */
210
-			$from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() );
210
+			$from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name());
211 211
 
212 212
 			/**
213 213
 			 * Filters the from email.
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
 			 *
216 216
 			 * @since 1.0
217 217
 			 */
218
-			$from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() );
218
+			$from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address());
219 219
 
220
-			Give()->emails->__set( 'from_name', $from_name );
221
-			Give()->emails->__set( 'from_email', $from_email );
222
-			Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', $this->get_email_header() ) );
220
+			Give()->emails->__set('from_name', $from_name);
221
+			Give()->emails->__set('from_email', $from_email);
222
+			Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', $this->get_email_header()));
223 223
 			/**
224 224
 			 * Filters the donation notification email headers.
225 225
 			 *
226 226
 			 * @since 1.0
227 227
 			 */
228
-			$headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() );
228
+			$headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers());
229 229
 
230
-			Give()->emails->__set( 'headers', $headers );
230
+			Give()->emails->__set('headers', $headers);
231 231
 		}
232 232
 
233 233
 		/**
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		 *
242 242
 		 * @return bool
243 243
 		 */
244
-		public function setup_email_notification( $donor_id, $email ) {
245
-			$donor = Give()->donors->get_donor_by( 'email', $email );
244
+		public function setup_email_notification($donor_id, $email) {
245
+			$donor = Give()->donors->get_donor_by('email', $email);
246 246
 			$this->recipient_email = $email;
247 247
 
248 248
 			// Set email data.
@@ -267,17 +267,17 @@  discard block
 block discarded – undo
267 267
 		 * @param $update_options
268 268
 		 * @param $option_name
269 269
 		 */
270
-		public function set_notification_status( $update_options, $option_name ) {
270
+		public function set_notification_status($update_options, $option_name) {
271 271
 			// Get updated settings.
272 272
 			$update_options = give_get_settings();
273 273
 
274 274
 			if (
275
-				! empty( $update_options['email_access'] )
276
-				&& ! empty( $update_options[ "{$this->config['id']}_notification" ] )
277
-				&& $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ]
275
+				! empty($update_options['email_access'])
276
+				&& ! empty($update_options["{$this->config['id']}_notification"])
277
+				&& $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"]
278 278
 			) {
279
-				$update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access'];
280
-				update_option( $option_name, $update_options );
279
+				$update_options["{$this->config['id']}_notification"] = $update_options['email_access'];
280
+				update_option($option_name, $update_options);
281 281
 			}
282 282
 		}
283 283
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 		 * @param Give_Email_Access_Email $email
293 293
 		 * @return string
294 294
 		 */
295
-		public function email_preview_header( $email_preview_header, $email ) {
296
-			if( $this->config['id'] === $email->config['id'] ) {
295
+		public function email_preview_header($email_preview_header, $email) {
296
+			if ($this->config['id'] === $email->config['id']) {
297 297
 				$email_preview_header = '';
298 298
 			}
299 299
 
Please login to merge, or discard this patch.
includes/admin/emails/ajax-handler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
  * @since 2.0
17 17
  */
18 18
 function give_set_notification_status_handler() {
19
-	$notification_id = isset( $_POST['notification_id'] ) ? give_clean( $_POST['notification_id'] ) : '';
20
-	if ( ! empty( $notification_id ) && give_update_option( "{$notification_id}_notification", give_clean( $_POST['status'] ) ) ) {
19
+	$notification_id = isset($_POST['notification_id']) ? give_clean($_POST['notification_id']) : '';
20
+	if ( ! empty($notification_id) && give_update_option("{$notification_id}_notification", give_clean($_POST['status']))) {
21 21
 		wp_send_json_success();
22 22
 	}
23 23
 
24 24
 	wp_send_json_error();
25 25
 }
26 26
 
27
-add_action( 'wp_ajax_give_set_notification_status', 'give_set_notification_status_handler' );
27
+add_action('wp_ajax_give_set_notification_status', 'give_set_notification_status_handler');
Please login to merge, or discard this patch.
includes/admin/emails/backward-compatibility.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
  *
12 12
  * @return string
13 13
  */
14
-function _give_bc_offline_donation_instruction_notification_status( $notification_status, $email, $form_id ) {
14
+function _give_bc_offline_donation_instruction_notification_status($notification_status, $email, $form_id) {
15 15
 	// Bailout.
16
-	if ( ! $form_id ) {
16
+	if ( ! $form_id) {
17 17
 		return $notification_status;
18 18
 	}
19 19
 
20
-	if ( ! get_post_meta( $form_id, '_give_offline-donation-instruction_notification', true ) ) {
21
-		$old_value           = get_post_meta( $form_id, '_give_customize_offline_donations', true );
22
-		$notification_status = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) )
20
+	if ( ! get_post_meta($form_id, '_give_offline-donation-instruction_notification', true)) {
21
+		$old_value           = get_post_meta($form_id, '_give_customize_offline_donations', true);
22
+		$notification_status = give_is_setting_enabled($old_value, array('enabled', 'global'))
23 23
 			? $old_value
24 24
 			: 'global';
25 25
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	return $notification_status;
29 29
 }
30 30
 
31
-add_filter( 'give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3 );
31
+add_filter('give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3);
32 32
 
33 33
 
34 34
 /**
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return mixed
45 45
  */
46
-function _give_bc_offline_donation_instruction_email_setting_values( $option_value, $option_name, $email, $form_id ) {
46
+function _give_bc_offline_donation_instruction_email_setting_values($option_value, $option_name, $email, $form_id) {
47 47
 	// Bailout.
48
-	if ( empty( $form_id ) || 'offline-donation-instruction' !== $email->config['id'] ) {
48
+	if (empty($form_id) || 'offline-donation-instruction' !== $email->config['id']) {
49 49
 		return $option_value;
50 50
 	}
51 51
 
52
-	switch ( $option_name ) {
52
+	switch ($option_name) {
53 53
 		case '_give_offline-donation-instruction_email_message':
54
-			if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) {
55
-				$option_value = get_post_meta( $form_id, '_give_offline_donation_email', true );
54
+			if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) {
55
+				$option_value = get_post_meta($form_id, '_give_offline_donation_email', true);
56 56
 			}
57 57
 			break;
58 58
 
59 59
 		case '_give_offline-donation-instruction_email_subject':
60
-			if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) {
61
-				$option_value = get_post_meta( $form_id, '_give_offline_donation_subject', true );
60
+			if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) {
61
+				$option_value = get_post_meta($form_id, '_give_offline_donation_subject', true);
62 62
 			}
63 63
 			break;
64 64
 	}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	return $option_value;
67 67
 }
68 68
 
69
-add_filter( 'give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4 );
69
+add_filter('give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4);
70 70
 
71 71
 
72 72
 /**
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
  *
81 81
  * @return string
82 82
  */
83
-function _give_bc_offline_instruction_status_setting_value( $field_value, $field, $form_id ) {
84
-	if ( ! get_post_meta( $form_id, $field['id'], true ) ) {
85
-		$old_value   = get_post_meta( $form_id, '_give_customize_offline_donations', true );
86
-		$field_value = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) )
83
+function _give_bc_offline_instruction_status_setting_value($field_value, $field, $form_id) {
84
+	if ( ! get_post_meta($form_id, $field['id'], true)) {
85
+		$old_value   = get_post_meta($form_id, '_give_customize_offline_donations', true);
86
+		$field_value = give_is_setting_enabled($old_value, array('enabled', 'global'))
87 87
 			? $old_value
88 88
 			: 'global';
89 89
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	return $field_value;
92 92
 }
93 93
 
94
-add_filter( '_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3 );
94
+add_filter('_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3);
95 95
 
96 96
 
97 97
 /**
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return string
107 107
  */
108
-function _offline_donation_instruction_email_subject_setting_value( $field_value, $field, $form_id ) {
109
-	if ( ! get_post_meta( $form_id, $field['id'], true ) ) {
110
-		$field_value = get_post_meta( $form_id, '_give_offline_donation_subject', true );
108
+function _offline_donation_instruction_email_subject_setting_value($field_value, $field, $form_id) {
109
+	if ( ! get_post_meta($form_id, $field['id'], true)) {
110
+		$field_value = get_post_meta($form_id, '_give_offline_donation_subject', true);
111 111
 	}
112 112
 
113 113
 	return $field_value;
114 114
 }
115 115
 
116
-add_filter( '_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3 );
116
+add_filter('_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3);
117 117
 
118 118
 
119 119
 /**
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
  *
128 128
  * @return string
129 129
  */
130
-function _give_bc_offline_donation_instruction_email_message_setting_value( $field_value, $field, $form_id ) {
131
-	if ( ! get_post_meta( $form_id, $field['id'], true ) ) {
132
-		$field_value = get_post_meta( $form_id, '_give_offline_donation_email', true );
130
+function _give_bc_offline_donation_instruction_email_message_setting_value($field_value, $field, $form_id) {
131
+	if ( ! get_post_meta($form_id, $field['id'], true)) {
132
+		$field_value = get_post_meta($form_id, '_give_offline_donation_email', true);
133 133
 	}
134 134
 
135 135
 	return $field_value;
136 136
 }
137 137
 
138
-add_filter( '_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3 );
139 138
\ No newline at end of file
139
+add_filter('_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3);
140 140
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reports/reports.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly.
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
34 34
 	$views        = give_reports_default_views();
35 35
 	?>
36 36
 	<div class="wrap give-settings-page">
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 		<h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1>
39 39
 
40 40
 		<h2 class="nav-tab-wrapper">
41
-			<?php foreach ( $views as $tab => $label ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
41
+			<?php foreach ($views as $tab => $label) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => $tab,
44 44
 					'settings-updated' => false,
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a>
46 46
 			<?php } ?>
47
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
48
-				<a href="<?php echo esc_url( add_query_arg( array(
47
+			<?php if (current_user_can('export_give_reports')) { ?>
48
+				<a href="<?php echo esc_url(add_query_arg(array(
49 49
 					'tab'              => 'export',
50 50
 					'settings-updated' => false,
51
-				), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
51
+				), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
52 52
 			<?php }
53 53
 			/**
54 54
 			 * Fires in the report tabs.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			 *
58 58
 			 * @since 1.0
59 59
 			 */
60
-			do_action( 'give_reports_tabs' );
60
+			do_action('give_reports_tabs');
61 61
 			?>
62 62
 		</h2>
63 63
 
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.0
69 69
 		 */
70
-		do_action( 'give_reports_page_top' );
70
+		do_action('give_reports_page_top');
71 71
 
72 72
 		// Set $active_tab prior to hook firing.
73
-		if ( in_array( $active_tab, array_keys( $views ) ) ) {
73
+		if (in_array($active_tab, array_keys($views))) {
74 74
 			$active_tab = 'reports';
75 75
 		}
76 76
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @since 1.0
81 81
 		 */
82
-		do_action( "give_reports_tab_{$active_tab}" );
82
+		do_action("give_reports_tab_{$active_tab}");
83 83
 
84 84
 		/**
85 85
 		 * Fires after the report page.
86 86
 		 *
87 87
 		 * @since 1.0
88 88
 		 */
89
-		do_action( 'give_reports_page_bottom' );
89
+		do_action('give_reports_page_bottom');
90 90
 		?>
91 91
 	</div><!-- .wrap -->
92 92
 	<?php
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function give_reports_default_views() {
102 102
 	$views = array(
103
-		'earnings' => esc_html__( 'Income', 'give' ),
104
-		'forms'    => esc_html__( 'Forms', 'give' ),
105
-		'gateways' => esc_html__( 'Donation Methods', 'give' ),
103
+		'earnings' => esc_html__('Income', 'give'),
104
+		'forms'    => esc_html__('Forms', 'give'),
105
+		'gateways' => esc_html__('Donation Methods', 'give'),
106 106
 	);
107 107
 
108
-	$views = apply_filters( 'give_report_views', $views );
108
+	$views = apply_filters('give_report_views', $views);
109 109
 
110 110
 	return $views;
111 111
 }
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
  * @since 1.0
121 121
  * @return string $view Report View
122 122
  */
123
-function give_get_reporting_view( $default = 'earnings' ) {
123
+function give_get_reporting_view($default = 'earnings') {
124 124
 
125
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
125
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
126 126
 		$view = $default;
127 127
 	} else {
128 128
 		$view = $_GET['view'];
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_get_reporting_view', $view );
131
+	return apply_filters('give_get_reporting_view', $view);
132 132
 }
133 133
 
134 134
 /**
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function give_reports_tab_reports() {
141 141
 
142
-	if( ! current_user_can( 'view_give_reports' ) ) {
143
-		wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
142
+	if ( ! current_user_can('view_give_reports')) {
143
+		wp_die(__('You do not have permission to access this report', 'give'), __('Error', 'give'), array('response' => 403));
144 144
 	}
145 145
 
146 146
 	$current_view = 'earnings';
147 147
 	$views        = give_reports_default_views();
148 148
 
149
-	if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) {
149
+	if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) {
150 150
 		$current_view = $_GET['tab'];
151 151
 	}
152 152
 
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @since 1.0
157 157
 	 */
158
-	do_action( "give_reports_view_{$current_view}" );
158
+	do_action("give_reports_view_{$current_view}");
159 159
 }
160 160
 
161
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
161
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
162 162
 
163 163
 /**
164 164
  * Renders the Reports Page Views Drop Downs
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
  */
169 169
 function give_report_views() {
170 170
 	$views        = give_reports_default_views();
171
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
171
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
172 172
 	/**
173 173
 	 * Fires before the report page actions form.
174 174
 	 *
175 175
 	 * @since 1.0
176 176
 	 */
177
-	do_action( 'give_report_view_actions_before' );
177
+	do_action('give_report_view_actions_before');
178 178
 	?>
179 179
 	<form id="give-reports-filter" method="get">
180 180
 		<select id="give-reports-view" name="view">
181
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
182
-			<?php foreach ( $views as $view_id => $label ) : ?>
183
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
181
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
182
+			<?php foreach ($views as $view_id => $label) : ?>
183
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
184 184
 			<?php endforeach; ?>
185 185
 		</select>
186 186
 
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 		 *
193 193
 		 * @since 1.0
194 194
 		 */
195
-		do_action( 'give_report_view_actions' );
195
+		do_action('give_report_view_actions');
196 196
 		?>
197 197
 
198 198
 		<input type="hidden" name="post_type" value="give_forms"/>
199 199
 		<input type="hidden" name="page" value="give-reports"/>
200
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
200
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
201 201
 	</form>
202 202
 	<?php
203 203
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	do_action( 'give_report_view_actions_after' );
208
+	do_action('give_report_view_actions_after');
209 209
 }
210 210
 
211 211
 /**
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
  */
219 219
 function give_reports_forms_table() {
220 220
 
221
-	if ( isset( $_GET['form-id'] ) ) {
221
+	if (isset($_GET['form-id'])) {
222 222
 		return;
223 223
 	}
224 224
 
225
-	include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-form-reports-table.php';
225
+	include GIVE_PLUGIN_DIR.'includes/admin/reports/class-form-reports-table.php';
226 226
 
227 227
 	$give_table = new Give_Form_Reports_Table();
228 228
 	$give_table->prepare_items();
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	<?php
235 235
 }
236 236
 
237
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
237
+add_action('give_reports_view_forms', 'give_reports_forms_table');
238 238
 
239 239
 /**
240 240
  * Renders the detailed report for a specific give form.
@@ -243,20 +243,20 @@  discard block
 block discarded – undo
243 243
  * @return void
244 244
  */
245 245
 function give_reports_form_details() {
246
-	if ( ! isset( $_GET['form-id'] ) ) {
246
+	if ( ! isset($_GET['form-id'])) {
247 247
 		return;
248 248
 	}
249 249
 	?>
250 250
 	<div class="tablenav top reports-forms-details-wrap">
251 251
 		<div class="actions bulkactions">
252
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
252
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
253 253
 		</div>
254 254
 	</div>
255 255
 	<?php
256
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
256
+	give_reports_graph_of_form(absint($_GET['form-id']));
257 257
 }
258 258
 
259
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
259
+add_action('give_reports_view_forms', 'give_reports_form_details');
260 260
 
261 261
 /**
262 262
  * Renders the Gateways Table
@@ -267,14 +267,14 @@  discard block
 block discarded – undo
267 267
  * @return void
268 268
  */
269 269
 function give_reports_gateways_table() {
270
-	include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-gateways-reports-table.php';
270
+	include GIVE_PLUGIN_DIR.'includes/admin/reports/class-gateways-reports-table.php';
271 271
 
272 272
 	$give_table = new Give_Gateway_Reports_Table();
273 273
 	$give_table->prepare_items();
274 274
 	$give_table->display();
275 275
 }
276 276
 
277
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
277
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
278 278
 
279 279
 /**
280 280
  * Renders the Reports Earnings Graphs
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
 function give_reports_earnings() {
286 286
 	?>
287 287
 	<div class="tablenav top reports-table-nav">
288
-		<h2 class="reports-earnings-title screen-reader-text"><?php _e( 'Income Report', 'give' ); ?></h2>
288
+		<h2 class="reports-earnings-title screen-reader-text"><?php _e('Income Report', 'give'); ?></h2>
289 289
 	</div>
290 290
 	<?php
291 291
 	give_reports_graph();
292 292
 }
293 293
 
294
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
294
+add_action('give_reports_view_earnings', 'give_reports_earnings');
295 295
 
296 296
 
297 297
 /**
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
  */
303 303
 function give_estimated_monthly_stats() {
304 304
 
305
-	$estimated = Give_Cache::get( 'give_estimated_monthly_stats', true );
305
+	$estimated = Give_Cache::get('give_estimated_monthly_stats', true);
306 306
 
307
-	if ( false === $estimated ) {
307
+	if (false === $estimated) {
308 308
 
309 309
 		$estimated = array(
310 310
 			'earnings' => 0,
@@ -313,22 +313,22 @@  discard block
 block discarded – undo
313 313
 
314 314
 		$stats = new Give_Payment_Stats;
315 315
 
316
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
317
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
316
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
317
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
318 318
 
319
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
320
-		$current_month = date( 'n', current_time( 'timestamp' ) );
321
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
322
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
319
+		$current_day   = date('d', current_time('timestamp'));
320
+		$current_month = date('n', current_time('timestamp'));
321
+		$current_year  = date('Y', current_time('timestamp'));
322
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
323 323
 
324
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
325
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
324
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
325
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
326 326
 
327 327
 		// Cache for one day
328
-		Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true );
328
+		Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true);
329 329
 	}
330 330
 
331
-	return maybe_unserialize( $estimated );
331
+	return maybe_unserialize($estimated);
332 332
 }
333 333
 
334 334
 /**
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 function give_reports_set_form_method() {
342 342
 	return 'get';
343 343
 }
344
-add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 );
345
-add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 );
344
+add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10);
345
+add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10);
346 346
 
347 347
 // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file.
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -663,9 +663,12 @@  discard block
 block discarded – undo
663 663
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
664 664
 								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
665 665
 									<?php echo $form_data_tab['icon-html']; ?>
666
-								<?php else : ?>
666
+								<?php else {
667
+	: ?>
667 668
 									<span class="give-icon give-icon-default"></span>
668
-								<?php endif; ?>
669
+								<?php endif;
670
+}
671
+?>
669 672
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
670 673
 							</a>
671 674
 							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
@@ -675,9 +678,12 @@  discard block
 block discarded – undo
675 678
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
676 679
 												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
677 680
 													<?php echo $sub_tab['icon-html']; ?>
678
-												<?php else : ?>
681
+												<?php else {
682
+	: ?>
679 683
 													<span class="give-icon give-icon-default"></span>
680
-												<?php endif; ?>
684
+												<?php endif;
685
+}
686
+?>
681 687
 												<span class="give-label"><?php echo $sub_tab['label']; ?></span>
682 688
 											</a>
683 689
 										</li>
Please login to merge, or discard this patch.
Spacing   +326 added lines, -330 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = __( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = __('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 10);
56 56
 
57 57
 		// Save form meta.
58
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
58
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
59 59
 
60 60
 		// cmb2 old setting loaders.
61 61
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
62 62
 		// Add offline donations options.
63
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
63
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
64 64
 
65 65
 		// Maintain active tab query parameter after save.
66
-		add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 );
66
+		add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2);
67 67
 	}
68 68
 
69 69
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	function get_settings() {
89 89
 		$post_id           = give_get_admin_post_id();
90
-		$price_placeholder = give_format_decimal( '1.00', false, false );
90
+		$price_placeholder = give_format_decimal('1.00', false, false);
91 91
 
92 92
 		// Start with an underscore to hide fields from custom fields list
93 93
 		$prefix = '_give_';
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
 			/**
97 97
 			 * Repeatable Field Groups
98 98
 			 */
99
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
99
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
100 100
 				'id'        => 'form_field_options',
101
-				'title'     => __( 'Donation Options', 'give' ),
101
+				'title'     => __('Donation Options', 'give'),
102 102
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
103
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
103
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
104 104
 					// Donation Option.
105 105
 					array(
106
-						'name'        => __( 'Donation Option', 'give' ),
107
-						'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
108
-						'id'          => $prefix . 'price_option',
106
+						'name'        => __('Donation Option', 'give'),
107
+						'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
108
+						'id'          => $prefix.'price_option',
109 109
 						'type'        => 'radio_inline',
110 110
 						'default'     => 'multi',
111
-						'options'     => apply_filters( 'give_forms_price_options', array(
112
-							'multi' => __( 'Multi-level Donation', 'give' ),
113
-							'set'   => __( 'Set Donation', 'give' ),
114
-						) ),
111
+						'options'     => apply_filters('give_forms_price_options', array(
112
+							'multi' => __('Multi-level Donation', 'give'),
113
+							'set'   => __('Set Donation', 'give'),
114
+						)),
115 115
 					),
116 116
 					array(
117
-						'name'        => __( 'Set Donation', 'give' ),
118
-						'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
119
-						'id'          => $prefix . 'set_price',
117
+						'name'        => __('Set Donation', 'give'),
118
+						'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
119
+						'id'          => $prefix.'set_price',
120 120
 						'type'        => 'text_small',
121 121
 						'data_type'   => 'price',
122 122
 						'attributes'  => array(
@@ -126,34 +126,34 @@  discard block
 block discarded – undo
126 126
 					),
127 127
 					// Display Style.
128 128
 					array(
129
-						'name'          => __( 'Display Style', 'give' ),
130
-						'description'   => __( 'Set how the donations levels will display on the form.', 'give' ),
131
-						'id'            => $prefix . 'display_style',
129
+						'name'          => __('Display Style', 'give'),
130
+						'description'   => __('Set how the donations levels will display on the form.', 'give'),
131
+						'id'            => $prefix.'display_style',
132 132
 						'type'          => 'radio_inline',
133 133
 						'default'       => 'buttons',
134 134
 						'options'       => array(
135
-							'buttons'  => __( 'Buttons', 'give' ),
136
-							'radios'   => __( 'Radios', 'give' ),
137
-							'dropdown' => __( 'Dropdown', 'give' ),
135
+							'buttons'  => __('Buttons', 'give'),
136
+							'radios'   => __('Radios', 'give'),
137
+							'dropdown' => __('Dropdown', 'give'),
138 138
 						),
139 139
 						'wrapper_class' => 'give-hidden',
140 140
 					),
141 141
 					// Custom Amount.
142 142
 					array(
143
-						'name'        => __( 'Custom Amount', 'give' ),
144
-						'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
145
-						'id'          => $prefix . 'custom_amount',
143
+						'name'        => __('Custom Amount', 'give'),
144
+						'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
145
+						'id'          => $prefix.'custom_amount',
146 146
 						'type'        => 'radio_inline',
147 147
 						'default'     => 'disabled',
148 148
 						'options'     => array(
149
-							'enabled'  => __( 'Enabled', 'give' ),
150
-							'disabled' => __( 'Disabled', 'give' ),
149
+							'enabled'  => __('Enabled', 'give'),
150
+							'disabled' => __('Disabled', 'give'),
151 151
 						),
152 152
 					),
153 153
 					array(
154
-						'name'          => __( 'Donation Limit', 'give' ),
155
-						'description'   => __( 'Set the minimum and maximum amount for all gateways.', 'give' ),
156
-						'id'            => $prefix . 'custom_amount_range',
154
+						'name'          => __('Donation Limit', 'give'),
155
+						'description'   => __('Set the minimum and maximum amount for all gateways.', 'give'),
156
+						'id'            => $prefix.'custom_amount_range',
157 157
 						'type'          => 'donation_limit',
158 158
 						'wrapper_class' => 'give-hidden',
159 159
 						'data_type'     => 'price',
@@ -162,43 +162,43 @@  discard block
 block discarded – undo
162 162
 							'class'       => 'give-money-field',
163 163
 						),
164 164
 						'options'       => array(
165
-							'display_label' => __( 'Donation Limits: ', 'give' ),
165
+							'display_label' => __('Donation Limits: ', 'give'),
166 166
 							'minimum'       => 1.00,
167 167
 							'maximum'       => 999999.99,
168 168
 						),
169 169
 					),
170 170
 					array(
171
-						'name'          => __( 'Custom Amount Text', 'give' ),
172
-						'description'   => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
173
-						'id'            => $prefix . 'custom_amount_text',
171
+						'name'          => __('Custom Amount Text', 'give'),
172
+						'description'   => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
173
+						'id'            => $prefix.'custom_amount_text',
174 174
 						'type'          => 'text_medium',
175 175
 						'attributes'    => array(
176 176
 							'rows'        => 3,
177
-							'placeholder' => __( 'Give a Custom Amount', 'give' ),
177
+							'placeholder' => __('Give a Custom Amount', 'give'),
178 178
 						),
179 179
 						'wrapper_class' => 'give-hidden',
180 180
 					),
181 181
 					// Donation Levels.
182 182
 					array(
183
-						'id'            => $prefix . 'donation_levels',
183
+						'id'            => $prefix.'donation_levels',
184 184
 						'type'          => 'group',
185 185
 						'options'       => array(
186
-							'add_button'    => __( 'Add Level', 'give' ),
187
-							'header_title'  => __( 'Donation Level', 'give' ),
186
+							'add_button'    => __('Add Level', 'give'),
187
+							'header_title'  => __('Donation Level', 'give'),
188 188
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
189 189
 						),
190 190
 						'wrapper_class' => 'give-hidden',
191 191
 						// Fields array works the same, except id's only need to be unique for this group.
192 192
 						// Prefix is not needed.
193
-						'fields'        => apply_filters( 'give_donation_levels_table_row', array(
193
+						'fields'        => apply_filters('give_donation_levels_table_row', array(
194 194
 							array(
195
-								'name' => __( 'ID', 'give' ),
196
-								'id'   => $prefix . 'id',
195
+								'name' => __('ID', 'give'),
196
+								'id'   => $prefix.'id',
197 197
 								'type' => 'levels_id',
198 198
 							),
199 199
 							array(
200
-								'name'       => __( 'Amount', 'give' ),
201
-								'id'         => $prefix . 'amount',
200
+								'name'       => __('Amount', 'give'),
201
+								'id'         => $prefix.'amount',
202 202
 								'type'       => 'text_small',
203 203
 								'data_type'  => 'price',
204 204
 								'attributes' => array(
@@ -207,126 +207,126 @@  discard block
 block discarded – undo
207 207
 								),
208 208
 							),
209 209
 							array(
210
-								'name'       => __( 'Text', 'give' ),
211
-								'id'         => $prefix . 'text',
210
+								'name'       => __('Text', 'give'),
211
+								'id'         => $prefix.'text',
212 212
 								'type'       => 'text',
213 213
 								'attributes' => array(
214
-									'placeholder' => __( 'Donation Level', 'give' ),
214
+									'placeholder' => __('Donation Level', 'give'),
215 215
 									'class'       => 'give-multilevel-text-field',
216 216
 								),
217 217
 							),
218 218
 							array(
219
-								'name' => __( 'Default', 'give' ),
220
-								'id'   => $prefix . 'default',
219
+								'name' => __('Default', 'give'),
220
+								'id'   => $prefix.'default',
221 221
 								'type' => 'give_default_radio_inline',
222 222
 							),
223
-						) ),
223
+						)),
224 224
 					),
225 225
 					array(
226 226
 						'name'  => 'donation_options_docs',
227 227
 						'type'  => 'docs_link',
228 228
 						'url'   => 'http://docs.givewp.com/form-donation-options',
229
-						'title' => __( 'Donation Options', 'give' ),
229
+						'title' => __('Donation Options', 'give'),
230 230
 					),
231 231
 				),
232 232
 					$post_id
233 233
 				),
234
-			) ),
234
+			)),
235 235
 
236 236
 			/**
237 237
 			 * Display Options
238 238
 			 */
239
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
239
+			'form_display_options'  => apply_filters('give_form_display_options', array(
240 240
 					'id'        => 'form_display_options',
241
-					'title'     => __( 'Form Display', 'give' ),
241
+					'title'     => __('Form Display', 'give'),
242 242
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
243
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
243
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
244 244
 						array(
245
-							'name'    => __( 'Display Options', 'give' ),
246
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
247
-							'id'      => $prefix . 'payment_display',
245
+							'name'    => __('Display Options', 'give'),
246
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
247
+							'id'      => $prefix.'payment_display',
248 248
 							'type'    => 'radio_inline',
249 249
 							'options' => array(
250
-								'onpage' => __( 'All Fields', 'give' ),
251
-								'modal'  => __( 'Modal', 'give' ),
252
-								'reveal' => __( 'Reveal', 'give' ),
253
-								'button' => __( 'Button', 'give' ),
250
+								'onpage' => __('All Fields', 'give'),
251
+								'modal'  => __('Modal', 'give'),
252
+								'reveal' => __('Reveal', 'give'),
253
+								'button' => __('Button', 'give'),
254 254
 							),
255 255
 							'default' => 'onpage',
256 256
 						),
257 257
 						array(
258
-							'id'            => $prefix . 'reveal_label',
259
-							'name'          => __( 'Continue Button', 'give' ),
260
-							'desc'          => __( 'The button label for displaying the additional payment fields.', 'give' ),
258
+							'id'            => $prefix.'reveal_label',
259
+							'name'          => __('Continue Button', 'give'),
260
+							'desc'          => __('The button label for displaying the additional payment fields.', 'give'),
261 261
 							'type'          => 'text_small',
262 262
 							'attributes'    => array(
263
-								'placeholder' => __( 'Donate Now', 'give' ),
263
+								'placeholder' => __('Donate Now', 'give'),
264 264
 							),
265 265
 							'wrapper_class' => 'give-hidden',
266 266
 						),
267 267
 						array(
268
-							'id'         => $prefix . 'checkout_label',
269
-							'name'       => __( 'Submit Button', 'give' ),
270
-							'desc'       => __( 'The button label for completing a donation.', 'give' ),
268
+							'id'         => $prefix.'checkout_label',
269
+							'name'       => __('Submit Button', 'give'),
270
+							'desc'       => __('The button label for completing a donation.', 'give'),
271 271
 							'type'       => 'text_small',
272 272
 							'attributes' => array(
273
-								'placeholder' => __( 'Donate Now', 'give' ),
273
+								'placeholder' => __('Donate Now', 'give'),
274 274
 							),
275 275
 						),
276 276
 						array(
277
-							'name' => __( 'Default Gateway', 'give' ),
278
-							'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
279
-							'id'   => $prefix . 'default_gateway',
277
+							'name' => __('Default Gateway', 'give'),
278
+							'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
279
+							'id'   => $prefix.'default_gateway',
280 280
 							'type' => 'default_gateway',
281 281
 						),
282 282
 						array(
283
-							'name'    => __( 'Company Donations', 'give' ),
284
-							'desc'    => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ),
285
-							'id'      => $prefix . 'company_field',
283
+							'name'    => __('Company Donations', 'give'),
284
+							'desc'    => __('Do you want a Company field to appear after First Name and Last Name?', 'give'),
285
+							'id'      => $prefix.'company_field',
286 286
 							'type'    => 'radio_inline',
287 287
 							'default' => 'global',
288 288
 							'options' => array(
289
-								'global' => __( 'Global Option', 'give' ),
290
-								'required' => __( 'Required', 'give' ),
291
-								'optional' => __( 'Optional', 'give' ),
292
-								'disabled' => __( 'Disabled', 'give' ),
289
+								'global' => __('Global Option', 'give'),
290
+								'required' => __('Required', 'give'),
291
+								'optional' => __('Optional', 'give'),
292
+								'disabled' => __('Disabled', 'give'),
293 293
 
294 294
 							),
295 295
 						),
296 296
 						array(
297
-							'name'    => __( 'Guest Donations', 'give' ),
298
-							'desc'    => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
299
-							'id'      => $prefix . 'logged_in_only',
297
+							'name'    => __('Guest Donations', 'give'),
298
+							'desc'    => __('Do you want to allow non-logged-in users to make donations?', 'give'),
299
+							'id'      => $prefix.'logged_in_only',
300 300
 							'type'    => 'radio_inline',
301 301
 							'default' => 'enabled',
302 302
 							'options' => array(
303
-								'enabled'  => __( 'Enabled', 'give' ),
304
-								'disabled' => __( 'Disabled', 'give' ),
303
+								'enabled'  => __('Enabled', 'give'),
304
+								'disabled' => __('Disabled', 'give'),
305 305
 							),
306 306
 						),
307 307
 						array(
308
-							'name'    => __( 'Registration', 'give' ),
309
-							'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
310
-							'id'      => $prefix . 'show_register_form',
308
+							'name'    => __('Registration', 'give'),
309
+							'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
310
+							'id'      => $prefix.'show_register_form',
311 311
 							'type'    => 'radio',
312 312
 							'options' => array(
313
-								'none'         => __( 'None', 'give' ),
314
-								'registration' => __( 'Registration', 'give' ),
315
-								'login'        => __( 'Login', 'give' ),
316
-								'both'         => __( 'Registration + Login', 'give' ),
313
+								'none'         => __('None', 'give'),
314
+								'registration' => __('Registration', 'give'),
315
+								'login'        => __('Login', 'give'),
316
+								'both'         => __('Registration + Login', 'give'),
317 317
 							),
318 318
 							'default' => 'none',
319 319
 						),
320 320
 						array(
321
-							'name'    => __( 'Floating Labels', 'give' ),
321
+							'name'    => __('Floating Labels', 'give'),
322 322
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
323
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
324
-							'id'      => $prefix . 'form_floating_labels',
323
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
324
+							'id'      => $prefix.'form_floating_labels',
325 325
 							'type'    => 'radio_inline',
326 326
 							'options' => array(
327
-								'global'   => __( 'Global Option', 'give' ),
328
-								'enabled'  => __( 'Enabled', 'give' ),
329
-								'disabled' => __( 'Disabled', 'give' ),
327
+								'global'   => __('Global Option', 'give'),
328
+								'enabled'  => __('Enabled', 'give'),
329
+								'disabled' => __('Disabled', 'give'),
330 330
 							),
331 331
 							'default' => 'global',
332 332
 						),
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 							'name'  => 'form_display_docs',
335 335
 							'type'  => 'docs_link',
336 336
 							'url'   => 'http://docs.givewp.com/form-display-options',
337
-							'title' => __( 'Form Display', 'give' ),
337
+							'title' => __('Form Display', 'give'),
338 338
 						),
339 339
 					),
340 340
 						$post_id
@@ -345,42 +345,42 @@  discard block
 block discarded – undo
345 345
 			/**
346 346
 			 * Donation Goals
347 347
 			 */
348
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
348
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
349 349
 				'id'        => 'donation_goal_options',
350
-				'title'     => __( 'Donation Goal', 'give' ),
350
+				'title'     => __('Donation Goal', 'give'),
351 351
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
352
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
352
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
353 353
 					// Goals
354 354
 					array(
355
-						'name'        => __( 'Donation Goal', 'give' ),
356
-						'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
357
-						'id'          => $prefix . 'goal_option',
355
+						'name'        => __('Donation Goal', 'give'),
356
+						'description' => __('Do you want to set a donation goal for this form?', 'give'),
357
+						'id'          => $prefix.'goal_option',
358 358
 						'type'        => 'radio_inline',
359 359
 						'default'     => 'disabled',
360 360
 						'options'     => array(
361
-							'enabled'  => __( 'Enabled', 'give' ),
362
-							'disabled' => __( 'Disabled', 'give' ),
361
+							'enabled'  => __('Enabled', 'give'),
362
+							'disabled' => __('Disabled', 'give'),
363 363
 						),
364 364
 					),
365 365
 
366 366
 					array(
367
-						'name'        => __( 'Goal Format', 'give' ),
368
-						'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ),
369
-						'id'          => $prefix . 'goal_format',
367
+						'name'        => __('Goal Format', 'give'),
368
+						'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give'),
369
+						'id'          => $prefix.'goal_format',
370 370
 						'type'        => 'donation_form_goal',
371 371
 						'default'     => 'amount',
372 372
 						'options'     => array(
373
-							'amount'     => __( 'Amount Raised', 'give' ),
374
-							'percentage' => __( 'Percentage Raised', 'give' ),
375
-							'donation'   => __( 'Number of Donations', 'give' ),
376
-							'donors'     => __( 'Number of Donors', 'give' ),
373
+							'amount'     => __('Amount Raised', 'give'),
374
+							'percentage' => __('Percentage Raised', 'give'),
375
+							'donation'   => __('Number of Donations', 'give'),
376
+							'donors'     => __('Number of Donors', 'give'),
377 377
 						),
378 378
 					),
379 379
 
380 380
 					array(
381
-						'name'          => __( 'Goal Amount', 'give' ),
382
-						'description'   => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
383
-						'id'            => $prefix . 'set_goal',
381
+						'name'          => __('Goal Amount', 'give'),
382
+						'description'   => __('This is the monetary goal amount you want to reach for this form.', 'give'),
383
+						'id'            => $prefix.'set_goal',
384 384
 						'type'          => 'text_small',
385 385
 						'data_type'     => 'price',
386 386
 						'attributes'    => array(
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 						'wrapper_class' => 'give-hidden',
391 391
 					),
392 392
 					array(
393
-						'id'         => $prefix . 'number_of_donation_goal',
394
-						'name'       => __( 'Donation Goal', 'give' ),
395
-						'desc'       => __( 'Set the total number of donations as a goal.', 'give' ),
393
+						'id'         => $prefix.'number_of_donation_goal',
394
+						'name'       => __('Donation Goal', 'give'),
395
+						'desc'       => __('Set the total number of donations as a goal.', 'give'),
396 396
 						'type'       => 'number',
397 397
 						'default'    => 1,
398 398
 						'attributes' => array(
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 						),
401 401
 					),
402 402
 					array(
403
-						'id'         => $prefix . 'number_of_donor_goal',
404
-						'name'       => __( 'Donor Goal', 'give' ),
405
-						'desc'       => __( 'Set the total number of donors as a goal.', 'give' ),
403
+						'id'         => $prefix.'number_of_donor_goal',
404
+						'name'       => __('Donor Goal', 'give'),
405
+						'desc'       => __('Set the total number of donors as a goal.', 'give'),
406 406
 						'type'       => 'number',
407 407
 						'default'    => 1,
408 408
 						'attributes' => array(
@@ -410,85 +410,85 @@  discard block
 block discarded – undo
410 410
 						),
411 411
 					),
412 412
 					array(
413
-						'name'          => __( 'Progress Bar Color', 'give' ),
414
-						'desc'          => __( 'Customize the color of the goal progress bar.', 'give' ),
415
-						'id'            => $prefix . 'goal_color',
413
+						'name'          => __('Progress Bar Color', 'give'),
414
+						'desc'          => __('Customize the color of the goal progress bar.', 'give'),
415
+						'id'            => $prefix.'goal_color',
416 416
 						'type'          => 'colorpicker',
417 417
 						'default'       => '#2bc253',
418 418
 						'wrapper_class' => 'give-hidden',
419 419
 					),
420 420
 
421 421
 					array(
422
-						'name'          => __( 'Close Form', 'give' ),
423
-						'desc'          => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
424
-						'id'            => $prefix . 'close_form_when_goal_achieved',
422
+						'name'          => __('Close Form', 'give'),
423
+						'desc'          => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
424
+						'id'            => $prefix.'close_form_when_goal_achieved',
425 425
 						'type'          => 'radio_inline',
426 426
 						'default'       => 'disabled',
427 427
 						'options'       => array(
428
-							'enabled'  => __( 'Enabled', 'give' ),
429
-							'disabled' => __( 'Disabled', 'give' ),
428
+							'enabled'  => __('Enabled', 'give'),
429
+							'disabled' => __('Disabled', 'give'),
430 430
 						),
431 431
 						'wrapper_class' => 'give-hidden',
432 432
 					),
433 433
 					array(
434
-						'name'          => __( 'Goal Achieved Message', 'give' ),
435
-						'desc'          => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
436
-						'id'            => $prefix . 'form_goal_achieved_message',
434
+						'name'          => __('Goal Achieved Message', 'give'),
435
+						'desc'          => __('Do you want to display a custom message when the goal is closed?', 'give'),
436
+						'id'            => $prefix.'form_goal_achieved_message',
437 437
 						'type'          => 'wysiwyg',
438
-						'default'       => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
438
+						'default'       => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
439 439
 						'wrapper_class' => 'give-hidden',
440 440
 					),
441 441
 					array(
442 442
 						'name'  => 'donation_goal_docs',
443 443
 						'type'  => 'docs_link',
444 444
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
445
-						'title' => __( 'Donation Goal', 'give' ),
445
+						'title' => __('Donation Goal', 'give'),
446 446
 					),
447 447
 				),
448 448
 					$post_id
449 449
 				),
450
-			) ),
450
+			)),
451 451
 
452 452
 			/**
453 453
 			 * Content Field
454 454
 			 */
455
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
455
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
456 456
 				'id'        => 'form_content_options',
457
-				'title'     => __( 'Form Content', 'give' ),
457
+				'title'     => __('Form Content', 'give'),
458 458
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
459
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
459
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
460 460
 
461 461
 					// Donation content.
462 462
 					array(
463
-						'name'        => __( 'Display Content', 'give' ),
464
-						'description' => __( 'Do you want to add custom content to this form?', 'give' ),
465
-						'id'          => $prefix . 'display_content',
463
+						'name'        => __('Display Content', 'give'),
464
+						'description' => __('Do you want to add custom content to this form?', 'give'),
465
+						'id'          => $prefix.'display_content',
466 466
 						'type'        => 'radio_inline',
467 467
 						'options'     => array(
468
-							'enabled'  => __( 'Enabled', 'give' ),
469
-							'disabled' => __( 'Disabled', 'give' ),
468
+							'enabled'  => __('Enabled', 'give'),
469
+							'disabled' => __('Disabled', 'give'),
470 470
 						),
471 471
 						'default'     => 'disabled',
472 472
 					),
473 473
 
474 474
 					// Content placement.
475 475
 					array(
476
-						'name'          => __( 'Content Placement', 'give' ),
477
-						'description'   => __( 'This option controls where the content appears within the donation form.', 'give' ),
478
-						'id'            => $prefix . 'content_placement',
476
+						'name'          => __('Content Placement', 'give'),
477
+						'description'   => __('This option controls where the content appears within the donation form.', 'give'),
478
+						'id'            => $prefix.'content_placement',
479 479
 						'type'          => 'radio_inline',
480
-						'options'       => apply_filters( 'give_forms_content_options_select', array(
481
-								'give_pre_form'  => __( 'Above fields', 'give' ),
482
-								'give_post_form' => __( 'Below fields', 'give' ),
480
+						'options'       => apply_filters('give_forms_content_options_select', array(
481
+								'give_pre_form'  => __('Above fields', 'give'),
482
+								'give_post_form' => __('Below fields', 'give'),
483 483
 							)
484 484
 						),
485 485
 						'default'       => 'give_pre_form',
486 486
 						'wrapper_class' => 'give-hidden',
487 487
 					),
488 488
 					array(
489
-						'name'          => __( 'Content', 'give' ),
490
-						'description'   => __( 'This content will display on the single give form page.', 'give' ),
491
-						'id'            => $prefix . 'form_content',
489
+						'name'          => __('Content', 'give'),
490
+						'description'   => __('This content will display on the single give form page.', 'give'),
491
+						'id'            => $prefix.'form_content',
492 492
 						'type'          => 'wysiwyg',
493 493
 						'wrapper_class' => 'give-hidden',
494 494
 					),
@@ -496,51 +496,51 @@  discard block
 block discarded – undo
496 496
 						'name'  => 'form_content_docs',
497 497
 						'type'  => 'docs_link',
498 498
 						'url'   => 'http://docs.givewp.com/form-content',
499
-						'title' => __( 'Form Content', 'give' ),
499
+						'title' => __('Form Content', 'give'),
500 500
 					),
501 501
 				),
502 502
 					$post_id
503 503
 				),
504
-			) ),
504
+			)),
505 505
 
506 506
 			/**
507 507
 			 * Terms & Conditions
508 508
 			 */
509
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
509
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
510 510
 				'id'        => 'form_terms_options',
511
-				'title'     => __( 'Terms & Conditions', 'give' ),
511
+				'title'     => __('Terms & Conditions', 'give'),
512 512
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
513
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
513
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
514 514
 					// Donation Option
515 515
 					array(
516
-						'name'        => __( 'Terms and Conditions', 'give' ),
517
-						'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
518
-						'id'          => $prefix . 'terms_option',
516
+						'name'        => __('Terms and Conditions', 'give'),
517
+						'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
518
+						'id'          => $prefix.'terms_option',
519 519
 						'type'        => 'radio_inline',
520
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
521
-								'global'   => __( 'Global Option', 'give' ),
522
-								'enabled'  => __( 'Customize', 'give' ),
523
-								'disabled' => __( 'Disable', 'give' ),
520
+						'options'     => apply_filters('give_forms_content_options_select', array(
521
+								'global'   => __('Global Option', 'give'),
522
+								'enabled'  => __('Customize', 'give'),
523
+								'disabled' => __('Disable', 'give'),
524 524
 							)
525 525
 						),
526 526
 						'default'     => 'global',
527 527
 					),
528 528
 					array(
529
-						'id'            => $prefix . 'agree_label',
530
-						'name'          => __( 'Agreement Label', 'give' ),
531
-						'desc'          => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
529
+						'id'            => $prefix.'agree_label',
530
+						'name'          => __('Agreement Label', 'give'),
531
+						'desc'          => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
532 532
 						'type'          => 'text',
533 533
 						'size'          => 'regular',
534 534
 						'attributes'    => array(
535
-							'placeholder' => __( 'Agree to Terms?', 'give' ),
535
+							'placeholder' => __('Agree to Terms?', 'give'),
536 536
 						),
537 537
 						'wrapper_class' => 'give-hidden',
538 538
 					),
539 539
 					array(
540
-						'id'            => $prefix . 'agree_text',
541
-						'name'          => __( 'Agreement Text', 'give' ),
542
-						'desc'          => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
543
-						'default'       => give_get_option( 'agreement_text' ),
540
+						'id'            => $prefix.'agree_text',
541
+						'name'          => __('Agreement Text', 'give'),
542
+						'desc'          => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
543
+						'default'       => give_get_option('agreement_text'),
544 544
 						'type'          => 'wysiwyg',
545 545
 						'wrapper_class' => 'give-hidden',
546 546
 					),
@@ -548,18 +548,18 @@  discard block
 block discarded – undo
548 548
 						'name'  => 'terms_docs',
549 549
 						'type'  => 'docs_link',
550 550
 						'url'   => 'http://docs.givewp.com/form-terms',
551
-						'title' => __( 'Terms and Conditions', 'give' ),
551
+						'title' => __('Terms and Conditions', 'give'),
552 552
 					),
553 553
 				),
554 554
 					$post_id
555 555
 				),
556
-			) ),
556
+			)),
557 557
 		);
558 558
 
559 559
 		/**
560 560
 		 * Filter the metabox tabbed panel settings.
561 561
 		 */
562
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
562
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
563 563
 
564 564
 		// Output.
565 565
 		return $settings;
@@ -576,19 +576,19 @@  discard block
 block discarded – undo
576 576
 		add_meta_box(
577 577
 			$this->get_metabox_ID(),
578 578
 			$this->get_metabox_label(),
579
-			array( $this, 'output' ),
580
-			array( 'give_forms' ),
579
+			array($this, 'output'),
580
+			array('give_forms'),
581 581
 			'normal',
582 582
 			'high'
583 583
 		);
584 584
 
585 585
 		// Show Goal Metabox only if goal is enabled.
586
-		if ( give_is_setting_enabled( give_get_meta( give_get_admin_post_id(), '_give_goal_option', true ) ) ) {
586
+		if (give_is_setting_enabled(give_get_meta(give_get_admin_post_id(), '_give_goal_option', true))) {
587 587
 			add_meta_box(
588 588
 				'give-form-goal-stats',
589
-				__( 'Goal Statistics', 'give' ),
590
-				array( $this, 'output_goal' ),
591
-				array( 'give_forms' ),
589
+				__('Goal Statistics', 'give'),
590
+				array($this, 'output_goal'),
591
+				array('give_forms'),
592 592
 				'side',
593 593
 				'low'
594 594
 			);
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	function enqueue_script() {
608 608
 		global $post;
609 609
 
610
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
610
+		if (is_object($post) && 'give_forms' === $post->post_type) {
611 611
 
612 612
 		}
613 613
 	}
@@ -645,32 +645,32 @@  discard block
 block discarded – undo
645 645
 	public function get_tabs() {
646 646
 		$tabs = array();
647 647
 
648
-		if ( ! empty( $this->settings ) ) {
649
-			foreach ( $this->settings as $setting ) {
650
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
648
+		if ( ! empty($this->settings)) {
649
+			foreach ($this->settings as $setting) {
650
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
651 651
 					continue;
652 652
 				}
653 653
 				$tab = array(
654 654
 					'id'        => $setting['id'],
655 655
 					'label'     => $setting['title'],
656
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
656
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
657 657
 				);
658 658
 
659
-				if ( $this->has_sub_tab( $setting ) ) {
660
-					if ( empty( $setting['sub-fields'] ) ) {
659
+				if ($this->has_sub_tab($setting)) {
660
+					if (empty($setting['sub-fields'])) {
661 661
 						$tab = array();
662 662
 					} else {
663
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
663
+						foreach ($setting['sub-fields'] as $sub_fields) {
664 664
 							$tab['sub-fields'][] = array(
665 665
 								'id'        => $sub_fields['id'],
666 666
 								'label'     => $sub_fields['title'],
667
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
667
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
668 668
 							);
669 669
 						}
670 670
 					}
671 671
 				}
672 672
 
673
-				if ( ! empty( $tab ) ) {
673
+				if ( ! empty($tab)) {
674 674
 					$tabs[] = $tab;
675 675
 				}
676 676
 			}
@@ -688,33 +688,33 @@  discard block
 block discarded – undo
688 688
 	 */
689 689
 	public function output() {
690 690
 		// Bailout.
691
-		if ( $form_data_tabs = $this->get_tabs() ) :
692
-			$active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options';
693
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
691
+		if ($form_data_tabs = $this->get_tabs()) :
692
+			$active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options';
693
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
694 694
 			?>
695 695
 			<input id="give_form_active_tab" type="hidden" name="give_form_active_tab">
696 696
 			<div class="give-metabox-panel-wrap">
697 697
 				<ul class="give-form-data-tabs give-metabox-tabs">
698
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
698
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
699 699
 						<?php
700 700
 						// Determine if current tab is active.
701 701
 						$is_active = $active_tab === $form_data_tab['id'] ? true : false;
702 702
 						?>
703
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
703
+						<li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
704 704
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
705
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
705
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
706 706
 									<?php echo $form_data_tab['icon-html']; ?>
707 707
 								<?php else : ?>
708 708
 									<span class="give-icon give-icon-default"></span>
709 709
 								<?php endif; ?>
710 710
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
711 711
 							</a>
712
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
712
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
713 713
 								<ul class="give-metabox-sub-tabs give-hidden">
714
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
714
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
715 715
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
716 716
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
717
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
717
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
718 718
 													<?php echo $sub_tab['icon-html']; ?>
719 719
 												<?php else : ?>
720 720
 													<span class="give-icon give-icon-default"></span>
@@ -729,29 +729,29 @@  discard block
 block discarded – undo
729 729
 					<?php endforeach; ?>
730 730
 				</ul>
731 731
 
732
-				<?php foreach ( $this->settings as $setting ) : ?>
733
-					<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
732
+				<?php foreach ($this->settings as $setting) : ?>
733
+					<?php do_action("give_before_{$setting['id']}_settings"); ?>
734 734
 					<?php
735 735
 					// Determine if current panel is active.
736 736
 					$is_active = $active_tab === $setting['id'] ? true : false;
737 737
 					?>
738
-					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>">
739
-						<?php if ( ! empty( $setting['fields'] ) ) : ?>
740
-							<?php foreach ( $setting['fields'] as $field ) : ?>
741
-								<?php give_render_field( $field ); ?>
738
+					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>">
739
+						<?php if ( ! empty($setting['fields'])) : ?>
740
+							<?php foreach ($setting['fields'] as $field) : ?>
741
+								<?php give_render_field($field); ?>
742 742
 							<?php endforeach; ?>
743 743
 						<?php endif; ?>
744 744
 					</div>
745
-					<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
745
+					<?php do_action("give_after_{$setting['id']}_settings"); ?>
746 746
 
747 747
 
748
-					<?php if ( $this->has_sub_tab( $setting ) ) : ?>
749
-						<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
750
-							<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
748
+					<?php if ($this->has_sub_tab($setting)) : ?>
749
+						<?php if ( ! empty($setting['sub-fields'])) : ?>
750
+							<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
751 751
 								<div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden">
752
-									<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
753
-										<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
754
-											<?php give_render_field( $sub_field ); ?>
752
+									<?php if ( ! empty($sub_fields['fields'])) : ?>
753
+										<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
754
+											<?php give_render_field($sub_field); ?>
755 755
 										<?php endforeach; ?>
756 756
 									<?php endif; ?>
757 757
 								</div>
@@ -774,9 +774,9 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @return void
776 776
 	 */
777
-	public function output_goal( $post ) {
777
+	public function output_goal($post) {
778 778
 
779
-		echo give_admin_form_goal_stats( $post->ID );
779
+		echo give_admin_form_goal_stats($post->ID);
780 780
 
781 781
 	}
782 782
 
@@ -789,9 +789,9 @@  discard block
 block discarded – undo
789 789
 	 *
790 790
 	 * @return bool
791 791
 	 */
792
-	private function has_sub_tab( $field_setting ) {
792
+	private function has_sub_tab($field_setting) {
793 793
 		$has_sub_tab = false;
794
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
794
+		if (array_key_exists('sub-fields', $field_setting)) {
795 795
 			$has_sub_tab = true;
796 796
 		}
797 797
 
@@ -806,13 +806,13 @@  discard block
 block discarded – undo
806 806
 	 * @return array
807 807
 	 */
808 808
 	function cmb2_metabox_settings() {
809
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
809
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
810 810
 		$give_forms_settings = $all_cmb2_settings;
811 811
 
812 812
 		// Filter settings: Use only give forms related settings.
813
-		foreach ( $all_cmb2_settings as $index => $setting ) {
814
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
815
-				unset( $give_forms_settings[ $index ] );
813
+		foreach ($all_cmb2_settings as $index => $setting) {
814
+			if ( ! in_array('give_forms', $setting['object_types'])) {
815
+				unset($give_forms_settings[$index]);
816 816
 			}
817 817
 		}
818 818
 
@@ -830,100 +830,100 @@  discard block
 block discarded – undo
830 830
 	 *
831 831
 	 * @return void
832 832
 	 */
833
-	public function save( $post_id, $post ) {
833
+	public function save($post_id, $post) {
834 834
 
835 835
 		// $post_id and $post are required.
836
-		if ( empty( $post_id ) || empty( $post ) ) {
836
+		if (empty($post_id) || empty($post)) {
837 837
 			return;
838 838
 		}
839 839
 
840 840
 		// Don't save meta boxes for revisions or autosaves.
841
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
841
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
842 842
 			return;
843 843
 		}
844 844
 
845 845
 		// Check the nonce.
846
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
846
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
847 847
 			return;
848 848
 		}
849 849
 
850 850
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
851
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
851
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
852 852
 			return;
853 853
 		}
854 854
 
855 855
 		// Check user has permission to edit.
856
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
856
+		if ( ! current_user_can('edit_post', $post_id)) {
857 857
 			return;
858 858
 		}
859 859
 
860 860
 		// Fire action before saving form meta.
861
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
861
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
862 862
 
863 863
 		/**
864 864
 		 * Filter the meta key to save.
865 865
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
866 866
 		 */
867
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
867
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
868 868
 
869 869
 		// Save form meta data.
870
-		if ( ! empty( $form_meta_keys ) ) {
871
-			foreach ( $form_meta_keys as $form_meta_key ) {
870
+		if ( ! empty($form_meta_keys)) {
871
+			foreach ($form_meta_keys as $form_meta_key) {
872 872
 
873 873
 				// Set default value for checkbox fields.
874 874
 				if (
875
-					! isset( $_POST[ $form_meta_key ] )
876
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
875
+					! isset($_POST[$form_meta_key])
876
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
877 877
 				) {
878
-					$_POST[ $form_meta_key ] = '';
878
+					$_POST[$form_meta_key] = '';
879 879
 				}
880 880
 
881
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
882
-					$setting_field = $this->get_setting_field( $form_meta_key );
883
-					if ( ! empty( $setting_field['type'] ) ) {
884
-						switch ( $setting_field['type'] ) {
881
+				if (isset($_POST[$form_meta_key])) {
882
+					$setting_field = $this->get_setting_field($form_meta_key);
883
+					if ( ! empty($setting_field['type'])) {
884
+						switch ($setting_field['type']) {
885 885
 							case 'textarea':
886 886
 							case 'wysiwyg':
887
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
887
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
888 888
 								break;
889 889
 
890 890
 							case 'donation_limit' :
891
-								$form_meta_value = $_POST[ $form_meta_key ];
891
+								$form_meta_value = $_POST[$form_meta_key];
892 892
 								break;
893 893
 
894 894
 							case 'group':
895 895
 								$form_meta_value = array();
896 896
 
897
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
897
+								foreach ($_POST[$form_meta_key] as $index => $group) {
898 898
 
899 899
 									// Do not save template input field values.
900
-									if ( '{{row-count-placeholder}}' === $index ) {
900
+									if ('{{row-count-placeholder}}' === $index) {
901 901
 										continue;
902 902
 									}
903 903
 
904 904
 									$group_meta_value = array();
905
-									foreach ( $group as $field_id => $field_value ) {
906
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
905
+									foreach ($group as $field_id => $field_value) {
906
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
907 907
 											case 'wysiwyg':
908
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
908
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
909 909
 												break;
910 910
 
911 911
 											default:
912
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
912
+												$group_meta_value[$field_id] = give_clean($field_value);
913 913
 										}
914 914
 									}
915 915
 
916
-									if ( ! empty( $group_meta_value ) ) {
917
-										$form_meta_value[ $index ] = $group_meta_value;
916
+									if ( ! empty($group_meta_value)) {
917
+										$form_meta_value[$index] = $group_meta_value;
918 918
 									}
919 919
 								}
920 920
 
921 921
 								// Arrange repeater field keys in order.
922
-								$form_meta_value = array_values( $form_meta_value );
922
+								$form_meta_value = array_values($form_meta_value);
923 923
 								break;
924 924
 
925 925
 							default:
926
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
926
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
927 927
 						}// End switch().
928 928
 
929 929
 						/**
@@ -933,38 +933,38 @@  discard block
 block discarded – undo
933 933
 						 */
934 934
 						$form_meta_value = apply_filters(
935 935
 							'give_pre_save_form_meta_value',
936
-							$this->sanitize_form_meta( $form_meta_value, $setting_field ),
936
+							$this->sanitize_form_meta($form_meta_value, $setting_field),
937 937
 							$form_meta_key,
938 938
 							$this,
939 939
 							$post_id
940 940
 						);
941 941
 
942 942
 						// Range slider.
943
-						if ( 'donation_limit' === $setting_field['type'] ) {
943
+						if ('donation_limit' === $setting_field['type']) {
944 944
 
945 945
 							// Sanitize amount for db.
946
-							$form_meta_value = array_map( 'give_sanitize_amount_for_db', $form_meta_value );
946
+							$form_meta_value = array_map('give_sanitize_amount_for_db', $form_meta_value);
947 947
 
948 948
 							// Store it to form meta.
949
-							give_update_meta( $post_id, $form_meta_key . '_minimum', $form_meta_value['minimum'] );
950
-							give_update_meta( $post_id, $form_meta_key . '_maximum', $form_meta_value['maximum'] );
949
+							give_update_meta($post_id, $form_meta_key.'_minimum', $form_meta_value['minimum']);
950
+							give_update_meta($post_id, $form_meta_key.'_maximum', $form_meta_value['maximum']);
951 951
 						} else {
952 952
 							// Save data.
953
-							give_update_meta( $post_id, $form_meta_key, $form_meta_value );
953
+							give_update_meta($post_id, $form_meta_key, $form_meta_value);
954 954
 						}
955 955
 
956 956
 						// Verify and delete form meta based on the form status.
957
-						give_set_form_closed_status( $post_id );
957
+						give_set_form_closed_status($post_id);
958 958
 
959 959
 						// Fire after saving form meta key.
960
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
960
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
961 961
 					}// End if().
962 962
 				}// End if().
963 963
 			}// End foreach().
964 964
 		}// End if().
965 965
 
966 966
 		// Fire action after saving form meta.
967
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
967
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
968 968
 	}
969 969
 
970 970
 
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
 	 *
978 978
 	 * @return string
979 979
 	 */
980
-	private function get_field_id( $field ) {
980
+	private function get_field_id($field) {
981 981
 		$field_id = '';
982 982
 
983
-		if ( array_key_exists( 'id', $field ) ) {
983
+		if (array_key_exists('id', $field)) {
984 984
 			$field_id = $field['id'];
985 985
 
986 986
 		}
@@ -997,16 +997,16 @@  discard block
 block discarded – undo
997 997
 	 *
998 998
 	 * @return array
999 999
 	 */
1000
-	private function get_fields_id( $setting ) {
1000
+	private function get_fields_id($setting) {
1001 1001
 		$meta_keys = array();
1002 1002
 
1003 1003
 		if (
1004
-			! empty( $setting )
1005
-			&& array_key_exists( 'fields', $setting )
1006
-			&& ! empty( $setting['fields'] )
1004
+			! empty($setting)
1005
+			&& array_key_exists('fields', $setting)
1006
+			&& ! empty($setting['fields'])
1007 1007
 		) {
1008
-			foreach ( $setting['fields'] as $field ) {
1009
-				if ( $field_id = $this->get_field_id( $field ) ) {
1008
+			foreach ($setting['fields'] as $field) {
1009
+				if ($field_id = $this->get_field_id($field)) {
1010 1010
 					$meta_keys[] = $field_id;
1011 1011
 				}
1012 1012
 			}
@@ -1024,14 +1024,14 @@  discard block
 block discarded – undo
1024 1024
 	 *
1025 1025
 	 * @return array
1026 1026
 	 */
1027
-	private function get_sub_fields_id( $setting ) {
1027
+	private function get_sub_fields_id($setting) {
1028 1028
 		$meta_keys = array();
1029 1029
 
1030
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
1031
-			foreach ( $setting['sub-fields'] as $fields ) {
1032
-				if ( ! empty( $fields['fields'] ) ) {
1033
-					foreach ( $fields['fields'] as $field ) {
1034
-						if ( $field_id = $this->get_field_id( $field ) ) {
1030
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
1031
+			foreach ($setting['sub-fields'] as $fields) {
1032
+				if ( ! empty($fields['fields'])) {
1033
+					foreach ($fields['fields'] as $field) {
1034
+						if ($field_id = $this->get_field_id($field)) {
1035 1035
 							$meta_keys[] = $field_id;
1036 1036
 						}
1037 1037
 					}
@@ -1053,14 +1053,14 @@  discard block
 block discarded – undo
1053 1053
 	private function get_meta_keys_from_settings() {
1054 1054
 		$meta_keys = array();
1055 1055
 
1056
-		foreach ( $this->settings as $setting ) {
1057
-			$meta_key = $this->get_fields_id( $setting );
1056
+		foreach ($this->settings as $setting) {
1057
+			$meta_key = $this->get_fields_id($setting);
1058 1058
 
1059
-			if ( $this->has_sub_tab( $setting ) ) {
1060
-				$meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) );
1059
+			if ($this->has_sub_tab($setting)) {
1060
+				$meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting));
1061 1061
 			}
1062 1062
 
1063
-			$meta_keys = array_merge( $meta_keys, $meta_key );
1063
+			$meta_keys = array_merge($meta_keys, $meta_key);
1064 1064
 		}
1065 1065
 
1066 1066
 		return $meta_keys;
@@ -1077,10 +1077,10 @@  discard block
 block discarded – undo
1077 1077
 	 *
1078 1078
 	 * @return string
1079 1079
 	 */
1080
-	function get_field_type( $field_id, $group_id = '' ) {
1081
-		$field = $this->get_setting_field( $field_id, $group_id );
1080
+	function get_field_type($field_id, $group_id = '') {
1081
+		$field = $this->get_setting_field($field_id, $group_id);
1082 1082
 
1083
-		$type = array_key_exists( 'type', $field )
1083
+		$type = array_key_exists('type', $field)
1084 1084
 			? $field['type']
1085 1085
 			: '';
1086 1086
 
@@ -1098,12 +1098,12 @@  discard block
 block discarded – undo
1098 1098
 	 *
1099 1099
 	 * @return array
1100 1100
 	 */
1101
-	private function get_field( $setting, $field_id ) {
1101
+	private function get_field($setting, $field_id) {
1102 1102
 		$setting_field = array();
1103 1103
 
1104
-		if ( ! empty( $setting['fields'] ) ) {
1105
-			foreach ( $setting['fields'] as $field ) {
1106
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
1104
+		if ( ! empty($setting['fields'])) {
1105
+			foreach ($setting['fields'] as $field) {
1106
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
1107 1107
 					$setting_field = $field;
1108 1108
 					break;
1109 1109
 				}
@@ -1123,12 +1123,12 @@  discard block
 block discarded – undo
1123 1123
 	 *
1124 1124
 	 * @return array
1125 1125
 	 */
1126
-	private function get_sub_field( $setting, $field_id ) {
1126
+	private function get_sub_field($setting, $field_id) {
1127 1127
 		$setting_field = array();
1128 1128
 
1129
-		if ( ! empty( $setting['sub-fields'] ) ) {
1130
-			foreach ( $setting['sub-fields'] as $fields ) {
1131
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1129
+		if ( ! empty($setting['sub-fields'])) {
1130
+			foreach ($setting['sub-fields'] as $fields) {
1131
+				if ($field = $this->get_field($fields, $field_id)) {
1132 1132
 					$setting_field = $field;
1133 1133
 					break;
1134 1134
 				}
@@ -1148,17 +1148,17 @@  discard block
 block discarded – undo
1148 1148
 	 *
1149 1149
 	 * @return array
1150 1150
 	 */
1151
-	function get_setting_field( $field_id, $group_id = '' ) {
1151
+	function get_setting_field($field_id, $group_id = '') {
1152 1152
 		$setting_field = array();
1153 1153
 
1154 1154
 		$_field_id = $field_id;
1155
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1155
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1156 1156
 
1157
-		if ( ! empty( $this->settings ) ) {
1158
-			foreach ( $this->settings as $setting ) {
1157
+		if ( ! empty($this->settings)) {
1158
+			foreach ($this->settings as $setting) {
1159 1159
 				if (
1160
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1161
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1160
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1161
+					|| ($setting_field = $this->get_field($setting, $field_id))
1162 1162
 				) {
1163 1163
 					break;
1164 1164
 				}
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
 		}
1167 1167
 
1168 1168
 		// Get field from group.
1169
-		if ( ! empty( $group_id ) ) {
1170
-			foreach ( $setting_field['fields'] as $field ) {
1171
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1169
+		if ( ! empty($group_id)) {
1170
+			foreach ($setting_field['fields'] as $field) {
1171
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1172 1172
 					$setting_field = $field;
1173 1173
 				}
1174 1174
 			}
@@ -1187,14 +1187,14 @@  discard block
 block discarded – undo
1187 1187
 	 *
1188 1188
 	 * @return mixed
1189 1189
 	 */
1190
-	function add_offline_donations_setting_tab( $settings ) {
1191
-		if ( give_is_gateway_active( 'offline' ) ) {
1192
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1190
+	function add_offline_donations_setting_tab($settings) {
1191
+		if (give_is_gateway_active('offline')) {
1192
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1193 1193
 				'id'        => 'offline_donations_options',
1194
-				'title'     => __( 'Offline Donations', 'give' ),
1194
+				'title'     => __('Offline Donations', 'give'),
1195 1195
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1196
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1197
-			) );
1196
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1197
+			));
1198 1198
 		}
1199 1199
 
1200 1200
 		return $settings;
@@ -1212,37 +1212,33 @@  discard block
 block discarded – undo
1212 1212
 	 *
1213 1213
 	 * @return mixed
1214 1214
 	 */
1215
-	function sanitize_form_meta( $meta_value, $setting_field ) {
1216
-		switch ( $setting_field['type'] ) {
1215
+	function sanitize_form_meta($meta_value, $setting_field) {
1216
+		switch ($setting_field['type']) {
1217 1217
 			case 'group':
1218
-				if ( ! empty( $setting_field['fields'] ) ) {
1219
-					foreach ( $setting_field['fields'] as $field ) {
1220
-						if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) {
1218
+				if ( ! empty($setting_field['fields'])) {
1219
+					foreach ($setting_field['fields'] as $field) {
1220
+						if (empty($field['data_type']) || 'price' !== $field['data_type']) {
1221 1221
 							continue;
1222 1222
 						}
1223 1223
 
1224
-						foreach ( $meta_value as $index => $meta_data ) {
1225
-							if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) {
1224
+						foreach ($meta_value as $index => $meta_data) {
1225
+							if ( ! isset($meta_value[$index][$field['id']])) {
1226 1226
 								continue;
1227 1227
 							}
1228 1228
 
1229
-							$meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ?
1230
-								give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) :
1231
-								( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ?
1232
-									give_sanitize_amount_for_db( '1.00' ) :
1233
-									0 );
1229
+							$meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ?
1230
+								give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ?
1231
+									give_sanitize_amount_for_db('1.00') : 0);
1234 1232
 						}
1235 1233
 					}
1236 1234
 				}
1237 1235
 				break;
1238 1236
 
1239 1237
 			default:
1240
-				if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) {
1238
+				if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) {
1241 1239
 					$meta_value = $meta_value ?
1242
-						give_sanitize_amount_for_db( $meta_value ) :
1243
-						( in_array( $setting_field['id'], array( '_give_set_price', '_give_custom_amount_minimum', '_give_set_goal' ) ) ?
1244
-							give_sanitize_amount_for_db( '1.00' ) :
1245
-							0 );
1240
+						give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array('_give_set_price', '_give_custom_amount_minimum', '_give_set_goal')) ?
1241
+							give_sanitize_amount_for_db('1.00') : 0);
1246 1242
 				}
1247 1243
 		}
1248 1244
 
@@ -1260,12 +1256,12 @@  discard block
 block discarded – undo
1260 1256
 	 *
1261 1257
 	 * @return string The URL after redirect.
1262 1258
 	 */
1263
-	public function maintain_active_tab( $location, $post_id ) {
1259
+	public function maintain_active_tab($location, $post_id) {
1264 1260
 		if (
1265
-			'give_forms' === get_post_type( $post_id ) &&
1266
-			! empty( $_POST['give_form_active_tab'] )
1261
+			'give_forms' === get_post_type($post_id) &&
1262
+			! empty($_POST['give_form_active_tab'])
1267 1263
 		) {
1268
-			$location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location );
1264
+			$location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location);
1269 1265
 		}
1270 1266
 
1271 1267
 		return $location;
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +19 added lines, -19 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
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return static
52 52
 	 */
53 53
 	public static function get_instance() {
54
-		if ( null === static::$instance ) {
54
+		if (null === static::$instance) {
55 55
 			self::$instance = new static();
56 56
 			self::$instance->setup();
57 57
 		}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @since 1.8.13
67 67
 	 */
68 68
 	private function setup() {
69
-		add_filter( 'cron_schedules', array( self::$instance, '__add_schedules' ) );
70
-		add_action( 'wp', array( self::$instance, '__schedule_events' ) );
69
+		add_filter('cron_schedules', array(self::$instance, '__add_schedules'));
70
+		add_action('wp', array(self::$instance, '__schedule_events'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array            An array of non-default cron schedules.
82 82
 	 */
83
-	public function __add_schedules( $schedules = array() ) {
83
+	public function __add_schedules($schedules = array()) {
84 84
 		// Adds once weekly to the existing schedules.
85 85
 		$schedules['weekly'] = array(
86 86
 			'interval' => 604800,
87
-			'display'  => __( 'Once Weekly', 'give' ),
87
+			'display'  => __('Once Weekly', 'give'),
88 88
 		);
89 89
 
90 90
 		return $schedules;
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @return void
113 113
 	 */
114 114
 	private function weekly_events() {
115
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
116
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
115
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
116
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
117 117
 		}
118 118
 	}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @return void
127 127
 	 */
128 128
 	private function daily_events() {
129
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
130
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
129
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
130
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
131 131
 		}
132 132
 	}
133 133
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return string
143 143
 	 */
144
-	public static function get_cron_action( $type = 'weekly' ) {
145
-		switch ( $type ) {
144
+	public static function get_cron_action($type = 'weekly') {
145
+		switch ($type) {
146 146
 			case 'daily':
147 147
 				$cron_action = 'give_daily_scheduled_events';
148 148
 				break;
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	 * @param        $action
165 165
 	 * @param string $type
166 166
 	 */
167
-	private static function add_event( $action, $type = 'weekly' ) {
168
-		$cron_event = self::get_cron_action( $type );
169
-		add_action( $cron_event, $action );
167
+	private static function add_event($action, $type = 'weekly') {
168
+		$cron_event = self::get_cron_action($type);
169
+		add_action($cron_event, $action);
170 170
 	}
171 171
 
172 172
 	/**
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @param $action
179 179
 	 */
180
-	public static function add_weekly_event( $action ) {
181
-		self::add_event( $action, 'weekly' );
180
+	public static function add_weekly_event($action) {
181
+		self::add_event($action, 'weekly');
182 182
 	}
183 183
 
184 184
 	/**
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @param $action
191 191
 	 */
192
-	public static function add_daily_event( $action ) {
193
-		self::add_event( $action, 'daily' );
192
+	public static function add_daily_event($action) {
193
+		self::add_event($action, 'daily');
194 194
 	}
195 195
 }
196 196
 
Please login to merge, or discard this patch.