Completed
Pull Request — master (#1336)
by Devin
16:29
created
includes/gateways/functions.php 1 patch
Spacing   +65 added lines, -65 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'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29 29
 		),
30 30
 		'manual' => array(
31
-			'admin_label'    => __( 'Test Donation', 'give' ),
32
-			'checkout_label' => __( 'Test Donation', 'give' )
31
+			'admin_label'    => __('Test Donation', 'give'),
32
+			'checkout_label' => __('Test Donation', '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
 /**
@@ -89,23 +89,23 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string Gateway ID
91 91
  */
92
-function give_get_default_gateway( $form_id ) {
92
+function give_get_default_gateway($form_id) {
93 93
 
94 94
 	$give_options = give_get_settings();
95
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
96
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
95
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
96
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
97 97
 
98 98
 	//Single Form settings varies compared to the Global default settings.
99
-	if ( ! empty( $form_default ) &&
99
+	if ( ! empty($form_default) &&
100 100
 	     $form_id !== null &&
101 101
 	     $default !== $form_default &&
102 102
 	     $form_default !== 'global' &&
103
-	     give_is_gateway_active( $form_default )
103
+	     give_is_gateway_active($form_default)
104 104
 	) {
105 105
 		$default = $form_default;
106 106
 	}
107 107
 
108
-	return apply_filters( 'give_default_gateway', $default );
108
+	return apply_filters('give_default_gateway', $default);
109 109
 }
110 110
 
111 111
 /**
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
  *
118 118
  * @return string Gateway admin label
119 119
  */
120
-function give_get_gateway_admin_label( $gateway ) {
120
+function give_get_gateway_admin_label($gateway) {
121 121
 	$gateways = give_get_payment_gateways();
122
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
123
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
122
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
123
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
124 124
 
125
-	if ( $gateway == 'manual' && $payment ) {
126
-		if ( give_get_payment_amount( $payment ) == 0 ) {
127
-			$label = __( 'Test Donation', 'give' );
125
+	if ($gateway == 'manual' && $payment) {
126
+		if (give_get_payment_amount($payment) == 0) {
127
+			$label = __('Test Donation', 'give');
128 128
 		}
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
131
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
132 132
 }
133 133
 
134 134
 /**
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return string Checkout label for the gateway
142 142
  */
143
-function give_get_gateway_checkout_label( $gateway ) {
143
+function give_get_gateway_checkout_label($gateway) {
144 144
 	$gateways = give_get_payment_gateways();
145
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
145
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
146 146
 
147
-	if ( $gateway == 'manual' ) {
148
-		$label = __( 'Test Donation', 'give' );
147
+	if ($gateway == 'manual') {
148
+		$label = __('Test Donation', 'give');
149 149
 	}
150 150
 
151
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
151
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
152 152
 }
153 153
 
154 154
 /**
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
  *
161 161
  * @return array Options the gateway supports
162 162
  */
163
-function give_get_gateway_supports( $gateway ) {
163
+function give_get_gateway_supports($gateway) {
164 164
 	$gateways = give_get_enabled_payment_gateways();
165
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
165
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
166 166
 
167
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
167
+	return apply_filters('give_gateway_supports', $supports, $gateway);
168 168
 }
169 169
 
170 170
 /**
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return void
179 179
  */
180
-function give_send_to_gateway( $gateway, $payment_data ) {
180
+function give_send_to_gateway($gateway, $payment_data) {
181 181
 
182
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
182
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
183 183
 
184 184
 	/**
185 185
 	 * Fires while loading payment gateway via AJAX.
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @param array $payment_data All the payment data to be sent to the gateway.
192 192
 	 */
193
-	do_action( "give_gateway_{$gateway}", $payment_data );
193
+	do_action("give_gateway_{$gateway}", $payment_data);
194 194
 }
195 195
 
196 196
 
@@ -204,34 +204,34 @@  discard block
 block discarded – undo
204 204
  *
205 205
  * @return string $enabled_gateway The slug of the gateway
206 206
  */
207
-function give_get_chosen_gateway( $form_id ) {
207
+function give_get_chosen_gateway($form_id) {
208 208
 
209
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
209
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
210 210
 
211 211
 	//Back to check if 'form-id' is present.
212
-	if ( empty( $request_form_id ) ) {
213
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
212
+	if (empty($request_form_id)) {
213
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
214 214
 	}
215 215
 
216
-	$request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : '';
216
+	$request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : '';
217 217
 	$chosen               = false;
218 218
 
219 219
 	//If both 'payment-mode' and 'form-id' then set for only this form.
220
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
220
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
221 221
 		$chosen = $request_payment_mode;
222
-	} elseif ( empty( $request_form_id ) && $request_payment_mode ) {
222
+	} elseif (empty($request_form_id) && $request_payment_mode) {
223 223
 		//If no 'form-id' but there is 'payment-mode'.
224 224
 		$chosen = $request_payment_mode;
225 225
 	}
226 226
 
227 227
 	// Get the enable gateway based of chosen var.
228
-	if ( $chosen && give_is_gateway_active( $chosen ) ) {
229
-		$enabled_gateway = urldecode( $chosen );
228
+	if ($chosen && give_is_gateway_active($chosen)) {
229
+		$enabled_gateway = urldecode($chosen);
230 230
 	} else {
231
-		$enabled_gateway = give_get_default_gateway( $form_id );
231
+		$enabled_gateway = give_get_default_gateway($form_id);
232 232
 	}
233 233
 
234
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
234
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
235 235
 
236 236
 }
237 237
 
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @return int ID of the new log entry
251 251
  */
252
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
253
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
252
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
253
+	return give_record_log($title, $message, $parent, 'gateway_error');
254 254
 }
255 255
 
256 256
 /**
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
  *
264 264
  * @return int
265 265
  */
266
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
266
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
267 267
 
268 268
 	$ret  = 0;
269 269
 	$args = array(
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 		'fields'      => 'ids'
276 276
 	);
277 277
 
278
-	$payments = new WP_Query( $args );
278
+	$payments = new WP_Query($args);
279 279
 
280
-	if ( $payments ) {
280
+	if ($payments) {
281 281
 		$ret = $payments->post_count;
282 282
 	}
283 283
 
@@ -294,27 +294,27 @@  discard block
 block discarded – undo
294 294
  *
295 295
  * @return array $gateways All the available gateways
296 296
  */
297
-function give_get_ordered_payment_gateways( $gateways ) {
297
+function give_get_ordered_payment_gateways($gateways) {
298 298
 
299 299
 	//  Get gateways setting.
300
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
300
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
301 301
 
302 302
 	// Return from here if we do not have gateways setting.
303
-	if ( empty( $gateways_setting ) ) {
303
+	if (empty($gateways_setting)) {
304 304
 		return $gateways;
305 305
 	}
306 306
 
307 307
 	// Reverse array to order payment gateways.
308
-	$gateways_setting = array_reverse( $gateways_setting );
308
+	$gateways_setting = array_reverse($gateways_setting);
309 309
 
310 310
 	// Reorder gateways array
311
-	foreach ( $gateways_setting as $gateway_key => $value ) {
311
+	foreach ($gateways_setting as $gateway_key => $value) {
312 312
 
313
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
314
-		unset( $gateways[ $gateway_key ] );
313
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
314
+		unset($gateways[$gateway_key]);
315 315
 
316
-		if ( ! empty( $new_gateway_value ) ) {
317
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
316
+		if ( ! empty($new_gateway_value)) {
317
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
318 318
 		}
319 319
 	}
320 320
 
@@ -325,5 +325,5 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @param array $gateways All the available gateways
327 327
 	 */
328
-	return apply_filters( 'give_payment_gateways_order', $gateways );
328
+	return apply_filters('give_payment_gateways_order', $gateways);
329 329
 }
330 330
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 	// Get offline payment instruction.
45
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
45
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
46 46
 
47 47
 	ob_start();
48 48
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param int $form_id Give form id.
55 55
 	 */
56
-	do_action( 'give_before_offline_info_fields', $form_id );
56
+	do_action('give_before_offline_info_fields', $form_id);
57 57
 	?>
58 58
 	<fieldset id="give_offline_payment_info">
59
-		<?php echo stripslashes( $offline_instructions ); ?>
59
+		<?php echo stripslashes($offline_instructions); ?>
60 60
 	</fieldset>
61 61
 	<?php
62 62
 	/**
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $form_id Give form id.
68 68
 	 */
69
-	do_action( 'give_after_offline_info_fields', $form_id );
69
+	do_action('give_after_offline_info_fields', $form_id);
70 70
 
71 71
 	echo ob_get_clean();
72 72
 }
73 73
 
74
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
74
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
75 75
 
76 76
 /**
77 77
  * Give Offline Billing Field
78 78
  *
79 79
  * @param $form_id
80 80
  */
81
-function give_offline_billing_fields( $form_id ) {
81
+function give_offline_billing_fields($form_id) {
82 82
 	//Enable Default CC fields (billing info)
83
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
84
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
83
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
84
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
85 85
 
86
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
86
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
87 87
 
88 88
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
89
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
90
-		give_default_cc_address_fields( $form_id );
91
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
92
-		give_default_cc_address_fields( $form_id );
89
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
90
+		give_default_cc_address_fields($form_id);
91
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
92
+		give_default_cc_address_fields($form_id);
93 93
 	}
94 94
 }
95 95
 
96
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
96
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
97 97
 
98 98
 /**
99 99
  * Process the payment
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
  *
105 105
  * @return void
106 106
  */
107
-function give_offline_process_payment( $purchase_data ) {
107
+function give_offline_process_payment($purchase_data) {
108 108
 
109
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
109
+	$purchase_summary = give_get_purchase_summary($purchase_data);
110 110
 
111 111
 	// setup the payment details
112 112
 	$payment_data = array(
113 113
 		'price'           => $purchase_data['price'],
114 114
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
115
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
116
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
115
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
116
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
117 117
 		'date'            => $purchase_data['date'],
118 118
 		'user_email'      => $purchase_data['user_email'],
119 119
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
 
126 126
 
127 127
 	// record the pending payment
128
-	$payment = give_insert_payment( $payment_data );
128
+	$payment = give_insert_payment($payment_data);
129 129
 
130
-	if ( $payment ) {
131
-		give_offline_send_admin_notice( $payment );
132
-		give_offline_send_donor_instructions( $payment );
130
+	if ($payment) {
131
+		give_offline_send_admin_notice($payment);
132
+		give_offline_send_donor_instructions($payment);
133 133
 		give_send_to_success_page();
134 134
 	} else {
135 135
 		// if errors are present, send the user back to the donation form so they can be corrected
136
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
136
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
137 137
 	}
138 138
 
139 139
 }
140 140
 
141
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
141
+add_action('give_gateway_offline', 'give_offline_process_payment');
142 142
 
143 143
 
144 144
 /**
@@ -151,59 +151,59 @@  discard block
 block discarded – undo
151 151
  * @since       1.0
152 152
  * @return void
153 153
  */
154
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
154
+function give_offline_send_donor_instructions($payment_id = 0) {
155 155
 
156
-	$payment_data                      = give_get_payment_meta( $payment_id );
157
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
156
+	$payment_data                      = give_get_payment_meta($payment_id);
157
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
158 158
 
159 159
 	//Customize email content depending on whether the single form has been customized
160
-	$email_content = give_get_option( 'global_offline_donation_email' );
160
+	$email_content = give_get_option('global_offline_donation_email');
161 161
 
162
-	if ( $post_offline_customization_option === 'yes' ) {
163
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
162
+	if ($post_offline_customization_option === 'yes') {
163
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
164 164
 	}
165 165
 
166
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
166
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
167 167
 
168 168
 	/**
169 169
 	 * Filters the from name.
170 170
 	 *
171 171
 	 * @since 1.7
172 172
 	 */
173
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
173
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
174 174
 
175
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
175
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
176 176
 
177 177
 	/**
178 178
 	 * Filters the from email.
179 179
 	 *
180 180
 	 * @since 1.7
181 181
 	 */
182
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
182
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
183 183
 
184
-	$to_email = give_get_payment_user_email( $payment_id );
184
+	$to_email = give_get_payment_user_email($payment_id);
185 185
 
186
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
187
-	if ( $post_offline_customization_option === 'yes' ) {
188
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
186
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
187
+	if ($post_offline_customization_option === 'yes') {
188
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
189 189
 	}
190 190
 
191
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
192
-	$subject = give_do_email_tags( $subject, $payment_id );
191
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
192
+	$subject = give_do_email_tags($subject, $payment_id);
193 193
 
194
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
195
-	$message     = give_do_email_tags( $email_content, $payment_id );
194
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
195
+	$message     = give_do_email_tags($email_content, $payment_id);
196 196
 
197 197
 	$emails = Give()->emails;
198 198
 
199
-	$emails->__set( 'from_name', $from_name );
200
-	$emails->__set( 'from_email', $from_email );
201
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
199
+	$emails->__set('from_name', $from_name);
200
+	$emails->__set('from_email', $from_email);
201
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
202 202
 
203
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
204
-	$emails->__set( 'headers', $headers );
203
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
204
+	$emails->__set('headers', $headers);
205 205
 
206
-	$emails->send( $to_email, $subject, $message, $attachments );
206
+	$emails->send($to_email, $subject, $message, $attachments);
207 207
 
208 208
 }
209 209
 
@@ -220,52 +220,52 @@  discard block
 block discarded – undo
220 220
  * @return void
221 221
  *
222 222
  */
223
-function give_offline_send_admin_notice( $payment_id = 0 ) {
223
+function give_offline_send_admin_notice($payment_id = 0) {
224 224
 
225 225
 	/* Send an email notification to the admin */
226 226
 	$admin_email = give_get_admin_notice_emails();
227
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
227
+	$user_info   = give_get_payment_meta_user_info($payment_id);
228 228
 
229
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
230
-		$user_data = get_userdata( $user_info['id'] );
229
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
230
+		$user_data = get_userdata($user_info['id']);
231 231
 		$name      = $user_data->display_name;
232
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
233
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
232
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
233
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
234 234
 	} else {
235 235
 		$name = $user_info['email'];
236 236
 	}
237 237
 
238
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
238
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
239 239
 
240
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
240
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
241 241
 
242
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
243
-	$admin_message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
244
-	$admin_message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
242
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
243
+	$admin_message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
244
+	$admin_message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
245 245
 
246 246
 
247
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
248
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
247
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
248
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
249 249
 
250 250
 	$admin_message .= sprintf(
251 251
 		'<a href="%1$s">%2$s</a>',
252
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
253
-		__( 'Click Here to View and/or Update Donation Details', 'give' )
254
-	) . "\n\n";
252
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
253
+		__('Click Here to View and/or Update Donation Details', 'give')
254
+	)."\n\n";
255 255
 
256
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
257
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
256
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
257
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
258 258
 
259
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
260
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
259
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
260
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
261 261
 
262 262
 	//Send Email
263 263
 	$emails = Give()->emails;
264
-	if ( ! empty( $admin_headers ) ) {
265
-		$emails->__set( 'headers', $admin_headers );
264
+	if ( ! empty($admin_headers)) {
265
+		$emails->__set('headers', $admin_headers);
266 266
 	}
267 267
 
268
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
268
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
269 269
 
270 270
 }
271 271
 
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return array
279 279
  */
280
-function give_offline_add_settings( $settings ) {
280
+function give_offline_add_settings($settings) {
281 281
 
282 282
 	//Vars
283 283
 	$prefix = '_give_';
284 284
 
285
-	$is_gateway_active = give_is_gateway_active( 'offline' );
285
+	$is_gateway_active = give_is_gateway_active('offline');
286 286
 
287 287
 	//this gateway isn't active
288
-	if ( ! $is_gateway_active ) {
288
+	if ( ! $is_gateway_active) {
289 289
 		//return settings and bounce
290 290
 		return $settings;
291 291
 	}
@@ -294,27 +294,27 @@  discard block
 block discarded – undo
294 294
 	$check_settings = array(
295 295
 
296 296
 		array(
297
-			'name'    => __( 'Customize Offline Donations', 'give' ),
298
-			'desc'    => __( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
299
-			'id'      => $prefix . 'customize_offline_donations',
297
+			'name'    => __('Customize Offline Donations', 'give'),
298
+			'desc'    => __('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
299
+			'id'      => $prefix.'customize_offline_donations',
300 300
 			'type'    => 'radio_inline',
301 301
 			'default' => 'no',
302 302
 			'options' => array(
303
-				'yes' => __( 'Yes', 'give' ),
304
-				'no'  => __( 'No', 'give' ),
303
+				'yes' => __('Yes', 'give'),
304
+				'no'  => __('No', 'give'),
305 305
 			),
306 306
 		),
307 307
 		array(
308
-			'name'        => __( 'Request Billing Information', 'give' ),
309
-			'desc'        => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
310
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
308
+			'name'        => __('Request Billing Information', 'give'),
309
+			'desc'        => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
310
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
311 311
 			'row_classes' => 'give-subfield',
312 312
 			'type'        => 'checkbox'
313 313
 		),
314 314
 		array(
315
-			'id'          => $prefix . 'offline_checkout_notes',
316
-			'name'        => __( 'Offline Donation Instructions', 'give' ),
317
-			'desc'        => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
315
+			'id'          => $prefix.'offline_checkout_notes',
316
+			'name'        => __('Offline Donation Instructions', 'give'),
317
+			'desc'        => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
318 318
 			'default'     => give_get_default_offline_donation_content(),
319 319
 			'type'        => 'wysiwyg',
320 320
 			'row_classes' => 'give-subfield',
@@ -323,17 +323,17 @@  discard block
 block discarded – undo
323 323
 			)
324 324
 		),
325 325
 		array(
326
-			'id'          => $prefix . 'offline_donation_subject',
327
-			'name'        => __( 'Offline Donation Email Instructions Subject', 'give' ),
328
-			'desc'        => __( 'Enter the subject line for the donation receipt email.', 'give' ),
329
-			'default'     => __( '{form_title} - Offline Donation Instructions', 'give' ),
326
+			'id'          => $prefix.'offline_donation_subject',
327
+			'name'        => __('Offline Donation Email Instructions Subject', 'give'),
328
+			'desc'        => __('Enter the subject line for the donation receipt email.', 'give'),
329
+			'default'     => __('{form_title} - Offline Donation Instructions', 'give'),
330 330
 			'row_classes' => 'give-subfield',
331 331
 			'type'        => 'text'
332 332
 		),
333 333
 		array(
334
-			'id'          => $prefix . 'offline_donation_email',
335
-			'name'        => __( 'Offline Donation Email Instructions', 'give' ),
336
-			'desc'        => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
334
+			'id'          => $prefix.'offline_donation_email',
335
+			'name'        => __('Offline Donation Email Instructions', 'give'),
336
+			'desc'        => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
337 337
 			'default'     => give_get_default_offline_donation_email_content(),
338 338
 			'type'        => 'wysiwyg',
339 339
 			'row_classes' => 'give-subfield',
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 		)
344 344
 	);
345 345
 
346
-	return array_merge( $settings, $check_settings );
346
+	return array_merge($settings, $check_settings);
347 347
 }
348 348
 
349
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
349
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
350 350
 
351 351
 
352 352
 /**
@@ -358,32 +358,32 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function give_get_default_offline_donation_content() {
360 360
 
361
-	$sitename = get_bloginfo( 'sitename' );
361
+	$sitename = get_bloginfo('sitename');
362 362
 
363
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
363
+	$default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
364 364
 	$default_text .= '<ol>';
365 365
 	$default_text .= '<li>';
366 366
 	$default_text .= sprintf(
367 367
 		/* translators: %s: site name */
368
-		__( 'Make a check payable to "%s"', 'give' ),
368
+		__('Make a check payable to "%s"', 'give'),
369 369
 		$sitename
370 370
 	);
371 371
 	$default_text .= '</li>';
372 372
 	$default_text .= '<li>';
373 373
 	$default_text .= sprintf(
374 374
 		/* translators: %s: site name */
375
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
375
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
376 376
 		$sitename
377 377
 	);
378 378
 	$default_text .= '</li>';
379
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
379
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
380 380
 	$default_text .= '</ol>';
381
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
381
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
382 382
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
383 383
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
384
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
384
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
385 385
 
386
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
386
+	return apply_filters('give_default_offline_donation_content', $default_text);
387 387
 
388 388
 }
389 389
 
@@ -396,34 +396,34 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function give_get_default_offline_donation_email_content() {
398 398
 
399
-	$sitename      = get_bloginfo( 'sitename' );
400
-	$default_text  = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
401
-	$default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>';
399
+	$sitename      = get_bloginfo('sitename');
400
+	$default_text  = '<p>'.__('Dear {name},', 'give').'</p>';
401
+	$default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>';
402 402
 	$default_text .= '<ol>';
403 403
 	$default_text .= '<li>';
404 404
 	$default_text .= sprintf(
405 405
 		/* translators: %s: site name */
406
-		__( 'Make a check payable to "%s"', 'give' ),
406
+		__('Make a check payable to "%s"', 'give'),
407 407
 		$sitename
408 408
 	);
409 409
 	$default_text .= '</li>';
410 410
 	$default_text .= '<li>';
411 411
 	$default_text .= sprintf(
412 412
 		/* translators: %s: site name */
413
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
413
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
414 414
 		$sitename
415 415
 	);
416 416
 	$default_text .= '</li>';
417
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
417
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
418 418
 	$default_text .= '</ol>';
419
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
419
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
420 420
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
421 421
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
422
-	$default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
423
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
424
-	$default_text .= '<p>' . $sitename . '</p>';
422
+	$default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
423
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
424
+	$default_text .= '<p>'.$sitename.'</p>';
425 425
 
426
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
426
+	return apply_filters('give_default_offline_donation_content', $default_text);
427 427
 
428 428
 }
429 429
 
@@ -437,17 +437,17 @@  discard block
 block discarded – undo
437 437
  *
438 438
  * @return string
439 439
  */
440
-function give_offline_donation_receipt_status_notice( $notice, $id ) {
441
-	$payment = new Give_Payment( $id );
440
+function give_offline_donation_receipt_status_notice($notice, $id) {
441
+	$payment = new Give_Payment($id);
442 442
 
443
-	if ( 'offline' !== $payment->gateway ) {
443
+	if ('offline' !== $payment->gateway) {
444 444
 		return $notice;
445 445
 	}
446 446
 
447
-	return give_output_error( 'Payment Pending: Please follow the instructions below to complete your donation.', false, 'warning' );
447
+	return give_output_error('Payment Pending: Please follow the instructions below to complete your donation.', false, 'warning');
448 448
 }
449 449
 
450
-add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 );
450
+add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2);
451 451
 
452 452
 /**
453 453
  * Add offline payment instruction on payment receipt.
@@ -458,26 +458,26 @@  discard block
 block discarded – undo
458 458
  *
459 459
  * @return mixed
460 460
  */
461
-function give_offline_payment_receipt_after( $payment ) {
461
+function give_offline_payment_receipt_after($payment) {
462 462
 	// Get payment object.
463
-	$payment = new Give_Payment( $payment->ID );
463
+	$payment = new Give_Payment($payment->ID);
464 464
 
465 465
 	// Bailout.
466
-	if ( 'offline' !== $payment->gateway ) {
466
+	if ('offline' !== $payment->gateway) {
467 467
 		return false;
468 468
 	}
469 469
 
470 470
 	?>
471 471
 	<tr>
472
-		<td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td>
472
+		<td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td>
473 473
 		<td>
474
-			<?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?>
474
+			<?php echo give_get_offline_payment_instruction($payment->form_id, true); ?>
475 475
 		</td>
476 476
 	</tr>
477 477
 	<?php
478 478
 }
479 479
 
480
-add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' );
480
+add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after');
481 481
 
482 482
 /**
483 483
  * Get offline payment instructions.
@@ -489,25 +489,25 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @return string
491 491
  */
492
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
492
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
493 493
 	// Bailout.
494
-	if ( ! $form_id ) {
494
+	if ( ! $form_id) {
495 495
 		return '';
496 496
 	}
497 497
 
498
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
499
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
500
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
498
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
499
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
500
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
501 501
 	$offline_instructions              = $global_offline_instruction;
502 502
 
503
-	if ( $post_offline_customization_option == 'yes' ) {
503
+	if ($post_offline_customization_option == 'yes') {
504 504
 		$offline_instructions = $post_offline_instructions;
505 505
 	}
506 506
 
507
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
507
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
508 508
 
509 509
 	/* translators: %s: form settings url */
510
-	$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
510
+	$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
511 511
 
512
-	return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions );
512
+	return ($wpautop ? wpautop($offline_instructions) : $offline_instructions);
513 513
 }
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Payment.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_payment( $payment_data ) {
35
+function give_process_paypal_payment($payment_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $payment_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( __( 'Nonce verification has failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($payment_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(__('Nonce verification has failed.', 'give'), __('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
42
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
41
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
42
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
43 43
 
44 44
 	// Collect Give's payment data.
45 45
 	$insert_payment_args = array(
@@ -57,101 +57,101 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment.
60
-	$payment_id = give_insert_payment( $insert_payment_args );
60
+	$payment_id = give_insert_payment($insert_payment_args);
61 61
 
62 62
 	// Check payment.
63
-	if ( ! $payment_id ) {
63
+	if ( ! $payment_id) {
64 64
 		// Record the error.
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 			/* translators: %s: payment data */
69
-				esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment_id
73 73
 		);
74 74
 		// Problems? Send back.
75
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
76 76
 
77 77
 	} else {
78 78
 
79 79
 		// Only send to PayPal if the pending payment is created successfully.
80
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
80
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
81 81
 
82 82
 		// Get the success url.
83
-		$return_url = add_query_arg( array(
83
+		$return_url = add_query_arg(array(
84 84
 			'payment-confirmation' => 'paypal',
85 85
 			'payment-id'           => $payment_id
86 86
 
87
-		), get_permalink( give_get_option( 'success_page' ) ) );
87
+		), get_permalink(give_get_option('success_page')));
88 88
 
89 89
 		// Get the PayPal redirect uri.
90
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
90
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
91 91
 
92 92
 		//Item name - pass level name if variable priced.
93 93
 		$item_name = $payment_data['post_data']['give-form-title'];
94 94
 
95 95
 		//Verify has variable prices.
96
-		if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
96
+		if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
97 97
 
98
-			$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
98
+			$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
99 99
 
100
-			$price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
100
+			$price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
101 101
 
102 102
 			//Donation given doesn't match selected level (must be a custom amount).
103
-			if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) {
104
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+			if ($price_level_amount != give_sanitize_amount($payment_data['price'])) {
104
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
105 105
 				//user custom amount text if any, fallback to default if not.
106
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
106
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
107 107
 
108 108
 			} //Is there any donation level text?
109
-			elseif ( ! empty( $item_price_level_text ) ) {
110
-				$item_name .= ' - ' . $item_price_level_text;
109
+			elseif ( ! empty($item_price_level_text)) {
110
+				$item_name .= ' - '.$item_price_level_text;
111 111
 			}
112 112
 
113 113
 		} //Single donation: Custom Amount.
114
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) {
115
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
114
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) {
115
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
116 116
 			//user custom amount text if any, fallback to default if not.
117
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
117
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
118 118
 		}
119 119
 
120 120
 		// Setup PayPal API params.
121 121
 		$paypal_args = array(
122
-			'business'      => give_get_option( 'paypal_email', false ),
122
+			'business'      => give_get_option('paypal_email', false),
123 123
 			'first_name'    => $payment_data['user_info']['first_name'],
124 124
 			'last_name'     => $payment_data['user_info']['last_name'],
125 125
 			'email'         => $payment_data['user_email'],
126 126
 			'invoice'       => $payment_data['purchase_key'],
127 127
 			'amount'        => $payment_data['price'],
128
-			'item_name'     => stripslashes( $item_name ),
128
+			'item_name'     => stripslashes($item_name),
129 129
 			'no_shipping'   => '1',
130 130
 			'shipping'      => '0',
131 131
 			'no_note'       => '1',
132 132
 			'currency_code' => give_get_currency(),
133
-			'charset'       => get_bloginfo( 'charset' ),
133
+			'charset'       => get_bloginfo('charset'),
134 134
 			'custom'        => $payment_id,
135 135
 			'rm'            => '2',
136 136
 			'return'        => $return_url,
137
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
137
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
138 138
 			'notify_url'    => $listener_url,
139 139
 			'page_style'    => give_get_paypal_page_style(),
140
-			'cbt'           => get_bloginfo( 'name' ),
140
+			'cbt'           => get_bloginfo('name'),
141 141
 			'bn'            => 'givewp_SP'
142 142
 		);
143 143
 
144 144
 		//Add user address if present.
145
-		if ( ! empty( $payment_data['user_info']['address'] ) ) {
146
-			$paypal_args['address1'] = isset( $payment_data['user_info']['address']['line1'] ) ? $payment_data['user_info']['address']['line1'] : '';
147
-			$paypal_args['address2'] = isset( $payment_data['user_info']['address']['line2'] ) ? $payment_data['user_info']['address']['line2'] : '';
148
-			$paypal_args['city']     = isset( $payment_data['user_info']['address']['city'] ) ? $payment_data['user_info']['address']['city'] : '';
149
-			$paypal_args['state']    = isset( $payment_data['user_info']['address']['state'] ) ? $payment_data['user_info']['address']['state'] : '';
150
-			$paypal_args['country']  = isset( $payment_data['user_info']['address']['country'] ) ? $payment_data['user_info']['address']['country'] : '';
145
+		if ( ! empty($payment_data['user_info']['address'])) {
146
+			$paypal_args['address1'] = isset($payment_data['user_info']['address']['line1']) ? $payment_data['user_info']['address']['line1'] : '';
147
+			$paypal_args['address2'] = isset($payment_data['user_info']['address']['line2']) ? $payment_data['user_info']['address']['line2'] : '';
148
+			$paypal_args['city']     = isset($payment_data['user_info']['address']['city']) ? $payment_data['user_info']['address']['city'] : '';
149
+			$paypal_args['state']    = isset($payment_data['user_info']['address']['state']) ? $payment_data['user_info']['address']['state'] : '';
150
+			$paypal_args['country']  = isset($payment_data['user_info']['address']['country']) ? $payment_data['user_info']['address']['country'] : '';
151 151
 		}
152 152
 
153 153
 		//Donations or regular transactions?
154
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
154
+		if (give_get_option('paypal_button_type') === 'standard') {
155 155
 			$paypal_extra_args = array(
156 156
 				'cmd' => '_xclick',
157 157
 			);
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 			);
162 162
 		}
163 163
 
164
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
165
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
164
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
165
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
166 166
 
167 167
 		// Build query.
168
-		$paypal_redirect .= http_build_query( $paypal_args );
168
+		$paypal_redirect .= http_build_query($paypal_args);
169 169
 
170 170
 		// Fix for some sites that encode the entities.
171
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
171
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
172 172
 
173 173
 		// Redirect to PayPal.
174
-		wp_redirect( $paypal_redirect );
174
+		wp_redirect($paypal_redirect);
175 175
 		exit;
176 176
 	}
177 177
 
178 178
 }
179 179
 
180
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
180
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
181 181
 
182 182
 /**
183 183
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function give_listen_for_paypal_ipn() {
189 189
 	// Regular PayPal IPN
190
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
190
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
191 191
 		/**
192 192
 		 * Fires while verifying PayPal IPN
193 193
 		 *
194 194
 		 * @since 1.0
195 195
 		 */
196
-		do_action( 'give_verify_paypal_ipn' );
196
+		do_action('give_verify_paypal_ipn');
197 197
 	}
198 198
 }
199 199
 
200
-add_action( 'init', 'give_listen_for_paypal_ipn' );
200
+add_action('init', 'give_listen_for_paypal_ipn');
201 201
 
202 202
 /**
203 203
  * Process PayPal IPN
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 function give_process_paypal_ipn() {
209 209
 
210 210
 	// Check the request method is POST
211
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
211
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
212 212
 		return;
213 213
 	}
214 214
 
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 	$post_data = '';
217 217
 
218 218
 	// Fallback just in case post_max_size is lower than needed
219
-	if ( ini_get( 'allow_url_fopen' ) ) {
220
-		$post_data = file_get_contents( 'php://input' );
219
+	if (ini_get('allow_url_fopen')) {
220
+		$post_data = file_get_contents('php://input');
221 221
 	} else {
222 222
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
223
-		ini_set( 'post_max_size', '12M' );
223
+		ini_set('post_max_size', '12M');
224 224
 	}
225 225
 	// Start the encoded data collection with notification command
226 226
 	$encoded_data = 'cmd=_notify-validate';
@@ -229,40 +229,40 @@  discard block
 block discarded – undo
229 229
 	$arg_separator = give_get_php_arg_separator_output();
230 230
 
231 231
 	// Verify there is a post_data
232
-	if ( $post_data || strlen( $post_data ) > 0 ) {
232
+	if ($post_data || strlen($post_data) > 0) {
233 233
 		// Append the data
234
-		$encoded_data .= $arg_separator . $post_data;
234
+		$encoded_data .= $arg_separator.$post_data;
235 235
 	} else {
236 236
 		// Check if POST is empty
237
-		if ( empty( $_POST ) ) {
237
+		if (empty($_POST)) {
238 238
 			// Nothing to do
239 239
 			return;
240 240
 		} else {
241 241
 			// Loop through each POST
242
-			foreach ( $_POST as $key => $value ) {
242
+			foreach ($_POST as $key => $value) {
243 243
 				// Encode the value and append the data.
244
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
244
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
245 245
 			}
246 246
 		}
247 247
 	}
248 248
 
249 249
 	// Convert collected post data to an array.
250
-	parse_str( $encoded_data, $encoded_data_array );
250
+	parse_str($encoded_data, $encoded_data_array);
251 251
 
252
-	foreach ( $encoded_data_array as $key => $value ) {
252
+	foreach ($encoded_data_array as $key => $value) {
253 253
 
254
-		if ( false !== strpos( $key, 'amp;' ) ) {
255
-			$new_key = str_replace( '&amp;', '&', $key );
256
-			$new_key = str_replace( 'amp;', '&', $new_key );
254
+		if (false !== strpos($key, 'amp;')) {
255
+			$new_key = str_replace('&amp;', '&', $key);
256
+			$new_key = str_replace('amp;', '&', $new_key);
257 257
 
258
-			unset( $encoded_data_array[ $key ] );
259
-			$encoded_data_array[ $new_key ] = $value;
258
+			unset($encoded_data_array[$key]);
259
+			$encoded_data_array[$new_key] = $value;
260 260
 		}
261 261
 
262 262
 	}
263 263
 
264 264
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure.
265
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
265
+	if ( ! give_get_option('disable_paypal_verification')) {
266 266
 
267 267
 		$remote_post_vars = array(
268 268
 			'method'      => 'POST',
@@ -282,28 +282,28 @@  discard block
 block discarded – undo
282 282
 		);
283 283
 
284 284
 		// Validate the IPN.
285
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
285
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
286 286
 
287
-		if ( is_wp_error( $api_response ) ) {
287
+		if (is_wp_error($api_response)) {
288 288
 			give_record_gateway_error(
289
-				esc_html__( 'IPN Error', 'give' ),
289
+				esc_html__('IPN Error', 'give'),
290 290
 				sprintf(
291 291
 				/* translators: %s: Paypal IPN response */
292
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
293
-					json_encode( $api_response )
292
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
293
+					json_encode($api_response)
294 294
 				)
295 295
 			);
296 296
 
297 297
 			return; // Something went wrong
298 298
 		}
299 299
 
300
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
300
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
301 301
 			give_record_gateway_error(
302
-				esc_html__( 'IPN Error', 'give' ),
302
+				esc_html__('IPN Error', 'give'),
303 303
 				sprintf(
304 304
 				/* translators: %s: Paypal IPN response */
305
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
306
-					json_encode( $api_response )
305
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
306
+					json_encode($api_response)
307 307
 				)
308 308
 			);
309 309
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	}
314 314
 
315 315
 	// Check if $post_data_array has been populated
316
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
316
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
317 317
 		return;
318 318
 	}
319 319
 
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 		'payment_status' => ''
323 323
 	);
324 324
 
325
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
325
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
326 326
 
327
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
327
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
328 328
 	$txn_type   = $encoded_data_array['txn_type'];
329 329
 
330
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
330
+	if (has_action('give_paypal_'.$txn_type)) {
331 331
 		/**
332 332
 		 * Fires while processing PayPal IPN $txn_type.
333 333
 		 *
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @param array $encoded_data_array Encoded data.
339 339
 		 * @param int   $payment_id         Payment id.
340 340
 		 */
341
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
341
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
342 342
 	} else {
343 343
 		/**
344 344
 		 * Fires while process PayPal IPN.
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 		 * @param array $encoded_data_array Encoded data.
351 351
 		 * @param int   $payment_id         Payment id.
352 352
 		 */
353
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
353
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
354 354
 	}
355 355
 	exit;
356 356
 }
357 357
 
358
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
358
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
359 359
 
360 360
 /**
361 361
  * Process web accept (one time) payment IPNs.
@@ -367,128 +367,128 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @return void
369 369
  */
370
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
370
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
371 371
 
372 372
 	//Only allow through these transaction types.
373
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) {
373
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') {
374 374
 		return;
375 375
 	}
376 376
 
377 377
 	//Need $payment_id to continue.
378
-	if ( empty( $payment_id ) ) {
378
+	if (empty($payment_id)) {
379 379
 		return;
380 380
 	}
381 381
 
382 382
 	// Collect donation payment details.
383 383
 	$paypal_amount  = $data['mc_gross'];
384
-	$payment_status = strtolower( $data['payment_status'] );
385
-	$currency_code  = strtolower( $data['mc_currency'] );
386
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
387
-	$payment_meta   = give_get_payment_meta( $payment_id );
384
+	$payment_status = strtolower($data['payment_status']);
385
+	$currency_code  = strtolower($data['mc_currency']);
386
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
387
+	$payment_meta   = give_get_payment_meta($payment_id);
388 388
 
389 389
 	// Must be a PayPal standard IPN.
390
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
390
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
391 391
 		return;
392 392
 	}
393 393
 
394 394
 	// Verify payment recipient
395
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
395
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
396 396
 
397 397
 		give_record_gateway_error(
398
-			esc_html__( 'IPN Error', 'give' ),
398
+			esc_html__('IPN Error', 'give'),
399 399
 			sprintf(
400 400
 			/* translators: %s: Paypal IPN response */
401
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
402
-				json_encode( $data )
401
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
402
+				json_encode($data)
403 403
 			),
404 404
 			$payment_id
405 405
 		);
406
-		give_update_payment_status( $payment_id, 'failed' );
407
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
406
+		give_update_payment_status($payment_id, 'failed');
407
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
408 408
 
409 409
 		return;
410 410
 	}
411 411
 
412 412
 	// Verify payment currency.
413
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
413
+	if ($currency_code != strtolower($payment_meta['currency'])) {
414 414
 
415 415
 		give_record_gateway_error(
416
-			esc_html__( 'IPN Error', 'give' ),
416
+			esc_html__('IPN Error', 'give'),
417 417
 			sprintf(
418 418
 			/* translators: %s: Paypal IPN response */
419
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
420
-				json_encode( $data )
419
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
420
+				json_encode($data)
421 421
 			),
422 422
 			$payment_id
423 423
 		);
424
-		give_update_payment_status( $payment_id, 'failed' );
425
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
424
+		give_update_payment_status($payment_id, 'failed');
425
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
426 426
 
427 427
 		return;
428 428
 	}
429 429
 
430 430
 	//Process refunds & reversed.
431
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
432
-		give_process_paypal_refund( $data, $payment_id );
431
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
432
+		give_process_paypal_refund($data, $payment_id);
433 433
 
434 434
 		return;
435 435
 	}
436 436
 
437 437
 	// Only complete payments once.
438
-	if ( get_post_status( $payment_id ) == 'publish' ) {
438
+	if (get_post_status($payment_id) == 'publish') {
439 439
 		return;
440 440
 	}
441 441
 
442 442
 	// Retrieve the total donation amount (before PayPal).
443
-	$payment_amount = give_get_payment_amount( $payment_id );
443
+	$payment_amount = give_get_payment_amount($payment_id);
444 444
 
445 445
 	//Check that the donation PP and local db amounts match.
446
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
446
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
447 447
 		// The prices don't match
448 448
 		give_record_gateway_error(
449
-			esc_html__( 'IPN Error', 'give' ),
449
+			esc_html__('IPN Error', 'give'),
450 450
 			sprintf(
451 451
 			/* translators: %s: Paypal IPN response */
452
-				esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
453
-				json_encode( $data )
452
+				esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
453
+				json_encode($data)
454 454
 			),
455 455
 			$payment_id
456 456
 		);
457
-		give_update_payment_status( $payment_id, 'failed' );
458
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
457
+		give_update_payment_status($payment_id, 'failed');
458
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
459 459
 
460 460
 		return;
461 461
 	}
462 462
 
463 463
 	//Process completed donations.
464
-	if ( $payment_status == 'completed' || give_is_test_mode() ) {
464
+	if ($payment_status == 'completed' || give_is_test_mode()) {
465 465
 
466 466
 		give_insert_payment_note(
467 467
 			$payment_id,
468 468
 			sprintf(
469 469
 			/* translators: %s: Paypal transaction ID */
470
-				esc_html__( 'PayPal Transaction ID: %s', 'give' ),
470
+				esc_html__('PayPal Transaction ID: %s', 'give'),
471 471
 				$data['txn_id']
472 472
 			)
473 473
 		);
474
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
475
-		give_update_payment_status( $payment_id, 'publish' );
474
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
475
+		give_update_payment_status($payment_id, 'publish');
476 476
 
477
-	} elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
477
+	} elseif ('pending' == $payment_status && isset($data['pending_reason'])) {
478 478
 
479 479
 		// Look for possible pending reasons, such as an echeck.
480
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
480
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
481 481
 
482
-		if ( ! empty( $note ) ) {
482
+		if ( ! empty($note)) {
483 483
 
484
-			give_insert_payment_note( $payment_id, $note );
484
+			give_insert_payment_note($payment_id, $note);
485 485
 
486 486
 		}
487 487
 	}
488 488
 
489 489
 }
490 490
 
491
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
491
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
492 492
 
493 493
 /**
494 494
  * Process PayPal IPN Refunds
@@ -500,28 +500,28 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return void
502 502
  */
503
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
503
+function give_process_paypal_refund($data, $payment_id = 0) {
504 504
 
505 505
 	// Collect payment details
506 506
 
507
-	if ( empty( $payment_id ) ) {
507
+	if (empty($payment_id)) {
508 508
 		return;
509 509
 	}
510 510
 
511
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
511
+	if (get_post_status($payment_id) == 'refunded') {
512 512
 		return; // Only refund payments once
513 513
 	}
514 514
 
515
-	$payment_amount = give_get_payment_amount( $payment_id );
515
+	$payment_amount = give_get_payment_amount($payment_id);
516 516
 	$refund_amount  = $data['payment_gross'] * - 1;
517 517
 
518
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
518
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
519 519
 
520 520
 		give_insert_payment_note(
521 521
 			$payment_id,
522 522
 			sprintf(
523 523
 			/* translators: %s: Paypal parent transaction ID */
524
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
524
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
525 525
 				$data['parent_txn_id']
526 526
 			)
527 527
 		);
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		$payment_id,
535 535
 		sprintf(
536 536
 		/* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
537
-			esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ),
537
+			esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'),
538 538
 			$data['parent_txn_id'],
539 539
 			$data['reason_code']
540 540
 		)
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 		$payment_id,
544 544
 		sprintf(
545 545
 		/* translators: %s: Paypal transaction ID */
546
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
546
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
547 547
 			$data['txn_id']
548 548
 		)
549 549
 	);
550
-	give_update_payment_status( $payment_id, 'refunded' );
550
+	give_update_payment_status($payment_id, 'refunded');
551 551
 }
552 552
 
553 553
 /**
@@ -559,24 +559,24 @@  discard block
 block discarded – undo
559 559
  *
560 560
  * @return string
561 561
  */
562
-function give_get_paypal_redirect( $ssl_check = false ) {
562
+function give_get_paypal_redirect($ssl_check = false) {
563 563
 
564
-	if ( is_ssl() || ! $ssl_check ) {
564
+	if (is_ssl() || ! $ssl_check) {
565 565
 		$protocal = 'https://';
566 566
 	} else {
567 567
 		$protocal = 'http://';
568 568
 	}
569 569
 
570 570
 	// Check the current payment mode
571
-	if ( give_is_test_mode() ) {
571
+	if (give_is_test_mode()) {
572 572
 		// Test mode
573
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
573
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
574 574
 	} else {
575 575
 		// Live mode
576
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
576
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
577 577
 	}
578 578
 
579
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
579
+	return apply_filters('give_paypal_uri', $paypal_uri);
580 580
 }
581 581
 
582 582
 /**
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
  * @return string
587 587
  */
588 588
 function give_get_paypal_page_style() {
589
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
589
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
590 590
 
591
-	return apply_filters( 'give_paypal_page_style', $page_style );
591
+	return apply_filters('give_paypal_page_style', $page_style);
592 592
 }
593 593
 
594 594
 /**
@@ -603,26 +603,26 @@  discard block
 block discarded – undo
603 603
  * @return string
604 604
  *
605 605
  */
606
-function give_paypal_success_page_content( $content ) {
606
+function give_paypal_success_page_content($content) {
607 607
 
608
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
608
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
609 609
 		return $content;
610 610
 	}
611 611
 
612
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
612
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
613 613
 
614
-	if ( ! $payment_id ) {
614
+	if ( ! $payment_id) {
615 615
 		$session    = give_get_purchase_session();
616
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
616
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
617 617
 	}
618 618
 
619
-	$payment = get_post( $payment_id );
620
-	if ( $payment && 'pending' == $payment->post_status ) {
619
+	$payment = get_post($payment_id);
620
+	if ($payment && 'pending' == $payment->post_status) {
621 621
 
622 622
 		// Payment is still pending so show processing indicator to fix the race condition.
623 623
 		ob_start();
624 624
 
625
-		give_get_template_part( 'payment', 'processing' );
625
+		give_get_template_part('payment', 'processing');
626 626
 
627 627
 		$content = ob_get_clean();
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 
633 633
 }
634 634
 
635
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
635
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
636 636
 
637 637
 /**
638 638
  * Given a Payment ID, extract the transaction ID
@@ -643,22 +643,22 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return string                   Transaction ID
645 645
  */
646
-function give_paypal_get_payment_transaction_id( $payment_id ) {
646
+function give_paypal_get_payment_transaction_id($payment_id) {
647 647
 
648 648
 	$transaction_id = '';
649
-	$notes          = give_get_payment_notes( $payment_id );
649
+	$notes          = give_get_payment_notes($payment_id);
650 650
 
651
-	foreach ( $notes as $note ) {
652
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
651
+	foreach ($notes as $note) {
652
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
653 653
 			$transaction_id = $match[1];
654 654
 			continue;
655 655
 		}
656 656
 	}
657 657
 
658
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
658
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
659 659
 }
660 660
 
661
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
661
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
662 662
 
663 663
 /**
664 664
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -670,16 +670,16 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return string                 A link to the PayPal transaction details
672 672
  */
673
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
673
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
674 674
 
675 675
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
676
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
676
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
677 677
 
678
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
678
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
679 679
 
680 680
 }
681 681
 
682
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
682
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
683 683
 
684 684
 
685 685
 /**
@@ -691,64 +691,64 @@  discard block
 block discarded – undo
691 691
  *
692 692
  * @return string
693 693
  */
694
-function give_paypal_get_pending_donation_note( $pending_reason ) {
694
+function give_paypal_get_pending_donation_note($pending_reason) {
695 695
 
696 696
 	$note = '';
697 697
 
698
-	switch ( $pending_reason ) {
698
+	switch ($pending_reason) {
699 699
 
700 700
 		case 'echeck' :
701 701
 
702
-			$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
702
+			$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
703 703
 
704 704
 			break;
705 705
 
706 706
 		case 'address' :
707 707
 
708
-			$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
708
+			$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
709 709
 
710 710
 			break;
711 711
 
712 712
 		case 'intl' :
713 713
 
714
-			$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
714
+			$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
715 715
 
716 716
 			break;
717 717
 
718 718
 		case 'multi-currency' :
719 719
 
720
-			$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
720
+			$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
721 721
 
722 722
 			break;
723 723
 
724 724
 		case 'paymentreview' :
725 725
 		case 'regulatory_review' :
726 726
 
727
-			$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
727
+			$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
728 728
 
729 729
 			break;
730 730
 
731 731
 		case 'unilateral' :
732 732
 
733
-			$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
733
+			$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
734 734
 
735 735
 			break;
736 736
 
737 737
 		case 'upgrade' :
738 738
 
739
-			$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
739
+			$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
740 740
 
741 741
 			break;
742 742
 
743 743
 		case 'verify' :
744 744
 
745
-			$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
745
+			$note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
746 746
 
747 747
 			break;
748 748
 
749 749
 		case 'other' :
750 750
 
751
-			$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
751
+			$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
752 752
 
753 753
 			break;
754 754
 
Please login to merge, or discard this patch.
includes/scripts.php 1 patch
Spacing   +148 added lines, -148 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,25 +25,25 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_load_scripts() {
27 27
 
28
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
29
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
30
-	$scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false;
28
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
29
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
30
+	$scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false;
31 31
 
32 32
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
33
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
33
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
34 34
 
35 35
 	// Localize / PHP to AJAX vars.
36
-	$localize_give_vars = apply_filters( 'give_global_script_vars', array(
36
+	$localize_give_vars = apply_filters('give_global_script_vars', array(
37 37
 		'ajaxurl'             => give_get_ajax_url(),
38
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
39
-		'currency_sign'       => give_currency_filter( '' ),
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
39
+		'currency_sign'       => give_currency_filter(''),
40 40
 		'currency_pos'        => give_get_currency_position(),
41 41
 		'thousands_separator' => give_get_price_thousand_separator(),
42 42
 		'decimal_separator'   => give_get_price_decimal_separator(),
43
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
44
-		'bad_minimum'         => __( 'The minimum donation amount for this form is', 'give' ),
45
-		'general_loading'     => __( 'Loading...', 'give' ),
46
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
43
+		'no_gateway'          => __('Please select a payment method.', 'give'),
44
+		'bad_minimum'         => __('The minimum donation amount for this form is', 'give'),
45
+		'general_loading'     => __('Loading...', 'give'),
46
+		'purchase_loading'    => __('Please Wait...', 'give'),
47 47
 		'number_decimals'     => give_get_price_decimals(),
48 48
 		'give_version'        => GIVE_VERSION,
49 49
 		'magnific_options'    => apply_filters(
@@ -57,81 +57,81 @@  discard block
 block discarded – undo
57 57
 			'give_form_translation_js',
58 58
 			array(
59 59
 				// Field name               Validation message.
60
-				'payment-mode'           => __( 'Please select payment mode.', 'give' ),
61
-				'give_first'             => __( 'Please enter your first name.', 'give' ),
62
-				'give_email'             => __( 'Please enter a valid email address.', 'give' ),
63
-				'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
64
-				'give_user_pass'         => __( 'Enter a password.', 'give' ),
65
-				'give_user_pass_confirm' => __( 'Enter a confirm password.', 'give' ),
66
-				'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
60
+				'payment-mode'           => __('Please select payment mode.', 'give'),
61
+				'give_first'             => __('Please enter your first name.', 'give'),
62
+				'give_email'             => __('Please enter a valid email address.', 'give'),
63
+				'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
64
+				'give_user_pass'         => __('Enter a password.', 'give'),
65
+				'give_user_pass_confirm' => __('Enter a confirm password.', 'give'),
66
+				'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
67 67
 			)
68 68
 		),
69
-	) );
69
+	));
70 70
 
71
-	$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array(
71
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
72 72
 		'ajaxurl'         => give_get_ajax_url(),
73
-		'loading'         => __( 'Loading', 'give' ),
73
+		'loading'         => __('Loading', 'give'),
74 74
 		// General loading message.
75
-		'select_option'   => __( 'Please select an option', 'give' ),
75
+		'select_option'   => __('Please select an option', 'give'),
76 76
 		// Variable pricing error with multi-donation option enabled.
77
-		'default_gateway' => give_get_default_gateway( null ),
78
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
77
+		'default_gateway' => give_get_default_gateway(null),
78
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
79 79
 		'number_decimals' => give_get_price_decimals(),
80
-	) );
80
+	));
81 81
 
82 82
 	// DEBUG is On.
83
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
83
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
84 84
 
85
-		if ( give_is_cc_verify_enabled() ) {
86
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
87
-			wp_enqueue_script( 'give-cc-validator' );
85
+		if (give_is_cc_verify_enabled()) {
86
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
87
+			wp_enqueue_script('give-cc-validator');
88 88
 		}
89 89
 
90
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
91
-		wp_enqueue_script( 'give-float-labels' );
90
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
91
+		wp_enqueue_script('give-float-labels');
92 92
 
93
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
94
-		wp_enqueue_script( 'give-blockui' );
93
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
94
+		wp_enqueue_script('give-blockui');
95 95
 
96
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
97
-		wp_enqueue_script( 'give-qtip' );
96
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
97
+		wp_enqueue_script('give-qtip');
98 98
 
99
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
100
-		wp_enqueue_script( 'give-accounting' );
99
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
100
+		wp_enqueue_script('give-accounting');
101 101
 
102
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
103
-		wp_enqueue_script( 'give-magnific' );
102
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
103
+		wp_enqueue_script('give-magnific');
104 104
 
105
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
106
-		wp_enqueue_script( 'give-checkout-global' );
105
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give-checkout-global');
107 107
 
108 108
 		// General scripts.
109
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
110
-		wp_enqueue_script( 'give-scripts' );
109
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
110
+		wp_enqueue_script('give-scripts');
111 111
 
112 112
 		// Load AJAX scripts, if enabled.
113
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
114
-		wp_enqueue_script( 'give-ajax' );
113
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
114
+		wp_enqueue_script('give-ajax');
115 115
 
116 116
 		// Localize / Pass AJAX vars from PHP,
117
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars );
118
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
117
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars);
118
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
119 119
 
120 120
 	} else {
121 121
 
122 122
 		// DEBUG is OFF (one JS file to rule them all!).
123
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
124
-		wp_enqueue_script( 'give' );
123
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
124
+		wp_enqueue_script('give');
125 125
 
126 126
 		// Localize / Pass AJAX vars from PHP.
127
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
128
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
127
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
128
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
129 129
 
130 130
 	}
131 131
 
132 132
 }
133 133
 
134
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
134
+add_action('wp_enqueue_scripts', 'give_load_scripts');
135 135
 
136 136
 /**
137 137
  * Register styles.
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function give_register_styles() {
146 146
 
147
-	if ( give_get_option( 'disable_css', false ) ) {
147
+	if (give_get_option('disable_css', false)) {
148 148
 		return;
149 149
 	}
150 150
 
151
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
152
-	wp_enqueue_style( 'give-styles' );
151
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
152
+	wp_enqueue_style('give-styles');
153 153
 
154 154
 }
155 155
 
156
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
156
+add_action('wp_enqueue_scripts', 'give_register_styles');
157 157
 
158 158
 
159 159
 /**
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 function give_get_stylesheet_uri() {
167 167
 
168 168
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
169
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
169
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
170 170
 
171 171
 	// LTR or RTL files.
172
-	$direction = ( is_rtl() ) ? '-rtl' : '';
172
+	$direction = (is_rtl()) ? '-rtl' : '';
173 173
 
174
-	$file          = 'give' . $direction . $suffix . '.css';
174
+	$file          = 'give'.$direction.$suffix.'.css';
175 175
 	$templates_dir = give_get_theme_template_dir_name();
176 176
 
177
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
178
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
179
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
180
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
181
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
177
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
178
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
179
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
180
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
181
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
182 182
 
183 183
 	$uri = false;
184 184
 
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	 * followed by non minified version, even if SCRIPT_DEBUG is not enabled.
189 189
 	 * This allows users to copy just give.css to their theme.
190 190
 	 */
191
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
192
-		if ( ! empty( $nonmin ) ) {
193
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
191
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
192
+		if ( ! empty($nonmin)) {
193
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
194 194
 		} else {
195
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
195
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
196 196
 		}
197
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
198
-		if ( ! empty( $nonmin ) ) {
199
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
197
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
198
+		if ( ! empty($nonmin)) {
199
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
200 200
 		} else {
201
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
201
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
202 202
 		}
203
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
204
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
203
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
204
+		$uri = trailingslashit(give_get_templates_url()).$file;
205 205
 	}
206 206
 
207
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
207
+	return apply_filters('give_get_stylesheet_uri', $uri);
208 208
 
209 209
 }
210 210
 
@@ -221,70 +221,70 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return void
223 223
  */
224
-function give_load_admin_scripts( $hook ) {
224
+function give_load_admin_scripts($hook) {
225 225
 
226 226
 	global $post, $post_type;
227 227
 
228 228
 	$give_options = give_get_settings();
229 229
 
230 230
 	// Directories of assets.
231
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
232
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
233
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
231
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
232
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
233
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
234 234
 
235 235
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
236
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
236
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
237 237
 
238 238
 	// LTR or RTL files.
239
-	$direction = ( is_rtl() ) ? '-rtl' : '';
239
+	$direction = (is_rtl()) ? '-rtl' : '';
240 240
 
241 241
 	// Global Admin.
242
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
243
-	wp_enqueue_style( 'give-admin-bar-notification' );
242
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
243
+	wp_enqueue_style('give-admin-bar-notification');
244 244
 
245 245
 	// Give Admin Only.
246
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
246
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
247 247
 		return;
248 248
 	}
249 249
 
250 250
 	// CSS.
251
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
252
-	wp_enqueue_style( 'jquery-ui-css' );
253
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', GIVE_VERSION );
254
-	wp_enqueue_style( 'give-admin' );
255
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
256
-	wp_enqueue_style( 'jquery-chosen' );
257
-	wp_enqueue_style( 'thickbox' );
251
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
252
+	wp_enqueue_style('jquery-ui-css');
253
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', GIVE_VERSION);
254
+	wp_enqueue_style('give-admin');
255
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
256
+	wp_enqueue_style('jquery-chosen');
257
+	wp_enqueue_style('thickbox');
258 258
 
259 259
 	// JS.
260
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
261
-	wp_enqueue_script( 'jquery-chosen' );
260
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
261
+	wp_enqueue_script('jquery-chosen');
262 262
 
263
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
264
-	wp_enqueue_script( 'give-accounting' );
263
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
264
+	wp_enqueue_script('give-accounting');
265 265
 
266
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
267
-	wp_enqueue_script( 'give-admin-scripts' );
266
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
267
+	wp_enqueue_script('give-admin-scripts');
268 268
 
269
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
270
-	wp_enqueue_script( 'jquery-flot' );
269
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
270
+	wp_enqueue_script('jquery-flot');
271 271
 
272
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
273
-	wp_enqueue_script( 'give-qtip' );
272
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
273
+	wp_enqueue_script('give-qtip');
274 274
 
275
-	wp_enqueue_script( 'jquery-ui-datepicker' );
276
-	wp_enqueue_script( 'thickbox' );
275
+	wp_enqueue_script('jquery-ui-datepicker');
276
+	wp_enqueue_script('thickbox');
277 277
 
278 278
 	// Forms CPT Script.
279
-	if ( $post_type === 'give_forms' ) {
280
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
281
-		wp_enqueue_script( 'give-admin-forms-scripts' );
279
+	if ($post_type === 'give_forms') {
280
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
281
+		wp_enqueue_script('give-admin-forms-scripts');
282 282
 	}
283 283
 
284 284
 	// Settings Scripts.
285
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
286
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
287
-		wp_enqueue_script( 'give-admin-settings-scripts' );
285
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
286
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
287
+		wp_enqueue_script('give-admin-settings-scripts');
288 288
 	}
289 289
 
290 290
 	// Price Separators.
@@ -292,46 +292,46 @@  discard block
 block discarded – undo
292 292
 	$decimal_separator  = give_get_price_decimal_separator();
293 293
 
294 294
 	// Localize strings & variables for JS.
295
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
296
-		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
295
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
296
+		'post_id'                 => isset($post->ID) ? $post->ID : null,
297 297
 		'give_version'            => GIVE_VERSION,
298 298
 		'thousands_separator'     => $thousand_separator,
299 299
 		'decimal_separator'       => $decimal_separator,
300
-		'quick_edit_warning'      => __( 'Not available for variable priced forms.', 'give' ),
301
-		'delete_payment'          => __( 'Are you sure you wish to delete this payment?', 'give' ),
302
-		'delete_payment_note'     => __( 'Are you sure you wish to delete this note?', 'give' ),
303
-		'revoke_api_key'          => __( 'Are you sure you wish to revoke this API key?', 'give' ),
304
-		'regenerate_api_key'      => __( 'Are you sure you wish to regenerate this API key?', 'give' ),
305
-		'resend_receipt'          => __( 'Are you sure you wish to resend the donation receipt?', 'give' ),
306
-		'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor.', 'give' ),
307
-		'delete_payment_download' => __( 'Are you sure you wish to delete this form?', 'give' ),
308
-		'one_price_min'           => __( 'You must have at least one price.', 'give' ),
309
-		'one_file_min'            => __( 'You must have at least one file.', 'give' ),
310
-		'one_field_min'           => __( 'You must have at least one field.', 'give' ),
311
-		'one_option'              => __( 'Choose a form', 'give' ),
312
-		'one_or_more_option'      => __( 'Choose one or more forms', 'give' ),
313
-		'numeric_item_price'      => __( 'Item price must be numeric.', 'give' ),
314
-		'numeric_quantity'        => __( 'Quantity must be numeric.', 'give' ),
315
-		'currency_sign'           => give_currency_filter( '' ),
316
-		'currency_pos'            => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
317
-		'currency_decimals'       => give_currency_decimal_filter( give_get_price_decimals() ),
318
-		'new_media_ui'            => apply_filters( 'give_use_35_media_ui', 1 ),
319
-		'remove_text'             => __( 'Remove', 'give' ),
320
-		'type_to_search'          => __( 'Type to search forms', 'give' ),
321
-		'batch_export_no_class'   => __( 'You must choose a method.', 'give' ),
322
-		'batch_export_no_reqs'    => __( 'Required fields not completed.', 'give' ),
323
-		'reset_stats_warn'        => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
324
-		'price_format_guide'      => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
325
-	) );
326
-
327
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
300
+		'quick_edit_warning'      => __('Not available for variable priced forms.', 'give'),
301
+		'delete_payment'          => __('Are you sure you wish to delete this payment?', 'give'),
302
+		'delete_payment_note'     => __('Are you sure you wish to delete this note?', 'give'),
303
+		'revoke_api_key'          => __('Are you sure you wish to revoke this API key?', 'give'),
304
+		'regenerate_api_key'      => __('Are you sure you wish to regenerate this API key?', 'give'),
305
+		'resend_receipt'          => __('Are you sure you wish to resend the donation receipt?', 'give'),
306
+		'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor.', 'give'),
307
+		'delete_payment_download' => __('Are you sure you wish to delete this form?', 'give'),
308
+		'one_price_min'           => __('You must have at least one price.', 'give'),
309
+		'one_file_min'            => __('You must have at least one file.', 'give'),
310
+		'one_field_min'           => __('You must have at least one field.', 'give'),
311
+		'one_option'              => __('Choose a form', 'give'),
312
+		'one_or_more_option'      => __('Choose one or more forms', 'give'),
313
+		'numeric_item_price'      => __('Item price must be numeric.', 'give'),
314
+		'numeric_quantity'        => __('Quantity must be numeric.', 'give'),
315
+		'currency_sign'           => give_currency_filter(''),
316
+		'currency_pos'            => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
317
+		'currency_decimals'       => give_currency_decimal_filter(give_get_price_decimals()),
318
+		'new_media_ui'            => apply_filters('give_use_35_media_ui', 1),
319
+		'remove_text'             => __('Remove', 'give'),
320
+		'type_to_search'          => __('Type to search forms', 'give'),
321
+		'batch_export_no_class'   => __('You must choose a method.', 'give'),
322
+		'batch_export_no_reqs'    => __('Required fields not completed.', 'give'),
323
+		'reset_stats_warn'        => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
324
+		'price_format_guide'      => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
325
+	));
326
+
327
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
328 328
 		// call for new media manager.
329 329
 		wp_enqueue_media();
330 330
 	}
331 331
 
332 332
 }
333 333
 
334
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
334
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
335 335
 
336 336
 /**
337 337
  * Admin Give Icon
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
 	?>
347 347
     <style type="text/css" media="screen">
348 348
 
349
-        <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
349
+        <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
350 350
         @font-face {
351 351
             font-family: 'give-icomoon';
352
-            src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>');
353
-            src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
354
-            url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
355
-            url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
352
+            src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>');
353
+            src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
354
+            url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
355
+            url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
356 356
             font-weight: normal;
357 357
             font-style: normal;
358 358
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	<?php
372 372
 }
373 373
 
374
-add_action( 'admin_head', 'give_admin_icon' );
374
+add_action('admin_head', 'give_admin_icon');
375 375
 
376 376
 /**
377 377
  * Admin js code
@@ -401,4 +401,4 @@  discard block
 block discarded – undo
401 401
 	<?php
402 402
 }
403 403
 
404
-add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' );
404
+add_action('admin_head', 'give_admin_hide_notice_shortly_js');
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		 * @return    Give
196 196
 		 */
197 197
 		public static function instance() {
198
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
198
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
199 199
 				self::$instance = new Give;
200 200
 				self::$instance->setup_constants();
201 201
 
202
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
202
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
203 203
 
204 204
 				self::$instance->includes();
205 205
 				self::$instance->roles           = new Give_Roles();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 */
233 233
 		public function __clone() {
234 234
 			// Cloning instances of the class is forbidden
235
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
236 236
 		}
237 237
 
238 238
 		/**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 */
246 246
 		public function __wakeup() {
247 247
 			// Unserializing instances of the class is forbidden.
248
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
249 249
 		}
250 250
 
251 251
 		/**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 		private function setup_constants() {
260 260
 
261 261
 			// Plugin version
262
-			if ( ! defined( 'GIVE_VERSION' ) ) {
263
-				define( 'GIVE_VERSION', '1.7.1' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.7.1');
264 264
 			}
265 265
 
266 266
 			// Plugin Folder Path
267
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
268
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
267
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
268
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
269 269
 			}
270 270
 
271 271
 			// Plugin Folder URL
272
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
273
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
272
+			if ( ! defined('GIVE_PLUGIN_URL')) {
273
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
274 274
 			}
275 275
 
276 276
 			// Plugin Basename aka: "give/give.php"
277
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
278
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
277
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
278
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
279 279
 			}
280 280
 
281 281
 			// Plugin Root File
282
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
283
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
282
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
283
+				define('GIVE_PLUGIN_FILE', __FILE__);
284 284
 			}
285 285
 
286 286
 			// Make sure CAL_GREGORIAN is defined
287
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
288
-				define( 'CAL_GREGORIAN', 1 );
287
+			if ( ! defined('CAL_GREGORIAN')) {
288
+				define('CAL_GREGORIAN', 1);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,117 +300,117 @@  discard block
 block discarded – undo
300 300
 		private function includes() {
301 301
 			global $give_options;
302 302
 
303
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
304 304
 			$give_options = give_get_settings();
305 305
 
306
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
311
-
312
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
314
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
322
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
323
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
326
-
327
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
328
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
329
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
330
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
331
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
332
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
333
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
334
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
335
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
336
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
337
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
338
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
339
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
340
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
341
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
342
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
343
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
344
-
345
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
347
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
348
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
349
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
350
-
351
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
353
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
354
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
355
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
356
-
357
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
359
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
360
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
361
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
362
-
363
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
364
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
311
+
312
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
314
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
322
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
323
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
326
+
327
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
328
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
329
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
330
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
331
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
332
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
333
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
334
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
335
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
336
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
337
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
338
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
339
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
340
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
341
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
342
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
343
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
344
+
345
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
347
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
348
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
349
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
350
+
351
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
353
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
354
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
355
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
356
+
357
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
359
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
360
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
361
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
362
+
363
+            if (defined('WP_CLI') && WP_CLI) {
364
+                require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
365 365
             }
366 366
 
367
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
368
-
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
371
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
373
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
374
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
376
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
377
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
379
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
380
-
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
382
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
383
-
384
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
387
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
388
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
389
-
390
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
391
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
394
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
396
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
397
-
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
400
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
401
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
402
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
403
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
404
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
405
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
406
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
407
-
408
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
409
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
367
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
368
+
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
371
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
373
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
374
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
376
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
377
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
379
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
380
+
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
382
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
383
+
384
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
387
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
388
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
389
+
390
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
391
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
394
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
396
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
397
+
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
400
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
401
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
402
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
403
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
404
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
405
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
406
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
407
+
408
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
409
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
410 410
 
411 411
 			}
412 412
 
413
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
413
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
414 414
 
415 415
 		}
416 416
 
@@ -424,26 +424,26 @@  discard block
 block discarded – undo
424 424
 		 */
425 425
 		public function load_textdomain() {
426 426
 			// Set filter for Give's languages directory
427
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
428
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
427
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
428
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
429 429
 
430 430
 			// Traditional WordPress plugin locale filter
431
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
432
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
431
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
432
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
433 433
 
434 434
 			// Setup paths to current locale file
435
-			$mofile_local  = $give_lang_dir . $mofile;
436
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
435
+			$mofile_local  = $give_lang_dir.$mofile;
436
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
437 437
 
438
-			if ( file_exists( $mofile_global ) ) {
438
+			if (file_exists($mofile_global)) {
439 439
 				// Look in global /wp-content/languages/give folder
440
-				load_textdomain( 'give', $mofile_global );
441
-			} elseif ( file_exists( $mofile_local ) ) {
440
+				load_textdomain('give', $mofile_global);
441
+			} elseif (file_exists($mofile_local)) {
442 442
 				// Look in local location from filter `give_languages_directory`
443
-				load_textdomain( 'give', $mofile_local );
443
+				load_textdomain('give', $mofile_local);
444 444
 			} else {
445 445
 				// Load the default language files packaged up w/ Give
446
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
446
+				load_plugin_textdomain('give', false, $give_lang_dir);
447 447
 			}
448 448
 		}
449 449
 
Please login to merge, or discard this patch.