Completed
Pull Request — master (#1856)
by Mehul
16:29
created
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the donation data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification 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 failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the donation page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
28 28
 
29
-		parent::__construct( 'give_goal' );
29
+		parent::__construct('give_goal');
30 30
 	}
31 31
 
32 32
 	/**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$create_form_link = sprintf(
40 40
 		/* translators: %s: create new form URL */
41
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42
-			admin_url( 'post-new.php?post_type=give_forms' )
41
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
42
+			admin_url('post-new.php?post_type=give_forms')
43 43
 		);
44 44
 
45 45
 		return array(
@@ -49,35 +49,35 @@  discard block
 block discarded – undo
49 49
 					'post_type' => 'give_forms',
50 50
 				),
51 51
 				'name'        => 'id',
52
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
53
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
52
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
53
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
54 54
 				'required'    => array(
55
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
56
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
55
+					'alert' => esc_html__('You must first select a Form!', 'give'),
56
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
57 57
 				),
58 58
 			),
59 59
 			array(
60 60
 				'type' => 'container',
61
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
61
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
62 62
 			),
63 63
 			array(
64 64
 				'type'    => 'listbox',
65 65
 				'name'    => 'show_text',
66
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
67
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
66
+				'label'   => esc_attr__('Show Text:', 'give'),
67
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
68 68
 				'options' => array(
69
-					'true'  => esc_html__( 'Show', 'give' ),
70
-					'false' => esc_html__( 'Hide', 'give' ),
69
+					'true'  => esc_html__('Show', 'give'),
70
+					'false' => esc_html__('Hide', 'give'),
71 71
 				),
72 72
 			),
73 73
 			array(
74 74
 				'type'    => 'listbox',
75 75
 				'name'    => 'show_bar',
76
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
77
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
76
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
77
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
78 78
 				'options' => array(
79
-					'true'  => esc_html__( 'Show', 'give' ),
80
-					'false' => esc_html__( 'Hide', 'give' ),
79
+					'true'  => esc_html__('Show', 'give'),
80
+					'false' => esc_html__('Hide', 'give'),
81 81
 				),
82 82
 			),
83 83
 		);
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.6.3
567 567
  *
568
- * @param $pending_reason
568
+ * @param string $pending_reason
569 569
  *
570 570
  * @return string
571 571
  */
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
  * @param int   $payment_id   Payment ID
643 643
  * @param array $payment_data Array of payment data.
644 644
  *
645
- * @return mixed|string
645
+ * @return string
646 646
  */
647 647
 function give_build_paypal_url( $payment_id, $payment_data ) {
648 648
 	// Only send to PayPal if the pending payment is created successfully.
Please login to merge, or discard this patch.
Spacing   +167 added lines, -167 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
 
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool
24 24
  */
25
-function give_paypal_standard_billing_fields( $form_id ) {
25
+function give_paypal_standard_billing_fields($form_id) {
26 26
 
27
-	if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) {
28
-		give_default_cc_address_fields( $form_id );
27
+	if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) {
28
+		give_default_cc_address_fields($form_id);
29 29
 
30 30
 		return true;
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 }
36 36
 
37
-add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields' );
37
+add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields');
38 38
 
39 39
 /**
40 40
  * Process PayPal Payment.
@@ -45,30 +45,30 @@  discard block
 block discarded – undo
45 45
  *
46 46
  * @return void
47 47
  */
48
-function give_process_paypal_payment( $payment_data ) {
48
+function give_process_paypal_payment($payment_data) {
49 49
 
50 50
 	// Validate nonce.
51
-	give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' );
52
-	$payment_id = give_create_payment( $payment_data );
51
+	give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway');
52
+	$payment_id = give_create_payment($payment_data);
53 53
 
54 54
 	// Register message in donation note that PayPal IPN is not received yet.
55
-	give_insert_payment_note( $payment_id, __( 'N/A', 'give' ) );
55
+	give_insert_payment_note($payment_id, __('N/A', 'give'));
56 56
 
57 57
 	// Check payment.
58
-	if ( empty( $payment_id ) ) {
58
+	if (empty($payment_id)) {
59 59
 		// Record the error.
60
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */
61
-		__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id );
60
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */
61
+		__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id);
62 62
 		// Problems? Send back.
63
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
63
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
64 64
 	}
65 65
 
66 66
 	// Redirect to PayPal.
67
-	wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) );
67
+	wp_redirect(give_build_paypal_url($payment_id, $payment_data));
68 68
 	exit;
69 69
 }
70 70
 
71
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
71
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
72 72
 
73 73
 /**
74 74
  * Listens for a PayPal IPN requests and then sends to the processing function.
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function give_listen_for_paypal_ipn() {
80 80
 	// Regular PayPal IPN
81
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
81
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
82 82
 		/**
83 83
 		 * Fires while verifying PayPal IPN
84 84
 		 *
85 85
 		 * @since 1.0
86 86
 		 */
87
-		do_action( 'give_verify_paypal_ipn' );
87
+		do_action('give_verify_paypal_ipn');
88 88
 	}
89 89
 }
90 90
 
91
-add_action( 'init', 'give_listen_for_paypal_ipn' );
91
+add_action('init', 'give_listen_for_paypal_ipn');
92 92
 
