Completed
Pull Request — master (#1082)
by Devin
19:08
created
includes/shortcodes.php 2 patches
Spacing   +113 added lines, -113 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,28 +25,28 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_donation_history() {
27 27
 
28
-	$email_access = give_get_option( 'email_access' );
28
+	$email_access = give_get_option('email_access');
29 29
 
30 30
 	//Is user logged in? Does a session exist? Does an email-access token exist?
31
-	if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) {
31
+	if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) {
32 32
 		ob_start();
33
-		give_get_template_part( 'history', 'donations' );
33
+		give_get_template_part('history', 'donations');
34 34
 
35 35
 		return ob_get_clean();
36 36
 	} //Is Email-based access enabled?
37
-	elseif ( $email_access == 'on' ) {
37
+	elseif ($email_access == 'on') {
38 38
 
39 39
 		ob_start();
40
-		give_get_template_part( 'email', 'login-form' );
40
+		give_get_template_part('email', 'login-form');
41 41
 
42 42
 		return ob_get_clean();
43 43
 	} else {
44
-		$message = esc_html__( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' );
45
-		echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message );
44
+		$message = esc_html__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give');
45
+		echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message);
46 46
 	}
47 47
 }
48 48
 
49
-add_shortcode( 'donation_history', 'give_donation_history' );
49
+add_shortcode('donation_history', 'give_donation_history');
50 50
 
51 51
 /**
52 52
  * Donation Form Shortcode
@@ -60,53 +60,53 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string
62 62
  */
