Completed
Pull Request — master (#1856)
by Mehul
19:23
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   +173 added lines, -173 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,27 +45,27 @@  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
 	// Check payment.
55
-	if ( empty( $payment_id ) ) {
55
+	if (empty($payment_id)) {
56 56
 		// Record the error.
57
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */
58
-		__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id );
57
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */
58
+		__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id);
59 59
 		// Problems? Send back.
60
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
60
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
61 61
 	}
62 62
 
63 63
 	// Redirect to PayPal.
64
-	wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) );
64
+	wp_redirect(give_build_paypal_url($payment_id, $payment_data));
65 65
 	exit;
66 66
 }
67 67
 
68
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
68
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
69 69
 
70 70
 /**
71 71
  * Listens for a PayPal IPN requests and then sends to the processing function.
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function give_listen_for_paypal_ipn() {
77 77
 	// Regular PayPal IPN
78
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
78
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
79 79
 		/**
80 80
 		 * Fires while verifying PayPal IPN
81 81
 		 *
82 82
 		 * @since 1.0
83 83
 		 */
84
-		do_action( 'give_verify_paypal_ipn' );
84
+		do_action('give_verify_paypal_ipn');
85 85
 	}
86 86
 }
87 87
 
88
-add_action( 'init', 'give_listen_for_paypal_ipn' );
88
+add_action('init', 'give_listen_for_paypal_ipn');
89 89
 
