Completed
Pull Request — master (#801)
by
unknown
18:24
created
includes/user-functions.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|object List of all user purchases
32 32
  */
33
-function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 
45
-	if ( $pagination ) {
46
-		if ( get_query_var( 'paged' ) ) {
47
-			$paged = get_query_var( 'paged' );
48
-		} else if ( get_query_var( 'page' ) ) {
49
-			$paged = get_query_var( 'page' );
45
+	if ($pagination) {
46
+		if (get_query_var('paged')) {
47
+			$paged = get_query_var('paged');
48
+		} else if (get_query_var('page')) {
49
+			$paged = get_query_var('page');
50 50
 		} else {
51 51
 			$paged = 1;
52 52
 		}
53 53
 	}
54 54
 
55
-	$args = apply_filters( 'give_get_users_purchases_args', array(
55
+	$args = apply_filters('give_get_users_purchases_args', array(
56 56
 		'user'    => $user,
57 57
 		'number'  => $number,
58 58
 		'status'  => $status,
59 59
 		'orderby' => 'date'
60
-	) );
60
+	));
61 61
 
62
-	if ( $pagination ) {
62
+	if ($pagination) {
63 63
 
64 64
 		$args['page'] = $paged;
65 65
 
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
 
70 70
 	}
71 71
 
72
-	$by_user_id = is_numeric( $user ) ? true : false;
73
-	$customer   = new Give_Customer( $user, $by_user_id );
72
+	$by_user_id = is_numeric($user) ? true : false;
73
+	$customer   = new Give_Customer($user, $by_user_id);
74 74
 
75
-	if ( ! empty( $customer->payment_ids ) ) {
75
+	if ( ! empty($customer->payment_ids)) {
76 76
 
77
-		unset( $args['user'] );
78
-		$args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) );
77
+		unset($args['user']);
78
+		$args['post__in'] = array_map('absint', explode(',', $customer->payment_ids));
79 79
 
80 80
 	}
81 81
 
82
-	$purchases = give_get_payments( apply_filters( 'give_get_users_purchases_args', $args ) );
82
+	$purchases = give_get_payments(apply_filters('give_get_users_purchases_args', $args));
83 83
 
84 84
 	// No purchases
85
-	if ( ! $purchases ) {
85
+	if ( ! $purchases) {
86 86
 		return false;
87 87
 	}
88 88
 
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return bool|object List of unique forms purchased by user
103 103
  */
104
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
105
-	if ( empty( $user ) ) {
104
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
105
+	if (empty($user)) {
106 106
 		$user = get_current_user_id();
107 107
 	}
108 108
 
109
-	if ( empty( $user ) ) {
109
+	if (empty($user)) {
110 110
 		return false;
111 111
 	}
112 112
 
113
-	$by_user_id = is_numeric( $user ) ? true : false;
113
+	$by_user_id = is_numeric($user) ? true : false;
114 114
 
115
-	$customer = new Give_Customer( $user, $by_user_id );
115
+	$customer = new Give_Customer($user, $by_user_id);
116 116
 
117
-	if ( empty( $customer->payment_ids ) ) {
117
+	if (empty($customer->payment_ids)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	// Get all the items purchased
122
-	$payment_ids    = array_reverse( explode( ',', $customer->payment_ids ) );
123
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
124
-	if ( ! empty( $limit_payments ) ) {
125
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
122
+	$payment_ids    = array_reverse(explode(',', $customer->payment_ids));
123
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
124
+	if ( ! empty($limit_payments)) {
125
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
126 126
 	}
127 127
 	$donation_data = array();
128
-	foreach ( $payment_ids as $payment_id ) {
129
-		$donation_data[] = give_get_payment_meta( $payment_id );
128
+	foreach ($payment_ids as $payment_id) {
129
+		$donation_data[] = give_get_payment_meta($payment_id);
130 130
 	}
131 131
 
132
-	if ( empty( $donation_data ) ) {
132
+	if (empty($donation_data)) {
133 133
 		return false;
134 134
 	}
135 135
 
136 136
 	// Grab only the post ids "form_id" of the forms purchased on this order
137 137
 	$completed_donations_ids = array();
138
-	foreach ( $donation_data as $purchase_meta ) {
138
+	foreach ($donation_data as $purchase_meta) {
139 139
 		$completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : '';
140 140
 	}
141 141
 
142
-	if ( empty( $completed_donations_ids ) ) {
142
+	if (empty($completed_donations_ids)) {
143 143
 		return false;
144 144
 	}
145 145
 
146 146
 	// Only include each product purchased once
147
-	$form_ids = array_unique( $completed_donations_ids );
147
+	$form_ids = array_unique($completed_donations_ids);
148 148
 
149 149
 	// Make sure we still have some products and a first item
150
-	if ( empty ( $form_ids ) || ! isset( $form_ids[0] ) ) {
150
+	if (empty ($form_ids) || ! isset($form_ids[0])) {
151 151
 		return false;
152 152
 	}
153 153
 
154
-	$post_type = get_post_type( $form_ids[0] );
154
+	$post_type = get_post_type($form_ids[0]);
155 155
 
156
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
156
+	$args = apply_filters('give_get_users_completed_donations_args', array(
157 157
 		'include'        => $form_ids,
158 158
 		'post_type'      => $post_type,
159
-		'posts_per_page' => - 1
160
-	) );
159
+		'posts_per_page' => -1
160
+	));
161 161
 
162
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
162
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
163 163
 }
164 164
 
165 165
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return      bool - true if has purchased, false other wise.
177 177
  */
178
-function give_has_purchases( $user_id = null ) {
179
-	if ( empty( $user_id ) ) {
178
+function give_has_purchases($user_id = null) {
179
+	if (empty($user_id)) {
180 180
 		$user_id = get_current_user_id();
181 181
 	}
182 182
 
183
-	if ( give_get_users_purchases( $user_id, 1 ) ) {
183
+	if (give_get_users_purchases($user_id, 1)) {
184 184
 		return true; // User has at least one purchase
185 185
 	}
186 186
 
@@ -200,32 +200,32 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return      array
202 202
  */
203
-function give_get_purchase_stats_by_user( $user = '' ) {
203
+function give_get_purchase_stats_by_user($user = '') {
204 204
 
205
-	if ( is_email( $user ) ) {
205
+	if (is_email($user)) {
206 206
 
207 207
 		$field = 'email';
208 208
 
209
-	} elseif ( is_numeric( $user ) ) {
209
+	} elseif (is_numeric($user)) {
210 210
 
211 211
 		$field = 'user_id';
212 212
 
213 213
 	}
214 214
 
215 215
 	$stats    = array();
216
-	$customer = Give()->customers->get_customer_by( $field, $user );
216
+	$customer = Give()->customers->get_customer_by($field, $user);
217 217
 
218
-	if ( $customer ) {
218
+	if ($customer) {
219 219
 
220
-		$customer = new Give_Customer( $customer->id );
220
+		$customer = new Give_Customer($customer->id);
221 221
 
222
-		$stats['purchases']   = absint( $customer->purchase_count );
223
-		$stats['total_spent'] = give_sanitize_amount( $customer->purchase_value );
222
+		$stats['purchases']   = absint($customer->purchase_count);
223
+		$stats['total_spent'] = give_sanitize_amount($customer->purchase_value);
224 224
 
225 225
 	}
226 226
 
227 227
 
228
-	return (array) apply_filters( 'give_purchase_stats_by_user', $stats, $user );
228
+	return (array) apply_filters('give_purchase_stats_by_user', $stats, $user);
229 229
 }
230 230
 
231 231
 
@@ -241,22 +241,22 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return      int - the total number of purchases
243 243
  */
244
-function give_count_purchases_of_customer( $user = null ) {
244
+function give_count_purchases_of_customer($user = null) {
245 245
 
246 246
 	//Logged in?
247
-	if ( empty( $user ) ) {
247
+	if (empty($user)) {
248 248
 		$user = get_current_user_id();
249 249
 	}
250 250
 
251 251
 	//Email access?
252
-	if ( empty( $user ) && Give()->email_access->token_email ) {
252
+	if (empty($user) && Give()->email_access->token_email) {
253 253
 		$user = Give()->email_access->token_email;
254 254
 	}
255 255
 
256 256
 
257
-	$stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false;
257
+	$stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false;
258 258
 
259
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
259
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
260 260
 }
261 261
 
262 262
 /**
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return      float - the total amount the user has spent
271 271
  */
272
-function give_purchase_total_of_user( $user = null ) {
272
+function give_purchase_total_of_user($user = null) {
273 273
 
274
-	$stats = give_get_purchase_stats_by_user( $user );
274
+	$stats = give_get_purchase_stats_by_user($user);
275 275
 
276 276
 	return $stats['total_spent'];
277 277
 }
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
  *
288 288
  * @return      bool
289 289
  */
290
-function give_validate_username( $username ) {
291
-	$sanitized = sanitize_user( $username, false );
292
-	$valid     = ( $sanitized == $username );
290
+function give_validate_username($username) {
291
+	$sanitized = sanitize_user($username, false);
292
+	$valid     = ($sanitized == $username);
293 293
 
294
-	return (bool) apply_filters( 'give_validate_username', $valid, $username );
294
+	return (bool) apply_filters('give_validate_username', $valid, $username);
295 295
 }
296 296
 
297 297
 
@@ -308,32 +308,32 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return      void
310 310
  */
311
-function give_add_past_purchases_to_new_user( $user_id ) {
311
+function give_add_past_purchases_to_new_user($user_id) {
312 312
 
313
-	$email = get_the_author_meta( 'user_email', $user_id );
313
+	$email = get_the_author_meta('user_email', $user_id);
314 314
 
315
-	$payments = give_get_payments( array( 's' => $email ) );
315
+	$payments = give_get_payments(array('s' => $email));
316 316
 
317
-	if ( $payments ) {
318
-		foreach ( $payments as $payment ) {
319
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
317
+	if ($payments) {
318
+		foreach ($payments as $payment) {
319
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
320 320
 				continue;
321 321
 			} // This payment already associated with an account
322 322
 
323
-			$meta                    = give_get_payment_meta( $payment->ID );
324
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
323
+			$meta                    = give_get_payment_meta($payment->ID);
324
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
325 325
 			$meta['user_info']['id'] = $user_id;
326 326
 			$meta['user_info']       = $meta['user_info'];
327 327
 
328 328
 			// Store the updated user ID in the payment meta
329
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
330
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
329
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
330
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
331 331
 		}
332 332
 	}
333 333
 
334 334
 }
335 335
 
336
-add_action( 'user_register', 'give_add_past_purchases_to_new_user' );
336
+add_action('user_register', 'give_add_past_purchases_to_new_user');
337 337
 
338 338
 
339 339
 /**
@@ -355,34 +355,34 @@  discard block
 block discarded – undo
355 355
  * @since         1.0
356 356
  * @return        array - The donor's address, if any
357 357
  */
358
-function give_get_donor_address( $user_id = 0 ) {
359
-	if ( empty( $user_id ) ) {
358
+function give_get_donor_address($user_id = 0) {
359
+	if (empty($user_id)) {
360 360
 		$user_id = get_current_user_id();
361 361
 	}
362 362
 
363
-	$address = get_user_meta( $user_id, '_give_user_address', true );
363
+	$address = get_user_meta($user_id, '_give_user_address', true);
364 364
 
365
-	if ( ! isset( $address['line1'] ) ) {
365
+	if ( ! isset($address['line1'])) {
366 366
 		$address['line1'] = '';
367 367
 	}
368 368
 
369
-	if ( ! isset( $address['line2'] ) ) {
369
+	if ( ! isset($address['line2'])) {
370 370
 		$address['line2'] = '';
371 371
 	}
372 372
 
373
-	if ( ! isset( $address['city'] ) ) {
373
+	if ( ! isset($address['city'])) {
374 374
 		$address['city'] = '';
375 375
 	}
376 376
 
377
-	if ( ! isset( $address['zip'] ) ) {
377
+	if ( ! isset($address['zip'])) {
378 378
 		$address['zip'] = '';
379 379
 	}
380 380
 
381
-	if ( ! isset( $address['country'] ) ) {
381
+	if ( ! isset($address['country'])) {
382 382
 		$address['country'] = '';
383 383
 	}
384 384
 
385
-	if ( ! isset( $address['state'] ) ) {
385
+	if ( ! isset($address['state'])) {
386 386
 		$address['state'] = '';
387 387
 	}
388 388
 
@@ -402,53 +402,53 @@  discard block
 block discarded – undo
402 402
  *
403 403
  * @return        void
404 404
  */
405
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
405
+function give_new_user_notification($user_id = 0, $user_data = array()) {
406 406
 
407
-	if ( empty( $user_id ) || empty( $user_data ) ) {
407
+	if (empty($user_id) || empty($user_data)) {
408 408
 		return;
409 409
 	}
410
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
410
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
411 411
 
412 412
 	/* translators: %s: site name */
413
-	$message  = sprintf( esc_html__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
413
+	$message  = sprintf(esc_html__('New user registration on your site %s:'), $blogname)."\r\n\r\n";
414 414
 	/* translators: %s: user login */
415
-	$message .= sprintf( esc_html__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n\r\n";
415
+	$message .= sprintf(esc_html__('Username: %s'), $user_data['user_login'])."\r\n\r\n";
416 416
 	/* translators: %s: user email */
417
-	$message .= sprintf( esc_html__( 'E-mail: %s' ), $user_data['user_email'] ) . "\r\n";
417
+	$message .= sprintf(esc_html__('E-mail: %s'), $user_data['user_email'])."\r\n";
418 418
 
419 419
 	@wp_mail(
420
-		get_option( 'admin_email' ),
420
+		get_option('admin_email'),
421 421
 		sprintf(
422 422
 			/* translators: %s: site name */
423
-			esc_html__( '[%s] New User Registration' ),
423
+			esc_html__('[%s] New User Registration'),
424 424
 			$blogname
425 425
 		),
426 426
 		$message
427 427
 	);
428 428
 
429 429
 	/* translators: %s: user login */
430
-	$message  = sprintf(
431
-		esc_html__( 'Username: %s' ),
430
+	$message = sprintf(
431
+		esc_html__('Username: %s'),
432 432
 		$user_data['user_login']
433
-	) . "\r\n";
433
+	)."\r\n";
434 434
 
435 435
 	/* translators: %s: paswword */
436 436
 	$message .= sprintf(
437
-		esc_html__( 'Password: %s' ),
438
-		esc_html__( '[Password entered during donation]', 'give' )
439
-	) . "\r\n";
437
+		esc_html__('Password: %s'),
438
+		esc_html__('[Password entered during donation]', 'give')
439
+	)."\r\n";
440 440
 
441 441
 	$message .= sprintf(
442 442
 		'<a href="%1$s">%2$s</a>',
443 443
 		wp_login_url(),
444
-		esc_html__( 'Click Here to Login', 'give' )
445
-	) . "\r\n";
444
+		esc_html__('Click Here to Login', 'give')
445
+	)."\r\n";
446 446
 
447 447
 	wp_mail(
448 448
 		$user_data['user_email'],
449 449
 		sprintf(
450 450
 			/* translators: %s: site name */
451
-			esc_html__( '[%s] Your username and password' ),
451
+			esc_html__('[%s] Your username and password'),
452 452
 			$blogname
453 453
 		),
454 454
 		$message
@@ -456,4 +456,4 @@  discard block
 block discarded – undo
456 456
 
457 457
 }
458 458
 
459
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
459
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
Please login to merge, or discard this patch.
includes/scripts.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
 		wp_enqueue_script( 'give-admin-forms-scripts' );
239 239
 	}
240 240
 
241
-    //Settings Scripts
242
-    if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
243
-        wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
244
-        wp_enqueue_script( 'give-admin-settings-scripts' );
245
-    }
241
+	//Settings Scripts
242
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
243
+		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
244
+		wp_enqueue_script( 'give-admin-settings-scripts' );
245
+	}
246 246
 
247
-    // Price Separators.
248
-    $thousand_separator = give_get_price_thousand_separator();
249
-    $decimal_separator  = give_get_price_decimal_separator();
247
+	// Price Separators.
248
+	$thousand_separator = give_get_price_thousand_separator();
249
+	$decimal_separator  = give_get_price_decimal_separator();
250 250
 
251
-    //Localize strings & variables for JS
251
+	//Localize strings & variables for JS
252 252
 	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
253 253
 		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
254 254
 		'give_version'            => GIVE_VERSION,
255
-        'thousands_separator'     => $thousand_separator,
256
-        'decimal_separator'       => $decimal_separator,
257
-        'quick_edit_warning'      => esc_html__( 'Sorry, not available for variable priced forms.', 'give' ),
255
+		'thousands_separator'     => $thousand_separator,
256
+		'decimal_separator'       => $decimal_separator,
257
+		'quick_edit_warning'      => esc_html__( 'Sorry, not available for variable priced forms.', 'give' ),
258 258
 		'delete_payment'          => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ),
259 259
 		'delete_payment_note'     => esc_html__( 'Are you sure you wish to delete this note?', 'give' ),
260 260
 		'revoke_api_key'          => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ),
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 		'batch_export_no_class'   => esc_html__( 'You must choose a method.', 'give' ),
283 283
 		'batch_export_no_reqs'    => esc_html__( 'Required fields not completed.', 'give' ),
284 284
 		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
285
-        'price_format_guide'      => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ).', 'give' ), $decimal_separator, $thousand_separator )
286
-    ) );
285
+		'price_format_guide'      => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ).', 'give' ), $decimal_separator, $thousand_separator )
286
+	) );
287 287
 
288 288
 	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
289 289
 		//call for new media manager
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -28,94 +28,94 @@  discard block
 block discarded – undo
28 28
 
29 29
 	global $give_options;
30 30
 
31
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
32
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
33
-	$scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false;
31
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
32
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
33
+	$scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false;
34 34
 
35 35
 	// Use minified libraries if SCRIPT_DEBUG is turned off
36
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
36
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
37 37
 
38 38
 	//Localize / PHP to AJAX vars
39
-	$localize_give_checkout = apply_filters( 'give_global_script_vars', array(
39
+	$localize_give_checkout = apply_filters('give_global_script_vars', array(
40 40
 		'ajaxurl'             => give_get_ajax_url(),
41
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
42
-		'currency_sign'       => give_currency_filter( '' ),
41
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
42
+		'currency_sign'       => give_currency_filter(''),
43 43
 		'currency_pos'        => give_get_currency_position(),
44 44
 		'thousands_separator' => give_get_price_thousand_separator(),
45 45
 		'decimal_separator'   => give_get_price_decimal_separator(),
46
-		'no_gateway'          => esc_html__( 'Please select a payment method.', 'give' ),
47
-		'bad_minimum'         => esc_html__( 'The minimum donation amount for this form is', 'give' ),
48
-		'general_loading'     => esc_html__( 'Loading...', 'give' ),
49
-		'purchase_loading'    => esc_html__( 'Please Wait...', 'give' ),
46
+		'no_gateway'          => esc_html__('Please select a payment method.', 'give'),
47
+		'bad_minimum'         => esc_html__('The minimum donation amount for this form is', 'give'),
48
+		'general_loading'     => esc_html__('Loading...', 'give'),
49
+		'purchase_loading'    => esc_html__('Please Wait...', 'give'),
50 50
 		'number_decimals'  => give_get_price_decimals(),
51 51
 		'give_version'        => GIVE_VERSION
52
-	) );
53
-	$localize_give_ajax     = apply_filters( 'give_global_ajax_vars', array(
52
+	));
53
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
54 54
 		'ajaxurl'          => give_get_ajax_url(),
55
-		'loading'          => esc_html__( 'Loading', 'give' ),
55
+		'loading'          => esc_html__('Loading', 'give'),
56 56
 		// General loading message
57
-		'select_option'    => esc_html__( 'Please select an option', 'give' ),
57
+		'select_option'    => esc_html__('Please select an option', 'give'),
58 58
 		// Variable pricing error with multi-purchase option enabled
59
-		'default_gateway'  => give_get_default_gateway( null ),
60
-		'permalinks'       => get_option( 'permalink_structure' ) ? '1' : '0',
59
+		'default_gateway'  => give_get_default_gateway(null),
60
+		'permalinks'       => get_option('permalink_structure') ? '1' : '0',
61 61
 		'number_decimals'  => give_get_price_decimals()
62
-	) );
62
+	));
63 63
 
64 64
 	//DEBUG is On
65
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
65
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
66 66
 
67
-		if ( give_is_cc_verify_enabled() ) {
68
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
69
-			wp_enqueue_script( 'give-cc-validator' );
67
+		if (give_is_cc_verify_enabled()) {
68
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
69
+			wp_enqueue_script('give-cc-validator');
70 70
 		}
71 71
 
72
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
73
-		wp_enqueue_script( 'give-float-labels' );
72
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
73
+		wp_enqueue_script('give-float-labels');
74 74
 
75
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
76
-		wp_enqueue_script( 'give-blockui' );
75
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
76
+		wp_enqueue_script('give-blockui');
77 77
 
78
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
79
-		wp_enqueue_script( 'give-qtip' );
78
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
79
+		wp_enqueue_script('give-qtip');
80 80
 
81
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
82
-		wp_enqueue_script( 'give-accounting' );
81
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
82
+		wp_enqueue_script('give-accounting');
83 83
 
84
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
85
-		wp_enqueue_script( 'give-magnific' );
84
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
85
+		wp_enqueue_script('give-magnific');
86 86
 
87
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
88
-		wp_enqueue_script( 'give-checkout-global' );
87
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
88
+		wp_enqueue_script('give-checkout-global');
89 89
 
90 90
 		//General scripts
91
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
92
-		wp_enqueue_script( 'give-scripts' );
91
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
92
+		wp_enqueue_script('give-scripts');
93 93
 
94 94
 		// Load AJAX scripts, if enabled
95
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
96
-		wp_enqueue_script( 'give-ajax' );
95
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
96
+		wp_enqueue_script('give-ajax');
97 97
 
98 98
 		//Localize / Pass AJAX vars from PHP
99
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout );
100
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
99
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout);
100
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
101 101
 
102 102
 
103 103
 	} else {
104 104
 
105 105
 		//DEBUG is OFF (one JS file to rule them all!)
106
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
107
-		wp_enqueue_script( 'give' );
106
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
107
+		wp_enqueue_script('give');
108 108
 
109 109
 		//Localize / Pass AJAX vars from PHP
110
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout );
111
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
110
+		wp_localize_script('give', 'give_global_vars', $localize_give_checkout);
111
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
112 112
 
113 113
 	}
114 114
 
115 115
 
116 116
 }
117 117
 
118
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
118
+add_action('wp_enqueue_scripts', 'give_load_scripts');
119 119
 
120 120
 /**
121 121
  * Register Styles
@@ -127,47 +127,47 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_register_styles() {
129 129
 
130
-	if ( give_get_option( 'disable_css', false ) ) {
130
+	if (give_get_option('disable_css', false)) {
131 131
 		return;
132 132
 	}
133 133
 
134 134
 	// Use minified libraries if SCRIPT_DEBUG is turned off
135
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
135
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
136 136
 
137
-	$file          = 'give' . $suffix . '.css';
137
+	$file          = 'give'.$suffix.'.css';
138 138
 	$templates_dir = give_get_theme_template_dir_name();
139 139
 
140
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
141
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css';
142
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
143
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css';
144
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
140
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
141
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css';
142
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
143
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css';
144
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
145 145
 
146 146
 	// Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory
147 147
 	// Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled.
148 148
 	// This allows users to copy just give.css to their theme
149
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
150
-		if ( ! empty( $nonmin ) ) {
151
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css';
149
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
150
+		if ( ! empty($nonmin)) {
151
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css';
152 152
 		} else {
153
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
153
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
154 154
 		}
155
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
156
-		if ( ! empty( $nonmin ) ) {
157
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css';
155
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
156
+		if ( ! empty($nonmin)) {
157
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css';
158 158
 		} else {
159
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
159
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
160 160
 		}
161
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
162
-		$url = trailingslashit( give_get_templates_url() ) . $file;
161
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
162
+		$url = trailingslashit(give_get_templates_url()).$file;
163 163
 	}
164 164
 
165
-	wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' );
166
-	wp_enqueue_style( 'give-styles' );
165
+	wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all');
166
+	wp_enqueue_style('give-styles');
167 167
 
168 168
 }
169 169
 
170
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
170
+add_action('wp_enqueue_scripts', 'give_register_styles');
171 171
 
172 172
 /**
173 173
  * Load Admin Scripts
@@ -183,65 +183,65 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return void
185 185
  */
186
-function give_load_admin_scripts( $hook ) {
186
+function give_load_admin_scripts($hook) {
187 187
 
188 188
 	global $wp_version, $post, $post_type, $give_options;
189 189
 
190 190
 	//Directories of assets
191
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
192
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
193
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
191
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
192
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
193
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
194 194
 
195 195
 	// Use minified libraries if SCRIPT_DEBUG is turned off
196
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
196
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
197 197
 
198 198
 	//Global Admin:
199
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
200
-	wp_enqueue_style( 'give-admin-bar-notification' );
199
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
200
+	wp_enqueue_style('give-admin-bar-notification');
201 201
 
202 202
 	//Give Admin Only:
203
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
203
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
204 204
 		return;
205 205
 	}
206 206
 
207 207
 	//CSS
208
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
209
-	wp_enqueue_style( 'jquery-ui-css' );
210
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION );
211
-	wp_enqueue_style( 'give-admin' );
212
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
213
-	wp_enqueue_style( 'jquery-chosen' );
214
-	wp_enqueue_style( 'thickbox' );
208
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
209
+	wp_enqueue_style('jquery-ui-css');
210
+	wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION);
211
+	wp_enqueue_style('give-admin');
212
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
213
+	wp_enqueue_style('jquery-chosen');
214
+	wp_enqueue_style('thickbox');
215 215
 
216 216
 	//JS
217
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
218
-	wp_enqueue_script( 'jquery-chosen' );
217
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
218
+	wp_enqueue_script('jquery-chosen');
219 219
 
220
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
221
-	wp_enqueue_script( 'give-accounting' );
220
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
221
+	wp_enqueue_script('give-accounting');
222 222
 
223
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
224
-	wp_enqueue_script( 'give-admin-scripts' );
223
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
224
+	wp_enqueue_script('give-admin-scripts');
225 225
 
226
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
227
-	wp_enqueue_script( 'jquery-flot' );
226
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
227
+	wp_enqueue_script('jquery-flot');
228 228
 
229
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
230
-	wp_enqueue_script( 'give-qtip' );
229
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
230
+	wp_enqueue_script('give-qtip');
231 231
 
232
-	wp_enqueue_script( 'jquery-ui-datepicker' );
233
-	wp_enqueue_script( 'thickbox' );
232
+	wp_enqueue_script('jquery-ui-datepicker');
233
+	wp_enqueue_script('thickbox');
234 234
 
235 235
 	// Forms CPT Script.
236
-	if ( $post_type === 'give_forms' ) {
237
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
238
-		wp_enqueue_script( 'give-admin-forms-scripts' );
236
+	if ($post_type === 'give_forms') {
237
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
238
+		wp_enqueue_script('give-admin-forms-scripts');
239 239
 	}
240 240
 
241 241
     //Settings Scripts
242
-    if (isset($_GET['page']) && $_GET['page'] == 'give-settings'  ) {
243
-        wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
244
-        wp_enqueue_script( 'give-admin-settings-scripts' );
242
+    if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
243
+        wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
244
+        wp_enqueue_script('give-admin-settings-scripts');
245 245
     }
246 246
 
247 247
     // Price Separators.
@@ -249,50 +249,50 @@  discard block
 block discarded – undo
249 249
     $decimal_separator  = give_get_price_decimal_separator();
250 250
 
251 251
     //Localize strings & variables for JS
252
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
253
-		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
252
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
253
+		'post_id'                 => isset($post->ID) ? $post->ID : null,
254 254
 		'give_version'            => GIVE_VERSION,
255 255
         'thousands_separator'     => $thousand_separator,
256 256
         'decimal_separator'       => $decimal_separator,
257
-        'quick_edit_warning'      => esc_html__( 'Sorry, not available for variable priced forms.', 'give' ),
258
-		'delete_payment'          => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ),
259
-		'delete_payment_note'     => esc_html__( 'Are you sure you wish to delete this note?', 'give' ),
260
-		'revoke_api_key'          => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ),
261
-		'regenerate_api_key'      => esc_html__( 'Are you sure you wish to regenerate this API key?', 'give' ),
262
-		'resend_receipt'          => esc_html__( 'Are you sure you wish to resend the donation receipt?', 'give' ),
263
-		'copy_download_link_text' => esc_html__( 'Copy these links to your clipboard and give them to your donor.', 'give' ),
257
+        'quick_edit_warning'      => esc_html__('Sorry, not available for variable priced forms.', 'give'),
258
+		'delete_payment'          => esc_html__('Are you sure you wish to delete this payment?', 'give'),
259
+		'delete_payment_note'     => esc_html__('Are you sure you wish to delete this note?', 'give'),
260
+		'revoke_api_key'          => esc_html__('Are you sure you wish to revoke this API key?', 'give'),
261
+		'regenerate_api_key'      => esc_html__('Are you sure you wish to regenerate this API key?', 'give'),
262
+		'resend_receipt'          => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'),
263
+		'copy_download_link_text' => esc_html__('Copy these links to your clipboard and give them to your donor.', 'give'),
264 264
 		/* translators: %s: form singular label */
265
-		'delete_payment_download' => sprintf( esc_html__( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ),
266
-		'one_price_min'           => esc_html__( 'You must have at least one price.', 'give' ),
267
-		'one_file_min'            => esc_html__( 'You must have at least one file.', 'give' ),
268
-		'one_field_min'           => esc_html__( 'You must have at least one field.', 'give' ),
265
+		'delete_payment_download' => sprintf(esc_html__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()),
266
+		'one_price_min'           => esc_html__('You must have at least one price.', 'give'),
267
+		'one_file_min'            => esc_html__('You must have at least one file.', 'give'),
268
+		'one_field_min'           => esc_html__('You must have at least one field.', 'give'),
269 269
 		/* translators: %s: form singular label */
270
-		'one_option'              => sprintf( esc_html__( 'Choose a %s', 'give' ), give_get_forms_label_singular() ),
270
+		'one_option'              => sprintf(esc_html__('Choose a %s', 'give'), give_get_forms_label_singular()),
271 271
 		/* translators: %s: form plural label */
272
-		'one_or_more_option'      => sprintf( esc_html__( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ),
273
-		'numeric_item_price'      => esc_html__( 'Item price must be numeric.', 'give' ),
274
-		'numeric_quantity'        => esc_html__( 'Quantity must be numeric.', 'give' ),
275
-		'currency_sign'           => give_currency_filter( '' ),
276
-		'currency_pos'            => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
272
+		'one_or_more_option'      => sprintf(esc_html__('Choose one or more %s', 'give'), give_get_forms_label_plural()),
273
+		'numeric_item_price'      => esc_html__('Item price must be numeric.', 'give'),
274
+		'numeric_quantity'        => esc_html__('Quantity must be numeric.', 'give'),
275
+		'currency_sign'           => give_currency_filter(''),
276
+		'currency_pos'            => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
277 277
 		'currency_decimals'       => give_currency_decimal_filter(),
278
-		'new_media_ui'            => apply_filters( 'give_use_35_media_ui', 1 ),
279
-		'remove_text'             => esc_html__( 'Remove', 'give' ),
278
+		'new_media_ui'            => apply_filters('give_use_35_media_ui', 1),
279
+		'remove_text'             => esc_html__('Remove', 'give'),
280 280
 		/* translators: %s: form plural label */
281
-		'type_to_search'          => sprintf( esc_html__( 'Type to search %s', 'give' ), give_get_forms_label_plural() ),
282
-		'batch_export_no_class'   => esc_html__( 'You must choose a method.', 'give' ),
283
-		'batch_export_no_reqs'    => esc_html__( 'Required fields not completed.', 'give' ),
284
-		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
285
-        'price_format_guide'      => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ).', 'give' ), $decimal_separator, $thousand_separator )
286
-    ) );
287
-
288
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
281
+		'type_to_search'          => sprintf(esc_html__('Type to search %s', 'give'), give_get_forms_label_plural()),
282
+		'batch_export_no_class'   => esc_html__('You must choose a method.', 'give'),
283
+		'batch_export_no_reqs'    => esc_html__('Required fields not completed.', 'give'),
284
+		'reset_stats_warn'        => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
285
+        'price_format_guide'      => sprintf(esc_html__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ).', 'give'), $decimal_separator, $thousand_separator)
286
+    ));
287
+
288
+	if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) {
289 289
 		//call for new media manager
290 290
 		wp_enqueue_media();
291 291
 	}
292 292
 
293 293
 }
294 294
 
295
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
295
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
296 296
 
297 297
 /**
298 298
  * Admin Give Icon
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
 	?>
310 310
 	<style type="text/css" media="screen">
311 311
 
312
-		<?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?>
312
+		<?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?>
313 313
 		@font-face {
314 314
 			font-family: 'give-icomoon';
315
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>');
316
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
317
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
318
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
319
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
315
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>');
316
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
317
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
318
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
319
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
320 320
 			font-weight: normal;
321 321
 			font-style: normal;
322 322
 		}
@@ -335,4 +335,4 @@  discard block
 block discarded – undo
335 335
 	<?php
336 336
 }
337 337
 
338
-add_action( 'admin_head', 'give_admin_icon' );
338
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
55
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
55
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
56 56
 			'ajax'     => false                       // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59 59
 		$this->query();
60 60
 	}
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return string Column Name
72 72
 	 */
73
-	public function column_default( $item, $column_name ) {
74
-		return $item[ $column_name ];
73
+	public function column_default($item, $column_name) {
74
+		return $item[$column_name];
75 75
 	}
76 76
 
77 77
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return string Column Name
87 87
 	 */
88
-	public function column_key( $item ) {
89
-		return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
88
+	public function column_key($item) {
89
+		return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string Column Name
102 102
 	 */
103
-	public function column_token( $item ) {
104
-		return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
103
+	public function column_token($item) {
104
+		return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
105 105
 	}
106 106
 
107 107
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return void
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'view'      => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-reports',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email']
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate'
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke'
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	public function get_columns() {
179 179
 		$columns = array(
180
-			'user'   => esc_html__( 'Username', 'give' ),
181
-			'key'    => esc_html__( 'Public Key', 'give' ),
182
-			'token'  => esc_html__( 'Token', 'give' ),
183
-			'secret' => esc_html__( 'Secret Key', 'give' )
180
+			'user'   => esc_html__('Username', 'give'),
181
+			'key'    => esc_html__('Public Key', 'give'),
182
+			'token'  => esc_html__('Token', 'give'),
183
+			'secret' => esc_html__('Secret Key', 'give')
184 184
 		);
185 185
 
186 186
 		return $columns;
@@ -193,19 +193,19 @@  discard block
 block discarded – undo
193 193
 	 * @since  1.1
194 194
 	 * @return void
195 195
 	 */
196
-	function bulk_actions( $which = '' ) {
196
+	function bulk_actions($which = '') {
197 197
 		// These aren't really bulk actions but this outputs the markup in the right place
198 198
 		static $give_api_is_bottom;
199 199
 
200
-		if ( $give_api_is_bottom ) {
200
+		if ($give_api_is_bottom) {
201 201
 			return;
202 202
 		}
203 203
 		?>
204 204
 		<input type="hidden" name="give_action" value="process_api_key"/>
205 205
 		<input type="hidden" name="give_api_process" value="generate"/>
206
-		<?php wp_nonce_field( 'give-api-nonce' ); ?>
206
+		<?php wp_nonce_field('give-api-nonce'); ?>
207 207
 		<?php echo Give()->html->ajax_user_search(); ?>
208
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
208
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
209 209
 		<?php
210 210
 		$give_api_is_bottom = true;
211 211
 	}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return int Current page number
219 219
 	 */
220 220
 	public function get_paged() {
221
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
221
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
222 222
 	}
223 223
 
224 224
 	/**
@@ -229,21 +229,21 @@  discard block
 block discarded – undo
229 229
 	 * @return array
230 230
 	 */
231 231
 	public function query() {
232
-		$users = get_users( array(
232
+		$users = get_users(array(
233 233
 			'meta_value' => 'give_user_secret_key',
234 234
 			'number'     => $this->per_page,
235
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 )
236
-		) );
237
-		$keys  = array();
238
-
239
-		foreach ( $users as $user ) {
240
-			$keys[ $user->ID ]['id']    = $user->ID;
241
-			$keys[ $user->ID ]['email'] = $user->user_email;
242
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
243
-
244
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
245
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
246
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
235
+			'offset'     => $this->per_page * ($this->get_paged() - 1)
236
+		));
237
+		$keys = array();
238
+
239
+		foreach ($users as $user) {
240
+			$keys[$user->ID]['id']    = $user->ID;
241
+			$keys[$user->ID]['email'] = $user->user_email;
242
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
243
+
244
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
245
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
246
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
247 247
 		}
248 248
 
249 249
 		return $keys;
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	public function total_items() {
261 261
 		global $wpdb;
262 262
 
263
-		if ( ! get_transient( 'give_total_api_keys' ) ) {
264
-			$total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" );
263
+		if ( ! get_transient('give_total_api_keys')) {
264
+			$total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'");
265 265
 
266
-			set_transient( 'give_total_api_keys', $total_items, 60 * 60 );
266
+			set_transient('give_total_api_keys', $total_items, 60 * 60);
267 267
 		}
268 268
 
269
-		return get_transient( 'give_total_api_keys' );
269
+		return get_transient('give_total_api_keys');
270 270
 	}
271 271
 
272 272
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$hidden   = array(); // No hidden columns
283 283
 		$sortable = array(); // Not sortable... for now
284 284
 
285
-		$this->_column_headers = array( $columns, $hidden, $sortable, 'id' );
285
+		$this->_column_headers = array($columns, $hidden, $sortable, 'id');
286 286
 
287 287
 		$data = $this->query();
288 288
 
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 
291 291
 		$this->items = $data;
292 292
 
293
-		$this->set_pagination_args( array(
293
+		$this->set_pagination_args(array(
294 294
 				'total_items' => $total_items,
295 295
 				'per_page'    => $this->per_page,
296
-				'total_pages' => ceil( $total_items / $this->per_page )
296
+				'total_pages' => ceil($total_items / $this->per_page)
297 297
 			)
298 298
 		);
299 299
 	}
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . esc_html__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.esc_html__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-login.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@
 block discarded – undo
42 42
 				'minWidth' => 320,
43 43
 				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),
44 44
 			),
45
-            array(
46
-                'type' => 'container',
47
-                'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
48
-            ),
49
-            array(
50
-                'type'     => 'textbox',
51
-                'name'     => 'logout-redirect',
52
-                'minWidth' => 320,
53
-                'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
54
-            ),
45
+			array(
46
+				'type' => 'container',
47
+				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
48
+			),
49
+			array(
50
+				'type'     => 'textbox',
51
+				'name'     => 'logout-redirect',
52
+				'minWidth' => 320,
53
+				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
54
+			),
55 55
 		);
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Login extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Login', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Login', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Login', 'give');
22
+		$this->shortcode['label'] = esc_html__('Login', 'give');
23 23
 
24
-		parent::__construct( 'give_login' );
24
+		parent::__construct('give_login');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Login Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Login Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'login-redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),
43
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after login.', 'give'),
44 44
 			),
45 45
             array(
46 46
                 'type' => 'container',
47
-                'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
47
+                'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Logout Redirect URL (optional):', 'give')),
48 48
             ),
49 49
             array(
50 50
                 'type'     => 'textbox',
51 51
                 'name'     => 'logout-redirect',
52 52
                 'minWidth' => 320,
53
-                'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
53
+                'tooltip'  => esc_attr__('Enter an URL here to redirect to after logout.', 'give'),
54 54
             ),
55 55
 		);
56 56
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_History extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = esc_attr__( 'Donation History', 'give' );
21
+		$this->shortcode['label'] = esc_attr__('Donation History', 'give');
22 22
 
23
-		parent::__construct( 'donation_history' );
23
+		parent::__construct('donation_history');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since       1.3.0
12 12
  */
13 13
 
14
-defined( 'ABSPATH' ) or exit;
14
+defined('ABSPATH') or exit;
15 15
 
16 16
 /**
17 17
  * Class Give_Shortcode_Button
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function __construct() {
32 32
 
33
-		if ( is_admin() ) {
34
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
33
+		if (is_admin()) {
34
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
35 35
 
36
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
37
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
38
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
36
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
37
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
38
+			add_action('media_buttons', array($this, 'shortcode_button'));
39 39
 		}
40 40
 
41
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
42
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
41
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
42
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @since 1.0
53 53
 	 */
54
-	public function mce_external_plugins( $plugin_array ) {
54
+	public function mce_external_plugins($plugin_array) {
55 55
 
56
-		if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
56
+		if (current_user_can('edit_posts') && current_user_can('edit_pages')) {
57 57
 
58
-			$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
58
+			$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
59 59
 
60
-			$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
60
+			$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
61 61
 		}
62 62
 
63 63
 		return $plugin_array;
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function admin_enqueue_assets() {
74 74
 
75
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
75
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
76 76
 
77 77
 		wp_enqueue_script(
78 78
 			'give_shortcode',
79
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
80
-			array( 'jquery' ),
79
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
80
+			array('jquery'),
81 81
 			GIVE_VERSION,
82 82
 			true
83 83
 		);
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function admin_localize_scripts() {
94 94
 
95
-		if ( ! empty( self::$shortcodes ) ) {
95
+		if ( ! empty(self::$shortcodes)) {
96 96
 
97 97
 			$variables = array();
98 98
 
99
-			foreach ( self::$shortcodes as $shortcode => $values ) {
100
-				if ( ! empty( $values['required'] ) ) {
101
-					$variables[ $shortcode ] = $values['required'];
99
+			foreach (self::$shortcodes as $shortcode => $values) {
100
+				if ( ! empty($values['required'])) {
101
+					$variables[$shortcode] = $values['required'];
102 102
 				}
103 103
 			}
104 104
 
105
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
105
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
106 106
 		}
107 107
 	}
108 108
 
@@ -117,24 +117,24 @@  discard block
 block discarded – undo
117 117
 
118 118
 		global $pagenow, $wp_version;
119 119
 
120
-		$shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' );
120
+		$shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php');
121 121
 		// Only run in admin post/page creation and edit screens
122
-		if ( in_array( $pagenow, $shortcode_button_pages )
123
-		     && apply_filters( 'give_shortcode_button_condition', true )
124
-		     && ! empty( self::$shortcodes )
122
+		if (in_array($pagenow, $shortcode_button_pages)
123
+		     && apply_filters('give_shortcode_button_condition', true)
124
+		     && ! empty(self::$shortcodes)
125 125
 		) {
126 126
 
127 127
 			$shortcodes = array();
128 128
 
129
-			foreach ( self::$shortcodes as $shortcode => $values ) {
129
+			foreach (self::$shortcodes as $shortcode => $values) {
130 130
 				/**
131 131
 				 * Filters the condition for including the current shortcode
132 132
 				 *
133 133
 				 * @since 1.0
134 134
 				 */
135
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
135
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
136 136
 
137
-					$shortcodes[ $shortcode ] = sprintf(
137
+					$shortcodes[$shortcode] = sprintf(
138 138
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>',
139 139
 						$shortcode,
140 140
 						$values['label'],
@@ -143,18 +143,18 @@  discard block
 block discarded – undo
143 143
 				}
144 144
 			}
145 145
 
146
-			if ( ! empty( $shortcodes ) ) {
146
+			if ( ! empty($shortcodes)) {
147 147
 
148 148
 				// check current WP version
149
-				$img = ( version_compare( $wp_version, '3.5', '<' ) )
150
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
151
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
149
+				$img = (version_compare($wp_version, '3.5', '<'))
150
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
151
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
152 152
 
153
-				reset( $shortcodes );
153
+				reset($shortcodes);
154 154
 
155
-				if ( count( $shortcodes ) == 1 ) {
155
+				if (count($shortcodes) == 1) {
156 156
 
157
-					$shortcode = key( $shortcodes );
157
+					$shortcode = key($shortcodes);
158 158
 
159 159
 					printf(
160 160
 						'<button class="button sc-shortcode" data-shortcode="%s">%s</button>',
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 						sprintf(
163 163
 							'%s %s %s',
164 164
 							$img,
165
-							esc_html__( 'Insert', 'give' ),
166
-							self::$shortcodes[ $shortcode ]['label']
165
+							esc_html__('Insert', 'give'),
166
+							self::$shortcodes[$shortcode]['label']
167 167
 						)
168 168
 					);
169 169
 				} else {
170 170
 					printf(
171
-						'<div class="sc-wrap">' .
172
-						'<button class="button sc-button">%s %s</button>' .
173
-						'<div class="sc-menu mce-menu">%s</div>' .
171
+						'<div class="sc-wrap">'.
172
+						'<button class="button sc-button">%s %s</button>'.
173
+						'<div class="sc-menu mce-menu">%s</div>'.
174 174
 						'</div>',
175 175
 						$img,
176
-						esc_html__( 'Give Shortcodes', 'give' ),
177
-						implode( '', array_values( $shortcodes ) )
176
+						esc_html__('Give Shortcodes', 'give'),
177
+						implode('', array_values($shortcodes))
178 178
 					);
179 179
 				}
180 180
 			}
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function shortcode_ajax() {
192 192
 
193
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
193
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
194 194
 		$response  = false;
195 195
 
196
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
196
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
197 197
 
198
-			$data = self::$shortcodes[ $shortcode ];
198
+			$data = self::$shortcodes[$shortcode];
199 199
 
200
-			if ( ! empty( $data['errors'] ) ) {
201
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
200
+			if ( ! empty($data['errors'])) {
201
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
202 202
 			}
203 203
 
204 204
 			$response = array(
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 			);
211 211
 		} else {
212 212
 			// todo: handle error
213
-			error_log( print_r( 'AJAX error!', 1 ) );
213
+			error_log(print_r('AJAX error!', 1));
214 214
 		}
215 215
 
216
-		wp_send_json( $response );
216
+		wp_send_json($response);
217 217
 	}
218 218
 }
219 219
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/abstract-shortcode-generator.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -248,8 +248,8 @@
 block discarded – undo
248 248
 
249 249
 			// do not reindex array!
250 250
 			$field['options'] = array(
251
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
252
-			                    ) + $field['options'];
251
+									'' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
252
+								) + $field['options'];
253 253
 
254 254
 			foreach ( $field['options'] as $value => $text ) {
255 255
 				$new_listbox['values'][] = array(
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since       1.3.0
12 12
  */
13 13
 
14
-defined( 'ABSPATH' ) or exit;
14
+defined('ABSPATH') or exit;
15 15
 
16 16
 abstract class Give_Shortcode_Generator {
17 17
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @since 1.0
59 59
 	 */
60
-	public function __construct( $shortcode ) {
60
+	public function __construct($shortcode) {
61 61
 
62 62
 
63 63
 		$this->shortcode_tag = $shortcode;
64 64
 
65
-		add_action( 'admin_init', array( $this, 'init' ) );
65
+		add_action('admin_init', array($this, 'init'));
66 66
 
67 67
 	}
68 68
 
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function init() {
75 75
 
76
-		if ( $this->shortcode_tag ) {
76
+		if ($this->shortcode_tag) {
77 77
 
78
-			$this->self = get_class( $this );
78
+			$this->self = get_class($this);
79 79
 
80 80
 			$this->errors   = array();
81 81
 			$this->required = array();
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 			$fields = $this->get_fields();
85 85
 
86 86
 			$defaults = array(
87
-				'btn_close' => esc_html__( 'Close', 'give' ),
88
-				'btn_okay'  => esc_html__( 'Insert Shortcode', 'give' ),
87
+				'btn_close' => esc_html__('Close', 'give'),
88
+				'btn_okay'  => esc_html__('Insert Shortcode', 'give'),
89 89
 				'errors'    => $this->errors,
90 90
 				'fields'    => $fields,
91
-				'label'     => '[' . $this->shortcode_tag . ']',
91
+				'label'     => '['.$this->shortcode_tag.']',
92 92
 				'required'  => $this->required,
93
-				'title'     => esc_html__( 'Insert Shortcode', 'give' ),
93
+				'title'     => esc_html__('Insert Shortcode', 'give'),
94 94
 			);
95 95
 
96
-			if ( user_can_richedit() ) {
96
+			if (user_can_richedit()) {
97 97
 
98
-				Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
98
+				Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
99 99
 
100 100
 			}
101 101
 		}
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @since 1.0
126 126
 	 */
127
-	protected function generate_fields( $defined_fields ) {
127
+	protected function generate_fields($defined_fields) {
128 128
 
129 129
 		$fields = array();
130 130
 
131
-		if ( is_array( $defined_fields ) ) {
131
+		if (is_array($defined_fields)) {
132 132
 
133
-			foreach ( $defined_fields as $field ) {
133
+			foreach ($defined_fields as $field) {
134 134
 
135 135
 				$defaults = array(
136 136
 					'label'       => false,
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 					'type'        => '',
142 142
 				);
143 143
 
144
-				$field  = wp_parse_args( (array) $field, $defaults );
145
-				$method = 'generate_' . strtolower( $field['type'] );
144
+				$field  = wp_parse_args((array) $field, $defaults);
145
+				$method = 'generate_'.strtolower($field['type']);
146 146
 
147
-				if ( method_exists( $this, $method ) ) {
147
+				if (method_exists($this, $method)) {
148 148
 
149
-					$field = call_user_func( array( $this, $method ), $field );
149
+					$field = call_user_func(array($this, $method), $field);
150 150
 
151
-					if ( $field ) {
151
+					if ($field) {
152 152
 						$fields[] = $field;
153 153
 					}
154 154
 				}
@@ -168,22 +168,22 @@  discard block
 block discarded – undo
168 168
 	protected function get_fields() {
169 169
 
170 170
 		$defined_fields   = $this->define_fields();
171
-		$generated_fields = $this->generate_fields( $defined_fields );
171
+		$generated_fields = $this->generate_fields($defined_fields);
172 172
 
173 173
 		$errors = array();
174 174
 
175
-		if ( ! empty( $this->errors ) ) {
176
-			foreach ( $this->required as $name => $alert ) {
177
-				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) {
175
+		if ( ! empty($this->errors)) {
176
+			foreach ($this->required as $name => $alert) {
177
+				if (false === array_search($name, array_column($generated_fields, 'name'))) {
178 178
 
179
-					$errors[] = $this->errors[ $name ];
179
+					$errors[] = $this->errors[$name];
180 180
 				}
181 181
 			}
182 182
 
183 183
 			$this->errors = $errors;
184 184
 		}
185 185
 
186
-		if ( ! empty( $errors ) ) {
186
+		if ( ! empty($errors)) {
187 187
 
188 188
 			return $errors;
189 189
 		}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @since 1.0
202 202
 	 */
203
-	protected function generate_container( $field ) {
203
+	protected function generate_container($field) {
204 204
 
205
-		if ( array_key_exists( 'html', $field ) ) {
205
+		if (array_key_exists('html', $field)) {
206 206
 
207 207
 			return array(
208 208
 				'type' => $field['type'],
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @since 1.0
224 224
 	 */
225
-	protected function generate_listbox( $field ) {
225
+	protected function generate_listbox($field) {
226 226
 
227
-		$listbox = shortcode_atts( array(
227
+		$listbox = shortcode_atts(array(
228 228
 			'label'    => '',
229 229
 			'minWidth' => '',
230 230
 			'name'     => false,
231 231
 			'tooltip'  => '',
232 232
 			'type'     => '',
233 233
 			'value'    => '',
234
-		), $field );
234
+		), $field);
235 235
 
236
-		if ( $this->validate( $field ) ) {
236
+		if ($this->validate($field)) {
237 237
 
238 238
 			$new_listbox = array();
239 239
 
240
-			foreach ( $listbox as $key => $value ) {
240
+			foreach ($listbox as $key => $value) {
241 241
 
242
-				if ( $key == 'value' && empty( $value ) ) {
243
-					$new_listbox[ $key ] = $listbox['name'];
244
-				} else if ( $value ) {
245
-					$new_listbox[ $key ] = $value;
242
+				if ($key == 'value' && empty($value)) {
243
+					$new_listbox[$key] = $listbox['name'];
244
+				} else if ($value) {
245
+					$new_listbox[$key] = $value;
246 246
 				}
247 247
 			}
248 248
 
249 249
 			// do not reindex array!
250 250
 			$field['options'] = array(
251
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
251
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')),
252 252
 			                    ) + $field['options'];
253 253
 
254
-			foreach ( $field['options'] as $value => $text ) {
254
+			foreach ($field['options'] as $value => $text) {
255 255
 				$new_listbox['values'][] = array(
256 256
 					'text'  => $text,
257 257
 					'value' => $value,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @since 1.0
275 275
 	 */
276
-	protected function generate_post( $field ) {
276
+	protected function generate_post($field) {
277 277
 
278 278
 		$args = array(
279 279
 			'post_type'      => 'post',
@@ -282,23 +282,23 @@  discard block
 block discarded – undo
282 282
 			'posts_per_page' => 30,
283 283
 		);
284 284
 
285
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
286
-		$posts   = get_posts( $args );
285
+		$args    = wp_parse_args((array) $field['query_args'], $args);
286
+		$posts   = get_posts($args);
287 287
 		$options = array();
288 288
 
289
-		if ( $posts ) {
290
-			foreach ( $posts as $post ) {
291
-				$options[ absint( $post->ID ) ] = esc_html( $post->post_title );
289
+		if ($posts) {
290
+			foreach ($posts as $post) {
291
+				$options[absint($post->ID)] = esc_html($post->post_title);
292 292
 			}
293 293
 
294 294
 			$field['type']    = 'listbox';
295 295
 			$field['options'] = $options;
296 296
 
297
-			return $this->generate_listbox( $field );
297
+			return $this->generate_listbox($field);
298 298
 		}
299 299
 
300 300
 		// perform validation here before returning false
301
-		$this->validate( $field );
301
+		$this->validate($field);
302 302
 
303 303
 		return false;
304 304
 	}
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @since 1.0
314 314
 	 */
315
-	protected function generate_textbox( $field ) {
315
+	protected function generate_textbox($field) {
316 316
 
317
-		$textbox = shortcode_atts( array(
317
+		$textbox = shortcode_atts(array(
318 318
 			'label'     => '',
319 319
 			'maxLength' => '',
320 320
 			'minHeight' => '',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 			'tooltip'   => '',
325 325
 			'type'      => '',
326 326
 			'value'     => '',
327
-		), $field );
327
+		), $field);
328 328
 
329
-		if ( $this->validate( $field ) ) {
330
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
329
+		if ($this->validate($field)) {
330
+			return array_filter($textbox, array($this, 'return_textbox_value'));
331 331
 		}
332 332
 
333 333
 		return false;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return bool
342 342
 	 */
343
-	function return_textbox_value( $value ) {
343
+	function return_textbox_value($value) {
344 344
 		return $value !== '';
345 345
 	}
346 346
 
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @since 1.0
358 358
 	 */
359
-	protected function validate( $field ) {
359
+	protected function validate($field) {
360 360
 
361
-		extract( shortcode_atts(
361
+		extract(shortcode_atts(
362 362
 				array(
363 363
 					'name'     => false,
364 364
 					'required' => false,
@@ -366,36 +366,36 @@  discard block
 block discarded – undo
366 366
 				), $field )
367 367
 		);
368 368
 
369
-		if ( $name ) {
369
+		if ($name) {
370 370
 
371
-			if ( isset( $required['error'] ) ) {
371
+			if (isset($required['error'])) {
372 372
 
373 373
 				$error = array(
374 374
 					'type' => 'container',
375 375
 					'html' => $required['error'],
376 376
 				);
377 377
 
378
-				$this->errors[ $name ] = $this->generate_container( $error );
378
+				$this->errors[$name] = $this->generate_container($error);
379 379
 			}
380 380
 
381
-			if ( ! ! $required || is_array( $required ) ) {
381
+			if ( ! ! $required || is_array($required)) {
382 382
 
383
-				$alert = esc_html__( 'Some of the Shortcode options are required.', 'give' );
383
+				$alert = esc_html__('Some of the Shortcode options are required.', 'give');
384 384
 
385
-				if ( isset( $required['alert'] ) ) {
385
+				if (isset($required['alert'])) {
386 386
 
387 387
 					$alert = $required['alert'];
388 388
 
389
-				} else if ( ! empty( $label ) ) {
389
+				} else if ( ! empty($label)) {
390 390
 
391 391
 					$alert = sprintf(
392 392
 						/* translators: %s: option lable */
393
-						__( 'The "%s" option is required.', 'give' ),
394
-						str_replace( ':', '', $label )
393
+						__('The "%s" option is required.', 'give'),
394
+						str_replace(':', '', $label)
395 395
 					);
396 396
 				}
397 397
 
398
-				$this->required[ $name ] = $alert;
398
+				$this->required[$name] = $alert;
399 399
 			}
400 400
 
401 401
 			return true;
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +83 added lines, -83 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	//Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => esc_html__( 'Name', 'give' ),
36
-		'form_category' => esc_html__( 'Categories', 'give' ),
37
-		'form_tag'      => esc_html__( 'Tags', 'give' ),
38
-		'price'         => esc_html__( 'Price', 'give' ),
39
-		'goal'          => esc_html__( 'Goal', 'give' ),
40
-		'donations'     => esc_html__( 'Donations', 'give' ),
41
-		'earnings'      => esc_html__( 'Income', 'give' ),
42
-		'shortcode'     => esc_html__( 'Shortcode', 'give' ),
43
-		'date'          => esc_html__( 'Date', 'give' )
35
+		'title'         => esc_html__('Name', 'give'),
36
+		'form_category' => esc_html__('Categories', 'give'),
37
+		'form_tag'      => esc_html__('Tags', 'give'),
38
+		'price'         => esc_html__('Price', 'give'),
39
+		'goal'          => esc_html__('Goal', 'give'),
40
+		'donations'     => esc_html__('Donations', 'give'),
41
+		'earnings'      => esc_html__('Income', 'give'),
42
+		'shortcode'     => esc_html__('Shortcode', 'give'),
43
+		'date'          => esc_html__('Date', 'give')
44 44
 	);
45 45
 
46 46
 	//Does the user want categories / tags?
47
-	if ( give_get_option( 'enable_categories' ) !== 'on' ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if (give_get_option('enable_categories') !== 'on') {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( give_get_option( 'enable_tags' ) !== 'on' ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if (give_get_option('enable_tags') !== 'on') {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,67 +66,67 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 		global $give_options;
72 72
 
73
-		$style = isset( $give_options['button_style'] ) ? $give_options['button_style'] : 'button';
74
-		$color = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'blue';
75
-		$color = ( $color == 'inherit' ) ? '' : $color;
73
+		$style = isset($give_options['button_style']) ? $give_options['button_style'] : 'button';
74
+		$color = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'blue';
75
+		$color = ($color == 'inherit') ? '' : $color;
76 76
 
77
-		$purchase_text = ! empty( $give_options['add_to_cart_text'] ) ? $give_options['add_to_cart_text'] : esc_html__( 'Purchase', 'give' );
77
+		$purchase_text = ! empty($give_options['add_to_cart_text']) ? $give_options['add_to_cart_text'] : esc_html__('Purchase', 'give');
78 78
 
79
-		switch ( $column_name ) {
79
+		switch ($column_name) {
80 80
 			case 'form_category':
81
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
81
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
82 82
 				break;
83 83
 			case 'form_tag':
84
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
84
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
85 85
 				break;
86 86
 			case 'price':
87
-				if ( give_has_variable_prices( $post_id ) ) {
88
-					echo give_price_range( $post_id );
87
+				if (give_has_variable_prices($post_id)) {
88
+					echo give_price_range($post_id);
89 89
 				} else {
90
-					echo give_price( $post_id, false );
91
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
90
+					echo give_price($post_id, false);
91
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
92 92
 				}
93 93
 				break;
94 94
 			case 'goal':
95
-				$goal_option = get_post_meta( $post_id, '_give_goal_option', true );
96
-				if ( ! empty( $goal_option ) && $goal_option === 'yes' ) {
97
-					echo give_goal( $post_id, false );
95
+				$goal_option = get_post_meta($post_id, '_give_goal_option', true);
96
+				if ( ! empty($goal_option) && $goal_option === 'yes') {
97
+					echo give_goal($post_id, false);
98 98
 				} else {
99
-					echo esc_html__( 'No Goal Set', 'give' );
99
+					echo esc_html__('No Goal Set', 'give');
100 100
 				}
101 101
 
102
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
102
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
103 103
 				break;
104 104
 			case 'donations':
105
-				if ( current_user_can( 'view_give_forms_stats', $post_id ) ) {
106
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form=' . $post_id ) ) . '">';
107
-					echo give_get_form_sales_stats( $post_id );
105
+				if (current_user_can('view_give_forms_stats', $post_id)) {
106
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form='.$post_id)).'">';
107
+					echo give_get_form_sales_stats($post_id);
108 108
 					echo '</a>';
109 109
 				} else {
110 110
 					echo '-';
111 111
 				}
112 112
 				break;
113 113
 			case 'earnings':
114
-				if ( current_user_can( 'view_give_forms_stats', $post_id ) ) {
115
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">';
116
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) );
114
+				if (current_user_can('view_give_forms_stats', $post_id)) {
115
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">';
116
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id)));
117 117
 					echo '</a>';
118 118
 				} else {
119 119
 					echo '-';
120 120
 				}
121 121
 				break;
122 122
 			case 'shortcode':
123
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
123
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
124 124
 				break;
125 125
 		}
126 126
 	}
127 127
 }
128 128
 
129
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
129
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
130 130
 
131 131
 /**
132 132
  * Registers the sortable columns in the list table
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
  *
138 138
  * @return array $columns Array of sortable columns
139 139
  */
140
-function give_sortable_form_columns( $columns ) {
140
+function give_sortable_form_columns($columns) {
141 141
 	$columns['price']    = 'price';
142 142
 	$columns['sales']    = 'sales';
143 143
 	$columns['earnings'] = 'earnings';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	return $columns;
147 147
 }
148 148
 
149
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
149
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
150 150
 
151 151
 /**
152 152
  * Sorts Columns in the Forms List Table
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
  *
158 158
  * @return array $vars Array of all the sort variables
159 159
  */
160
-function give_sort_forms( $vars ) {
160
+function give_sort_forms($vars) {
161 161
 	// Check if we're viewing the "give_forms" post type
162
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
162
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
163 163
 		// Check if 'orderby' is set to "sales"
164
-		if ( isset( $vars['orderby'] ) && 'sales' == $vars['orderby'] ) {
164
+		if (isset($vars['orderby']) && 'sales' == $vars['orderby']) {
165 165
 			$vars = array_merge(
166 166
 				$vars,
167 167
 				array(
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		}
173 173
 
174 174
 		// Check if "orderby" is set to "earnings"
175
-		if ( isset( $vars['orderby'] ) && 'earnings' == $vars['orderby'] ) {
175
+		if (isset($vars['orderby']) && 'earnings' == $vars['orderby']) {
176 176
 			$vars = array_merge(
177 177
 				$vars,
178 178
 				array(
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 
185 185
 		// Check if "orderby" is set to "price"
186
-		if ( isset( $vars['orderby'] ) && 'price' == $vars['orderby'] ) {
186
+		if (isset($vars['orderby']) && 'price' == $vars['orderby']) {
187 187
 			$vars = array_merge(
188 188
 				$vars,
189 189
 				array(
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		// Check if "orderby" is set to "goal"
197
-		if ( isset( $vars['orderby'] ) && 'goal' == $vars['orderby'] ) {
197
+		if (isset($vars['orderby']) && 'goal' == $vars['orderby']) {
198 198
 			$vars = array_merge(
199 199
 				$vars,
200 200
 				array(
@@ -217,16 +217,16 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return array       Array of all sort variables
219 219
  */
220
-function give_filter_forms( $vars ) {
221
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
220
+function give_filter_forms($vars) {
221
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
222 222
 
223 223
 		// If an author ID was passed, use it
224
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
224
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
225 225
 
226 226
 			$author_id = $_REQUEST['author'];
227
-			if ( (int) $author_id !== get_current_user_id() ) {
227
+			if ((int) $author_id !== get_current_user_id()) {
228 228
 				// Tried to view the products of another person, sorry
229
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
229
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
230 230
 			}
231 231
 			$vars = array_merge(
232 232
 				$vars,
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
  * @return void
252 252
  */
253 253
 function give_forms_load() {
254
-	add_filter( 'request', 'give_sort_forms' );
255
-	add_filter( 'request', 'give_filter_forms' );
254
+	add_filter('request', 'give_sort_forms');
255
+	add_filter('request', 'give_filter_forms');
256 256
 }
257 257
 
258
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
258
+add_action('load-edit.php', 'give_forms_load', 9999);
259 259
 
260 260
 /**
261 261
  * Remove Forms Month Filter
@@ -269,17 +269,17 @@  discard block
 block discarded – undo
269 269
  * @global      $typenow The post type we are viewing
270 270
  * @return array Empty array disables the dropdown
271 271
  */
272
-function give_remove_month_filter( $dates ) {
272
+function give_remove_month_filter($dates) {
273 273
 	global $typenow;
274 274
 
275
-	if ( $typenow == 'give_forms' ) {
275
+	if ($typenow == 'give_forms') {
276 276
 		$dates = array();
277 277
 	}
278 278
 
279 279
 	return $dates;
280 280
 }
281 281
 
282
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
282
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
283 283
 
284 284
 /**
285 285
  * Adds price field to Quick Edit options
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
  *
292 292
  * @return void
293 293
  */
294
-function give_price_field_quick_edit( $column_name, $post_type ) {
295
-	if ( $column_name != 'price' || $post_type != 'give_forms' ) {
294
+function give_price_field_quick_edit($column_name, $post_type) {
295
+	if ($column_name != 'price' || $post_type != 'give_forms') {
296 296
 		return;
297 297
 	}
298 298
 	?>
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 			<h4><?php 
302 302
 				printf(
303 303
 					/* translators: %s: forms singular label */
304
-					esc_html__( '%s Configuration', 'give' ),
304
+					esc_html__('%s Configuration', 'give'),
305 305
 					give_get_forms_label_singular()
306 306
 				);
307 307
 			?></h4>
308 308
 			<label>
309
-				<span class="title"><?php esc_html_e( 'Price', 'give' ); ?></span>
309
+				<span class="title"><?php esc_html_e('Price', 'give'); ?></span>
310 310
 				<span class="input-text-wrap">
311 311
 					<input type="text" name="_give_regprice" class="text regprice" />
312 312
 				</span>
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	<?php
318 318
 }
319 319
 
320
-add_action( 'quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2 );
321
-add_action( 'bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2 );
320
+add_action('quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2);
321
+add_action('bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2);
322 322
 
323 323
 /**
324 324
  * Updates price when saving post
@@ -329,23 +329,23 @@  discard block
 block discarded – undo
329 329
  *
330 330
  * @return void
331 331
  */
332
-function give_price_save_quick_edit( $post_id ) {
333
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
332
+function give_price_save_quick_edit($post_id) {
333
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
334 334
 		return;
335 335
 	}
336
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
336
+	if ( ! current_user_can('edit_post', $post_id)) {
337 337
 		return $post_id;
338 338
 	}
339
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
339
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
340 340
 		return $post_id;
341 341
 	}
342 342
 
343
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
344
-		update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) );
343
+	if (isset($_REQUEST['_give_regprice'])) {
344
+		update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice'])));
345 345
 	}
346 346
 }
347 347
 
348
-add_action( 'save_post', 'give_price_save_quick_edit' );
348
+add_action('save_post', 'give_price_save_quick_edit');
349 349
 
350 350
 /**
351 351
  * Process bulk edit actions via AJAX
@@ -355,18 +355,18 @@  discard block
 block discarded – undo
355 355
  */
356 356
 function give_save_bulk_edit() {
357 357
 
358
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
358
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
359 359
 
360
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
361
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
362
-		foreach ( $post_ids as $post_id ) {
360
+	if ( ! empty($post_ids) && is_array($post_ids)) {
361
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
362
+		foreach ($post_ids as $post_id) {
363 363
 
364
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
364
+			if ( ! current_user_can('edit_post', $post_id)) {
365 365
 				continue;
366 366
 			}
367 367
 
368
-			if ( ! empty( $price ) ) {
369
-				update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) );
368
+			if ( ! empty($price)) {
369
+				update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price));
370 370
 			}
371 371
 		}
372 372
 	}
@@ -374,4 +374,4 @@  discard block
 block discarded – undo
374 374
 	die();
375 375
 }
376 376
 
377
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
377
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.