93 93
 /**
94 94
  * Process PayPal IPN
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 function give_process_paypal_ipn() {
100 100
 
101 101
 	// Check the request method is POST.
102
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
102
+	if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) {
103 103
 		return;
104 104
 	}
105 105
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	$post_data = '';
108 108
 
109 109
 	// Fallback just in case post_max_size is lower than needed.
110
-	if ( ini_get( 'allow_url_fopen' ) ) {
111
-		$post_data = file_get_contents( 'php://input' );
110
+	if (ini_get('allow_url_fopen')) {
111
+		$post_data = file_get_contents('php://input');
112 112
 	} else {
113 113
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough.
114
-		ini_set( 'post_max_size', '12M' );
114
+		ini_set('post_max_size', '12M');
115 115
 	}
116 116
 	// Start the encoded data collection with notification command.
117 117
 	$encoded_data = 'cmd=_notify-validate';
@@ -120,39 +120,39 @@  discard block
 block discarded – undo
120 120
 	$arg_separator = give_get_php_arg_separator_output();
121 121
 
122 122
 	// Verify there is a post_data.
123
-	if ( $post_data || strlen( $post_data ) > 0 ) {
123
+	if ($post_data || strlen($post_data) > 0) {
124 124
 		// Append the data.
125
-		$encoded_data .= $arg_separator . $post_data;
125
+		$encoded_data .= $arg_separator.$post_data;
126 126
 	} else {
127 127
 		// Check if POST is empty.
128
-		if ( empty( $_POST ) ) {
128
+		if (empty($_POST)) {
129 129
 			// Nothing to do.
130 130
 			return;
131 131
 		} else {
132 132
 			// Loop through each POST.
133
-			foreach ( $_POST as $key => $value ) {
133
+			foreach ($_POST as $key => $value) {
134 134
 				// Encode the value and append the data.
135
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
135
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
136 136
 			}
137 137
 		}
138 138
 	}
139 139
 
140 140
 	// Convert collected post data to an array.
141
-	parse_str( $encoded_data, $encoded_data_array );
141
+	parse_str($encoded_data, $encoded_data_array);
142 142
 
143
-	foreach ( $encoded_data_array as $key => $value ) {
143
+	foreach ($encoded_data_array as $key => $value) {
144 144
 
145
-		if ( false !== strpos( $key, 'amp;' ) ) {
146
-			$new_key = str_replace( '&amp;', '&', $key );
147
-			$new_key = str_replace( 'amp;', '&', $new_key );
145
+		if (false !== strpos($key, 'amp;')) {
146
+			$new_key = str_replace('&amp;', '&', $key);
147
+			$new_key = str_replace('amp;', '&', $new_key);
148 148
 
149
-			unset( $encoded_data_array[ $key ] );
150
-			$encoded_data_array[ $new_key ] = $value;
149
+			unset($encoded_data_array[$key]);
150
+			$encoded_data_array[$new_key] = $value;
151 151
 		}
152 152
 	}
153 153
 
154 154
 	// Validate IPN request w/ PayPal if user hasn't disabled this security measure.
155
-	if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) {
155
+	if (give_is_setting_enabled(give_get_option('paypal_verification'))) {
156 156
 
157 157
 		$remote_post_vars = array(
158 158
 			'method'      => 'POST',
@@ -172,25 +172,25 @@  discard block
 block discarded – undo
172 172
 		);
173 173
 
174 174
 		// Validate the IPN.
175
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
175
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
176 176
 
177
-		if ( is_wp_error( $api_response ) ) {
178
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
179
-			__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
177
+		if (is_wp_error($api_response)) {
178
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
179
+			__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
180 180
 
181 181
 			return; // Something went wrong
182 182
 		}
183 183
 
184
-		if ( 'VERIFIED' !== $api_response['body'] ) {
185
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
186
-			__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
184
+		if ('VERIFIED' !== $api_response['body']) {
185
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
186
+			__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
187 187
 
188 188
 			return; // Response not okay.
189 189
 		}
190 190
 	}// End if().
191 191
 
192 192
 	// Check if $post_data_array has been populated.
193
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
193
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
194 194
 		return;
195 195
 	}
196 196
 
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 		'payment_status' => '',
200 200
 	);
201 201
 
202
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
202
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
203 203
 
204
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
204
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
205 205
 	$txn_type   = $encoded_data_array['txn_type'];
206 206
 
207
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
207
+	if (has_action('give_paypal_'.$txn_type)) {
208 208
 		/**
209 209
 		 * Fires while processing PayPal IPN $txn_type.
210 210
 		 *
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 * @param array $encoded_data_array Encoded data.
216 216
 		 * @param int   $payment_id         Payment id.
217 217
 		 */
218
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
218
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
219 219
 	} else {
220 220
 		/**
221 221
 		 * Fires while process PayPal IPN.
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 		 * @param array $encoded_data_array Encoded data.
228 228
 		 * @param int   $payment_id         Payment id.
229 229
 		 */
230
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
230
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
231 231
 	}
232 232
 	exit;
233 233
 }
234 234
 
235
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
235
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
236 236
 
237 237
 /**
238 238
  * Process web accept (one time) payment IPNs.
@@ -244,102 +244,102 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return void
246 246
  */
247
-function give_process_paypal_web_accept( $data, $payment_id ) {
247
+function give_process_paypal_web_accept($data, $payment_id) {
248 248
 
249 249
 	// Only allow through these transaction types.
250
-	if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) {
250
+	if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) {
251 251
 		return;
252 252
 	}
253 253
 
254 254
 	// Need $payment_id to continue.
255
-	if ( empty( $payment_id ) ) {
255
+	if (empty($payment_id)) {
256 256
 		return;
257 257
 	}
258 258
 
259 259
 	// Register message in donation note that IPN received successfully.
260
-	give_insert_payment_note( $payment_id, __( 'Last IPN Received', 'give' ) );
260
+	give_insert_payment_note($payment_id, __('Last IPN Received', 'give'));
261 261
 
262 262
 	// Collect donation payment details.
263 263
 	$paypal_amount  = $data['mc_gross'];
264
-	$payment_status = strtolower( $data['payment_status'] );
265
-	$currency_code  = strtolower( $data['mc_currency'] );
266
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
267
-	$payment_meta   = give_get_payment_meta( $payment_id );
264
+	$payment_status = strtolower($data['payment_status']);
265
+	$currency_code  = strtolower($data['mc_currency']);
266
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
267
+	$payment_meta   = give_get_payment_meta($payment_id);
268 268
 
269 269
 	// Must be a PayPal standard IPN.
270
-	if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) {
270
+	if ('paypal' !== give_get_payment_gateway($payment_id)) {
271 271
 		return;
272 272
 	}
273 273
 
274 274
 	// Verify payment recipient
275
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) {
275
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) {
276 276
 
277
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
278
-		__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
279
-		give_update_payment_status( $payment_id, 'failed' );
280
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) );
277
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
278
+		__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
279
+		give_update_payment_status($payment_id, 'failed');
280
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
281 281
 
282 282
 		return;
283 283
 	}
284 284
 
285 285
 	// Verify payment currency.