63
-function give_form_shortcode( $atts, $content = null ) {
64
-	$atts = shortcode_atts( array(
63
+function give_form_shortcode($atts, $content = null) {
64
+	$atts = shortcode_atts(array(
65 65
 		'id'            => '',
66 66
 		'show_title'    => true,
67 67
 		'show_goal'     => true,
68 68
 		'show_content'  => '',
69 69
 		'float_labels'  => '',
70 70
 		'display_style' => '',
71
-	), $atts, 'give_form' );
71
+	), $atts, 'give_form');
72 72
 
73
-	foreach ( $atts as $key => $value ) {
73
+	foreach ($atts as $key => $value) {
74 74
 		//convert shortcode_atts values to booleans
75
-		if ( $key == 'show_title' ) {
76
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
77
-		} elseif ( $key == 'show_goal' ) {
78
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
75
+		if ($key == 'show_title') {
76
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
77
+		} elseif ($key == 'show_goal') {
78
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
79 79
 		}
80 80
 
81 81
 		//validate show_content value
82
-		if ( $key == 'show_content' ) {
83
-			if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) {
84
-				$atts[ $key ] = '';
85
-			} else if ( $value == 'above' ) {
86
-				$atts[ $key ] = 'give_pre_form';
87
-			} else if ( $value == 'below' ) {
88
-				$atts[ $key ] = 'give_post_form';
82
+		if ($key == 'show_content') {
83
+			if ( ! in_array($value, array('none', 'above', 'below'))) {
84
+				$atts[$key] = '';
85
+			} else if ($value == 'above') {
86
+				$atts[$key] = 'give_pre_form';
87
+			} else if ($value == 'below') {
88
+				$atts[$key] = 'give_post_form';
89 89
 			}
90 90
 		}
91 91
 
92 92
 		//validate display_style and float_labels value
93
-		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
94
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
93
+		if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal')))
94
+		     || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled')))
95 95
 		) {
96 96
 
97
-			$atts[ $key ] = '';
97
+			$atts[$key] = '';
98 98
 		}
99 99
 	}
100 100
 
101 101
 	//get the Give Form
102 102
 	ob_start();
103
-	give_get_donation_form( $atts );
103
+	give_get_donation_form($atts);
104 104
 	$final_output = ob_get_clean();
105 105
 
106
-	return apply_filters( 'give_donate_form', $final_output, $atts );
106
+	return apply_filters('give_donate_form', $final_output, $atts);
107 107
 }
108 108
 
109
-add_shortcode( 'give_form', 'give_form_shortcode' );
109
+add_shortcode('give_form', 'give_form_shortcode');
110 110
 
111 111
 /**
112 112
  * Donation Form Goal Shortcode.
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_goal_shortcode( $atts, $content = null ) {
124
-	$atts = shortcode_atts( array(
123
+function give_goal_shortcode($atts, $content = null) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'        => '',
126 126
 		'show_text' => true,
127 127
 		'show_bar'  => true,
128
-	), $atts, 'give_goal' );
128
+	), $atts, 'give_goal');
129 129
 
130 130
 
131 131
 	//get the Give Form.
132 132
 	ob_start();
133 133
 
134 134
 	//Sanity check 1: ensure there is an ID Provided.
135
-	if ( empty( $atts['id'] ) ) {
136
-		give_output_error( esc_html__( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true );
135
+	if (empty($atts['id'])) {
136
+		give_output_error(esc_html__('Error: No Donation form ID for the shortcode provided.', 'give'), true);
137 137
 	}
138 138
 
139 139
 	//Sanity check 2: Check that this form even has Goals enabled.
140
-	$goal_option = get_post_meta( $atts['id'], '_give_goal_option', true );
141
-	if ( empty( $goal_option ) || $goal_option !== 'yes' ) {
142
-		give_output_error( esc_html__( 'Error: This form does not have Goals enabled.', 'give' ), true );
140
+	$goal_option = get_post_meta($atts['id'], '_give_goal_option', true);
141
+	if (empty($goal_option) || $goal_option !== 'yes') {
142
+		give_output_error(esc_html__('Error: This form does not have Goals enabled.', 'give'), true);
143 143
 	} else {
144 144
 		//Passed all sanity checks: output Goal.
145
-		give_show_goal_progress( $atts['id'], $atts );
145
+		give_show_goal_progress($atts['id'], $atts);
146 146
 	}
147 147
 
148 148
 	$final_output = ob_get_clean();
149 149
 
150
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
150
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
151 151
 }
152 152
 
153
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
153
+add_shortcode('give_goal', 'give_goal_shortcode');
154 154
 
155 155
 
156 156
 /**
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
  * @uses  give_login_form()
168 168
  * @return string
169 169
  */
170
-function give_login_form_shortcode( $atts, $content = null ) {
171
-	$atts = shortcode_atts( array(
170
+function give_login_form_shortcode($atts, $content = null) {
171
+	$atts = shortcode_atts(array(
172 172
         // Add backward compatibility for redirect attribute.
173 173
         'redirect'          => '',
174 174
 
175 175
 		'login-redirect'    => '',
176 176
 		'logout-redirect'   => '',
177
-	), $atts, 'give_login' );
177
+	), $atts, 'give_login');
178 178
 
179 179
     // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
-    $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
180
+    $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
181 181
 
182
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
182
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
183 183
 }
184 184
 
185
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
185
+add_shortcode('give_login', 'give_login_form_shortcode');
186 186
 
187 187
 /**
188 188
  * Register Shortcode.
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
  * @uses  give_register_form()
198 198
  * @return string
199 199
  */
200
-function give_register_form_shortcode( $atts, $content = null ) {
201
-	$atts = shortcode_atts( array(
200
+function give_register_form_shortcode($atts, $content = null) {
201
+	$atts = shortcode_atts(array(
202 202
 		'redirect' => '',
203
-	), $atts, 'give_register' );
203
+	), $atts, 'give_register');
204 204
 
205
-	return give_register_form( $atts['redirect'] );
205
+	return give_register_form($atts['redirect']);
206 206
 }
207 207
 
208
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
208
+add_shortcode('give_register', 'give_register_form_shortcode');
209 209
 
210 210
 
211 211
 /**
@@ -220,62 +220,62 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return string
222 222
  */
223
-function give_receipt_shortcode( $atts, $content = null ) {
223
+function give_receipt_shortcode($atts, $content = null) {
224 224
 
225 225
 	global $give_receipt_args, $payment;
226 226
 
227
-	$give_receipt_args = shortcode_atts( array(
228
-		'error'          => esc_html__( 'Sorry, you are missing the payment key to view this donation receipt.', 'give' ),
227
+	$give_receipt_args = shortcode_atts(array(
228
+		'error'          => esc_html__('Sorry, you are missing the payment key to view this donation receipt.', 'give'),
229 229
 		'price'          => true,
230 230
 		'donor'          => true,
231 231
 		'date'           => true,
232 232
 		'payment_key'    => false,
233 233
 		'payment_method' => true,
234 234
 		'payment_id'     => true
235
-	), $atts, 'give_receipt' );
235
+	), $atts, 'give_receipt');
236 236
 
237 237
 	//set $session var
238 238
 	$session = give_get_purchase_session();
239 239
 
240 240
 	//set payment key var
241
-	if ( isset( $_GET['payment_key'] ) ) {
242
-		$payment_key = urldecode( $_GET['payment_key'] );
243
-	} elseif ( $session ) {
241
+	if (isset($_GET['payment_key'])) {
242
+		$payment_key = urldecode($_GET['payment_key']);
243
+	} elseif ($session) {
244 244
 		$payment_key = $session['purchase_key'];
245
-	} elseif ( $give_receipt_args['payment_key'] ) {
245
+	} elseif ($give_receipt_args['payment_key']) {
246 246
 		$payment_key = $give_receipt_args['payment_key'];
247 247
 	}
248 248
 
249
-	$email_access = give_get_option( 'email_access' );
249
+	$email_access = give_get_option('email_access');
250 250
 
251 251
 	// No payment_key found & Email Access is Turned on:
252
-	if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) {
252
+	if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) {
253 253
 
254 254
 		ob_start();
255 255
 
256
-		give_get_template_part( 'email-login-form' );
256
+		give_get_template_part('email-login-form');
257 257
 
258 258
 		return ob_get_clean();
259 259
 
260
-	} elseif ( ! isset( $payment_key ) ) {
260
+	} elseif ( ! isset($payment_key)) {
261 261
 
262
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
262
+		return give_output_error($give_receipt_args['error'], false, 'error');
263 263
 
264 264
 	}
265 265
 
266
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
267
-	$user_can_view = give_can_view_receipt( $payment_key );
266
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
267
+	$user_can_view = give_can_view_receipt($payment_key);
268 268
 
269 269
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
270
-	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) {
270
+	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) {
271 271
 
272 272
 		ob_start();
273 273
 
274
-		give_get_template_part( 'email-login-form' );
274
+		give_get_template_part('email-login-form');
275 275
 
276 276
 		return ob_get_clean();
277 277
 
278
-	} elseif ( ! $user_can_view ) {
278
+	} elseif ( ! $user_can_view) {
279 279
 
280 280
 		global $give_login_redirect;
281 281
 
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 
284 284
 		ob_start();
285 285
 
286
-		give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation payment receipt.', 'give' ) ) );
286
+		give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation payment receipt.', 'give')));
287 287
 
288
-		give_get_template_part( 'shortcode', 'login' );
288
+		give_get_template_part('shortcode', 'login');
289 289
 
290 290
 		$login_form = ob_get_clean();
291 291
 
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 	 * or if user is logged in and the user can view sensitive shop data.
301 301
 	 *
302 302
 	 */
303
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
304
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
303
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
304
+		return give_output_error($give_receipt_args['error'], false, 'error');
305 305
 	}
306 306
 
307 307
 	ob_start();
308 308
 
309
-	give_get_template_part( 'shortcode', 'receipt' );
309
+	give_get_template_part('shortcode', 'receipt');
310 310
 
311 311
 	$display = ob_get_clean();
312 312
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 }
317 317
 
318
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
318
+add_shortcode('give_receipt', 'give_receipt_shortcode');
319 319
 
320 320
 /**
321 321
  * Profile Editor Shortcode.
@@ -335,18 +335,18 @@  discard block
 block discarded – undo
335 335
  *
336 336
  * @return string Output generated from the profile editor
337 337
  */
338
-function give_profile_editor_shortcode( $atts, $content = null ) {
338
+function give_profile_editor_shortcode($atts, $content = null) {
339 339
 
340 340
 	ob_start();
341 341
 
342
-	give_get_template_part( 'shortcode', 'profile-editor' );
342
+	give_get_template_part('shortcode', 'profile-editor');
343 343
 
344 344
 	$display = ob_get_clean();
345 345
 
346 346
 	return $display;
347 347
 }
348 348
 
349
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
349
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
350 350
 
351 351
 /**
352 352
  * Process Profile Updater Form.
@@ -359,30 +359,30 @@  discard block
 block discarded – undo
359 359
  *
360 360
  * @return bool
361 361
  */
362
-function give_process_profile_editor_updates( $data ) {
362
+function give_process_profile_editor_updates($data) {
363 363
 	// Profile field change request
364
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
364
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
365 365
 		return false;
366 366
 	}
367 367
 
368 368
 	// Nonce security
369
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
369
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
370 370
 		return false;
371 371
 	}
372 372
 
373 373
 	$user_id       = get_current_user_id();
374
-	$old_user_data = get_userdata( $user_id );
375
-
376
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
377
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
378
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
379
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
380
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
381
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
382
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
383
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
384
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
385
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
374
+	$old_user_data = get_userdata($user_id);
375
+
376
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
377
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
378
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
379
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
380
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
381
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
382
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
383
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
384
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
385
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
386 386
 
387 387
 	$userdata = array(
388 388
 		'ID'           => $user_id,
@@ -410,46 +410,46 @@  discard block
 block discarded – undo
410 410
 	 * @param int   $user_id  The ID of the user.
411 411
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
412 412
 	 */
413
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
413
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
414 414
 
415 415
 	// New password
416
-	if ( ! empty( $data['give_new_user_pass1'] ) ) {
417
-		if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) {
418
-			give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) );
416
+	if ( ! empty($data['give_new_user_pass1'])) {
417
+		if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) {
418
+			give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give'));
419 419
 		} else {
420 420
 			$userdata['user_pass'] = $data['give_new_user_pass1'];
421 421
 		}
422 422
 	}
423 423
 
424
-	if( empty( $email ) ) {
424
+	if (empty($email)) {
425 425
 		// Make sure email should not be empty.
426
-		give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) );
426
+		give_set_error('email_empty', esc_html__('The email you entered is empty.', 'give'));
427 427
 
428
-	}else if ( ! is_email( $email ) ){
428
+	} else if ( ! is_email($email)) {
429 429
 		// Make sure email should be valid.
430
-		give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) );
430
+		give_set_error('email_not_valid', esc_html__('The email you entered is not valid. Please use another', 'give'));
431 431
 
432
-	}else if ( $email != $old_user_data->user_email ) {
432
+	} else if ($email != $old_user_data->user_email) {
433 433
 		// Make sure the new email doesn't belong to another user
434
-		if ( email_exists( $email ) ) {
435
-			give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) );
434
+		if (email_exists($email)) {
435
+			give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give'));
436 436
 		}
437 437
 	}
438 438
 
439 439
 	// Check for errors
440 440
 	$errors = give_get_errors();
441 441
 
442
-	if ( $errors ) {
442
+	if ($errors) {
443 443
 		// Send back to the profile editor if there are errors
444
-		wp_redirect( $data['give_redirect'] );
444
+		wp_redirect($data['give_redirect']);
445 445
 		give_die();
446 446
 	}
447 447
 
448 448
 	// Update the user
449
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
450
-	$updated = wp_update_user( $userdata );
449
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
450
+	$updated = wp_update_user($userdata);
451 451
 
452
-	if ( $updated ) {
452
+	if ($updated) {
453 453
 
454 454
 		/**
455 455
 		 * Fires after updating user profile.
@@ -459,13 +459,13 @@  discard block
 block discarded – undo
459 459
 		 * @param int   $user_id  The ID of the user.
460 460
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
461 461
 		 */
462
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
463
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
462
+		do_action('give_user_profile_updated', $user_id, $userdata);
463
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
464 464
 		give_die();
465 465
 	}
466 466
 
467 467
 	return false;
468 468
 }
469 469
 
470
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
470
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
471 471
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -425,11 +425,11 @@
 block discarded – undo
425 425
 		// Make sure email should not be empty.
426 426
 		give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) );
427 427
 
428
-	}else if ( ! is_email( $email ) ){
428
+	} else if ( ! is_email( $email ) ){
429 429
 		// Make sure email should be valid.
430 430
 		give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) );
431 431
 