90 90
 /**
91 91
  * Process PayPal IPN
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 function give_process_paypal_ipn() {
97 97
 
98 98
 	// Check the request method is POST.
99
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
99
+	if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) {
100 100
 		return;
101 101
 	}
102 102
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	$post_data = '';
105 105
 
106 106
 	// Fallback just in case post_max_size is lower than needed.
107
-	if ( ini_get( 'allow_url_fopen' ) ) {
108
-		$post_data = file_get_contents( 'php://input' );
107
+	if (ini_get('allow_url_fopen')) {
108
+		$post_data = file_get_contents('php://input');
109 109
 	} else {
110 110
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough.
111
-		ini_set( 'post_max_size', '12M' );
111
+		ini_set('post_max_size', '12M');
112 112
 	}
113 113
 	// Start the encoded data collection with notification command.
114 114
 	$encoded_data = 'cmd=_notify-validate';
@@ -117,39 +117,39 @@  discard block
 block discarded – undo
117 117
 	$arg_separator = give_get_php_arg_separator_output();
118 118
 
119 119
 	// Verify there is a post_data.
120
-	if ( $post_data || strlen( $post_data ) > 0 ) {
120
+	if ($post_data || strlen($post_data) > 0) {
121 121
 		// Append the data.
122
-		$encoded_data .= $arg_separator . $post_data;
122
+		$encoded_data .= $arg_separator.$post_data;
123 123
 	} else {
124 124
 		// Check if POST is empty.
125
-		if ( empty( $_POST ) ) {
125
+		if (empty($_POST)) {
126 126
 			// Nothing to do.
127 127
 			return;
128 128
 		} else {
129 129
 			// Loop through each POST.
130
-			foreach ( $_POST as $key => $value ) {
130
+			foreach ($_POST as $key => $value) {
131 131
 				// Encode the value and append the data.
132
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
132
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
133 133
 			}
134 134
 		}
135 135
 	}
136 136
 
137 137
 	// Convert collected post data to an array.
138
-	parse_str( $encoded_data, $encoded_data_array );
138
+	parse_str($encoded_data, $encoded_data_array);
139 139
 
140
-	foreach ( $encoded_data_array as $key => $value ) {
140
+	foreach ($encoded_data_array as $key => $value) {
141 141
 
142
-		if ( false !== strpos( $key, 'amp;' ) ) {
143
-			$new_key = str_replace( '&amp;', '&', $key );
144
-			$new_key = str_replace( 'amp;', '&', $new_key );
142
+		if (false !== strpos($key, 'amp;')) {
143
+			$new_key = str_replace('&amp;', '&', $key);
144
+			$new_key = str_replace('amp;', '&', $new_key);
145 145
 
146
-			unset( $encoded_data_array[ $key ] );
147
-			$encoded_data_array[ $new_key ] = $value;
146
+			unset($encoded_data_array[$key]);
147
+			$encoded_data_array[$new_key] = $value;
148 148
 		}
149 149
 	}
150 150
 
151 151
 	// Validate IPN request w/ PayPal if user hasn't disabled this security measure.
152
-	if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) {
152
+	if (give_is_setting_enabled(give_get_option('paypal_verification'))) {
153 153
 
154 154
 		$remote_post_vars = array(
155 155
 			'method'      => 'POST',
@@ -169,25 +169,25 @@  discard block
 block discarded – undo
169 169
 		);
170 170
 
171 171
 		// Validate the IPN.
172
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
172
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
173 173
 
174
-		if ( is_wp_error( $api_response ) ) {
175
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
176
-			__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
174
+		if (is_wp_error($api_response)) {
175
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
176
+			__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
177 177
 
178 178
 			return; // Something went wrong
179 179
 		}
180 180
 
181
-		if ( 'VERIFIED' !== $api_response['body'] ) {
182
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
183
-			__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
181
+		if ('VERIFIED' !== $api_response['body']) {
182
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
183
+			__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
184 184
 
185 185
 			return; // Response not okay.
186 186
 		}
187 187
 	}// End if().
188 188
 
189 189
 	// Check if $post_data_array has been populated.
190
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
190
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
191 191
 		return;
192 192
 	}
193 193
 
@@ -196,28 +196,28 @@  discard block
 block discarded – undo
196 196
 		'payment_status' => '',
197 197
 	);
198 198
 
199
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
199
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
200 200
 
201
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
201
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
202 202
 	$txn_type   = $encoded_data_array['txn_type'];
203 203
 
204 204
 	// Check for PayPal IPN Notifications and update data based on it.
205
-	$current_timestamp = current_time( 'timestamp' );
205
+	$current_timestamp = current_time('timestamp');
206 206
 	$paypal_ipn_vars = array(
207
-		'auth_status'    => ( $api_response['body'] ) ? $api_response['body'] : 'N/A',
207
+		'auth_status'    => ($api_response['body']) ? $api_response['body'] : 'N/A',
208 208
 		'transaction_id' => $encoded_data_array['txn_id'],
209 209
 		'payment_id'     => $payment_id,
210 210
 	);
211
-	update_option( 'give_last_paypal_ipn_received', $paypal_ipn_vars );
212
-	give_insert_payment_note( $payment_id, sprintf(
213
-				__( 'Last IPN received on %s at %s', 'give' ),
214
-				date_i18n( 'm/d/Y', $current_timestamp ),
215
-				date_i18n( 'H:i', $current_timestamp )
211
+	update_option('give_last_paypal_ipn_received', $paypal_ipn_vars);
212
+	give_insert_payment_note($payment_id, sprintf(
213
+				__('Last IPN received on %s at %s', 'give'),
214
+				date_i18n('m/d/Y', $current_timestamp),
215
+				date_i18n('H:i', $current_timestamp)
216 216
 			)
217 217
 	);
218
-	give_update_meta( $payment_id, 'give_last_paypal_ipn_received', $current_timestamp );
218
+	give_update_meta($payment_id, 'give_last_paypal_ipn_received', $current_timestamp);
219 219
 
220
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
220
+	if (has_action('give_paypal_'.$txn_type)) {
221 221
 		/**
222 222
 		 * Fires while processing PayPal IPN $txn_type.
223 223
 		 *
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		 * @param array $encoded_data_array Encoded data.
229 229
 		 * @param int   $payment_id         Payment id.
230 230
 		 */
231
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
231
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
232 232
 	} else {
233 233
 		/**
234 234
 		 * Fires while process PayPal IPN.
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 		 * @param array $encoded_data_array Encoded data.
241 241
 		 * @param int   $payment_id         Payment id.
242 242
 		 */
243
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
243
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
244 244
 	}
245 245
 	exit;
246 246
 }
247 247
 
248
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
248
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
249 249
 
250 250
 /**
251 251
  * Process web accept (one time) payment IPNs.
@@ -257,99 +257,99 @@  discard block
 block discarded – undo
257 257
  *
258 258
  * @return void
259 259
  */
