Completed
Push — master ( b2b30d...461219 )
by Matt
20:30
created
includes/user-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@
 block discarded – undo
270 270
  * @access      public
271 271
  * @since       1.0
272 272
  *
273
- * @param       $username string - the username to validate
273
+ * @param       string $username string - the username to validate
274 274
  *
275 275
  * @return      bool
276 276
  */
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|object List of all user 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,42 +402,42 @@  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_attr__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
413
+	$message  = sprintf(esc_attr__('New user registration on your site %s:'), $blogname)."\r\n\r\n";
414 414
 	/* translators: %s: user login */
415
-	$message .= sprintf( esc_attr__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n\r\n";
415
+	$message .= sprintf(esc_attr__('Username: %s'), $user_data['user_login'])."\r\n\r\n";
416 416
 	/* translators: %s: user email */
417
-	$message .= sprintf( esc_attr__( 'E-mail: %s' ), $user_data['user_email'] ) . "\r\n";
417
+	$message .= sprintf(esc_attr__('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_attr__( '[%s] New User Registration' ),
423
+			esc_attr__('[%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( esc_attr__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n";
430
+	$message  = sprintf(esc_attr__('Username: %s'), $user_data['user_login'])."\r\n";
431 431
 	/* translators: %s: paswword */
432
-	$message .= sprintf( esc_attr__( 'Password: %s' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n";
432
+	$message .= sprintf(esc_attr__('Password: %s'), esc_attr__('[Password entered during donation]', 'give'))."\r\n";
433 433
 
434
-	$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login &raquo;', 'give' ) . '</a>' . "\r\n";
434
+	$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login &raquo;', 'give').'</a>'."\r\n";
435 435
 
436 436
 	wp_mail(
437 437
 		$user_data['user_email'],
438 438
 		sprintf(
439 439
 			/* translators: %s: site name */
440
-			esc_attr__( '[%s] Your username and password' ),
440
+			esc_attr__('[%s] Your username and password'),
441 441
 			$blogname
442 442
 		),
443 443
 		$message
@@ -445,4 +445,4 @@  discard block
 block discarded – undo
445 445
 
446 446
 }
447 447
 
448
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
448
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
Please login to merge, or discard this patch.
includes/admin/admin-actions.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
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  * @return void
23 23
  */
24 24
 function give_process_actions() {
25
-	if ( isset( $_POST['give-action'] ) ) {
26
-		do_action( 'give_' . $_POST['give-action'], $_POST );
25
+	if (isset($_POST['give-action'])) {
26
+		do_action('give_'.$_POST['give-action'], $_POST);
27 27
 	}
28 28
 
29
-	if ( isset( $_GET['give-action'] ) ) {
30
-		do_action( 'give_' . $_GET['give-action'], $_GET );
29
+	if (isset($_GET['give-action'])) {
30
+		do_action('give_'.$_GET['give-action'], $_GET);
31 31
 	}
32 32
 }
33 33
 
34
-add_action( 'admin_init', 'give_process_actions' );
35 34
\ No newline at end of file
35
+add_action('admin_init', 'give_process_actions');
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 2 patches
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Payment History Page
@@ -63,11 +65,13 @@  discard block
 block discarded – undo
63 65
  */
64 66
 function give_view_order_details_title( $admin_title, $title ) {
65 67
 
66
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base )
67
-		return $admin_title;
68
+	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
69
+			return $admin_title;
70
+	}
68 71
 
69
-	if( ! isset( $_GET['give-action'] ) )
70
-		return $admin_title;
72
+	if( ! isset( $_GET['give-action'] ) ) {
73
+			return $admin_title;
74
+	}
71 75
 
72 76
 	switch( $_GET['give-action'] ) :
73 77
 
@@ -99,11 +103,13 @@  discard block
 block discarded – undo
99 103
 function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
100 104
 
101 105
 	$post = get_post( $post_id );
102
-	if( ! $post )
103
-		return $url;
106
+	if( ! $post ) {
107
+			return $url;
108
+	}
104 109
 
105
-	if( 'give_payment' != $post->post_type )
106
-		return $url;
110
+	if( 'give_payment' != $post->post_type ) {
111
+			return $url;
112
+	}
107 113
 
108 114
 	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
109 115
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 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' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Payment History Page
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 function give_payment_history_page() {
25 25
 	global $give_options;
26 26
 
27
-	$give_payment = get_post_type_object( 'give_payment' );
27
+	$give_payment = get_post_type_object('give_payment');
28 28
 
29
-	if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) {
30
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php';
29
+	if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) {
30
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php';
31 31
 	} else {
32
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
32
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
33 33
 		$payments_table = new Give_Payment_History_Table();
34 34
 		$payments_table->prepare_items();
35 35
 	?>
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		 *
44 44
 		 * @since 1.0
45 45
 		 */
46
-		do_action( 'give_payments_page_top' );
46
+		do_action('give_payments_page_top');
47 47
 		?>
48 48
 
49
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
49
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
50 50
 			<input type="hidden" name="post_type" value="give_forms" />
51 51
 			<input type="hidden" name="page" value="give-payment-history" />
52 52
 			<?php $payments_table->views() ?>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 *
61 61
 		 * @since 1.0
62 62
 		 */
63
-		do_action( 'give_payments_page_bottom' );
63
+		do_action('give_payments_page_bottom');
64 64
 		?>
65 65
 
66 66
 	</div>
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
  * @param $title
78 78
  * @return string
79 79
  */
80
-function give_view_order_details_title( $admin_title, $title ) {
80
+function give_view_order_details_title($admin_title, $title) {
81 81
 
82
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base )
82
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base)
83 83
 		return $admin_title;
84 84
 
85
-	if( ! isset( $_GET['give-action'] ) )
85
+	if ( ! isset($_GET['give-action']))
86 86
 		return $admin_title;
87 87
 
88
-	switch( $_GET['give-action'] ) :
88
+	switch ($_GET['give-action']) :
89 89
 
90 90
 		case 'view-order-details' :
91 91
 			$title = sprintf(
92 92
 				/* translators: %s: admin title */
93
-				esc_html__( 'View Donation Details - %s', 'give' ),
93
+				esc_html__('View Donation Details - %s', 'give'),
94 94
 				$admin_title
95 95
 			);
96 96
 			break;
97 97
 		case 'edit-payment' :
98 98
 			$title = sprintf(
99 99
 				/* translators: %s: admin title */
100
-				esc_html__( 'Edit Payment - %s', 'give' ),
100
+				esc_html__('Edit Payment - %s', 'give'),
101 101
 				$admin_title
102 102
 			);
103 103
 			break;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 	return $title;
110 110
 }
111
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
111
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
112 112
 
113 113
 /**
114 114
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
  * @param $context
121 121
  * @return string
122 122
  */
123
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
123
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
124 124
 
125
-	$post = get_post( $post_id );
126
-	if( ! $post )
125
+	$post = get_post($post_id);
126
+	if ( ! $post)
127 127
 		return $url;
128 128
 
129
-	if( 'give_payment' != $post->post_type )
129
+	if ('give_payment' != $post->post_type)
130 130
 		return $url;
131 131
 
132
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
132
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id);
133 133
 
134 134
 	return $url;
135 135
 }
136
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
136
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -440,8 +440,10 @@
 block discarded – undo
440 440
 												echo give_get_payment_note_html( $note, $payment_id );
441 441
 
442 442
 											endforeach;
443
-										else :
443
+										else {
444
+											:
444 445
 											$no_notes_display = '';
446
+										}
445 447
 										endif;
446 448
 										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>';
447 449
 										?>
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if purchase ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a payment. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a payment. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -53,75 +53,75 @@  discard block
 block discarded – undo
53 53
 	<h1 id="transaction-details-heading"><?php
54 54
 		printf(
55 55
 		/* translators: %s: payment number */
56
-			esc_html__( 'Payment %s', 'give' ),
56
+			esc_html__('Payment %s', 'give'),
57 57
 			$number
58 58
 		);
59
-		if ( $payment_mode == 'test' ) {
60
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Payment', 'give' ) . '</span>';
59
+		if ($payment_mode == 'test') {
60
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Payment', 'give').'</span>';
61 61
 		}
62 62
 		?></h1>
63 63
 
64
-	<?php do_action( 'give_view_order_details_before', $payment_id ); ?>
64
+	<?php do_action('give_view_order_details_before', $payment_id); ?>
65 65
 	<form id="give-edit-order-form" method="post">
66
-		<?php do_action( 'give_view_order_details_form_top', $payment_id ); ?>
66
+		<?php do_action('give_view_order_details_form_top', $payment_id); ?>
67 67
 		<div id="poststuff">
68 68
 			<div id="give-dashboard-widgets-wrap">
69 69
 				<div id="post-body" class="metabox-holder columns-2">
70 70
 					<div id="postbox-container-1" class="postbox-container">
71 71
 						<div id="side-sortables" class="meta-box-sortables ui-sortable">
72 72
 
73
-							<?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?>
73
+							<?php do_action('give_view_order_details_sidebar_before', $payment_id); ?>
74 74
 
75 75
 							<div id="give-order-update" class="postbox give-order-data">
76 76
 
77 77
 								<h3 class="hndle">
78
-									<span><?php esc_html_e( 'Update Payment', 'give' ); ?></span>
78
+									<span><?php esc_html_e('Update Payment', 'give'); ?></span>
79 79
 								</h3>
80 80
 
81 81
 								<div class="inside">
82 82
 									<div class="give-admin-box">
83 83
 
84
-										<?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?>
84
+										<?php do_action('give_view_order_details_totals_before', $payment_id); ?>
85 85
 
86 86
 										<div class="give-admin-box-inside">
87 87
 											<p>
88
-												<span class="label"><?php esc_html_e( 'Status:', 'give' ); ?></span>&nbsp;
88
+												<span class="label"><?php esc_html_e('Status:', 'give'); ?></span>&nbsp;
89 89
 												<select name="give-payment-status" class="medium-text">
90
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
91
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
90
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
91
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
92 92
 													<?php endforeach; ?>
93 93
 												</select>
94
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
94
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
95 95
 											</p>
96 96
 										</div>
97 97
 
98 98
 										<div class="give-admin-box-inside">
99 99
 											<p>
100
-												<span class="label"><?php esc_html_e( 'Date:', 'give' ); ?></span>&nbsp;
101
-												<input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
100
+												<span class="label"><?php esc_html_e('Date:', 'give'); ?></span>&nbsp;
101
+												<input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
102 102
 											</p>
103 103
 										</div>
104 104
 
105 105
 										<div class="give-admin-box-inside">
106 106
 											<p>
107
-												<span class="label"><?php esc_html_e( 'Time:', 'give' ); ?></span>&nbsp;
108
-												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
109
-												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
107
+												<span class="label"><?php esc_html_e('Time:', 'give'); ?></span>&nbsp;
108
+												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
109
+												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
110 110
 											</p>
111 111
 										</div>
112 112
 
113
-										<?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?>
113
+										<?php do_action('give_view_order_details_update_inner', $payment_id); ?>
114 114
 
115 115
 										<?php
116 116
 										//@TODO: Fees
117
-										$fees = give_get_payment_fees( $payment_id );
118
-										if ( ! empty( $fees ) ) : ?>
117
+										$fees = give_get_payment_fees($payment_id);
118
+										if ( ! empty($fees)) : ?>
119 119
 											<div class="give-order-fees give-admin-box-inside">
120
-												<p class="strong"><?php esc_html_e( 'Fees', 'give' ); ?>:</p>
120
+												<p class="strong"><?php esc_html_e('Fees', 'give'); ?>:</p>
121 121
 												<ul class="give-payment-fees">
122
-													<?php foreach ( $fees as $fee ) : ?>
122
+													<?php foreach ($fees as $fee) : ?>
123 123
 														<li>
124
-															<span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span>
124
+															<span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span>
125 125
 														</li>
126 126
 													<?php endforeach; ?>
127 127
 												</ul>
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 
132 132
 										<div class="give-order-payment give-admin-box-inside">
133 133
 											<p>
134
-												<span class="label"><?php esc_html_e( 'Total Donation', 'give' ); ?>:</span>&nbsp;
135
-												<?php echo give_currency_symbol( $payment->currency ); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
134
+												<span class="label"><?php esc_html_e('Total Donation', 'give'); ?>:</span>&nbsp;
135
+												<?php echo give_currency_symbol($payment->currency); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
136 136
 											</p>
137 137
 										</div>
138 138
 
139
-										<?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?>
139
+										<?php do_action('give_view_order_details_totals_after', $payment_id); ?>
140 140
 
141 141
 									</div>
142 142
 									<!-- /.give-admin-box -->
@@ -145,20 +145,20 @@  discard block
 block discarded – undo
145 145
 								<!-- /.inside -->
146 146
 
147 147
 								<div class="give-order-update-box give-admin-box">
148
-									<?php do_action( 'give_view_order_details_update_before', $payment_id ); ?>
148
+									<?php do_action('give_view_order_details_update_before', $payment_id); ?>
149 149
 									<div id="major-publishing-actions">
150 150
 										<div id="publishing-action">
151
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/>
152
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
153
-												<a href="<?php echo esc_url( add_query_arg( array(
151
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/>
152
+											<?php if (give_is_payment_complete($payment_id)) : ?>
153
+												<a href="<?php echo esc_url(add_query_arg(array(
154 154
 													'give-action' => 'email_links',
155 155
 													'purchase_id' => $payment_id
156
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
156
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
157 157
 											<?php endif; ?>
158 158
 										</div>
159 159
 										<div class="clear"></div>
160 160
 									</div>
161
-									<?php do_action( 'give_view_order_details_update_after', $payment_id ); ?>
161
+									<?php do_action('give_view_order_details_update_after', $payment_id); ?>
162 162
 								</div>
163 163
 								<!-- /.give-order-update-box -->
164 164
 
@@ -168,55 +168,55 @@  discard block
 block discarded – undo
168 168
 							<div id="give-order-details" class="postbox give-order-data">
169 169
 
170 170
 								<h3 class="hndle">
171
-									<span><?php esc_html_e( 'Payment Meta', 'give' ); ?></span>
171
+									<span><?php esc_html_e('Payment Meta', 'give'); ?></span>
172 172
 								</h3>
173 173
 
174 174
 								<div class="inside">
175 175
 									<div class="give-admin-box">
176 176
 
177
-										<?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?>
177
+										<?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?>
178 178
 
179 179
 										<?php
180
-										$gateway = give_get_payment_gateway( $payment_id );
181
-										if ( $gateway ) : ?>
180
+										$gateway = give_get_payment_gateway($payment_id);
181
+										if ($gateway) : ?>
182 182
 											<div class="give-order-gateway give-admin-box-inside">
183 183
 												<p>
184
-													<span class="label"><?php esc_html_e( 'Gateway:', 'give' ); ?></span>&nbsp;
185
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
184
+													<span class="label"><?php esc_html_e('Gateway:', 'give'); ?></span>&nbsp;
185
+													<?php echo give_get_gateway_admin_label($gateway); ?>
186 186
 												</p>
187 187
 											</div>
188 188
 										<?php endif; ?>
189 189
 
190 190
 										<div class="give-order-payment-key give-admin-box-inside">
191 191
 											<p>
192
-												<span class="label"><?php esc_html_e( 'Key:', 'give' ); ?></span>&nbsp;
193
-												<span><?php echo give_get_payment_key( $payment_id ); ?></span>
192
+												<span class="label"><?php esc_html_e('Key:', 'give'); ?></span>&nbsp;
193
+												<span><?php echo give_get_payment_key($payment_id); ?></span>
194 194
 											</p>
195 195
 										</div>
196 196
 
197 197
 										<div class="give-order-ip give-admin-box-inside">
198 198
 											<p>
199
-												<span class="label"><?php esc_html_e( 'IP:', 'give' ); ?></span>&nbsp;
200
-												<span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span>
199
+												<span class="label"><?php esc_html_e('IP:', 'give'); ?></span>&nbsp;
200
+												<span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span>
201 201
 											</p>
202 202
 										</div>
203 203
 
204
-										<?php if ( $transaction_id ) : ?>
204
+										<?php if ($transaction_id) : ?>
205 205
 											<div class="give-order-tx-id give-admin-box-inside">
206 206
 												<p>
207
-													<span class="label"><?php esc_html_e( 'Transaction ID:', 'give' ); ?></span>&nbsp;
208
-													<span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span>
207
+													<span class="label"><?php esc_html_e('Transaction ID:', 'give'); ?></span>&nbsp;
208
+													<span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span>
209 209
 												</p>
210 210
 											</div>
211 211
 										<?php endif; ?>
212 212
 
213 213
 										<div class="give-admin-box-inside">
214
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
215
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
214
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
215
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
216 216
 											</p>
217 217
 										</div>
218 218
 
219
-										<?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?>
219
+										<?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?>
220 220
 
221 221
 									</div>
222 222
 									<!-- /.column-container -->
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 							</div>
228 228
 							<!-- /#give-order-data -->
229 229
 
230
-							<?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?>
230
+							<?php do_action('give_view_order_details_sidebar_after', $payment_id); ?>
231 231
 
232 232
 						</div>
233 233
 						<!-- /#side-sortables -->
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 
239 239
 						<div id="normal-sortables" class="meta-box-sortables ui-sortable">
240 240
 
241
-							<?php do_action( 'give_view_order_details_main_before', $payment_id ); ?>
241
+							<?php do_action('give_view_order_details_main_before', $payment_id); ?>
242 242
 
243 243
 							<?php $column_count = 'columns-3'; ?>
244 244
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
245 245
 								<h3 class="hndle">
246
-									<span><?php esc_html_e( 'Donation Information', 'give' ); ?></span>
246
+									<span><?php esc_html_e('Donation Information', 'give'); ?></span>
247 247
 								</h3>
248 248
 
249 249
 								<div class="inside">
@@ -251,32 +251,32 @@  discard block
 block discarded – undo
251 251
 									<table style="width:100%;">
252 252
 										<thead>
253 253
 										<tr>
254
-											<?php do_action( 'give_donation_details_thead_before', $payment_id ); ?>
255
-											<th><?php esc_html_e( 'Donation Form ID', 'give' ) ?></th>
256
-											<th><?php esc_html_e( 'Donation Form Title', 'give' ) ?></th>
257
-											<th><?php esc_html_e( 'Donation Level', 'give' ) ?></th>
258
-											<th><?php esc_html_e( 'Donation Date', 'give' ) ?></th>
259
-											<th><?php esc_html_e( 'Total Donation', 'give' ) ?></th>
260
-											<?php do_action( 'give_donation_details_thead_after', $payment_id ); ?>
254
+											<?php do_action('give_donation_details_thead_before', $payment_id); ?>
255
+											<th><?php esc_html_e('Donation Form ID', 'give') ?></th>
256
+											<th><?php esc_html_e('Donation Form Title', 'give') ?></th>
257
+											<th><?php esc_html_e('Donation Level', 'give') ?></th>
258
+											<th><?php esc_html_e('Donation Date', 'give') ?></th>
259
+											<th><?php esc_html_e('Total Donation', 'give') ?></th>
260
+											<?php do_action('give_donation_details_thead_after', $payment_id); ?>
261 261
 										</tr>
262 262
 										</thead>
263 263
 										<tr>
264
-											<?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?>
264
+											<?php do_action('give_donation_details_tbody_before', $payment_id); ?>
265 265
 											<td>
266 266
 												<?php echo $payment_meta['form_id']; ?>
267 267
 											</td>
268 268
 											<td>
269
-												<?php give_get_form_dropdown( array(
269
+												<?php give_get_form_dropdown(array(
270 270
 													'id'       => $payment_meta['form_id'],
271 271
 													'selected' => $payment_meta['form_id'],
272 272
 													'chosen'   => true
273
-												), true ); ?>
273
+												), true); ?>
274 274
 											</td>
275 275
 											<td>
276 276
 												<?php
277
-												$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
278
-												if ( empty( $var_prices ) ) {
279
-													echo esc_html__( 'n/a', 'give' );
277
+												$var_prices = give_has_variable_prices($payment_meta['form_id']);
278
+												if (empty($var_prices)) {
279
+													echo esc_html__('n/a', 'give');
280 280
 												} else {
281 281
 													// Variable price dropdown options.
282 282
 													$variable_price_dropdown_option = array(
@@ -288,20 +288,20 @@  discard block
 block discarded – undo
288 288
 													);
289 289
 
290 290
 													// Render variable prices select tag html.
291
-													give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
291
+													give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
292 292
 												}
293 293
 												?>
294 294
 											</td>
295 295
 											<td>
296 296
 												<?php
297 297
 												//Transaction Date
298
-												$date_format = get_option( 'date_format' );
299
-												echo date_i18n( $date_format, $payment_date );
298
+												$date_format = get_option('date_format');
299
+												echo date_i18n($date_format, $payment_date);
300 300
 												?>
301 301
 											</td>
302 302
 											<td>
303
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td>
304
-											<?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?>
303
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td>
304
+											<?php do_action('give_donation_details_tbody_after', $payment_id); ?>
305 305
 
306 306
 										</tr>
307 307
 									</table>
@@ -313,64 +313,64 @@  discard block
 block discarded – undo
313 313
 							</div>
314 314
 							<!-- /#give-donation-overview -->
315 315
 
316
-							<?php do_action( 'give_view_order_details_files_after', $payment_id ); ?>
316
+							<?php do_action('give_view_order_details_files_after', $payment_id); ?>
317 317
 
318
-							<?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?>
318
+							<?php do_action('give_view_order_details_billing_before', $payment_id); ?>
319 319
 
320 320
 
321 321
 							<div id="give-customer-details" class="postbox">
322 322
 								<h3 class="hndle">
323
-									<span><?php esc_html_e( 'Donor Details', 'give' ); ?></span>
323
+									<span><?php esc_html_e('Donor Details', 'give'); ?></span>
324 324
 								</h3>
325 325
 
326 326
 								<div class="inside give-clearfix">
327 327
 
328
-									<?php $customer = new Give_Customer( $customer_id ); ?>
328
+									<?php $customer = new Give_Customer($customer_id); ?>
329 329
 
330 330
 									<div class="column-container customer-info">
331 331
 										<div class="column">
332
-											<?php echo Give()->html->donor_dropdown( array(
332
+											<?php echo Give()->html->donor_dropdown(array(
333 333
 												'selected' => $customer->id,
334 334
 												'name'     => 'customer-id'
335
-											) ); ?>
335
+											)); ?>
336 336
 										</div>
337 337
 										<div class="column">
338 338
 											<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
339 339
 										</div>
340 340
 										<div class="column">
341
-											<?php if ( ! empty( $customer->id ) ) : ?>
342
-												<?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>
343
-												<a href="<?php echo $customer_url; ?>" title="<?php esc_attr_e( 'View Donor Details', 'give' ); ?>"><?php esc_html_e( 'View Donor Details', 'give' ); ?></a>
341
+											<?php if ( ! empty($customer->id)) : ?>
342
+												<?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>
343
+												<a href="<?php echo $customer_url; ?>" title="<?php esc_attr_e('View Donor Details', 'give'); ?>"><?php esc_html_e('View Donor Details', 'give'); ?></a>
344 344
 												&nbsp;|&nbsp;
345 345
 											<?php endif; ?>
346
-											<a href="#new" class="give-payment-new-customer" title="<?php esc_attr_e( 'New Donor', 'give' ); ?>"><?php esc_html_e( 'New Donor', 'give' ); ?></a>
346
+											<a href="#new" class="give-payment-new-customer" title="<?php esc_attr_e('New Donor', 'give'); ?>"><?php esc_html_e('New Donor', 'give'); ?></a>
347 347
 										</div>
348 348
 									</div>
349 349
 
350 350
 									<div class="column-container new-customer" style="display: none">
351 351
 										<div class="column">
352
-											<label for="give-new-customer-name"><?php esc_html_e( 'Name:', 'give' ); ?></label>&nbsp;
352
+											<label for="give-new-customer-name"><?php esc_html_e('Name:', 'give'); ?></label>&nbsp;
353 353
 											<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
354 354
 										</div>
355 355
 										<div class="column">
356
-											<label for="give-new-customer-email"><?php esc_html_e( 'Email:', 'give' ); ?></label>&nbsp;
356
+											<label for="give-new-customer-email"><?php esc_html_e('Email:', 'give'); ?></label>&nbsp;
357 357
 											<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
358 358
 										</div>
359 359
 										<div class="column">
360 360
 											<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
361
-											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
361
+											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
362 362
 										</div>
363 363
 										<div class="column">
364 364
 											<small>
365
-												<em>*<?php esc_html_e( 'Click "Save Payment" to create new donor', 'give' ); ?></em>
365
+												<em>*<?php esc_html_e('Click "Save Payment" to create new donor', 'give'); ?></em>
366 366
 											</small>
367 367
 										</div>
368 368
 									</div>
369 369
 
370 370
 									<?php
371 371
 									// The give_payment_personal_details_list hook is left here for backwards compatibility
372
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
373
-									do_action( 'give_payment_view_details', $payment_id );
372
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
373
+									do_action('give_payment_view_details', $payment_id);
374 374
 									?>
375 375
 
376 376
 								</div>
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
 							<div id="give-billing-details" class="postbox">
383 383
 								<h3 class="hndle">
384
-									<span><?php esc_html_e( 'Billing Address', 'give' ); ?></span>
384
+									<span><?php esc_html_e('Billing Address', 'give'); ?></span>
385 385
 								</h3>
386 386
 
387 387
 								<div class="inside give-clearfix">
@@ -392,62 +392,62 @@  discard block
 block discarded – undo
392 392
 											<div class="data column-container">
393 393
 												<div class="column">
394 394
 													<div class="give-wrap-address-line1">
395
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Street Address Line 1:', 'give' ); ?></label>
396
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
395
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Street Address Line 1:', 'give'); ?></label>
396
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
397 397
 													</div>
398 398
 
399 399
 													<div class="give-wrap-address-line2">
400
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Street Address Line 2:', 'give' ); ?></label>
401
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
400
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Street Address Line 2:', 'give'); ?></label>
401
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
402 402
 													</div>
403 403
 
404 404
 												</div>
405 405
 												<div class="column">
406 406
 													<div class="give-wrap-address-city">
407
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
408
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
407
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
408
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
409 409
 
410 410
 													</div>
411 411
 
412 412
 													<div class="give-wrap-address-zip">
413
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
414
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
413
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
414
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
415 415
 
416 416
 													</div>
417 417
 												</div>
418 418
 												<div class="column">
419 419
 													<div id="give-order-address-country-wrap">
420
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
420
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
421 421
 														<?php
422
-														echo Give()->html->select( array(
422
+														echo Give()->html->select(array(
423 423
 															'options'          => give_get_country_list(),
424 424
 															'name'             => 'give-payment-address[0][country]',
425 425
 															'selected'         => $address['country'],
426 426
 															'show_option_all'  => false,
427 427
 															'show_option_none' => false,
428 428
 															'chosen'           => true,
429
-															'placeholder'      => esc_attr__( 'Select a country', 'give' )
430
-														) );
429
+															'placeholder'      => esc_attr__('Select a country', 'give')
430
+														));
431 431
 														?>
432 432
 													</div>
433 433
 
434 434
 													<div id="give-order-address-state-wrap">
435
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label>
435
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label>
436 436
 														<?php
437
-														$states = give_get_states( $address['country'] );
438
-														if ( ! empty( $states ) ) {
439
-															echo Give()->html->select( array(
437
+														$states = give_get_states($address['country']);
438
+														if ( ! empty($states)) {
439
+															echo Give()->html->select(array(
440 440
 																'options'          => $states,
441 441
 																'name'             => 'give-payment-address[0][state]',
442 442
 																'selected'         => $address['state'],
443 443
 																'show_option_all'  => false,
444 444
 																'show_option_none' => false,
445 445
 																'chosen'           => true,
446
-																'placeholder'      => esc_attr__( 'Select a state', 'give' )
447
-															) );
446
+																'placeholder'      => esc_attr__('Select a state', 'give')
447
+															));
448 448
 														} else {
449 449
 															?>
450
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
450
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
451 451
 															<?php
452 452
 														} ?>
453 453
 													</div>
@@ -457,38 +457,38 @@  discard block
 block discarded – undo
457 457
 									</div>
458 458
 									<!-- /#give-order-address -->
459 459
 
460
-									<?php do_action( 'give_payment_billing_details', $payment_id ); ?>
460
+									<?php do_action('give_payment_billing_details', $payment_id); ?>
461 461
 
462 462
 								</div>
463 463
 								<!-- /.inside -->
464 464
 							</div>
465 465
 							<!-- /#give-billing-details -->
466 466
 
467
-							<?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?>
467
+							<?php do_action('give_view_order_details_billing_after', $payment_id); ?>
468 468
 
469 469
 							<div id="give-payment-notes" class="postbox">
470
-								<h3 class="hndle"><span><?php esc_html_e( 'Payment Notes', 'give' ); ?></span></h3>
470
+								<h3 class="hndle"><span><?php esc_html_e('Payment Notes', 'give'); ?></span></h3>
471 471
 
472 472
 								<div class="inside">
473 473
 									<div id="give-payment-notes-inner">
474 474
 										<?php
475
-										$notes = give_get_payment_notes( $payment_id );
476
-										if ( ! empty( $notes ) ) :
475
+										$notes = give_get_payment_notes($payment_id);
476
+										if ( ! empty($notes)) :
477 477
 											$no_notes_display = ' style="display:none;"';
478
-											foreach ( $notes as $note ) :
478
+											foreach ($notes as $note) :
479 479
 
480
-												echo give_get_payment_note_html( $note, $payment_id );
480
+												echo give_get_payment_note_html($note, $payment_id);
481 481
 
482 482
 											endforeach;
483 483
 										else :
484 484
 											$no_notes_display = '';
485 485
 										endif;
486
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No payment notes', 'give' ) . '</p>'; ?>
486
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No payment notes', 'give').'</p>'; ?>
487 487
 									</div>
488 488
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
489 489
 
490 490
 									<div class="give-clearfix">
491
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
491
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
492 492
 									</div>
493 493
 
494 494
 								</div>
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 							</div>
497 497
 							<!-- /#give-payment-notes -->
498 498
 
499
-							<?php do_action( 'give_view_order_details_main_after', $payment_id ); ?>
499
+							<?php do_action('give_view_order_details_main_after', $payment_id); ?>
500 500
 						</div>
501 501
 						<!-- /#normal-sortables -->
502 502
 					</div>
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 			<!-- #give-dashboard-widgets-wrap -->
508 508
 		</div>
509 509
 		<!-- /#post-stuff -->
510
-		<?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?>
511
-		<?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?>
512
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
510
+		<?php do_action('give_view_order_details_form_bottom', $payment_id); ?>
511
+		<?php wp_nonce_field('give_update_payment_details_nonce'); ?>
512
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
513 513
 		<input type="hidden" name="give_action" value="update_payment_details"/>
514 514
 	</form>
515
-	<?php do_action( 'give_view_order_details_after', $payment_id ); ?>
515
+	<?php do_action('give_view_order_details_after', $payment_id); ?>
516 516
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/reporting/class-give-graph.php 1 patch
Spacing   +32 added lines, -32 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
 
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @since 1.0
80 80
 	 */
81
-	public function __construct( $_data ) {
81
+	public function __construct($_data) {
82 82
 
83 83
 		$this->data = $_data;
84 84
 
85 85
 		// Generate unique ID
86
-		$this->id = md5( rand() );
86
+		$this->id = md5(rand());
87 87
 
88 88
 		// Setup default options;
89
-		$this->options = apply_filters( 'give_graph_args', array(
89
+		$this->options = apply_filters('give_graph_args', array(
90 90
 			'y_mode'          => null,
91 91
 			'x_mode'          => null,
92 92
 			'y_decimals'      => 0,
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			'bars'            => true,
104 104
 			'lines'           => false,
105 105
 			'points'          => true
106
-		) );
106
+		));
107 107
 
108 108
 	}
109 109
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @since 1.0
117 117
 	 */
118
-	public function set( $key, $value ) {
119
-		$this->options[ $key ] = $value;
118
+	public function set($key, $value) {
119
+		$this->options[$key] = $value;
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @since 1.0
128 128
 	 */
129
-	public function get( $key ) {
130
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
129
+	public function get($key) {
130
+		return isset($this->options[$key]) ? $this->options[$key] : false;
131 131
 	}
132 132
 
133 133
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @since 1.0
137 137
 	 */
138 138
 	public function get_data() {
139
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
139
+		return apply_filters('give_get_graph_data', $this->data, $this);
140 140
 	}
141 141
 
142 142
 	/**
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function load_scripts() {
148 148
 		// Use minified libraries if SCRIPT_DEBUG is turned off
149
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
149
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
150 150
 
151
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
152
-		wp_enqueue_script( 'jquery-flot-orderbars' );
151
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
152
+		wp_enqueue_script('jquery-flot-orderbars');
153 153
 
154
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
155
-		wp_enqueue_script( 'jquery-flot-time' );
154
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
155
+		wp_enqueue_script('jquery-flot-time');
156 156
 
157
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
158
-		wp_enqueue_script( 'jquery-flot-resize' );
157
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
158
+		wp_enqueue_script('jquery-flot-resize');
159 159
 
160
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
161
-		wp_enqueue_script( 'jquery-flot' );
160
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
161
+		wp_enqueue_script('jquery-flot');
162 162
 
163 163
 	}
164 164
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 					[
186 186
 						<?php
187 187
 							$order = 0;
188
-							foreach( $this->get_data() as $label => $data ) :
188
+							foreach ($this->get_data() as $label => $data) :
189 189
 						?>
190 190
 						{
191
-							label : "<?php echo esc_attr( $label ); ?>",
192
-							id    : "<?php echo sanitize_key( $label ); ?>",
191
+							label : "<?php echo esc_attr($label); ?>",
192
+							id    : "<?php echo sanitize_key($label); ?>",
193 193
 							// data format is: [ point on x, value on y ]
194
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
194
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
195 195
 							points: {
196 196
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
197 197
 							},
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 								fill     : true,
207 207
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
208 208
 							},
209
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
209
+							<?php if ($this->options['multiple_y_axes']) : ?>
210 210
 							yaxis : <?php echo $yaxis_count; ?>
211 211
 							<?php endif; ?>
212 212
 
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 						grid: {
221 221
 							show           : true,
222 222
 							aboveData      : false,
223
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
224
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
225
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
226
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
223
+							color          : "<?php echo $this->options['color']; ?>",
224
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
225
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
226
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
227 227
 							clickable      : false,
228 228
 							hoverable      : true
229 229
 						},
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 							mode        : "<?php echo $this->options['x_mode']; ?>",
235 235
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
236 236
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
237
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
237
+							<?php if ($this->options['x_mode'] != 'time') : ?>
238 238
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
239 239
 							<?php endif; ?>
240 240
 						},
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 							min         : 0,
244 244
 							mode        : "<?php echo $this->options['y_mode']; ?>",
245 245
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
246
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
246
+							<?php if ($this->options['y_mode'] != 'time') : ?>
247 247
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>
248 248
 							<?php endif; ?>
249 249
 						}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 * @since 1.0
304 304
 	 */
305 305
 	public function display() {
306
-		do_action( 'give_before_graph', $this );
306
+		do_action('give_before_graph', $this);
307 307
 		echo $this->build_graph();
308
-		do_action( 'give_after_graph', $this );
308
+		do_action('give_after_graph', $this);
309 309
 	}
310 310
 
311 311
 }
Please login to merge, or discard this patch.
includes/admin/reporting/pdf-reports.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,8 +124,10 @@
 block discarded – undo
124 124
 
125 125
 			$pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) );
126 126
 		endforeach;
127
-	else:
127
+	else {
128
+		:
128 129
 		$pdf->SetWidths( array( 280 ) );
130
+	}
129 131
 		$title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) );
130 132
 		$pdf->Row( array( $title ) );
131 133
 	endif;
Please login to merge, or discard this patch.
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,82 +25,82 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
39
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php';
38
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php';
39
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php';
40 40
 
41 41
 	$daterange = utf8_decode(
42 42
 		sprintf(
43 43
 		/* translators: 1: start date 2: end date */
44
-			esc_html__( '%1$s to %2$s', 'give' ),
45
-			date_i18n( get_option( 'date_format' ), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
46
-			date_i18n( get_option( 'date_format' ) )
44
+			esc_html__('%1$s to %2$s', 'give'),
45
+			date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))),
46
+			date_i18n(get_option('date_format'))
47 47
 		)
48 48
 	);
49 49
 
50 50
 	$pdf = new give_pdf();
51
-	$pdf->AddPage( 'L', 'A4' );
51
+	$pdf->AddPage('L', 'A4');
52 52
 
53
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
54
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
55
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
53
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
54
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
55
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
56 56
 
57
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
57
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
58 58
 
59
-	$pdf->SetMargins( 8, 8, 8 );
60
-	$pdf->SetX( 8 );
59
+	$pdf->SetMargins(8, 8, 8);
60
+	$pdf->SetX(8);
61 61
 
62
-	$pdf->SetFont( 'Helvetica', '', 16 );
63
-	$pdf->SetTextColor( 50, 50, 50 );
64
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
62
+	$pdf->SetFont('Helvetica', '', 16);
63
+	$pdf->SetTextColor(50, 50, 50);
64
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
65 65
 
66
-	$pdf->SetFont( 'Helvetica', '', 13 );
66
+	$pdf->SetFont('Helvetica', '', 13);
67 67
 	$pdf->Ln();
68
-	$pdf->SetTextColor( 150, 150, 150 );
69
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
68
+	$pdf->SetTextColor(150, 150, 150);
69
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
70 70
 	$pdf->Ln();
71
-	$pdf->SetTextColor( 50, 50, 50 );
72
-	$pdf->SetFont( 'Helvetica', '', 14 );
73
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
74
-	$pdf->SetFont( 'Helvetica', '', 12 );
71
+	$pdf->SetTextColor(50, 50, 50);
72
+	$pdf->SetFont('Helvetica', '', 14);
73
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
74
+	$pdf->SetFont('Helvetica', '', 12);
75 75
 
76
-	$pdf->SetFillColor( 238, 238, 238 );
77
-	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
78
-	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
79
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
80
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
81
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
82
-	$pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
76
+	$pdf->SetFillColor(238, 238, 238);
77
+	$pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
78
+	$pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
79
+	$pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
80
+	$pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
81
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
82
+	$pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
83 83
 
84
-	$year       = date( 'Y' );
85
-	$give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) );
84
+	$year       = date('Y');
85
+	$give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
86 86
 
87
-	if ( $give_forms ):
88
-		$pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) );
87
+	if ($give_forms):
88
+		$pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
89 89
 
90
-		foreach ( $give_forms as $form ):
91
-			$pdf->SetFillColor( 255, 255, 255 );
90
+		foreach ($give_forms as $form):
91
+			$pdf->SetFillColor(255, 255, 255);
92 92
 
93 93
 			$title = $form->post_title;
94 94
 
95
-			if ( give_has_variable_prices( $form->ID ) ) {
95
+			if (give_has_variable_prices($form->ID)) {
96 96
 
97
-				$prices = give_get_variable_prices( $form->ID );
97
+				$prices = give_get_variable_prices($form->ID);
98 98
 
99 99
 				$first = $prices[0]['_give_amount'];
100
-				$last  = array_pop( $prices );
100
+				$last  = array_pop($prices);
101 101
 				$last  = $last['_give_amount'];
102 102
 
103
-				if ( $first < $last ) {
103
+				if ($first < $last) {
104 104
 					$min = $first;
105 105
 					$max = $last;
106 106
 				} else {
@@ -108,57 +108,57 @@  discard block
 block discarded – undo
108 108
 					$max = $first;
109 109
 				}
110 110
 
111
-				$price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) );
111
+				$price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max)));
112 112
 			} else {
113
-				$price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) );
113
+				$price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID)));
114 114
 			}