432
-	}else if ( $email != $old_user_data->user_email ) {
432
+	} else if ( $email != $old_user_data->user_email ) {
433 433
 		// Make sure the new email doesn't belong to another user
434 434
 		if ( email_exists( $email ) ) {
435 435
 			give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) );
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +184 added lines, -184 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 Purchase.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_purchase( $purchase_data ) {
35
+function give_process_paypal_purchase($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id  = intval( $purchase_data['post_data']['give-form-id'] );
42
-	$price_id = isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '';
41
+	$form_id  = intval($purchase_data['post_data']['give-form-id']);
42
+	$price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '';
43 43
 
44 44
 	// Collect payment data.
45 45
 	$payment_data = array(
@@ -57,103 +57,103 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment.
60
-	$payment = give_insert_payment( $payment_data );
60
+	$payment = give_insert_payment($payment_data);
61 61
 
62 62
 	// Check payment.
63
-	if ( ! $payment ) {
63
+	if ( ! $payment) {
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 buyer to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment
73 73
 		);
74 74
 		// Problems? Send back.
75
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$purchase_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
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 = $purchase_data['post_data']['give-form-title'];
94 94
 
95 95
 		//Verify has variable prices.
96
-		if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) {
96
+		if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) {
97 97
 
98
-			$item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] );
98
+			$item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']);
99 99
 
100
-			$price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] );
100
+			$price_level_amount = give_get_price_option_amount($form_id, $purchase_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( $purchase_data['price'] ) ) {
104
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+			if ($price_level_amount != give_sanitize_amount($purchase_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( $purchase_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($purchase_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 arguments.
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'    => $purchase_data['user_info']['first_name'],
124 124
 			'last_name'     => $purchase_data['user_info']['last_name'],
125 125
 			'email'         => $purchase_data['user_email'],
126 126
 			'invoice'       => $purchase_data['purchase_key'],
127 127
 			'amount'        => $purchase_data['price'],
128 128
 			// The all important donation amount.
129
-			'item_name'     => stripslashes( $item_name ),
129
+			'item_name'     => stripslashes($item_name),
130 130
 			// "Purpose" field pre-populated with Form Title.
131 131
 			'no_shipping'   => '1',
132 132
 			'shipping'      => '0',
133 133
 			'no_note'       => '1',
134 134
 			'currency_code' => give_get_currency(),
135
-			'charset'       => get_bloginfo( 'charset' ),
135
+			'charset'       => get_bloginfo('charset'),
136 136
 			'custom'        => $payment,
137 137
 			'rm'            => '2',
138 138
 			'return'        => $return_url,
139
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ),
139
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment),
140 140
 			'notify_url'    => $listener_url,
141 141
 			'page_style'    => give_get_paypal_page_style(),
142
-			'cbt'           => get_bloginfo( 'name' ),
142
+			'cbt'           => get_bloginfo('name'),
143 143
 			'bn'            => 'givewp_SP'
144 144
 		);
145 145
 
146 146
 		//Add user address if present.
147
-		if ( ! empty( $purchase_data['user_info']['address'] ) ) {
148
-			$paypal_args['address1'] = isset( $purchase_data['user_info']['address']['line1'] ) ? $purchase_data['user_info']['address']['line1'] : '';
149
-			$paypal_args['address2'] = isset( $purchase_data['user_info']['address']['line2'] ) ? $purchase_data['user_info']['address']['line2'] : '';
150
-			$paypal_args['city']     = isset( $purchase_data['user_info']['address']['city'] ) ? $purchase_data['user_info']['address']['city'] : '';
151
-			$paypal_args['state']    = isset( $purchase_data['user_info']['address']['state'] ) ? $purchase_data['user_info']['address']['state'] : '';
152
-			$paypal_args['country']  = isset( $purchase_data['user_info']['address']['country'] ) ? $purchase_data['user_info']['address']['country'] : '';
147
+		if ( ! empty($purchase_data['user_info']['address'])) {
148
+			$paypal_args['address1'] = isset($purchase_data['user_info']['address']['line1']) ? $purchase_data['user_info']['address']['line1'] : '';
149
+			$paypal_args['address2'] = isset($purchase_data['user_info']['address']['line2']) ? $purchase_data['user_info']['address']['line2'] : '';
150
+			$paypal_args['city']     = isset($purchase_data['user_info']['address']['city']) ? $purchase_data['user_info']['address']['city'] : '';
151
+			$paypal_args['state']    = isset($purchase_data['user_info']['address']['state']) ? $purchase_data['user_info']['address']['state'] : '';
152
+			$paypal_args['country']  = isset($purchase_data['user_info']['address']['country']) ? $purchase_data['user_info']['address']['country'] : '';
153 153
 		}
154 154
 
155 155
 		//Donations or regular transactions?
156
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
156
+		if (give_get_option('paypal_button_type') === 'standard') {
157 157
 			$paypal_extra_args = array(
158 158
 				'cmd' => '_xclick',
159 159
 			);
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
 			);
164 164
 		}
165 165
 
166
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
167
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data );
166
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
167
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data);
168 168
 
169 169
 		// Build query.
170
-		$paypal_redirect .= http_build_query( $paypal_args );
170
+		$paypal_redirect .= http_build_query($paypal_args);
171 171
 
172 172
 		// Fix for some sites that encode the entities.
173
-		$paypal_redirect = str_replace( '&', '&', $paypal_redirect );
173
+		$paypal_redirect = str_replace('&', '&', $paypal_redirect);
174 174
 
175 175
 		// Redirect to PayPal.
176
-		wp_redirect( $paypal_redirect );
176
+		wp_redirect($paypal_redirect);
177 177
 		exit;
178 178
 	}
179 179
 
180 180
 }
181 181
 
182
-add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' );
182
+add_action('give_gateway_paypal', 'give_process_paypal_purchase');
183 183
 
184 184
 /**
185 185
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function give_listen_for_paypal_ipn() {
191 191
 	// Regular PayPal IPN
192
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
193
-		do_action( 'give_verify_paypal_ipn' );
192
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
193
+		do_action('give_verify_paypal_ipn');
194 194
 	}
195 195
 }
196 196
 
197
-add_action( 'init', 'give_listen_for_paypal_ipn' );
197
+add_action('init', 'give_listen_for_paypal_ipn');
198 198
 
199 199
 /**
200 200
  * Process PayPal IPN
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 function give_process_paypal_ipn() {
206 206
 
207 207
 	// Check the request method is POST
208
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
208
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
209 209
 		return;
210 210
 	}
211 211
 
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	$post_data = '';
214 214
 
215 215
 	// Fallback just in case post_max_size is lower than needed
216
-	if ( ini_get( 'allow_url_fopen' ) ) {
217
-		$post_data = file_get_contents( 'php://input' );
216
+	if (ini_get('allow_url_fopen')) {
217
+		$post_data = file_get_contents('php://input');
218 218
 	} else {
219 219
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
220
-		ini_set( 'post_max_size', '12M' );
220
+		ini_set('post_max_size', '12M');
221 221
 	}
222 222
 	// Start the encoded data collection with notification command
223 223
 	$encoded_data = 'cmd=_notify-validate';
@@ -226,40 +226,40 @@  discard block
 block discarded – undo
226 226
 	$arg_separator = give_get_php_arg_separator_output();
227 227
 
228 228
 	// Verify there is a post_data
229
-	if ( $post_data || strlen( $post_data ) > 0 ) {
229
+	if ($post_data || strlen($post_data) > 0) {
230 230
 		// Append the data
231
-		$encoded_data .= $arg_separator . $post_data;
231
+		$encoded_data .= $arg_separator.$post_data;
232 232
 	} else {
233 233
 		// Check if POST is empty
234
-		if ( empty( $_POST ) ) {
234
+		if (empty($_POST)) {
235 235
 			// Nothing to do
236 236
 			return;
237 237
 		} else {
238 238
 			// Loop through each POST
239
-			foreach ( $_POST as $key => $value ) {
239
+			foreach ($_POST as $key => $value) {
240 240
 				// Encode the value and append the data
241
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
241
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
242 242
 			}
243 243
 		}
244 244
 	}
245 245
 
246 246
 	// Convert collected post data to an array
247
-	parse_str( $encoded_data, $encoded_data_array );
247
+	parse_str($encoded_data, $encoded_data_array);
248 248
 
249
-	foreach ( $encoded_data_array as $key => $value ) {
249
+	foreach ($encoded_data_array as $key => $value) {
250 250
 
251
-		if ( false !== strpos( $key, 'amp;' ) ) {
252
-			$new_key = str_replace( '&', '&', $key );
253
-			$new_key = str_replace( 'amp;', '&', $new_key );
251
+		if (false !== strpos($key, 'amp;')) {
252
+			$new_key = str_replace('&', '&', $key);
253
+			$new_key = str_replace('amp;', '&', $new_key);
254 254
 
255
-			unset( $encoded_data_array[ $key ] );
256
-			$encoded_data_array[ $new_key ] = $value;
255
+			unset($encoded_data_array[$key]);
256
+			$encoded_data_array[$new_key] = $value;
257 257
 		}
258 258
 
259 259
 	}
260 260
 
261 261
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure
262
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
262
+	if ( ! give_get_option('disable_paypal_verification')) {
263 263
 
264 264
 		$remote_post_vars = array(
265 265
 			'method'      => 'POST',
@@ -279,28 +279,28 @@  discard block
 block discarded – undo
279 279
 		);
280 280
 
281 281
 		// Validate the IPN
282
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
282
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
283 283
 
284
-		if ( is_wp_error( $api_response ) ) {
284
+		if (is_wp_error($api_response)) {
285 285
 			give_record_gateway_error(
286
-				esc_html__( 'IPN Error', 'give' ),
286
+				esc_html__('IPN Error', 'give'),
287 287
 				sprintf(
288 288
 				/* translators: %s: Paypal IPN response */
