@@ -565,7 +565,7 @@ discard block |
||
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 |
||
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. |
@@ -9,7 +9,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
75 | 75 | */ |
76 | 76 | function give_listen_for_paypal_ipn() { |
77 | 77 | // Regular PayPal IPN |
78 | - if ( isset( $_GET['give-listener'] ) && 'IPN' === $_GET['give-listener'] ) { |
|
78 | + if (isset($_GET['give-listener']) && 'IPN' === $_GET['give-listener']) { |
|
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 |
||
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 |
||
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 |
||
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( '&', '&', $key ); |
|
144 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
142 | + if (false !== strpos($key, 'amp;')) { |
|
143 | + $new_key = str_replace('&', '&', $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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 transaction ID, generate a link to the PayPal transaction ID details |
@@ -485,16 +485,16 @@ discard block |
||
485 | 485 | * |
486 | 486 | * @return string A link to the PayPal transaction details |
487 | 487 | */ |
488 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
488 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
489 | 489 | |
490 | 490 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
491 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
491 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
492 | 492 | |
493 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
493 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
497 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
497 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
498 | 498 | |
499 | 499 | |
500 | 500 | /** |
@@ -506,64 +506,64 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @return string |
508 | 508 | */ |
509 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
509 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
510 | 510 | |
511 | 511 | $note = ''; |
512 | 512 | |
513 | - switch ( $pending_reason ) { |
|
513 | + switch ($pending_reason) { |
|
514 | 514 | |
515 | 515 | case 'echeck' : |
516 | 516 | |
517 | - $note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
517 | + $note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
518 | 518 | |
519 | 519 | break; |
520 | 520 | |
521 | 521 | case 'address' : |
522 | 522 | |
523 | - $note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
523 | + $note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
524 | 524 | |
525 | 525 | break; |
526 | 526 | |
527 | 527 | case 'intl' : |
528 | 528 | |
529 | - $note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
529 | + $note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
530 | 530 | |
531 | 531 | break; |
532 | 532 | |
533 | 533 | case 'multi-currency' : |
534 | 534 | |
535 | - $note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
535 | + $note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
536 | 536 | |
537 | 537 | break; |
538 | 538 | |
539 | 539 | case 'paymentreview' : |
540 | 540 | case 'regulatory_review' : |
541 | 541 | |
542 | - $note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
542 | + $note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
543 | 543 | |
544 | 544 | break; |
545 | 545 | |
546 | 546 | case 'unilateral' : |
547 | 547 | |
548 | - $note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
548 | + $note = __('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
549 | 549 | |
550 | 550 | break; |
551 | 551 | |
552 | 552 | case 'upgrade' : |
553 | 553 | |
554 | - $note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
554 | + $note = __('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
555 | 555 | |
556 | 556 | break; |
557 | 557 | |
558 | 558 | case 'verify' : |
559 | 559 | |
560 | - $note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
560 | + $note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
561 | 561 | |
562 | 562 | break; |
563 | 563 | |
564 | 564 | case 'other' : |
565 | 565 | |
566 | - $note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
566 | + $note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
567 | 567 | |
568 | 568 | break; |
569 | 569 | |
@@ -581,49 +581,49 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @return mixed|string |
583 | 583 | */ |
584 | -function give_build_paypal_url( $payment_id, $payment_data ) { |
|
584 | +function give_build_paypal_url($payment_id, $payment_data) { |
|
585 | 585 | // Only send to PayPal if the pending payment is created successfully. |
586 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
586 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
587 | 587 | |
588 | 588 | // Get the success url. |
589 | - $return_url = add_query_arg( array( |
|
589 | + $return_url = add_query_arg(array( |
|
590 | 590 | 'payment-confirmation' => 'paypal', |
591 | 591 | 'payment-id' => $payment_id, |
592 | 592 | |
593 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
593 | + ), get_permalink(give_get_option('success_page'))); |
|
594 | 594 | |
595 | 595 | // Get the PayPal redirect uri. |
596 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
596 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
597 | 597 | |
598 | 598 | // Item name. |
599 | - $item_name = give_build_paypal_item_title( $payment_data ); |
|
599 | + $item_name = give_build_paypal_item_title($payment_data); |
|
600 | 600 | |
601 | 601 | // Setup PayPal API params. |
602 | 602 | $paypal_args = array( |
603 | - 'business' => give_get_option( 'paypal_email', false ), |
|
603 | + 'business' => give_get_option('paypal_email', false), |
|
604 | 604 | 'first_name' => $payment_data['user_info']['first_name'], |
605 | 605 | 'last_name' => $payment_data['user_info']['last_name'], |
606 | 606 | 'email' => $payment_data['user_email'], |
607 | 607 | 'invoice' => $payment_data['purchase_key'], |
608 | 608 | 'amount' => $payment_data['price'], |
609 | - 'item_name' => stripslashes( $item_name ), |
|
609 | + 'item_name' => stripslashes($item_name), |
|
610 | 610 | 'no_shipping' => '1', |
611 | 611 | 'shipping' => '0', |
612 | 612 | 'no_note' => '1', |
613 | 613 | 'currency_code' => give_get_currency(), |
614 | - 'charset' => get_bloginfo( 'charset' ), |
|
614 | + 'charset' => get_bloginfo('charset'), |
|
615 | 615 | 'custom' => $payment_id, |
616 | 616 | 'rm' => '2', |
617 | 617 | 'return' => $return_url, |
618 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
618 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
619 | 619 | 'notify_url' => $listener_url, |
620 | 620 | 'page_style' => give_get_paypal_page_style(), |
621 | - 'cbt' => get_bloginfo( 'name' ), |
|
621 | + 'cbt' => get_bloginfo('name'), |
|
622 | 622 | 'bn' => 'givewp_SP', |
623 | 623 | ); |
624 | 624 | |
625 | 625 | // Add user address if present. |
626 | - if ( ! empty( $payment_data['user_info']['address'] ) ) { |
|
626 | + if ( ! empty($payment_data['user_info']['address'])) { |
|
627 | 627 | $default_address = array( |
628 | 628 | 'line1' => '', |
629 | 629 | 'line2' => '', |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | 'country' => '', |
634 | 634 | ); |
635 | 635 | |
636 | - $address = wp_parse_args( $payment_data['user_info']['address'], $default_address ); |
|
636 | + $address = wp_parse_args($payment_data['user_info']['address'], $default_address); |
|
637 | 637 | |
638 | 638 | $paypal_args['address1'] = $address['line1']; |
639 | 639 | $paypal_args['address2'] = $address['line2']; |
@@ -654,13 +654,13 @@ discard block |
||
654 | 654 | * @param array $paypal_args |
655 | 655 | * @param array $payment_data |
656 | 656 | */ |
657 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data ); |
|
657 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data); |
|
658 | 658 | |
659 | 659 | // Build query. |
660 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
660 | + $paypal_redirect .= http_build_query($paypal_args); |
|
661 | 661 | |
662 | 662 | // Fix for some sites that encode the entities. |
663 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
663 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
664 | 664 | |
665 | 665 | return $paypal_redirect; |
666 | 666 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | function give_get_paypal_button_type() { |
676 | 676 | // paypal_button_type can be donation or standard. |
677 | 677 | $paypal_button_type = '_donations'; |
678 | - if ( 'standard' === give_get_option( 'paypal_button_type' ) ) { |
|
678 | + if ('standard' === give_get_option('paypal_button_type')) { |
|
679 | 679 | $paypal_button_type = '_xclick'; |
680 | 680 | } |
681 | 681 | |
@@ -692,30 +692,30 @@ discard block |
||
692 | 692 | * |
693 | 693 | * @return string |
694 | 694 | */ |
695 | -function give_build_paypal_item_title( $payment_data ) { |
|
696 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
695 | +function give_build_paypal_item_title($payment_data) { |
|
696 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
697 | 697 | $item_name = $payment_data['post_data']['give-form-title']; |
698 | 698 | |
699 | 699 | // Verify has variable prices. |
700 | - if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) { |
|
700 | + if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) { |
|
701 | 701 | |
702 | - $item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
703 | - $price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
702 | + $item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']); |
|
703 | + $price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']); |
|
704 | 704 | |
705 | 705 | // Donation given doesn't match selected level (must be a custom amount). |
706 | - if ( $price_level_amount != give_maybe_sanitize_amount( $payment_data['price'] ) ) { |
|
707 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
706 | + if ($price_level_amount != give_maybe_sanitize_amount($payment_data['price'])) { |
|
707 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
708 | 708 | // user custom amount text if any, fallback to default if not. |
709 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) ); |
|
709 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give')); |
|
710 | 710 | |
711 | - } elseif ( ! empty( $item_price_level_text ) ) { |
|
712 | - $item_name .= ' - ' . $item_price_level_text; |
|
711 | + } elseif ( ! empty($item_price_level_text)) { |
|
712 | + $item_name .= ' - '.$item_price_level_text; |
|
713 | 713 | } |
714 | 714 | } // End if(). |
715 | - elseif ( give_get_form_price( $form_id ) !== give_maybe_sanitize_amount( $payment_data['price'] ) ) { |
|
716 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
715 | + elseif (give_get_form_price($form_id) !== give_maybe_sanitize_amount($payment_data['price'])) { |
|
716 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
717 | 717 | // user custom amount text if any, fallback to default if not. |
718 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) ); |
|
718 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give')); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | return $item_name; |
@@ -9,11 +9,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -9,11 +9,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
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'); |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
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' ) . '">★★★★★</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').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
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'); |
@@ -98,7 +98,7 @@ |
||
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. |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Get current page. |
55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
56 | 56 | |
57 | 57 | // Bailout. |
58 | 58 | if ( |
59 | - empty( $current_page ) |
|
60 | - || empty( $_GET['_wp_http_referer'] ) |
|
61 | - || ! in_array( $current_page, $give_pages ) |
|
59 | + empty($current_page) |
|
60 | + || empty($_GET['_wp_http_referer']) |
|
61 | + || ! in_array($current_page, $give_pages) |
|
62 | 62 | ) { |
63 | 63 | return false; |
64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @since 1.8 |
70 | 70 | */ |
71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
72 | 72 | |
73 | - if ( $redirect ) { |
|
73 | + if ($redirect) { |
|
74 | 74 | // Redirect. |
75 | 75 | wp_redirect( |
76 | 76 | remove_query_arg( |
77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
77 | + array('_wp_http_referer', '_wpnonce'), |
|
78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function give_hide_outdated_php_notice() { |
98 | 98 | |
99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
100 | 100 | give_die(); |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Transient key name. |
104 | 104 | $transient_key = "_give_hide_outdated_php_notices_shortly"; |
105 | 105 | |
106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
106 | + if (Give_Cache::get($transient_key, true)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Hide notice for 24 hours. |
111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
112 | 112 | |
113 | 113 | give_die(); |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Register admin notices. |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function _give_register_admin_notices() { |
125 | 125 | // Bailout. |
126 | - if ( ! is_admin() ) { |
|
126 | + if ( ! is_admin()) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Add payment bulk notice. |
131 | 131 | if ( |
132 | - current_user_can( 'edit_give_payments' ) |
|
133 | - && isset( $_GET['action'] ) |
|
134 | - && ! empty( $_GET['action'] ) |
|
135 | - && isset( $_GET['payment'] ) |
|
136 | - && ! empty( $_GET['payment'] ) |
|
132 | + current_user_can('edit_give_payments') |
|
133 | + && isset($_GET['action']) |
|
134 | + && ! empty($_GET['action']) |
|
135 | + && isset($_GET['payment']) |
|
136 | + && ! empty($_GET['payment']) |
|
137 | 137 | ) { |
138 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
138 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
139 | 139 | |
140 | - switch ( $_GET['action'] ) { |
|
140 | + switch ($_GET['action']) { |
|
141 | 141 | case 'delete': |
142 | - Give()->notices->register_notice( array( |
|
142 | + Give()->notices->register_notice(array( |
|
143 | 143 | 'id' => 'bulk_action_delete', |
144 | 144 | 'type' => 'updated', |
145 | 145 | 'description' => sprintf( |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | ), |
152 | 152 | $payment_count ), |
153 | 153 | 'show' => true, |
154 | - ) ); |
|
154 | + )); |
|
155 | 155 | |
156 | 156 | break; |
157 | 157 | |
158 | 158 | case 'resend-receipt': |
159 | - Give()->notices->register_notice( array( |
|
159 | + Give()->notices->register_notice(array( |
|
160 | 160 | 'id' => 'bulk_action_resend_receipt', |
161 | 161 | 'type' => 'updated', |
162 | 162 | 'description' => sprintf( |
@@ -169,196 +169,196 @@ discard block |
||
169 | 169 | $payment_count |
170 | 170 | ), |
171 | 171 | 'show' => true, |
172 | - ) ); |
|
172 | + )); |
|
173 | 173 | break; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | 177 | // Add give message notices. |
178 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
178 | + if ( ! empty($_GET['give-message'])) { |
|
179 | 179 | // Donation reports errors. |
180 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
181 | - switch ( $_GET['give-message'] ) { |
|
180 | + if (current_user_can('view_give_reports')) { |
|
181 | + switch ($_GET['give-message']) { |
|
182 | 182 | case 'donation_deleted' : |
183 | - Give()->notices->register_notice( array( |
|
183 | + Give()->notices->register_notice(array( |
|
184 | 184 | 'id' => 'give-donation-deleted', |
185 | 185 | 'type' => 'updated', |
186 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
186 | + 'description' => __('The donation has been deleted.', 'give'), |
|
187 | 187 | 'show' => true, |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | break; |
190 | 190 | case 'email_sent' : |
191 | - Give()->notices->register_notice( array( |
|
191 | + Give()->notices->register_notice(array( |
|
192 | 192 | 'id' => 'give-payment-sent', |
193 | 193 | 'type' => 'updated', |
194 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
194 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
195 | 195 | 'show' => true, |
196 | - ) ); |
|
196 | + )); |
|
197 | 197 | break; |
198 | 198 | case 'refreshed-reports' : |
199 | - Give()->notices->register_notice( array( |
|
199 | + Give()->notices->register_notice(array( |
|
200 | 200 | 'id' => 'give-refreshed-reports', |
201 | 201 | 'type' => 'updated', |
202 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
202 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
203 | 203 | 'show' => true, |
204 | - ) ); |
|
204 | + )); |
|
205 | 205 | break; |
206 | 206 | case 'donation-note-deleted' : |
207 | - Give()->notices->register_notice( array( |
|
207 | + Give()->notices->register_notice(array( |
|
208 | 208 | 'id' => 'give-donation-note-deleted', |
209 | 209 | 'type' => 'updated', |
210 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
210 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
211 | 211 | 'show' => true, |
212 | - ) ); |
|
212 | + )); |
|
213 | 213 | break; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Give settings notices and errors. |
218 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
219 | - switch ( $_GET['give-message'] ) { |
|
218 | + if (current_user_can('manage_give_settings')) { |
|
219 | + switch ($_GET['give-message']) { |
|
220 | 220 | case 'settings-imported' : |
221 | - Give()->notices->register_notice( array( |
|
221 | + Give()->notices->register_notice(array( |
|
222 | 222 | 'id' => 'give-settings-imported', |
223 | 223 | 'type' => 'updated', |
224 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
224 | + 'description' => __('The settings have been imported.', 'give'), |
|
225 | 225 | 'show' => true, |
226 | - ) ); |
|
226 | + )); |
|
227 | 227 | break; |
228 | 228 | case 'api-key-generated' : |
229 | - Give()->notices->register_notice( array( |
|
229 | + Give()->notices->register_notice(array( |
|
230 | 230 | 'id' => 'give-api-key-generated', |
231 | 231 | 'type' => 'updated', |
232 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
232 | + 'description' => __('API keys have been generated.', 'give'), |
|
233 | 233 | 'show' => true, |
234 | - ) ); |
|
234 | + )); |
|
235 | 235 | break; |
236 | 236 | case 'api-key-exists' : |
237 | - Give()->notices->register_notice( array( |
|
237 | + Give()->notices->register_notice(array( |
|
238 | 238 | 'id' => 'give-api-key-exists', |
239 | 239 | 'type' => 'updated', |
240 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
240 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
241 | 241 | 'show' => true, |
242 | - ) ); |
|
242 | + )); |
|
243 | 243 | break; |
244 | 244 | case 'api-key-regenerated' : |
245 | - Give()->notices->register_notice( array( |
|
245 | + Give()->notices->register_notice(array( |
|
246 | 246 | 'id' => 'give-api-key-regenerated', |
247 | 247 | 'type' => 'updated', |
248 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
248 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
249 | 249 | 'show' => true, |
250 | - ) ); |
|
250 | + )); |
|
251 | 251 | break; |
252 | 252 | case 'api-key-revoked' : |
253 | - Give()->notices->register_notice( array( |
|
253 | + Give()->notices->register_notice(array( |
|
254 | 254 | 'id' => 'give-api-key-revoked', |
255 | 255 | 'type' => 'updated', |
256 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
256 | + 'description' => __('API keys have been revoked.', 'give'), |
|
257 | 257 | 'show' => true, |
258 | - ) ); |
|
258 | + )); |
|
259 | 259 | break; |
260 | 260 | case 'sent-test-email' : |
261 | - Give()->notices->register_notice( array( |
|
261 | + Give()->notices->register_notice(array( |
|
262 | 262 | 'id' => 'give-sent-test-email', |
263 | 263 | 'type' => 'updated', |
264 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
264 | + 'description' => __('The test email has been sent.', 'give'), |
|
265 | 265 | 'show' => true, |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | break; |
268 | 268 | case 'matched-success-failure-page': |
269 | - Give()->notices->register_notice( array( |
|
269 | + Give()->notices->register_notice(array( |
|
270 | 270 | 'id' => 'give-matched-success-failure-page', |
271 | 271 | 'type' => 'updated', |
272 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
272 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
273 | 273 | 'show' => true, |
274 | - ) ); |
|
274 | + )); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | // Payments errors. |
279 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
280 | - switch ( $_GET['give-message'] ) { |
|
279 | + if (current_user_can('edit_give_payments')) { |
|
280 | + switch ($_GET['give-message']) { |
|
281 | 281 | case 'note-added' : |
282 | - Give()->notices->register_notice( array( |
|
282 | + Give()->notices->register_notice(array( |
|
283 | 283 | 'id' => 'give-note-added', |
284 | 284 | 'type' => 'updated', |
285 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
285 | + 'description' => __('The donation note has been added.', 'give'), |
|
286 | 286 | 'show' => true, |
287 | - ) ); |
|
287 | + )); |
|
288 | 288 | break; |
289 | 289 | case 'payment-updated' : |
290 | - Give()->notices->register_notice( array( |
|
290 | + Give()->notices->register_notice(array( |
|
291 | 291 | 'id' => 'give-payment-updated', |
292 | 292 | 'type' => 'updated', |
293 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
293 | + 'description' => __('The donation has been updated.', 'give'), |
|
294 | 294 | 'show' => true, |
295 | - ) ); |
|
295 | + )); |
|
296 | 296 | break; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | 300 | // Donor Notices. |
301 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
302 | - switch ( $_GET['give-message'] ) { |
|
301 | + if (current_user_can('edit_give_payments')) { |
|
302 | + switch ($_GET['give-message']) { |
|
303 | 303 | case 'donor-deleted' : |
304 | - Give()->notices->register_notice( array( |
|
304 | + Give()->notices->register_notice(array( |
|
305 | 305 | 'id' => 'give-donor-deleted', |
306 | 306 | 'type' => 'updated', |
307 | - 'description' => __( 'The donor has been deleted.', 'give' ), |
|
307 | + 'description' => __('The donor has been deleted.', 'give'), |
|
308 | 308 | 'show' => true, |
309 | - ) ); |
|
309 | + )); |
|
310 | 310 | break; |
311 | 311 | |
312 | 312 | case 'email-added' : |
313 | - Give()->notices->register_notice( array( |
|
313 | + Give()->notices->register_notice(array( |
|
314 | 314 | 'id' => 'give-donor-email-added', |
315 | 315 | 'type' => 'updated', |
316 | - 'description' => __( 'Donor email added.', 'give' ), |
|
316 | + 'description' => __('Donor email added.', 'give'), |
|
317 | 317 | 'show' => true, |
318 | - ) ); |
|
318 | + )); |
|
319 | 319 | break; |
320 | 320 | |
321 | 321 | case 'email-removed' : |
322 | - Give()->notices->register_notice( array( |
|
322 | + Give()->notices->register_notice(array( |
|
323 | 323 | 'id' => 'give-donor-email-removed', |
324 | 324 | 'type' => 'updated', |
325 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
325 | + 'description' => __('Donor email removed.', 'give'), |
|
326 | 326 | 'show' => true, |
327 | - ) ); |
|
327 | + )); |
|
328 | 328 | break; |
329 | 329 | |
330 | 330 | case 'email-remove-failed' : |
331 | - Give()->notices->register_notice( array( |
|
331 | + Give()->notices->register_notice(array( |
|
332 | 332 | 'id' => 'give-donor-email-remove-failed', |
333 | 333 | 'type' => 'updated', |
334 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
334 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
335 | 335 | 'show' => true, |
336 | - ) ); |
|
336 | + )); |
|
337 | 337 | break; |
338 | 338 | |
339 | 339 | case 'primary-email-updated' : |
340 | - Give()->notices->register_notice( array( |
|
340 | + Give()->notices->register_notice(array( |
|
341 | 341 | 'id' => 'give-donor-primary-email-updated', |
342 | 342 | 'type' => 'updated', |
343 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
343 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
344 | 344 | 'show' => true, |
345 | - ) ); |
|
345 | + )); |
|
346 | 346 | break; |
347 | 347 | |
348 | 348 | case 'primary-email-failed' : |
349 | - Give()->notices->register_notice( array( |
|
349 | + Give()->notices->register_notice(array( |
|
350 | 350 | 'id' => 'give-donor-primary-email-failed', |
351 | 351 | 'type' => 'updated', |
352 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
352 | + 'description' => __('Failed to set primary email.', 'give'), |
|
353 | 353 | 'show' => true, |
354 | - ) ); |
|
354 | + )); |
|
355 | 355 | break; |
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
361 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
361 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
362 | 362 | |
363 | 363 | |
364 | 364 | /** |
@@ -368,31 +368,30 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return bool |
370 | 370 | */ |
371 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
372 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
373 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
374 | - give_is_test_mode(); |
|
371 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
372 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
373 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
375 | 374 | |
376 | 375 | if ( |
377 | - ! current_user_can( 'view_give_reports' ) || |
|
376 | + ! current_user_can('view_give_reports') || |
|
378 | 377 | ! $is_test_mode |
379 | 378 | ) { |
380 | 379 | return false; |
381 | 380 | } |
382 | 381 | |
383 | 382 | // Add the main siteadmin menu item. |
384 | - $wp_admin_bar->add_menu( array( |
|
383 | + $wp_admin_bar->add_menu(array( |
|
385 | 384 | 'id' => 'give-test-notice', |
386 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
385 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
387 | 386 | 'parent' => 'top-secondary', |
388 | - 'title' => esc_html__( 'Give Test Mode Active', 'give' ), |
|
389 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
390 | - ) ); |
|
387 | + 'title' => esc_html__('Give Test Mode Active', 'give'), |
|
388 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
389 | + )); |
|
391 | 390 | |
392 | 391 | return true; |
393 | 392 | } |
394 | 393 | |
395 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
394 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
396 | 395 | |
397 | 396 | /** |
398 | 397 | * Add Link to Import page in from donation archive and donation single page |
@@ -401,13 +400,13 @@ discard block |
||
401 | 400 | */ |
402 | 401 | function give_import_page_link_callback() { |
403 | 402 | ?> |
404 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
405 | - class="page-import-action page-title-action"><?php esc_html_e( 'Import Donations', 'give' ); ?></a> |
|
403 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
404 | + class="page-import-action page-title-action"><?php esc_html_e('Import Donations', 'give'); ?></a> |
|
406 | 405 | |
407 | 406 | <style type="text/css"> |
408 | 407 | <?php |
409 | 408 | // Check if view donation single page only. |
410 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
409 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
411 | 410 | ?> |
412 | 411 | .wrap #transaction-details-heading { |
413 | 412 | display: inline-block; |
@@ -429,7 +428,7 @@ discard block |
||
429 | 428 | } |
430 | 429 | |
431 | 430 | |
432 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
431 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
433 | 432 | |
434 | 433 | /** |
435 | 434 | * Load donation import ajax callback |
@@ -441,9 +440,9 @@ discard block |
||
441 | 440 | */ |
442 | 441 | function give_donation_import_callback() { |
443 | 442 | $import_setting = array(); |
444 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
443 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
445 | 444 | |
446 | - parse_str( $fields ); |
|
445 | + parse_str($fields); |
|
447 | 446 | |
448 | 447 | $import_setting['create_user'] = $create_user; |
449 | 448 | $import_setting['mode'] = $mode; |
@@ -452,54 +451,54 @@ discard block |
||
452 | 451 | $import_setting['delete_csv'] = $delete_csv; |
453 | 452 | |
454 | 453 | // Parent key id. |
455 | - $main_key = maybe_unserialize( $main_key ); |
|
456 | - |
|
457 | - $current = absint( $_REQUEST['current'] ); |
|
458 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
459 | - $start = absint( $_REQUEST['start'] ); |
|
460 | - $end = absint( $_REQUEST['end'] ); |
|
461 | - $next = absint( $_REQUEST['next'] ); |
|
462 | - $total = absint( $_REQUEST['total'] ); |
|
463 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
464 | - if ( empty( $delimiter ) ) { |
|
454 | + $main_key = maybe_unserialize($main_key); |
|
455 | + |
|
456 | + $current = absint($_REQUEST['current']); |
|
457 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
458 | + $start = absint($_REQUEST['start']); |
|
459 | + $end = absint($_REQUEST['end']); |
|
460 | + $next = absint($_REQUEST['next']); |
|
461 | + $total = absint($_REQUEST['total']); |
|
462 | + $per_page = absint($_REQUEST['per_page']); |
|
463 | + if (empty($delimiter)) { |
|
465 | 464 | $delimiter = ','; |
466 | 465 | } |
467 | 466 | |
468 | 467 | // processing done here. |
469 | - $raw_data = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter ); |
|
470 | - $raw_key = maybe_unserialize( $mapto ); |
|
468 | + $raw_data = give_get_donation_data_from_csv($csv, $start, $end, $delimiter); |
|
469 | + $raw_key = maybe_unserialize($mapto); |
|
471 | 470 | |
472 | 471 | //Prevent normal emails |
473 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
474 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
475 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
472 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
473 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
474 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
476 | 475 | |
477 | - foreach ( $raw_data as $row_data ) { |
|
478 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
476 | + foreach ($raw_data as $row_data) { |
|
477 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
479 | 478 | } |
480 | 479 | |
481 | 480 | // Check if function exists or not. |
482 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
483 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
481 | + if (function_exists('give_payment_save_page_data')) { |
|
482 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
484 | 483 | } |
485 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
486 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
484 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
485 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
487 | 486 | |
488 | - if ( $next == false ) { |
|
487 | + if ($next == false) { |
|
489 | 488 | $json_data = array( |
490 | 489 | 'success' => true, |
491 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
490 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
492 | 491 | ); |
493 | 492 | } else { |
494 | 493 | $index_start = $start; |
495 | 494 | $index_end = $end; |
496 | 495 | $last = false; |
497 | 496 | $next = true; |
498 | - if ( $next ) { |
|
497 | + if ($next) { |
|
499 | 498 | $index_start = $index_start + $per_page; |
500 | - $index_end = $per_page + ( $index_start - 1 ); |
|
499 | + $index_end = $per_page + ($index_start - 1); |
|
501 | 500 | } |
502 | - if ( $index_end >= $total ) { |
|
501 | + if ($index_end >= $total) { |
|
503 | 502 | $index_end = $total; |
504 | 503 | $last = true; |
505 | 504 | } |
@@ -513,26 +512,26 @@ discard block |
||
513 | 512 | ); |
514 | 513 | } |
515 | 514 | |
516 | - $url = give_import_page_url( array( |
|
515 | + $url = give_import_page_url(array( |
|
517 | 516 | 'step' => '4', |
518 | 517 | 'csv' => $csv, |
519 | 518 | 'total' => $total, |
520 | 519 | 'delete_csv' => $import_setting['delete_csv'], |
521 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
522 | - ) ); |
|
520 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
521 | + )); |
|
523 | 522 | $json_data['url'] = $url; |
524 | 523 | |
525 | - $current ++; |
|
524 | + $current++; |
|
526 | 525 | $json_data['current'] = $current; |
527 | 526 | |
528 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
527 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
529 | 528 | $json_data['percentage'] = $percentage; |
530 | 529 | |
531 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
532 | - wp_die( json_encode( $json_data ) ); |
|
530 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
531 | + wp_die(json_encode($json_data)); |
|
533 | 532 | } |
534 | 533 | |
535 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
534 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
536 | 535 | |
537 | 536 | |
538 | 537 | /** |
@@ -545,7 +544,7 @@ discard block |
||
545 | 544 | $blank_slate->init(); |
546 | 545 | } |
547 | 546 | |
548 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
547 | +add_action('current_screen', 'give_blank_slate'); |
|
549 | 548 | |
550 | 549 | /** |
551 | 550 | * Get Array of WP User Roles. |
@@ -558,8 +557,8 @@ discard block |
||
558 | 557 | $user_roles = array(); |
559 | 558 | |
560 | 559 | // Loop through User Roles. |
561 | - foreach ( get_editable_roles() as $role_name => $role_info ): |
|
562 | - $user_roles[ $role_name ] = $role_info['name']; |
|
560 | + foreach (get_editable_roles() as $role_name => $role_info): |
|
561 | + $user_roles[$role_name] = $role_info['name']; |
|
563 | 562 | endforeach; |
564 | 563 | |
565 | 564 | return $user_roles; |
@@ -463,7 +463,7 @@ |
||
463 | 463 | * @since 1.7 |
464 | 464 | * @access public |
465 | 465 | * |
466 | - * @return bool |
|
466 | + * @return false|null |
|
467 | 467 | */ |
468 | 468 | public function delete_cache() { |
469 | 469 | global $wpdb; |
@@ -10,7 +10,7 @@ discard block |
||
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 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __setup_hooks() { |
45 | 45 | // Create the log post type |
46 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
46 | + add_action('init', array($this, 'register_post_type'), 1); |
|
47 | 47 | |
48 | 48 | // Create types taxonomy and default types |
49 | - add_action( 'init', array( $this, 'register_taxonomy' ), 1 ); |
|
49 | + add_action('init', array($this, 'register_taxonomy'), 1); |
|
50 | 50 | |
51 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) ); |
|
52 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) ); |
|
53 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) ); |
|
54 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) ); |
|
51 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
52 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
53 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
54 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /* Logs post type */ |
69 | 69 | $log_args = array( |
70 | 70 | 'labels' => array( |
71 | - 'name' => esc_html__( 'Logs', 'give' ), |
|
71 | + 'name' => esc_html__('Logs', 'give'), |
|
72 | 72 | ), |
73 | 73 | 'public' => false, |
74 | 74 | 'exclude_from_search' => true, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | 'query_var' => false, |
78 | 78 | 'rewrite' => false, |
79 | 79 | 'capability_type' => 'post', |
80 | - 'supports' => array( 'title', 'editor' ), |
|
80 | + 'supports' => array('title', 'editor'), |
|
81 | 81 | 'can_export' => true, |
82 | 82 | ); |
83 | 83 | |
84 | - register_post_type( 'give_log', $log_args ); |
|
84 | + register_post_type('give_log', $log_args); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | public function register_taxonomy() { |
98 | - register_taxonomy( 'give_log_type', 'give_log', array( |
|
98 | + register_taxonomy('give_log_type', 'give_log', array( |
|
99 | 99 | 'public' => false, |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'api_request', |
118 | 118 | ); |
119 | 119 | |
120 | - return apply_filters( 'give_log_types', $terms ); |
|
120 | + return apply_filters('give_log_types', $terms); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool Whether log type is valid. |
134 | 134 | */ |
135 | - public function valid_type( $type ) { |
|
136 | - return in_array( $type, $this->log_types() ); |
|
135 | + public function valid_type($type) { |
|
136 | + return in_array($type, $this->log_types()); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return int Log ID. |
154 | 154 | */ |
155 | - public function add( $title = '', $message = '', $parent = 0, $type = null ) { |
|
155 | + public function add($title = '', $message = '', $parent = 0, $type = null) { |
|
156 | 156 | $log_data = array( |
157 | 157 | 'post_title' => $title, |
158 | 158 | 'post_content' => $message, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'log_type' => $type, |
161 | 161 | ); |
162 | 162 | |
163 | - return $this->insert_log( $log_data ); |
|
163 | + return $this->insert_log($log_data); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return array An array of the connected logs. |
179 | 179 | */ |
180 | - public function get_logs( $object_id = 0, $type = null, $paged = null ) { |
|
181 | - return $this->get_connected_logs( array( |
|
180 | + public function get_logs($object_id = 0, $type = null, $paged = null) { |
|
181 | + return $this->get_connected_logs(array( |
|
182 | 182 | 'post_parent' => $object_id, |
183 | 183 | 'paged' => $paged, |
184 | 184 | 'log_type' => $type, |
185 | - ) ); |
|
185 | + )); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return int The ID of the newly created log item. |
198 | 198 | */ |
199 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
199 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
200 | 200 | $defaults = array( |
201 | 201 | 'post_type' => 'give_log', |
202 | 202 | 'post_status' => 'publish', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'log_type' => false, |
206 | 206 | ); |
207 | 207 | |
208 | - $args = wp_parse_args( $log_data, $defaults ); |
|
208 | + $args = wp_parse_args($log_data, $defaults); |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Fires before inserting log entry. |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @param array $log_data Log entry data. |
216 | 216 | * @param array $log_meta Log entry meta. |
217 | 217 | */ |
218 | - do_action( 'give_pre_insert_log', $log_data, $log_meta ); |
|
218 | + do_action('give_pre_insert_log', $log_data, $log_meta); |
|
219 | 219 | |
220 | 220 | // Store the log entry |
221 | - $log_id = wp_insert_post( $args ); |
|
221 | + $log_id = wp_insert_post($args); |
|
222 | 222 | |
223 | 223 | // Set the log type, if any |
224 | - if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) { |
|
225 | - wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false ); |
|
224 | + if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) { |
|
225 | + wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Set log meta, if any |
229 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
230 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
231 | - give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
229 | + if ($log_id && ! empty($log_meta)) { |
|
230 | + foreach ((array) $log_meta as $key => $meta) { |
|
231 | + give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $log_data Log entry data. |
242 | 242 | * @param array $log_meta Log entry meta. |
243 | 243 | */ |
244 | - do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta ); |
|
244 | + do_action('give_post_insert_log', $log_id, $log_data, $log_meta); |
|
245 | 245 | |
246 | 246 | return $log_id; |
247 | 247 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return bool|null True if successful, false otherwise. |
259 | 259 | */ |
260 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
260 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Fires before updating log entry. |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param array $log_data Log entry data. |
268 | 268 | * @param array $log_meta Log entry meta. |
269 | 269 | */ |
270 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
270 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
271 | 271 | |
272 | 272 | $defaults = array( |
273 | 273 | 'post_type' => 'give_log', |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | 'post_parent' => 0, |
276 | 276 | ); |
277 | 277 | |
278 | - $args = wp_parse_args( $log_data, $defaults ); |
|
278 | + $args = wp_parse_args($log_data, $defaults); |
|
279 | 279 | |
280 | 280 | // Store the log entry |
281 | - $log_id = wp_update_post( $args ); |
|
281 | + $log_id = wp_update_post($args); |
|
282 | 282 | |
283 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
284 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
285 | - if ( ! empty( $meta ) ) { |
|
286 | - give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
283 | + if ($log_id && ! empty($log_meta)) { |
|
284 | + foreach ((array) $log_meta as $key => $meta) { |
|
285 | + if ( ! empty($meta)) { |
|
286 | + give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param array $log_data Log entry data. |
298 | 298 | * @param array $log_meta Log entry meta. |
299 | 299 | */ |
300 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
300 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return array|false Array if logs were found, false otherwise. |
314 | 314 | */ |
315 | - public function get_connected_logs( $args = array() ) { |
|
315 | + public function get_connected_logs($args = array()) { |
|
316 | 316 | |
317 | 317 | $defaults = array( |
318 | 318 | 'post_type' => 'give_log', |
319 | 319 | 'posts_per_page' => 20, |
320 | 320 | 'post_status' => 'publish', |
321 | - 'paged' => get_query_var( 'paged' ), |
|
321 | + 'paged' => get_query_var('paged'), |
|
322 | 322 | 'log_type' => false, |
323 | 323 | 'date_query' => null |
324 | 324 | ); |
325 | 325 | |
326 | - $query_args = wp_parse_args( $args, $defaults ); |
|
326 | + $query_args = wp_parse_args($args, $defaults); |
|
327 | 327 | |
328 | - if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) { |
|
328 | + if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) { |
|
329 | 329 | $query_args['tax_query'] = array( |
330 | 330 | array( |
331 | 331 | 'taxonomy' => 'give_log_type', |
@@ -336,28 +336,28 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | // Retrieve logs based on specific timeframe |
339 | - if ( !empty ( $query_args['date_query'] ) && is_array( $query_args['date_query'] ) ) { |
|
340 | - if ( ! empty( $query_args['date_query']['start_date'] ) ) { |
|
341 | - $query_args['date_query']['after'] = array( |
|
342 | - 'year' => date( 'Y', strtotime( $query_args['date_query']['start_date'] ) ), |
|
343 | - 'month' => date( 'm', strtotime( $query_args['date_query']['start_date'] ) ), |
|
344 | - 'day' => date( 'd', strtotime( $query_args['date_query']['start_date'] ) ) |
|
339 | + if ( ! empty ($query_args['date_query']) && is_array($query_args['date_query'])) { |
|
340 | + if ( ! empty($query_args['date_query']['start_date'])) { |
|
341 | + $query_args['date_query']['after'] = array( |
|
342 | + 'year' => date('Y', strtotime($query_args['date_query']['start_date'])), |
|
343 | + 'month' => date('m', strtotime($query_args['date_query']['start_date'])), |
|
344 | + 'day' => date('d', strtotime($query_args['date_query']['start_date'])) |
|
345 | 345 | ); |
346 | 346 | } |
347 | 347 | |
348 | - if ( ! empty( $query_args['date_query']['end_date'] ) ) { |
|
349 | - $query_args['date_query']['before'] = array( |
|
350 | - 'year' => date( 'Y', strtotime( $query_args['date_query']['end_date'] ) ), |
|
351 | - 'month' => date( 'm', strtotime( $query_args['date_query']['end_date'] ) ), |
|
352 | - 'day' => date( 'd', strtotime( $query_args['date_query']['end_date'] ) ) |
|
348 | + if ( ! empty($query_args['date_query']['end_date'])) { |
|
349 | + $query_args['date_query']['before'] = array( |
|
350 | + 'year' => date('Y', strtotime($query_args['date_query']['end_date'])), |
|
351 | + 'month' => date('m', strtotime($query_args['date_query']['end_date'])), |
|
352 | + 'day' => date('d', strtotime($query_args['date_query']['end_date'])) |
|
353 | 353 | ); |
354 | 354 | } |
355 | 355 | $query_args['date_query']['inclusive'] = true; |
356 | 356 | } |
357 | 357 | |
358 | - $logs = get_posts( $query_args ); |
|
358 | + $logs = get_posts($query_args); |
|
359 | 359 | |
360 | - if ( $logs ) { |
|
360 | + if ($logs) { |
|
361 | 361 | return $logs; |
362 | 362 | } |
363 | 363 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return int Log count. |
382 | 382 | */ |
383 | - public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) { |
|
383 | + public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) { |
|
384 | 384 | |
385 | 385 | $query_args = array( |
386 | 386 | 'post_type' => 'give_log', |
387 | - 'posts_per_page' => - 1, |
|
387 | + 'posts_per_page' => -1, |
|
388 | 388 | 'post_status' => 'publish', |
389 | 389 | 'fields' => 'ids', |
390 | 390 | ); |
391 | 391 | |
392 | - if ( $object_id ) { |
|
392 | + if ($object_id) { |
|
393 | 393 | $query_args['post_parent'] = $object_id; |
394 | 394 | } |
395 | 395 | |
396 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
396 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
397 | 397 | $query_args['tax_query'] = array( |
398 | 398 | array( |
399 | 399 | 'taxonomy' => 'give_log_type', |
@@ -403,24 +403,24 @@ discard block |
||
403 | 403 | ); |
404 | 404 | } |
405 | 405 | |
406 | - if ( ! empty( $meta_query ) ) { |
|
406 | + if ( ! empty($meta_query)) { |
|
407 | 407 | $query_args['meta_query'] = $meta_query; |
408 | 408 | } |
409 | 409 | |
410 | - if ( ! empty( $date_query ) ) { |
|
410 | + if ( ! empty($date_query)) { |
|
411 | 411 | $query_args['date_query'] = $date_query; |
412 | 412 | } |
413 | 413 | |
414 | 414 | // Get cache key for current query. |
415 | - $cache_key = Give_Cache::get_key( 'get_log_count', $query_args ); |
|
415 | + $cache_key = Give_Cache::get_key('get_log_count', $query_args); |
|
416 | 416 | |
417 | 417 | // check if cache already exist or not. |
418 | - if ( ! ( $logs_count = Give_Cache::get( $cache_key ) ) ) { |
|
419 | - $logs = new WP_Query( $query_args ); |
|
418 | + if ( ! ($logs_count = Give_Cache::get($cache_key))) { |
|
419 | + $logs = new WP_Query($query_args); |
|
420 | 420 | $logs_count = (int) $logs->post_count; |
421 | 421 | |
422 | 422 | // Cache results. |
423 | - Give_Cache::set( $cache_key, $logs_count ); |
|
423 | + Give_Cache::set($cache_key, $logs_count); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | return $logs_count; |
@@ -440,16 +440,16 @@ discard block |
||
440 | 440 | * |
441 | 441 | * @return void |
442 | 442 | */ |
443 | - public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) { |
|
443 | + public function delete_logs($object_id = 0, $type = null, $meta_query = null) { |
|
444 | 444 | $query_args = array( |
445 | 445 | 'post_parent' => $object_id, |
446 | 446 | 'post_type' => 'give_log', |
447 | - 'posts_per_page' => - 1, |
|
447 | + 'posts_per_page' => -1, |
|
448 | 448 | 'post_status' => 'publish', |
449 | 449 | 'fields' => 'ids', |
450 | 450 | ); |
451 | 451 | |
452 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
452 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
453 | 453 | $query_args['tax_query'] = array( |
454 | 454 | array( |
455 | 455 | 'taxonomy' => 'give_log_type', |
@@ -459,15 +459,15 @@ discard block |
||
459 | 459 | ); |
460 | 460 | } |
461 | 461 | |
462 | - if ( ! empty( $meta_query ) ) { |
|
462 | + if ( ! empty($meta_query)) { |
|
463 | 463 | $query_args['meta_query'] = $meta_query; |
464 | 464 | } |
465 | 465 | |
466 | - $logs = get_posts( $query_args ); |
|
466 | + $logs = get_posts($query_args); |
|
467 | 467 | |
468 | - if ( $logs ) { |
|
469 | - foreach ( $logs as $log ) { |
|
470 | - wp_delete_post( $log, true ); |
|
468 | + if ($logs) { |
|
469 | + foreach ($logs as $log) { |
|
470 | + wp_delete_post($log, true); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param int $post_id |
482 | 482 | */ |
483 | - public function background_process_delete_cache( $post_id ) { |
|
483 | + public function background_process_delete_cache($post_id) { |
|
484 | 484 | // Delete log cache immediately |
485 | - wp_schedule_single_event( time() - 5, 'give_delete_log_cache' ); |
|
485 | + wp_schedule_single_event(time() - 5, 'give_delete_log_cache'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | ); |
511 | 511 | |
512 | 512 | // Bailout. |
513 | - if ( empty( $cache_option_names ) ) { |
|
513 | + if (empty($cache_option_names)) { |
|
514 | 514 | return false; |
515 | 515 | } |
516 | 516 | |
517 | - Give_Cache::delete( $cache_option_names ); |
|
517 | + Give_Cache::delete($cache_option_names); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @return int ID of the new log entry. |
538 | 538 | */ |
539 | -function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) { |
|
539 | +function give_record_log($title = '', $message = '', $parent = 0, $type = null) { |
|
540 | 540 | /* @var Give_Logging $give_logs */ |
541 | 541 | global $give_logs; |
542 | - $log = $give_logs->add( $title, $message, $parent, $type ); |
|
542 | + $log = $give_logs->add($title, $message, $parent, $type); |
|
543 | 543 | |
544 | 544 | return $log; |
545 | 545 | } |
@@ -530,7 +530,7 @@ |
||
530 | 530 | * |
531 | 531 | * @param int $payment_id |
532 | 532 | * |
533 | - * @return int payment_id |
|
533 | + * @return string payment_id |
|
534 | 534 | */ |
535 | 535 | function give_email_tag_payment_id( $payment_id ) { |
536 | 536 | $payment = new Give_Payment( $payment_id ); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param string $description Email tag description text |
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | */ |
58 | - public function add( $tag, $description, $func ) { |
|
59 | - if ( is_callable( $func ) ) { |
|
60 | - $this->tags[ $tag ] = array( |
|
58 | + public function add($tag, $description, $func) { |
|
59 | + if (is_callable($func)) { |
|
60 | + $this->tags[$tag] = array( |
|
61 | 61 | 'tag' => $tag, |
62 | 62 | 'description' => $description, |
63 | 63 | 'func' => $func, |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param string $tag Email tag to remove hook from |
74 | 74 | */ |
75 | - public function remove( $tag ) { |
|
76 | - unset( $this->tags[ $tag ] ); |
|
75 | + public function remove($tag) { |
|
76 | + unset($this->tags[$tag]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public function email_tag_exists( $tag ) { |
|
89 | - return array_key_exists( $tag, $this->tags ); |
|
88 | + public function email_tag_exists($tag) { |
|
89 | + return array_key_exists($tag, $this->tags); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Content with email tags filtered out. |
112 | 112 | */ |
113 | - public function do_tags( $content, $payment_id ) { |
|
113 | + public function do_tags($content, $payment_id) { |
|
114 | 114 | |
115 | 115 | // Check if there is at least one tag added. |
116 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
116 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
117 | 117 | return $content; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->payment_id = $payment_id; |
121 | 121 | |
122 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
122 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
123 | 123 | |
124 | 124 | $this->payment_id = null; |
125 | 125 | |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function do_tag( $m ) { |
|
138 | + public function do_tag($m) { |
|
139 | 139 | |
140 | 140 | // Get tag |
141 | 141 | $tag = $m[1]; |
142 | 142 | |
143 | 143 | // Return tag if tag not set |
144 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
144 | + if ( ! $this->email_tag_exists($tag)) { |
|
145 | 145 | return $m[0]; |
146 | 146 | } |
147 | 147 | |
148 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); |
|
148 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | * @param string $description Description of the email tag added |
160 | 160 | * @param callable $func Hook to run when email tag is found |
161 | 161 | */ |
162 | -function give_add_email_tag( $tag, $description, $func ) { |
|
163 | - Give()->email_tags->add( $tag, $description, $func ); |
|
162 | +function give_add_email_tag($tag, $description, $func) { |
|
163 | + Give()->email_tags->add($tag, $description, $func); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param string $tag Email tag to remove hook from |
172 | 172 | */ |
173 | -function give_remove_email_tag( $tag ) { |
|
174 | - Give()->email_tags->remove( $tag ); |
|
173 | +function give_remove_email_tag($tag) { |
|
174 | + Give()->email_tags->remove($tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return bool |
185 | 185 | */ |
186 | -function give_email_tag_exists( $tag ) { |
|
187 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
186 | +function give_email_tag_exists($tag) { |
|
187 | + return Give()->email_tags->email_tag_exists($tag); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $email_tags = give_get_email_tags(); |
212 | 212 | |
213 | 213 | ob_start(); |
214 | - if ( count( $email_tags ) > 0 ) : ?> |
|
214 | + if (count($email_tags) > 0) : ?> |
|
215 | 215 | <div class="give-email-tags-wrap"> |
216 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
216 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
217 | 217 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
218 | 218 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
219 | 219 | </span> |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string Content with email tags filtered out. |
237 | 237 | */ |
238 | -function give_do_email_tags( $content, $payment_id ) { |
|
238 | +function give_do_email_tags($content, $payment_id) { |
|
239 | 239 | |
240 | 240 | // Replace all tags |
241 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
241 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
242 | 242 | |
243 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
243 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
244 | 244 | |
245 | 245 | // Return content |
246 | 246 | return $content; |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @since 1.0 |
261 | 261 | */ |
262 | - do_action( 'give_add_email_tags' ); |
|
262 | + do_action('give_add_email_tags'); |
|
263 | 263 | } |
264 | 264 | |
265 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
265 | +add_action('init', 'give_load_email_tags', - 999); |
|
266 | 266 | |
267 | 267 | |
268 | 268 | /** |
@@ -276,97 +276,97 @@ discard block |
||
276 | 276 | $email_tags = array( |
277 | 277 | array( |
278 | 278 | 'tag' => 'donation', |
279 | - 'description' => __( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
279 | + 'description' => __('The donation form name, and the donation level (if applicable).', 'give'), |
|
280 | 280 | 'function' => 'give_email_tag_donation', |
281 | 281 | ), |
282 | 282 | array( |
283 | 283 | 'tag' => 'form_title', |
284 | - 'description' => __( 'The donation form name.', 'give' ), |
|
284 | + 'description' => __('The donation form name.', 'give'), |
|
285 | 285 | 'function' => 'give_email_tag_form_title', |
286 | 286 | ), |
287 | 287 | array( |
288 | 288 | 'tag' => 'amount', |
289 | - 'description' => __( 'The total donation amount with currency sign.', 'give' ), |
|
289 | + 'description' => __('The total donation amount with currency sign.', 'give'), |
|
290 | 290 | 'function' => 'give_email_tag_amount', |
291 | 291 | ), |
292 | 292 | array( |
293 | 293 | 'tag' => 'price', |
294 | - 'description' => __( 'The total donation amount with currency sign.', 'give' ), |
|
294 | + 'description' => __('The total donation amount with currency sign.', 'give'), |
|
295 | 295 | 'function' => 'give_email_tag_price', |
296 | 296 | ), |
297 | 297 | array( |
298 | 298 | 'tag' => 'name', |
299 | - 'description' => __( 'The donor\'s first name.', 'give' ), |
|
299 | + 'description' => __('The donor\'s first name.', 'give'), |
|
300 | 300 | 'function' => 'give_email_tag_first_name', |
301 | 301 | ), |
302 | 302 | array( |
303 | 303 | 'tag' => 'fullname', |
304 | - 'description' => __( 'The donor\'s full name, first and last.', 'give' ), |
|
304 | + 'description' => __('The donor\'s full name, first and last.', 'give'), |
|
305 | 305 | 'function' => 'give_email_tag_fullname', |
306 | 306 | ), |
307 | 307 | array( |
308 | 308 | 'tag' => 'username', |
309 | - 'description' => __( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
309 | + 'description' => __('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
310 | 310 | 'function' => 'give_email_tag_username', |
311 | 311 | ), |
312 | 312 | array( |
313 | 313 | 'tag' => 'user_email', |
314 | - 'description' => __( 'The donor\'s email address.', 'give' ), |
|
314 | + 'description' => __('The donor\'s email address.', 'give'), |
|
315 | 315 | 'function' => 'give_email_tag_user_email', |
316 | 316 | ), |
317 | 317 | array( |
318 | 318 | 'tag' => 'billing_address', |
319 | - 'description' => __( 'The donor\'s billing address.', 'give' ), |
|
319 | + 'description' => __('The donor\'s billing address.', 'give'), |
|
320 | 320 | 'function' => 'give_email_tag_billing_address', |
321 | 321 | ), |
322 | 322 | array( |
323 | 323 | 'tag' => 'date', |
324 | - 'description' => __( 'The date of the donation.', 'give' ), |
|
324 | + 'description' => __('The date of the donation.', 'give'), |
|
325 | 325 | 'function' => 'give_email_tag_date', |
326 | 326 | ), |
327 | 327 | array( |
328 | 328 | 'tag' => 'payment_id', |
329 | - 'description' => __( 'The unique ID number for this donation.', 'give' ), |
|
329 | + 'description' => __('The unique ID number for this donation.', 'give'), |
|
330 | 330 | 'function' => 'give_email_tag_payment_id', |
331 | 331 | ), |
332 | 332 | array( |
333 | 333 | 'tag' => 'receipt_id', |
334 | - 'description' => __( 'The unique ID number for this donation receipt.', 'give' ), |
|
334 | + 'description' => __('The unique ID number for this donation receipt.', 'give'), |
|
335 | 335 | 'function' => 'give_email_tag_receipt_id', |
336 | 336 | ), |
337 | 337 | array( |
338 | 338 | 'tag' => 'payment_method', |
339 | - 'description' => __( 'The method of payment used for this donation.', 'give' ), |
|
339 | + 'description' => __('The method of payment used for this donation.', 'give'), |
|
340 | 340 | 'function' => 'give_email_tag_payment_method', |
341 | 341 | ), |
342 | 342 | array( |
343 | 343 | 'tag' => 'sitename', |
344 | - 'description' => __( 'The name of your site.', 'give' ), |
|
344 | + 'description' => __('The name of your site.', 'give'), |
|
345 | 345 | 'function' => 'give_email_tag_sitename', |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'tag' => 'receipt_link', |
349 | - 'description' => __( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
349 | + 'description' => __('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
350 | 350 | 'function' => 'give_email_tag_receipt_link', |
351 | 351 | ), |
352 | 352 | array( |
353 | 353 | 'tag' => 'receipt_link_url', |
354 | - 'description' => __( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
354 | + 'description' => __('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
355 | 355 | 'function' => 'give_email_tag_receipt_link_url', |
356 | 356 | ), |
357 | 357 | ); |
358 | 358 | |
359 | 359 | // Apply give_email_tags filter |
360 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
360 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
361 | 361 | |
362 | 362 | // Add email tags |
363 | - foreach ( $email_tags as $email_tag ) { |
|
364 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
363 | + foreach ($email_tags as $email_tag) { |
|
364 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | } |
368 | 368 | |
369 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
369 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
370 | 370 | |
371 | 371 | |
372 | 372 | /** |
@@ -378,15 +378,15 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @return string name |
380 | 380 | */ |
381 | -function give_email_tag_first_name( $payment_id ) { |
|
382 | - $payment = new Give_Payment( $payment_id ); |
|
381 | +function give_email_tag_first_name($payment_id) { |
|
382 | + $payment = new Give_Payment($payment_id); |
|
383 | 383 | $user_info = $payment->user_info; |
384 | 384 | |
385 | - if ( empty( $user_info ) ) { |
|
385 | + if (empty($user_info)) { |
|
386 | 386 | return ''; |
387 | 387 | } |
388 | 388 | |
389 | - $email_name = give_get_email_names( $user_info ); |
|
389 | + $email_name = give_get_email_names($user_info); |
|
390 | 390 | |
391 | 391 | return $email_name['name']; |
392 | 392 | } |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return string fullname |
402 | 402 | */ |
403 | -function give_email_tag_fullname( $payment_id ) { |
|
404 | - $payment = new Give_Payment( $payment_id ); |
|
403 | +function give_email_tag_fullname($payment_id) { |
|
404 | + $payment = new Give_Payment($payment_id); |
|
405 | 405 | $user_info = $payment->user_info; |
406 | 406 | |
407 | - if ( empty( $user_info ) ) { |
|
407 | + if (empty($user_info)) { |
|
408 | 408 | return ''; |
409 | 409 | } |
410 | 410 | |
411 | - $email_name = give_get_email_names( $user_info ); |
|
411 | + $email_name = give_get_email_names($user_info); |
|
412 | 412 | |
413 | 413 | return $email_name['fullname']; |
414 | 414 | } |
@@ -422,15 +422,15 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @return string username. |
424 | 424 | */ |
425 | -function give_email_tag_username( $payment_id ) { |
|
426 | - $payment = new Give_Payment( $payment_id ); |
|
425 | +function give_email_tag_username($payment_id) { |
|
426 | + $payment = new Give_Payment($payment_id); |
|
427 | 427 | $user_info = $payment->user_info; |
428 | 428 | |
429 | - if ( empty( $user_info ) ) { |
|
429 | + if (empty($user_info)) { |
|
430 | 430 | return ''; |
431 | 431 | } |
432 | 432 | |
433 | - $email_name = give_get_email_names( $user_info ); |
|
433 | + $email_name = give_get_email_names($user_info); |
|
434 | 434 | |
435 | 435 | return $email_name['username']; |
436 | 436 | } |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @return string user_email |
446 | 446 | */ |
447 | -function give_email_tag_user_email( $payment_id ) { |
|
448 | - $payment = new Give_Payment( $payment_id ); |
|
447 | +function give_email_tag_user_email($payment_id) { |
|
448 | + $payment = new Give_Payment($payment_id); |
|
449 | 449 | |
450 | 450 | return $payment->email; |
451 | 451 | } |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return string billing_address |
461 | 461 | */ |
462 | -function give_email_tag_billing_address( $payment_id ) { |
|
463 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
464 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
462 | +function give_email_tag_billing_address($payment_id) { |
|
463 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
464 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
465 | 465 | 'line1' => '', |
466 | 466 | 'line2' => '', |
467 | 467 | 'city' => '', |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | ); |
472 | 472 | |
473 | 473 | $return = $user_address['line1']; |
474 | - if ( ! empty( $user_address['line2'] ) ) { |
|
475 | - $return .= ', ' . $user_address['line2']; |
|
474 | + if ( ! empty($user_address['line2'])) { |
|
475 | + $return .= ', '.$user_address['line2']; |
|
476 | 476 | } |
477 | - if ( ! empty( $user_address['city'] ) ) { |
|
478 | - $return .= "\n" . $user_address['city']; |
|
477 | + if ( ! empty($user_address['city'])) { |
|
478 | + $return .= "\n".$user_address['city']; |
|
479 | 479 | } |
480 | - if ( ! empty( $user_address['state'] ) ) { |
|
481 | - $return .= ', ' . $user_address['state']; |
|
480 | + if ( ! empty($user_address['state'])) { |
|
481 | + $return .= ', '.$user_address['state']; |
|
482 | 482 | } |
483 | - if ( ! empty( $user_address['zip'] ) ) { |
|
484 | - $return .= ' ' . $user_address['zip']; |
|
483 | + if ( ! empty($user_address['zip'])) { |
|
484 | + $return .= ' '.$user_address['zip']; |
|
485 | 485 | } |
486 | - if ( ! empty( $user_address['country'] ) ) { |
|
487 | - $return .= "\n" . give_get_country_name_by_key( $user_address['country'] ); |
|
486 | + if ( ! empty($user_address['country'])) { |
|
487 | + $return .= "\n".give_get_country_name_by_key($user_address['country']); |
|
488 | 488 | } |
489 | 489 | |
490 | - if ( empty( $return ) ) { |
|
491 | - $return = __( 'None provided', 'give' ); |
|
490 | + if (empty($return)) { |
|
491 | + $return = __('None provided', 'give'); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | return apply_filters('give_email_tag_billing_address', $return, $payment_id); |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @return string date |
506 | 506 | */ |
507 | -function give_email_tag_date( $payment_id ) { |
|
508 | - $payment = new Give_Payment( $payment_id ); |
|
507 | +function give_email_tag_date($payment_id) { |
|
508 | + $payment = new Give_Payment($payment_id); |
|
509 | 509 | |
510 | - return date_i18n( give_date_format(), strtotime( $payment->date ) ); |
|
510 | + return date_i18n(give_date_format(), strtotime($payment->date)); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -519,11 +519,11 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return string amount |
521 | 521 | */ |
522 | -function give_email_tag_amount( $payment_id ) { |
|
523 | - $payment = new Give_Payment( $payment_id ); |
|
524 | - $give_amount = give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), $payment->currency ); |
|
522 | +function give_email_tag_amount($payment_id) { |
|
523 | + $payment = new Give_Payment($payment_id); |
|
524 | + $give_amount = give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), $payment->currency); |
|
525 | 525 | |
526 | - return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
526 | + return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @return string price |
537 | 537 | */ |
538 | -function give_email_tag_price( $payment_id ) { |
|
539 | - return give_email_tag_amount( $payment_id ); |
|
538 | +function give_email_tag_price($payment_id) { |
|
539 | + return give_email_tag_amount($payment_id); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | /** |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @return int payment_id |
550 | 550 | */ |
551 | -function give_email_tag_payment_id( $payment_id ) { |
|
552 | - $payment = new Give_Payment( $payment_id ); |
|
551 | +function give_email_tag_payment_id($payment_id) { |
|
552 | + $payment = new Give_Payment($payment_id); |
|
553 | 553 | |
554 | 554 | return $payment->number; |
555 | 555 | } |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * |
564 | 564 | * @return string receipt_id |
565 | 565 | */ |
566 | -function give_email_tag_receipt_id( $payment_id ) { |
|
567 | - $payment = new Give_Payment( $payment_id ); |
|
566 | +function give_email_tag_receipt_id($payment_id) { |
|
567 | + $payment = new Give_Payment($payment_id); |
|
568 | 568 | |
569 | 569 | return $payment->key; |
570 | 570 | } |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return string $form_title |
580 | 580 | */ |
581 | -function give_email_tag_donation( $payment_id ) { |
|
582 | - $payment = new Give_Payment( $payment_id ); |
|
581 | +function give_email_tag_donation($payment_id) { |
|
582 | + $payment = new Give_Payment($payment_id); |
|
583 | 583 | $payment_meta = $payment->payment_meta; |
584 | - $level_title = give_has_variable_prices( $payment->form_id ); |
|
584 | + $level_title = give_has_variable_prices($payment->form_id); |
|
585 | 585 | $separator = $level_title ? '-' : ''; |
586 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) ); |
|
586 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, false, $separator)); |
|
587 | 587 | |
588 | - return ! empty( $form_title ) ? $form_title : ''; |
|
588 | + return ! empty($form_title) ? $form_title : ''; |
|
589 | 589 | |
590 | 590 | } |
591 | 591 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return string $form_title |
600 | 600 | */ |
601 | -function give_email_tag_form_title( $payment_id ) { |
|
602 | - $payment = new Give_Payment( $payment_id ); |
|
601 | +function give_email_tag_form_title($payment_id) { |
|
602 | + $payment = new Give_Payment($payment_id); |
|
603 | 603 | $payment_meta = $payment->payment_meta; |
604 | 604 | |
605 | - return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : ''; |
|
605 | + return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : ''; |
|
606 | 606 | |
607 | 607 | } |
608 | 608 | |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @return string gateway |
617 | 617 | */ |
618 | -function give_email_tag_payment_method( $payment_id ) { |
|
619 | - $payment = new Give_Payment( $payment_id ); |
|
618 | +function give_email_tag_payment_method($payment_id) { |
|
619 | + $payment = new Give_Payment($payment_id); |
|
620 | 620 | |
621 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
621 | + return give_get_gateway_checkout_label($payment->gateway); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | /** |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | * |
631 | 631 | * @return string sitename |
632 | 632 | */ |
633 | -function give_email_tag_sitename( $payment_id ) { |
|
634 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
633 | +function give_email_tag_sitename($payment_id) { |
|
634 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | * |
644 | 644 | * @return string receipt_link |
645 | 645 | */ |
646 | -function give_email_tag_receipt_link( $payment_id ) { |
|
646 | +function give_email_tag_receipt_link($payment_id) { |
|
647 | 647 | |
648 | - $receipt_url = esc_url( add_query_arg( array( |
|
649 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
648 | + $receipt_url = esc_url(add_query_arg(array( |
|
649 | + 'payment_key' => give_get_payment_key($payment_id), |
|
650 | 650 | 'give_action' => 'view_receipt', |
651 | - ), home_url() ) ); |
|
652 | - $formatted = sprintf( |
|
651 | + ), home_url())); |
|
652 | + $formatted = sprintf( |
|
653 | 653 | '<a href="%1$s">%2$s</a>', |
654 | 654 | $receipt_url, |
655 | - esc_html__( 'View it in your browser »', 'give' ) |
|
655 | + esc_html__('View it in your browser »', 'give') |
|
656 | 656 | ); |
657 | 657 | |
658 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
658 | + if (give_get_option('email_template') !== 'none') { |
|
659 | 659 | return $formatted; |
660 | 660 | } else { |
661 | 661 | return $receipt_url; |
@@ -674,12 +674,12 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @return string receipt_url |
676 | 676 | */ |
677 | -function give_email_tag_receipt_link_url( $payment_id ) { |
|
677 | +function give_email_tag_receipt_link_url($payment_id) { |
|
678 | 678 | |
679 | - $receipt_url = esc_url( add_query_arg( array( |
|
680 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
679 | + $receipt_url = esc_url(add_query_arg(array( |
|
680 | + 'payment_key' => give_get_payment_key($payment_id), |
|
681 | 681 | 'give_action' => 'view_receipt', |
682 | - ), home_url() ) ); |
|
682 | + ), home_url())); |
|
683 | 683 | |
684 | 684 | return $receipt_url; |
685 | 685 |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | - array( |
|
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | - 'id' => 'email_settings_docs_link', |
|
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
87 | - 'type' => 'give_docs_link', |
|
88 | - ), |
|
82 | + array( |
|
83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | + 'id' => 'email_settings_docs_link', |
|
85 | + 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | + 'title' => __( 'Email Settings', 'give' ), |
|
87 | + 'type' => 'give_docs_link', |
|
88 | + ), |
|
89 | 89 | array( |
90 | 90 | 'id' => 'give_title_email_settings_1', |
91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | - array( |
|
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | - 'type' => 'give_docs_link', |
|
127 | - ), |
|
121 | + array( |
|
122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
124 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | + 'type' => 'give_docs_link', |
|
127 | + ), |
|
128 | 128 | array( |
129 | 129 | 'id' => 'give_title_email_settings_2', |
130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'type' => 'textarea', |
176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
177 | 177 | ), |
178 | - array( |
|
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | - 'id' => 'donation_notification_settings_docs_link', |
|
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | - 'type' => 'give_docs_link', |
|
184 | - ), |
|
178 | + array( |
|
179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | + 'id' => 'donation_notification_settings_docs_link', |
|
181 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | + 'type' => 'give_docs_link', |
|
184 | + ), |
|
185 | 185 | array( |
186 | 186 | 'id' => 'give_title_email_settings_3', |
187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
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_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'email-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'email_template', |
57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
58 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
57 | + 'name' => esc_html__('Email Template', 'give'), |
|
58 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => give_get_email_templates() |
61 | 61 | ), |
62 | 62 | array( |
63 | 63 | 'id' => 'email_logo', |
64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
64 | + 'name' => esc_html__('Logo', 'give'), |
|
65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
66 | 66 | 'type' => 'file' |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'id' => 'from_name', |
70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
72 | - 'default' => get_bloginfo( 'name' ), |
|
70 | + 'name' => esc_html__('From Name', 'give'), |
|
71 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
72 | + 'default' => get_bloginfo('name'), |
|
73 | 73 | 'type' => 'text' |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'id' => 'from_email', |
77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
78 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
77 | + 'name' => esc_html__('From Email', 'give'), |
|
78 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
79 | + 'default' => get_bloginfo('admin_email'), |
|
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | 82 | array( |
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
84 | 84 | 'id' => 'email_settings_docs_link', |
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
85 | + 'url' => esc_url('http://docs.givewp.com/settings-emails'), |
|
86 | + 'title' => __('Email Settings', 'give'), |
|
87 | 87 | 'type' => 'give_docs_link', |
88 | 88 | ), |
89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'id' => 'donation_subject', |
105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
108 | 108 | 'type' => 'text' |
109 | 109 | ), |
110 | 110 | array( |
111 | 111 | 'id' => 'donation_receipt', |
112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
113 | 113 | 'desc' => sprintf( |
114 | 114 | /* translators: %s: emails tags list */ |
115 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give' ), |
|
115 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give'), |
|
116 | 116 | '<br/>'.give_get_emails_tags_list() |
117 | 117 | ), |
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-receipt'), |
|
125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => 'admin_notices', |
144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Enable/Disable all admin notifications from Give completely.', 'give' ), |
|
144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
145 | + 'desc' => esc_html__('Enable/Disable all admin notifications from Give completely.', 'give'), |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ) |
152 | 152 | ), |
153 | 153 | array( |
154 | 154 | 'id' => 'donation_notification_subject', |
155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
156 | - 'desc' => esc_html__( 'Enter the subject line for the admin donation notification email.', 'give' ), |
|
155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
156 | + 'desc' => esc_html__('Enter the subject line for the admin donation notification email.', 'give'), |
|
157 | 157 | 'type' => 'text', |
158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
159 | 159 | ), |
160 | 160 | array( |
161 | 161 | 'id' => 'donation_notification', |
162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
163 | 163 | 'desc' => sprintf( |
164 | 164 | /* translators: %s: emails tags list */ |
165 | - __( 'Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give' ), |
|
165 | + __('Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give'), |
|
166 | 166 | '<br/>'.give_get_emails_tags_list() |
167 | 167 | ), |
168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ), |
171 | 171 | array( |
172 | 172 | 'id' => 'admin_notice_emails', |
173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
175 | 175 | 'type' => 'textarea', |
176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
176 | + 'default' => get_bloginfo('admin_email') |
|
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
181 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
183 | 183 | 'type' => 'give_docs_link', |
184 | 184 | ), |
185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Filter the emails settings. |
195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
196 | 196 | */ |
197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.8 |
203 | 203 | * @param array $settings |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
206 | 206 | |
207 | 207 | // Output. |
208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_sections() { |
218 | 218 | $sections = array( |
219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
222 | 222 | ); |
223 | 223 | |
224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |