@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * Used to redirect a user back to the donation form if there are errors present. |
157 | 157 | * |
158 | - * @param array|string $args |
|
158 | + * @param string $args |
|
159 | 159 | * |
160 | 160 | * @access public |
161 | 161 | * @since 1.0 |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @since 1.0 |
302 | 302 | * @since 1.8.16 Add security check |
303 | 303 | * |
304 | - * @return bool |
|
304 | + * @return false|null |
|
305 | 305 | */ |
306 | 306 | function give_listen_for_failed_payments() { |
307 | 307 | |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | * @since 2.2.0 |
1293 | 1293 | * |
1294 | 1294 | * @param array|integer $price_or_level_id Price level data. |
1295 | - * @param boolean|integer $form_id Donation Form ID. |
|
1295 | + * @param integer $form_id Donation Form ID. |
|
1296 | 1296 | * |
1297 | 1297 | * @return boolean |
1298 | 1298 | */ |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | * |
1397 | 1397 | * @since 2.2.0 |
1398 | 1398 | * |
1399 | - * @return object |
|
1399 | + * @return Give_Donor |
|
1400 | 1400 | */ |
1401 | 1401 | function give_get_name_with_title_prefixes( $donor ) { |
1402 | 1402 | |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | * |
1442 | 1442 | * @since 2.2.0 |
1443 | 1443 | * |
1444 | - * @return array |
|
1444 | + * @return string|boolean |
|
1445 | 1445 | */ |
1446 | 1446 | function give_get_default_title_prefixes() { |
1447 | 1447 | /** |
@@ -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 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | global $typenow; |
25 | 25 | |
26 | - if ( $typenow != 'give_forms' ) { |
|
26 | + if ($typenow != 'give_forms') { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return int|false |
42 | 42 | */ |
43 | -function get_form_id_from_args( $args ) { |
|
43 | +function get_form_id_from_args($args) { |
|
44 | 44 | |
45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
46 | 46 | |
47 | - return intval( $args['form_id'] ); |
|
47 | + return intval($args['form_id']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | -function give_is_float_labels_enabled( $args ) { |
|
62 | +function give_is_float_labels_enabled($args) { |
|
63 | 63 | |
64 | 64 | $float_labels = ''; |
65 | 65 | |
66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
66 | + if ( ! empty($args['float_labels'])) { |
|
67 | 67 | $float_labels = $args['float_labels']; |
68 | 68 | } |
69 | 69 | |
70 | - if ( empty( $float_labels ) ) { |
|
71 | - $float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
70 | + if (empty($float_labels)) { |
|
71 | + $float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) { |
|
75 | - $float_labels = give_get_option( 'floatlabels', 'disabled' ); |
|
74 | + if (empty($float_labels) || ('global' === $float_labels)) { |
|
75 | + $float_labels = give_get_option('floatlabels', 'disabled'); |
|
76 | 76 | } |
77 | 77 | |
78 | - return give_is_setting_enabled( $float_labels ); |
|
78 | + return give_is_setting_enabled($float_labels); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $can_checkout = true; |
93 | 93 | |
94 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
94 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | function give_get_success_page_uri() { |
106 | 106 | $give_options = give_get_settings(); |
107 | 107 | |
108 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
108 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
109 | 109 | |
110 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
110 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function give_is_success_page() { |
121 | 121 | $give_options = give_get_settings(); |
122 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
122 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
123 | 123 | |
124 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
124 | + return apply_filters('give_is_success_page', $is_success_page); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @since 1.0 |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_send_to_success_page( $query_string = null ) { |
|
138 | +function give_send_to_success_page($query_string = null) { |
|
139 | 139 | |
140 | 140 | $redirect = give_get_success_page_uri(); |
141 | 141 | |
142 | - if ( $query_string ) { |
|
142 | + if ($query_string) { |
|
143 | 143 | $redirect .= $query_string; |
144 | 144 | } |
145 | 145 | |
146 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
146 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
147 | 147 | |
148 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
148 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
149 | 149 | give_die(); |
150 | 150 | } |
151 | 151 | |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return Void |
163 | 163 | */ |
164 | -function give_send_back_to_checkout( $args = array() ) { |
|
164 | +function give_send_back_to_checkout($args = array()) { |
|
165 | 165 | |
166 | - $url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : ''; |
|
166 | + $url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : ''; |
|
167 | 167 | $form_id = 0; |
168 | 168 | |
169 | 169 | // Set the form_id. |
170 | - if ( isset( $_POST['give-form-id'] ) ) { |
|
171 | - $form_id = sanitize_text_field( $_POST['give-form-id'] ); |
|
170 | + if (isset($_POST['give-form-id'])) { |
|
171 | + $form_id = sanitize_text_field($_POST['give-form-id']); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Need a URL to continue. If none, redirect back to single form. |
175 | - if ( empty( $url ) ) { |
|
176 | - wp_safe_redirect( get_permalink( $form_id ) ); |
|
175 | + if (empty($url)) { |
|
176 | + wp_safe_redirect(get_permalink($form_id)); |
|
177 | 177 | give_die(); |
178 | 178 | } |
179 | 179 | |
@@ -182,41 +182,41 @@ discard block |
||
182 | 182 | ); |
183 | 183 | |
184 | 184 | // Set the $level_id. |
185 | - if ( isset( $_POST['give-price-id'] ) ) { |
|
186 | - $defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] ); |
|
185 | + if (isset($_POST['give-price-id'])) { |
|
186 | + $defaults['level-id'] = sanitize_text_field($_POST['give-price-id']); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // Check for backward compatibility. |
190 | - if ( is_string( $args ) ) { |
|
191 | - $args = str_replace( '?', '', $args ); |
|
190 | + if (is_string($args)) { |
|
191 | + $args = str_replace('?', '', $args); |
|
192 | 192 | } |
193 | 193 | |
194 | - $args = wp_parse_args( $args, $defaults ); |
|
194 | + $args = wp_parse_args($args, $defaults); |
|
195 | 195 | |
196 | 196 | // Merge URL query with $args to maintain third-party URL parameters after redirect. |
197 | - $url_data = wp_parse_url( $url ); |
|
197 | + $url_data = wp_parse_url($url); |
|
198 | 198 | |
199 | 199 | // Check if an array to prevent notices before parsing. |
200 | - if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) { |
|
201 | - parse_str( $url_data['query'], $query ); |
|
200 | + if (isset($url_data['query']) && ! empty($url_data['query'])) { |
|
201 | + parse_str($url_data['query'], $query); |
|
202 | 202 | |
203 | 203 | // Precaution: don't allow any CC info. |
204 | - unset( $query['card_number'] ); |
|
205 | - unset( $query['card_cvc'] ); |
|
204 | + unset($query['card_number']); |
|
205 | + unset($query['card_cvc']); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | // No $url_data so pass empty array. |
209 | 209 | $query = array(); |
210 | 210 | } |
211 | 211 | |
212 | - $new_query = array_merge( $args, $query ); |
|
213 | - $new_query_string = http_build_query( $new_query ); |
|
212 | + $new_query = array_merge($args, $query); |
|
213 | + $new_query_string = http_build_query($new_query); |
|
214 | 214 | |
215 | 215 | // Assemble URL parts. |
216 | - $redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' ); |
|
216 | + $redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap'); |
|
217 | 217 | |
218 | 218 | // Redirect them. |
219 | - wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
219 | + wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
220 | 220 | give_die(); |
221 | 221 | |
222 | 222 | } |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return string |
234 | 234 | */ |
235 | -function give_get_success_page_url( $query_string = null ) { |
|
235 | +function give_get_success_page_url($query_string = null) { |
|
236 | 236 | |
237 | - $success_page = give_get_option( 'success_page', 0 ); |
|
238 | - $success_page = get_permalink( $success_page ); |
|
237 | + $success_page = give_get_option('success_page', 0); |
|
238 | + $success_page = get_permalink($success_page); |
|
239 | 239 | |
240 | - if ( $query_string ) { |
|
240 | + if ($query_string) { |
|
241 | 241 | $success_page .= $query_string; |
242 | 242 | } |
243 | 243 | |
244 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
244 | + return apply_filters('give_success_page_url', $success_page); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
@@ -254,32 +254,31 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist. |
256 | 256 | */ |
257 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
257 | +function give_get_failed_transaction_uri($extras = false) { |
|
258 | 258 | $give_options = give_get_settings(); |
259 | 259 | |
260 | 260 | // Remove question mark. |
261 | - if ( 0 === strpos( $extras, '?' ) ) { |
|
262 | - $extras = substr( $extras, 1 ); |
|
261 | + if (0 === strpos($extras, '?')) { |
|
262 | + $extras = substr($extras, 1); |
|
263 | 263 | } |
264 | 264 | |
265 | - $extras_args = wp_parse_args( $extras ); |
|
265 | + $extras_args = wp_parse_args($extras); |
|
266 | 266 | |
267 | 267 | // Set nonce if payment id exist in extra params. |
268 | - if ( array_key_exists( 'payment-id', $extras_args ) ) { |
|
269 | - $extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" ); |
|
270 | - $extras = http_build_query( $extras_args ); |
|
268 | + if (array_key_exists('payment-id', $extras_args)) { |
|
269 | + $extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}"); |
|
270 | + $extras = http_build_query($extras_args); |
|
271 | 271 | } |
272 | 272 | |
273 | - $uri = ! empty( $give_options['failure_page'] ) ? |
|
274 | - trailingslashit( get_permalink( $give_options['failure_page'] ) ) : |
|
275 | - home_url(); |
|
273 | + $uri = ! empty($give_options['failure_page']) ? |
|
274 | + trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
276 | 275 | |
277 | 276 | |
278 | - if ( $extras ) { |
|
277 | + if ($extras) { |
|
279 | 278 | $uri .= "?{$extras}"; |
280 | 279 | } |
281 | 280 | |
282 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
281 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
283 | 282 | } |
284 | 283 | |
285 | 284 | /** |
@@ -290,9 +289,9 @@ discard block |
||
290 | 289 | */ |
291 | 290 | function give_is_failed_transaction_page() { |
292 | 291 | $give_options = give_get_settings(); |
293 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
292 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
294 | 293 | |
295 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
294 | + return apply_filters('give_is_failure_page', $ret); |
|
296 | 295 | } |
297 | 296 | |
298 | 297 | /** |
@@ -305,25 +304,25 @@ discard block |
||
305 | 304 | */ |
306 | 305 | function give_listen_for_failed_payments() { |
307 | 306 | |
308 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
309 | - $payment_id = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0; |
|
310 | - $nonce = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false; |
|
307 | + $failed_page = give_get_option('failure_page', 0); |
|
308 | + $payment_id = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0; |
|
309 | + $nonce = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false; |
|
311 | 310 | |
312 | 311 | // Bailout. |
313 | - if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) { |
|
312 | + if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) { |
|
314 | 313 | return false; |
315 | 314 | } |
316 | 315 | |
317 | 316 | // Security check. |
318 | - if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) { |
|
319 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) ); |
|
317 | + if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) { |
|
318 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give')); |
|
320 | 319 | } |
321 | 320 | |
322 | 321 | // Set payment status to failure |
323 | - give_update_payment_status( $payment_id, 'failed' ); |
|
322 | + give_update_payment_status($payment_id, 'failed'); |
|
324 | 323 | } |
325 | 324 | |
326 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
325 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
327 | 326 | |
328 | 327 | /** |
329 | 328 | * Retrieve the Donation History page URI |
@@ -336,9 +335,9 @@ discard block |
||
336 | 335 | function give_get_history_page_uri() { |
337 | 336 | $give_options = give_get_settings(); |
338 | 337 | |
339 | - $history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' ); |
|
338 | + $history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url'); |
|
340 | 339 | |
341 | - return apply_filters( 'give_get_history_page_uri', $history_page ); |
|
340 | + return apply_filters('give_get_history_page_uri', $history_page); |
|
342 | 341 | } |
343 | 342 | |
344 | 343 | /** |
@@ -351,11 +350,11 @@ discard block |
||
351 | 350 | * @since 1.0 |
352 | 351 | * @return bool |
353 | 352 | */ |
354 | -function give_field_is_required( $field = '', $form_id ) { |
|
353 | +function give_field_is_required($field = '', $form_id) { |
|
355 | 354 | |
356 | - $required_fields = give_get_required_fields( $form_id ); |
|
355 | + $required_fields = give_get_required_fields($form_id); |
|
357 | 356 | |
358 | - return array_key_exists( $field, $required_fields ); |
|
357 | + return array_key_exists($field, $required_fields); |
|
359 | 358 | } |
360 | 359 | |
361 | 360 | /** |
@@ -372,12 +371,12 @@ discard block |
||
372 | 371 | * |
373 | 372 | * @return void |
374 | 373 | */ |
375 | -function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) { |
|
374 | +function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) { |
|
376 | 375 | $log_data = array( |
377 | 376 | 'log_parent' => $payment_id, |
378 | 377 | 'log_type' => 'sale', |
379 | - 'log_date' => isset( $donation_date ) ? $donation_date : null, |
|
380 | - 'log_date_gmt' => isset( $donation_date ) ? $donation_date : null, |
|
378 | + 'log_date' => isset($donation_date) ? $donation_date : null, |
|
379 | + 'log_date_gmt' => isset($donation_date) ? $donation_date : null, |
|
381 | 380 | ); |
382 | 381 | |
383 | 382 | $log_meta = array( |
@@ -385,7 +384,7 @@ discard block |
||
385 | 384 | 'price_id' => (int) $price_id, |
386 | 385 | ); |
387 | 386 | |
388 | - Give()->logs->insert_log( $log_data, $log_meta ); |
|
387 | + Give()->logs->insert_log($log_data, $log_meta); |
|
389 | 388 | } |
390 | 389 | |
391 | 390 | |
@@ -399,13 +398,13 @@ discard block |
||
399 | 398 | * |
400 | 399 | * @return bool|int |
401 | 400 | */ |
402 | -function give_increase_donation_count( $form_id = 0, $quantity = 1 ) { |
|
401 | +function give_increase_donation_count($form_id = 0, $quantity = 1) { |
|
403 | 402 | $quantity = (int) $quantity; |
404 | 403 | |
405 | 404 | /** @var \Give_Donate_Form $form */ |
406 | - $form = new Give_Donate_Form( $form_id ); |
|
405 | + $form = new Give_Donate_Form($form_id); |
|
407 | 406 | |
408 | - return $form->increase_sales( $quantity ); |
|
407 | + return $form->increase_sales($quantity); |
|
409 | 408 | } |
410 | 409 | |
411 | 410 | /** |
@@ -418,13 +417,13 @@ discard block |
||
418 | 417 | * |
419 | 418 | * @return bool|int |
420 | 419 | */ |
421 | -function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) { |
|
420 | +function give_decrease_donation_count($form_id = 0, $quantity = 1) { |
|
422 | 421 | $quantity = (int) $quantity; |
423 | 422 | |
424 | 423 | /** @var \Give_Donate_Form $form */ |
425 | - $form = new Give_Donate_Form( $form_id ); |
|
424 | + $form = new Give_Donate_Form($form_id); |
|
426 | 425 | |
427 | - return $form->decrease_sales( $quantity ); |
|
426 | + return $form->decrease_sales($quantity); |
|
428 | 427 | } |
429 | 428 | |
430 | 429 | /** |
@@ -440,11 +439,11 @@ discard block |
||
440 | 439 | * |
441 | 440 | * @return bool|int |
442 | 441 | */ |
443 | -function give_increase_earnings( $give_form_id = 0, $amount, $payment_id = 0 ) { |
|
442 | +function give_increase_earnings($give_form_id = 0, $amount, $payment_id = 0) { |
|
444 | 443 | /** @var \Give_Donate_Form $form */ |
445 | - $form = new Give_Donate_Form( $give_form_id ); |
|
444 | + $form = new Give_Donate_Form($give_form_id); |
|
446 | 445 | |
447 | - return $form->increase_earnings( $amount, $payment_id ); |
|
446 | + return $form->increase_earnings($amount, $payment_id); |
|
448 | 447 | } |
449 | 448 | |
450 | 449 | /** |
@@ -462,11 +461,11 @@ discard block |
||
462 | 461 | * |
463 | 462 | * @return bool|int |
464 | 463 | */ |
465 | -function give_decrease_form_earnings( $form_id = 0, $amount, $payment_id = 0 ) { |
|
464 | +function give_decrease_form_earnings($form_id = 0, $amount, $payment_id = 0) { |
|
466 | 465 | /** @var \Give_Donate_Form $form */ |
467 | - $form = new Give_Donate_Form( $form_id ); |
|
466 | + $form = new Give_Donate_Form($form_id); |
|
468 | 467 | |
469 | - return $form->decrease_earnings( $amount, $payment_id ); |
|
468 | + return $form->decrease_earnings($amount, $payment_id); |
|
470 | 469 | } |
471 | 470 | |
472 | 471 | |
@@ -479,15 +478,15 @@ discard block |
||
479 | 478 | * |
480 | 479 | * @return int $earnings Earnings for a certain form |
481 | 480 | */ |
482 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
483 | - $give_form = new Give_Donate_Form( $form_id ); |
|
481 | +function give_get_form_earnings_stats($form_id = 0) { |
|
482 | + $give_form = new Give_Donate_Form($form_id); |
|
484 | 483 | |
485 | 484 | /** |
486 | 485 | * Filter the form earnings |
487 | 486 | * |
488 | 487 | * @since 1.8.17 |
489 | 488 | */ |
490 | - return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form ); |
|
489 | + return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form); |
|
491 | 490 | } |
492 | 491 | |
493 | 492 | |
@@ -500,8 +499,8 @@ discard block |
||
500 | 499 | * |
501 | 500 | * @return int $sales Amount of sales for a certain form |
502 | 501 | */ |
503 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
504 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
502 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
503 | + $give_form = new Give_Donate_Form($give_form_id); |
|
505 | 504 | |
506 | 505 | return $give_form->sales; |
507 | 506 | } |
@@ -516,16 +515,16 @@ discard block |
||
516 | 515 | * |
517 | 516 | * @return float $sales Average monthly sales |
518 | 517 | */ |
519 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
520 | - $sales = give_get_form_sales_stats( $form_id ); |
|
521 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
518 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
519 | + $sales = give_get_form_sales_stats($form_id); |
|
520 | + $release_date = get_post_field('post_date', $form_id); |
|
522 | 521 | |
523 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
522 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
524 | 523 | |
525 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
524 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
526 | 525 | |
527 | - if ( $months > 0 ) { |
|
528 | - $sales = ( $sales / $months ); |
|
526 | + if ($months > 0) { |
|
527 | + $sales = ($sales / $months); |
|
529 | 528 | } |
530 | 529 | |
531 | 530 | return $sales; |
@@ -541,16 +540,16 @@ discard block |
||
541 | 540 | * |
542 | 541 | * @return float $earnings Average monthly earnings |
543 | 542 | */ |
544 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
545 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
546 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
543 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
544 | + $earnings = give_get_form_earnings_stats($form_id); |
|
545 | + $release_date = get_post_field('post_date', $form_id); |
|
547 | 546 | |
548 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
547 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
549 | 548 | |
550 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
549 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
551 | 550 | |
552 | - if ( $months > 0 ) { |
|
553 | - $earnings = ( $earnings / $months ); |
|
551 | + if ($months > 0) { |
|
552 | + $earnings = ($earnings / $months); |
|
554 | 553 | } |
555 | 554 | |
556 | 555 | return $earnings < 0 ? 0 : $earnings; |
@@ -571,34 +570,34 @@ discard block |
||
571 | 570 | * |
572 | 571 | * @return string $price_name Name of the price option |
573 | 572 | */ |
574 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) { |
|
573 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) { |
|
575 | 574 | |
576 | - $prices = give_get_variable_prices( $form_id ); |
|
575 | + $prices = give_get_variable_prices($form_id); |
|
577 | 576 | $price_name = ''; |
578 | 577 | |
579 | - if ( false === $prices ) { |
|
578 | + if (false === $prices) { |
|
580 | 579 | return $price_name; |
581 | 580 | } |
582 | 581 | |
583 | - foreach ( $prices as $price ) { |
|
582 | + foreach ($prices as $price) { |
|
584 | 583 | |
585 | - if ( intval( $price['_give_id']['level_id'] ) === intval( $price_id ) ) { |
|
584 | + if (intval($price['_give_id']['level_id']) === intval($price_id)) { |
|
586 | 585 | |
587 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
586 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
588 | 587 | $price_fallback = $use_fallback ? |
589 | 588 | give_currency_filter( |
590 | 589 | give_format_amount( |
591 | 590 | $price['_give_amount'], |
592 | - array( 'sanitize' => false ) |
|
591 | + array('sanitize' => false) |
|
593 | 592 | ), |
594 | - array( 'decode_currency' => true ) |
|
593 | + array('decode_currency' => true) |
|
595 | 594 | ) : ''; |
596 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
595 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
597 | 596 | |
598 | 597 | } |
599 | 598 | } |
600 | 599 | |
601 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
600 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
602 | 601 | } |
603 | 602 | |
604 | 603 | |
@@ -612,25 +611,25 @@ discard block |
||
612 | 611 | * |
613 | 612 | * @return string $range A fully formatted price range |
614 | 613 | */ |
615 | -function give_price_range( $form_id = 0, $formatted = true ) { |
|
616 | - $low = give_get_lowest_price_option( $form_id ); |
|
617 | - $high = give_get_highest_price_option( $form_id ); |
|
618 | - $order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc'; |
|
614 | +function give_price_range($form_id = 0, $formatted = true) { |
|
615 | + $low = give_get_lowest_price_option($form_id); |
|
616 | + $high = give_get_highest_price_option($form_id); |
|
617 | + $order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc'; |
|
619 | 618 | |
620 | 619 | $range = sprintf( |
621 | 620 | '<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep"> – </span><span class="give_price_range_%3$s">%4$s</span>', |
622 | 621 | 'asc' === $order_type ? 'low' : 'high', |
623 | - 'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ), |
|
622 | + 'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))), |
|
624 | 623 | 'asc' === $order_type ? 'high' : 'low', |
625 | - 'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) |
|
624 | + 'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false))) |
|
626 | 625 | |
627 | 626 | ); |
628 | 627 | |
629 | - if ( ! $formatted ) { |
|
630 | - $range = wp_strip_all_tags( $range ); |
|
628 | + if ( ! $formatted) { |
|
629 | + $range = wp_strip_all_tags($range); |
|
631 | 630 | } |
632 | 631 | |
633 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
632 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
634 | 633 | } |
635 | 634 | |
636 | 635 | |
@@ -645,35 +644,35 @@ discard block |
||
645 | 644 | * |
646 | 645 | * @return int ID of the lowest price |
647 | 646 | */ |
648 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
647 | +function give_get_lowest_price_id($form_id = 0) { |
|
649 | 648 | |
650 | - if ( empty( $form_id ) ) { |
|
649 | + if (empty($form_id)) { |
|
651 | 650 | $form_id = get_the_ID(); |
652 | 651 | } |
653 | 652 | |
654 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
655 | - return give_get_form_price( $form_id ); |
|
653 | + if ( ! give_has_variable_prices($form_id)) { |
|
654 | + return give_get_form_price($form_id); |
|
656 | 655 | } |
657 | 656 | |
658 | - $prices = give_get_variable_prices( $form_id ); |
|
657 | + $prices = give_get_variable_prices($form_id); |
|
659 | 658 | |
660 | 659 | $min = $min_id = 0; |
661 | 660 | |
662 | - if ( ! empty( $prices ) ) { |
|
661 | + if ( ! empty($prices)) { |
|
663 | 662 | |
664 | - foreach ( $prices as $key => $price ) { |
|
663 | + foreach ($prices as $key => $price) { |
|
665 | 664 | |
666 | - if ( empty( $price['_give_amount'] ) ) { |
|
665 | + if (empty($price['_give_amount'])) { |
|
667 | 666 | continue; |
668 | 667 | } |
669 | 668 | |
670 | - if ( ! isset( $min ) ) { |
|
669 | + if ( ! isset($min)) { |
|
671 | 670 | $min = $price['_give_amount']; |
672 | 671 | } else { |
673 | - $min = min( $min, $price['_give_amount'] ); |
|
672 | + $min = min($min, $price['_give_amount']); |
|
674 | 673 | } |
675 | 674 | |
676 | - if ( $price['_give_amount'] == $min ) { |
|
675 | + if ($price['_give_amount'] == $min) { |
|
677 | 676 | $min_id = $price['_give_id']['level_id']; |
678 | 677 | } |
679 | 678 | } |
@@ -691,22 +690,22 @@ discard block |
||
691 | 690 | * |
692 | 691 | * @return float Amount of the lowest price |
693 | 692 | */ |
694 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
695 | - if ( empty( $form_id ) ) { |
|
693 | +function give_get_lowest_price_option($form_id = 0) { |
|
694 | + if (empty($form_id)) { |
|
696 | 695 | $form_id = get_the_ID(); |
697 | 696 | } |
698 | 697 | |
699 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
700 | - return give_get_form_price( $form_id ); |
|
698 | + if ( ! give_has_variable_prices($form_id)) { |
|
699 | + return give_get_form_price($form_id); |
|
701 | 700 | } |
702 | 701 | |
703 | - if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) { |
|
702 | + if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) { |
|
704 | 703 | // Backward compatibility. |
705 | - $prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
|
706 | - $low = ! empty( $prices ) ? min( $prices ) : 0; |
|
704 | + $prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount'); |
|
705 | + $low = ! empty($prices) ? min($prices) : 0; |
|
707 | 706 | } |
708 | 707 | |
709 | - return give_maybe_sanitize_amount( $low ); |
|
708 | + return give_maybe_sanitize_amount($low); |
|
710 | 709 | } |
711 | 710 | |
712 | 711 | /** |
@@ -718,23 +717,23 @@ discard block |
||
718 | 717 | * |
719 | 718 | * @return float Amount of the highest price |
720 | 719 | */ |
721 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
720 | +function give_get_highest_price_option($form_id = 0) { |
|
722 | 721 | |
723 | - if ( empty( $form_id ) ) { |
|
722 | + if (empty($form_id)) { |
|
724 | 723 | $form_id = get_the_ID(); |
725 | 724 | } |
726 | 725 | |
727 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
728 | - return give_get_form_price( $form_id ); |
|
726 | + if ( ! give_has_variable_prices($form_id)) { |
|
727 | + return give_get_form_price($form_id); |
|
729 | 728 | } |
730 | 729 | |
731 | - if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) { |
|
730 | + if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) { |
|
732 | 731 | // Backward compatibility. |
733 | - $prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
|
734 | - $high = ! empty( $prices ) ? max( $prices ) : 0; |
|
732 | + $prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount'); |
|
733 | + $high = ! empty($prices) ? max($prices) : 0; |
|
735 | 734 | } |
736 | 735 | |
737 | - return give_maybe_sanitize_amount( $high ); |
|
736 | + return give_maybe_sanitize_amount($high); |
|
738 | 737 | } |
739 | 738 | |
740 | 739 | /** |
@@ -746,15 +745,15 @@ discard block |
||
746 | 745 | * |
747 | 746 | * @return mixed string|int Price of the form |
748 | 747 | */ |
749 | -function give_get_form_price( $form_id = 0 ) { |
|
748 | +function give_get_form_price($form_id = 0) { |
|
750 | 749 | |
751 | - if ( empty( $form_id ) ) { |
|
750 | + if (empty($form_id)) { |
|
752 | 751 | return false; |
753 | 752 | } |
754 | 753 | |
755 | - $form = new Give_Donate_Form( $form_id ); |
|
754 | + $form = new Give_Donate_Form($form_id); |
|
756 | 755 | |
757 | - return $form->__get( 'price' ); |
|
756 | + return $form->__get('price'); |
|
758 | 757 | } |
759 | 758 | |
760 | 759 | /** |
@@ -766,13 +765,13 @@ discard block |
||
766 | 765 | * |
767 | 766 | * @return mixed string|int Minimum price of the form |
768 | 767 | */ |
769 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
768 | +function give_get_form_minimum_price($form_id = 0) { |
|
770 | 769 | |
771 | - if ( empty( $form_id ) ) { |
|
770 | + if (empty($form_id)) { |
|
772 | 771 | return false; |
773 | 772 | } |
774 | 773 | |
775 | - $form = new Give_Donate_Form( $form_id ); |
|
774 | + $form = new Give_Donate_Form($form_id); |
|
776 | 775 | |
777 | 776 | return $form->get_minimum_price(); |
778 | 777 | |
@@ -787,13 +786,13 @@ discard block |
||
787 | 786 | * |
788 | 787 | * @return bool|float |
789 | 788 | */ |
790 | -function give_get_form_maximum_price( $form_id = 0 ) { |
|
789 | +function give_get_form_maximum_price($form_id = 0) { |
|
791 | 790 | |
792 | - if ( empty( $form_id ) ) { |
|
791 | + if (empty($form_id)) { |
|
793 | 792 | return false; |
794 | 793 | } |
795 | 794 | |
796 | - $form = new Give_Donate_Form( $form_id ); |
|
795 | + $form = new Give_Donate_Form($form_id); |
|
797 | 796 | |
798 | 797 | return $form->get_maximum_price(); |
799 | 798 | } |
@@ -809,48 +808,48 @@ discard block |
||
809 | 808 | * |
810 | 809 | * @return int $formatted_price |
811 | 810 | */ |
812 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
811 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
813 | 812 | $price = 0; |
814 | 813 | |
815 | - if ( empty( $form_id ) ) { |
|
814 | + if (empty($form_id)) { |
|
816 | 815 | $form_id = get_the_ID(); |
817 | 816 | } |
818 | 817 | |
819 | - if ( give_has_variable_prices( $form_id ) ) { |
|
818 | + if (give_has_variable_prices($form_id)) { |
|
820 | 819 | |
821 | - $prices = give_get_variable_prices( $form_id ); |
|
820 | + $prices = give_get_variable_prices($form_id); |
|
822 | 821 | |
823 | - if ( false !== $price_id ) { |
|
822 | + if (false !== $price_id) { |
|
824 | 823 | |
825 | 824 | // loop through multi-prices to see which is default |
826 | - foreach ( $prices as $price ) { |
|
825 | + foreach ($prices as $price) { |
|
827 | 826 | // this is the default price |
828 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
827 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
829 | 828 | $price = (float) $price['_give_amount']; |
830 | 829 | }; |
831 | 830 | } |
832 | 831 | } else { |
833 | 832 | |
834 | - $price = give_get_lowest_price_option( $form_id ); |
|
833 | + $price = give_get_lowest_price_option($form_id); |
|
835 | 834 | } |
836 | 835 | } else { |
837 | 836 | |
838 | - $price = give_get_form_price( $form_id ); |
|
837 | + $price = give_get_form_price($form_id); |
|
839 | 838 | } |
840 | 839 | |
841 | - $price = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id ); |
|
842 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
843 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
840 | + $price = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id); |
|
841 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
842 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
844 | 843 | |
845 | - if ( $echo ) { |
|
844 | + if ($echo) { |
|
846 | 845 | echo $formatted_price; |
847 | 846 | } else { |
848 | 847 | return $formatted_price; |
849 | 848 | } |
850 | 849 | } |
851 | 850 | |
852 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
853 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
851 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
852 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
854 | 853 | |
855 | 854 | |
856 | 855 | /** |
@@ -863,19 +862,19 @@ discard block |
||
863 | 862 | * |
864 | 863 | * @return float $amount Amount of the price option |
865 | 864 | */ |
866 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
867 | - $prices = give_get_variable_prices( $form_id ); |
|
865 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
866 | + $prices = give_get_variable_prices($form_id); |
|
868 | 867 | |
869 | 868 | $amount = 0.00; |
870 | 869 | |
871 | - foreach ( $prices as $price ) { |
|
872 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
873 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
870 | + foreach ($prices as $price) { |
|
871 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
872 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
874 | 873 | break; |
875 | 874 | }; |
876 | 875 | } |
877 | 876 | |
878 | - return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id ); |
|
877 | + return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id); |
|
879 | 878 | } |
880 | 879 | |
881 | 880 | /** |
@@ -887,13 +886,13 @@ discard block |
||
887 | 886 | * |
888 | 887 | * @return mixed string|int Goal of the form |
889 | 888 | */ |
890 | -function give_get_form_goal( $form_id = 0 ) { |
|
889 | +function give_get_form_goal($form_id = 0) { |
|
891 | 890 | |
892 | - if ( empty( $form_id ) ) { |
|
891 | + if (empty($form_id)) { |
|
893 | 892 | return false; |
894 | 893 | } |
895 | 894 | |
896 | - $form = new Give_Donate_Form( $form_id ); |
|
895 | + $form = new Give_Donate_Form($form_id); |
|
897 | 896 | |
898 | 897 | return $form->goal; |
899 | 898 | |
@@ -908,13 +907,13 @@ discard block |
||
908 | 907 | * |
909 | 908 | * @return mixed string|int Goal of the form |
910 | 909 | */ |
911 | -function give_get_form_goal_format( $form_id = 0 ) { |
|
910 | +function give_get_form_goal_format($form_id = 0) { |
|
912 | 911 | |
913 | - if ( empty( $form_id ) ) { |
|
912 | + if (empty($form_id)) { |
|
914 | 913 | return false; |
915 | 914 | } |
916 | 915 | |
917 | - return give_get_meta( $form_id, '_give_goal_format', true ); |
|
916 | + return give_get_meta($form_id, '_give_goal_format', true); |
|
918 | 917 | |
919 | 918 | } |
920 | 919 | |
@@ -928,19 +927,19 @@ discard block |
||
928 | 927 | * |
929 | 928 | * @return string $formatted_goal |
930 | 929 | */ |
931 | -function give_goal( $form_id = 0, $echo = true ) { |
|
930 | +function give_goal($form_id = 0, $echo = true) { |
|
932 | 931 | |
933 | - if ( empty( $form_id ) ) { |
|
932 | + if (empty($form_id)) { |
|
934 | 933 | $form_id = get_the_ID(); |
935 | 934 | } |
936 | 935 | |
937 | - $goal = give_get_form_goal( $form_id ); |
|
938 | - $goal_format = give_get_form_goal_format( $form_id ); |
|
936 | + $goal = give_get_form_goal($form_id); |
|
937 | + $goal_format = give_get_form_goal_format($form_id); |
|
939 | 938 | |
940 | - if ( 'donation' === $goal_format ) { |
|
939 | + if ('donation' === $goal_format) { |
|
941 | 940 | $goal = "{$goal} donations"; |
942 | 941 | } else { |
943 | - $goal = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id ); |
|
942 | + $goal = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id); |
|
944 | 943 | } |
945 | 944 | |
946 | 945 | $formatted_goal = sprintf( |
@@ -948,17 +947,17 @@ discard block |
||
948 | 947 | $form_id, |
949 | 948 | $goal |
950 | 949 | ); |
951 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
950 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
952 | 951 | |
953 | - if ( $echo ) { |
|
952 | + if ($echo) { |
|
954 | 953 | echo $formatted_goal; |
955 | 954 | } else { |
956 | 955 | return $formatted_goal; |
957 | 956 | } |
958 | 957 | } |
959 | 958 | |
960 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
961 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
959 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
960 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
962 | 961 | |
963 | 962 | |
964 | 963 | /** |
@@ -970,15 +969,15 @@ discard block |
||
970 | 969 | * |
971 | 970 | * @return bool $ret Whether or not the logged_in_only setting is set |
972 | 971 | */ |
973 | -function give_logged_in_only( $form_id ) { |
|
972 | +function give_logged_in_only($form_id) { |
|
974 | 973 | // If _give_logged_in_only is set to enable then guest can donate from that specific form. |
975 | 974 | // Otherwise it is member only donation form. |
976 | - $val = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
977 | - $val = ! empty( $val ) ? $val : 'enabled'; |
|
975 | + $val = give_get_meta($form_id, '_give_logged_in_only', true); |
|
976 | + $val = ! empty($val) ? $val : 'enabled'; |
|
978 | 977 | |
979 | - $ret = ! give_is_setting_enabled( $val ); |
|
978 | + $ret = ! give_is_setting_enabled($val); |
|
980 | 979 | |
981 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
980 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
982 | 981 | } |
983 | 982 | |
984 | 983 | |
@@ -991,11 +990,11 @@ discard block |
||
991 | 990 | * |
992 | 991 | * @return string |
993 | 992 | */ |
994 | -function give_show_login_register_option( $form_id ) { |
|
993 | +function give_show_login_register_option($form_id) { |
|
995 | 994 | |
996 | - $show_register_form = give_get_meta( $form_id, '_give_show_register_form', true ); |
|
995 | + $show_register_form = give_get_meta($form_id, '_give_show_register_form', true); |
|
997 | 996 | |
998 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
997 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
999 | 998 | |
1000 | 999 | } |
1001 | 1000 | |
@@ -1011,12 +1010,12 @@ discard block |
||
1011 | 1010 | * |
1012 | 1011 | * @return array |
1013 | 1012 | */ |
1014 | -function _give_get_prefill_form_field_values( $form_id ) { |
|
1013 | +function _give_get_prefill_form_field_values($form_id) { |
|
1015 | 1014 | $logged_in_donor_info = array(); |
1016 | 1015 | |
1017 | - if ( is_user_logged_in() ) : |
|
1018 | - $donor_data = get_userdata( get_current_user_id() ); |
|
1019 | - $donor = new Give_Donor( get_current_user_id(), true ); |
|
1016 | + if (is_user_logged_in()) : |
|
1017 | + $donor_data = get_userdata(get_current_user_id()); |
|
1018 | + $donor = new Give_Donor(get_current_user_id(), true); |
|
1020 | 1019 | $donor_address = $donor->get_donor_address(); |
1021 | 1020 | $company_name = $donor->get_company_name(); |
1022 | 1021 | |
@@ -1028,7 +1027,7 @@ discard block |
||
1028 | 1027 | 'give_last' => $donor_data->last_name, |
1029 | 1028 | |
1030 | 1029 | // Title Prefix. |
1031 | - 'give_title' => $donor->get_meta( '_give_donor_title_prefix', true ), |
|
1030 | + 'give_title' => $donor->get_meta('_give_donor_title_prefix', true), |
|
1032 | 1031 | |
1033 | 1032 | // Company name. |
1034 | 1033 | 'company_name' => $company_name, |
@@ -1058,23 +1057,23 @@ discard block |
||
1058 | 1057 | |
1059 | 1058 | // Bailout: Auto fill form field values only form form which donor is donating. |
1060 | 1059 | if ( |
1061 | - empty( $_GET['form-id'] ) |
|
1060 | + empty($_GET['form-id']) |
|
1062 | 1061 | || ! $form_id |
1063 | - || ( $form_id !== absint( $_GET['form-id'] ) ) |
|
1062 | + || ($form_id !== absint($_GET['form-id'])) |
|
1064 | 1063 | ) { |
1065 | 1064 | return $logged_in_donor_info; |
1066 | 1065 | } |
1067 | 1066 | |
1068 | 1067 | // Get purchase data. |
1069 | - $give_purchase_data = Give()->session->get( 'give_purchase' ); |
|
1068 | + $give_purchase_data = Give()->session->get('give_purchase'); |
|
1070 | 1069 | |
1071 | 1070 | // Get donor info from form data. |
1072 | - $give_donor_info_in_session = empty( $give_purchase_data['post_data'] ) |
|
1071 | + $give_donor_info_in_session = empty($give_purchase_data['post_data']) |
|
1073 | 1072 | ? array() |
1074 | 1073 | : $give_purchase_data['post_data']; |
1075 | 1074 | |
1076 | 1075 | // Output. |
1077 | - return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info ); |
|
1076 | + return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info); |
|
1078 | 1077 | } |
1079 | 1078 | |
1080 | 1079 | /** |
@@ -1087,13 +1086,13 @@ discard block |
||
1087 | 1086 | * |
1088 | 1087 | * @return int |
1089 | 1088 | */ |
1090 | -function give_get_form_donor_count( $form_id, $args = array() ) { |
|
1089 | +function give_get_form_donor_count($form_id, $args = array()) { |
|
1091 | 1090 | global $wpdb; |
1092 | 1091 | |
1093 | - $cache_key = Give_Cache::get_key( "form_donor_count_{$form_id}", $args, false ); |
|
1094 | - $donor_count = absint( Give_Cache::get_db_query( $cache_key ) ); |
|
1092 | + $cache_key = Give_Cache::get_key("form_donor_count_{$form_id}", $args, false); |
|
1093 | + $donor_count = absint(Give_Cache::get_db_query($cache_key)); |
|
1095 | 1094 | |
1096 | - if ( $form_id && ! $donor_count ) { |
|
1095 | + if ($form_id && ! $donor_count) { |
|
1097 | 1096 | // Set arguments. |
1098 | 1097 | $args = wp_parse_args( |
1099 | 1098 | $args, |
@@ -1103,7 +1102,7 @@ discard block |
||
1103 | 1102 | ); |
1104 | 1103 | |
1105 | 1104 | $donation_meta_table = Give()->payment_meta->table_name; |
1106 | - $donation_id_col_name = Give()->payment_meta->get_meta_type() . '_id'; |
|
1105 | + $donation_id_col_name = Give()->payment_meta->get_meta_type().'_id'; |
|
1107 | 1106 | |
1108 | 1107 | $distinct = $args['unique'] ? 'DISTINCT meta_value' : 'meta_value'; |
1109 | 1108 | |
@@ -1128,7 +1127,7 @@ discard block |
||
1128 | 1127 | 'publish' |
1129 | 1128 | ); |
1130 | 1129 | |
1131 | - $donor_count = absint( $wpdb->get_var( $query ) ); |
|
1130 | + $donor_count = absint($wpdb->get_var($query)); |
|
1132 | 1131 | } |
1133 | 1132 | |
1134 | 1133 | |
@@ -1137,7 +1136,7 @@ discard block |
||
1137 | 1136 | * |
1138 | 1137 | * @since 2.1.0 |
1139 | 1138 | */ |
1140 | - $donor_count = apply_filters( 'give_get_form_donor_count', $donor_count, $form_id, $args ); |
|
1139 | + $donor_count = apply_filters('give_get_form_donor_count', $donor_count, $form_id, $args); |
|
1141 | 1140 | |
1142 | 1141 | return $donor_count; |
1143 | 1142 | } |
@@ -1151,33 +1150,33 @@ discard block |
||
1151 | 1150 | * |
1152 | 1151 | * @return void |
1153 | 1152 | */ |
1154 | -function give_set_form_closed_status( $form_id ) { |
|
1153 | +function give_set_form_closed_status($form_id) { |
|
1155 | 1154 | |
1156 | 1155 | // Bailout. |
1157 | - if ( empty( $form_id ) ) { |
|
1156 | + if (empty($form_id)) { |
|
1158 | 1157 | return; |
1159 | 1158 | } |
1160 | 1159 | |
1161 | 1160 | $open_form = false; |
1162 | - $is_goal_enabled = give_is_setting_enabled( give_get_meta( $form_id, '_give_goal_option', true, 'disabled' ) ); |
|
1161 | + $is_goal_enabled = give_is_setting_enabled(give_get_meta($form_id, '_give_goal_option', true, 'disabled')); |
|
1163 | 1162 | |
1164 | 1163 | // Proceed, if the form goal is enabled. |
1165 | - if ( $is_goal_enabled ) { |
|
1164 | + if ($is_goal_enabled) { |
|
1166 | 1165 | |
1167 | - $close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $form_id, '_give_close_form_when_goal_achieved', true, 'disabled' ) ); |
|
1166 | + $close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($form_id, '_give_close_form_when_goal_achieved', true, 'disabled')); |
|
1168 | 1167 | |
1169 | 1168 | // Proceed, if close form when goal achieved option is enabled. |
1170 | - if ( $close_form_when_goal_achieved ) { |
|
1169 | + if ($close_form_when_goal_achieved) { |
|
1171 | 1170 | |
1172 | - $form = new Give_Donate_Form( $form_id ); |
|
1173 | - $goal_progress_stats = give_goal_progress_stats( $form ); |
|
1171 | + $form = new Give_Donate_Form($form_id); |
|
1172 | + $goal_progress_stats = give_goal_progress_stats($form); |
|
1174 | 1173 | |
1175 | 1174 | // Verify whether the form is closed or not after processing data. |
1176 | 1175 | $closed = $goal_progress_stats['raw_goal'] <= $goal_progress_stats['raw_actual']; |
1177 | 1176 | |
1178 | 1177 | // Update form meta if verified that the form is closed. |
1179 | - if ( $closed ) { |
|
1180 | - give_update_meta( $form_id, '_give_form_status', 'closed' ); |
|
1178 | + if ($closed) { |
|
1179 | + give_update_meta($form_id, '_give_form_status', 'closed'); |
|
1181 | 1180 | } else { |
1182 | 1181 | $open_form = true; |
1183 | 1182 | } |
@@ -1189,8 +1188,8 @@ discard block |
||
1189 | 1188 | } |
1190 | 1189 | |
1191 | 1190 | // If $open_form is true, then update form status to open. |
1192 | - if ( $open_form ) { |
|
1193 | - give_update_meta( $form_id, '_give_form_status', 'open' ); |
|
1191 | + if ($open_form) { |
|
1192 | + give_update_meta($form_id, '_give_form_status', 'open'); |
|
1194 | 1193 | } |
1195 | 1194 | } |
1196 | 1195 | |
@@ -1203,32 +1202,31 @@ discard block |
||
1203 | 1202 | * |
1204 | 1203 | * @return string |
1205 | 1204 | */ |
1206 | -function give_admin_form_goal_stats( $form_id ) { |
|
1205 | +function give_admin_form_goal_stats($form_id) { |
|
1207 | 1206 | |
1208 | 1207 | $html = ''; |
1209 | - $goal_stats = give_goal_progress_stats( $form_id ); |
|
1210 | - $percent_complete = round( ( $goal_stats['raw_actual'] / $goal_stats['raw_goal'] ), 3 ) * 100; |
|
1208 | + $goal_stats = give_goal_progress_stats($form_id); |
|
1209 | + $percent_complete = round(($goal_stats['raw_actual'] / $goal_stats['raw_goal']), 3) * 100; |
|
1211 | 1210 | |
1212 | 1211 | $html .= sprintf( |
1213 | 1212 | '<div class="give-admin-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="%1$s"> |
1214 | 1213 | <span style="width:%1$s%%;"></span> |
1215 | 1214 | </div>', |
1216 | - esc_attr( $goal_stats['progress'] ) |
|
1215 | + esc_attr($goal_stats['progress']) |
|
1217 | 1216 | ); |
1218 | 1217 | |
1219 | 1218 | $html .= sprintf( |
1220 | - ( 'percentage' !== $goal_stats['format'] ) ? |
|
1221 | - '<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' : |
|
1222 | - '<div class="give-goal-text"><a href="%3$s">%1$s </a>', |
|
1223 | - ( 'percentage' !== $goal_stats['format'] ) ? $goal_stats['actual'] : $percent_complete . '%', |
|
1224 | - ( 'percentage' !== $goal_stats['format'] ) ? __( 'of', 'give' ) : '', |
|
1225 | - esc_url( admin_url( "post.php?post={$form_id}&action=edit&give_tab=donation_goal_options" ) ), |
|
1219 | + ('percentage' !== $goal_stats['format']) ? |
|
1220 | + '<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' : '<div class="give-goal-text"><a href="%3$s">%1$s </a>', |
|
1221 | + ('percentage' !== $goal_stats['format']) ? $goal_stats['actual'] : $percent_complete.'%', |
|
1222 | + ('percentage' !== $goal_stats['format']) ? __('of', 'give') : '', |
|
1223 | + esc_url(admin_url("post.php?post={$form_id}&action=edit&give_tab=donation_goal_options")), |
|
1226 | 1224 | $goal_stats['goal'], |
1227 | - ( 'donors' === $goal_stats['format'] ? __( 'Donors', 'give' ) : ( 'donation' === $goal_stats['format'] ? __( 'Donations', 'give' ) : '' ) ) |
|
1225 | + ('donors' === $goal_stats['format'] ? __('Donors', 'give') : ('donation' === $goal_stats['format'] ? __('Donations', 'give') : '')) |
|
1228 | 1226 | ); |
1229 | 1227 | |
1230 | - if ( $goal_stats['raw_actual'] >= $goal_stats['raw_goal'] ) { |
|
1231 | - $html .= sprintf( '<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __( 'Goal achieved', 'give' ) ); |
|
1228 | + if ($goal_stats['raw_actual'] >= $goal_stats['raw_goal']) { |
|
1229 | + $html .= sprintf('<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __('Goal achieved', 'give')); |
|
1232 | 1230 | } |
1233 | 1231 | |
1234 | 1232 | $html .= '</div>'; |
@@ -1246,11 +1244,11 @@ discard block |
||
1246 | 1244 | * |
1247 | 1245 | * @return null | array |
1248 | 1246 | */ |
1249 | -function give_form_get_default_level( $form_id ) { |
|
1247 | +function give_form_get_default_level($form_id) { |
|
1250 | 1248 | $default_level = null; |
1251 | 1249 | |
1252 | 1250 | // If donation form has variable prices. |
1253 | - if ( give_has_variable_prices( $form_id ) ) { |
|
1251 | + if (give_has_variable_prices($form_id)) { |
|
1254 | 1252 | /** |
1255 | 1253 | * Filter the variable pricing |
1256 | 1254 | * |
@@ -1262,12 +1260,12 @@ discard block |
||
1262 | 1260 | * @param array $prices Array of variable prices. |
1263 | 1261 | * @param int $form Form ID. |
1264 | 1262 | */ |
1265 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
1263 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
1266 | 1264 | |
1267 | 1265 | // Go through each of the level and get the default level id. |
1268 | - foreach ( $prices as $level ) { |
|
1266 | + foreach ($prices as $level) { |
|
1269 | 1267 | if ( |
1270 | - isset( $level['_give_default'] ) |
|
1268 | + isset($level['_give_default']) |
|
1271 | 1269 | && $level['_give_default'] === 'default' |
1272 | 1270 | ) { |
1273 | 1271 | $default_level = $level; |
@@ -1283,7 +1281,7 @@ discard block |
||
1283 | 1281 | * @param array $default_level Default level price data. |
1284 | 1282 | * @param integer $form_id Donation form ID. |
1285 | 1283 | */ |
1286 | - return apply_filters( 'give_form_get_default_level', $default_level, $form_id ); |
|
1284 | + return apply_filters('give_form_get_default_level', $default_level, $form_id); |
|
1287 | 1285 | } |
1288 | 1286 | |
1289 | 1287 | /** |
@@ -1296,21 +1294,21 @@ discard block |
||
1296 | 1294 | * |
1297 | 1295 | * @return boolean |
1298 | 1296 | */ |
1299 | -function give_is_default_level_id( $price_or_level_id, $form_id = 0 ) { |
|
1297 | +function give_is_default_level_id($price_or_level_id, $form_id = 0) { |
|
1300 | 1298 | $is_default = false; |
1301 | 1299 | |
1302 | 1300 | if ( |
1303 | - ! empty( $form_id ) |
|
1304 | - && is_numeric( $price_or_level_id ) |
|
1301 | + ! empty($form_id) |
|
1302 | + && is_numeric($price_or_level_id) |
|
1305 | 1303 | ) { |
1306 | 1304 | // Get default level id. |
1307 | - $form_price_data = give_form_get_default_level( $form_id ); |
|
1305 | + $form_price_data = give_form_get_default_level($form_id); |
|
1308 | 1306 | |
1309 | - $is_default = ! is_null( $form_price_data ) && ( $price_or_level_id === absint( $form_price_data['_give_id']['level_id'] ) ); |
|
1307 | + $is_default = ! is_null($form_price_data) && ($price_or_level_id === absint($form_price_data['_give_id']['level_id'])); |
|
1310 | 1308 | } |
1311 | 1309 | |
1312 | - $is_default = false === $is_default && is_array( $price_or_level_id ) ? |
|
1313 | - ( isset( $price_or_level_id['_give_default'] ) && $price_or_level_id['_give_default'] === 'default' ) |
|
1310 | + $is_default = false === $is_default && is_array($price_or_level_id) ? |
|
1311 | + (isset($price_or_level_id['_give_default']) && $price_or_level_id['_give_default'] === 'default') |
|
1314 | 1312 | : $is_default; |
1315 | 1313 | |
1316 | 1314 | /** |
@@ -1321,7 +1319,7 @@ discard block |
||
1321 | 1319 | * @param bool $is_default True if it is default price level id otherwise false. |
1322 | 1320 | * @param array|integer $price_or_level_id Price Data. |
1323 | 1321 | */ |
1324 | - return apply_filters( 'give_is_default_level_id', $is_default, $price_or_level_id ); |
|
1322 | + return apply_filters('give_is_default_level_id', $is_default, $price_or_level_id); |
|
1325 | 1323 | } |
1326 | 1324 | |
1327 | 1325 | |
@@ -1334,20 +1332,20 @@ discard block |
||
1334 | 1332 | * |
1335 | 1333 | * @return mixed |
1336 | 1334 | */ |
1337 | -function give_get_name_title_prefixes( $form_id = 0 ) { |
|
1335 | +function give_get_name_title_prefixes($form_id = 0) { |
|
1338 | 1336 | |
1339 | - $name_title_prefix = give_is_name_title_prefix_enabled( $form_id ); |
|
1340 | - $title_prefixes = give_get_option( 'title_prefixes', give_get_default_title_prefixes() ); |
|
1337 | + $name_title_prefix = give_is_name_title_prefix_enabled($form_id); |
|
1338 | + $title_prefixes = give_get_option('title_prefixes', give_get_default_title_prefixes()); |
|
1341 | 1339 | |
1342 | 1340 | // If form id exists, then fetch form specific title prefixes. |
1343 | - if ( intval( $form_id ) > 0 && $name_title_prefix ) { |
|
1341 | + if (intval($form_id) > 0 && $name_title_prefix) { |
|
1344 | 1342 | |
1345 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
1346 | - if ( 'global' !== $form_title_prefix ) { |
|
1347 | - $form_title_prefixes = give_get_meta( $form_id, '_give_title_prefixes', true, give_get_default_title_prefixes() ); |
|
1343 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
1344 | + if ('global' !== $form_title_prefix) { |
|
1345 | + $form_title_prefixes = give_get_meta($form_id, '_give_title_prefixes', true, give_get_default_title_prefixes()); |
|
1348 | 1346 | |
1349 | 1347 | // Check whether the form based title prefixes exists or not. |
1350 | - if ( is_array( $form_title_prefixes ) && count( $form_title_prefixes ) > 0 ) { |
|
1348 | + if (is_array($form_title_prefixes) && count($form_title_prefixes) > 0) { |
|
1351 | 1349 | $title_prefixes = $form_title_prefixes; |
1352 | 1350 | } |
1353 | 1351 | } |
@@ -1366,22 +1364,22 @@ discard block |
||
1366 | 1364 | * |
1367 | 1365 | * @return bool |
1368 | 1366 | */ |
1369 | -function give_is_name_title_prefix_enabled( $form_id = 0, $status = '' ) { |
|
1370 | - if ( empty( $status ) ) { |
|
1371 | - $status = array( 'required', 'optional' ); |
|
1367 | +function give_is_name_title_prefix_enabled($form_id = 0, $status = '') { |
|
1368 | + if (empty($status)) { |
|
1369 | + $status = array('required', 'optional'); |
|
1372 | 1370 | } else { |
1373 | - $status = array( $status ); |
|
1371 | + $status = array($status); |
|
1374 | 1372 | } |
1375 | 1373 | |
1376 | - $title_prefix_status = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status ); |
|
1374 | + $title_prefix_status = give_is_setting_enabled(give_get_option('name_title_prefix'), $status); |
|
1377 | 1375 | |
1378 | - if ( intval( $form_id ) > 0 ) { |
|
1379 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
1376 | + if (intval($form_id) > 0) { |
|
1377 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
1380 | 1378 | |
1381 | - if ( 'disabled' === $form_title_prefix ) { |
|
1379 | + if ('disabled' === $form_title_prefix) { |
|
1382 | 1380 | $title_prefix_status = false; |
1383 | - } elseif ( in_array( $form_title_prefix, $status, true ) ) { |
|
1384 | - $title_prefix_status = give_is_setting_enabled( $form_title_prefix, $status ); |
|
1381 | + } elseif (in_array($form_title_prefix, $status, true)) { |
|
1382 | + $title_prefix_status = give_is_setting_enabled($form_title_prefix, $status); |
|
1385 | 1383 | } |
1386 | 1384 | } |
1387 | 1385 | |
@@ -1398,18 +1396,18 @@ discard block |
||
1398 | 1396 | * |
1399 | 1397 | * @return object |
1400 | 1398 | */ |
1401 | -function give_get_name_with_title_prefixes( $donor ) { |
|
1399 | +function give_get_name_with_title_prefixes($donor) { |
|
1402 | 1400 | |
1403 | 1401 | // Prepare Give_Donor object, if $donor is numeric. |
1404 | - if ( is_numeric( $donor ) ) { |
|
1405 | - $donor = new Give_Donor( $donor ); |
|
1402 | + if (is_numeric($donor)) { |
|
1403 | + $donor = new Give_Donor($donor); |
|
1406 | 1404 | } |
1407 | 1405 | |
1408 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
1406 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
1409 | 1407 | |
1410 | 1408 | // Update Donor name, if non empty title prefix. |
1411 | - if ( ! empty( $title_prefix ) ) { |
|
1412 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
1409 | + if ( ! empty($title_prefix)) { |
|
1410 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
1413 | 1411 | } |
1414 | 1412 | |
1415 | 1413 | return $donor; |
@@ -1425,15 +1423,15 @@ discard block |
||
1425 | 1423 | * |
1426 | 1424 | * @return string |
1427 | 1425 | */ |
1428 | -function give_get_donor_name_with_title_prefixes( $title_prefix, $name ) { |
|
1426 | +function give_get_donor_name_with_title_prefixes($title_prefix, $name) { |
|
1429 | 1427 | |
1430 | 1428 | $donor_name = $name; |
1431 | 1429 | |
1432 | - if ( ! empty( $title_prefix ) && ! empty( $name ) ) { |
|
1430 | + if ( ! empty($title_prefix) && ! empty($name)) { |
|
1433 | 1431 | $donor_name = "{$title_prefix} {$name}"; |
1434 | 1432 | } |
1435 | 1433 | |
1436 | - return trim( $donor_name ); |
|
1434 | + return trim($donor_name); |
|
1437 | 1435 | } |
1438 | 1436 | |
1439 | 1437 | /** |
@@ -1453,9 +1451,9 @@ discard block |
||
1453 | 1451 | return apply_filters( |
1454 | 1452 | 'give_get_default_title_prefixes', |
1455 | 1453 | array( |
1456 | - 'Mr.' => __( 'Mr.', 'give' ), |
|
1457 | - 'Mrs.' => __( 'Mrs.', 'give' ), |
|
1458 | - 'Ms.' => __( 'Ms.', 'give' ), |
|
1454 | + 'Mr.' => __('Mr.', 'give'), |
|
1455 | + 'Mrs.' => __('Mrs.', 'give'), |
|
1456 | + 'Ms.' => __('Ms.', 'give'), |
|
1459 | 1457 | ) |
1460 | 1458 | ); |
1461 | 1459 | } |
@@ -1469,25 +1467,25 @@ discard block |
||
1469 | 1467 | * |
1470 | 1468 | * @return bool |
1471 | 1469 | */ |
1472 | -function give_is_name_title_prefix_required( $form_id = 0 ) { |
|
1470 | +function give_is_name_title_prefix_required($form_id = 0) { |
|
1473 | 1471 | |
1474 | 1472 | // Bail out, if name title prefix is not enabled. |
1475 | - if ( ! give_is_name_title_prefix_enabled( $form_id ) ) { |
|
1473 | + if ( ! give_is_name_title_prefix_enabled($form_id)) { |
|
1476 | 1474 | return false; |
1477 | 1475 | } |
1478 | 1476 | |
1479 | - $status = array( 'optional' ); |
|
1480 | - $is_optional = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status ); |
|
1477 | + $status = array('optional'); |
|
1478 | + $is_optional = give_is_setting_enabled(give_get_option('name_title_prefix'), $status); |
|
1481 | 1479 | |
1482 | - if ( intval( $form_id ) > 0 ) { |
|
1483 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
1480 | + if (intval($form_id) > 0) { |
|
1481 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
1484 | 1482 | |
1485 | - if ( 'required' === $form_title_prefix ) { |
|
1483 | + if ('required' === $form_title_prefix) { |
|
1486 | 1484 | $is_optional = false; |
1487 | - } elseif ( 'optional' === $form_title_prefix ) { |
|
1485 | + } elseif ('optional' === $form_title_prefix) { |
|
1488 | 1486 | $is_optional = true; |
1489 | 1487 | } |
1490 | 1488 | } |
1491 | 1489 | |
1492 | - return ( ! $is_optional ); |
|
1490 | + return ( ! $is_optional); |
|
1493 | 1491 | } |
1494 | 1492 | \ No newline at end of file |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @since 1.8.17 |
230 | 230 | * |
231 | - * @return array|string |
|
231 | + * @return boolean |
|
232 | 232 | */ |
233 | 233 | function give_get_history_session() { |
234 | 234 | return (bool) Give()->session->get( 'history_access' ); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * |
705 | 705 | * @todo Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828). |
706 | 706 | * |
707 | - * @return bool |
|
707 | + * @return false|null |
|
708 | 708 | */ |
709 | 709 | function give_donation_metabox_menu() { |
710 | 710 | |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | * |
983 | 983 | * @since 1.8 |
984 | 984 | * |
985 | - * @param $form_id |
|
985 | + * @param integer $form_id |
|
986 | 986 | * |
987 | 987 | * @return bool |
988 | 988 | */ |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | * @param int $id |
1090 | 1090 | * @param string $meta_key |
1091 | 1091 | * @param mixed $meta_value |
1092 | - * @param mixed $prev_value |
|
1092 | + * @param string $prev_value |
|
1093 | 1093 | * |
1094 | 1094 | * @return mixed |
1095 | 1095 | */ |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | * @since 1.8.13 |
1349 | 1349 | * |
1350 | 1350 | * @param array $list List of objects or arrays |
1351 | - * @param int|string $field Field from the object to place instead of the entire object |
|
1351 | + * @param string $field Field from the object to place instead of the entire object |
|
1352 | 1352 | * @param int|string $index_key Optional. Field from the object to use as keys for the new array. |
1353 | 1353 | * Default null. |
1354 | 1354 | * |
@@ -1782,7 +1782,7 @@ discard block |
||
1782 | 1782 | * |
1783 | 1783 | * @since 2.1 |
1784 | 1784 | * |
1785 | - * @param $form_id |
|
1785 | + * @param integer $form_id |
|
1786 | 1786 | * |
1787 | 1787 | * @return bool |
1788 | 1788 | */ |
@@ -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 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | |
40 | 40 | global $wp; |
41 | 41 | |
42 | - if ( get_option( 'permalink_structure' ) ) { |
|
43 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
42 | + if (get_option('permalink_structure')) { |
|
43 | + $base = trailingslashit(home_url($wp->request)); |
|
44 | 44 | } else { |
45 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
46 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
45 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
46 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $scheme = is_ssl() ? 'https' : 'http'; |
50 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
50 | + $current_uri = set_url_scheme($base, $scheme); |
|
51 | 51 | |
52 | - if ( is_front_page() ) { |
|
53 | - $current_uri = home_url( '/' ); |
|
52 | + if (is_front_page()) { |
|
53 | + $current_uri = home_url('/'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @param string $current_uri |
62 | 62 | */ |
63 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
63 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | */ |
83 | 83 | $gateways = give_get_enabled_payment_gateways(); |
84 | 84 | |
85 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
85 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
86 | 86 | $ret = true; |
87 | - } elseif ( count( $gateways ) == 1 ) { |
|
87 | + } elseif (count($gateways) == 1) { |
|
88 | 88 | $ret = false; |
89 | - } elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
89 | + } elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
90 | 90 | $ret = false; |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param bool $ret |
99 | 99 | */ |
100 | - return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret ); |
|
100 | + return (bool) apply_filters('give_is_cc_verify_enabled', $ret); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | function give_get_timezone_id() { |
110 | 110 | |
111 | 111 | // if site timezone string exists, return it. |
112 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
112 | + if ($timezone = get_option('timezone_string')) { |
|
113 | 113 | return $timezone; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // get UTC offset, if it isn't set return UTC. |
117 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
117 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
118 | 118 | return 'UTC'; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // attempt to guess the timezone string from the UTC offset. |
122 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
122 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
123 | 123 | |
124 | 124 | // last try, guess timezone string manually. |
125 | - if ( $timezone === false ) { |
|
125 | + if ($timezone === false) { |
|
126 | 126 | |
127 | - $is_dst = date( 'I' ); |
|
127 | + $is_dst = date('I'); |
|
128 | 128 | |
129 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
130 | - foreach ( $abbr as $city ) { |
|
131 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
129 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
130 | + foreach ($abbr as $city) { |
|
131 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
132 | 132 | return $city['timezone_id']; |
133 | 133 | } |
134 | 134 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | |
153 | 153 | $ip = '127.0.0.1'; |
154 | 154 | |
155 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
155 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
156 | 156 | // check ip from share internet |
157 | 157 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
158 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
158 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
159 | 159 | // to check ip is pass from proxy |
160 | 160 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
161 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
161 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
162 | 162 | $ip = $_SERVER['REMOTE_ADDR']; |
163 | 163 | } |
164 | 164 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @since 1.0 |
169 | 169 | */ |
170 | - $ip = apply_filters( 'give_get_ip', $ip ); |
|
170 | + $ip = apply_filters('give_get_ip', $ip); |
|
171 | 171 | |
172 | 172 | // Filter empty values. |
173 | - if ( false !== strpos( $ip, ',' ) ) { |
|
174 | - $ip = give_clean( explode( ',', $ip ) ); |
|
175 | - $ip = array_filter( $ip ); |
|
176 | - $ip = implode( ',', $ip ); |
|
173 | + if (false !== strpos($ip, ',')) { |
|
174 | + $ip = give_clean(explode(',', $ip)); |
|
175 | + $ip = array_filter($ip); |
|
176 | + $ip = implode(',', $ip); |
|
177 | 177 | } else { |
178 | - $ip = give_clean( $ip ); |
|
178 | + $ip = give_clean($ip); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $ip; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @uses Give()->session->set() |
195 | 195 | */ |
196 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
197 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
198 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
196 | +function give_set_purchase_session($purchase_data = array()) { |
|
197 | + Give()->session->set('give_purchase', $purchase_data); |
|
198 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return mixed array | false |
210 | 210 | */ |
211 | 211 | function give_get_purchase_session() { |
212 | - return Give()->session->get( 'give_purchase' ); |
|
212 | + return Give()->session->get('give_purchase'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return array|string |
221 | 221 | */ |
222 | 222 | function give_get_receipt_session() { |
223 | - return Give()->session->get( 'receipt_access' ); |
|
223 | + return Give()->session->get('receipt_access'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return array|string |
232 | 232 | */ |
233 | 233 | function give_get_history_session() { |
234 | - return (bool) Give()->session->get( 'history_access' ); |
|
234 | + return (bool) Give()->session->get('history_access'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return string By default, the name of the form. Then the price level text if any is found. |
245 | 245 | */ |
246 | -function give_payment_gateway_item_title( $payment_data ) { |
|
246 | +function give_payment_gateway_item_title($payment_data) { |
|
247 | 247 | |
248 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
249 | - $item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | - $price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : ''; |
|
248 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
249 | + $item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | + $price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : ''; |
|
251 | 251 | |
252 | 252 | // Verify has variable prices. |
253 | - if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) { |
|
253 | + if (give_has_variable_prices($form_id) && ! empty($price_id)) { |
|
254 | 254 | |
255 | - $item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false ); |
|
255 | + $item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false); |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Output donation level text if: |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | * 1. It's not a custom amount |
261 | 261 | * 2. The level field has actual text and isn't the amount (which is already displayed on the receipt). |
262 | 262 | */ |
263 | - if ( 'custom' !== $price_id && ! empty( $item_price_level_text ) ) { |
|
263 | + if ('custom' !== $price_id && ! empty($item_price_level_text)) { |
|
264 | 264 | // Matches a donation level - append level text. |
265 | - $item_name .= ' - ' . $item_price_level_text; |
|
265 | + $item_name .= ' - '.$item_price_level_text; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data ); |
|
280 | + return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -293,38 +293,38 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @return string |
295 | 295 | */ |
296 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
296 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
297 | 297 | |
298 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
299 | - $price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : ''; |
|
298 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
299 | + $price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : ''; |
|
300 | 300 | |
301 | 301 | // Form title. |
302 | - $summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) ); |
|
302 | + $summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give'))); |
|
303 | 303 | |
304 | 304 | // Form multilevel if applicable. |
305 | - if ( ! empty( $price_id ) && 'custom' !== $price_id ) { |
|
306 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
305 | + if ( ! empty($price_id) && 'custom' !== $price_id) { |
|
306 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // Add Donor's name + email if requested. |
310 | - if ( $name_and_email ) { |
|
310 | + if ($name_and_email) { |
|
311 | 311 | |
312 | 312 | // First name |
313 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
314 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
313 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
314 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
315 | 315 | } |
316 | 316 | |
317 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
318 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
317 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
318 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
319 | 319 | } |
320 | 320 | |
321 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
321 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // Cut the length |
325 | - $summary = substr( $summary, 0, $length ); |
|
325 | + $summary = substr($summary, 0, $length); |
|
326 | 326 | |
327 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
327 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -339,31 +339,31 @@ discard block |
||
339 | 339 | function give_get_host() { |
340 | 340 | $host = false; |
341 | 341 | |
342 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
342 | + if (defined('WPE_APIKEY')) { |
|
343 | 343 | $host = 'WP Engine'; |
344 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
344 | + } elseif (defined('PAGELYBIN')) { |
|
345 | 345 | $host = 'Pagely'; |
346 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
346 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
347 | 347 | $host = 'ICDSoft'; |
348 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
348 | + } elseif (DB_HOST == 'mysqlv5') { |
|
349 | 349 | $host = 'NetworkSolutions'; |
350 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
350 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
351 | 351 | $host = 'iPage'; |
352 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
352 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
353 | 353 | $host = 'IPower'; |
354 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
354 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
355 | 355 | $host = 'MediaTemple Grid'; |
356 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
356 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
357 | 357 | $host = 'pair Networks'; |
358 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
358 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
359 | 359 | $host = 'Rackspace Cloud'; |
360 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
360 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
361 | 361 | $host = 'SysFix.eu Power Hosting'; |
362 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
362 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
363 | 363 | $host = 'Flywheel'; |
364 | 364 | } else { |
365 | 365 | // Adding a general fallback for data gathering |
366 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
366 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | return $host; |
@@ -379,67 +379,67 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @return bool true if host matches, false if not |
381 | 381 | */ |
382 | -function give_is_host( $host = false ) { |
|
382 | +function give_is_host($host = false) { |
|
383 | 383 | |
384 | 384 | $return = false; |
385 | 385 | |
386 | - if ( $host ) { |
|
387 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
386 | + if ($host) { |
|
387 | + $host = str_replace(' ', '', strtolower($host)); |
|
388 | 388 | |
389 | - switch ( $host ) { |
|
389 | + switch ($host) { |
|
390 | 390 | case 'wpengine': |
391 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
391 | + if (defined('WPE_APIKEY')) { |
|
392 | 392 | $return = true; |
393 | 393 | } |
394 | 394 | break; |
395 | 395 | case 'pagely': |
396 | - if ( defined( 'PAGELYBIN' ) ) { |
|
396 | + if (defined('PAGELYBIN')) { |
|
397 | 397 | $return = true; |
398 | 398 | } |
399 | 399 | break; |
400 | 400 | case 'icdsoft': |
401 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
401 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
402 | 402 | $return = true; |
403 | 403 | } |
404 | 404 | break; |
405 | 405 | case 'networksolutions': |
406 | - if ( DB_HOST == 'mysqlv5' ) { |
|
406 | + if (DB_HOST == 'mysqlv5') { |
|
407 | 407 | $return = true; |
408 | 408 | } |
409 | 409 | break; |
410 | 410 | case 'ipage': |
411 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
411 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
412 | 412 | $return = true; |
413 | 413 | } |
414 | 414 | break; |
415 | 415 | case 'ipower': |
416 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
416 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
417 | 417 | $return = true; |
418 | 418 | } |
419 | 419 | break; |
420 | 420 | case 'mediatemplegrid': |
421 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
421 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
422 | 422 | $return = true; |
423 | 423 | } |
424 | 424 | break; |
425 | 425 | case 'pairnetworks': |
426 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
426 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
427 | 427 | $return = true; |
428 | 428 | } |
429 | 429 | break; |
430 | 430 | case 'rackspacecloud': |
431 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
431 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
432 | 432 | $return = true; |
433 | 433 | } |
434 | 434 | break; |
435 | 435 | case 'sysfix.eu': |
436 | 436 | case 'sysfix.eupowerhosting': |
437 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
437 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
438 | 438 | $return = true; |
439 | 439 | } |
440 | 440 | break; |
441 | 441 | case 'flywheel': |
442 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
442 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
443 | 443 | $return = true; |
444 | 444 | } |
445 | 445 | break; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param string $replacement Optional. The function that should have been called. |
473 | 473 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
474 | 474 | */ |
475 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
475 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
476 | 476 | |
477 | 477 | /** |
478 | 478 | * Fires while give deprecated function call occurs. |
@@ -485,19 +485,19 @@ discard block |
||
485 | 485 | * @param string $replacement Optional. The function that should have been called. |
486 | 486 | * @param string $version The plugin version that deprecated the function. |
487 | 487 | */ |
488 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
488 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
489 | 489 | |
490 | - $show_errors = current_user_can( 'manage_options' ); |
|
490 | + $show_errors = current_user_can('manage_options'); |
|
491 | 491 | |
492 | 492 | // Allow plugin to filter the output error trigger. |
493 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
494 | - if ( ! is_null( $replacement ) ) { |
|
495 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
496 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
493 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
494 | + if ( ! is_null($replacement)) { |
|
495 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
496 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
497 | 497 | // Alternatively we could dump this to a file. |
498 | 498 | } else { |
499 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
500 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
499 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
500 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
501 | 501 | // Alternatively we could dump this to a file. |
502 | 502 | } |
503 | 503 | } |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | * @return string $post_id |
512 | 512 | */ |
513 | 513 | function give_get_admin_post_id() { |
514 | - $post_id = isset( $_REQUEST['post'] ) ? absint( $_REQUEST['post'] ) : null; |
|
514 | + $post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : null; |
|
515 | 515 | |
516 | - $post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null ); |
|
516 | + $post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null); |
|
517 | 517 | |
518 | - $post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null ); |
|
518 | + $post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null); |
|
519 | 519 | |
520 | 520 | return $post_id; |
521 | 521 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return string Arg separator output |
528 | 528 | */ |
529 | 529 | function give_get_php_arg_separator_output() { |
530 | - return ini_get( 'arg_separator.output' ); |
|
530 | + return ini_get('arg_separator.output'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | * |
543 | 543 | * @return string Short month name |
544 | 544 | */ |
545 | -function give_month_num_to_name( $n ) { |
|
546 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
545 | +function give_month_num_to_name($n) { |
|
546 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
547 | 547 | |
548 | - return date_i18n( 'M', $timestamp ); |
|
548 | + return date_i18n('M', $timestamp); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return bool Whether or not function is disabled. |
560 | 560 | */ |
561 | -function give_is_func_disabled( $function ) { |
|
562 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
561 | +function give_is_func_disabled($function) { |
|
562 | + $disabled = explode(',', ini_get('disable_functions')); |
|
563 | 563 | |
564 | - return in_array( $function, $disabled ); |
|
564 | + return in_array($function, $disabled); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | function give_get_newsletter() { |
573 | 573 | ?> |
574 | 574 | |
575 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
575 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
576 | 576 | |
577 | 577 | <div class="give-newsletter-form-wrap"> |
578 | 578 | |
@@ -580,33 +580,33 @@ discard block |
||
580 | 580 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
581 | 581 | target="_blank"> |
582 | 582 | <div class="give-newsletter-confirmation"> |
583 | - <p><?php esc_html_e( 'To complete your subscription, click the confirmation link in your email. Thank you!', 'give' ); ?></p> |
|
583 | + <p><?php esc_html_e('To complete your subscription, click the confirmation link in your email. Thank you!', 'give'); ?></p> |
|
584 | 584 | </div> |
585 | 585 | |
586 | 586 | <table class="form-table give-newsletter-form"> |
587 | 587 | <tr valign="middle"> |
588 | 588 | <td> |
589 | 589 | <label for="mce-EMAIL" |
590 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
590 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
591 | 591 | <input type="email" name="EMAIL" id="mce-EMAIL" |
592 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
592 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
593 | 593 | class="required email" value="" required> |
594 | 594 | </td> |
595 | 595 | <td> |
596 | 596 | <label for="mce-FNAME" |
597 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
597 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
598 | 598 | <input type="text" name="FNAME" id="mce-FNAME" |
599 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="" required> |
|
599 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="" required> |
|
600 | 600 | </td> |
601 | 601 | <td> |
602 | 602 | <label for="mce-LNAME" |
603 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
603 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
604 | 604 | <input type="text" name="LNAME" id="mce-LNAME" |
605 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
605 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
606 | 606 | </td> |
607 | 607 | <td> |
608 | 608 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
609 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
609 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
610 | 610 | </td> |
611 | 611 | </tr> |
612 | 612 | </table> |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | * |
664 | 664 | * @return string |
665 | 665 | */ |
666 | -function give_svg_icons( $icon ) { |
|
666 | +function give_svg_icons($icon) { |
|
667 | 667 | |
668 | 668 | // Store your SVGs in an associative array |
669 | 669 | $svgs = array( |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | ); |
676 | 676 | |
677 | 677 | // Return the chosen icon's SVG string |
678 | - return $svgs[ $icon ]; |
|
678 | + return $svgs[$icon]; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
@@ -687,15 +687,15 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @return mixed |
689 | 689 | */ |
690 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
691 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
692 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
690 | +function modify_nav_menu_meta_box_object($post_type) { |
|
691 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
692 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | return $post_type; |
696 | 696 | } |
697 | 697 | |
698 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
698 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
699 | 699 | |
700 | 700 | /** |
701 | 701 | * Show Donation Forms Post Type in Appearance > Menus by default on fresh install. |
@@ -712,30 +712,30 @@ discard block |
||
712 | 712 | $screen = get_current_screen(); |
713 | 713 | |
714 | 714 | // Proceed, if current screen is navigation menus. |
715 | - if ( 'nav-menus' === $screen->id && give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && ! get_user_option( 'give_is_donation_forms_menu_updated' ) ) { |
|
715 | + if ('nav-menus' === $screen->id && give_is_setting_enabled(give_get_option('forms_singular')) && ! get_user_option('give_is_donation_forms_menu_updated')) { |
|
716 | 716 | |
717 | 717 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
718 | - if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) ) { |
|
718 | + if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))) { |
|
719 | 719 | return false; |
720 | 720 | } |
721 | 721 | |
722 | 722 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
723 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
723 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
724 | 724 | return false; |
725 | 725 | } |
726 | 726 | |
727 | 727 | // Exclude 'Donation Form' value from hidden meta box's list. |
728 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
728 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
729 | 729 | |
730 | 730 | // Get current user ID. |
731 | 731 | $user = wp_get_current_user(); |
732 | 732 | |
733 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
734 | - update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true ); |
|
733 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
734 | + update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
738 | -add_action( 'current_screen', 'give_donation_metabox_menu' ); |
|
738 | +add_action('current_screen', 'give_donation_metabox_menu'); |
|
739 | 739 | |
740 | 740 | /** |
741 | 741 | * Array_column backup usage |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | * @license https://opensource.org/licenses/MIT MIT |
749 | 749 | */ |
750 | 750 | |
751 | -if ( ! function_exists( 'array_column' ) ) { |
|
751 | +if ( ! function_exists('array_column')) { |
|
752 | 752 | /** |
753 | 753 | * Returns the values from a single column of the input array, identified by |
754 | 754 | * the $columnKey. |
@@ -767,43 +767,43 @@ discard block |
||
767 | 767 | * |
768 | 768 | * @return array |
769 | 769 | */ |
770 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
770 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
771 | 771 | // Using func_get_args() in order to check for proper number of |
772 | 772 | // parameters and trigger errors exactly as the built-in array_column() |
773 | 773 | // does in PHP 5.5. |
774 | 774 | $argc = func_num_args(); |
775 | 775 | $params = func_get_args(); |
776 | 776 | |
777 | - if ( $argc < 2 ) { |
|
778 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
777 | + if ($argc < 2) { |
|
778 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
779 | 779 | |
780 | 780 | return null; |
781 | 781 | } |
782 | 782 | |
783 | - if ( ! is_array( $params[0] ) ) { |
|
784 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
783 | + if ( ! is_array($params[0])) { |
|
784 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
785 | 785 | |
786 | 786 | return null; |
787 | 787 | } |
788 | 788 | |
789 | - if ( ! is_int( $params[1] ) && ! is_float( $params[1] ) && ! is_string( $params[1] ) && $params[1] !== null && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) ) { |
|
790 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
789 | + if ( ! is_int($params[1]) && ! is_float($params[1]) && ! is_string($params[1]) && $params[1] !== null && ! (is_object($params[1]) && method_exists($params[1], '__toString'))) { |
|
790 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
791 | 791 | |
792 | 792 | return false; |
793 | 793 | } |
794 | 794 | |
795 | - if ( isset( $params[2] ) && ! is_int( $params[2] ) && ! is_float( $params[2] ) && ! is_string( $params[2] ) && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) ) { |
|
796 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
795 | + if (isset($params[2]) && ! is_int($params[2]) && ! is_float($params[2]) && ! is_string($params[2]) && ! (is_object($params[2]) && method_exists($params[2], '__toString'))) { |
|
796 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
797 | 797 | |
798 | 798 | return false; |
799 | 799 | } |
800 | 800 | |
801 | 801 | $paramsInput = $params[0]; |
802 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
802 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
803 | 803 | |
804 | 804 | $paramsIndexKey = null; |
805 | - if ( isset( $params[2] ) ) { |
|
806 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
805 | + if (isset($params[2])) { |
|
806 | + if (is_float($params[2]) || is_int($params[2])) { |
|
807 | 807 | $paramsIndexKey = (int) $params[2]; |
808 | 808 | } else { |
809 | 809 | $paramsIndexKey = (string) $params[2]; |
@@ -812,26 +812,26 @@ discard block |
||
812 | 812 | |
813 | 813 | $resultArray = array(); |
814 | 814 | |
815 | - foreach ( $paramsInput as $row ) { |
|
815 | + foreach ($paramsInput as $row) { |
|
816 | 816 | $key = $value = null; |
817 | 817 | $keySet = $valueSet = false; |
818 | 818 | |
819 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
819 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
820 | 820 | $keySet = true; |
821 | - $key = (string) $row[ $paramsIndexKey ]; |
|
821 | + $key = (string) $row[$paramsIndexKey]; |
|
822 | 822 | } |
823 | 823 | |
824 | - if ( $paramsColumnKey === null ) { |
|
824 | + if ($paramsColumnKey === null) { |
|
825 | 825 | $valueSet = true; |
826 | 826 | $value = $row; |
827 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
827 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
828 | 828 | $valueSet = true; |
829 | - $value = $row[ $paramsColumnKey ]; |
|
829 | + $value = $row[$paramsColumnKey]; |
|
830 | 830 | } |
831 | 831 | |
832 | - if ( $valueSet ) { |
|
833 | - if ( $keySet ) { |
|
834 | - $resultArray[ $key ] = $value; |
|
832 | + if ($valueSet) { |
|
833 | + if ($keySet) { |
|
834 | + $resultArray[$key] = $value; |
|
835 | 835 | } else { |
836 | 836 | $resultArray[] = $value; |
837 | 837 | } |
@@ -851,54 +851,54 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return bool Whether the receipt is visible or not. |
853 | 853 | */ |
854 | -function give_can_view_receipt( $payment_key = '' ) { |
|
854 | +function give_can_view_receipt($payment_key = '') { |
|
855 | 855 | |
856 | 856 | $return = false; |
857 | 857 | |
858 | - if ( empty( $payment_key ) ) { |
|
858 | + if (empty($payment_key)) { |
|
859 | 859 | return $return; |
860 | 860 | } |
861 | 861 | |
862 | 862 | global $give_receipt_args; |
863 | 863 | |
864 | - $give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key ); |
|
864 | + $give_receipt_args['id'] = give_get_donation_id_by_key($payment_key); |
|
865 | 865 | |
866 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
866 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
867 | 867 | |
868 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
868 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
869 | 869 | |
870 | - if ( is_user_logged_in() ) { |
|
871 | - if ( $user_id === (int) get_current_user_id() ) { |
|
870 | + if (is_user_logged_in()) { |
|
871 | + if ($user_id === (int) get_current_user_id()) { |
|
872 | 872 | $return = true; |
873 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
873 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
874 | 874 | $return = true; |
875 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
875 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
876 | 876 | $return = true; |
877 | 877 | } |
878 | 878 | } |
879 | 879 | |
880 | 880 | // Check whether it is purchase session? |
881 | 881 | $purchase_session = give_get_purchase_session(); |
882 | - if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) { |
|
883 | - if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) { |
|
882 | + if ( ! empty($purchase_session) && ! is_user_logged_in()) { |
|
883 | + if ($purchase_session['purchase_key'] === $payment_meta['key']) { |
|
884 | 884 | $return = true; |
885 | 885 | } |
886 | 886 | } |
887 | 887 | |
888 | 888 | // Check whether it is receipt access session? |
889 | 889 | $receipt_session = give_get_receipt_session(); |
890 | - if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) { |
|
891 | - if ( $receipt_session === $payment_meta['key'] ) { |
|
890 | + if ( ! empty($receipt_session) && ! is_user_logged_in()) { |
|
891 | + if ($receipt_session === $payment_meta['key']) { |
|
892 | 892 | $return = true; |
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
896 | 896 | // Check whether it is history access session? |
897 | - if ( true === give_get_history_session() ) { |
|
897 | + if (true === give_get_history_session()) { |
|
898 | 898 | $return = true; |
899 | 899 | } |
900 | 900 | |
901 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
901 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
902 | 902 | |
903 | 903 | } |
904 | 904 | |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * |
908 | 908 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
909 | 909 | */ |
910 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
910 | +if ( ! function_exists('cal_days_in_month')) { |
|
911 | 911 | /** |
912 | 912 | * cal_days_in_month |
913 | 913 | * |
@@ -917,8 +917,8 @@ discard block |
||
917 | 917 | * |
918 | 918 | * @return bool|string |
919 | 919 | */ |
920 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
921 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
920 | + function cal_days_in_month($calendar, $month, $year) { |
|
921 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | |
@@ -937,40 +937,40 @@ discard block |
||
937 | 937 | */ |
938 | 938 | function give_get_plugins() { |
939 | 939 | $plugins = get_plugins(); |
940 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
940 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
941 | 941 | |
942 | - if ( is_multisite() ) { |
|
943 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
944 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
942 | + if (is_multisite()) { |
|
943 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
944 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
945 | 945 | } |
946 | 946 | |
947 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
947 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
948 | 948 | // Is plugin active? |
949 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
950 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
949 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
950 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
951 | 951 | } else { |
952 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
952 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
953 | 953 | } |
954 | 954 | |
955 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
955 | + $dirname = strtolower(dirname($plugin_path)); |
|
956 | 956 | |
957 | 957 | // Is plugin a Give add-on by WordImpress? |
958 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
958 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
959 | 959 | // Plugin is a Give-addon. |
960 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
960 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
961 | 961 | |
962 | 962 | /* @var stdClass $license_active */ |
963 | - $license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) ); |
|
963 | + $license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name'])); |
|
964 | 964 | |
965 | 965 | // Does a valid license exist? |
966 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
967 | - $plugins[ $plugin_path ]['License'] = true; |
|
966 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
967 | + $plugins[$plugin_path]['License'] = true; |
|
968 | 968 | } else { |
969 | - $plugins[ $plugin_path ]['License'] = false; |
|
969 | + $plugins[$plugin_path]['License'] = false; |
|
970 | 970 | } |
971 | 971 | } else { |
972 | 972 | // Plugin is not a Give add-on. |
973 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
973 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | |
@@ -986,13 +986,13 @@ discard block |
||
986 | 986 | * |
987 | 987 | * @return bool |
988 | 988 | */ |
989 | -function give_is_terms_enabled( $form_id ) { |
|
990 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
989 | +function give_is_terms_enabled($form_id) { |
|
990 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
991 | 991 | |
992 | - if ( give_is_setting_enabled( $form_option, 'global' ) && give_is_setting_enabled( give_get_option( 'terms' ) ) ) { |
|
992 | + if (give_is_setting_enabled($form_option, 'global') && give_is_setting_enabled(give_get_option('terms'))) { |
|
993 | 993 | return true; |
994 | 994 | |
995 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
995 | + } elseif (give_is_setting_enabled($form_option)) { |
|
996 | 996 | return true; |
997 | 997 | |
998 | 998 | } else { |
@@ -1016,10 +1016,10 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return WP_Error|bool |
1018 | 1018 | */ |
1019 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1019 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1020 | 1020 | |
1021 | 1021 | // Delete all cache. |
1022 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1022 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1023 | 1023 | |
1024 | 1024 | /** |
1025 | 1025 | * Fire the action when donation stats delete. |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * @param string|array $date_range |
1030 | 1030 | * @param array $args |
1031 | 1031 | */ |
1032 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1032 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1033 | 1033 | |
1034 | 1034 | return $status; |
1035 | 1035 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | function give_is_add_new_form_page() { |
1044 | 1044 | $status = false; |
1045 | 1045 | |
1046 | - if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) { |
|
1046 | + if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) { |
|
1047 | 1047 | $status = true; |
1048 | 1048 | } |
1049 | 1049 | |
@@ -1066,15 +1066,15 @@ discard block |
||
1066 | 1066 | * |
1067 | 1067 | * @return mixed |
1068 | 1068 | */ |
1069 | -function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) { |
|
1069 | +function give_get_meta($id, $meta_key = '', $single = false, $default = false) { |
|
1070 | 1070 | /** |
1071 | 1071 | * Filter the meta value |
1072 | 1072 | * |
1073 | 1073 | * @since 1.8.8 |
1074 | 1074 | */ |
1075 | - $meta_value = apply_filters( 'give_get_meta', get_post_meta( $id, $meta_key, $single ), $id, $meta_key, $default ); |
|
1075 | + $meta_value = apply_filters('give_get_meta', get_post_meta($id, $meta_key, $single), $id, $meta_key, $default); |
|
1076 | 1076 | |
1077 | - if ( ( empty( $meta_key ) || empty( $meta_value ) ) && $default ) { |
|
1077 | + if ((empty($meta_key) || empty($meta_value)) && $default) { |
|
1078 | 1078 | $meta_value = $default; |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1093,15 +1093,15 @@ discard block |
||
1093 | 1093 | * |
1094 | 1094 | * @return mixed |
1095 | 1095 | */ |
1096 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1097 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1096 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1097 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1098 | 1098 | |
1099 | 1099 | /** |
1100 | 1100 | * Filter the meta value update status |
1101 | 1101 | * |
1102 | 1102 | * @since 1.8.8 |
1103 | 1103 | */ |
1104 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1104 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | /** |
@@ -1115,15 +1115,15 @@ discard block |
||
1115 | 1115 | * |
1116 | 1116 | * @return mixed |
1117 | 1117 | */ |
1118 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1119 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1118 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1119 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1120 | 1120 | |
1121 | 1121 | /** |
1122 | 1122 | * Filter the meta value delete status |
1123 | 1123 | * |
1124 | 1124 | * @since 1.8.8 |
1125 | 1125 | */ |
1126 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1126 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | /** |
@@ -1135,22 +1135,22 @@ discard block |
||
1135 | 1135 | * |
1136 | 1136 | * @return bool If the action has been added to the completed actions array |
1137 | 1137 | */ |
1138 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1138 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1139 | 1139 | // Bailout. |
1140 | - if ( empty( $upgrade_action ) ) { |
|
1140 | + if (empty($upgrade_action)) { |
|
1141 | 1141 | return false; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | // Fresh install? |
1145 | 1145 | // If fresh install then all upgrades will be consider as completed. |
1146 | - $is_fresh_install = ! get_option( 'give_version' ); |
|
1147 | - if ( $is_fresh_install ) { |
|
1146 | + $is_fresh_install = ! get_option('give_version'); |
|
1147 | + if ($is_fresh_install) { |
|
1148 | 1148 | return true; |
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | $completed_upgrades = give_get_completed_upgrades(); |
1152 | 1152 | |
1153 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1153 | + return in_array($upgrade_action, $completed_upgrades); |
|
1154 | 1154 | |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1162,8 +1162,8 @@ discard block |
||
1162 | 1162 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1163 | 1163 | */ |
1164 | 1164 | function give_maybe_resume_upgrade() { |
1165 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1166 | - if ( empty( $doing_upgrade ) ) { |
|
1165 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1166 | + if (empty($doing_upgrade)) { |
|
1167 | 1167 | return false; |
1168 | 1168 | } |
1169 | 1169 | |
@@ -1179,9 +1179,9 @@ discard block |
||
1179 | 1179 | * |
1180 | 1180 | * @return bool If the function was successfully added |
1181 | 1181 | */ |
1182 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1182 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1183 | 1183 | |
1184 | - if ( empty( $upgrade_action ) ) { |
|
1184 | + if (empty($upgrade_action)) { |
|
1185 | 1185 | return false; |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1189,16 +1189,16 @@ discard block |
||
1189 | 1189 | $completed_upgrades[] = $upgrade_action; |
1190 | 1190 | |
1191 | 1191 | // Remove any blanks, and only show uniques. |
1192 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1192 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1193 | 1193 | |
1194 | 1194 | /** |
1195 | 1195 | * Fire the action when any upgrade set to complete. |
1196 | 1196 | * |
1197 | 1197 | * @since 1.8.12 |
1198 | 1198 | */ |
1199 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1199 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1200 | 1200 | |
1201 | - return update_option( 'give_completed_upgrades', $completed_upgrades, false ); |
|
1201 | + return update_option('give_completed_upgrades', $completed_upgrades, false); |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | * @return array The array of completed upgrades |
1209 | 1209 | */ |
1210 | 1210 | function give_get_completed_upgrades() { |
1211 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1211 | + return (array) get_option('give_completed_upgrades'); |
|
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | /** |
@@ -1223,16 +1223,16 @@ discard block |
||
1223 | 1223 | * |
1224 | 1224 | * @return null|array |
1225 | 1225 | */ |
1226 | -function __give_v20_bc_table_details( $type ) { |
|
1226 | +function __give_v20_bc_table_details($type) { |
|
1227 | 1227 | global $wpdb; |
1228 | 1228 | $table = array(); |
1229 | 1229 | |
1230 | 1230 | // Bailout. |
1231 | - if ( empty( $type ) ) { |
|
1231 | + if (empty($type)) { |
|
1232 | 1232 | return null; |
1233 | 1233 | } |
1234 | 1234 | |
1235 | - switch ( $type ) { |
|
1235 | + switch ($type) { |
|
1236 | 1236 | case 'form': |
1237 | 1237 | $table['name'] = $wpdb->formmeta; |
1238 | 1238 | $table['column']['id'] = 'form_id'; |
@@ -1241,11 +1241,11 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | case 'payment': |
1243 | 1243 | $table['name'] = $wpdb->donationmeta; |
1244 | - $table['column']['id'] = Give()->payment_meta->get_meta_type() . '_id'; |
|
1244 | + $table['column']['id'] = Give()->payment_meta->get_meta_type().'_id'; |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | // Backward compatibility. |
1248 | - if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) { |
|
1248 | + if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) { |
|
1249 | 1249 | $table['name'] = $wpdb->postmeta; |
1250 | 1250 | $table['column']['id'] = 'post_id'; |
1251 | 1251 | } |
@@ -1260,12 +1260,12 @@ discard block |
||
1260 | 1260 | * |
1261 | 1261 | * @param WP_Query $query |
1262 | 1262 | */ |
1263 | -function give_remove_pages_from_search( $query ) { |
|
1263 | +function give_remove_pages_from_search($query) { |
|
1264 | 1264 | |
1265 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1265 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1266 | 1266 | |
1267 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1268 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1267 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1268 | + $success_page = give_get_option('success_page', 0); |
|
1269 | 1269 | |
1270 | 1270 | $args = apply_filters( |
1271 | 1271 | 'give_remove_pages_from_search', array( |
@@ -1273,11 +1273,11 @@ discard block |
||
1273 | 1273 | $success_page, |
1274 | 1274 | ), $query |
1275 | 1275 | ); |
1276 | - $query->set( 'post__not_in', $args ); |
|
1276 | + $query->set('post__not_in', $args); |
|
1277 | 1277 | } |
1278 | 1278 | } |
1279 | 1279 | |
1280 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1280 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1281 | 1281 | |
1282 | 1282 | /** |
1283 | 1283 | * Inserts a new key/value before a key in the array. |
@@ -1293,14 +1293,14 @@ discard block |
||
1293 | 1293 | * |
1294 | 1294 | * @see array_insert_before() |
1295 | 1295 | */ |
1296 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
1297 | - if ( array_key_exists( $key, $array ) ) { |
|
1296 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
1297 | + if (array_key_exists($key, $array)) { |
|
1298 | 1298 | $new = array(); |
1299 | - foreach ( $array as $k => $value ) { |
|
1300 | - if ( $k === $key ) { |
|
1301 | - $new[ $new_key ] = $new_value; |
|
1299 | + foreach ($array as $k => $value) { |
|
1300 | + if ($k === $key) { |
|
1301 | + $new[$new_key] = $new_value; |
|
1302 | 1302 | } |
1303 | - $new[ $k ] = $value; |
|
1303 | + $new[$k] = $value; |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | return $new; |
@@ -1323,13 +1323,13 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @see array_insert_before() |
1325 | 1325 | */ |
1326 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
1327 | - if ( array_key_exists( $key, $array ) ) { |
|
1326 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
1327 | + if (array_key_exists($key, $array)) { |
|
1328 | 1328 | $new = array(); |
1329 | - foreach ( $array as $k => $value ) { |
|
1330 | - $new[ $k ] = $value; |
|
1331 | - if ( $k === $key ) { |
|
1332 | - $new[ $new_key ] = $new_value; |
|
1329 | + foreach ($array as $k => $value) { |
|
1330 | + $new[$k] = $value; |
|
1331 | + if ($k === $key) { |
|
1332 | + $new[$new_key] = $new_value; |
|
1333 | 1333 | } |
1334 | 1334 | } |
1335 | 1335 | |
@@ -1356,21 +1356,21 @@ discard block |
||
1356 | 1356 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
1357 | 1357 | * `$list` will be preserved in the results. |
1358 | 1358 | */ |
1359 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
1359 | +function give_list_pluck($list, $field, $index_key = null) { |
|
1360 | 1360 | |
1361 | - if ( ! $index_key ) { |
|
1361 | + if ( ! $index_key) { |
|
1362 | 1362 | /** |
1363 | 1363 | * This is simple. Could at some point wrap array_column() |
1364 | 1364 | * if we knew we had an array of arrays. |
1365 | 1365 | */ |
1366 | - foreach ( $list as $key => $value ) { |
|
1367 | - if ( is_object( $value ) ) { |
|
1368 | - if ( isset( $value->$field ) ) { |
|
1369 | - $list[ $key ] = $value->$field; |
|
1366 | + foreach ($list as $key => $value) { |
|
1367 | + if (is_object($value)) { |
|
1368 | + if (isset($value->$field)) { |
|
1369 | + $list[$key] = $value->$field; |
|
1370 | 1370 | } |
1371 | 1371 | } else { |
1372 | - if ( isset( $value[ $field ] ) ) { |
|
1373 | - $list[ $key ] = $value[ $field ]; |
|
1372 | + if (isset($value[$field])) { |
|
1373 | + $list[$key] = $value[$field]; |
|
1374 | 1374 | } |
1375 | 1375 | } |
1376 | 1376 | } |
@@ -1383,18 +1383,18 @@ discard block |
||
1383 | 1383 | * to the end of the stack. This is how array_column() behaves. |
1384 | 1384 | */ |
1385 | 1385 | $newlist = array(); |
1386 | - foreach ( $list as $value ) { |
|
1387 | - if ( is_object( $value ) ) { |
|
1388 | - if ( isset( $value->$index_key ) ) { |
|
1389 | - $newlist[ $value->$index_key ] = $value->$field; |
|
1386 | + foreach ($list as $value) { |
|
1387 | + if (is_object($value)) { |
|
1388 | + if (isset($value->$index_key)) { |
|
1389 | + $newlist[$value->$index_key] = $value->$field; |
|
1390 | 1390 | } else { |
1391 | 1391 | $newlist[] = $value->$field; |
1392 | 1392 | } |
1393 | 1393 | } else { |
1394 | - if ( isset( $value[ $index_key ] ) ) { |
|
1395 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
1394 | + if (isset($value[$index_key])) { |
|
1395 | + $newlist[$value[$index_key]] = $value[$field]; |
|
1396 | 1396 | } else { |
1397 | - $newlist[] = $value[ $field ]; |
|
1397 | + $newlist[] = $value[$field]; |
|
1398 | 1398 | } |
1399 | 1399 | } |
1400 | 1400 | } |
@@ -1417,8 +1417,8 @@ discard block |
||
1417 | 1417 | * |
1418 | 1418 | * @return int|false Meta ID on success, false on failure. |
1419 | 1419 | */ |
1420 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
1421 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
1420 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
1421 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | /** |
@@ -1436,8 +1436,8 @@ discard block |
||
1436 | 1436 | * |
1437 | 1437 | * @return bool True on success, false on failure. |
1438 | 1438 | */ |
1439 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
1440 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
1439 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
1440 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | /** |
@@ -1452,8 +1452,8 @@ discard block |
||
1452 | 1452 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
1453 | 1453 | * is true. |
1454 | 1454 | */ |
1455 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
1456 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
1455 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
1456 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | /** |
@@ -1470,8 +1470,8 @@ discard block |
||
1470 | 1470 | * |
1471 | 1471 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
1472 | 1472 | */ |
1473 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1474 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
1473 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
1474 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
1475 | 1475 | } |
1476 | 1476 | |
1477 | 1477 | |
@@ -1484,15 +1484,15 @@ discard block |
||
1484 | 1484 | * |
1485 | 1485 | * @return void |
1486 | 1486 | */ |
1487 | -function give_recount_form_income_donation( $form_id = 0 ) { |
|
1487 | +function give_recount_form_income_donation($form_id = 0) { |
|
1488 | 1488 | // Check if form id is not empty. |
1489 | - if ( ! empty( $form_id ) ) { |
|
1489 | + if ( ! empty($form_id)) { |
|
1490 | 1490 | /** |
1491 | 1491 | * Filter to modify payment status. |
1492 | 1492 | * |
1493 | 1493 | * @since 1.8.13 |
1494 | 1494 | */ |
1495 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
1495 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
1496 | 1496 | |
1497 | 1497 | /** |
1498 | 1498 | * Filter to modify args of payment query before recalculating the form total |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | 'give_recount_form_stats_args', array( |
1504 | 1504 | 'give_forms' => $form_id, |
1505 | 1505 | 'status' => $accepted_statuses, |
1506 | - 'posts_per_page' => - 1, |
|
1506 | + 'posts_per_page' => -1, |
|
1507 | 1507 | 'fields' => 'ids', |
1508 | 1508 | ) |
1509 | 1509 | ); |
@@ -1513,28 +1513,28 @@ discard block |
||
1513 | 1513 | 'earnings' => 0, |
1514 | 1514 | ); |
1515 | 1515 | |
1516 | - $payments = new Give_Payments_Query( $args ); |
|
1516 | + $payments = new Give_Payments_Query($args); |
|
1517 | 1517 | $payments = $payments->get_payments(); |
1518 | 1518 | |
1519 | - if ( $payments ) { |
|
1520 | - foreach ( $payments as $payment ) { |
|
1519 | + if ($payments) { |
|
1520 | + foreach ($payments as $payment) { |
|
1521 | 1521 | // Ensure acceptible status only |
1522 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
1522 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
1523 | 1523 | continue; |
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | // Ensure only payments for this form are counted |
1527 | - if ( $payment->form_id != $form_id ) { |
|
1527 | + if ($payment->form_id != $form_id) { |
|
1528 | 1528 | continue; |
1529 | 1529 | } |
1530 | 1530 | |
1531 | - $totals['sales'] ++; |
|
1531 | + $totals['sales']++; |
|
1532 | 1532 | $totals['earnings'] += $payment->total; |
1533 | 1533 | |
1534 | 1534 | } |
1535 | 1535 | } |
1536 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
1537 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
1536 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
1537 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
1538 | 1538 | }// End if(). |
1539 | 1539 | } |
1540 | 1540 | |
@@ -1549,26 +1549,26 @@ discard block |
||
1549 | 1549 | * |
1550 | 1550 | * @return string |
1551 | 1551 | */ |
1552 | -function give_get_attribute_str( $attributes, $default_attributes = array() ) { |
|
1552 | +function give_get_attribute_str($attributes, $default_attributes = array()) { |
|
1553 | 1553 | $attribute_str = ''; |
1554 | 1554 | |
1555 | - if ( isset( $attributes['attributes'] ) ) { |
|
1555 | + if (isset($attributes['attributes'])) { |
|
1556 | 1556 | $attributes = $attributes['attributes']; |
1557 | 1557 | } |
1558 | 1558 | |
1559 | - if ( ! empty( $default_attributes ) ) { |
|
1560 | - $attributes = wp_parse_args( $attributes, $default_attributes ); |
|
1559 | + if ( ! empty($default_attributes)) { |
|
1560 | + $attributes = wp_parse_args($attributes, $default_attributes); |
|
1561 | 1561 | } |
1562 | 1562 | |
1563 | - if ( empty( $attributes ) ) { |
|
1563 | + if (empty($attributes)) { |
|
1564 | 1564 | return $attribute_str; |
1565 | 1565 | } |
1566 | 1566 | |
1567 | - foreach ( $attributes as $tag => $value ) { |
|
1567 | + foreach ($attributes as $tag => $value) { |
|
1568 | 1568 | $attribute_str .= " {$tag}=\"{$value}\""; |
1569 | 1569 | } |
1570 | 1570 | |
1571 | - return trim( $attribute_str ); |
|
1571 | + return trim($attribute_str); |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | /** |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | function give_get_wp_upload_dir() { |
1582 | 1582 | $wp_upload_dir = wp_upload_dir(); |
1583 | 1583 | |
1584 | - return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false ); |
|
1584 | + return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false); |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | 1587 | /** |
@@ -1593,15 +1593,15 @@ discard block |
||
1593 | 1593 | * |
1594 | 1594 | * @return string|bool $file_contents File content |
1595 | 1595 | */ |
1596 | -function give_get_core_settings_json( $file_name ) { |
|
1596 | +function give_get_core_settings_json($file_name) { |
|
1597 | 1597 | $upload_dir = give_get_wp_upload_dir(); |
1598 | - $file_path = $upload_dir . '/' . $file_name; |
|
1598 | + $file_path = $upload_dir.'/'.$file_name; |
|
1599 | 1599 | |
1600 | - if ( is_wp_error( $file_path ) || empty( $file_path ) ) { |
|
1601 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
1600 | + if (is_wp_error($file_path) || empty($file_path)) { |
|
1601 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | - $file_contents = file_get_contents( $file_path ); |
|
1604 | + $file_contents = file_get_contents($file_path); |
|
1605 | 1605 | |
1606 | 1606 | return $file_contents; |
1607 | 1607 | } |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | * @return int $country The two letter country code for the site's base country |
1615 | 1615 | */ |
1616 | 1616 | function give_get_limit_display_donations() { |
1617 | - return give_get_option( 'limit_display_donations', 1 ); |
|
1617 | + return give_get_option('limit_display_donations', 1); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | /** |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | * @since 1.8.17 |
1624 | 1624 | */ |
1625 | 1625 | function give_donation_history_table_end() { |
1626 | - $email = Give()->session->get( 'give_email' ); |
|
1626 | + $email = Give()->session->get('give_email'); |
|
1627 | 1627 | ?> |
1628 | 1628 | <tfoot> |
1629 | 1629 | <tr> |
@@ -1631,15 +1631,15 @@ discard block |
||
1631 | 1631 | <div class="give-security-wrap"> |
1632 | 1632 | <div class="give-security-column give-security-description-wrap"> |
1633 | 1633 | <?php |
1634 | - echo sprintf( __( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ), $email ); |
|
1634 | + echo sprintf(__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'), $email); |
|
1635 | 1635 | ?> |
1636 | 1636 | </div> |
1637 | 1637 | <div class="give-security-column give-security-button-wrap"> |
1638 | 1638 | <a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" |
1639 | 1639 | class="give-confirm-email-btn give-btn"> |
1640 | - <?php _e( 'Confirm Email', 'give' ); ?> |
|
1640 | + <?php _e('Confirm Email', 'give'); ?> |
|
1641 | 1641 | </a> |
1642 | - <span><?php _e( 'Email Sent!', 'give' ); ?></span> |
|
1642 | + <span><?php _e('Email Sent!', 'give'); ?></span> |
|
1643 | 1643 | </div> |
1644 | 1644 | </div> |
1645 | 1645 | </td> |
@@ -1660,10 +1660,10 @@ discard block |
||
1660 | 1660 | * |
1661 | 1661 | * @return void |
1662 | 1662 | */ |
1663 | -function give_doing_it_wrong( $function, $message, $version ) { |
|
1664 | - $message .= "\nBacktrace:" . wp_debug_backtrace_summary(); |
|
1663 | +function give_doing_it_wrong($function, $message, $version) { |
|
1664 | + $message .= "\nBacktrace:".wp_debug_backtrace_summary(); |
|
1665 | 1665 | |
1666 | - _doing_it_wrong( $function, $message, $version ); |
|
1666 | + _doing_it_wrong($function, $message, $version); |
|
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
@@ -1673,10 +1673,10 @@ discard block |
||
1673 | 1673 | * @since 1.8.18 |
1674 | 1674 | */ |
1675 | 1675 | function give_ignore_user_abort() { |
1676 | - ignore_user_abort( true ); |
|
1676 | + ignore_user_abort(true); |
|
1677 | 1677 | |
1678 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
1679 | - set_time_limit( 0 ); |
|
1678 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
1679 | + set_time_limit(0); |
|
1680 | 1680 | } |
1681 | 1681 | } |
1682 | 1682 | |
@@ -1690,28 +1690,28 @@ discard block |
||
1690 | 1690 | * |
1691 | 1691 | * @return int |
1692 | 1692 | */ |
1693 | -function give_get_total_post_type_count( $post_type = '', $args = array() ) { |
|
1693 | +function give_get_total_post_type_count($post_type = '', $args = array()) { |
|
1694 | 1694 | global $wpdb; |
1695 | 1695 | $where = ''; |
1696 | 1696 | |
1697 | - if ( ! $post_type ) { |
|
1697 | + if ( ! $post_type) { |
|
1698 | 1698 | return 0; |
1699 | 1699 | } |
1700 | 1700 | |
1701 | 1701 | // Bulit where query |
1702 | - if ( ! empty( $post_type ) ) { |
|
1702 | + if ( ! empty($post_type)) { |
|
1703 | 1703 | $where .= ' WHERE'; |
1704 | 1704 | |
1705 | - if ( is_array( $post_type ) ) { |
|
1706 | - $where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'"; |
|
1705 | + if (is_array($post_type)) { |
|
1706 | + $where .= " post_type='".implode("' OR post_type='", $post_type)."'"; |
|
1707 | 1707 | } else { |
1708 | 1708 | $where .= " post_type='{$post_type}'"; |
1709 | 1709 | } |
1710 | 1710 | } |
1711 | 1711 | |
1712 | - $result = $wpdb->get_var( "SELECT count(ID) FROM {$wpdb->posts}{$where}" ); |
|
1712 | + $result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}"); |
|
1713 | 1713 | |
1714 | - return absint( $result ); |
|
1714 | + return absint($result); |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1724,9 +1724,9 @@ discard block |
||
1724 | 1724 | * |
1725 | 1725 | * @credit WooCommerce |
1726 | 1726 | */ |
1727 | -function give_maybe_define_constant( $name, $value ) { |
|
1728 | - if ( ! defined( $name ) ) { |
|
1729 | - define( $name, $value ); |
|
1727 | +function give_maybe_define_constant($name, $value) { |
|
1728 | + if ( ! defined($name)) { |
|
1729 | + define($name, $value); |
|
1730 | 1730 | } |
1731 | 1731 | } |
1732 | 1732 | |
@@ -1740,8 +1740,8 @@ discard block |
||
1740 | 1740 | * |
1741 | 1741 | * @return string |
1742 | 1742 | */ |
1743 | -function give_time_do_tags( $string, $timestamp = 0 ) { |
|
1744 | - $current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' ); |
|
1743 | +function give_time_do_tags($string, $timestamp = 0) { |
|
1744 | + $current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp'); |
|
1745 | 1745 | |
1746 | 1746 | $formatted_string = str_replace( |
1747 | 1747 | array( |
@@ -1756,15 +1756,15 @@ discard block |
||
1756 | 1756 | '{N}', |
1757 | 1757 | '{S}', |
1758 | 1758 | ), array( |
1759 | - date( 'j', $current_time ), |
|
1760 | - date( 'd', $current_time ), |
|
1761 | - date( 'n', $current_time ), |
|
1762 | - date( 'm', $current_time ), |
|
1763 | - date( 'Y', $current_time ), |
|
1764 | - date( 'Y', $current_time ), |
|
1765 | - date( 'G', $current_time ), |
|
1766 | - date( 'H', $current_time ), |
|
1767 | - date( 's', $current_time ), |
|
1759 | + date('j', $current_time), |
|
1760 | + date('d', $current_time), |
|
1761 | + date('n', $current_time), |
|
1762 | + date('m', $current_time), |
|
1763 | + date('Y', $current_time), |
|
1764 | + date('Y', $current_time), |
|
1765 | + date('G', $current_time), |
|
1766 | + date('H', $current_time), |
|
1767 | + date('s', $current_time), |
|
1768 | 1768 | ), $string |
1769 | 1769 | ); |
1770 | 1770 | |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | * |
1774 | 1774 | * @since 2.1.0 |
1775 | 1775 | */ |
1776 | - return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp ); |
|
1776 | + return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp); |
|
1777 | 1777 | } |
1778 | 1778 | |
1779 | 1779 | |
@@ -1786,24 +1786,24 @@ discard block |
||
1786 | 1786 | * |
1787 | 1787 | * @return bool |
1788 | 1788 | */ |
1789 | -function give_is_company_field_enabled( $form_id ) { |
|
1790 | - $form_setting_val = give_get_meta( $form_id, '_give_company_field', true ); |
|
1791 | - $global_setting_val = give_get_option( 'company_field' ); |
|
1789 | +function give_is_company_field_enabled($form_id) { |
|
1790 | + $form_setting_val = give_get_meta($form_id, '_give_company_field', true); |
|
1791 | + $global_setting_val = give_get_option('company_field'); |
|
1792 | 1792 | |
1793 | - if ( ! empty( $form_setting_val ) ) { |
|
1794 | - if ( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) { |
|
1793 | + if ( ! empty($form_setting_val)) { |
|
1794 | + if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) { |
|
1795 | 1795 | return true; |
1796 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( |
|
1796 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled( |
|
1797 | 1797 | $global_setting_val, array( |
1798 | 1798 | 'required', |
1799 | 1799 | 'optional', |
1800 | 1800 | ) |
1801 | - ) ) { |
|
1801 | + )) { |
|
1802 | 1802 | return true; |
1803 | 1803 | } else { |
1804 | 1804 | return false; |
1805 | 1805 | } |
1806 | - } elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) { |
|
1806 | + } elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) { |
|
1807 | 1807 | return true; |
1808 | 1808 | |
1809 | 1809 | } else { |
@@ -1820,19 +1820,19 @@ discard block |
||
1820 | 1820 | * |
1821 | 1821 | * @return bool |
1822 | 1822 | */ |
1823 | -function give_is_anonymous_donation_field_enabled( $form_id ) { |
|
1824 | - $form_setting_val = give_get_meta( $form_id, '_give_anonymous_donation', true, 'global' ); |
|
1825 | - $global_setting_val = give_get_option( 'anonymous_donation', 'disabled' ); |
|
1823 | +function give_is_anonymous_donation_field_enabled($form_id) { |
|
1824 | + $form_setting_val = give_get_meta($form_id, '_give_anonymous_donation', true, 'global'); |
|
1825 | + $global_setting_val = give_get_option('anonymous_donation', 'disabled'); |
|
1826 | 1826 | |
1827 | - if ( ! empty( $form_setting_val ) ) { |
|
1828 | - if ( give_is_setting_enabled( $form_setting_val ) ) { |
|
1827 | + if ( ! empty($form_setting_val)) { |
|
1828 | + if (give_is_setting_enabled($form_setting_val)) { |
|
1829 | 1829 | return true; |
1830 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ) { |
|
1830 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) { |
|
1831 | 1831 | return true; |
1832 | 1832 | } else { |
1833 | 1833 | return false; |
1834 | 1834 | } |
1835 | - } elseif ( give_is_setting_enabled( $global_setting_val ) ) { |
|
1835 | + } elseif (give_is_setting_enabled($global_setting_val)) { |
|
1836 | 1836 | return true; |
1837 | 1837 | } |
1838 | 1838 | |
@@ -1848,19 +1848,19 @@ discard block |
||
1848 | 1848 | * |
1849 | 1849 | * @return bool |
1850 | 1850 | */ |
1851 | -function give_is_donor_comment_field_enabled( $form_id ) { |
|
1852 | - $form_setting_val = give_get_meta( $form_id, '_give_donor_comment', true, 'global' ); |
|
1853 | - $global_setting_val = give_get_option( 'donor_comment', 'disabled' ); |
|
1851 | +function give_is_donor_comment_field_enabled($form_id) { |
|
1852 | + $form_setting_val = give_get_meta($form_id, '_give_donor_comment', true, 'global'); |
|
1853 | + $global_setting_val = give_get_option('donor_comment', 'disabled'); |
|
1854 | 1854 | |
1855 | - if ( ! empty( $form_setting_val ) ) { |
|
1856 | - if ( give_is_setting_enabled( $form_setting_val ) ) { |
|
1855 | + if ( ! empty($form_setting_val)) { |
|
1856 | + if (give_is_setting_enabled($form_setting_val)) { |
|
1857 | 1857 | return true; |
1858 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ) { |
|
1858 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) { |
|
1859 | 1859 | return true; |
1860 | 1860 | } else { |
1861 | 1861 | return false; |
1862 | 1862 | } |
1863 | - } elseif ( give_is_setting_enabled( $global_setting_val ) ) { |
|
1863 | + } elseif (give_is_setting_enabled($global_setting_val)) { |
|
1864 | 1864 | return true; |
1865 | 1865 | } |
1866 | 1866 | |
@@ -1878,12 +1878,12 @@ discard block |
||
1878 | 1878 | * |
1879 | 1879 | * @return array |
1880 | 1880 | */ |
1881 | -function __give_get_active_license_info( $license_id ) { |
|
1881 | +function __give_get_active_license_info($license_id) { |
|
1882 | 1882 | global $wpdb; |
1883 | 1883 | $option_name = "{$license_id}_license_active"; |
1884 | 1884 | $data = array(); |
1885 | 1885 | |
1886 | - if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) { |
|
1886 | + if ( ! isset($GLOBALS['give_active_licenses_info'])) { |
|
1887 | 1887 | $GLOBALS['give_active_licenses_info'] = array(); |
1888 | 1888 | |
1889 | 1889 | $licenses_info = $wpdb->get_results( |
@@ -1896,16 +1896,16 @@ discard block |
||
1896 | 1896 | ARRAY_A |
1897 | 1897 | ); |
1898 | 1898 | |
1899 | - if ( ! empty( $licenses_info ) ) { |
|
1899 | + if ( ! empty($licenses_info)) { |
|
1900 | 1900 | $GLOBALS['give_active_licenses_info'] = array_combine( |
1901 | - wp_list_pluck( $licenses_info, 'option_name' ), |
|
1902 | - wp_list_pluck( $licenses_info, 'option_value' ) |
|
1901 | + wp_list_pluck($licenses_info, 'option_name'), |
|
1902 | + wp_list_pluck($licenses_info, 'option_value') |
|
1903 | 1903 | ); |
1904 | 1904 | } |
1905 | 1905 | } |
1906 | 1906 | |
1907 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) { |
|
1908 | - $data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] ); |
|
1907 | + if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) { |
|
1908 | + $data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]); |
|
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | return $data; |
@@ -1921,18 +1921,18 @@ discard block |
||
1921 | 1921 | * |
1922 | 1922 | * @return array |
1923 | 1923 | */ |
1924 | -function __give_get_active_by_user_meta( $banner_addon_name ) { |
|
1924 | +function __give_get_active_by_user_meta($banner_addon_name) { |
|
1925 | 1925 | global $wpdb; |
1926 | 1926 | |
1927 | 1927 | // Get the option key. |
1928 | - $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name ); |
|
1928 | + $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name); |
|
1929 | 1929 | $data = array(); |
1930 | 1930 | |
1931 | 1931 | if ( |
1932 | - ! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1933 | - || empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1932 | + ! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1933 | + || empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1934 | 1934 | ) { |
1935 | - $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array(); |
|
1935 | + $GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array(); |
|
1936 | 1936 | |
1937 | 1937 | // Get the meta of activation banner by user. |
1938 | 1938 | $activation_banners = $wpdb->get_results( |
@@ -1945,16 +1945,16 @@ discard block |
||
1945 | 1945 | ARRAY_A |
1946 | 1946 | ); |
1947 | 1947 | |
1948 | - if ( ! empty( $activation_banners ) ) { |
|
1948 | + if ( ! empty($activation_banners)) { |
|
1949 | 1949 | $GLOBALS['give_addon_activated_by_user'] = array_combine( |
1950 | - wp_list_pluck( $activation_banners, 'option_name' ), |
|
1951 | - wp_list_pluck( $activation_banners, 'option_value' ) |
|
1950 | + wp_list_pluck($activation_banners, 'option_name'), |
|
1951 | + wp_list_pluck($activation_banners, 'option_value') |
|
1952 | 1952 | ); |
1953 | 1953 | } |
1954 | 1954 | } |
1955 | 1955 | |
1956 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) { |
|
1957 | - $data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] ); |
|
1956 | + if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) { |
|
1957 | + $data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]); |
|
1958 | 1958 | } |
1959 | 1959 | |
1960 | 1960 | return $data; |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | * |
1974 | 1974 | * @see wp-inlucdes/pluggable.php:wp_nonce_tick |
1975 | 1975 | */ |
1976 | - return (int) apply_filters( 'nonce_life', DAY_IN_SECONDS ); |
|
1976 | + return (int) apply_filters('nonce_life', DAY_IN_SECONDS); |
|
1977 | 1977 | } |
1978 | 1978 | |
1979 | 1979 | /** |
@@ -1987,11 +1987,11 @@ discard block |
||
1987 | 1987 | * |
1988 | 1988 | * @return string |
1989 | 1989 | */ |
1990 | -function give_get_nonce_field( $action, $name, $referer = false ) { |
|
1990 | +function give_get_nonce_field($action, $name, $referer = false) { |
|
1991 | 1991 | return str_replace( |
1992 | 1992 | "id=\"{$name}\"", |
1993 | 1993 | '', |
1994 | - wp_nonce_field( $action, $name, $referer, false ) |
|
1994 | + wp_nonce_field($action, $name, $referer, false) |
|
1995 | 1995 | ); |
1996 | 1996 | } |
1997 | 1997 | |
@@ -2004,31 +2004,31 @@ discard block |
||
2004 | 2004 | * |
2005 | 2005 | * @return array |
2006 | 2006 | */ |
2007 | -function give_goal_progress_stats( $form ) { |
|
2007 | +function give_goal_progress_stats($form) { |
|
2008 | 2008 | |
2009 | - if ( ! $form instanceof Give_Donate_Form ) { |
|
2010 | - $form = new Give_Donate_Form( $form ); |
|
2009 | + if ( ! $form instanceof Give_Donate_Form) { |
|
2010 | + $form = new Give_Donate_Form($form); |
|
2011 | 2011 | } |
2012 | 2012 | |
2013 | 2013 | $donors = ''; |
2014 | 2014 | |
2015 | - $goal_format = give_get_form_goal_format( $form->ID ); |
|
2015 | + $goal_format = give_get_form_goal_format($form->ID); |
|
2016 | 2016 | |
2017 | 2017 | /** |
2018 | 2018 | * Filter the form. |
2019 | 2019 | * |
2020 | 2020 | * @since 1.8.8 |
2021 | 2021 | */ |
2022 | - $total_goal = apply_filters( 'give_goal_amount_target_output', round( give_maybe_sanitize_amount( $form->goal ) ), $form->ID, $form ); |
|
2022 | + $total_goal = apply_filters('give_goal_amount_target_output', round(give_maybe_sanitize_amount($form->goal)), $form->ID, $form); |
|
2023 | 2023 | |
2024 | - switch ( $goal_format ) { |
|
2024 | + switch ($goal_format) { |
|
2025 | 2025 | case 'donation': |
2026 | 2026 | /** |
2027 | 2027 | * Filter the form donations. |
2028 | 2028 | * |
2029 | 2029 | * @since 2.1 |
2030 | 2030 | */ |
2031 | - $actual = $donations = apply_filters( 'give_goal_donations_raised_output', $form->sales, $form->ID, $form ); |
|
2031 | + $actual = $donations = apply_filters('give_goal_donations_raised_output', $form->sales, $form->ID, $form); |
|
2032 | 2032 | break; |
2033 | 2033 | case 'donors': |
2034 | 2034 | /** |
@@ -2042,7 +2042,7 @@ discard block |
||
2042 | 2042 | * |
2043 | 2043 | * @return int $donors Total number of donors that donated to the form. |
2044 | 2044 | */ |
2045 | - $actual = $donors = apply_filters( 'give_goal_donors_target_output', give_get_form_donor_count( $form->ID ), $form->ID, $form ); |
|
2045 | + $actual = $donors = apply_filters('give_goal_donors_target_output', give_get_form_donor_count($form->ID), $form->ID, $form); |
|
2046 | 2046 | break; |
2047 | 2047 | default: |
2048 | 2048 | /** |
@@ -2050,11 +2050,11 @@ discard block |
||
2050 | 2050 | * |
2051 | 2051 | * @since 1.8.8 |
2052 | 2052 | */ |
2053 | - $actual = $income = apply_filters( 'give_goal_amount_raised_output', $form->earnings, $form->ID, $form ); |
|
2053 | + $actual = $income = apply_filters('give_goal_amount_raised_output', $form->earnings, $form->ID, $form); |
|
2054 | 2054 | break; |
2055 | 2055 | } |
2056 | 2056 | |
2057 | - $progress = $total_goal ? round( ( $actual / $total_goal ) * 100, 2 ) : 0; |
|
2057 | + $progress = $total_goal ? round(($actual / $total_goal) * 100, 2) : 0; |
|
2058 | 2058 | |
2059 | 2059 | $stats_array = array( |
2060 | 2060 | 'raw_actual' => $actual, |
@@ -2066,20 +2066,20 @@ discard block |
||
2066 | 2066 | * |
2067 | 2067 | * @since 1.8.8 |
2068 | 2068 | */ |
2069 | - $progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form->ID, $form ); |
|
2069 | + $progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form->ID, $form); |
|
2070 | 2070 | |
2071 | 2071 | // Define Actual Goal based on the goal format. |
2072 | - if ( 'percentage' === $goal_format ) { |
|
2072 | + if ('percentage' === $goal_format) { |
|
2073 | 2073 | $actual = "{$actual}%"; |
2074 | - } elseif ( 'amount' === $goal_format ) { |
|
2075 | - $actual = give_currency_filter( give_format_amount( $actual ) ); |
|
2074 | + } elseif ('amount' === $goal_format) { |
|
2075 | + $actual = give_currency_filter(give_format_amount($actual)); |
|
2076 | 2076 | } |
2077 | 2077 | |
2078 | 2078 | // Define Total Goal based on the goal format. |
2079 | - if ( 'percentage' === $goal_format ) { |
|
2079 | + if ('percentage' === $goal_format) { |
|
2080 | 2080 | $total_goal = ''; |
2081 | - } elseif ( 'amount' === $goal_format ) { |
|
2082 | - $total_goal = give_currency_filter( give_format_amount( $total_goal ) ); |
|
2081 | + } elseif ('amount' === $goal_format) { |
|
2082 | + $total_goal = give_currency_filter(give_format_amount($total_goal)); |
|
2083 | 2083 | } |
2084 | 2084 | |
2085 | 2085 | $stats_array = array_merge( |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | * |
2098 | 2098 | * @since 2.1 |
2099 | 2099 | */ |
2100 | - return apply_filters( 'give_goal_progress_stats', $stats_array ); |
|
2100 | + return apply_filters('give_goal_progress_stats', $stats_array); |
|
2101 | 2101 | } |
2102 | 2102 | |
2103 | 2103 | /** |
@@ -2108,11 +2108,11 @@ discard block |
||
2108 | 2108 | * @return array $message admin message key. |
2109 | 2109 | */ |
2110 | 2110 | function give_get_admin_messages_key() { |
2111 | - $messages = empty( $_GET['give-messages'] ) ? array() : give_clean( $_GET['give-messages'] ); |
|
2111 | + $messages = empty($_GET['give-messages']) ? array() : give_clean($_GET['give-messages']); |
|
2112 | 2112 | |
2113 | 2113 | // backward compatibility. |
2114 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
2115 | - $messages[] = give_clean( $_GET['give-message'] ); |
|
2114 | + if ( ! empty($_GET['give-message'])) { |
|
2115 | + $messages[] = give_clean($_GET['give-message']); |
|
2116 | 2116 | } |
2117 | 2117 | |
2118 | 2118 | /** |
@@ -2124,7 +2124,7 @@ discard block |
||
2124 | 2124 | * |
2125 | 2125 | * @return array $message admin message key. |
2126 | 2126 | */ |
2127 | - return (array) apply_filters( 'give_get_admin_messages_key', $messages ); |
|
2127 | + return (array) apply_filters('give_get_admin_messages_key', $messages); |
|
2128 | 2128 | } |
2129 | 2129 | |
2130 | 2130 | /** |
@@ -2137,7 +2137,7 @@ discard block |
||
2137 | 2137 | function give_get_user_agent() { |
2138 | 2138 | |
2139 | 2139 | // Get User Agent. |
2140 | - $user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? give_clean( $_SERVER['HTTP_USER_AGENT'] ) : ''; // WPCS: input var ok. |
|
2140 | + $user_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? give_clean($_SERVER['HTTP_USER_AGENT']) : ''; // WPCS: input var ok. |
|
2141 | 2141 | |
2142 | 2142 | return $user_agent; |
2143 | 2143 | } |
@@ -2152,11 +2152,11 @@ discard block |
||
2152 | 2152 | * @param integer $expire Expiry of the cookie. |
2153 | 2153 | * @param bool $secure Whether the cookie should be served only over https. |
2154 | 2154 | */ |
2155 | -function give_setcookie( $name, $value, $expire = 0, $secure = false ) { |
|
2156 | - if ( ! headers_sent() ) { |
|
2155 | +function give_setcookie($name, $value, $expire = 0, $secure = false) { |
|
2156 | + if ( ! headers_sent()) { |
|
2157 | 2157 | setcookie( |
2158 | 2158 | $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, |
2159 | - apply_filters( 'give_cookie_httponly', false, $name, $value, $expire, $secure ) |
|
2159 | + apply_filters('give_cookie_httponly', false, $name, $value, $expire, $secure) |
|
2160 | 2160 | ); |
2161 | 2161 | } |
2162 | 2162 | } |
@@ -2170,7 +2170,7 @@ discard block |
||
2170 | 2170 | * |
2171 | 2171 | * @return string Formatted address. |
2172 | 2172 | */ |
2173 | -function give_get_formatted_address( $address = array() ) { |
|
2173 | +function give_get_formatted_address($address = array()) { |
|
2174 | 2174 | $formatted_address = ''; |
2175 | 2175 | |
2176 | 2176 | /** |
@@ -2178,21 +2178,21 @@ discard block |
||
2178 | 2178 | * |
2179 | 2179 | * @since 2.2.0 |
2180 | 2180 | */ |
2181 | - $address_format = apply_filters( 'give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}" ); |
|
2182 | - preg_match_all( '/{([A-z0-9\-\_\ ]+)}/s', $address_format, $matches ); |
|
2181 | + $address_format = apply_filters('give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}"); |
|
2182 | + preg_match_all('/{([A-z0-9\-\_\ ]+)}/s', $address_format, $matches); |
|
2183 | 2183 | |
2184 | - if ( ! empty( $matches ) && ! empty( $address ) ) { |
|
2184 | + if ( ! empty($matches) && ! empty($address)) { |
|
2185 | 2185 | $address_values = array(); |
2186 | 2186 | |
2187 | - foreach ( $matches[1] as $address_tag ) { |
|
2188 | - $address_values[ $address_tag ] = ''; |
|
2187 | + foreach ($matches[1] as $address_tag) { |
|
2188 | + $address_values[$address_tag] = ''; |
|
2189 | 2189 | |
2190 | - if ( isset( $address[ $address_tag ] ) ) { |
|
2191 | - $address_values[ $address_tag ] = $address[ $address_tag ]; |
|
2190 | + if (isset($address[$address_tag])) { |
|
2191 | + $address_values[$address_tag] = $address[$address_tag]; |
|
2192 | 2192 | } |
2193 | 2193 | } |
2194 | 2194 | |
2195 | - $formatted_address = str_ireplace( $matches[0], $address_values, $address_format ); |
|
2195 | + $formatted_address = str_ireplace($matches[0], $address_values, $address_format); |
|
2196 | 2196 | } |
2197 | 2197 | |
2198 | 2198 | /** |
@@ -2203,7 +2203,7 @@ discard block |
||
2203 | 2203 | * @param string $formatted_address Formatted address. |
2204 | 2204 | * @param string $address_format Format of the address. |
2205 | 2205 | */ |
2206 | - $formatted_address = apply_filters( 'give_get_formatted_address', $formatted_address, $address_format, $address ); |
|
2206 | + $formatted_address = apply_filters('give_get_formatted_address', $formatted_address, $address_format, $address); |
|
2207 | 2207 | |
2208 | 2208 | return $formatted_address; |
2209 | 2209 | } |
@@ -2217,10 +2217,10 @@ discard block |
||
2217 | 2217 | * |
2218 | 2218 | * @return string The JS date format. |
2219 | 2219 | */ |
2220 | -function give_convert_php_date_format_to_js( $php_format ) { |
|
2220 | +function give_convert_php_date_format_to_js($php_format) { |
|
2221 | 2221 | $js_format = $php_format; |
2222 | 2222 | |
2223 | - switch ( $php_format ) { |
|
2223 | + switch ($php_format) { |
|
2224 | 2224 | case 'F j, Y': |
2225 | 2225 | $js_format = 'MM dd, yy'; |
2226 | 2226 | break; |
@@ -2243,7 +2243,7 @@ discard block |
||
2243 | 2243 | * @param string $js_format The JS date format. |
2244 | 2244 | * @param string $php_format The PHP date format. |
2245 | 2245 | */ |
2246 | - $js_format = apply_filters( 'give_js_date_format', $js_format, $php_format ); |
|
2246 | + $js_format = apply_filters('give_js_date_format', $js_format, $php_format); |
|
2247 | 2247 | |
2248 | 2248 | return $js_format; |
2249 | 2249 | } |
@@ -2257,7 +2257,7 @@ discard block |
||
2257 | 2257 | */ |
2258 | 2258 | function give_get_localized_date_format_to_js() { |
2259 | 2259 | |
2260 | - return give_convert_php_date_format_to_js( get_option( 'date_format' ) ); |
|
2260 | + return give_convert_php_date_format_to_js(get_option('date_format')); |
|
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | /** |
@@ -2270,21 +2270,21 @@ discard block |
||
2270 | 2270 | * |
2271 | 2271 | * @return string |
2272 | 2272 | */ |
2273 | -function give_get_safe_asset_url( $url ) { |
|
2273 | +function give_get_safe_asset_url($url) { |
|
2274 | 2274 | |
2275 | 2275 | // Bailout, if empty URL passed. |
2276 | - if ( empty( $url ) ) { |
|
2276 | + if (empty($url)) { |
|
2277 | 2277 | return $url; |
2278 | 2278 | } |
2279 | 2279 | |
2280 | - $schema = parse_url( $url, PHP_URL_SCHEME ); |
|
2281 | - $schema_length = strlen( $schema ) + 1; |
|
2282 | - $url = substr( $url, $schema_length ); |
|
2280 | + $schema = parse_url($url, PHP_URL_SCHEME); |
|
2281 | + $schema_length = strlen($schema) + 1; |
|
2282 | + $url = substr($url, $schema_length); |
|
2283 | 2283 | |
2284 | 2284 | /** |
2285 | 2285 | * Fire the filter |
2286 | 2286 | * |
2287 | 2287 | * @since 2.2.0 |
2288 | 2288 | */ |
2289 | - return apply_filters( 'give_get_safe_asset_url', $url ); |
|
2289 | + return apply_filters('give_get_safe_asset_url', $url); |
|
2290 | 2290 | } |
@@ -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 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX. |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | 41 | |
42 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok. |
|
42 | + $post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok. |
|
43 | 43 | |
44 | - if ( isset( $post_data['give_payment_mode'] ) ) { |
|
44 | + if (isset($post_data['give_payment_mode'])) { |
|
45 | 45 | |
46 | - $form_id_prefix = ! empty( $post_data['give_form_id_prefix'] ) ? $post_data['give_form_id_prefix'] : ''; |
|
46 | + $form_id_prefix = ! empty($post_data['give_form_id_prefix']) ? $post_data['give_form_id_prefix'] : ''; |
|
47 | 47 | |
48 | 48 | $args = array( |
49 | 49 | 'id_prefix' => $form_id_prefix, |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.7 |
56 | 56 | */ |
57 | - do_action( 'give_donation_form', $post_data['give_form_id'], $args ); |
|
57 | + do_action('give_donation_form', $post_data['give_form_id'], $args); |
|
58 | 58 | |
59 | 59 | exit(); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
64 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
63 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
64 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Create wp nonce using Ajax call. |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @return void |
74 | 74 | */ |
75 | 75 | function give_donation_form_nonce() { |
76 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
76 | + if (isset($_POST['give_form_id'])) { |
|
77 | 77 | |
78 | 78 | // Get donation form id. |
79 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
79 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
80 | 80 | |
81 | 81 | // Send nonce json data. |
82 | - wp_send_json_success( wp_create_nonce( "give_donation_form_nonce_{$form_id}" ) ); |
|
82 | + wp_send_json_success(wp_create_nonce("give_donation_form_nonce_{$form_id}")); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | -add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
87 | -add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
86 | +add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
87 | +add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
88 | 88 | |
89 | 89 | |
90 | 90 | /** |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | function __give_donation_form_reset_all_nonce() { |
99 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
99 | + if (isset($_POST['give_form_id'])) { |
|
100 | 100 | |
101 | 101 | // Get donation form id. |
102 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
102 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
103 | 103 | |
104 | 104 | $data = array( |
105 | - 'give_form_hash' => wp_create_nonce( "give_donation_form_nonce_{$form_id}" ), |
|
106 | - 'give_form_user_register_hash' => wp_create_nonce( "give_form_create_user_nonce_{$form_id}" ) |
|
105 | + 'give_form_hash' => wp_create_nonce("give_donation_form_nonce_{$form_id}"), |
|
106 | + 'give_form_user_register_hash' => wp_create_nonce("give_form_create_user_nonce_{$form_id}") |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | /** |
@@ -112,17 +112,17 @@ discard block |
||
112 | 112 | * @since 2.2.0 |
113 | 113 | * |
114 | 114 | */ |
115 | - $data = apply_filters( 'give_donation_form_reset_all_nonce_data', $data ); |
|
115 | + $data = apply_filters('give_donation_form_reset_all_nonce_data', $data); |
|
116 | 116 | |
117 | 117 | // Send nonce json data. |
118 | - wp_send_json_success( $data ); |
|
118 | + wp_send_json_success($data); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | wp_send_json_error(); |
122 | 122 | } |
123 | 123 | |
124 | -add_action( 'wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' ); |
|
125 | -add_action( 'wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' ); |
|
124 | +add_action('wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce'); |
|
125 | +add_action('wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Sets an error within the donation form if no gateways are enabled. |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | function give_no_gateway_error() { |
136 | 136 | $gateways = give_get_enabled_payment_gateways(); |
137 | 137 | |
138 | - if ( empty( $gateways ) ) { |
|
139 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
138 | + if (empty($gateways)) { |
|
139 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
140 | 140 | } else { |
141 | - give_unset_error( 'no_gateways' ); |
|
141 | + give_unset_error('no_gateways'); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | -add_action( 'init', 'give_no_gateway_error' ); |
|
145 | +add_action('init', 'give_no_gateway_error'); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @return Give |
281 | 281 | */ |
282 | 282 | public static function instance() { |
283 | - if ( is_null( self::$_instance ) ) { |
|
283 | + if (is_null(self::$_instance)) { |
|
284 | 284 | self::$_instance = new self(); |
285 | 285 | } |
286 | 286 | |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function __construct() { |
294 | 294 | // PHP version |
295 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
296 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
295 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
296 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // Bailout: Need minimum php version to load plugin. |
300 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
301 | - add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) ); |
|
300 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
301 | + add_action('admin_notices', array($this, 'minimum_phpversion_notice')); |
|
302 | 302 | |
303 | 303 | return; |
304 | 304 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $this->includes(); |
308 | 308 | $this->init_hooks(); |
309 | 309 | |
310 | - do_action( 'give_loaded' ); |
|
310 | + do_action('give_loaded'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | * @since 1.8.9 |
317 | 317 | */ |
318 | 318 | private function init_hooks() { |
319 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
320 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
319 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
320 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
321 | 321 | |
322 | 322 | // Set up localization on init Hook. |
323 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
323 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @since 1.8.9 |
338 | 338 | */ |
339 | - do_action( 'before_give_init' ); |
|
339 | + do_action('before_give_init'); |
|
340 | 340 | |
341 | 341 | // Set up localization. |
342 | 342 | $this->load_textdomain(); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @since 1.8.7 |
373 | 373 | */ |
374 | - do_action( 'give_init', $this ); |
|
374 | + do_action('give_init', $this); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | public function __clone() { |
390 | 390 | // Cloning instances of the class is forbidden. |
391 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
391 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function __wakeup() { |
403 | 403 | // Unserializing instances of the class is forbidden. |
404 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
404 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
@@ -415,33 +415,33 @@ discard block |
||
415 | 415 | private function setup_constants() { |
416 | 416 | |
417 | 417 | // Plugin version |
418 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
419 | - define( 'GIVE_VERSION', '2.2.3' ); |
|
418 | + if ( ! defined('GIVE_VERSION')) { |
|
419 | + define('GIVE_VERSION', '2.2.3'); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // Plugin Root File |
423 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
424 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
423 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
424 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | // Plugin Folder Path |
428 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
429 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
428 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
429 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | // Plugin Folder URL |
433 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
434 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
433 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
434 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | // Plugin Basename aka: "give/give.php" |
438 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
439 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
438 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
439 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // Make sure CAL_GREGORIAN is defined |
443 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
444 | - define( 'CAL_GREGORIAN', 1 ); |
|
443 | + if ( ! defined('CAL_GREGORIAN')) { |
|
444 | + define('CAL_GREGORIAN', 1); |
|
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
@@ -459,170 +459,170 @@ discard block |
||
459 | 459 | /** |
460 | 460 | * Load libraries. |
461 | 461 | */ |
462 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
463 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
462 | + if ( ! class_exists('WP_Async_Request')) { |
|
463 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
464 | 464 | } |
465 | 465 | |
466 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
467 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
466 | + if ( ! class_exists('WP_Background_Process')) { |
|
467 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
471 | 471 | * Load plugin files |
472 | 472 | */ |
473 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
475 | 475 | $give_options = give_get_settings(); |
476 | 476 | |
477 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
488 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
490 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php'; |
|
491 | - |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php'; |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
503 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor-wall-widget.php'; |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sessions.php'; |
|
506 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
507 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
508 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
509 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-comment.php'; |
|
513 | - |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
517 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
523 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
530 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
533 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
534 | - |
|
535 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
536 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
537 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
538 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
540 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
541 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php'; |
|
542 | - |
|
543 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
548 | - |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
554 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
555 | - |
|
556 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
557 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-wall.php'; |
|
558 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-stats.php'; |
|
559 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
560 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/frontend-donor-functions.php'; |
|
561 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/actions.php'; |
|
562 | - |
|
563 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
564 | - |
|
565 | - require_once GIVE_PLUGIN_DIR . 'blocks/load.php'; |
|
566 | - |
|
567 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
568 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
490 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php'; |
|
491 | + |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php'; |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
503 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor-wall-widget.php'; |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sessions.php'; |
|
506 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
507 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
508 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
509 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-comment.php'; |
|
513 | + |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
517 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
523 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
530 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
533 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
534 | + |
|
535 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
536 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
537 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
538 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
540 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
541 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php'; |
|
542 | + |
|
543 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
548 | + |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
554 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
555 | + |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-wall.php'; |
|
558 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-stats.php'; |
|
559 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
560 | + require_once GIVE_PLUGIN_DIR.'includes/donors/frontend-donor-functions.php'; |
|
561 | + require_once GIVE_PLUGIN_DIR.'includes/donors/actions.php'; |
|
562 | + |
|
563 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
564 | + |
|
565 | + require_once GIVE_PLUGIN_DIR.'blocks/load.php'; |
|
566 | + |
|
567 | + if (defined('WP_CLI') && WP_CLI) { |
|
568 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
569 | 569 | } |
570 | 570 | |
571 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
572 | - |
|
573 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
574 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
575 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
576 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
577 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
578 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
579 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
580 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
581 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
582 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
583 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
584 | - |
|
585 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
586 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
587 | - |
|
588 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
589 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
590 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
591 | - |
|
592 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
593 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-give-form-duplicator.php'; |
|
594 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
595 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
596 | - |
|
597 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
598 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
599 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
600 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
601 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php'; |
|
602 | - |
|
603 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
604 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
605 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
606 | - |
|
607 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
608 | - |
|
609 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
610 | - |
|
611 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
612 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
613 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
614 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
615 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
616 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
617 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
618 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
619 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
620 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
621 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
622 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donor-wall.php'; |
|
571 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
572 | + |
|
573 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
574 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
575 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
576 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
577 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
578 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
579 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
580 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
581 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
582 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
583 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
584 | + |
|
585 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
586 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
587 | + |
|
588 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
589 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
590 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
591 | + |
|
592 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
593 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-give-form-duplicator.php'; |
|
594 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
595 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
596 | + |
|
597 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
598 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
599 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
600 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
601 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php'; |
|
602 | + |
|
603 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
604 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
605 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
606 | + |
|
607 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
608 | + |
|
609 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
610 | + |
|
611 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
612 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
613 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
614 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
615 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
616 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
617 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
618 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
619 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
620 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
621 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
622 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donor-wall.php'; |
|
623 | 623 | }// End if(). |
624 | 624 | |
625 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
625 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -637,16 +637,16 @@ discard block |
||
637 | 637 | public function load_textdomain() { |
638 | 638 | |
639 | 639 | // Set filter for Give's languages directory |
640 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
641 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
640 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
641 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
642 | 642 | |
643 | 643 | // Traditional WordPress plugin locale filter. |
644 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
645 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
644 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
645 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
646 | 646 | |
647 | - unload_textdomain( 'give' ); |
|
648 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
649 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
647 | + unload_textdomain('give'); |
|
648 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
649 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
650 | 650 | |
651 | 651 | } |
652 | 652 | |
@@ -659,21 +659,21 @@ discard block |
||
659 | 659 | */ |
660 | 660 | public function minimum_phpversion_notice() { |
661 | 661 | // Bailout. |
662 | - if ( ! is_admin() ) { |
|
662 | + if ( ! is_admin()) { |
|
663 | 663 | return; |
664 | 664 | } |
665 | 665 | |
666 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
667 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
668 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
669 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
670 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
671 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
672 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
666 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
667 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
668 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
669 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
670 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
671 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
672 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
673 | 673 | |
674 | 674 | echo sprintf( |
675 | 675 | '<div class="notice notice-error">%1$s</div>', |
676 | - wp_kses_post( $notice_desc ) |
|
676 | + wp_kses_post($notice_desc) |
|
677 | 677 | ); |
678 | 678 | } |
679 | 679 |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @since 2.1.0 |
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | - $this->direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : ''; |
|
41 | - $this->scripts_footer = give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ? true : false; |
|
40 | + $this->direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : ''; |
|
41 | + $this->scripts_footer = give_is_setting_enabled(give_get_option('scripts_footer')) ? true : false; |
|
42 | 42 | $this->init(); |
43 | 43 | } |
44 | 44 | |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function init() { |
51 | 51 | |
52 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_styles' ) ); |
|
53 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
54 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) ); |
|
55 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
52 | + add_action('admin_enqueue_scripts', array($this, 'register_styles')); |
|
53 | + add_action('admin_enqueue_scripts', array($this, 'register_scripts')); |
|
54 | + add_action('wp_enqueue_scripts', array($this, 'register_styles')); |
|
55 | + add_action('wp_enqueue_scripts', array($this, 'register_scripts')); |
|
56 | 56 | |
57 | - if ( is_admin() ) { |
|
58 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
59 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) ); |
|
60 | - add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_admin_scripts' ) ); |
|
61 | - add_action( 'admin_head', array( $this, 'global_admin_head' ) ); |
|
57 | + if (is_admin()) { |
|
58 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
59 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles')); |
|
60 | + add_action('enqueue_block_editor_assets', array($this, 'gutenberg_admin_scripts')); |
|
61 | + add_action('admin_head', array($this, 'global_admin_head')); |
|
62 | 62 | |
63 | 63 | } else { |
64 | - add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_styles' ) ); |
|
65 | - add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ) ); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'public_enqueue_styles')); |
|
65 | + add_action('wp_enqueue_scripts', array($this, 'public_enqueue_scripts')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | public function register_styles() { |
75 | 75 | |
76 | 76 | // WP-admin. |
77 | - wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', array(), GIVE_VERSION ); |
|
77 | + wp_register_style('give-admin-styles', GIVE_PLUGIN_URL.'assets/dist/css/admin'.$this->direction.'.css', array(), GIVE_VERSION); |
|
78 | 78 | |
79 | 79 | // WP-admin: plugin page. |
80 | 80 | wp_register_style( |
81 | 81 | 'plugin-deactivation-survey-css', |
82 | - GIVE_PLUGIN_URL . 'assets/dist/css/plugin-deactivation-survey.css', |
|
82 | + GIVE_PLUGIN_URL.'assets/dist/css/plugin-deactivation-survey.css', |
|
83 | 83 | array(), |
84 | 84 | GIVE_VERSION |
85 | 85 | ); |
86 | 86 | |
87 | 87 | // Frontend. |
88 | - if ( give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
89 | - wp_register_style( 'give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
88 | + if (give_is_setting_enabled(give_get_option('css'))) { |
|
89 | + wp_register_style('give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -98,23 +98,23 @@ discard block |
||
98 | 98 | public function register_scripts() { |
99 | 99 | |
100 | 100 | // WP-Admin. |
101 | - wp_register_script( 'give-admin-scripts', GIVE_PLUGIN_URL . 'assets/dist/js/admin.js', array( |
|
101 | + wp_register_script('give-admin-scripts', GIVE_PLUGIN_URL.'assets/dist/js/admin.js', array( |
|
102 | 102 | 'jquery', |
103 | 103 | 'jquery-ui-datepicker', |
104 | 104 | 'wp-color-picker', |
105 | 105 | 'jquery-query', |
106 | - ), GIVE_VERSION ); |
|
106 | + ), GIVE_VERSION); |
|
107 | 107 | |
108 | 108 | // WP-admin: plugin page. |
109 | - wp_register_script( 'plugin-deactivation-survey-js', |
|
110 | - GIVE_PLUGIN_URL . 'assets/dist/js/plugin-deactivation-survey.js', |
|
111 | - array( 'jquery' ), |
|
109 | + wp_register_script('plugin-deactivation-survey-js', |
|
110 | + GIVE_PLUGIN_URL.'assets/dist/js/plugin-deactivation-survey.js', |
|
111 | + array('jquery'), |
|
112 | 112 | GIVE_VERSION, |
113 | 113 | true |
114 | 114 | ); |
115 | 115 | |
116 | 116 | // Frontend. |
117 | - wp_register_script( 'give', GIVE_PLUGIN_URL . 'assets/dist/js/give.js', array( 'jquery' ), GIVE_VERSION, $this->scripts_footer ); |
|
117 | + wp_register_script('give', GIVE_PLUGIN_URL.'assets/dist/js/give.js', array('jquery'), GIVE_VERSION, $this->scripts_footer); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $hook Page hook. |
126 | 126 | */ |
127 | - public function admin_enqueue_styles( $hook ) { |
|
127 | + public function admin_enqueue_styles($hook) { |
|
128 | 128 | // Give Admin Only. |
129 | - if ( ! apply_filters( 'give_load_admin_styles', give_is_admin_page(), $hook ) ) { |
|
129 | + if ( ! apply_filters('give_load_admin_styles', give_is_admin_page(), $hook)) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | 133 | // Give enqueues. |
134 | - wp_enqueue_style( 'give-admin-styles' ); |
|
135 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
134 | + wp_enqueue_style('give-admin-styles'); |
|
135 | + wp_enqueue_style('give-admin-bar-notification'); |
|
136 | 136 | |
137 | 137 | // WP Core enqueues. |
138 | - wp_enqueue_style( 'wp-color-picker' ); |
|
139 | - wp_enqueue_style( 'thickbox' ); // @TODO remove once we have modal API. |
|
138 | + wp_enqueue_style('wp-color-picker'); |
|
139 | + wp_enqueue_style('thickbox'); // @TODO remove once we have modal API. |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @param string $hook Page hook. |
149 | 149 | */ |
150 | - public function admin_enqueue_scripts( $hook ) { |
|
150 | + public function admin_enqueue_scripts($hook) { |
|
151 | 151 | global $pagenow; |
152 | 152 | |
153 | 153 | // Plugin page script |
154 | - if ( 'plugins.php' === $pagenow ) { |
|
154 | + if ('plugins.php' === $pagenow) { |
|
155 | 155 | $this->plugin_equeue_scripts(); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Give Admin Only. |
159 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
159 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // WP Scripts. |
164 | - wp_enqueue_script( 'wp-color-picker' ); |
|
165 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
166 | - wp_enqueue_script( 'thickbox' ); |
|
164 | + wp_enqueue_script('wp-color-picker'); |
|
165 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
166 | + wp_enqueue_script('thickbox'); |
|
167 | 167 | wp_enqueue_media(); |
168 | 168 | |
169 | 169 | // Give admin scripts. |
170 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
170 | + wp_enqueue_script('give-admin-scripts'); |
|
171 | 171 | |
172 | 172 | // Localize admin scripts |
173 | 173 | $this->admin_localize_scripts(); |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | * |
184 | 184 | */ |
185 | 185 | private function plugin_equeue_scripts() { |
186 | - wp_enqueue_style( 'plugin-deactivation-survey-css' ); |
|
187 | - wp_enqueue_script( 'plugin-deactivation-survey-js' ); |
|
186 | + wp_enqueue_style('plugin-deactivation-survey-css'); |
|
187 | + wp_enqueue_script('plugin-deactivation-survey-js'); |
|
188 | 188 | |
189 | 189 | $localized_data = array( |
190 | - 'nonce' => wp_create_nonce( 'deactivation_survey_nonce' ), |
|
191 | - 'cancel' => __( 'Cancel', 'give' ), |
|
192 | - 'deactivation_no_option_selected' => __( 'Error: Please select at least one option.', 'give' ), |
|
193 | - 'submit_and_deactivate' => __( 'Submit and Deactivate', 'give' ), |
|
194 | - 'skip_and_deactivate' => __( 'Skip & Deactivate', 'give' ), |
|
195 | - 'please_fill_field' => __( 'Error: Please fill the field.', 'give' ), |
|
190 | + 'nonce' => wp_create_nonce('deactivation_survey_nonce'), |
|
191 | + 'cancel' => __('Cancel', 'give'), |
|
192 | + 'deactivation_no_option_selected' => __('Error: Please select at least one option.', 'give'), |
|
193 | + 'submit_and_deactivate' => __('Submit and Deactivate', 'give'), |
|
194 | + 'skip_and_deactivate' => __('Skip & Deactivate', 'give'), |
|
195 | + 'please_fill_field' => __('Error: Please fill the field.', 'give'), |
|
196 | 196 | |
197 | 197 | ); |
198 | - wp_localize_script( 'plugin-deactivation-survey-js', 'give_vars', $localized_data ); |
|
198 | + wp_localize_script('plugin-deactivation-survey-js', 'give_vars', $localized_data); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -212,119 +212,119 @@ discard block |
||
212 | 212 | |
213 | 213 | // Localize strings & variables for JS. |
214 | 214 | $localized_data = array( |
215 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
215 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
216 | 216 | 'give_version' => GIVE_VERSION, |
217 | 217 | 'thousands_separator' => $thousand_separator, |
218 | 218 | 'decimal_separator' => $decimal_separator, |
219 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
220 | - 'delete_payment' => __( 'Are you sure you want to <strong>permanently</strong> delete this donation?', 'give' ), |
|
221 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
222 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
223 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
224 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
225 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
226 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
227 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
228 | - 'currency_sign' => give_currency_filter( '' ), |
|
229 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
219 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
220 | + 'delete_payment' => __('Are you sure you want to <strong>permanently</strong> delete this donation?', 'give'), |
|
221 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
222 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
223 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
224 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
225 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
226 | + 'one_option' => __('Choose a form', 'give'), |
|
227 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
228 | + 'currency_sign' => give_currency_filter(''), |
|
229 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
230 | 230 | 'currency_decimals' => give_get_price_decimals(), |
231 | - 'ok' => __( 'Ok', 'give' ), |
|
232 | - 'cancel' => __( 'Cancel', 'give' ), |
|
233 | - 'success' => __( 'Success', 'give' ), |
|
234 | - 'error' => __( 'Error', 'give' ), |
|
235 | - 'close' => __( 'Close', 'give' ), |
|
236 | - 'confirm' => __( 'Confirm', 'give' ), |
|
237 | - 'confirm_action' => __( 'Confirm Action', 'give' ), |
|
238 | - 'confirm_deletion' => __( 'Confirm Deletion', 'give' ), |
|
239 | - 'confirm_delete_donation' => __( 'Confirm Delete Donation', 'give' ), |
|
240 | - 'confirm_resend' => __( 'Confirm re-send', 'give' ), |
|
241 | - 'confirm_bulk_action' => __( 'Confirm bulk action', 'give' ), |
|
242 | - 'restart_upgrade' => __( 'Do you want to restart the update process?', 'give' ), |
|
243 | - 'restart_update' => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ), |
|
244 | - 'stop_upgrade' => __( 'Do you want to stop the update process now?', 'give' ), |
|
245 | - 'import_failed' => __( 'Import failed', 'give' ), |
|
246 | - 'flush_success' => __( 'Flush success', 'give' ), |
|
247 | - 'flush_error' => __( 'Flush error', 'give' ), |
|
248 | - 'no_form_selected' => __( 'No form selected', 'give' ), |
|
249 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
250 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
251 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
252 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
253 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
254 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
231 | + 'ok' => __('Ok', 'give'), |
|
232 | + 'cancel' => __('Cancel', 'give'), |
|
233 | + 'success' => __('Success', 'give'), |
|
234 | + 'error' => __('Error', 'give'), |
|
235 | + 'close' => __('Close', 'give'), |
|
236 | + 'confirm' => __('Confirm', 'give'), |
|
237 | + 'confirm_action' => __('Confirm Action', 'give'), |
|
238 | + 'confirm_deletion' => __('Confirm Deletion', 'give'), |
|
239 | + 'confirm_delete_donation' => __('Confirm Delete Donation', 'give'), |
|
240 | + 'confirm_resend' => __('Confirm re-send', 'give'), |
|
241 | + 'confirm_bulk_action' => __('Confirm bulk action', 'give'), |
|
242 | + 'restart_upgrade' => __('Do you want to restart the update process?', 'give'), |
|
243 | + 'restart_update' => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'), |
|
244 | + 'stop_upgrade' => __('Do you want to stop the update process now?', 'give'), |
|
245 | + 'import_failed' => __('Import failed', 'give'), |
|
246 | + 'flush_success' => __('Flush success', 'give'), |
|
247 | + 'flush_error' => __('Flush error', 'give'), |
|
248 | + 'no_form_selected' => __('No form selected', 'give'), |
|
249 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
250 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
251 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
252 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
253 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
254 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
255 | 255 | /* translators : %s: Donation form options metabox */ |
256 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
257 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
258 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
259 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
260 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
261 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
262 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
263 | - 'unlock_donor_fields_title' => __( 'Action forbidden', 'give' ), |
|
264 | - 'unlock_donor_fields_message' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
265 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
256 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
257 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
258 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
259 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
260 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
261 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
262 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
263 | + 'unlock_donor_fields_title' => __('Action forbidden', 'give'), |
|
264 | + 'unlock_donor_fields_message' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
265 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
266 | 266 | 'donors_bulk_action' => array( |
267 | 267 | 'no_donor_selected' => array( |
268 | - 'title' => __( 'No donors selected', 'give' ), |
|
269 | - 'desc' => __( 'You must choose at least one or more donors to delete.', 'give' ) |
|
268 | + 'title' => __('No donors selected', 'give'), |
|
269 | + 'desc' => __('You must choose at least one or more donors to delete.', 'give') |
|
270 | 270 | ), |
271 | 271 | 'no_action_selected' => array( |
272 | - 'title' => __( 'No action selected', 'give' ), |
|
273 | - 'desc' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
272 | + 'title' => __('No action selected', 'give'), |
|
273 | + 'desc' => __('You must select a bulk action to proceed.', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | 'donations_bulk_action' => array( |
277 | 277 | 'titles' => array( |
278 | - 'zero' => __( 'No payments selected', 'give' ), |
|
278 | + 'zero' => __('No payments selected', 'give'), |
|
279 | 279 | ), |
280 | 280 | 'delete' => array( |
281 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
282 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
283 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
281 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
282 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
283 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
284 | 284 | ), |
285 | 285 | 'resend-receipt' => array( |
286 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
287 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
288 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
286 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
287 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
288 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
289 | 289 | ), |
290 | 290 | 'set-to-status' => array( |
291 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
292 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
293 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
291 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
292 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
293 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
294 | 294 | ), |
295 | 295 | ), |
296 | 296 | 'updates' => array( |
297 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ), |
|
297 | + 'ajax_error' => __('Please reload this page and try again', 'give'), |
|
298 | 298 | ), |
299 | 299 | 'metabox_fields' => array( |
300 | 300 | 'media' => array( |
301 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
301 | + 'button_title' => __('Choose Image', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'file' => array( |
304 | - 'button_title' => __( 'Choose File', 'give' ), |
|
304 | + 'button_title' => __('Choose File', 'give'), |
|
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | 'chosen' => array( |
308 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
309 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
308 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
309 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
310 | 310 | ), |
311 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
312 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
313 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
311 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
312 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
313 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
314 | 314 | 'give_donation_import' => 'give_donation_import', |
315 | 315 | 'core_settings_import' => 'give_core_settings_import', |
316 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
316 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
317 | 317 | 'give_donation_amounts' => array( |
318 | - 'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ), |
|
319 | - 'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ), |
|
318 | + 'minimum' => apply_filters('give_donation_minimum_limit', 1), |
|
319 | + 'maximum' => apply_filters('give_donation_maximum_limit', 999999.99), |
|
320 | 320 | ), |
321 | - 'chosen_add_title_prefix' => __( 'No result found. Press enter to add', 'give' ), |
|
322 | - 'db_update_nonce' => wp_create_nonce( Give_Updates::$background_updater->get_identifier() ), |
|
321 | + 'chosen_add_title_prefix' => __('No result found. Press enter to add', 'give'), |
|
322 | + 'db_update_nonce' => wp_create_nonce(Give_Updates::$background_updater->get_identifier()), |
|
323 | 323 | 'ajax' => give_test_ajax_works(), |
324 | 324 | 'date_format' => give_get_localized_date_format_to_js(), |
325 | 325 | ); |
326 | 326 | |
327 | - wp_localize_script( 'give-admin-scripts', 'give_vars', $localized_data ); |
|
327 | + wp_localize_script('give-admin-scripts', 'give_vars', $localized_data); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | <style type="text/css" media="screen"> |
336 | 336 | @font-face { |
337 | 337 | font-family: 'give-icomoon'; |
338 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
339 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
340 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
341 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
338 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
339 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
340 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
341 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
342 | 342 | font-weight: normal; |
343 | 343 | font-style: normal; |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @since 2.1.0 |
362 | 362 | */ |
363 | 363 | public function public_enqueue_styles() { |
364 | - wp_enqueue_style( 'give-styles' ); |
|
364 | + wp_enqueue_style('give-styles'); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | public function public_enqueue_scripts() { |
374 | 374 | |
375 | 375 | // Call Babel Polyfill with common handle so that it is compatible with plugins and themes. |
376 | - if ( ! wp_script_is( 'babel-polyfill', 'enqueued' ) ) { |
|
376 | + if ( ! wp_script_is('babel-polyfill', 'enqueued')) { |
|
377 | 377 | wp_enqueue_script( |
378 | 378 | 'babel-polyfill', |
379 | - GIVE_PLUGIN_URL . 'assets/dist/js/babel-polyfill.js', |
|
380 | - array( 'jquery' ), |
|
379 | + GIVE_PLUGIN_URL.'assets/dist/js/babel-polyfill.js', |
|
380 | + array('jquery'), |
|
381 | 381 | GIVE_VERSION, |
382 | 382 | false |
383 | 383 | ); |
384 | 384 | } |
385 | 385 | |
386 | - wp_enqueue_script( 'give' ); |
|
386 | + wp_enqueue_script('give'); |
|
387 | 387 | |
388 | 388 | $this->public_localize_scripts(); |
389 | 389 | } |
@@ -402,22 +402,22 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @return string $message Send notice message for email access. |
404 | 404 | */ |
405 | - $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) ); |
|
405 | + $message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give')); |
|
406 | 406 | |
407 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
407 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
408 | 408 | 'ajaxurl' => give_get_ajax_url(), |
409 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
409 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
410 | 410 | // Do not use this nonce. Its deprecated. |
411 | 411 | 'currency' => give_get_currency(), |
412 | - 'currency_sign' => give_currency_filter( '' ), |
|
412 | + 'currency_sign' => give_currency_filter(''), |
|
413 | 413 | 'currency_pos' => give_get_currency_position(), |
414 | 414 | 'thousands_separator' => give_get_price_thousand_separator(), |
415 | 415 | 'decimal_separator' => give_get_price_decimal_separator(), |
416 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
417 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
418 | - 'bad_maximum' => __( 'The maximum custom donation amount for this form is', 'give' ), |
|
419 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
420 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
416 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
417 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
418 | + 'bad_maximum' => __('The maximum custom donation amount for this form is', 'give'), |
|
419 | + 'general_loading' => __('Loading...', 'give'), |
|
420 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
421 | 421 | 'number_decimals' => give_get_price_decimals(), |
422 | 422 | 'give_version' => GIVE_VERSION, |
423 | 423 | 'magnific_options' => apply_filters( |
@@ -431,32 +431,32 @@ discard block |
||
431 | 431 | 'give_form_translation_js', |
432 | 432 | array( |
433 | 433 | // Field name Validation message. |
434 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
435 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
436 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
437 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
438 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
439 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
440 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
434 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
435 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
436 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
437 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
438 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
439 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
440 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
441 | 441 | ) |
442 | 442 | ), |
443 | 443 | 'confirm_email_sent_message' => $message, |
444 | - 'ajax_vars' => apply_filters( 'give_global_ajax_vars', array( |
|
444 | + 'ajax_vars' => apply_filters('give_global_ajax_vars', array( |
|
445 | 445 | 'ajaxurl' => give_get_ajax_url(), |
446 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
447 | - 'loading' => __( 'Loading', 'give' ), |
|
446 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
447 | + 'loading' => __('Loading', 'give'), |
|
448 | 448 | // General loading message. |
449 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
449 | + 'select_option' => __('Please select an option', 'give'), |
|
450 | 450 | // Variable pricing error with multi-donation option enabled. |
451 | - 'default_gateway' => give_get_default_gateway( null ), |
|
452 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
451 | + 'default_gateway' => give_get_default_gateway(null), |
|
452 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
453 | 453 | 'number_decimals' => give_get_price_decimals(), |
454 | - ) ), |
|
454 | + )), |
|
455 | 455 | 'cookie_hash' => COOKIEHASH, |
456 | - 'delete_session_nonce_cookie' => absint( Give()->session->is_delete_nonce_cookie() ) |
|
457 | - ) ); |
|
456 | + 'delete_session_nonce_cookie' => absint(Give()->session->is_delete_nonce_cookie()) |
|
457 | + )); |
|
458 | 458 | |
459 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
459 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
@@ -470,15 +470,15 @@ discard block |
||
470 | 470 | */ |
471 | 471 | public function get_frontend_stylesheet_uri() { |
472 | 472 | |
473 | - $file = 'give' . $this->direction . '.css'; |
|
473 | + $file = 'give'.$this->direction.'.css'; |
|
474 | 474 | $templates_dir = give_get_theme_template_dir_name(); |
475 | 475 | |
476 | 476 | // Directory paths to CSS files to support checking via file_exists(). |
477 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
478 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
479 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
480 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
481 | - $give_plugin_style_sheet = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file; |
|
477 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
478 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
479 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
480 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
481 | + $give_plugin_style_sheet = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file; |
|
482 | 482 | $uri = false; |
483 | 483 | |
484 | 484 | /** |
@@ -489,23 +489,23 @@ discard block |
||
489 | 489 | * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme. |
490 | 490 | * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin. |
491 | 491 | */ |
492 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
493 | - if ( ! empty( $nonmin ) ) { |
|
494 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
492 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
493 | + if ( ! empty($nonmin)) { |
|
494 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
495 | 495 | } else { |
496 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
496 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
497 | 497 | } |
498 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
499 | - if ( ! empty( $nonmin ) ) { |
|
500 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
498 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
499 | + if ( ! empty($nonmin)) { |
|
500 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
501 | 501 | } else { |
502 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
502 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
503 | 503 | } |
504 | - } elseif ( file_exists( $give_plugin_style_sheet ) ) { |
|
505 | - $uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file; |
|
504 | + } elseif (file_exists($give_plugin_style_sheet)) { |
|
505 | + $uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file; |
|
506 | 506 | } |
507 | 507 | |
508 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
508 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
509 | 509 | |
510 | 510 | } |
511 | 511 | |
@@ -517,18 +517,18 @@ discard block |
||
517 | 517 | // Enqueue the bundled block JS file |
518 | 518 | wp_enqueue_script( |
519 | 519 | 'give-blocks-js', |
520 | - GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js', |
|
521 | - array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ), |
|
520 | + GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js', |
|
521 | + array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'), |
|
522 | 522 | GIVE_VERSION |
523 | 523 | ); |
524 | 524 | |
525 | 525 | // Enqueue public styles |
526 | - wp_enqueue_style( 'give-styles' ); |
|
526 | + wp_enqueue_style('give-styles'); |
|
527 | 527 | |
528 | 528 | // Enqueue the bundled block css file |
529 | 529 | wp_enqueue_style( |
530 | 530 | 'give-blocks-css', |
531 | - GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css', |
|
531 | + GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css', |
|
532 | 532 | array( ), |
533 | 533 | GIVE_VERSION |
534 | 534 | ); |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @return Give_Donor_Wall |
51 | 51 | */ |
52 | 52 | public static function get_instance() { |
53 | - if ( null === static::$instance ) { |
|
53 | + if (null === static::$instance) { |
|
54 | 54 | self::$instance = new static(); |
55 | 55 | |
56 | 56 | self::$instance->setup_actions(); |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function setup_actions() { |
70 | 70 | |
71 | - add_shortcode( 'give_donor_wall', array( $this, 'render_shortcode' ) ); |
|
71 | + add_shortcode('give_donor_wall', array($this, 'render_shortcode')); |
|
72 | 72 | |
73 | - add_action( 'wp_ajax_give_get_donor_comments', array( $this, 'ajax_handler' ) ); |
|
74 | - add_action( 'wp_ajax_nopriv_give_get_donor_comments', array( $this, 'ajax_handler' ) ); |
|
73 | + add_action('wp_ajax_give_get_donor_comments', array($this, 'ajax_handler')); |
|
74 | + add_action('wp_ajax_nopriv_give_get_donor_comments', array($this, 'ajax_handler')); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -107,29 +107,29 @@ discard block |
||
107 | 107 | * } |
108 | 108 | * @return string|bool The markup of the form grid or false. |
109 | 109 | */ |
110 | - public function render_shortcode( $atts ) { |
|
110 | + public function render_shortcode($atts) { |
|
111 | 111 | |
112 | 112 | $give_settings = give_get_settings(); |
113 | 113 | |
114 | - $atts = $this->parse_atts( $atts ); |
|
115 | - $donor_query = $this->get_donor_query_atts( $atts ); |
|
116 | - $donors = $this->get_donors( $donor_query ); |
|
114 | + $atts = $this->parse_atts($atts); |
|
115 | + $donor_query = $this->get_donor_query_atts($atts); |
|
116 | + $donors = $this->get_donors($donor_query); |
|
117 | 117 | $html = ''; |
118 | 118 | |
119 | - if ( $donors ) { |
|
119 | + if ($donors) { |
|
120 | 120 | |
121 | 121 | ob_start(); |
122 | 122 | |
123 | - foreach ( $donors as $donor ) { |
|
123 | + foreach ($donors as $donor) { |
|
124 | 124 | // Give/templates/shortcode-donor-wall.php. |
125 | - give_get_template( 'shortcode-donor-wall', array( $donor, $give_settings, $atts ) ); |
|
125 | + give_get_template('shortcode-donor-wall', array($donor, $give_settings, $atts)); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $html = ob_get_clean(); |
129 | 129 | |
130 | 130 | // Return only donor html. |
131 | 131 | if ( |
132 | - isset( $atts['only_donor_html'] ) |
|
132 | + isset($atts['only_donor_html']) |
|
133 | 133 | && wp_doing_ajax() |
134 | 134 | && $atts['only_donor_html'] |
135 | 135 | ) { |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $next_donor_query['fields'] = 'id'; |
143 | 143 | |
144 | 144 | $more_btn_html = ''; |
145 | - if ( $this->get_donors( $next_donor_query ) ) { |
|
145 | + if ($this->get_donors($next_donor_query)) { |
|
146 | 146 | $more_btn_html = sprintf( |
147 | 147 | '<button class="give-donor__load_more give-button-with-loader" data-shortcode="%1$s"><span class="give-loading-animation"></span>%2$s</button>', |
148 | - rawurlencode( http_build_query( $atts ) ), |
|
148 | + rawurlencode(http_build_query($atts)), |
|
149 | 149 | $atts['loadmore_text'] |
150 | 150 | ); |
151 | 151 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $html = $html |
154 | 154 | ? sprintf( |
155 | 155 | '<div class="give-wrap give-grid-ie-utility"><div class="give-grid give-grid--%1$s">%2$s</div>%3$s</div>', |
156 | - esc_attr( $atts['columns'] ), |
|
156 | + esc_attr($atts['columns']), |
|
157 | 157 | $html, |
158 | 158 | $more_btn_html |
159 | 159 | ) |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - public function parse_atts( $atts ) { |
|
175 | + public function parse_atts($atts) { |
|
176 | 176 | $atts = shortcode_atts( |
177 | 177 | array( |
178 | 178 | 'donors_per_page' => 20, |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | 'show_comments' => true, |
188 | 188 | 'comment_length' => 20, |
189 | 189 | 'only_comments' => false, |
190 | - 'readmore_text' => esc_html__( 'Read More', 'give' ), |
|
191 | - 'loadmore_text' => esc_html__( 'Load More', 'give' ), |
|
190 | + 'readmore_text' => esc_html__('Read More', 'give'), |
|
191 | + 'loadmore_text' => esc_html__('Load More', 'give'), |
|
192 | 192 | 'avatar_size' => 60, |
193 | 193 | 'orderby' => 'donation_count', |
194 | 194 | 'order' => 'DESC', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Validate integer attributes. |
201 | - $atts['donors_per_page'] = absint( $atts['donors_per_page'] ); |
|
201 | + $atts['donors_per_page'] = absint($atts['donors_per_page']); |
|
202 | 202 | |
203 | 203 | // Validate boolean attributes. |
204 | 204 | $boolean_attributes = array( |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | 'only_donor_html', |
214 | 214 | ); |
215 | 215 | |
216 | - foreach ( $boolean_attributes as $att ) { |
|
216 | + foreach ($boolean_attributes as $att) { |
|
217 | 217 | // Convert numeric to boolean. |
218 | 218 | // It will prevent condition check against boolean value. |
219 | - if ( is_numeric( $atts[ $att ] ) ) { |
|
220 | - $atts[ $att ] = (bool) $atts[ $att ]; |
|
219 | + if (is_numeric($atts[$att])) { |
|
220 | + $atts[$att] = (bool) $atts[$att]; |
|
221 | 221 | } |
222 | 222 | |
223 | - $atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN ); |
|
223 | + $atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return $atts; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return array |
238 | 238 | */ |
239 | - public function get_donor_query_atts( $atts ) { |
|
239 | + public function get_donor_query_atts($atts) { |
|
240 | 240 | // Set default form query args. |
241 | 241 | $donor_args = array( |
242 | 242 | 'number' => $atts['donors_per_page'], |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | ); |
247 | 247 | |
248 | 248 | // Hide donors with zero donation amount. |
249 | - if ( $atts['hide_empty'] ) { |
|
249 | + if ($atts['hide_empty']) { |
|
250 | 250 | $donor_args['donation_amount'] = array( |
251 | 251 | 'compare' => '>=', |
252 | 252 | 'amount' => 1, |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | // Show donor who donated to specific form. |
257 | - if ( $atts['form_id'] ) { |
|
257 | + if ($atts['form_id']) { |
|
258 | 258 | $donor_args['give_forms'] = $atts['form_id']; |
259 | 259 | } |
260 | 260 | |
261 | 261 | // Show donor by id. |
262 | - if ( $atts['ids'] ) { |
|
262 | + if ($atts['ids']) { |
|
263 | 263 | $donor_args['donor'] = $atts['ids']; |
264 | 264 | } |
265 | 265 | |
266 | 266 | // Replace donation with purchase because donor table has that prefix in column name. |
267 | 267 | $donor_args['orderby'] = str_replace( |
268 | - array( 'donation', 'amount' ), array( |
|
268 | + array('donation', 'amount'), array( |
|
269 | 269 | 'purchase', |
270 | 270 | 'value', |
271 | 271 | ), $atts['orderby'] |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | 'date_created' => 'DESC', |
278 | 278 | ); |
279 | 279 | |
280 | - unset( $donor_args['order'] ); |
|
280 | + unset($donor_args['order']); |
|
281 | 281 | |
282 | 282 | // Set payment query. |
283 | 283 | // @codingStandardsIgnoreStart |
284 | - if ( true === $atts['only_comments'] ) { |
|
284 | + if (true === $atts['only_comments']) { |
|
285 | 285 | $donor_args['meta_query'] = array( |
286 | 286 | array( |
287 | 287 | 'key' => '_give_has_comment', |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return array |
306 | 306 | */ |
307 | - public function get_donors( $donor_query ) { |
|
308 | - $donor_query = new Give_Donors_Query( $donor_query ); |
|
307 | + public function get_donors($donor_query) { |
|
308 | + $donor_query = new Give_Donors_Query($donor_query); |
|
309 | 309 | $donors = $donor_query->get_donors(); |
310 | 310 | |
311 | 311 | return $donors; |
@@ -319,26 +319,26 @@ discard block |
||
319 | 319 | * @access public |
320 | 320 | */ |
321 | 321 | public function ajax_handler() { |
322 | - $shortcode_atts = wp_parse_args( give_clean( rawurldecode( $_POST['data'] ) ) ); // @codingStandardsIgnoreLine |
|
322 | + $shortcode_atts = wp_parse_args(give_clean(rawurldecode($_POST['data']))); // @codingStandardsIgnoreLine |
|
323 | 323 | |
324 | 324 | // Get next page donor comments. |
325 | 325 | $shortcode_atts['paged'] = $shortcode_atts['paged'] + 1; |
326 | 326 | $shortcode_atts['only_donor_html'] = true; |
327 | 327 | |
328 | - $donors_comment_html = $this->render_shortcode( $shortcode_atts ); |
|
328 | + $donors_comment_html = $this->render_shortcode($shortcode_atts); |
|
329 | 329 | |
330 | 330 | // Check if donor comment remaining. |
331 | - $donor_query = $this->get_donor_query_atts( $shortcode_atts ); |
|
331 | + $donor_query = $this->get_donor_query_atts($shortcode_atts); |
|
332 | 332 | $donor_query['paged'] = $donor_query['paged'] + 1; |
333 | 333 | $donor_query['fields'] = 'id'; |
334 | - $has_donors = $this->get_donors( $donor_query ) ? 1 : 0; |
|
334 | + $has_donors = $this->get_donors($donor_query) ? 1 : 0; |
|
335 | 335 | |
336 | 336 | // Remove internal shortcode param. |
337 | - unset( $shortcode_atts['only_donor_html'] ); |
|
337 | + unset($shortcode_atts['only_donor_html']); |
|
338 | 338 | |
339 | 339 | wp_send_json( |
340 | 340 | array( |
341 | - 'shortcode' => rawurlencode( http_build_query( $shortcode_atts ) ), |
|
341 | + 'shortcode' => rawurlencode(http_build_query($shortcode_atts)), |
|
342 | 342 | 'html' => $donors_comment_html, |
343 | 343 | 'remaining' => $has_donors, |
344 | 344 | ) |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false, // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
66 | + public function search_box($text, $input_id) { |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function get_columns() { |
78 | 78 | $columns = array( |
79 | - 'ID' => __( 'Log ID', 'give' ), |
|
80 | - 'date' => __( 'Date', 'give' ), |
|
81 | - 'details' => __( 'Process Details', 'give' ), |
|
79 | + 'ID' => __('Log ID', 'give'), |
|
80 | + 'date' => __('Date', 'give'), |
|
81 | + 'details' => __('Process Details', 'give'), |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | return $columns; |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return string Column Name |
97 | 97 | */ |
98 | - public function column_default( $item, $column_name ) { |
|
99 | - switch ( $column_name ) { |
|
98 | + public function column_default($item, $column_name) { |
|
99 | + switch ($column_name) { |
|
100 | 100 | case 'ID': |
101 | 101 | return sprintf( |
102 | 102 | '<span class="give-item-label give-item-label-gray">%1$s</span> %2$s', |
103 | - esc_attr( $item[ $column_name ] ), |
|
104 | - esc_attr( $item['title'] ) |
|
103 | + esc_attr($item[$column_name]), |
|
104 | + esc_attr($item['title']) |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | default: |
108 | - return esc_attr( $item[ $column_name ] ); |
|
108 | + return esc_attr($item[$column_name]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -119,24 +119,24 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return void |
121 | 121 | */ |
122 | - public function column_details( $item ) { |
|
123 | - echo Give()->tooltips->render_link( array( |
|
124 | - 'label' => __( 'View Update Log', 'give' ), |
|
122 | + public function column_details($item) { |
|
123 | + echo Give()->tooltips->render_link(array( |
|
124 | + 'label' => __('View Update Log', 'give'), |
|
125 | 125 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
126 | 126 | 'link' => "#TB_inline?width=640&inlineId=log-details-{$item['ID']}", |
127 | 127 | 'attributes' => array( |
128 | 128 | 'class' => 'thickbox give-error-log-details-link button button-small', |
129 | 129 | ), |
130 | - ) ); |
|
130 | + )); |
|
131 | 131 | ?> |
132 | - <div id="log-details-<?php echo esc_attr( $item['ID'] ); ?>" style="display:none;"> |
|
132 | + <div id="log-details-<?php echo esc_attr($item['ID']); ?>" style="display:none;"> |
|
133 | 133 | <?php |
134 | 134 | |
135 | 135 | // Print Log Content, if not empty. |
136 | - if ( ! empty( $item['log_content'] ) ) { |
|
136 | + if ( ! empty($item['log_content'])) { |
|
137 | 137 | echo sprintf( |
138 | 138 | '<p><pre>%1$s</pre></div>', |
139 | - esc_html( $item['log_content'] ) |
|
139 | + esc_html($item['log_content']) |
|
140 | 140 | ); |
141 | 141 | } |
142 | 142 | ?> |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param string $which |
159 | 159 | */ |
160 | - protected function display_tablenav( $which ) { |
|
161 | - if ( 'top' === $which ) { |
|
162 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
160 | + protected function display_tablenav($which) { |
|
161 | + if ('top' === $which) { |
|
162 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
163 | 163 | } |
164 | 164 | ?> |
165 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
165 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
166 | 166 | |
167 | 167 | <div class="alignleft actions bulkactions"> |
168 | - <?php $this->bulk_actions( $which ); ?> |
|
168 | + <?php $this->bulk_actions($which); ?> |
|
169 | 169 | </div> |
170 | 170 | <?php |
171 | - $this->extra_tablenav( $which ); |
|
172 | - $this->pagination( $which ); |
|
171 | + $this->extra_tablenav($which); |
|
172 | + $this->pagination($which); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <br class="clear"/> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return int Current page number |
187 | 187 | */ |
188 | 188 | public function get_paged() { |
189 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
189 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return void |
201 | 201 | */ |
202 | - function bulk_actions( $which = '' ) { |
|
202 | + function bulk_actions($which = '') { |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | 'posts_per_page' => $this->per_page, |
220 | 220 | ); |
221 | 221 | |
222 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
222 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
223 | 223 | |
224 | - if ( $logs ) { |
|
225 | - foreach ( $logs as $log ) { |
|
224 | + if ($logs) { |
|
225 | + foreach ($logs as $log) { |
|
226 | 226 | |
227 | 227 | $logs_data[] = array( |
228 | 228 | 'ID' => $log->ID, |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | $columns = $this->get_columns(); |
255 | 255 | $hidden = array(); // No hidden columns |
256 | 256 | $sortable = $this->get_sortable_columns(); |
257 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
257 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
258 | 258 | $this->items = $this->get_logs(); |
259 | - $total_items = Give()->logs->get_log_count( 0, 'update' ); |
|
259 | + $total_items = Give()->logs->get_log_count(0, 'update'); |
|
260 | 260 | |
261 | - $this->set_pagination_args( array( |
|
261 | + $this->set_pagination_args(array( |
|
262 | 262 | 'total_items' => $total_items, |
263 | 263 | 'per_page' => $this->per_page, |
264 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
265 | - ) ); |
|
264 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
265 | + )); |
|
266 | 266 | } |
267 | 267 | } |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | 'class' => 'tools-form-dropdown-recount-form-select', |
58 | 58 | 'name' => 'form_id', |
59 | 59 | 'chosen' => true, |
60 | - 'placeholder' => __( 'Select Form', 'give' ), |
|
60 | + 'placeholder' => __('Select Form', 'give'), |
|
61 | 61 | ); |
62 | - echo Give()->html->forms_dropdown( $args ); |
|
62 | + echo Give()->html->forms_dropdown($args); |
|
63 | 63 | ?> |
64 | 64 | </span> |
65 | 65 | |
66 | 66 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
67 | 67 | <label for="delete-import-donors"> |
68 | 68 | <?php |
69 | - echo Give()->html->checkbox( array( 'name' => 'delete-import-donors' ) ); |
|
70 | - esc_html_e( 'Delete imported WordPress users', 'give' ); |
|
69 | + echo Give()->html->checkbox(array('name' => 'delete-import-donors')); |
|
70 | + esc_html_e('Delete imported WordPress users', 'give'); |
|
71 | 71 | ?> |
72 | 72 | </label> |
73 | 73 | </span> |
74 | 74 | |
75 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
75 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
76 | 76 | |
77 | 77 | <br/> |
78 | 78 | |
79 | 79 | <span class="give-recount-stats-descriptions"> |
80 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
81 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
82 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
83 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
80 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
81 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
82 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
83 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
84 | 84 | <?php |
85 | 85 | /** |
86 | 86 | * Fires in the recount stats description area. |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @since 1.5 |
91 | 91 | */ |
92 | - do_action( 'give_recount_tool_descriptions' ); |
|
92 | + do_action('give_recount_tool_descriptions'); |
|
93 | 93 | ?> |
94 | - <span id="delete-test-transactions"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
95 | - <span id="reset-stats"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
94 | + <span id="delete-test-transactions"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
95 | + <span id="reset-stats"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
96 | 96 | </span> |
97 | 97 | |
98 | 98 | <span class="spinner"></span> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 1.5 |
108 | 108 | */ |
109 | - do_action( 'give_tools_recount_forms' ); |
|
109 | + do_action('give_tools_recount_forms'); |
|
110 | 110 | ?> |
111 | 111 | </div><!-- .inside --> |
112 | 112 | </div><!-- .postbox --> |
@@ -117,4 +117,4 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @since 1.5 |
119 | 119 | */ |
120 | -do_action( 'give_tools_recount_stats_after' ); |
|
120 | +do_action('give_tools_recount_stats_after'); |
@@ -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 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * |
72 | 72 | * } |
73 | 73 | */ |
74 | - public function add( $args ) { |
|
75 | - __give_211_bc_email_template_tag_param( $args, func_get_args() ); |
|
74 | + public function add($args) { |
|
75 | + __give_211_bc_email_template_tag_param($args, func_get_args()); |
|
76 | 76 | |
77 | - if ( is_callable( $args['func'] ) ) { |
|
78 | - $this->tags[ $args['tag'] ] = array( |
|
77 | + if (is_callable($args['func'])) { |
|
78 | + $this->tags[$args['tag']] = array( |
|
79 | 79 | 'tag' => $args['tag'], |
80 | 80 | 'desc' => $args['desc'], |
81 | 81 | 'func' => $args['func'], |
82 | - 'context' => give_check_variable( $args['context'], 'empty', 'general' ), |
|
82 | + 'context' => give_check_variable($args['context'], 'empty', 'general'), |
|
83 | 83 | 'is_admin' => (bool) $args['is_admin'], // Introduced in 2.2.1 |
84 | 84 | 'description' => $args['desc'], // deprecated in 2.2.1 |
85 | 85 | 'function' => $args['func'], // deprecated in 2.2.1 |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param string $tag Email tag to remove hook from |
96 | 96 | */ |
97 | - public function remove( $tag ) { |
|
98 | - unset( $this->tags[ $tag ] ); |
|
97 | + public function remove($tag) { |
|
98 | + unset($this->tags[$tag]); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return bool |
109 | 109 | */ |
110 | - public function email_tag_exists( $tag ) { |
|
111 | - return array_key_exists( $tag, $this->tags ); |
|
110 | + public function email_tag_exists($tag) { |
|
111 | + return array_key_exists($tag, $this->tags); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array |
124 | 124 | */ |
125 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
125 | + public function get_tags($context_type = 'all', $field = '') { |
|
126 | 126 | $tags = $this->tags; |
127 | 127 | |
128 | - if ( 'all' !== $context_type ) { |
|
128 | + if ('all' !== $context_type) { |
|
129 | 129 | $tags = array(); |
130 | 130 | |
131 | - foreach ( $this->tags as $tag ) { |
|
132 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
131 | + foreach ($this->tags as $tag) { |
|
132 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - $tags[ $tag['tag'] ] = $tag; |
|
136 | + $tags[$tag['tag']] = $tag; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
141 | - $tags = wp_list_pluck( $tags, $field ); |
|
140 | + if ( ! empty($tags) && ! empty($field)) { |
|
141 | + $tags = wp_list_pluck($tags, $field); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $tags; |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return string Content with email tags filtered out. |
158 | 158 | */ |
159 | - public function do_tags( $content, $tag_args ) { |
|
159 | + public function do_tags($content, $tag_args) { |
|
160 | 160 | |
161 | 161 | // Check if there is at least one tag added. |
162 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
162 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
163 | 163 | return $content; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $this->tag_args = $tag_args; |
167 | 167 | |
168 | - $new_content = preg_replace_callback( '/{([A-z0-9\-\_]+)}/s', array( $this, 'do_tag' ), $content ); |
|
168 | + $new_content = preg_replace_callback('/{([A-z0-9\-\_]+)}/s', array($this, 'do_tag'), $content); |
|
169 | 169 | |
170 | 170 | $this->tag_args = null; |
171 | 171 | |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return mixed |
183 | 183 | */ |
184 | - public function do_tag( $m ) { |
|
184 | + public function do_tag($m) { |
|
185 | 185 | |
186 | 186 | // Get tag |
187 | 187 | $tag = $m[1]; |
188 | 188 | |
189 | 189 | // Return tag if tag not set |
190 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
190 | + if ( ! $this->email_tag_exists($tag)) { |
|
191 | 191 | return $m[0]; |
192 | 192 | } |
193 | 193 | |
194 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
194 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | } |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @param array $args Email template tag argument |
206 | 206 | * Check Give_Email_Template_Tags::add function description for more information |
207 | 207 | */ |
208 | -function give_add_email_tag( $args ) { |
|
209 | - __give_211_bc_email_template_tag_param( $args, func_get_args() ); |
|
208 | +function give_add_email_tag($args) { |
|
209 | + __give_211_bc_email_template_tag_param($args, func_get_args()); |
|
210 | 210 | |
211 | - Give()->email_tags->add( $args ); |
|
211 | + Give()->email_tags->add($args); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param string $tag Email tag to remove hook from |
220 | 220 | */ |
221 | -function give_remove_email_tag( $tag ) { |
|
222 | - Give()->email_tags->remove( $tag ); |
|
221 | +function give_remove_email_tag($tag) { |
|
222 | + Give()->email_tags->remove($tag); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return bool |
233 | 233 | */ |
234 | -function give_email_tag_exists( $tag ) { |
|
235 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
234 | +function give_email_tag_exists($tag) { |
|
235 | + return Give()->email_tags->email_tag_exists($tag); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | $email_tags = give_get_email_tags(); |
260 | 260 | |
261 | 261 | ob_start(); |
262 | - if ( count( $email_tags ) > 0 ) : ?> |
|
262 | + if (count($email_tags) > 0) : ?> |
|
263 | 263 | <div class="give-email-tags-wrap"> |
264 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
264 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
265 | 265 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
266 | 266 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['desc']; ?> |
267 | 267 | </span> |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return string Content with email tags filtered out. |
288 | 288 | */ |
289 | -function give_do_email_tags( $content, $tag_args ) { |
|
289 | +function give_do_email_tags($content, $tag_args) { |
|
290 | 290 | // Backward compatibility < 2.0 |
291 | - if ( ! is_array( $tag_args ) && is_numeric( $tag_args ) ) { |
|
292 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
291 | + if ( ! is_array($tag_args) && is_numeric($tag_args)) { |
|
292 | + $tag_args = array('payment_id' => $tag_args); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $email_tags = Give()->email_tags instanceof Give_Email_Template_Tags |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | : new Give_Email_Template_Tags(); |
298 | 298 | |
299 | 299 | // Replace all tags |
300 | - $content = $email_tags->do_tags( $content, $tag_args ); |
|
300 | + $content = $email_tags->do_tags($content, $tag_args); |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * Filter the filtered content text. |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @since 1.0 |
306 | 306 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
307 | 307 | */ |
308 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
308 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
309 | 309 | |
310 | 310 | // Return content |
311 | 311 | return $content; |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @since 1.0 |
326 | 326 | */ |
327 | - do_action( 'give_add_email_tags' ); |
|
327 | + do_action('give_add_email_tags'); |
|
328 | 328 | } |
329 | 329 | |
330 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
330 | +add_action('init', 'give_load_email_tags', - 999); |
|
331 | 331 | |
332 | 332 | |
333 | 333 | /** |
@@ -342,67 +342,67 @@ discard block |
||
342 | 342 | /* Donation Payment */ |
343 | 343 | array( |
344 | 344 | 'tag' => 'donation', |
345 | - 'desc' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
345 | + 'desc' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
346 | 346 | 'func' => 'give_email_tag_donation', |
347 | 347 | 'context' => 'donation', |
348 | 348 | ), |
349 | 349 | array( |
350 | 350 | 'tag' => 'amount', |
351 | - 'desc' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
351 | + 'desc' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
352 | 352 | 'func' => 'give_email_tag_amount', |
353 | 353 | 'context' => 'donation', |
354 | 354 | ), |
355 | 355 | array( |
356 | 356 | 'tag' => 'price', |
357 | - 'desc' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
357 | + 'desc' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
358 | 358 | 'func' => 'give_email_tag_price', |
359 | 359 | 'context' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | 362 | 'tag' => 'billing_address', |
363 | - 'desc' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
363 | + 'desc' => esc_html__('The donor\'s billing address.', 'give'), |
|
364 | 364 | 'func' => 'give_email_tag_billing_address', |
365 | 365 | 'context' => 'donation', |
366 | 366 | ), |
367 | 367 | array( |
368 | 368 | 'tag' => 'date', |
369 | - 'desc' => esc_html__( 'The date of the donation.', 'give' ), |
|
369 | + 'desc' => esc_html__('The date of the donation.', 'give'), |
|
370 | 370 | 'func' => 'give_email_tag_date', |
371 | 371 | 'context' => 'donation', |
372 | 372 | ), |
373 | 373 | array( |
374 | 374 | 'tag' => 'payment_id', |
375 | - 'desc' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
375 | + 'desc' => esc_html__('The unique ID number for this donation.', 'give'), |
|
376 | 376 | 'func' => 'give_email_tag_payment_id', |
377 | 377 | 'context' => 'donation', |
378 | 378 | ), |
379 | 379 | array( |
380 | 380 | 'tag' => 'payment_method', |
381 | - 'desc' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
381 | + 'desc' => esc_html__('The method of payment used for this donation.', 'give'), |
|
382 | 382 | 'func' => 'give_email_tag_payment_method', |
383 | 383 | 'context' => 'donation', |
384 | 384 | ), |
385 | 385 | array( |
386 | 386 | 'tag' => 'payment_total', |
387 | - 'desc' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
387 | + 'desc' => esc_html__('The payment total for this donation.', 'give'), |
|
388 | 388 | 'func' => 'give_email_tag_payment_total', |
389 | 389 | 'context' => 'donation', |
390 | 390 | ), |
391 | 391 | array( |
392 | 392 | 'tag' => 'receipt_id', |
393 | - 'desc' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
393 | + 'desc' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
394 | 394 | 'func' => 'give_email_tag_receipt_id', |
395 | 395 | 'context' => 'donation', |
396 | 396 | ), |
397 | 397 | array( |
398 | 398 | 'tag' => 'receipt_link', |
399 | - 'desc' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
399 | + 'desc' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
400 | 400 | 'func' => 'give_email_tag_receipt_link', |
401 | 401 | 'context' => 'donation', |
402 | 402 | ), |
403 | 403 | array( |
404 | 404 | 'tag' => 'receipt_link_url', |
405 | - 'desc' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
405 | + 'desc' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
406 | 406 | 'func' => 'give_email_tag_receipt_link_url', |
407 | 407 | 'context' => 'donation', |
408 | 408 | ), |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | /* Donation Form */ |
411 | 411 | array( |
412 | 412 | 'tag' => 'form_title', |
413 | - 'desc' => esc_html__( 'The donation form name.', 'give' ), |
|
413 | + 'desc' => esc_html__('The donation form name.', 'give'), |
|
414 | 414 | 'func' => 'give_email_tag_form_title', |
415 | 415 | 'context' => 'form', |
416 | 416 | ), |
@@ -418,37 +418,37 @@ discard block |
||
418 | 418 | /* Donor */ |
419 | 419 | array( |
420 | 420 | 'tag' => 'name', |
421 | - 'desc' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
421 | + 'desc' => esc_html__('The donor\'s first name.', 'give'), |
|
422 | 422 | 'func' => 'give_email_tag_first_name', |
423 | 423 | 'context' => 'donor', |
424 | 424 | ), |
425 | 425 | array( |
426 | 426 | 'tag' => 'fullname', |
427 | - 'desc' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
427 | + 'desc' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
428 | 428 | 'func' => 'give_email_tag_fullname', |
429 | 429 | 'context' => 'donor', |
430 | 430 | ), |
431 | 431 | array( |
432 | 432 | 'tag' => 'username', |
433 | - 'desc' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
433 | + 'desc' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
434 | 434 | 'func' => 'give_email_tag_username', |
435 | 435 | 'context' => 'donor', |
436 | 436 | ), |
437 | 437 | array( |
438 | 438 | 'tag' => 'company_name', |
439 | - 'desc' => esc_html__( 'Company name.', 'give' ), |
|
439 | + 'desc' => esc_html__('Company name.', 'give'), |
|
440 | 440 | 'func' => 'give_email_tag_company_name', |
441 | 441 | 'context' => 'donation', |
442 | 442 | ), |
443 | 443 | array( |
444 | 444 | 'tag' => 'user_email', |
445 | - 'desc' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
445 | + 'desc' => esc_html__('The donor\'s email address.', 'give'), |
|
446 | 446 | 'func' => 'give_email_tag_user_email', |
447 | 447 | 'context' => 'donor', |
448 | 448 | ), |
449 | 449 | array( |
450 | 450 | 'tag' => 'email_access_link', |
451 | - 'desc' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
451 | + 'desc' => esc_html__('The donor\'s email access link.', 'give'), |
|
452 | 452 | 'func' => 'give_email_tag_email_access_link', |
453 | 453 | 'context' => 'donor', |
454 | 454 | ), |
@@ -456,35 +456,35 @@ discard block |
||
456 | 456 | /* General */ |
457 | 457 | array( |
458 | 458 | 'tag' => 'sitename', |
459 | - 'desc' => esc_html__( 'The name of your site.', 'give' ), |
|
459 | + 'desc' => esc_html__('The name of your site.', 'give'), |
|
460 | 460 | 'func' => 'give_email_tag_sitename', |
461 | 461 | 'context' => 'general', |
462 | 462 | ), |
463 | 463 | |
464 | 464 | array( |
465 | 465 | 'tag' => 'reset_password_link', |
466 | - 'desc' => esc_html__( 'The reset password link for user.', 'give' ), |
|
466 | + 'desc' => esc_html__('The reset password link for user.', 'give'), |
|
467 | 467 | 'func' => 'give_email_tag_reset_password_link', |
468 | 468 | 'context' => 'general', |
469 | 469 | ), |
470 | 470 | |
471 | 471 | array( |
472 | 472 | 'tag' => 'admin_email', |
473 | - 'desc' => esc_html__( 'The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give' ), |
|
473 | + 'desc' => esc_html__('The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give'), |
|
474 | 474 | 'func' => 'give_email_admin_email', |
475 | 475 | 'context' => 'general', |
476 | 476 | ), |
477 | 477 | |
478 | 478 | array( |
479 | 479 | 'tag' => 'site_url', |
480 | - 'desc' => esc_html__( 'The website URL.', 'give' ), |
|
480 | + 'desc' => esc_html__('The website URL.', 'give'), |
|
481 | 481 | 'func' => 'give_email_site_url', |
482 | 482 | 'context' => 'general', |
483 | 483 | ), |
484 | 484 | |
485 | 485 | array( |
486 | 486 | 'tag' => 'offline_mailing_address', |
487 | - 'desc' => esc_html__( 'The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give' ), |
|
487 | + 'desc' => esc_html__('The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give'), |
|
488 | 488 | 'func' => 'give_email_offline_mailing_address', |
489 | 489 | 'context' => 'general', |
490 | 490 | ), |
@@ -492,16 +492,16 @@ discard block |
||
492 | 492 | ); |
493 | 493 | |
494 | 494 | // Apply give_email_tags filter |
495 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
495 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
496 | 496 | |
497 | 497 | // Add email tags |
498 | - foreach ( $email_tags as $email_tag ) { |
|
499 | - give_add_email_tag( $email_tag ); |
|
498 | + foreach ($email_tags as $email_tag) { |
|
499 | + give_add_email_tag($email_tag); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | } |
503 | 503 | |
504 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
504 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
505 | 505 | |
506 | 506 | |
507 | 507 | /** |
@@ -513,24 +513,24 @@ discard block |
||
513 | 513 | * |
514 | 514 | * @return string $firstname |
515 | 515 | */ |
516 | -function give_email_tag_first_name( $tag_args ) { |
|
516 | +function give_email_tag_first_name($tag_args) { |
|
517 | 517 | $user_info = array(); |
518 | 518 | $firstname = ''; |
519 | 519 | |
520 | 520 | // Backward compatibility. |
521 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
521 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
522 | 522 | |
523 | - switch ( true ) { |
|
524 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
525 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
526 | - $email_names = give_get_email_names( $donor_info ); |
|
523 | + switch (true) { |
|
524 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
525 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
526 | + $email_names = give_get_email_names($donor_info); |
|
527 | 527 | $firstname = $email_names['name']; |
528 | 528 | |
529 | 529 | break; |
530 | 530 | |
531 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
531 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
532 | 532 | $firstname = Give()->donor_meta->get_meta( |
533 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
533 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
534 | 534 | '_give_donor_first_name', |
535 | 535 | true |
536 | 536 | ); |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @since 2.0 |
543 | 543 | */ |
544 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
545 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
544 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
545 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
546 | 546 | break; |
547 | 547 | } |
548 | 548 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @param string $firstname |
555 | 555 | * @param array $tag_args |
556 | 556 | */ |
557 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
557 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
558 | 558 | |
559 | 559 | return $firstname; |
560 | 560 | } |
@@ -568,21 +568,21 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return string $fullname |
570 | 570 | */ |
571 | -function give_email_tag_fullname( $tag_args ) { |
|
571 | +function give_email_tag_fullname($tag_args) { |
|
572 | 572 | $fullname = ''; |
573 | 573 | |
574 | 574 | // Backward compatibility. |
575 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
575 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
576 | 576 | |
577 | - switch ( true ) { |
|
578 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
579 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
580 | - $email_names = give_get_email_names( $donor_info ); |
|
577 | + switch (true) { |
|
578 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
579 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
580 | + $email_names = give_get_email_names($donor_info); |
|
581 | 581 | $fullname = $email_names['fullname']; |
582 | 582 | break; |
583 | 583 | |
584 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
585 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
584 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
585 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | /** |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @since 2.0 |
592 | 592 | */ |
593 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
594 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
593 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
594 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
595 | 595 | break; |
596 | 596 | } |
597 | 597 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | * @param string $fullname |
604 | 604 | * @param array $tag_args |
605 | 605 | */ |
606 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
606 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
607 | 607 | |
608 | 608 | return $fullname; |
609 | 609 | } |
@@ -617,21 +617,21 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @return string username. |
619 | 619 | */ |
620 | -function give_email_tag_username( $tag_args ) { |
|
620 | +function give_email_tag_username($tag_args) { |
|
621 | 621 | $username = ''; |
622 | 622 | |
623 | 623 | // Backward compatibility. |
624 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
624 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
625 | 625 | |
626 | - switch ( true ) { |
|
627 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
628 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
629 | - $email_names = give_get_email_names( $donor_info ); |
|
626 | + switch (true) { |
|
627 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
628 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
629 | + $email_names = give_get_email_names($donor_info); |
|
630 | 630 | $username = $email_names['username']; |
631 | 631 | break; |
632 | 632 | |
633 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
634 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
633 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
634 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
635 | 635 | $username = $user_info->user_login; |
636 | 636 | break; |
637 | 637 | |
@@ -640,9 +640,9 @@ discard block |
||
640 | 640 | * |
641 | 641 | * @since 2.0 |
642 | 642 | */ |
643 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
644 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
645 | - $user_info = get_user_by( 'id', $user_id ); |
|
643 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
644 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
645 | + $user_info = get_user_by('id', $user_id); |
|
646 | 646 | $username = $user_info->user_login; |
647 | 647 | } |
648 | 648 | break; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * @param string $username |
657 | 657 | * @param array $tag_args |
658 | 658 | */ |
659 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
659 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
660 | 660 | |
661 | 661 | return $username; |
662 | 662 | } |
@@ -670,19 +670,19 @@ discard block |
||
670 | 670 | * |
671 | 671 | * @return string user_email |
672 | 672 | */ |
673 | -function give_email_tag_user_email( $tag_args ) { |
|
673 | +function give_email_tag_user_email($tag_args) { |
|
674 | 674 | $email = ''; |
675 | 675 | |
676 | 676 | // Backward compatibility. |
677 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
677 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
678 | 678 | |
679 | - switch ( true ) { |
|
680 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
681 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
679 | + switch (true) { |
|
680 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
681 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
682 | 682 | break; |
683 | 683 | |
684 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
685 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
684 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
685 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
686 | 686 | $email = $user_info->user_email; |
687 | 687 | break; |
688 | 688 | |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | * |
692 | 692 | * @since 2.0 |
693 | 693 | */ |
694 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
695 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
694 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
695 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
696 | 696 | break; |
697 | 697 | } |
698 | 698 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param string $email |
705 | 705 | * @param array $tag_args |
706 | 706 | */ |
707 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
707 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
708 | 708 | |
709 | 709 | return $email; |
710 | 710 | } |
@@ -718,22 +718,22 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string billing_address |
720 | 720 | */ |
721 | -function give_email_tag_billing_address( $tag_args ) { |
|
721 | +function give_email_tag_billing_address($tag_args) { |
|
722 | 722 | $address = ''; |
723 | 723 | |
724 | 724 | // Backward compatibility. |
725 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
725 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
726 | 726 | |
727 | - switch ( true ) { |
|
728 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
729 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
727 | + switch (true) { |
|
728 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
729 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
730 | 730 | |
731 | 731 | $billing_address = array(); |
732 | 732 | $billing_address['street_address'] = ''; |
733 | 733 | $billing_address['street_address'] .= $donation_address['line1']; |
734 | 734 | |
735 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
736 | - $billing_address['street_address'] .= "\n" . $donation_address['line2']; |
|
735 | + if ( ! empty($donation_address['line2'])) { |
|
736 | + $billing_address['street_address'] .= "\n".$donation_address['line2']; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | $billing_address['city'] = $donation_address['city']; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $billing_address['postal_code'] = $donation_address['zip']; |
742 | 742 | $billing_address['country'] = $donation_address['country']; |
743 | 743 | |
744 | - $address = give_get_formatted_address( $billing_address ); |
|
744 | + $address = give_get_formatted_address($billing_address); |
|
745 | 745 | |
746 | 746 | break; |
747 | 747 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * @param string $address |
755 | 755 | * @param array $tag_args |
756 | 756 | */ |
757 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
757 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
758 | 758 | |
759 | 759 | return $address; |
760 | 760 | } |
@@ -768,15 +768,15 @@ discard block |
||
768 | 768 | * |
769 | 769 | * @return string $date Post Date. |
770 | 770 | */ |
771 | -function give_email_tag_date( $tag_args ) { |
|
771 | +function give_email_tag_date($tag_args) { |
|
772 | 772 | $date = ''; |
773 | 773 | |
774 | 774 | // Backward compatibility. |
775 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
775 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
776 | 776 | |
777 | - switch ( true ) { |
|
778 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
779 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
777 | + switch (true) { |
|
778 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
779 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
780 | 780 | break; |
781 | 781 | } |
782 | 782 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * @param string $date |
789 | 789 | * @param array $tag_args |
790 | 790 | */ |
791 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
791 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
792 | 792 | |
793 | 793 | return $date; |
794 | 794 | } |
@@ -802,16 +802,16 @@ discard block |
||
802 | 802 | * |
803 | 803 | * @return string amount |
804 | 804 | */ |
805 | -function give_email_tag_amount( $tag_args ) { |
|
805 | +function give_email_tag_amount($tag_args) { |
|
806 | 806 | $amount = ''; |
807 | 807 | |
808 | 808 | // Backward compatibility. |
809 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
809 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
810 | 810 | |
811 | - switch ( true ) { |
|
812 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
813 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
814 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
811 | + switch (true) { |
|
812 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
813 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
814 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
815 | 815 | break; |
816 | 816 | } |
817 | 817 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | * @param string $amount |
824 | 824 | * @param array $tag_args |
825 | 825 | */ |
826 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
826 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
827 | 827 | |
828 | 828 | return $amount; |
829 | 829 | } |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @return string price |
839 | 839 | */ |
840 | -function give_email_tag_price( $tag_args ) { |
|
841 | - return give_email_tag_amount( $tag_args ); |
|
840 | +function give_email_tag_price($tag_args) { |
|
841 | + return give_email_tag_amount($tag_args); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | /** |
@@ -850,15 +850,15 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @return int payment_id |
852 | 852 | */ |
853 | -function give_email_tag_payment_id( $tag_args ) { |
|
853 | +function give_email_tag_payment_id($tag_args) { |
|
854 | 854 | $payment_id = ''; |
855 | 855 | |
856 | 856 | // Backward compatibility. |
857 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
857 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
858 | 858 | |
859 | - switch ( true ) { |
|
860 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
861 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
859 | + switch (true) { |
|
860 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
861 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
862 | 862 | break; |
863 | 863 | } |
864 | 864 | |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | * @param string $payment_id |
871 | 871 | * @param array $tag_args |
872 | 872 | */ |
873 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
873 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | /** |
@@ -882,15 +882,15 @@ discard block |
||
882 | 882 | * |
883 | 883 | * @return string receipt_id |
884 | 884 | */ |
885 | -function give_email_tag_receipt_id( $tag_args ) { |
|
885 | +function give_email_tag_receipt_id($tag_args) { |
|
886 | 886 | $receipt_id = ''; |
887 | 887 | |
888 | 888 | // Backward compatibility. |
889 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
889 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
890 | 890 | |
891 | - switch ( true ) { |
|
892 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
893 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
891 | + switch (true) { |
|
892 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
893 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
894 | 894 | break; |
895 | 895 | } |
896 | 896 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | * @param string $receipt_id |
903 | 903 | * @param array $tag_args |
904 | 904 | */ |
905 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
905 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | /** |
@@ -914,21 +914,21 @@ discard block |
||
914 | 914 | * |
915 | 915 | * @return string $form_title |
916 | 916 | */ |
917 | -function give_email_tag_donation( $tag_args ) { |
|
917 | +function give_email_tag_donation($tag_args) { |
|
918 | 918 | $donation_form_title = ''; |
919 | 919 | |
920 | 920 | // Backward compatibility. |
921 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
921 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
922 | 922 | |
923 | - switch ( true ) { |
|
924 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
925 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
923 | + switch (true) { |
|
924 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
925 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
926 | 926 | $separator = $level_title ? '-' : ''; |
927 | 927 | $donation_form_title = strip_tags( |
928 | 928 | give_check_variable( |
929 | 929 | give_get_donation_form_title( |
930 | 930 | $tag_args['payment_id'], |
931 | - array( 'separator' => $separator ) |
|
931 | + array('separator' => $separator) |
|
932 | 932 | ), |
933 | 933 | 'empty', |
934 | 934 | '' |
@@ -961,15 +961,15 @@ discard block |
||
961 | 961 | * |
962 | 962 | * @return string $form_title |
963 | 963 | */ |
964 | -function give_email_tag_form_title( $tag_args ) { |
|
964 | +function give_email_tag_form_title($tag_args) { |
|
965 | 965 | $donation_form_title = ''; |
966 | 966 | |
967 | 967 | // Backward compatibility. |
968 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
968 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
969 | 969 | |
970 | - switch ( true ) { |
|
971 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
972 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
970 | + switch (true) { |
|
971 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
972 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
973 | 973 | break; |
974 | 974 | } |
975 | 975 | |
@@ -998,15 +998,15 @@ discard block |
||
998 | 998 | * |
999 | 999 | * @return string $company_name |
1000 | 1000 | */ |
1001 | -function give_email_tag_company_name( $tag_args ) { |
|
1001 | +function give_email_tag_company_name($tag_args) { |
|
1002 | 1002 | $company_name = ''; |
1003 | 1003 | |
1004 | 1004 | // Backward compatibility. |
1005 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1005 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1006 | 1006 | |
1007 | - switch ( true ) { |
|
1008 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1009 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
1007 | + switch (true) { |
|
1008 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1009 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
1010 | 1010 | break; |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1034,18 +1034,18 @@ discard block |
||
1034 | 1034 | * |
1035 | 1035 | * @return string gateway |
1036 | 1036 | */ |
1037 | -function give_email_tag_payment_method( $tag_args ) { |
|
1037 | +function give_email_tag_payment_method($tag_args) { |
|
1038 | 1038 | $payment_method = ''; |
1039 | 1039 | |
1040 | 1040 | // Backward compatibility. |
1041 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1041 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1042 | 1042 | |
1043 | 1043 | // Backward compatibility. |
1044 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1044 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1045 | 1045 | |
1046 | - switch ( true ) { |
|
1047 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1048 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
1046 | + switch (true) { |
|
1047 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1048 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
1049 | 1049 | break; |
1050 | 1050 | } |
1051 | 1051 | |
@@ -1076,15 +1076,15 @@ discard block |
||
1076 | 1076 | * |
1077 | 1077 | * @return string |
1078 | 1078 | */ |
1079 | -function give_email_tag_payment_total( $tag_args ) { |
|
1079 | +function give_email_tag_payment_total($tag_args) { |
|
1080 | 1080 | $payment_total = ''; |
1081 | 1081 | |
1082 | 1082 | // Backward compatibility. |
1083 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1083 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1084 | 1084 | |
1085 | - switch ( true ) { |
|
1086 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1087 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1085 | + switch (true) { |
|
1086 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1087 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1088 | 1088 | break; |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1112,11 +1112,11 @@ discard block |
||
1112 | 1112 | * |
1113 | 1113 | * @return string |
1114 | 1114 | */ |
1115 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1116 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1115 | +function give_email_tag_sitename($tag_args = array()) { |
|
1116 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1117 | 1117 | |
1118 | 1118 | // Backward compatibility. |
1119 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1119 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1120 | 1120 | |
1121 | 1121 | /** |
1122 | 1122 | * Filter the {sitename} email template tag output. |
@@ -1142,21 +1142,21 @@ discard block |
||
1142 | 1142 | * |
1143 | 1143 | * @return string receipt_link |
1144 | 1144 | */ |
1145 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1145 | +function give_email_tag_receipt_link($tag_args) { |
|
1146 | 1146 | // Backward compatibility. |
1147 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1147 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1148 | 1148 | |
1149 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1149 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1150 | 1150 | |
1151 | 1151 | // Bailout. |
1152 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1152 | + if (give_get_option('email_template') === 'none') { |
|
1153 | 1153 | return $receipt_url; |
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | $receipt_url = esc_url( |
1157 | 1157 | add_query_arg( |
1158 | 1158 | array( |
1159 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1159 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1160 | 1160 | ), give_get_history_page_uri() |
1161 | 1161 | ) |
1162 | 1162 | ); |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $formatted = sprintf( |
1165 | 1165 | '<a href="%1$s">%2$s</a>', |
1166 | 1166 | $receipt_url, |
1167 | - __( 'View it in your browser »', 'give' ) |
|
1167 | + __('View it in your browser »', 'give') |
|
1168 | 1168 | ); |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1193,11 +1193,11 @@ discard block |
||
1193 | 1193 | * |
1194 | 1194 | * @return string receipt_url |
1195 | 1195 | */ |
1196 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1196 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1197 | 1197 | // Backward compatibility. |
1198 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1198 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1199 | 1199 | |
1200 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1200 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * Filter the {receipt_link_url} email template tag output. |
@@ -1224,14 +1224,14 @@ discard block |
||
1224 | 1224 | * |
1225 | 1225 | * @return string |
1226 | 1226 | */ |
1227 | -function give_get_receipt_url( $payment_id ) { |
|
1227 | +function give_get_receipt_url($payment_id) { |
|
1228 | 1228 | $receipt_url = ''; |
1229 | 1229 | |
1230 | - if ( $payment_id ) { |
|
1230 | + if ($payment_id) { |
|
1231 | 1231 | $receipt_url = esc_url( |
1232 | 1232 | add_query_arg( |
1233 | 1233 | array( |
1234 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1234 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1235 | 1235 | ), give_get_history_page_uri() |
1236 | 1236 | ) |
1237 | 1237 | ); |
@@ -1250,22 +1250,22 @@ discard block |
||
1250 | 1250 | * |
1251 | 1251 | * @return string |
1252 | 1252 | */ |
1253 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1253 | +function give_email_tag_email_access_link($tag_args) { |
|
1254 | 1254 | $donor_id = 0; |
1255 | 1255 | $donor = array(); |
1256 | 1256 | $email_access_link = ''; |
1257 | 1257 | |
1258 | 1258 | // Backward compatibility. |
1259 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1259 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1260 | 1260 | |
1261 | - switch ( true ) { |
|
1262 | - case ! empty( $tag_args['donor_id'] ): |
|
1261 | + switch (true) { |
|
1262 | + case ! empty($tag_args['donor_id']): |
|
1263 | 1263 | $donor_id = $tag_args['donor_id']; |
1264 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1264 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1265 | 1265 | break; |
1266 | 1266 | |
1267 | - case ! empty( $tag_args['user_id'] ): |
|
1268 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1267 | + case ! empty($tag_args['user_id']): |
|
1268 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1269 | 1269 | $donor_id = $donor->id; |
1270 | 1270 | break; |
1271 | 1271 | |
@@ -1274,11 +1274,11 @@ discard block |
||
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | // Set email access link if donor exist. |
1277 | - if ( $donor_id ) { |
|
1278 | - $verify_key = wp_generate_password( 20, false ); |
|
1277 | + if ($donor_id) { |
|
1278 | + $verify_key = wp_generate_password(20, false); |
|
1279 | 1279 | |
1280 | 1280 | // Generate a new verify key |
1281 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1281 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1282 | 1282 | // update verify key in email tags. |
1283 | 1283 | $tag_args['verify_key'] = $verify_key; |
1284 | 1284 | |
@@ -1293,28 +1293,28 @@ discard block |
||
1293 | 1293 | ); |
1294 | 1294 | |
1295 | 1295 | // Add Payment Key to email access url, if it exists. |
1296 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1296 | + if ( ! empty($_GET['payment_key'])) { |
|
1297 | 1297 | $access_url = add_query_arg( |
1298 | 1298 | array( |
1299 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1299 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1300 | 1300 | ), |
1301 | 1301 | $access_url |
1302 | 1302 | ); |
1303 | 1303 | } |
1304 | 1304 | |
1305 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1305 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1306 | 1306 | $email_access_link = sprintf( |
1307 | 1307 | '<a href="%1$s" target="_blank">%2$s</a>', |
1308 | - esc_url( $access_url ), |
|
1309 | - __( 'View your donation history »', 'give' ) |
|
1308 | + esc_url($access_url), |
|
1309 | + __('View your donation history »', 'give') |
|
1310 | 1310 | ); |
1311 | 1311 | |
1312 | 1312 | } else { |
1313 | 1313 | |
1314 | 1314 | $email_access_link = sprintf( |
1315 | 1315 | '%1$s: %2$s', |
1316 | - __( 'View your donation history', 'give' ), |
|
1317 | - esc_url( $access_url ) |
|
1316 | + __('View your donation history', 'give'), |
|
1317 | + esc_url($access_url) |
|
1318 | 1318 | ); |
1319 | 1319 | } |
1320 | 1320 | } |
@@ -1346,23 +1346,23 @@ discard block |
||
1346 | 1346 | * |
1347 | 1347 | * @return array |
1348 | 1348 | */ |
1349 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1350 | - if ( ! is_array( $tag_args ) ) { |
|
1351 | - switch ( true ) { |
|
1352 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1353 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1349 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1350 | + if ( ! is_array($tag_args)) { |
|
1351 | + switch (true) { |
|
1352 | + case ('give_payment' === get_post_type($tag_args)): |
|
1353 | + $tag_args = array('payment_id' => $tag_args); |
|
1354 | 1354 | break; |
1355 | 1355 | |
1356 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1357 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1356 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1357 | + $tag_args = array('user_id' => $tag_args); |
|
1358 | 1358 | break; |
1359 | 1359 | |
1360 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1361 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1360 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1361 | + $tag_args = array('donor_id' => $tag_args); |
|
1362 | 1362 | break; |
1363 | 1363 | |
1364 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1365 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1364 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1365 | + $tag_args = array('user_id' => $tag_args); |
|
1366 | 1366 | break; |
1367 | 1367 | } |
1368 | 1368 | } |
@@ -1380,29 +1380,29 @@ discard block |
||
1380 | 1380 | * |
1381 | 1381 | * @since 2.2.1 |
1382 | 1382 | */ |
1383 | -function __give_211_bc_email_template_tag_param( &$args, $func_args = array() ) { |
|
1383 | +function __give_211_bc_email_template_tag_param(&$args, $func_args = array()) { |
|
1384 | 1384 | |
1385 | 1385 | /** |
1386 | 1386 | * This is for backward-compatibility, i.e.; if the parameters are |
1387 | 1387 | * still passed as 4 separate arguments instead of 1 single array. |
1388 | 1388 | */ |
1389 | - if ( ! is_array( $args ) ) { |
|
1389 | + if ( ! is_array($args)) { |
|
1390 | 1390 | $args = array( |
1391 | - 'tag' => isset( $func_args[0] ) ? $func_args[0] : '', |
|
1392 | - 'desc' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1393 | - 'func' => isset( $func_args[2] ) ? $func_args[2] : '', |
|
1394 | - 'context' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1391 | + 'tag' => isset($func_args[0]) ? $func_args[0] : '', |
|
1392 | + 'desc' => isset($func_args[1]) ? $func_args[1] : '', |
|
1393 | + 'func' => isset($func_args[2]) ? $func_args[2] : '', |
|
1394 | + 'context' => isset($func_args[3]) ? $func_args[3] : '', |
|
1395 | 1395 | 'is_admin' => false, |
1396 | 1396 | ); |
1397 | 1397 | } else { |
1398 | 1398 | |
1399 | 1399 | // This is for backward compatibility. Use 'desc' instead of 'description'. |
1400 | - if ( array_key_exists( 'description', $args ) ) { |
|
1400 | + if (array_key_exists('description', $args)) { |
|
1401 | 1401 | $args['desc'] = $args['description']; |
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | // This is for backward compatibility. Use 'func' instead of 'function'. |
1405 | - if ( array_key_exists( 'function', $args ) ) { |
|
1405 | + if (array_key_exists('function', $args)) { |
|
1406 | 1406 | $args['func'] = $args['function']; |
1407 | 1407 | } |
1408 | 1408 | |
@@ -1429,36 +1429,36 @@ discard block |
||
1429 | 1429 | * |
1430 | 1430 | * @return array |
1431 | 1431 | */ |
1432 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1432 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1433 | 1433 | |
1434 | 1434 | $reset_password_url = ''; |
1435 | 1435 | |
1436 | - switch ( true ) { |
|
1437 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1438 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1436 | + switch (true) { |
|
1437 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1438 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1439 | 1439 | break; |
1440 | 1440 | |
1441 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1442 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1441 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1442 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1443 | 1443 | break; |
1444 | 1444 | |
1445 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1446 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1445 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1446 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1447 | 1447 | break; |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1450 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1451 | 1451 | // Generate link, if Email content type is html. |
1452 | 1452 | $reset_password_link = sprintf( |
1453 | 1453 | '<a href="%1$s" target="_blank">%2$s</a>', |
1454 | - esc_url( $reset_password_url ), |
|
1455 | - __( 'Reset your password »', 'give' ) |
|
1454 | + esc_url($reset_password_url), |
|
1455 | + __('Reset your password »', 'give') |
|
1456 | 1456 | ); |
1457 | 1457 | } else { |
1458 | 1458 | $reset_password_link = sprintf( |
1459 | 1459 | '%1$s: %2$s', |
1460 | - __( 'Reset your password', 'give' ), |
|
1461 | - esc_url( $reset_password_url ) |
|
1460 | + __('Reset your password', 'give'), |
|
1461 | + esc_url($reset_password_url) |
|
1462 | 1462 | ); |
1463 | 1463 | } |
1464 | 1464 | |
@@ -1487,21 +1487,21 @@ discard block |
||
1487 | 1487 | * |
1488 | 1488 | * @return mixed|string |
1489 | 1489 | */ |
1490 | -function give_get_reset_password_url( $user_id ) { |
|
1490 | +function give_get_reset_password_url($user_id) { |
|
1491 | 1491 | $reset_password_url = ''; |
1492 | 1492 | |
1493 | 1493 | // Proceed further only, if user_id exists. |
1494 | - if ( $user_id ) { |
|
1494 | + if ($user_id) { |
|
1495 | 1495 | |
1496 | 1496 | // Get User Object Details. |
1497 | - $user = get_user_by( 'ID', $user_id ); |
|
1497 | + $user = get_user_by('ID', $user_id); |
|
1498 | 1498 | |
1499 | 1499 | // Prepare Reset Password URL. |
1500 | 1500 | $reset_password_url = esc_url( |
1501 | 1501 | add_query_arg( |
1502 | 1502 | array( |
1503 | 1503 | 'action' => 'rp', |
1504 | - 'key' => get_password_reset_key( $user ), |
|
1504 | + 'key' => get_password_reset_key($user), |
|
1505 | 1505 | 'login' => $user->user_login, |
1506 | 1506 | ), wp_login_url() |
1507 | 1507 | ) |
@@ -1520,15 +1520,15 @@ discard block |
||
1520 | 1520 | */ |
1521 | 1521 | function give_email_admin_email() { |
1522 | 1522 | |
1523 | - $admin_email = give_get_option( 'contact_admin_email' ); |
|
1523 | + $admin_email = give_get_option('contact_admin_email'); |
|
1524 | 1524 | |
1525 | - if ( empty( $admin_email ) ) { |
|
1526 | - give_delete_option( 'contact_admin_email' ); |
|
1525 | + if (empty($admin_email)) { |
|
1526 | + give_delete_option('contact_admin_email'); |
|
1527 | 1527 | } |
1528 | 1528 | |
1529 | - return ( ! empty( $admin_email ) ) |
|
1529 | + return ( ! empty($admin_email)) |
|
1530 | 1530 | ? $admin_email |
1531 | - : get_bloginfo( 'admin_email' ); |
|
1531 | + : get_bloginfo('admin_email'); |
|
1532 | 1532 | } |
1533 | 1533 | |
1534 | 1534 | /** |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | * @return string |
1540 | 1540 | */ |
1541 | 1541 | function give_email_site_url() { |
1542 | - return get_bloginfo( 'url' ); |
|
1542 | + return get_bloginfo('url'); |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | |
@@ -1551,10 +1551,10 @@ discard block |
||
1551 | 1551 | * @return string |
1552 | 1552 | */ |
1553 | 1553 | function give_email_offline_mailing_address() { |
1554 | - $offline_address = give_get_option( 'contact_offline_mailing_address' ); |
|
1554 | + $offline_address = give_get_option('contact_offline_mailing_address'); |
|
1555 | 1555 | |
1556 | - if ( false === $offline_address ) { |
|
1557 | - return sprintf( ' <em>%s</em></em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', get_bloginfo( 'sitename' ) ); |
|
1556 | + if (false === $offline_address) { |
|
1557 | + return sprintf(' <em>%s</em></em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', get_bloginfo('sitename')); |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | return $offline_address; |
@@ -1572,97 +1572,97 @@ discard block |
||
1572 | 1572 | * |
1573 | 1573 | * @return mixed |
1574 | 1574 | */ |
1575 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1576 | - preg_match_all( '/{meta_([A-z0-9\-\_\ ]+)}/s', $content, $matches ); |
|
1575 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1576 | + preg_match_all('/{meta_([A-z0-9\-\_\ ]+)}/s', $content, $matches); |
|
1577 | 1577 | |
1578 | - if ( ! empty( $matches[0] ) ) { |
|
1578 | + if ( ! empty($matches[0])) { |
|
1579 | 1579 | $search = $replace = array(); |
1580 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1581 | - if ( in_array( $meta_tag, $search ) ) { |
|
1580 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1581 | + if (in_array($meta_tag, $search)) { |
|
1582 | 1582 | continue; |
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | $search[] = $meta_tag; |
1586 | 1586 | |
1587 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1588 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1589 | - $meta_tag = current( $meta_tag_arr ); |
|
1587 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1588 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1589 | + $meta_tag = current($meta_tag_arr); |
|
1590 | 1590 | |
1591 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1592 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1593 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1591 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1592 | + $type = current(explode('_', $meta_tag, 2)); |
|
1593 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1594 | 1594 | |
1595 | - switch ( $type ) { |
|
1595 | + switch ($type) { |
|
1596 | 1596 | case 'donation': |
1597 | 1597 | // Bailout. |
1598 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1598 | + if ( ! isset($tag_args['payment_id'])) { |
|
1599 | 1599 | $replace[] = ''; |
1600 | 1600 | continue; |
1601 | 1601 | } |
1602 | 1602 | |
1603 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1603 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1604 | 1604 | |
1605 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1605 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1606 | 1606 | $replace[] = $meta_data; |
1607 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1608 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1607 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1608 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | break; |
1612 | 1612 | |
1613 | 1613 | case 'form': |
1614 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1614 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1615 | 1615 | |
1616 | 1616 | // Bailout. |
1617 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1618 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1617 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1618 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1622 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1621 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1622 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1623 | 1623 | $replace[] = $meta_data; |
1624 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1625 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1624 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1625 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1626 | 1626 | } |
1627 | 1627 | break; |
1628 | 1628 | |
1629 | 1629 | case 'donor': |
1630 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1630 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1631 | 1631 | |
1632 | 1632 | // Bailout. |
1633 | - if ( ! $donor_id ) { |
|
1634 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1635 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1636 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1637 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1633 | + if ( ! $donor_id) { |
|
1634 | + if (isset($tag_args['payment_id'])) { |
|
1635 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1636 | + } elseif (isset($tag_args['user_id'])) { |
|
1637 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1638 | 1638 | } |
1639 | 1639 | } |
1640 | 1640 | |
1641 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1641 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1642 | 1642 | |
1643 | - if ( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1644 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1643 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1644 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1647 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1648 | 1648 | $replace[] = $meta_data; |
1649 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1650 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1649 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1650 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1651 | 1651 | } |
1652 | 1652 | |
1653 | 1653 | break; |
1654 | 1654 | |
1655 | 1655 | default: |
1656 | - $replace[] = end( $search ); |
|
1656 | + $replace[] = end($search); |
|
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | |
1660 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1661 | - $content = str_replace( $search, $replace, $content ); |
|
1660 | + if ( ! empty($search) && ! empty($replace)) { |
|
1661 | + $content = str_replace($search, $replace, $content); |
|
1662 | 1662 | } |
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | return $content; |
1666 | 1666 | } |
1667 | 1667 | |
1668 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1668 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2); |