289
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
290
-					json_encode( $api_response )
289
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
290
+					json_encode($api_response)
291 291
 				)
292 292
 			);
293 293
 
294 294
 			return; // Something went wrong
295 295
 		}
296 296
 
297
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
297
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
298 298
 			give_record_gateway_error(
299
-				esc_html__( 'IPN Error', 'give' ),
299
+				esc_html__('IPN Error', 'give'),
300 300
 				sprintf(
301 301
 				/* translators: %s: Paypal IPN response */
302
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
303
-					json_encode( $api_response )
302
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
303
+					json_encode($api_response)
304 304
 				)
305 305
 			);
306 306
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	}
311 311
 
312 312
 	// Check if $post_data_array has been populated
313
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
313
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
314 314
 		return;
315 315
 	}
316 316
 
@@ -319,21 +319,21 @@  discard block
 block discarded – undo
319 319
 		'payment_status' => ''
320 320
 	);
321 321
 
322
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
322
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
323 323
 
324
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
324
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
325 325
 
326
-	if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) {
326
+	if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) {
327 327
 		// Allow PayPal IPN types to be processed separately
328
-		do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id );
328
+		do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id);
329 329
 	} else {
330 330
 		// Fallback to web accept just in case the txn_type isn't present
331
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
331
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
332 332
 	}
333 333
 	exit;
334 334
 }
335 335
 
336
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
336
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
337 337
 
338 338
 /**
339 339
  * Process web accept (one time) payment IPNs.
@@ -344,224 +344,224 @@  discard block
 block discarded – undo
344 344
  *
345 345
  * @return void
346 346
  */
347
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
347
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
348 348
 
349
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) {
349
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
350 350
 		return;
351 351
 	}
352 352
 
353
-	if ( empty( $payment_id ) ) {
353
+	if (empty($payment_id)) {
354 354
 		return;
355 355
 	}
356 356
 
357 357
 	// Collect payment details
358
-	$purchase_key   = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number'];
358
+	$purchase_key   = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
359 359
 	$paypal_amount  = $data['mc_gross'];
360
-	$payment_status = strtolower( $data['payment_status'] );
361
-	$currency_code  = strtolower( $data['mc_currency'] );
362
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
363
-	$payment_meta   = give_get_payment_meta( $payment_id );
360
+	$payment_status = strtolower($data['payment_status']);
361
+	$currency_code  = strtolower($data['mc_currency']);
362
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
363
+	$payment_meta   = give_get_payment_meta($payment_id);
364 364
 
365 365
 
366
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
366
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
367 367
 		return; // this isn't a PayPal standard IPN
368 368
 	}
369 369
 
370 370
 	// Verify payment recipient
371
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
371
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
372 372
 
373 373
 		give_record_gateway_error(
374
-			esc_html__( 'IPN Error', 'give' ),
374
+			esc_html__('IPN Error', 'give'),
375 375
 			sprintf(
376 376
 			/* translators: %s: Paypal IPN response */
377
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
378
-				json_encode( $data )
377
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
378
+				json_encode($data)
379 379
 			),
380 380
 			$payment_id
381 381
 		);
382
-		give_update_payment_status( $payment_id, 'failed' );
383
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
382
+		give_update_payment_status($payment_id, 'failed');
383
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
384 384
 
385 385
 		return;
386 386
 	}
387 387
 
388 388
 	// Verify payment currency.
389
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
389
+	if ($currency_code != strtolower($payment_meta['currency'])) {
390 390
 
391 391
 		give_record_gateway_error(
392
-			esc_html__( 'IPN Error', 'give' ),
392
+			esc_html__('IPN Error', 'give'),
393 393
 			sprintf(
394 394
 			/* translators: %s: Paypal IPN response */
395
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
396
-				json_encode( $data )
395
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
396
+				json_encode($data)
397 397
 			),
398 398
 			$payment_id
399 399
 		);
400
-		give_update_payment_status( $payment_id, 'failed' );
401
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
400
+		give_update_payment_status($payment_id, 'failed');
401
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
402 402
 
403 403
 		return;
404 404
 	}
405 405
 
406
-	if ( ! give_get_payment_user_email( $payment_id ) ) {
406
+	if ( ! give_get_payment_user_email($payment_id)) {
407 407
 
408 408
 		// No email associated with donation, so store email from PayPal.
409
-		give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] );
409
+		give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
410 410
 
411 411
 		// Setup and store the donors's details.
412 412
 		$address            = array();
413
-		$address['line1']   = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false;
414
-		$address['city']    = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false;
415
-		$address['state']   = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false;
416
-		$address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false;
417
-		$address['zip']     = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false;
413
+		$address['line1']   = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
414
+		$address['city']    = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
415
+		$address['state']   = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
416
+		$address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
417
+		$address['zip']     = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
418 418
 
419 419
 		$user_info = array(
420 420
 			'id'         => '-1',
421
-			'email'      => sanitize_text_field( $data['payer_email'] ),
422
-			'first_name' => sanitize_text_field( $data['first_name'] ),
423
-			'last_name'  => sanitize_text_field( $data['last_name'] ),
421
+			'email'      => sanitize_text_field($data['payer_email']),
422
+			'first_name' => sanitize_text_field($data['first_name']),
423
+			'last_name'  => sanitize_text_field($data['last_name']),
424 424
 			'discount'   => '',
425 425
 			'address'    => $address
426 426
 		);
427 427
 
428 428
 		$payment_meta['user_info'] = $user_info;
429
-		give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta );
429
+		give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
430 430
 	}
431 431
 
432
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
432
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
433 433
 
434 434
 		// Process a refund
435
-		give_process_paypal_refund( $data, $payment_id );
435
+		give_process_paypal_refund($data, $payment_id);
436 436
 
437 437
 	} else {
438 438
 
439
-		if ( get_post_status( $payment_id ) == 'publish' ) {
439
+		if (get_post_status($payment_id) == 'publish') {
440 440
 			return; // Only complete payments once
441 441
 		}
442 442
 
443 443
 		// Retrieve the total purchase amount (before PayPal)
444
-		$payment_amount = give_get_payment_amount( $payment_id );
444
+		$payment_amount = give_get_payment_amount($payment_id);
445 445
 
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
-		if ( $purchase_key != give_get_payment_key( $payment_id ) ) {
462
+		if ($purchase_key != give_get_payment_key($payment_id)) {
463 463
 			// Purchase keys don't match
464 464
 			give_record_gateway_error(
465
-				esc_html__( 'IPN Error', 'give' ),
465
+				esc_html__('IPN Error', 'give'),
466 466
 				sprintf(
467 467
 				/* translators: %s: Paypal IPN response */
468
-					esc_html__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ),
469
-					json_encode( $data )
468
+					esc_html__('Invalid purchase key in IPN response. IPN data: %s', 'give'),
469
+					json_encode($data)
470 470
 				),
471 471
 				$payment_id
472 472
 			);
473
-			give_update_payment_status( $payment_id, 'failed' );
474
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) );
473
+			give_update_payment_status($payment_id, 'failed');
474
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
475 475
 
476 476
 			return;
477 477
 		}
478 478
 