286
-	if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) {
286
+	if ($currency_code !== strtolower($payment_meta['currency'])) {
287 287
 
288
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
289
-		__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
290
-		give_update_payment_status( $payment_id, 'failed' );
291
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
288
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
289
+		__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
290
+		give_update_payment_status($payment_id, 'failed');
291
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
292 292
 
293 293
 		return;
294 294
 	}
295 295
 
296 296
 	// Process refunds & reversed.
297
-	if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
298
-		give_process_paypal_refund( $data, $payment_id );
297
+	if ('refunded' === $payment_status || 'reversed' === $payment_status) {
298
+		give_process_paypal_refund($data, $payment_id);
299 299
 
300 300
 		return;
301 301
 	}
302 302
 
303 303
 	// Only complete payments once.
304
-	if ( 'publish' === get_post_status( $payment_id ) ) {
304
+	if ('publish' === get_post_status($payment_id)) {
305 305
 		return;
306 306
 	}
307 307
 
308 308
 	// Retrieve the total donation amount (before PayPal).
309
-	$payment_amount = give_get_payment_amount( $payment_id );
309
+	$payment_amount = give_get_payment_amount($payment_id);
310 310
 
311 311
 	// Check that the donation PP and local db amounts match.
312
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
312
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
313 313
 		// The prices don't match
314
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
315
-		__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
316
-		give_update_payment_status( $payment_id, 'failed' );
317
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
314
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
315
+		__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
316
+		give_update_payment_status($payment_id, 'failed');
317
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
318 318
 
319 319
 		return;
320 320
 	}
321 321
 
322 322
 	// Process completed donations.
323
-	if ( 'completed' === $payment_status || give_is_test_mode() ) {
323
+	if ('completed' === $payment_status || give_is_test_mode()) {
324 324
 
325
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
326
-		__( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) );
327
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
328
-		give_update_payment_status( $payment_id, 'publish' );
325
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
326
+		__('PayPal Transaction ID: %s', 'give'), $data['txn_id'] ));
327
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
328
+		give_update_payment_status($payment_id, 'publish');
329 329
 
330
-	} elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) {
330
+	} elseif ('pending' === $payment_status && isset($data['pending_reason'])) {
331 331
 
332 332
 		// Look for possible pending reasons, such as an echeck.
333
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
333
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
334 334
 
335
-		if ( ! empty( $note ) ) {
336
-			give_insert_payment_note( $payment_id, $note );
335
+		if ( ! empty($note)) {
336
+			give_insert_payment_note($payment_id, $note);
337 337
 		}
338 338
 	}
339 339
 
340 340
 }
341 341
 
342
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 );
342
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2);
343 343
 
344 344
 /**
345 345
  * Process PayPal IPN Refunds
@@ -351,35 +351,35 @@  discard block
 block discarded – undo
351 351
  *
352 352
  * @return void
353 353
  */
354
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
354
+function give_process_paypal_refund($data, $payment_id = 0) {
355 355
 
356 356
 	// Collect payment details.
357
-	if ( empty( $payment_id ) ) {
357
+	if (empty($payment_id)) {
358 358
 		return;
359 359
 	}
360 360
 
361 361
 	// Only refund payments once.
362
-	if ( 'refunded' === get_post_status( $payment_id ) ) {
362
+	if ('refunded' === get_post_status($payment_id)) {
363 363
 		return;
364 364
 	}
365 365
 
366
-	$payment_amount = give_get_payment_amount( $payment_id );
366
+	$payment_amount = give_get_payment_amount($payment_id);
367 367
 	$refund_amount  = $data['payment_gross'] * - 1;
368 368
 
369
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
369
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
370 370
 
371
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
372
-		__( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) );
371
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
372
+		__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] ));
373 373
 
374 374
 		return; // This is a partial refund
375 375
 
376 376
 	}
377 377
 
378
-	give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
379
-	__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) );
380
-	give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
381
-	__( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) );
382
-	give_update_payment_status( $payment_id, 'refunded' );
378
+	give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
379
+	__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] ));
380
+	give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
381
+	__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] ));
382
+	give_update_payment_status($payment_id, 'refunded');
383 383
 }
384 384
 
385 385
 /**
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
  *
392 392
  * @return string
393 393
  */