260
-function give_process_paypal_web_accept( $data, $payment_id ) {
260
+function give_process_paypal_web_accept($data, $payment_id) {
261 261
 
262 262
 	// Only allow through these transaction types.
263
-	if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) {
263
+	if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) {
264 264
 		return;
265 265
 	}
266 266
 
267 267
 	// Need $payment_id to continue.
268
-	if ( empty( $payment_id ) ) {
268
+	if (empty($payment_id)) {
269 269
 		return;
270 270
 	}
271 271
 
272 272
 	// Collect donation payment details.
273 273
 	$paypal_amount  = $data['mc_gross'];
274
-	$payment_status = strtolower( $data['payment_status'] );
275
-	$currency_code  = strtolower( $data['mc_currency'] );
276
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
277
-	$payment_meta   = give_get_payment_meta( $payment_id );
274
+	$payment_status = strtolower($data['payment_status']);
275
+	$currency_code  = strtolower($data['mc_currency']);
276
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
277
+	$payment_meta   = give_get_payment_meta($payment_id);
278 278
 
279 279
 	// Must be a PayPal standard IPN.
280
-	if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) {
280
+	if ('paypal' !== give_get_payment_gateway($payment_id)) {
281 281
 		return;
282 282
 	}
283 283
 
284 284
 	// Verify payment recipient
285
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) {
285
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) {
286 286
 
287
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
288
-		__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
289
-		give_update_payment_status( $payment_id, 'failed' );
290
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) );
287
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
288
+		__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
289
+		give_update_payment_status($payment_id, 'failed');
290
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
291 291
 
292 292
 		return;
293 293
 	}
294 294
 
295 295
 	// Verify payment currency.
296
-	if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) {
296
+	if ($currency_code !== strtolower($payment_meta['currency'])) {
297 297
 
298
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
299
-		__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
300
-		give_update_payment_status( $payment_id, 'failed' );
301
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
298
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
299
+		__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
300
+		give_update_payment_status($payment_id, 'failed');
301
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
302 302
 
303 303
 		return;
304 304
 	}
305 305
 
306 306
 	// Process refunds & reversed.
307
-	if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
308
-		give_process_paypal_refund( $data, $payment_id );
307
+	if ('refunded' === $payment_status || 'reversed' === $payment_status) {
308
+		give_process_paypal_refund($data, $payment_id);
309 309
 
310 310
 		return;
311 311
 	}
312 312
 
313 313
 	// Only complete payments once.
314
-	if ( 'publish' === get_post_status( $payment_id ) ) {
314
+	if ('publish' === get_post_status($payment_id)) {
315 315
 		return;
316 316
 	}
317 317
 
318 318
 	// Retrieve the total donation amount (before PayPal).
319
-	$payment_amount = give_get_payment_amount( $payment_id );
319
+	$payment_amount = give_get_payment_amount($payment_id);
320 320
 
321 321
 	// Check that the donation PP and local db amounts match.
322
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
322
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
323 323
 		// The prices don't match
324
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
325
-		__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
326
-		give_update_payment_status( $payment_id, 'failed' );
327
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
324
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
325
+		__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
326
+		give_update_payment_status($payment_id, 'failed');
327
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
328 328
 
329 329
 		return;
330 330
 	}
331 331
 
332 332
 	// Process completed donations.
333
-	if ( 'completed' === $payment_status || give_is_test_mode() ) {
333
+	if ('completed' === $payment_status || give_is_test_mode()) {
334 334
 
335
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
336
-		__( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) );
337
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
338
-		give_update_payment_status( $payment_id, 'publish' );
335
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
336
+		__('PayPal Transaction ID: %s', 'give'), $data['txn_id'] ));
337
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
338
+		give_update_payment_status($payment_id, 'publish');
339 339
 
340
-	} elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) {
340
+	} elseif ('pending' === $payment_status && isset($data['pending_reason'])) {
341 341
 
342 342
 		// Look for possible pending reasons, such as an echeck.
343
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
343
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
344 344
 
345
-		if ( ! empty( $note ) ) {
346
-			give_insert_payment_note( $payment_id, $note );
345
+		if ( ! empty($note)) {
346
+			give_insert_payment_note($payment_id, $note);
347 347
 		}
348 348
 	}
349 349
 
350 350
 }
351 351
 
352
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 );
352
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2);
353 353
 
354 354
 /**
355 355
  * Process PayPal IPN Refunds
@@ -361,35 +361,35 @@  discard block
 block discarded – undo
361 361
  *
362 362
  * @return void
363 363
  */