479
-		if ( $payment_status == 'completed' || give_is_test_mode() ) {
479
+		if ($payment_status == 'completed' || give_is_test_mode()) {
480 480
 			give_insert_payment_note(
481 481
 				$payment_id,
482 482
 				sprintf(
483 483
 				/* translators: %s: Paypal transaction ID */
484
-					esc_html__( 'PayPal Transaction ID: %s', 'give' ),
484
+					esc_html__('PayPal Transaction ID: %s', 'give'),
485 485
 					$data['txn_id']
486 486
 				)
487 487
 			);
488
-			give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
489
-			give_update_payment_status( $payment_id, 'publish' );
490
-		} else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
488
+			give_set_payment_transaction_id($payment_id, $data['txn_id']);
489
+			give_update_payment_status($payment_id, 'publish');
490
+		} else if ('pending' == $payment_status && isset($data['pending_reason'])) {
491 491
 
492 492
 			// Look for possible pending reasons, such as an echeck
493 493
 
494 494
 			$note = '';
495 495
 
496
-			switch ( strtolower( $data['pending_reason'] ) ) {
496
+			switch (strtolower($data['pending_reason'])) {
497 497
 
498 498
 				case 'echeck' :
499 499
 
500
-					$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
500
+					$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
501 501
 
502 502
 					break;
503 503
 
504 504
 				case 'address' :
505 505
 
506
-					$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
506
+					$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
507 507
 
508 508
 					break;
509 509
 
510 510
 				case 'intl' :
511 511
 
512
-					$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
512
+					$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
513 513
 
514 514
 					break;
515 515
 
516 516
 				case 'multi-currency' :
517 517
 
518
-					$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
518
+					$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
519 519
 
520 520
 					break;
521 521
 
522 522
 				case 'paymentreview' :
523 523
 				case 'regulatory_review' :
524 524
 
525
-					$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
525
+					$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
526 526
 
527 527
 					break;
528 528
 
529 529
 				case 'unilateral' :
530 530
 
531
-					$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
531
+					$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
532 532
 
533 533
 					break;
534 534
 
535 535
 				case 'upgrade' :
536 536
 
537
-					$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
537
+					$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
538 538
 
539 539
 					break;
540 540
 
541 541
 				case 'verify' :
542 542
 
543
-					$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this payment.', 'give' );
543
+					$note = esc_html__('PayPal account is not verified. Verify account in order to accept this payment.', 'give');
544 544
 
545 545
 					break;
546 546
 
547 547
 				case 'other' :
548 548
 
549
-					$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
549
+					$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
550 550
 
551 551
 					break;
552 552
 
553 553
 			}
554 554
 
555
-			if ( ! empty( $note ) ) {
555
+			if ( ! empty($note)) {
556 556
 
557
-				give_insert_payment_note( $payment_id, $note );
557
+				give_insert_payment_note($payment_id, $note);
558 558
 
559 559
 			}
560 560
 		}
561 561
 	}
562 562
 }
563 563
 
564
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
564
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
565 565
 
566 566
 /**
567 567
  * Process PayPal IPN Refunds
@@ -572,28 +572,28 @@  discard block
 block discarded – undo
572 572
  *
573 573
  * @return void
574 574
  */
575
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
575
+function give_process_paypal_refund($data, $payment_id = 0) {
576 576
 
577 577
 	// Collect payment details
578 578
 
579
-	if ( empty( $payment_id ) ) {
579
+	if (empty($payment_id)) {
580 580
 		return;
581 581
 	}
582 582
 
583
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
583
+	if (get_post_status($payment_id) == 'refunded') {
584 584
 		return; // Only refund payments once
585 585
 	}
586 586
 
587
-	$payment_amount = give_get_payment_amount( $payment_id );
587
+	$payment_amount = give_get_payment_amount($payment_id);
588 588
 	$refund_amount  = $data['payment_gross'] * - 1;
589 589
 
590
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
590
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
591 591
 
592 592
 		give_insert_payment_note(
593 593
 			$payment_id,
594 594
 			sprintf(
595 595
 			/* translators: %s: Paypal parent transaction ID */
596
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
596
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
597 597
 				$data['parent_txn_id']
598 598
 			)
599 599
 		);
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		$payment_id,
607 607
 		sprintf(
608 608
 		/* translators: %s: Paypal parent transaction ID */
609
-			esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ),
609
+			esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'),
610 610
 			$data['parent_txn_id'], $data['reason_code']
611 611
 		)
612 612
 	);
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 		$payment_id,
615 615
 		sprintf(
616 616
 		/* translators: %s: Paypal transaction ID */
617
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
617
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
618 618
 			$data['txn_id']
619 619
 		)
620 620
 	);
621
-	give_update_payment_status( $payment_id, 'refunded' );
621
+	give_update_payment_status($payment_id, 'refunded');
622 622
 }
623 623
 
624 624
 /**
@@ -630,24 +630,24 @@  discard block
 block discarded – undo
630 630
  *
631 631
  * @return string
632 632
  */