394
-function give_get_paypal_redirect( $ssl_check = false ) {
394
+function give_get_paypal_redirect($ssl_check = false) {
395 395
 
396
-	if ( is_ssl() || ! $ssl_check ) {
396
+	if (is_ssl() || ! $ssl_check) {
397 397
 		$protocol = 'https://';
398 398
 	} else {
399 399
 		$protocol = 'http://';
400 400
 	}
401 401
 
402 402
 	// Check the current payment mode
403
-	if ( give_is_test_mode() ) {
403
+	if (give_is_test_mode()) {
404 404
 		// Test mode
405
-		$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
405
+		$paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr';
406 406
 	} else {
407 407
 		// Live mode
408
-		$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
408
+		$paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr';
409 409
 	}
410 410
 
411
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
411
+	return apply_filters('give_paypal_uri', $paypal_uri);
412 412
 }
413 413
 
414 414
 /**
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
  * @return string
419 419
  */
420 420
 function give_get_paypal_page_style() {
421
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
421
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
422 422
 
423
-	return apply_filters( 'give_paypal_page_style', $page_style );
423
+	return apply_filters('give_paypal_page_style', $page_style);
424 424
 }
425 425
 
426 426
 /**
@@ -434,26 +434,26 @@  discard block
 block discarded – undo
434 434
  *
435 435
  * @return string
436 436
  */
437
-function give_paypal_success_page_content( $content ) {
437
+function give_paypal_success_page_content($content) {
438 438
 
439
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
439
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
440 440
 		return $content;
441 441
 	}
442 442
 
443
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
443
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
444 444
 
445
-	if ( ! $payment_id ) {
445
+	if ( ! $payment_id) {
446 446
 		$session    = give_get_purchase_session();
447
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
447
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
448 448
 	}
449 449
 
450
-	$payment = get_post( $payment_id );
451
-	if ( $payment && 'pending' === $payment->post_status ) {
450
+	$payment = get_post($payment_id);
451
+	if ($payment && 'pending' === $payment->post_status) {
452 452
 
453 453
 		// Payment is still pending so show processing indicator to fix the race condition.
454 454
 		ob_start();
455 455
 
456
-		give_get_template_part( 'payment', 'processing' );
456
+		give_get_template_part('payment', 'processing');
457 457
 
458 458
 		$content = ob_get_clean();
459 459
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
 }
465 465
 
466
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
466
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
467 467
 
468 468
 /**
469 469
  * Given a Payment ID, extract the transaction ID
@@ -474,22 +474,22 @@  discard block
 block discarded – undo
474 474
  *
475 475
  * @return string                   Transaction ID
476 476
  */
477
-function give_paypal_get_payment_transaction_id( $payment_id ) {
477
+function give_paypal_get_payment_transaction_id($payment_id) {
478 478
 
479 479
 	$transaction_id = '';
480
-	$notes          = give_get_payment_notes( $payment_id );
480
+	$notes          = give_get_payment_notes($payment_id);
481 481
 
482
-	foreach ( $notes as $note ) {
483
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
482
+	foreach ($notes as $note) {
483
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
484 484
 			$transaction_id = $match[1];
485 485
 			continue;
486 486
 		}
487 487
 	}
488 488
 
489
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
489
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
490 490
 }
491 491
 
492
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
492
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
493 493
 
494 494
 /**
495 495
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -501,16 +501,16 @@  discard block
 block discarded – undo
501 501
  *
502 502
  * @return string                 A link to the PayPal transaction details
503 503
  */
504
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
504
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
505 505
 
506 506
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
507
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
507
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
508 508
 
509
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
509
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
510 510
 
511 511
 }
512 512
 
513
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
513
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
514 514
 
515 515
 
516 516
 /**
@@ -522,64 +522,64 @@  discard block
 block discarded – undo
522 522
  *
523 523
  * @return string
524 524
  */
525
-function give_paypal_get_pending_donation_note( $pending_reason ) {
525
+function give_paypal_get_pending_donation_note($pending_reason) {
526 526
 
527 527
 	$note = '';
528 528
 
529
-	switch ( $pending_reason ) {
529
+	switch ($pending_reason) {
530 530
 
531 531
 		case 'echeck' :
532 532
 
533
-			$note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
533
+			$note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
534 534
 
535 535
 			break;
536 536
 
537 537
 		case 'address' :
538 538
 
539
-			$note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
539
+			$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
540 540
 
541 541
 			break;
542 542
 
543 543
 		case 'intl' :
544 544
 
545
-			$note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
545
+			$note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
546 546
 
547 547
 			break;
548 548
 
549 549
 		case 'multi-currency' :
550 550
 
551
-			$note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
551
+			$note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
552 552
 
553 553
 			break;
554 554
 
555 555
 		case 'paymentreview' :
556 556
 		case 'regulatory_review' :
557 557
 
558
-			$note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
558
+			$note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
559 559
 
560 560
 			break;
561 561
 
562 562
 		case 'unilateral' :
563 563
 
564
-			$note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
564
+			$note = __('Payment was sent to non-confirmed or non-registered email address.', 'give');
565 565
 
566 566
 			break;
567 567
 
568 568
 		case 'upgrade' :
569 569
 
570
-			$note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
570
+			$note = __('PayPal account must be upgraded before this payment can be accepted.', 'give');
571 571
 
572 572
 			break;
573 573
 
574 574
 		case 'verify' :
575 575
 
576
-			$note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
576
+			$note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
577 577
 
578 578
 			break;
579 579
 
580 580
 		case 'other' :
581 581
 
582
-			$note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
582
+			$note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
583 583
 
584 584
 			break;
585 585
 
@@ -597,49 +597,49 @@  discard block
 block discarded – undo
597 597
  *
598 598
  * @return mixed|string
599 599
  */
600
-function give_build_paypal_url( $payment_id, $payment_data ) {
600
+function give_build_paypal_url($payment_id, $payment_data) {
601 601
 	// Only send to PayPal if the pending payment is created successfully.
602
-	$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
602
+	$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
603 603
 
604 604
 	// Get the success url.
605
-	$return_url = add_query_arg( array(
605
+	$return_url = add_query_arg(array(
606 606
 		'payment-confirmation' => 'paypal',
607 607
 		'payment-id'           => $payment_id,
608 608
 
609
-	), get_permalink( give_get_option( 'success_page' ) ) );
609
+	), get_permalink(give_get_option('success_page')));
610 610
 
611 611
 	// Get the PayPal redirect uri.
612
-	$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
612
+	$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
613 613
 
614 614
 	// Item name.
615
-	$item_name = give_build_paypal_item_title( $payment_data );
615
+	$item_name = give_build_paypal_item_title($payment_data);
616 616
 
617 617
 	// Setup PayPal API params.
618 618
 	$paypal_args = array(
619
-		'business'      => give_get_option( 'paypal_email', false ),
619
+		'business'      => give_get_option('paypal_email', false),
620 620
 		'first_name'    => $payment_data['user_info']['first_name'],
621 621
 		'last_name'     => $payment_data['user_info']['last_name'],
622 622
 		'email'         => $payment_data['user_email'],
623 623
 		'invoice'       => $payment_data['purchase_key'],
624 624
 		'amount'        => $payment_data['price'],
625
-		'item_name'     => stripslashes( $item_name ),
625
+		'item_name'     => stripslashes($item_name),
626 626
 		'no_shipping'   => '1',
627 627
 		'shipping'      => '0',
628 628
 		'no_note'       => '1',
629 629
 		'currency_code' => give_get_currency(),
630
-		'charset'       => get_bloginfo( 'charset' ),
630
+		'charset'       => get_bloginfo('charset'),
631 631
 		'custom'        => $payment_id,
632 632
 		'rm'            => '2',
633 633
 		'return'        => $return_url,
634
-		'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
634
+		'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
635 635
 		'notify_url'    => $listener_url,
636 636
 		'page_style'    => give_get_paypal_page_style(),
637
-		'cbt'           => get_bloginfo( 'name' ),
637
+		'cbt'           => get_bloginfo('name'),
638 638
 		'bn'            => 'givewp_SP',
639 639
 	);
640 640
 
641 641
 	// Add user address if present.
642
-	if ( ! empty( $payment_data['user_info']['address'] ) ) {
642
+	if ( ! empty($payment_data['user_info']['address'])) {
643 643
 		$default_address = array(
644 644
 			'line1'   => '',
645 645
 			'line2'   => '',
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 			'country' => '',
650 650
 		);
651 651
 
652
-		$address = wp_parse_args( $payment_data['user_info']['address'], $default_address );
652
+		$address = wp_parse_args($payment_data['user_info']['address'], $default_address);
653 653
 
654 654
 		$paypal_args['address1'] = $address['line1'];
655 655
 		$paypal_args['address2'] = $address['line2'];
@@ -670,13 +670,13 @@  discard block
 block discarded – undo
670 670
 	 * @param array $paypal_args
671 671
 	 * @param array $payment_data
672 672
 	 */
673
-	$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
673
+	$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
674 674
 
675 675
 	// Build query.
676
-	$paypal_redirect .= http_build_query( $paypal_args );
676
+	$paypal_redirect .= http_build_query($paypal_args);
677 677
 
678 678
 	// Fix for some sites that encode the entities.
679
-	$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
679
+	$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
680 680
 
681 681
 	return $paypal_redirect;
682 682
 }
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 function give_get_paypal_button_type() {
692 692
 	// paypal_button_type can be donation or standard.
693 693
 	$paypal_button_type = '_donations';
694
-	if ( 'standard' === give_get_option( 'paypal_button_type' ) ) {
694
+	if ('standard' === give_get_option('paypal_button_type')) {
695 695
 		$paypal_button_type = '_xclick';
696 696
 	}
697 697
 
@@ -708,30 +708,30 @@  discard block
 block discarded – undo
708 708
  *
709 709
  * @return string
710 710
  */
711
-function give_build_paypal_item_title( $payment_data ) {
712
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
711
+function give_build_paypal_item_title($payment_data) {
712
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
713 713
 	$item_name = $payment_data['post_data']['give-form-title'];
714 714
 
715 715
 	// Verify has variable prices.
716
-	if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
716
+	if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
717 717
 
718
-		$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
719
-		$price_level_amount    = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
718
+		$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
719
+		$price_level_amount    = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
720 720
 
721 721
 		// Donation given doesn't match selected level (must be a custom amount).
722
-		if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) {
723
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
722
+		if ($price_level_amount != give_sanitize_amount($payment_data['price'])) {
723
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
724 724
 			// user custom amount text if any, fallback to default if not.
725
-			$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
725
+			$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
726 726
 
727
-		} elseif ( ! empty( $item_price_level_text ) ) {
728
-			$item_name .= ' - ' . $item_price_level_text;
727
+		} elseif ( ! empty($item_price_level_text)) {
728
+			$item_name .= ' - '.$item_price_level_text;
729 729
 		}
730 730
 	} // End if().
731
-	elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) {
732
-		$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
731
+	elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) {
732
+		$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
733 733
 		// user custom amount text if any, fallback to default if not.
734
-		$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
734
+		$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
735 735
 	}
736 736
 
737 737
 	return $item_name;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-license.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_License' ) ) :
16
+if ( ! class_exists('Give_Settings_License')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_License.
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'licenses';
46
-			$this->label = esc_html__( 'Licenses', 'give' );
46
+			$this->label = esc_html__('Licenses', 'give');
47 47
 
48
-			add_filter( 'give-settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-settings_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-settings_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-settings_settings_{$this->id}_page", array($this, 'output'));
50 50
 		}
51 51
 
52 52
 		/**
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 		 * @param  array $pages Lst of pages.
57 57
 		 * @return array
58 58
 		 */
59
-		public function add_settings_page( $pages ) {
59
+		public function add_settings_page($pages) {
60 60
 			$setting = $this->get_settings();
61 61
 			// Bailout: Do not add licenses setting tab if it does not contain any setting fields.
62
-			if( ! empty( $setting ) ) {
63
-				$pages[ $this->id ] = $this->label;
62
+			if ( ! empty($setting)) {
63
+				$pages[$this->id] = $this->label;
64 64
 			}
65 65
 
66 66
 			return $pages;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			 * Filter the licenses settings.
80 80
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
81 81
 			 */
82
-			$settings = apply_filters( 'give_settings_licenses', $settings );
82
+			$settings = apply_filters('give_settings_licenses', $settings);
83 83
 
84 84
 			/**
85 85
 			 * Filter the settings.
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			 * @since  1.8
88 88
 			 * @param  array $settings
89 89
 			 */
90
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
90
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
91 91
 
92 92
 			// Output.
93 93
 			return $settings;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		public function output() {
103 103
 			$settings = $this->get_settings();
104 104
 
105
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
105
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
106 106
 		}
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-addon.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Addon' ) ) :
16
+if ( ! class_exists('Give_Settings_Addon')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Addon.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		 */
27 27
 		public function __construct() {
28 28
 			$this->id    = 'addons';
29
-			$this->label = esc_html__( 'Add-ons', 'give' );
29
+			$this->label = esc_html__('Add-ons', 'give');
30 30
 
31 31
 			parent::__construct();
32 32
 		}
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 		 * @param  $setting_tab
39 39
 		 * @return string
40 40
 		 */
41
-		function set_default_setting_tab( $setting_tab ) {
41
+		function set_default_setting_tab($setting_tab) {
42 42
 			$default_tab = '';
43 43
 
44 44
 			// Set default tab to first setting tab.
45
-			if( $sections = array_keys( $this->get_sections() ) ) {
46
-				$default_tab = current( $sections );
45
+			if ($sections = array_keys($this->get_sections())) {
46
+				$default_tab = current($sections);
47 47
 			}
48 48
 			return $default_tab;
49 49
 		}
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 		 * @param  array $pages Lst of pages.
56 56
 		 * @return array
57 57
 		 */
58
-		public function add_settings_page( $pages ) {
58
+		public function add_settings_page($pages) {
59 59
 			$setting = $this->get_settings();
60 60
 			// Bailout: Do not add addons setting tab if it does not contain any setting fields.
61
-			if( ! empty( $setting ) ) {
62
-				$pages[ $this->id ] = $this->label;
61
+			if ( ! empty($setting)) {
62
+				$pages[$this->id] = $this->label;
63 63
 			}
64 64
 
65 65
 			return $pages;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			 * Filter the addons settings.
79 79
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
80 80
 			 */
81
-			$settings = apply_filters( 'give_settings_addons', $settings );
81
+			$settings = apply_filters('give_settings_addons', $settings);
82 82
 
83 83
 			/**
84 84
 			 * Filter the settings.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @since  1.8
87 87
 			 * @param  array $settings
88 88
 			 */
89
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
89
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
90 90
 
91 91
 			// Output.
92 92
 			return $settings;
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return  mixed
28 28
  */
29
-function _give_sanitize_number_decimals_setting_field( $value ) {
30
-	return absint( $value );
29
+function _give_sanitize_number_decimals_setting_field($value) {
30
+	return absint($value);
31 31
 }
32
-add_filter( 'give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10 );
33 32
\ No newline at end of file
33
+add_filter('give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10);
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_add_shortcode_to_publish_metabox() {
24 24
 
25
-	if ( 'give_forms' !== get_post_type() ) {
25
+	if ('give_forms' !== get_post_type()) {
26 26
 		return false;
27 27
 	}
28 28
 	global $post;
29 29
 
30 30
 	//Only enqueue scripts for CPT on post type screen
31
-	if ( 'give_forms' === $post->post_type ) {
31
+	if ('give_forms' === $post->post_type) {
32 32
 		//Shortcode column with select all input
33
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
34
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
33
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
34
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
35 35
 
36 36
 	}
37 37
 
38 38
 }
39 39
 
40
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
40
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
  *
99 99
  * @since 1.8
100 100
  *
101
- * @return bool
101
+ * @return false|null
102 102
  */
103 103
 function give_redirect_to_clean_url_admin_pages() {
104 104
 	// Give admin pages.
Please login to merge, or discard this patch.
Spacing   +117 added lines, -118 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	);
52 52
 
53 53
 	// Get current page.
54
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
54
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
55 55
 
56 56
 	// Bailout.
57 57
 	if (
58
-		empty( $current_page )
59
-		|| empty( $_GET['_wp_http_referer'] )
60
-		|| ! in_array( $current_page, $give_pages )
58
+		empty($current_page)
59
+		|| empty($_GET['_wp_http_referer'])
60
+		|| ! in_array($current_page, $give_pages)
61 61
 	) {
62 62
 		return false;
63 63
 	}
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @since 1.8
69 69
 	 */
70
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
70
+	$redirect = apply_filters("give_validate_{$current_page}", true);
71 71
 
72
-	if ( $redirect ) {
72
+	if ($redirect) {
73 73
 		// Redirect.
74 74
 		wp_redirect(
75 75
 			remove_query_arg(
76
-				array( '_wp_http_referer', '_wpnonce' ),
77
-				wp_unslash( $_SERVER['REQUEST_URI'] )
76
+				array('_wp_http_referer', '_wpnonce'),
77
+				wp_unslash($_SERVER['REQUEST_URI'])
78 78
 			)
79 79
 		);
80 80
 		exit;
81 81
 	}
82 82
 }
83 83
 
84
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
84
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
85 85
 
86 86
 
87 87
 /**
@@ -95,25 +95,25 @@  discard block
 block discarded – undo
95 95
  */
96 96
 function give_hide_outdated_php_notice() {
97 97
 
98
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
98
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
99 99
 		give_die();
100 100
 	}
101 101
 
102 102
 	// Transient key name.
103 103
 	$transient_key = "_give_hide_outdated_php_notices_shortly";
104 104
 
105
-	if ( Give_Cache::get( $transient_key, true ) ) {
105
+	if (Give_Cache::get($transient_key, true)) {
106 106
 		return;
107 107
 	}
108 108
 
109 109
 	// Hide notice for 24 hours.
110
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
110
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
111 111
 
112 112
 	give_die();
113 113
 
114 114
 }
115 115
 
116
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
116
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
117 117
 
118 118
 /**
119 119
  * Register admin notices.
@@ -122,43 +122,43 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function _give_register_admin_notices() {
124 124
 	// Bailout.
125
-	if( ! is_admin() ) {
125
+	if ( ! is_admin()) {
126 126
 		return;
127 127
 	}
128 128
 
129 129
 	// Add PHP version update notice
130
-	if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
130
+	if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
131 131
 
132
-		$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
133
-		$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
134
-		$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
135
-		$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
136
-		$notice_desc .= '<p>' .  __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
137
-		$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
138
-		$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
132
+		$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
133
+		$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
134
+		$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
135
+		$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
136
+		$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
137
+		$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
138
+		$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
139 139
 
140
-		Give()->notices->register_notice( array(
140
+		Give()->notices->register_notice(array(
141 141
 			'id'          => 'give-invalid-php-version',
142 142
 			'type'        => 'error',
143 143
 			'description' => $notice_desc,
144 144
 			'dismissible_type' => 'user',
145 145
 			'dismiss_interval' => 'shortly',
146
-		) );
146
+		));
147 147
 	}
148 148
 
149 149
 	// Add payment bulk notice.
150 150
 	if (
151
-		current_user_can( 'edit_give_payments' )
152
-		&& isset( $_GET['action'] )
153
-		&& ! empty( $_GET['action'] )
154
-		&& isset( $_GET['payment'] )
155
-		&& ! empty( $_GET['payment'] )
151
+		current_user_can('edit_give_payments')
152
+		&& isset($_GET['action'])
153
+		&& ! empty($_GET['action'])
154
+		&& isset($_GET['payment'])
155
+		&& ! empty($_GET['payment'])
156 156
 	) {
157
-		$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
157
+		$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
158 158
 
159
-		switch ( $_GET['action'] ) {
159
+		switch ($_GET['action']) {
160 160
 			case 'delete':
161
-				Give()->notices->register_notice( array(
161
+				Give()->notices->register_notice(array(
162 162
 					'id'          => 'bulk_action_delete',
163 163
 					'type'        => 'updated',
164 164
 					'description' => sprintf(
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 						),
171 171
 						$payment_count ),
172 172
 					'show'        => true,
173
-				) );
173
+				));
174 174
 
175 175
 				break;
176 176
 
177 177
 			case 'resend-receipt':
178
-				Give()->notices->register_notice( array(
178
+				Give()->notices->register_notice(array(
179 179
 					'id'          => 'bulk_action_resend_receipt',
180 180
 					'type'        => 'updated',
181 181
 					'description' => sprintf(
@@ -188,196 +188,196 @@  discard block
 block discarded – undo
188 188
 						$payment_count
189 189
 					),
190 190
 					'show'        => true,
191
-				) );
191
+				));
192 192
 				break;
193 193
 		}
194 194
 	}
195 195
 
196 196
 	// Add give message notices.
197
-	if ( ! empty( $_GET['give-message'] ) ) {
197
+	if ( ! empty($_GET['give-message'])) {
198 198
 		// Donation reports errors.
199
-		if ( current_user_can( 'view_give_reports' ) ) {
200
-			switch ( $_GET['give-message'] ) {
199
+		if (current_user_can('view_give_reports')) {
200
+			switch ($_GET['give-message']) {
201 201
 				case 'donation_deleted' :
202
-					Give()->notices->register_notice( array(
202
+					Give()->notices->register_notice(array(
203 203
 						'id'          => 'give-donation-deleted',
204 204
 						'type'        => 'updated',
205
-						'description' => __( 'The donation has been deleted.', 'give' ),
205
+						'description' => __('The donation has been deleted.', 'give'),
206 206
 						'show'        => true,
207
-					) );
207
+					));
208 208
 					break;
209 209
 				case 'email_sent' :
210
-					Give()->notices->register_notice( array(
210
+					Give()->notices->register_notice(array(
211 211
 						'id'          => 'give-payment-sent',
212 212
 						'type'        => 'updated',
213
-						'description' => __( 'The donation receipt has been resent.', 'give' ),
213
+						'description' => __('The donation receipt has been resent.', 'give'),
214 214
 						'show'        => true,
215
-					) );
215
+					));
216 216
 					break;
217 217
 				case 'refreshed-reports' :
218
-					Give()->notices->register_notice( array(
218
+					Give()->notices->register_notice(array(
219 219
 						'id'          => 'give-refreshed-reports',
220 220
 						'type'        => 'updated',
221
-						'description' => __( 'The reports cache has been cleared.', 'give' ),
221
+						'description' => __('The reports cache has been cleared.', 'give'),
222 222
 						'show'        => true,
223
-					) );
223
+					));
224 224
 					break;
225 225
 				case 'donation-note-deleted' :
226
-					Give()->notices->register_notice( array(
226
+					Give()->notices->register_notice(array(
227 227
 						'id'          => 'give-donation-note-deleted',
228 228
 						'type'        => 'updated',
229
-						'description' => __( 'The donation note has been deleted.', 'give' ),
229
+						'description' => __('The donation note has been deleted.', 'give'),
230 230
 						'show'        => true,
231
-					) );
231
+					));
232 232
 					break;
233 233
 			}
234 234
 		}
235 235
 
236 236
 		// Give settings notices and errors.
237
-		if ( current_user_can( 'manage_give_settings' ) ) {
238
-			switch ( $_GET['give-message'] ) {
237
+		if (current_user_can('manage_give_settings')) {
238
+			switch ($_GET['give-message']) {
239 239
 				case 'settings-imported' :
240
-					Give()->notices->register_notice( array(
240
+					Give()->notices->register_notice(array(
241 241
 						'id'          => 'give-settings-imported',
242 242
 						'type'        => 'updated',
243
-						'description' => __( 'The settings have been imported.', 'give' ),
243
+						'description' => __('The settings have been imported.', 'give'),
244 244
 						'show'        => true,
245
-					) );
245
+					));
246 246
 					break;
247 247
 				case 'api-key-generated' :
248
-					Give()->notices->register_notice( array(
248
+					Give()->notices->register_notice(array(
249 249
 						'id'          => 'give-api-key-generated',
250 250
 						'type'        => 'updated',
251
-						'description' => __( 'API keys have been generated.', 'give' ),
251
+						'description' => __('API keys have been generated.', 'give'),
252 252
 						'show'        => true,
253
-					) );
253
+					));
254 254
 					break;
255 255
 				case 'api-key-exists' :
256
-					Give()->notices->register_notice( array(
256
+					Give()->notices->register_notice(array(
257 257
 						'id'          => 'give-api-key-exists',
258 258
 						'type'        => 'updated',
259
-						'description' => __( 'The specified user already has API keys.', 'give' ),
259
+						'description' => __('The specified user already has API keys.', 'give'),
260 260
 						'show'        => true,
261
-					) );
261
+					));
262 262
 					break;
263 263
 				case 'api-key-regenerated' :
264
-					Give()->notices->register_notice( array(
264
+					Give()->notices->register_notice(array(
265 265
 						'id'          => 'give-api-key-regenerated',
266 266
 						'type'        => 'updated',
267
-						'description' => __( 'API keys have been regenerated.', 'give' ),
267
+						'description' => __('API keys have been regenerated.', 'give'),
268 268
 						'show'        => true,
269
-					) );
269
+					));
270 270
 					break;
271 271
 				case 'api-key-revoked' :
272
-					Give()->notices->register_notice( array(
272
+					Give()->notices->register_notice(array(
273 273
 						'id'          => 'give-api-key-revoked',
274 274
 						'type'        => 'updated',
275
-						'description' => __( 'API keys have been revoked.', 'give' ),
275
+						'description' => __('API keys have been revoked.', 'give'),
276 276
 						'show'        => true,
277
-					) );
277
+					));
278 278
 					break;
279 279
 				case 'sent-test-email' :
280
-					Give()->notices->register_notice( array(
280
+					Give()->notices->register_notice(array(
281 281
 						'id'          => 'give-sent-test-email',
282 282
 						'type'        => 'updated',
283
-						'description' => __( 'The test email has been sent.', 'give' ),
283
+						'description' => __('The test email has been sent.', 'give'),
284 284
 						'show'        => true,
285
-					) );
285
+					));
286 286
 					break;
287 287
 				case 'matched-success-failure-page':
288
-					Give()->notices->register_notice( array(
288
+					Give()->notices->register_notice(array(
289 289
 						'id'          => 'give-matched-success-failure-page',
290 290
 						'type'        => 'updated',
291
-						'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
291
+						'description' => __('You cannot set the success and failed pages to the same page', 'give'),
292 292
 						'show'        => true,
293
-					) );
293
+					));
294 294
 					break;
295 295
 			}
296 296
 		}
297 297
 		// Payments errors.
298
-		if ( current_user_can( 'edit_give_payments' ) ) {
299
-			switch ( $_GET['give-message'] ) {
298
+		if (current_user_can('edit_give_payments')) {
299
+			switch ($_GET['give-message']) {
300 300
 				case 'note-added' :
301
-					Give()->notices->register_notice( array(
301
+					Give()->notices->register_notice(array(
302 302
 						'id'          => 'give-note-added',
303 303
 						'type'        => 'updated',
304
-						'description' => __( 'The donation note has been added.', 'give' ),
304
+						'description' => __('The donation note has been added.', 'give'),
305 305
 						'show'        => true,
306
-					) );
306
+					));
307 307
 					break;
308 308
 				case 'payment-updated' :
309
-					Give()->notices->register_notice( array(
309
+					Give()->notices->register_notice(array(
310 310
 						'id'          => 'give-payment-updated',
311 311
 						'type'        => 'updated',
312
-						'description' => __( 'The donation has been updated.', 'give' ),
312
+						'description' => __('The donation has been updated.', 'give'),
313 313
 						'show'        => true,
314
-					) );
314
+					));
315 315
 					break;
316 316
 			}
317 317
 		}
318 318
 
319 319
 		// Donor Notices.
320
-		if ( current_user_can( 'edit_give_payments' ) ) {
321
-			switch ( $_GET['give-message'] ) {
320
+		if (current_user_can('edit_give_payments')) {
321
+			switch ($_GET['give-message']) {
322 322
 				case 'donor-deleted' :
323
-					Give()->notices->register_notice( array(
323
+					Give()->notices->register_notice(array(
324 324
 						'id'          => 'give-donor-deleted',
325 325
 						'type'        => 'updated',
326
-						'description' => __( 'The donor has been deleted.', 'give' ),
326
+						'description' => __('The donor has been deleted.', 'give'),
327 327
 						'show'        => true,
328
-					) );
328
+					));
329 329
 					break;
330 330
 
331 331
 				case 'email-added' :
332
-					Give()->notices->register_notice( array(
332
+					Give()->notices->register_notice(array(
333 333
 						'id'          => 'give-donor-email-added',
334 334
 						'type'        => 'updated',
335
-						'description' => __( 'Donor email added.', 'give' ),
335
+						'description' => __('Donor email added.', 'give'),
336 336
 						'show'        => true,
337
-					) );
337
+					));
338 338
 					break;
339 339
 
340 340
 				case 'email-removed' :
341
-					Give()->notices->register_notice( array(
341
+					Give()->notices->register_notice(array(
342 342
 						'id'          => 'give-donor-email-removed',
343 343
 						'type'        => 'updated',
344
-						'description' => __( 'Donor email removed.', 'give' ),
344
+						'description' => __('Donor email removed.', 'give'),
345 345
 						'show'        => true,
346
-					) );
346
+					));
347 347
 					break;
348 348
 
349 349
 				case 'email-remove-failed' :
350
-					Give()->notices->register_notice( array(
350
+					Give()->notices->register_notice(array(
351 351
 						'id'          => 'give-donor-email-remove-failed',
352 352
 						'type'        => 'updated',
353
-						'description' => __( 'Failed to remove donor email.', 'give' ),
353
+						'description' => __('Failed to remove donor email.', 'give'),
354 354
 						'show'        => true,
355
-					) );
355
+					));
356 356
 					break;
357 357
 
358 358
 				case 'primary-email-updated' :
359
-					Give()->notices->register_notice( array(
359
+					Give()->notices->register_notice(array(
360 360
 						'id'          => 'give-donor-primary-email-updated',
361 361
 						'type'        => 'updated',
362
-						'description' => __( 'Primary email updated for donor.', 'give' ),
362
+						'description' => __('Primary email updated for donor.', 'give'),
363 363
 						'show'        => true,
364
-					) );
364
+					));
365 365
 					break;
366 366
 
367 367
 				case 'primary-email-failed' :
368
-					Give()->notices->register_notice( array(
368
+					Give()->notices->register_notice(array(
369 369
 						'id'          => 'give-donor-primary-email-failed',
370 370
 						'type'        => 'updated',
371
-						'description' => __( 'Failed to set primary email.', 'give' ),
371
+						'description' => __('Failed to set primary email.', 'give'),
372 372
 						'show'        => true,
373
-					) );
373
+					));
374 374
 					break;
375 375
 			}
376 376
 		}
377 377
 	}
378 378
 }
379 379
 
380
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
380
+add_action('admin_notices', '_give_register_admin_notices', - 1);
381 381
 
382 382
 
383 383
 /**
@@ -387,27 +387,26 @@  discard block
 block discarded – undo
387 387
  *
388 388
  * @return bool
389 389
  */
390
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
391
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
392
-		give_is_setting_enabled( $_POST['test_mode'] ) :
393
-		give_is_test_mode();
390
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
391
+	$is_test_mode = ! empty($_POST['test_mode']) ?
392
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
394 393
 
395 394
 	if (
396
-		! current_user_can( 'view_give_reports' ) ||
395
+		! current_user_can('view_give_reports') ||
397 396
 		! $is_test_mode
398 397
 	) {
399 398
 		return false;
400 399
 	}
401 400
 
402 401
 	// Add the main siteadmin menu item.
403
-	$wp_admin_bar->add_menu( array(
402
+	$wp_admin_bar->add_menu(array(
404 403
 		'id'     => 'give-test-notice',
405
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
404
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
406 405
 		'parent' => 'top-secondary',
407
-		'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
408
-		'meta'   => array( 'class' => 'give-test-mode-active' ),
409
-	) );
406
+		'title'  => esc_html__('Give Test Mode Active', 'give'),
407
+		'meta'   => array('class' => 'give-test-mode-active'),
408
+	));
410 409
 
411 410
 	return true;
412 411
 }
413
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
414 412
\ No newline at end of file
413
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
415 414
\ No newline at end of file
Please login to merge, or discard this patch.