115 115
 
116
-			$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
117
-			$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
116
+			$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
117
+			$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
118 118
 
119
-			$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
120
-			$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
119
+			$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
120
+			$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
121 121
 
122
-			$sales    = give_get_form_sales_stats( $form->ID );
123
-			$link     = get_permalink( $form->ID );
124
-			$earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) );
122
+			$sales    = give_get_form_sales_stats($form->ID);
123
+			$link     = get_permalink($form->ID);
124
+			$earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID)));
125 125
 
126
-			if ( function_exists( 'iconv' ) ) {
126
+			if (function_exists('iconv')) {
127 127
 				// Ensure characters like euro; are properly converted.
128
-				$price    = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) );
129
-				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
128
+				$price    = iconv('UTF-8', 'windows-1252', utf8_encode($price));
129
+				$earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
130 130
 			}
131 131
 
132
-			$pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) );
132
+			$pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
133 133
 		endforeach;
134 134
 	else:
135
-		$pdf->SetWidths( array( 280 ) );
135
+		$pdf->SetWidths(array(280));
136 136
 		$title = utf8_decode(
137 137
 			sprintf(
138 138
 			/* translators: %s: form plural label */
139
-				esc_html__( 'No %s found.', 'give' ),
139
+				esc_html__('No %s found.', 'give'),
140 140
 				give_get_forms_label_plural()
141 141
 			)
142 142
 		);
143
-		$pdf->Row( array( $title ) );
143
+		$pdf->Row(array($title));
144 144
 	endif;
145 145
 
146 146
 	$pdf->Ln();
147
-	$pdf->SetTextColor( 50, 50, 50 );
148
-	$pdf->SetFont( 'Helvetica', '', 14 );
149
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
150
-	$pdf->SetFont( 'Helvetica', '', 12 );
151
-
152
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
153
-	$image = str_replace( ' ', '%20', $image );
154
-
155
-	$pdf->SetX( 25 );
156
-	$pdf->Image( $image . '&file=.png' );
157
-	$pdf->Ln( 7 );
158
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
147
+	$pdf->SetTextColor(50, 50, 50);
148
+	$pdf->SetFont('Helvetica', '', 14);
149
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
150
+	$pdf->SetFont('Helvetica', '', 12);
151
+
152
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
153
+	$image = str_replace(' ', '%20', $image);
154
+
155
+	$pdf->SetX(25);
156
+	$pdf->Image($image.'&file=.png');
157
+	$pdf->Ln(7);
158
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
159 159
 }
160 160
 
161
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
161
+add_action('give_generate_pdf', 'give_generate_pdf');
162 162
 
163 163
 /**
164 164
  * Draws Chart for PDF Report.
@@ -175,38 +175,38 @@  discard block
 block discarded – undo
175 175
  * @return string $chart->getUrl() URL for the Google Chart
176 176
  */
177 177
 function give_draw_chart_image() {
178
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
179
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
180
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
178
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
179
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
180
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
181 181
 
182
-	$chart = new GoogleChart( 'lc', 900, 330 );
182
+	$chart = new GoogleChart('lc', 900, 330);
183 183
 
184 184
 	$i        = 1;
185 185
 	$earnings = "";
186 186
 	$sales    = "";
187 187
 
188
-	while ( $i <= 12 ) :
189
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
190
-		$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
191
-		$i ++;
188
+	while ($i <= 12) :
189
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
190
+		$sales .= give_get_sales_by_date(null, $i, date('Y')).",";
191
+		$i++;
192 192
 	endwhile;
193 193
 
194
-	$earnings_array = explode( ",", $earnings );
195
-	$sales_array    = explode( ",", $sales );
194
+	$earnings_array = explode(",", $earnings);
195
+	$sales_array    = explode(",", $sales);
196 196
 
197 197
 	$i = 0;
198
-	while ( $i <= 11 ) {
199
-		if ( empty( $sales_array[ $i ] ) ) {
200
-			$sales_array[ $i ] = 0;
198
+	while ($i <= 11) {
199
+		if (empty($sales_array[$i])) {
200
+			$sales_array[$i] = 0;
201 201
 		}
202
-		$i ++;
202
+		$i++;
203 203
 	}
204 204
 
205 205
 	$min_earnings   = 0;
206
-	$max_earnings   = max( $earnings_array );
207
-	$earnings_scale = round( $max_earnings, - 1 );
206
+	$max_earnings   = max($earnings_array);
207
+	$earnings_scale = round($max_earnings, - 1);
208 208
 
209
-	$data = new GoogleChartData( array(
209
+	$data = new GoogleChartData(array(
210 210
 		$earnings_array[0],
211 211
 		$earnings_array[1],
212 212
 		$earnings_array[2],
@@ -219,25 +219,25 @@  discard block
 block discarded – undo
219 219
 		$earnings_array[9],
220 220
 		$earnings_array[10],
221 221
 		$earnings_array[11]
222
-	) );
222
+	));
223 223
 
224
-	$data->setLegend( esc_html__( 'Income', 'give' ) );
225
-	$data->setColor( '1b58a3' );
226
-	$chart->addData( $data );
224
+	$data->setLegend(esc_html__('Income', 'give'));
225
+	$data->setColor('1b58a3');
226
+	$chart->addData($data);
227 227
 
228
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
229
-	$shape_marker->setColor( '000000' );
230
-	$shape_marker->setSize( 7 );
231
-	$shape_marker->setBorder( 2 );
232
-	$shape_marker->setData( $data );
233
-	$chart->addMarker( $shape_marker );
228
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
229
+	$shape_marker->setColor('000000');
230
+	$shape_marker->setSize(7);
231
+	$shape_marker->setBorder(2);
232
+	$shape_marker->setData($data);
233
+	$chart->addMarker($shape_marker);
234 234
 
235
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
236
-	$value_marker->setColor( '000000' );
237
-	$value_marker->setData( $data );
238
-	$chart->addMarker( $value_marker );
235
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
236
+	$value_marker->setColor('000000');
237
+	$value_marker->setData($data);
238
+	$chart->addMarker($value_marker);
239 239
 
240
-	$data = new GoogleChartData( array(
240
+	$data = new GoogleChartData(array(
241 241
 		$sales_array[0],
242 242
 		$sales_array[1],
243 243
 		$sales_array[2],
@@ -250,46 +250,46 @@  discard block
 block discarded – undo
250 250
 		$sales_array[9],
251 251
 		$sales_array[10],
252 252
 		$sales_array[11]
253
-	) );
254
-	$data->setLegend( esc_html__( 'Donations', 'give' ) );
255
-	$data->setColor( 'ff6c1c' );
256
-	$chart->addData( $data );
257
-
258
-	$chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
259
-
260
-	$chart->setScale( 0, $max_earnings );
261
-
262
-	$y_axis = new GoogleChartAxis( 'y' );
263
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
264
-	$chart->addAxis( $y_axis );
265
-
266
-	$x_axis = new GoogleChartAxis( 'x' );
267
-	$x_axis->setTickMarks( 5 );
268
-	$x_axis->setLabels( array(
269
-		esc_html__( 'Jan', 'give' ),
270
-		esc_html__( 'Feb', 'give' ),
271
-		esc_html__( 'Mar', 'give' ),
272
-		esc_html__( 'Apr', 'give' ),
273
-		esc_html__( 'May', 'give' ),
274
-		esc_html__( 'June', 'give' ),
275
-		esc_html__( 'July', 'give' ),
276
-		esc_html__( 'Aug', 'give' ),
277
-		esc_html__( 'Sept', 'give' ),
278
-		esc_html__( 'Oct', 'give' ),
279
-		esc_html__( 'Nov', 'give' ),
280
-		esc_html__( 'Dec', 'give' )
281
-	) );
282
-	$chart->addAxis( $x_axis );
283
-
284
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
285
-	$shape_marker->setSize( 6 );
286
-	$shape_marker->setBorder( 2 );
287
-	$shape_marker->setData( $data );
288
-	$chart->addMarker( $shape_marker );
289
-
290
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
291
-	$value_marker->setData( $data );
292
-	$chart->addMarker( $value_marker );
253
+	));
254
+	$data->setLegend(esc_html__('Donations', 'give'));
255
+	$data->setColor('ff6c1c');
256
+	$chart->addData($data);
257
+
258
+	$chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18);
259
+
260
+	$chart->setScale(0, $max_earnings);
261
+
262
+	$y_axis = new GoogleChartAxis('y');
263
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
264
+	$chart->addAxis($y_axis);
265
+
266
+	$x_axis = new GoogleChartAxis('x');
267
+	$x_axis->setTickMarks(5);
268
+	$x_axis->setLabels(array(
269
+		esc_html__('Jan', 'give'),
270
+		esc_html__('Feb', 'give'),
271
+		esc_html__('Mar', 'give'),
272
+		esc_html__('Apr', 'give'),
273
+		esc_html__('May', 'give'),
274
+		esc_html__('June', 'give'),
275
+		esc_html__('July', 'give'),
276
+		esc_html__('Aug', 'give'),
277
+		esc_html__('Sept', 'give'),
278
+		esc_html__('Oct', 'give'),
279
+		esc_html__('Nov', 'give'),
280
+		esc_html__('Dec', 'give')
281
+	));
282
+	$chart->addAxis($x_axis);
283
+
284
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
285
+	$shape_marker->setSize(6);
286
+	$shape_marker->setBorder(2);
287
+	$shape_marker->setData($data);
288
+	$chart->addMarker($shape_marker);
289
+
290
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
291
+	$value_marker->setData($data);
292
+	$chart->addMarker($value_marker);
293 293
 
294 294
 	return $chart->getUrl();
295 295
 }
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Give_API_V1 Class
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Give_API_V1 Class
Please login to merge, or discard this patch.
includes/gateways/functions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,10 +97,10 @@
 block discarded – undo
97 97
 
98 98
 	//Single Form settings varies compared to the Global default settings
99 99
 	if ( ! empty( $form_default ) &&
100
-	     $form_id !== null &&
101
-	     $default !== $form_default &&
102
-	     $form_default !== 'global' &&
103
-	     give_is_gateway_active( $form_default )
100
+		 $form_id !== null &&
101
+		 $default !== $form_default &&
102
+		 $form_default !== 'global' &&
103
+		 give_is_gateway_active( $form_default )
104 104
 	) {
105 105
 		$default = $form_default;
106 106
 	}
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 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,16 +24,16 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => esc_html__( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => esc_html__( 'PayPal', 'give' ),
27
+			'admin_label'    => esc_html__('PayPal Standard', 'give'),
28
+			'checkout_label' => esc_html__('PayPal', 'give'),
29 29
 		),
30 30
 		'manual' => array(
31
-			'admin_label'    => esc_html__( 'Test Payment', 'give' ),
32
-			'checkout_label' => esc_html__( 'Test Payment', 'give' )
31
+			'admin_label'    => esc_html__('Test Payment', 'give'),
32
+			'checkout_label' => esc_html__('Test Payment', 'give')
33 33
 		),
34 34
 	);