633
-function give_get_paypal_redirect( $ssl_check = false ) {
633
+function give_get_paypal_redirect($ssl_check = false) {
634 634
 
635
-	if ( is_ssl() || ! $ssl_check ) {
635
+	if (is_ssl() || ! $ssl_check) {
636 636
 		$protocal = 'https://';
637 637
 	} else {
638 638
 		$protocal = 'http://';
639 639
 	}
640 640
 
641 641
 	// Check the current payment mode
642
-	if ( give_is_test_mode() ) {
642
+	if (give_is_test_mode()) {
643 643
 		// Test mode
644
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
644
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
645 645
 	} else {
646 646
 		// Live mode
647
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
647
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
648 648
 	}
649 649
 
650
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
650
+	return apply_filters('give_paypal_uri', $paypal_uri);
651 651
 }
652 652
 
653 653
 /**
@@ -657,9 +657,9 @@  discard block
 block discarded – undo
657 657
  * @return string
658 658
  */
659 659
 function give_get_paypal_page_style() {
660
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
660
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
661 661
 
662
-	return apply_filters( 'give_paypal_page_style', $page_style );
662
+	return apply_filters('give_paypal_page_style', $page_style);
663 663
 }
664 664
 
665 665
 /**
@@ -674,27 +674,27 @@  discard block
 block discarded – undo
674 674
  * @return string
675 675
  *
676 676
  */
677
-function give_paypal_success_page_content( $content ) {
677
+function give_paypal_success_page_content($content) {
678 678
 
679
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
679
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
680 680
 		return $content;
681 681
 	}
682 682
 
683
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
683
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
684 684
 
685
-	if ( ! $payment_id ) {
685
+	if ( ! $payment_id) {
686 686
 		$session    = give_get_purchase_session();
687
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
687
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
688 688
 	}
689 689
 
690
-	$payment = get_post( $payment_id );
690
+	$payment = get_post($payment_id);
691 691
 
692
-	if ( $payment && 'pending' == $payment->post_status ) {
692
+	if ($payment && 'pending' == $payment->post_status) {
693 693
 
694 694
 		// Payment is still pending so show processing indicator to fix the Race Condition
695 695
 		ob_start();
696 696
 
697
-		give_get_template_part( 'payment', 'processing' );
697
+		give_get_template_part('payment', 'processing');
698 698
 
699 699
 		$content = ob_get_clean();
700 700
 
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 
705 705
 }
706 706
 
707
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
707
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
708 708
 
709 709
 /**
710 710
  * Given a Payment ID, extract the transaction ID
@@ -715,22 +715,22 @@  discard block
 block discarded – undo
715 715
  *
716 716
  * @return string                   Transaction ID
717 717
  */
718
-function give_paypal_get_payment_transaction_id( $payment_id ) {
718
+function give_paypal_get_payment_transaction_id($payment_id) {
719 719
 
720 720
 	$transaction_id = '';
721
-	$notes          = give_get_payment_notes( $payment_id );
721
+	$notes          = give_get_payment_notes($payment_id);
722 722
 
723
-	foreach ( $notes as $note ) {
724
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
723
+	foreach ($notes as $note) {
724
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
725 725
 			$transaction_id = $match[1];
726 726
 			continue;
727 727
 		}
728 728
 	}
729 729
 
730
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
730
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
731 731
 }
732 732
 
733
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
733
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
734 734
 
735 735
 /**
736 736
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -742,13 +742,13 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @return string                 A link to the PayPal transaction details
744 744
  */
745
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
745
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
746 746
 
747 747
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
748
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
748
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
749 749
 
750
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
750
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
751 751
 
752 752
 }
753 753
 
754
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
754
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
Please login to merge, or discard this patch.
includes/admin/class-i18n-module.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	 * @param $args
67 67
 	 *
68 68
 	 */
69
-	public function __construct( $args ) {
70
-		if ( ! is_admin() ) {
69
+	public function __construct($args) {
70
+		if ( ! is_admin()) {
71 71
 			return;
72 72
 		}
73 73
 
74 74
 		//This plugin is en_US native.
75 75
 		$this->locale = get_locale();
76
-		if ( 'en_US' === $this->locale ) {
76
+		if ('en_US' === $this->locale) {
77 77
 			return;
78 78
 		}
79 79
 
80
-		$this->init( $args );
80
+		$this->init($args);
81 81
 
82
-		if ( ! $this->hide_promo() ) {
83
-			add_action( $this->hook, array( $this, 'promo' ) );
82
+		if ( ! $this->hide_promo()) {
83
+			add_action($this->hook, array($this, 'promo'));
84 84
 		}
85 85
 	}
86 86
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @param array $args
93 93
 	 */
94
-	private function init( $args ) {
95
-		foreach ( $args as $key => $arg ) {
94
+	private function init($args) {
95
+		foreach ($args as $key => $arg) {
96 96
 			$this->$key = $arg;
97 97
 		}
98 98
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 * @return bool
107 107
 	 */
108 108
 	private function hide_promo() {
109
-		$hide_promo = get_transient( 'give_i18n_give_promo_hide' );
110
-		if ( ! $hide_promo ) {
111
-			if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) {
109
+		$hide_promo = get_transient('give_i18n_give_promo_hide');
110
+		if ( ! $hide_promo) {
111
+			if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) {
112 112
 				// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
113
-				set_transient( 'give_i18n_give_promo_hide', true );
113
+				set_transient('give_i18n_give_promo_hide', true);
114 114
 				$hide_promo = true;
115 115
 			}
116 116
 		}
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	private function promo_message() {
129 129
 		$message = false;
130 130
 
131
-		if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) {
132
-			$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help complete the translation to %1$s!', 'give' );
133
-		} else if ( ! $this->translation_loaded && $this->translation_exists ) {
134
-			$message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' );
135
-		} else if ( ! $this->translation_exists ) {
136
-			$message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' );
131
+		if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) {
132
+			$message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help complete the translation to %1$s!', 'give');
133
+		} else if ( ! $this->translation_loaded && $this->translation_exists) {
134
+			$message = __('You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give');
135
+		} else if ( ! $this->translation_exists) {
136
+			$message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give');
137 137
 		}
138 138
 
139
-		$registration_link = sprintf( '<a href="%1$s">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) );
140
-		$message           = sprintf( $message, esc_html( $this->locale_name ), esc_html( 'Give' ), $this->percent_translated, $registration_link );
139
+		$registration_link = sprintf('<a href="%1$s">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give'));
140
+		$message           = sprintf($message, esc_html($this->locale_name), esc_html('Give'), $this->percent_translated, $registration_link);
141 141
 
142 142
 		return $message;
143 143
 	}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		$this->translation_details();
151 151
 		$message = $this->promo_message();
152 152
 
153
-		if ( $message ) { ?>
153
+		if ($message) { ?>
154 154
 
155 155
 			<style>
156 156
 				/* Banner specific styles */
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 				<a href="https://wordpress.org/support/register.php" class="alignleft give-i18n-icon" style="margin:0" target="_blank"><span class="dashicons dashicons-translation" style="font-size: 110px; text-decoration: none;"></span></a>
203 203
 
204 204
 				<div class="give-i18n-notice-content">
205
-					<a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
205
+					<a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
206 206
 
207
-					<h2 style="margin: 10px 0;"><?php printf( __( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2>
207
+					<h2 style="margin: 10px 0;"><?php printf(__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2>
208 208
 					<p><?php echo $message; ?></p>
209 209
 					<p>
210
-						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now &raquo;', 'give' ); ?></a>
210
+						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now &raquo;', 'give'); ?></a>
211 211
 					</p>
212 212
 				</div>
213 213
 			</div>
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	private function find_or_initialize_translation_details() {
226 226
 
227
-		$set = get_transient( 'give_i18n_give_' . $this->locale );
227
+		$set = get_transient('give_i18n_give_'.$this->locale);
228 228
 
229
-		if ( ! $set ) {
229
+		if ( ! $set) {
230 230
 			$set = $this->retrieve_translation_details();
231
-			set_transient( 'give_i18n_give_' . $this->locale, $set, DAY_IN_SECONDS );
231
+			set_transient('give_i18n_give_'.$this->locale, $set, DAY_IN_SECONDS);
232 232
 		}
233 233
 
234 234
 		return $set;
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	private function translation_details() {
243 243
 		$set = $this->find_or_initialize_translation_details();
244 244
 
245
-		$this->translation_exists = ! is_null( $set );
246
-		$this->translation_loaded = is_textdomain_loaded( 'give' );
245
+		$this->translation_exists = ! is_null($set);
246
+		$this->translation_loaded = is_textdomain_loaded('give');
247 247
 
248
-		$this->parse_translation_set( $set );
248
+		$this->parse_translation_set($set);
249 249
 	}
250 250
 
251 251
 	/**
@@ -257,26 +257,26 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	private function retrieve_translation_details() {
259 259
 
260
-		$api_url = trailingslashit( $this->glotpress_url );
260
+		$api_url = trailingslashit($this->glotpress_url);
261 261
 
262
-		$resp = wp_remote_get( $api_url );
262
+		$resp = wp_remote_get($api_url);
263 263
 
264
-		if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) {
264
+		if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') {
265 265
 			return null;
266 266
 		}
267 267
 
268
-		$body = wp_remote_retrieve_body( $resp );
269
-		unset( $resp );
268
+		$body = wp_remote_retrieve_body($resp);
269
+		unset($resp);
270 270
 
271
-		if ( $body ) {
272
-			$body = json_decode( $body );
271
+		if ($body) {
272
+			$body = json_decode($body);
273 273
 
274
-			foreach ( $body->translation_sets as $set ) {
275
-				if ( ! property_exists( $set, 'wp_locale' ) ) {
274
+			foreach ($body->translation_sets as $set) {
275
+				if ( ! property_exists($set, 'wp_locale')) {
276 276
 					continue;
277 277
 				}
278 278
 
279
-				if ( $this->locale == $set->wp_locale ) {
279
+				if ($this->locale == $set->wp_locale) {
280 280
 					return $set;
281 281
 				}
282 282
 			}
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @access private
294 294
 	 */
295
-	private function parse_translation_set( $set ) {
296
-		if ( $this->translation_exists && is_object( $set ) ) {
295
+	private function parse_translation_set($set) {
296
+		if ($this->translation_exists && is_object($set)) {
297 297
 			$this->locale_name        = $set->name;
298 298
 			$this->percent_translated = $set->percent_translated;
299 299
 		} else {
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
55
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
55
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
56 56
 			'ajax'     => false                       // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59 59
 		$this->query();
60 60
 	}
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return string Column Name
72 72
 	 */
73
-	public function column_default( $item, $column_name ) {
74
-		return $item[ $column_name ];
73
+	public function column_default($item, $column_name) {
74
+		return $item[$column_name];
75 75
 	}
76 76
 
77 77
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return string Column Name
87 87
 	 */
88
-	public function column_key( $item ) {
89
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
88
+	public function column_key($item) {
89
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string Column Name
102 102
 	 */
103
-	public function column_token( $item ) {
104
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
103
+	public function column_token($item) {
104
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
105 105
 	}
106 106
 
107 107
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return void
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'view'      => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-reports',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email']
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate'
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke'
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	public function get_columns() {
179 179
 		$columns = array(
180
-			'user'   => esc_html__( 'Username', 'give' ),
181
-			'key'    => esc_html__( 'Public Key', 'give' ),
182
-			'token'  => esc_html__( 'Token', 'give' ),
183
-			'secret' => esc_html__( 'Secret Key', 'give' )
180
+			'user'   => esc_html__('Username', 'give'),
181
+			'key'    => esc_html__('Public Key', 'give'),
182
+			'token'  => esc_html__('Token', 'give'),
183
+			'secret' => esc_html__('Secret Key', 'give')
184 184
 		);
185 185
 
186 186
 		return $columns;
@@ -193,20 +193,20 @@  discard block
 block discarded – undo
193 193
 	 * @access protected
194 194
 	 * @param string $which
195 195
 	 */
196
-	protected function display_tablenav( $which ) {
197
-		if ( 'top' === $which ) {
198
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
196
+	protected function display_tablenav($which) {
197
+		if ('top' === $which) {
198
+			wp_nonce_field('bulk-'.$this->_args['plural']);
199 199
 		}
200 200
 		?>
201
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
201
+		<div class="tablenav <?php echo esc_attr($which); ?>">
202 202
 
203 203
 			<div class="alignleft actions bulkactions">
204
-				<?php $this->bulk_actions( $which ); ?>
204
+				<?php $this->bulk_actions($which); ?>
205 205
 			</div>
206 206
 
207 207
 			<?php
208
-			$this->extra_tablenav( $which );
209
-			$this->pagination( $which );
208
+			$this->extra_tablenav($which);
209
+			$this->pagination($which);
210 210
 			?>
211 211
 
212 212
 			<br class="clear" />
@@ -222,19 +222,19 @@  discard block
 block discarded – undo
222 222
 	 * @param  string $which
223 223
 	 * @return void
224 224
 	 */
225
-	function bulk_actions( $which = '' ) {
225
+	function bulk_actions($which = '') {
226 226
 		// These aren't really bulk actions but this outputs the markup in the right place
227 227
 		static $give_api_is_bottom;
228 228
 
229
-		if ( $give_api_is_bottom ) {
229
+		if ($give_api_is_bottom) {
230 230
 			return;
231 231
 		}
232 232
 		?>
233 233
 		<input type="hidden" name="give_action" value="process_api_key"/>
234 234
 		<input type="hidden" name="give_api_process" value="generate"/>
235
-		<?php wp_nonce_field( 'give-api-nonce' ); ?>
235
+		<?php wp_nonce_field('give-api-nonce'); ?>
236 236
 		<?php echo Give()->html->ajax_user_search(); ?>
237
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
237
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
238 238
 		<?php
239 239
 		$give_api_is_bottom = true;
240 240
 	}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * @return int Current page number
248 248
 	 */
249 249
 	public function get_paged() {
250
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
250
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
251 251
 	}
252 252
 
253 253
 	/**
@@ -258,21 +258,21 @@  discard block
 block discarded – undo
258 258
 	 * @return array
259 259
 	 */
260 260
 	public function query() {
261
-		$users = get_users( array(
261
+		$users = get_users(array(
262 262
 			'meta_value' => 'give_user_secret_key',
263 263
 			'number'     => $this->per_page,
264
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 )
265
-		) );
266
-		$keys  = array();
267
-
268
-		foreach ( $users as $user ) {
269
-			$keys[ $user->ID ]['id']    = $user->ID;
270
-			$keys[ $user->ID ]['email'] = $user->user_email;
271
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
272
-
273
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
274
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
275
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
264
+			'offset'     => $this->per_page * ($this->get_paged() - 1)
265
+		));
266
+		$keys = array();
267
+
268
+		foreach ($users as $user) {
269
+			$keys[$user->ID]['id']    = $user->ID;
270
+			$keys[$user->ID]['email'] = $user->user_email;
271
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
272
+
273
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
274
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
275
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
276 276
 		}
277 277
 
278 278
 		return $keys;
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 	public function total_items() {
290 290
 		global $wpdb;
291 291
 
292
-		if ( ! get_transient( 'give_total_api_keys' ) ) {
293
-			$total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" );
292
+		if ( ! get_transient('give_total_api_keys')) {
293
+			$total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'");
294 294
 
295
-			set_transient( 'give_total_api_keys', $total_items, 60 * 60 );
295
+			set_transient('give_total_api_keys', $total_items, 60 * 60);
296 296
 		}
297 297
 
298
-		return get_transient( 'give_total_api_keys' );
298
+		return get_transient('give_total_api_keys');
299 299
 	}
300 300
 
301 301
 	/**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		$hidden   = array(); // No hidden columns
312 312
 		$sortable = array(); // Not sortable... for now
313 313
 
314
-		$this->_column_headers = array( $columns, $hidden, $sortable, 'id' );
314
+		$this->_column_headers = array($columns, $hidden, $sortable, 'id');
315 315
 
316 316
 		$data = $this->query();
317 317
 
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
 
320 320
 		$this->items = $data;
321 321
 
322
-		$this->set_pagination_args( array(
322
+		$this->set_pagination_args(array(
323 323
 				'total_items' => $total_items,
324 324
 				'per_page'    => $this->per_page,
325
-				'total_pages' => ceil( $total_items / $this->per_page )
325
+				'total_pages' => ceil($total_items / $this->per_page)
326 326
 			)
327 327
 		);
328 328
 	}
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Exit if accessed directly
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param $_banner_details
28 28
 	 */
29
-	function __construct( $_banner_details ) {
29
+	function __construct($_banner_details) {
30 30
 
31 31
 		global $current_user;
32 32
 		$this->banner_details = $_banner_details;
33
-		$this->test_mode      = ( $this->banner_details['testing'] == 'true' ) ? true : false;
34
-		$this->nag_meta_key   = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
33
+		$this->test_mode      = ($this->banner_details['testing'] == 'true') ? true : false;
34
+		$this->nag_meta_key   = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
35 35
 
36 36
 		//Get current user
37 37
 		$this->user_id = $current_user->ID;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	public function init() {
51 51
 
52 52
 		//Testing?
53
-		if ( $this->test_mode ) {
54
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
53
+		if ($this->test_mode) {
54
+			delete_user_meta($this->user_id, $this->nag_meta_key);
55 55
 		}
56 56
 
57 57
 		//Get the current page to add the notice to
58
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
59
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
58
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
59
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
60 60
 
61 61
 	}
62 62
 
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 		global $pagenow;
71 71
 
72 72
 		//Make sure we're on the plugins page.
73
-		if ( $pagenow !== 'plugins.php' ) {
73
+		if ($pagenow !== 'plugins.php') {
74 74
 			return false;
75 75
 		}
76 76
 
77 77
 		// If the user hasn't already dismissed our alert,
78 78
 		// Output the activation banner
79
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?>
79
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?>
80 80
 
81 81
 			<style>
82 82
 				div.give-addon-alert.updated {
@@ -155,43 +155,43 @@  discard block
 block discarded – undo
155 155
 					<h3><?php
156 156
 						printf(
157 157
 						/* translators: %s: Add-on name */
158
-							esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ),
159
-							'<span>' . $this->banner_details['name'] . '</span>'
158
+							esc_html__("Thank you for installing Give's %s Add-on!", 'give'),
159
+							'<span>'.$this->banner_details['name'].'</span>'
160 160
 						);
161 161
 						?></h3>
162 162
 
163 163
 					<a href="<?php
164 164
 					//The Dismiss Button.
165
-					$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
166
-					echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span
165
+					$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
166
+					echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span
167 167
 							class="dashicons dashicons-dismiss"></span></a>
168 168
 
169 169
 					<div class="alert-actions">
170 170
 
171 171
 						<?php //Point them to your settings page.
172
-						if ( isset( $this->banner_details['settings_url'] ) ) { ?>
172
+						if (isset($this->banner_details['settings_url'])) { ?>
173 173
 							<a href="<?php echo $this->banner_details['settings_url']; ?>">
174
-								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?></a>
174
+								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?></a>
175 175
 						<?php } ?>
176 176
 
177 177
 						<?php
178 178
 						// Show them how to configure the Addon.
179
-						if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
179
+						if (isset($this->banner_details['documentation_url'])) { ?>
180 180
 							<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
181 181
 								<span class="dashicons dashicons-media-text"></span><?php
182 182
 								printf(
183 183
 								/* translators: %s: Add-on name */
184
-									esc_html__( 'Documentation: %s Add-on', 'give' ),
184
+									esc_html__('Documentation: %s Add-on', 'give'),
185 185
 									$this->banner_details['name']
186 186
 								);
187 187
 								?></a>
188 188
 						<?php } ?>
189 189
 						<?php
190 190
 						//Let them signup for plugin updates
191
-						if ( isset( $this->banner_details['support_url'] ) ) { ?>
191
+						if (isset($this->banner_details['support_url'])) { ?>
192 192
 
193 193
 							<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
194
-								<span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?>
194
+								<span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?>
195 195
 							</a>
196 196
 
197 197
 						<?php } ?>
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 		 * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
216 216
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
217 217
 		 */
218
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
218
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
219 219
 
220 220
 			//Get the global user
221 221
 			global $current_user;
222 222
 			$user_id = $current_user->ID;
223 223
 
224
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
224
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
225 225
 		}
226 226
 	}
227 227
 
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
17 17
  *
18 18
  * @since 1.0
19 19
  */
20
-class Give_Forms_Widget extends WP_Widget{
20
+class Give_Forms_Widget extends WP_Widget {
21 21
 	/**
22 22
 	 * The widget class name
23 23
 	 *
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * Instantiate the class
30 30
 	 */
31
-	public function __construct(){
32
-		$this->self = get_class( $this );
31
+	public function __construct() {
32
+		$this->self = get_class($this);
33 33
 
34 34
 		parent::__construct(
35
-			strtolower( $this->self ),
36
-			esc_html__( 'Give - Donation Form', 'give' ),
35
+			strtolower($this->self),
36
+			esc_html__('Give - Donation Form', 'give'),
37 37
 			array(
38
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
38
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
39 39
 			)
40 40
 		);
41 41
 
42
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
43
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
42
+		add_action('widgets_init', array($this, 'widget_init'));
43
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
44 44
 	}
45 45
 
46 46
 	/**
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return void
52 52
 	 */
53
-	public function admin_widget_scripts( $hook ){
53
+	public function admin_widget_scripts($hook) {
54 54
 		// Directories of assets
55
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
56
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
57
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
55
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
56
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
57
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
58 58
 
59 59
 		// Use minified libraries if SCRIPT_DEBUG is turned off
60
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
60
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
61 61
 
62 62
 		// Widget Script
63
-		if ( $hook == 'widgets.php' ) {
63
+		if ($hook == 'widgets.php') {
64 64
 
65
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
65
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
66 66
 
67
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
67
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
68 68
 
69
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
69
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
70 70
 		}
71 71
 	}
72 72
 
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 	 *                        before_widget, and after_widget.
78 78
 	 * @param array $instance The settings for the particular instance of the widget.
79 79
 	 */
80
-	public function widget( $args, $instance ){
81
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
82
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
80
+	public function widget($args, $instance) {
81
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
82
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
83 83
 
84 84
 
85 85
 		// If user set float labels to global then check global float label setting and update donation form widget accordingly.
86
-		if( ( 'global' === $instance['float_labels'] ) ) {
87
-			$instance['float_labels'] = ( 'on' === give_get_option( 'enable_floatlabels', '' ) ) ? 'enabled' : 'disabled';
86
+		if (('global' === $instance['float_labels'])) {
87
+			$instance['float_labels'] = ('on' === give_get_option('enable_floatlabels', '')) ? 'enabled' : 'disabled';
88 88
 		}
89 89
 
90 90
 		echo $args['before_widget'];
91 91
 
92
-		do_action( 'give_before_forms_widget' );
92
+		do_action('give_before_forms_widget');
93 93
 
94
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
94
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
95 95
 
96
-		give_get_donation_form( $instance );
96
+		give_get_donation_form($instance);
97 97
 
98 98
 		echo $args['after_widget'];
99 99
 
100
-		do_action( 'give_after_forms_widget' );
100
+		do_action('give_after_forms_widget');
101 101
 	}
102 102
 
103 103
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public function form( $instance ){
110
+	public function form($instance) {
111 111
 		$defaults = array(
112 112
 			'title'         => '',
113 113
 			'id'            => '',
@@ -115,70 +115,70 @@  discard block
 block discarded – undo
115 115
 			'display_style' => 'modal',
116 116
 		);
117 117
 
118
-		$instance = wp_parse_args( (array) $instance, $defaults );
118
+		$instance = wp_parse_args((array) $instance, $defaults);
119 119
 
120 120
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
121
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
121
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
122 122
 
123 123
 		// Query Give Forms
124 124
 		$args = array(
125 125
 			'post_type'      => 'give_forms',
126
-			'posts_per_page' => - 1,
126
+			'posts_per_page' => -1,
127 127
 			'post_status'    => 'publish',
128 128
 		);
129 129
 
130
-		$give_forms = get_posts( $args );
130
+		$give_forms = get_posts($args);
131 131
 
132 132
 		// Widget: Title
133 133
 
134 134
 		?><p>
135
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
136
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br>
137
-			<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
135
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
136
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br>
137
+			<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
138 138
 		</p><?php
139 139
 
140 140
 		// Widget: Give Form
141 141
 
142 142
 		?><p>
143
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php
143
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php
144 144
 				printf(
145 145
 					/* translators: %s: form singular label */
146
-					esc_html__( 'Give %s:', 'give' ),
146
+					esc_html__('Give %s:', 'give'),
147 147
 					give_get_forms_label_singular()
148 148
 				);
149 149
 			?></label>
150
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
151
-				<option value="current"><?php esc_html_e( '— Select —', 'give' ); ?></option>
152
-				<?php foreach ( $give_forms as $give_form ) { ?>
153
-					<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
150
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
151
+				<option value="current"><?php esc_html_e('— Select —', 'give'); ?></option>
152
+				<?php foreach ($give_forms as $give_form) { ?>
153
+					<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
154 154
 				<?php } ?>
155 155
 			</select><br>
156
-			<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
156
+			<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
157 157
 		</p>
158 158
 
159 159
 		<?php // Widget: Display Style ?>
160 160
 		<p>
161
-			<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display style:', 'give' ); ?></label><br>
162
-			<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
163
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
164
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label><br>
161
+			<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display style:', 'give'); ?></label><br>
162
+			<label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
163
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
164
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label><br>
165 165
 			 <small class="give-field-description">
166
-				<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
166
+				<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
167 167
 			</small>
168 168
 		</p>
169 169
 
170 170
 		<?php // Widget: Floating Labels ?>
171 171
 		<p>
172
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
173
-			<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Options', 'give' ); ?></label>
174
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
175
-			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
172
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
173
+			<label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Options', 'give'); ?></label>
174
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
175
+			&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
176 176
 			<small class="give-field-description">
177 177
 				<?php
178 178
 				printf(
179 179
 					/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
180
-					__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
181
-					esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' )
180
+					__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
181
+					esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')
182 182
 				);
183 183
 			?></small>
184 184
 		</p><?php
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return void
191 191
 	 */
192
-	function widget_init(){
193
-		register_widget( $this->self );
192
+	function widget_init() {
193
+		register_widget($this->self);
194 194
 	}
195 195
 
196 196
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return array
203 203
 	 */
204
-	public function update( $new_instance, $old_instance ){
204
+	public function update($new_instance, $old_instance) {
205 205
 		$this->flush_widget_cache();
206 206
 
207 207
 		return $new_instance;
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return void
214 214
 	 */
215
-	public function flush_widget_cache(){
216
-		wp_cache_delete( $this->self, 'widget' );
215
+	public function flush_widget_cache() {
216
+		wp_cache_delete($this->self, 'widget');
217 217
 	}
218 218
 }
219 219
 
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +129 added lines, -129 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__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, esc_html__('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__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, esc_html__('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.6.1' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.6.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,111 +300,111 @@  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-purchase.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-functions.php';
342
-
343
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
344
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
345
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
347
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
348
-
349
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
350
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
351
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
353
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
354
-
355
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
356
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
357
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
359
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
360
-
361
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
362
-
363
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
364
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
365
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
366
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
367
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
368
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
371
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
373
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
374
-
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
376
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
377
-
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
379
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
380
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
382
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
383
-
384
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
387
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
388
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
389
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
390
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
391
-
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
394
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
396
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
397
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
400
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
401
-
402
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
403
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.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-purchase.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-functions.php';
342
+
343
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
344
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
345
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
347
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
348
+
349
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
350
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
351
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
353
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
354
+
355
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
356
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
357
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
359
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
360
+
361
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
362
+
363
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
364
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
365
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
366
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
367
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
368
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
371
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
373
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
374
+
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
376
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
377
+
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
379
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
380
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
382
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
383
+
384
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
387
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
388
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
389
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
390
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
391
+
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
394
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
396
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
397
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
400
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
401
+
402
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
403
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
404 404
 
405 405
 			}
406 406
 
407
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
407
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
408 408
 
409 409
 		}
410 410
 
@@ -418,26 +418,26 @@  discard block
 block discarded – undo
418 418
 		 */
419 419
 		public function load_textdomain() {
420 420
 			// Set filter for Give's languages directory
421
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
422
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
421
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
422
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
423 423
 
424 424
 			// Traditional WordPress plugin locale filter
425
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
426
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
425
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
426
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
427 427
 
428 428
 			// Setup paths to current locale file
429
-			$mofile_local  = $give_lang_dir . $mofile;
430
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
429
+			$mofile_local  = $give_lang_dir.$mofile;
430
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
431 431
 
432
-			if ( file_exists( $mofile_global ) ) {
432
+			if (file_exists($mofile_global)) {
433 433
 				// Look in global /wp-content/languages/give folder
434
-				load_textdomain( 'give', $mofile_global );
435
-			} elseif ( file_exists( $mofile_local ) ) {
434
+				load_textdomain('give', $mofile_global);
435
+			} elseif (file_exists($mofile_local)) {
436 436
 				// Look in local location from filter `give_languages_directory`
437
-				load_textdomain( 'give', $mofile_local );
437
+				load_textdomain('give', $mofile_local);
438 438
 			} else {
439 439
 				// Load the default language files packaged up w/ Give
440
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
440
+				load_plugin_textdomain('give', false, $give_lang_dir);
441 441
 			}
442 442
 		}
443 443
 
Please login to merge, or discard this patch.