364
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
364
+function give_process_paypal_refund($data, $payment_id = 0) {
365 365
 
366 366
 	// Collect payment details.
367
-	if ( empty( $payment_id ) ) {
367
+	if (empty($payment_id)) {
368 368
 		return;
369 369
 	}
370 370
 
371 371
 	// Only refund payments once.
372
-	if ( 'refunded' === get_post_status( $payment_id ) ) {
372
+	if ('refunded' === get_post_status($payment_id)) {
373 373
 		return;
374 374
 	}
375 375
 
376
-	$payment_amount = give_get_payment_amount( $payment_id );
376
+	$payment_amount = give_get_payment_amount($payment_id);
377 377
 	$refund_amount  = $data['payment_gross'] * - 1;
378 378
 
379
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
379
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
380 380
 
381
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
382
-		__( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) );
381
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
382
+		__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] ));
383 383
 
384 384
 		return; // This is a partial refund
385 385
 
386 386
 	}
387 387
 
388
-	give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
389
-	__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) );
390
-	give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
391
-	__( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) );
392
-	give_update_payment_status( $payment_id, 'refunded' );
388
+	give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
389
+	__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] ));
390
+	give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
391
+	__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] ));
392
+	give_update_payment_status($payment_id, 'refunded');
393 393
 }
394 394
 
395 395
 /**
@@ -401,24 +401,24 @@  discard block
 block discarded – undo
401 401
  *
402 402
  * @return string
403 403
  */