35 35
 
36
-	return apply_filters( 'give_payment_gateways', $gateways );
36
+	return apply_filters('give_payment_gateways', $gateways);
37 37
 
38 38
 }
39 39
 
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 
48 48
 	$gateways = give_get_payment_gateways();
49 49
 
50
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
50
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
51 51
 
52 52
 	$gateway_list = array();
53 53
 
54
-	foreach ( $gateways as $key => $gateway ) {
55
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
56
-			$gateway_list[ $key ] = $gateway;
54
+	foreach ($gateways as $key => $gateway) {
55
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
56
+			$gateway_list[$key] = $gateway;
57 57
 		}
58 58
 	}
59 59
 
60 60
 	// Set order of payment gateway in list.
61
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
61
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
62 62
 
63
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list );
63
+	return apply_filters('give_enabled_payment_gateways', $gateway_list);
64 64
 }
65 65
 
66 66
 /**
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
  *
73 73
  * @return boolean true if enabled, false otherwise
74 74
  */
75
-function give_is_gateway_active( $gateway ) {
75
+function give_is_gateway_active($gateway) {
76 76
 	$gateways = give_get_enabled_payment_gateways();
77 77
 
78
-	$ret = array_key_exists( $gateway, $gateways );
78
+	$ret = array_key_exists($gateway, $gateways);
79 79
 
80
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
80
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
81 81
 }
82 82
 
83 83
 /**
@@ -90,24 +90,24 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return string Gateway ID
92 92
  */
93
-function give_get_default_gateway( $form_id ) {
93
+function give_get_default_gateway($form_id) {
94 94
 
95 95
 	global $give_options;
96 96
 
97
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
98
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
97
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
98
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
99 99
 
100 100
 	//Single Form settings varies compared to the Global default settings
101
-	if ( ! empty( $form_default ) &&
101
+	if ( ! empty($form_default) &&
102 102
 	     $form_id !== null &&
103 103
 	     $default !== $form_default &&
104 104
 	     $form_default !== 'global' &&
105
-	     give_is_gateway_active( $form_default )
105
+	     give_is_gateway_active($form_default)
106 106
 	) {
107 107
 		$default = $form_default;
108 108
 	}
109 109
 
110
-	return apply_filters( 'give_default_gateway', $default );
110
+	return apply_filters('give_default_gateway', $default);
111 111
 }
112 112
 
113 113
 /**
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
  *
120 120
  * @return string Gateway admin label
121 121
  */
122
-function give_get_gateway_admin_label( $gateway ) {
122
+function give_get_gateway_admin_label($gateway) {
123 123
 	$gateways = give_get_enabled_payment_gateways();
124
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
125
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
124
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
125
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
126 126
 
127
-	if ( $gateway == 'manual' && $payment ) {
128
-		if ( give_get_payment_amount( $payment ) == 0 ) {
129
-			$label = esc_html__( 'Test Donation', 'give' );
127
+	if ($gateway == 'manual' && $payment) {
128
+		if (give_get_payment_amount($payment) == 0) {
129
+			$label = esc_html__('Test Donation', 'give');
130 130
 		}
131 131
 	}
132 132
 
133
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
133
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
134 134
 }
135 135
 
136 136
 /**
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
  *
143 143
  * @return string Checkout label for the gateway
144 144
  */
145
-function give_get_gateway_checkout_label( $gateway ) {
145
+function give_get_gateway_checkout_label($gateway) {
146 146
 	$gateways = give_get_enabled_payment_gateways();
147
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
147
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
148 148
 
149
-	if ( $gateway == 'manual' ) {
150
-		$label = esc_html__( 'Test Donation', 'give' );
149
+	if ($gateway == 'manual') {
150
+		$label = esc_html__('Test Donation', 'give');
151 151
 	}
152 152
 
153
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
153
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
154 154
 }
155 155
 
156 156
 /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return array Options the gateway supports
164 164
  */
165
-function give_get_gateway_supports( $gateway ) {
165
+function give_get_gateway_supports($gateway) {
166 166
 	$gateways = give_get_enabled_payment_gateways();
167
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
167
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
168 168
 
169
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
169
+	return apply_filters('give_gateway_supports', $supports, $gateway);
170 170
 }
171 171
 
172 172
 /**
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return void
181 181
  */
182
-function give_send_to_gateway( $gateway, $payment_data ) {
182
+function give_send_to_gateway($gateway, $payment_data) {
183 183
 
184
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
184
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
185 185
 
186 186
 	// $gateway must match the ID used when registering the gateway
187
-	do_action( 'give_gateway_' . $gateway, $payment_data );
187
+	do_action('give_gateway_'.$gateway, $payment_data);
188 188
 }
189 189
 
190 190
 
@@ -201,32 +201,32 @@  discard block
 block discarded – undo
201 201
  *
202 202
  * @return string $enabled_gateway The slug of the gateway
203 203
  */
204
-function give_get_chosen_gateway( $form_id ) {
204
+function give_get_chosen_gateway($form_id) {
205 205
 	$gateways        = give_get_enabled_payment_gateways();
206
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
207
-	if ( empty( $request_form_id ) ) {
208
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
206
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
207
+	if (empty($request_form_id)) {
208
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
209 209
 	}
210
-	$chosen          = give_get_default_gateway( $form_id );
210
+	$chosen          = give_get_default_gateway($form_id);
211 211
 	$enabled_gateway = '';
212 212
 
213 213
 	//Take into account request Form ID args
214
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
215
-		$chosen = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : '';
214
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
215
+		$chosen = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : '';
216 216
 	}
217 217
 
218
-	if ( $chosen ) {
219
-		$enabled_gateway = urldecode( $chosen );
220
-	} else if ( count( $gateways ) >= 1 && ! $chosen ) {
221
-		foreach ( $gateways as $gateway_id => $gateway ):
218
+	if ($chosen) {
219
+		$enabled_gateway = urldecode($chosen);
220
+	} else if (count($gateways) >= 1 && ! $chosen) {
221
+		foreach ($gateways as $gateway_id => $gateway):
222 222
 			$enabled_gateway = $gateway_id;
223 223
 		endforeach;
224 224
 	} else {
225
-		$enabled_gateway = give_get_default_gateway( $form_id );
225
+		$enabled_gateway = give_get_default_gateway($form_id);
226 226
 	}
227 227
 
228 228
 
229
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
229
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
230 230
 }
231 231
 
232 232
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return int ID of the new log entry
245 245
  */
246
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
247
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
246
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
247
+	return give_record_log($title, $message, $parent, 'gateway_error');
248 248
 }
249 249
 
250 250
 /**
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
  *
258 258
  * @return int
259 259
  */
260
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
260
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
261 261
 
262 262
 	$ret  = 0;
263 263
 	$args = array(
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
 		'fields'      => 'ids'
270 270
 	);
271 271
 
272
-	$payments = new WP_Query( $args );
272
+	$payments = new WP_Query($args);
273 273
 
274
-	if ( $payments ) {
274
+	if ($payments) {
275 275
 		$ret = $payments->post_count;
276 276
 	}
277 277
 
@@ -288,27 +288,27 @@  discard block
 block discarded – undo
288 288
  *
289 289
  * @return array $gateways All the available gateways
290 290
  */
291
-function give_get_ordered_payment_gateways( $gateways ) {
291
+function give_get_ordered_payment_gateways($gateways) {
292 292
 
293 293
 	//  Get gateways setting.
294
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
294
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
295 295
 
296 296
 	// Return from here if we do not have gateways setting.
297
-	if ( empty( $gateways_setting ) ) {
297
+	if (empty($gateways_setting)) {
298 298
 		return $gateways;
299 299
 	}
300 300
 
301 301
 	// Reverse array to order payment gateways.
302
-	$gateways_setting = array_reverse( $gateways_setting );
302
+	$gateways_setting = array_reverse($gateways_setting);
303 303
 
304 304
 	// Reorder gateways array
305
-	foreach ( $gateways_setting as $gateway_key => $value ) {
305
+	foreach ($gateways_setting as $gateway_key => $value) {
306 306
 
307
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
308
-		unset( $gateways[ $gateway_key ] );
307
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
308
+		unset($gateways[$gateway_key]);
309 309
 
310
-		if ( ! empty( $new_gateway_value ) ) {
311
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
310
+		if ( ! empty($new_gateway_value)) {
311
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
312 312
 		}
313 313
 	}
314 314
 
@@ -319,5 +319,5 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @param array $gateways All the available gateways
321 321
 	 */
322
-	return apply_filters( 'give_payment_gateways_order', $gateways );
322
+	return apply_filters('give_payment_gateways_order', $gateways);
323 323
 }
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@
 block discarded – undo
117 117
 		$shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' );
118 118
 		// Only run in admin post/page creation and edit screens
119 119
 		if ( in_array( $pagenow, $shortcode_button_pages )
120
-		     && apply_filters( 'give_shortcode_button_condition', true )
121
-		     && ! empty( self::$shortcodes )
120
+			 && apply_filters( 'give_shortcode_button_condition', true )
121
+			 && ! empty( self::$shortcodes )
122 122
 		) {
123 123
 
124 124
 			$shortcodes = array();
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 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,15 +51,15 @@  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
 			return false;
58 58
 		}
59 59
 
60
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
60
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
61 61
 
62
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
62
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
63 63
 
64 64
 		return $plugin_array;
65 65
 	}
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function admin_enqueue_assets() {
75 75
 
76
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
76
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
77 77
 
78 78
 		wp_enqueue_script(
79 79
 			'give_shortcode',
80
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
81
-			array( 'jquery' ),
80
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
81
+			array('jquery'),
82 82
 			GIVE_VERSION,
83 83
 			true
84 84
 		);
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function admin_localize_scripts() {
95 95
 
96
-		if ( ! empty( self::$shortcodes ) ) {
96
+		if ( ! empty(self::$shortcodes)) {
97 97
 
98 98
 			$variables = array();
99 99
 
100
-			foreach ( self::$shortcodes as $shortcode => $values ) {
101
-				if ( ! empty( $values['required'] ) ) {
102
-					$variables[ $shortcode ] = $values['required'];
100
+			foreach (self::$shortcodes as $shortcode => $values) {
101
+				if ( ! empty($values['required'])) {
102
+					$variables[$shortcode] = $values['required'];
103 103
 				}
104 104
 			}
105 105
 
106
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
106
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
107 107
 		}
108 108
 	}
109 109
 
@@ -118,31 +118,31 @@  discard block
 block discarded – undo
118 118
 
119 119
 		global $pagenow, $wp_version;
120 120
 
121
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
121
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
122 122
 			'post.php',
123 123
 			'page.php',
124 124
 			'post-new.php',
125 125
 			'post-edit.php'
126
-		) );
126
+		));
127 127
 
128 128
 		// Only run in admin post/page creation and edit screens
129
-		if ( in_array( $pagenow, $shortcode_button_pages )
130
-		     && apply_filters( 'give_shortcode_button_condition', true )
131
-		     && ! empty( self::$shortcodes )
129
+		if (in_array($pagenow, $shortcode_button_pages)
130
+		     && apply_filters('give_shortcode_button_condition', true)
131
+		     && ! empty(self::$shortcodes)
132 132
 		) {
133 133
 
134 134
 			$shortcodes = array();
135 135
 
136
-			foreach ( self::$shortcodes as $shortcode => $values ) {
136
+			foreach (self::$shortcodes as $shortcode => $values) {
137 137
 
138 138
 				/**
139 139
 				 * Filters the condition for including the current shortcode
140 140
 				 *
141 141
 				 * @since 1.0
142 142
 				 */
143
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
143
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
144 144
 
145
-					$shortcodes[ $shortcode ] = sprintf(
145
+					$shortcodes[$shortcode] = sprintf(
146 146
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>',
147 147
 						$shortcode,
148 148
 						$values['label'],
@@ -151,37 +151,37 @@  discard block
 block discarded – undo
151 151
 				}
152 152
 			}
153 153
 
154
-			if ( ! empty( $shortcodes ) ) {
154
+			if ( ! empty($shortcodes)) {
155 155
 
156 156
 				// check current WP version
157
-				$img = ( version_compare( $wp_version, '3.5', '<' ) )
158
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
159
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
157
+				$img = (version_compare($wp_version, '3.5', '<'))
158
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
159
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
160 160
 
161
-				reset( $shortcodes );
161
+				reset($shortcodes);
162 162
 
163
-				if ( count( $shortcodes ) == 1 ) {
163
+				if (count($shortcodes) == 1) {
164 164
 
165
-					$shortcode = key( $shortcodes );
165
+					$shortcode = key($shortcodes);
166 166
 
167 167
 					printf(
168 168
 						'<button class="button sc-shortcode" data-shortcode="%s">%s</button>',
169 169
 						$shortcode,
170
-						sprintf( '%s %s %s',
170
+						sprintf('%s %s %s',
171 171
 							$img,
172
-							esc_html__( 'Insert', 'give' ),
173
-							self::$shortcodes[ $shortcode ]['label']
172
+							esc_html__('Insert', 'give'),
173
+							self::$shortcodes[$shortcode]['label']
174 174
 						)
175 175
 					);
176 176
 				} else {
177 177
 					printf(
178
-						'<div class="sc-wrap">' .
179
-						'<button class="button sc-button">%s %s</button>' .
180
-						'<div class="sc-menu mce-menu">%s</div>' .
178
+						'<div class="sc-wrap">'.
179
+						'<button class="button sc-button">%s %s</button>'.
180
+						'<div class="sc-menu mce-menu">%s</div>'.
181 181
 						'</div>',
182 182
 						$img,
183
-						esc_html__( 'Give Shortcodes', 'give' ),
184
-						implode( '', array_values( $shortcodes ) )
183
+						esc_html__('Give Shortcodes', 'give'),
184
+						implode('', array_values($shortcodes))
185 185
 					);
186 186
 				}
187 187
 			}
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function shortcode_ajax() {
199 199
 
200
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
200
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
201 201
 		$response  = false;
202 202
 
203
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
203
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
204 204
 
205
-			$data = self::$shortcodes[ $shortcode ];
205
+			$data = self::$shortcodes[$shortcode];
206 206
 
207
-			if ( ! empty( $data['errors'] ) ) {
208
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
207
+			if ( ! empty($data['errors'])) {
208
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
209 209
 			}
210 210
 
211 211
 			$response = array(
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 			);
218 218
 		} else {
219 219
 			// todo: handle error
220
-			error_log( print_r( 'AJAX error!', 1 ) );
220
+			error_log(print_r('AJAX error!', 1));
221 221
 		}
222 222
 
223
-		wp_send_json( $response );
223
+		wp_send_json($response);
224 224
 	}
225 225
 }
226 226
 
Please login to merge, or discard this patch.