404
-function give_get_paypal_redirect( $ssl_check = false ) {
404
+function give_get_paypal_redirect($ssl_check = false) {
405 405
 
406
-	if ( is_ssl() || ! $ssl_check ) {
406
+	if (is_ssl() || ! $ssl_check) {
407 407
 		$protocol = 'https://';
408 408
 	} else {
409 409
 		$protocol = 'http://';
410 410
 	}
411 411
 
412 412
 	// Check the current payment mode
413
-	if ( give_is_test_mode() ) {
413
+	if (give_is_test_mode()) {
414 414
 		// Test mode
415
-		$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
415
+		$paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr';
416 416
 	} else {
417 417
 		// Live mode
418
-		$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
418
+		$paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr';
419 419
 	}
420 420
 
421
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
421
+	return apply_filters('give_paypal_uri', $paypal_uri);
422 422
 }
423 423
 
424 424
 /**
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
  * @return string
429 429
  */
430 430
 function give_get_paypal_page_style() {
431
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
431
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
432 432
 
433
-	return apply_filters( 'give_paypal_page_style', $page_style );
433
+	return apply_filters('give_paypal_page_style', $page_style);
434 434
 }
435 435
 
436 436
 /**
@@ -444,26 +444,26 @@  discard block
 block discarded – undo
444 444
  *
445 445
  * @return string
446 446
  */
447
-function give_paypal_success_page_content( $content ) {
447
+function give_paypal_success_page_content($content) {
448 448
 
449
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
449
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
450 450
 		return $content;
451 451
 	}
452 452
 
453
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
453
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
454 454
 
455
-	if ( ! $payment_id ) {
455
+	if ( ! $payment_id) {
456 456
 		$session    = give_get_purchase_session();
457
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
457
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
458 458
 	}
459 459
 
460
-	$payment = get_post( $payment_id );
461
-	if ( $payment && 'pending' === $payment->post_status ) {
460
+	$payment = get_post($payment_id);
461
+	if ($payment && 'pending' === $payment->post_status) {
462 462
 
463 463
 		// Payment is still pending so show processing indicator to fix the race condition.
464 464
 		ob_start();
465 465
 
466
-		give_get_template_part( 'payment', 'processing' );
466
+		give_get_template_part('payment', 'processing');
467 467
 
468 468
 		$content = ob_get_clean();
469 469
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 }
475 475
 
476
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
476
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
477 477
 
478 478
 /**
479 479
  * Given a Payment ID, extract the transaction ID
@@ -484,22 +484,22 @@  discard block
 block discarded – undo
484 484
  *
485 485
  * @return string                   Transaction ID
486 486
  */
487
-function give_paypal_get_payment_transaction_id( $payment_id ) {
487
+function give_paypal_get_payment_transaction_id($payment_id) {
488 488
 
489 489
 	$transaction_id = '';
490
-	$notes          = give_get_payment_notes( $payment_id );
490
+	$notes          = give_get_payment_notes($payment_id);
491 491
 
492
-	foreach ( $notes as $note ) {
493
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
492
+	foreach ($notes as $note) {
493
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
494 494
 			$transaction_id = $match[1];
495 495
 			continue;
496 496
 		}
497 497
 	}
498 498
 
499
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
499
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
500 500
 }
501 501
 
502
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
502
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
503 503
 
504 504
 /**
505 505
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -511,16 +511,16 @@  discard block
 block discarded – undo
511 511
  *
512 512
  * @return string                 A link to the PayPal transaction details
513 513
  */
514
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
514
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
515 515
 
516 516
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
517
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
517
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
518 518
 
519
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
519
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
520 520
 
521 521
 }
522 522
 
523
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
523
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
524 524
 
525 525
 
526 526
 /**
@@ -532,64 +532,64 @@  discard block
 block discarded – undo
532 532
  *
533 533
  * @return string
534 534
  */
535
-function give_paypal_get_pending_donation_note( $pending_reason ) {
535
+function give_paypal_get_pending_donation_note($pending_reason) {
536 536
 
537 537
 	$note = '';
538 538
 
539
-	switch ( $pending_reason ) {
539
+	switch ($pending_reason) {
540 540
 
541 541
 		case 'echeck' :
542 542
 
543
-			$note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
543
+			$note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
544 544
 
545 545
 			break;
546 546
 
547 547
 		case 'address' :
548 548
 
549
-			$note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
549
+			$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
550 550
 
551 551
 			break;
552 552
 
553 553
 		case 'intl' :
554 554
 
555
-			$note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
555
+			$note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
556 556
 
557 557
 			break;
558 558
 
559 559
 		case 'multi-currency' :
560 560
 
561
-			$note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
561
+			$note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
562 562
 
563 563
 			break;
564 564
 
565 565
 		case 'paymentreview' :
566 566
 		case 'regulatory_review' :
567 567
 
568
-			$note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
568
+			$note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
569 569
 
570 570
 			break;
571 571
 
572 572
 		case 'unilateral' :
573 573
 
574
-			$note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
574
+			$note = __('Payment was sent to non-confirmed or non-registered email address.', 'give');
575 575
 
576 576
 			break;
577 577
 
578 578
 		case 'upgrade' :
579 579
 
580
-			$note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
580
+			$note = __('PayPal account must be upgraded before this payment can be accepted.', 'give');
581 581
 
582 582
 			break;
583 583
 
584 584
 		case 'verify' :
585 585
 
586
-			$note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
586
+			$note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
587 587
 
588 588
 			break;
589 589
 
590 590
 		case 'other' :
591 591
 
592
-			$note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
592
+			$note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
593 593
 
594 594
 			break;
595 595
 
@@ -607,49 +607,49 @@  discard block
 block discarded – undo
607 607
  *
608 608
  * @return mixed|string
609 609
  */
610
-function give_build_paypal_url( $payment_id, $payment_data ) {
610
+function give_build_paypal_url($payment_id, $payment_data) {
611 611
 	// Only send to PayPal if the pending payment is created successfully.
612
-	$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
612
+	$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
613 613
 
614 614
 	// Get the success url.
615
-	$return_url = add_query_arg( array(
615
+	$return_url = add_query_arg(array(
616 616
 		'payment-confirmation' => 'paypal',
617 617
 		'payment-id'           => $payment_id,
618 618
 
619
-	), get_permalink( give_get_option( 'success_page' ) ) );
619
+	), get_permalink(give_get_option('success_page')));
620 620
 
621 621
 	// Get the PayPal redirect uri.
622
-	$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
622
+	$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
623 623
 
624 624
 	// Item name.
625
-	$item_name = give_build_paypal_item_title( $payment_data );
625
+	$item_name = give_build_paypal_item_title($payment_data);
626 626
 
627 627
 	// Setup PayPal API params.
628 628
 	$paypal_args = array(
629
-		'business'      => give_get_option( 'paypal_email', false ),
629
+		'business'      => give_get_option('paypal_email', false),
630 630
 		'first_name'    => $payment_data['user_info']['first_name'],
631 631
 		'last_name'     => $payment_data['user_info']['last_name'],
632 632
 		'email'         => $payment_data['user_email'],
633 633
 		'invoice'       => $payment_data['purchase_key'],
634 634
 		'amount'        => $payment_data['price'],
635
-		'item_name'     => stripslashes( $item_name ),
635
+		'item_name'     => stripslashes($item_name),
636 636
 		'no_shipping'   => '1',
637 637
 		'shipping'      => '0',
638 638
 		'no_note'       => '1',
639 639
 		'currency_code' => give_get_currency(),
640
-		'charset'       => get_bloginfo( 'charset' ),
640
+		'charset'       => get_bloginfo('charset'),
641 641
 		'custom'        => $payment_id,
642 642
 		'rm'            => '2',
643 643
 		'return'        => $return_url,
644
-		'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
644
+		'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
645 645
 		'notify_url'    => $listener_url,
646 646
 		'page_style'    => give_get_paypal_page_style(),
647
-		'cbt'           => get_bloginfo( 'name' ),
647
+		'cbt'           => get_bloginfo('name'),
648 648
 		'bn'            => 'givewp_SP',
649 649
 	);
650 650
 
651 651
 	// Add user address if present.
652
-	if ( ! empty( $payment_data['user_info']['address'] ) ) {
652
+	if ( ! empty($payment_data['user_info']['address'])) {
653 653
 		$default_address = array(
654 654
 			'line1'   => '',
655 655
 			'line2'   => '',
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 			'country' => '',
660 660
 		);
661 661
 
662
-		$address = wp_parse_args( $payment_data['user_info']['address'], $default_address );
662
+		$address = wp_parse_args($payment_data['user_info']['address'], $default_address);
663 663
 
664 664
 		$paypal_args['address1'] = $address['line1'];
665 665
 		$paypal_args['address2'] = $address['line2'];
@@ -680,13 +680,13 @@  discard block
 block discarded – undo
680 680
 	 * @param array $paypal_args
681 681
 	 * @param array $payment_data
682 682
 	 */
683
-	$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
683
+	$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
684 684
 
685 685
 	// Build query.
686
-	$paypal_redirect .= http_build_query( $paypal_args );
686
+	$paypal_redirect .= http_build_query($paypal_args);
687 687
 
688 688
 	// Fix for some sites that encode the entities.
689
-	$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
689
+	$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
690 690
 
691 691
 	return $paypal_redirect;
692 692
 }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 function give_get_paypal_button_type() {
702 702
 	// paypal_button_type can be donation or standard.
703 703
 	$paypal_button_type = '_donations';
704
-	if ( 'standard' === give_get_option( 'paypal_button_type' ) ) {
704
+	if ('standard' === give_get_option('paypal_button_type')) {
705 705
 		$paypal_button_type = '_xclick';
706 706
 	}
707 707
 
@@ -718,30 +718,30 @@  discard block
 block discarded – undo
718 718
  *
719 719
  * @return string
720 720
  */
721
-function give_build_paypal_item_title( $payment_data ) {
722
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
721
+function give_build_paypal_item_title($payment_data) {
722
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
723 723
 	$item_name = $payment_data['post_data']['give-form-title'];
724 724
 
725 725
 	// Verify has variable prices.
726
-	if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
726
+	if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
727 727
 
728
-		$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
729
-		$price_level_amount    = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
728
+		$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
729
+		$price_level_amount    = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
730 730
 
731 731
 		// Donation given doesn't match selected level (must be a custom amount).
732
-		if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) {
733
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
732
+		if ($price_level_amount != give_sanitize_amount($payment_data['price'])) {
733
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
734 734
 			// user custom amount text if any, fallback to default if not.
735
-			$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
735
+			$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
736 736
 
737
-		} elseif ( ! empty( $item_price_level_text ) ) {
738
-			$item_name .= ' - ' . $item_price_level_text;
737
+		} elseif ( ! empty($item_price_level_text)) {
738
+			$item_name .= ' - '.$item_price_level_text;
739 739
 		}
740 740
 	} // End if().
741
-	elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) {
742
-		$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
741
+	elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) {
742
+		$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
743 743
 		// user custom amount text if any, fallback to default if not.
744
-		$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
744
+		$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
745 745
 	}
746 746
 
747 747
 	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.