@@ -6,7 +6,7 @@ |
||
6 | 6 | * @version 1.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
9 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly. |
|
10 | 10 | |
11 | 11 | // This is the footer used if no others are available |
12 | 12 |
@@ -6,7 +6,10 @@ |
||
6 | 6 | * @version 1.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
10 | + exit; |
|
11 | +} |
|
12 | +// Exit if accessed directly. |
|
10 | 13 | |
11 | 14 | // This is the footer used if no others are available |
12 | 15 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param array $args An array of form arguments. |
23 | 23 | * |
24 | - * @return string Donation form. |
|
24 | + * @return false|null Donation form. |
|
25 | 25 | */ |
26 | 26 | function give_get_donation_form( $args = array() ) { |
27 | 27 | |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | * |
1489 | 1489 | * @param int $form_id The form ID. |
1490 | 1490 | * |
1491 | - * @return bool |
|
1491 | + * @return false|null |
|
1492 | 1492 | */ |
1493 | 1493 | function give_terms_agreement( $form_id ) { |
1494 | 1494 | $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | * @param int $form_id The form ID. |
1667 | 1667 | * @param array $args An array of form arguments. |
1668 | 1668 | * |
1669 | - * @return mixed |
|
1669 | + * @return boolean |
|
1670 | 1670 | */ |
1671 | 1671 | function give_show_goal_progress( $form_id, $args ) { |
1672 | 1672 | |
@@ -1686,7 +1686,7 @@ discard block |
||
1686 | 1686 | * |
1687 | 1687 | * @since 1.8 |
1688 | 1688 | * |
1689 | - * @param $form_id |
|
1689 | + * @param integer $form_id |
|
1690 | 1690 | * @param $args |
1691 | 1691 | * |
1692 | 1692 | * @return mixed|string |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | * @param int $form_id The form ID. |
1728 | 1728 | * @param array $args An array of form arguments. |
1729 | 1729 | * |
1730 | - * @return void|bool |
|
1730 | + * @return false|null |
|
1731 | 1731 | */ |
1732 | 1732 | function give_form_content( $form_id, $args ) { |
1733 | 1733 |
@@ -343,7 +343,7 @@ |
||
343 | 343 | ?> |
344 | 344 | </div> |
345 | 345 | <?php |
346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
346 | + elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
347 | 347 | ?> |
348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
349 | 349 | <?php |
@@ -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,50 +23,50 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id, |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID. |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | 55 | ); |
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
58 | 58 | if ( |
59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
60 | - || ( 'trash' === $form->post_status ) |
|
59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
60 | + || ('trash' === $form->post_status) |
|
61 | 61 | ) { |
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
65 | 65 | //Get the form wrap CSS classes. |
66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
67 | 67 | |
68 | 68 | //Get the <form> tag wrap CSS classes. |
69 | - $form_classes = $form->get_form_classes( $args ); |
|
69 | + $form_classes = $form->get_form_classes($args); |
|
70 | 70 | |
71 | 71 | ob_start(); |
72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * @param int $form_id The form ID. |
79 | 79 | * @param array $args An array of form arguments. |
80 | 80 | */ |
81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
82 | 82 | |
83 | 83 | ?> |
84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
85 | 85 | |
86 | - <?php if ( $form->is_close_donation_form() ) { |
|
86 | + <?php if ($form->is_close_donation_form()) { |
|
87 | 87 | |
88 | 88 | // Get Goal thank you message. |
89 | - $goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
89 | + $goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
91 | 91 | |
92 | 92 | // Print thank you message. |
93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
94 | 94 | |
95 | 95 | } else { |
96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * 1. if show_title params set to true |
99 | 99 | * 2. if admin set form display_style to button |
100 | 100 | */ |
101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
102 | 102 | if ( |
103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
104 | - && ! doing_action( 'give_single_form_summary' ) |
|
103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
104 | + && ! doing_action('give_single_form_summary') |
|
105 | 105 | ) { |
106 | 106 | echo $form_title; |
107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
114 | 114 | * @param int $form_id The form ID. |
115 | 115 | * @param array $args An array of form arguments. |
116 | 116 | */ |
117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
117 | + do_action('give_pre_form', $form->ID, $args); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
124 | 124 | <input type="hidden" name="give-current-url" |
125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
126 | 126 | <input type="hidden" name="give-form-url" |
127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
128 | 128 | <input type="hidden" name="give-form-minimum" |
129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ), array( 'sanitize' => false ) ); ?>"/> |
|
129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID), array('sanitize' => false)); ?>"/> |
|
130 | 130 | |
131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | <?php |
139 | 139 | |
140 | 140 | // Price ID hidden field for variable (multi-level) donation forms. |
141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
141 | + if (give_has_variable_prices($form_id)) { |
|
142 | 142 | // Get default selected price ID. |
143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
144 | 144 | $price_id = 0; |
145 | 145 | //loop through prices. |
146 | - foreach ( $prices as $price ) { |
|
147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
146 | + foreach ($prices as $price) { |
|
147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
148 | 148 | $price_id = $price['_give_id']['level_id']; |
149 | 149 | }; |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param int $form_id The form ID. |
161 | 161 | * @param array $args An array of form arguments. |
162 | 162 | */ |
163 | - do_action( 'give_donation_form_top', $form->ID, $args ); |
|
163 | + do_action('give_donation_form_top', $form->ID, $args); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Fires while outputting donation form, for payment gateway fields. |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param int $form_id The form ID. |
171 | 171 | * @param array $args An array of form arguments. |
172 | 172 | */ |
173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Fires while outputting donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param int $form_id The form ID. |
181 | 181 | * @param array $args An array of form arguments. |
182 | 182 | */ |
183 | - do_action( 'give_donation_form_bottom', $form->ID, $args ); |
|
183 | + do_action('give_donation_form_bottom', $form->ID, $args); |
|
184 | 184 | |
185 | 185 | ?> |
186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * @param int $form_id The form ID. |
195 | 195 | * @param array $args An array of form arguments. |
196 | 196 | */ |
197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
197 | + do_action('give_post_form', $form->ID, $args); |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | |
202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
203 | 203 | <?php |
204 | 204 | |
205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * @param int $form_id The form ID. |
211 | 211 | * @param array $args An array of form arguments. |
212 | 212 | */ |
213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
213 | + do_action('give_post_form_output', $form->ID, $args); |
|
214 | 214 | |
215 | 215 | $final_output = ob_get_clean(); |
216 | 216 | |
217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return string |
233 | 233 | */ |
234 | -function give_show_purchase_form( $form_id ) { |
|
234 | +function give_show_purchase_form($form_id) { |
|
235 | 235 | |
236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
237 | 237 | |
238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
239 | 239 | $form_id = $_POST['give_form_id']; |
240 | 240 | } |
241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @since 1.7 |
246 | 246 | */ |
247 | - do_action( 'give_payment_fields_top', $form_id ); |
|
247 | + do_action('give_payment_fields_top', $form_id); |
|
248 | 248 | |
249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
249 | + if (give_can_checkout() && isset($form_id)) { |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Fires while displaying donation form, before registration login. |
253 | 253 | * |
254 | 254 | * @since 1.7 |
255 | 255 | */ |
256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Fire when register/login form fields render. |
260 | 260 | * |
261 | 261 | * @since 1.7 |
262 | 262 | */ |
263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Fire when credit card form fields render. |
267 | 267 | * |
268 | 268 | * @since 1.7 |
269 | 269 | */ |
270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
271 | 271 | |
272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
274 | 274 | /** |
275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param int $form_id The form ID. |
280 | 280 | */ |
281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
282 | 282 | } else { |
283 | 283 | /** |
284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @param int $form_id The form ID. |
289 | 289 | */ |
290 | - do_action( 'give_cc_form', $form_id ); |
|
290 | + do_action('give_cc_form', $form_id); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @since 1.7 |
297 | 297 | */ |
298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
299 | 299 | |
300 | 300 | } else { |
301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @since 1.7 |
305 | 305 | */ |
306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
306 | + do_action('give_donation_form_no_access', $form_id); |
|
307 | 307 | |
308 | 308 | } |
309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @since 1.7 |
314 | 314 | */ |
315 | - do_action( 'give_payment_fields_bottom', $form_id ); |
|
315 | + do_action('give_payment_fields_bottom', $form_id); |
|
316 | 316 | } |
317 | 317 | |
318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return void |
328 | 328 | */ |
329 | -function give_show_register_login_fields( $form_id ) { |
|
329 | +function give_show_register_login_fields($form_id) { |
|
330 | 330 | |
331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
331 | + $show_register_form = give_show_login_register_option($form_id); |
|
332 | 332 | |
333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
334 | 334 | ?> |
335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @since 1.7 |
341 | 341 | */ |
342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
342 | + do_action('give_donation_form_register_fields', $form_id); |
|
343 | 343 | ?> |
344 | 344 | </div> |
345 | 345 | <?php |
346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
347 | 347 | ?> |
348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @since 1.7 |
354 | 354 | */ |
355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
355 | + do_action('give_donation_form_login_fields', $form_id); |
|
356 | 356 | ?> |
357 | 357 | </div> |
358 | 358 | <?php |
359 | 359 | endif; |
360 | 360 | |
361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
362 | 362 | /** |
363 | 363 | * Fire when user info render. |
364 | 364 | * |
365 | 365 | * @since 1.7 |
366 | 366 | */ |
367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return void |
385 | 385 | */ |
386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
387 | 387 | |
388 | 388 | $give_options = give_get_settings(); |
389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
390 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false ) ); |
|
395 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
390 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false)); |
|
395 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
402 | 402 | * @param int $form_id The form ID. |
403 | 403 | * @param array $args An array of form arguments. |
404 | 404 | */ |
405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
406 | 406 | |
407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
409 | 409 | ?> |
410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
414 | - <?php if ( $currency_position == 'before' ) { |
|
414 | + <?php if ($currency_position == 'before') { |
|
415 | 415 | echo $currency_output; |
416 | 416 | } ?> |
417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
418 | - <?php if ( $currency_position == 'after' ) { |
|
418 | + <?php if ($currency_position == 'after') { |
|
419 | 419 | echo $currency_output; |
420 | 420 | } ?> |
421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | ?> |
426 | 426 | <div class="give-total-wrap"> |
427 | 427 | <div class="give-donation-amount form-row-wide"> |
428 | - <?php if ( $currency_position == 'before' ) { |
|
428 | + <?php if ($currency_position == 'before') { |
|
429 | 429 | echo $currency_output; |
430 | 430 | } ?> |
431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
434 | - <?php if ( $currency_position == 'after' ) { |
|
434 | + <?php if ($currency_position == 'after') { |
|
435 | 435 | echo $currency_output; |
436 | 436 | } ?> |
437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * @param int $form_id The form ID. |
447 | 447 | * @param array $args An array of form arguments. |
448 | 448 | */ |
449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
450 | 450 | |
451 | 451 | //Custom Amount Text |
452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
454 | 454 | <?php } |
455 | 455 | |
456 | 456 | //Output Variable Pricing Levels. |
457 | - if ( $variable_pricing ) { |
|
458 | - give_output_levels( $form_id ); |
|
457 | + if ($variable_pricing) { |
|
458 | + give_output_levels($form_id); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | * @param int $form_id The form ID. |
467 | 467 | * @param array $args An array of form arguments. |
468 | 468 | */ |
469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
470 | 470 | } |
471 | 471 | |
472 | -add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
472 | +add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2); |
|
473 | 473 | |
474 | 474 | /** |
475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,30 +480,30 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @return string Donation levels. |
482 | 482 | */ |
483 | -function give_output_levels( $form_id ) { |
|
483 | +function give_output_levels($form_id) { |
|
484 | 484 | |
485 | 485 | //Get variable pricing. |
486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
487 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
488 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
489 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
490 | - if ( empty( $custom_amount_text ) ) { |
|
491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
487 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
488 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
489 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
490 | + if (empty($custom_amount_text)) { |
|
491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | $output = ''; |
495 | 495 | |
496 | - switch ( $display_style ) { |
|
496 | + switch ($display_style) { |
|
497 | 497 | case 'buttons': |
498 | 498 | |
499 | 499 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
500 | 500 | |
501 | - foreach ( $prices as $price ) { |
|
502 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price ); |
|
503 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
501 | + foreach ($prices as $price) { |
|
502 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price); |
|
503 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
504 | 504 | |
505 | 505 | $output .= '<li>'; |
506 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">'; |
|
506 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">'; |
|
507 | 507 | $output .= $level_text; |
508 | 508 | $output .= '</button>'; |
509 | 509 | $output .= '</li>'; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | } |
512 | 512 | |
513 | 513 | //Custom Amount. |
514 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
514 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
515 | 515 | $output .= '<li>'; |
516 | 516 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
517 | 517 | $output .= $custom_amount_text; |
@@ -527,22 +527,22 @@ discard block |
||
527 | 527 | |
528 | 528 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
529 | 529 | |
530 | - foreach ( $prices as $price ) { |
|
531 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price ); |
|
532 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
530 | + foreach ($prices as $price) { |
|
531 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price); |
|
532 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
533 | 533 | |
534 | 534 | $output .= '<li>'; |
535 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">'; |
|
536 | - $output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>'; |
|
535 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">'; |
|
536 | + $output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>'; |
|
537 | 537 | $output .= '</li>'; |
538 | 538 | |
539 | 539 | } |
540 | 540 | |
541 | 541 | //Custom Amount. |
542 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
542 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
543 | 543 | $output .= '<li>'; |
544 | 544 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
545 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
545 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
546 | 546 | $output .= '</li>'; |
547 | 547 | } |
548 | 548 | |
@@ -552,23 +552,23 @@ discard block |
||
552 | 552 | |
553 | 553 | case 'dropdown': |
554 | 554 | |
555 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
556 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
555 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
556 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
557 | 557 | |
558 | 558 | //first loop through prices. |
559 | - foreach ( $prices as $price ) { |
|
560 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price ); |
|
561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
559 | + foreach ($prices as $price) { |
|
560 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price); |
|
561 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
562 | 562 | |
563 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">'; |
|
563 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">'; |
|
564 | 564 | $output .= $level_text; |
565 | 565 | $output .= '</option>'; |
566 | 566 | |
567 | 567 | } |
568 | 568 | |
569 | 569 | //Custom Amount. |
570 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
571 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
570 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
571 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | $output .= '</select>'; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | break; |
577 | 577 | } |
578 | 578 | |
579 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
579 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -591,27 +591,27 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @return string Checkout button. |
593 | 593 | */ |
594 | -function give_display_checkout_button( $form_id, $args ) { |
|
594 | +function give_display_checkout_button($form_id, $args) { |
|
595 | 595 | |
596 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
596 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
597 | 597 | ? $args['display_style'] |
598 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
598 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
599 | 599 | |
600 | - if ( 'button' === $display_option ) { |
|
600 | + if ('button' === $display_option) { |
|
601 | 601 | $display_option = 'modal'; |
602 | - } elseif ( $display_option === 'onpage' ) { |
|
602 | + } elseif ($display_option === 'onpage') { |
|
603 | 603 | return ''; |
604 | 604 | } |
605 | 605 | |
606 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
607 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
606 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
607 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
608 | 608 | |
609 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
609 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
610 | 610 | |
611 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
611 | + echo apply_filters('give_display_checkout_button', $output); |
|
612 | 612 | } |
613 | 613 | |
614 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
614 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -622,57 +622,57 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return void |
624 | 624 | */ |
625 | -function give_user_info_fields( $form_id ) { |
|
625 | +function give_user_info_fields($form_id) { |
|
626 | 626 | // Get user info. |
627 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
627 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
628 | 628 | |
629 | 629 | /** |
630 | 630 | * Fire before user personal information fields |
631 | 631 | * |
632 | 632 | * @since 1.7 |
633 | 633 | */ |
634 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
634 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
635 | 635 | ?> |
636 | 636 | <fieldset id="give_checkout_user_info"> |
637 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
637 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
638 | 638 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
639 | 639 | <label class="give-label" for="give-first"> |
640 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
641 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
640 | + <?php esc_html_e('First Name', 'give'); ?> |
|
641 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
642 | 642 | <span class="give-required-indicator">*</span> |
643 | 643 | <?php endif ?> |
644 | 644 | <span class="give-tooltip give-icon give-icon-question" |
645 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
645 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
646 | 646 | </label> |
647 | 647 | <input |
648 | 648 | class="give-input required" |
649 | 649 | type="text" |
650 | 650 | name="give_first" |
651 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
651 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
652 | 652 | id="give-first" |
653 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
654 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
653 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
654 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
655 | 655 | /> |
656 | 656 | </p> |
657 | 657 | |
658 | 658 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
659 | 659 | <label class="give-label" for="give-last"> |
660 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
661 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
660 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
661 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
662 | 662 | <span class="give-required-indicator">*</span> |
663 | 663 | <?php endif ?> |
664 | 664 | <span class="give-tooltip give-icon give-icon-question" |
665 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
665 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
666 | 666 | </label> |
667 | 667 | |
668 | 668 | <input |
669 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
669 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
670 | 670 | type="text" |
671 | 671 | name="give_last" |
672 | 672 | id="give-last" |
673 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
674 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
675 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
673 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
674 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
675 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
676 | 676 | /> |
677 | 677 | </p> |
678 | 678 | |
@@ -682,26 +682,26 @@ discard block |
||
682 | 682 | * |
683 | 683 | * @since 1.7 |
684 | 684 | */ |
685 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
685 | + do_action('give_donation_form_before_email', $form_id); |
|
686 | 686 | ?> |
687 | 687 | <p id="give-email-wrap" class="form-row form-row-wide"> |
688 | 688 | <label class="give-label" for="give-email"> |
689 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
690 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
689 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
690 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
691 | 691 | <span class="give-required-indicator">*</span> |
692 | 692 | <?php } ?> |
693 | 693 | <span class="give-tooltip give-icon give-icon-question" |
694 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
694 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
695 | 695 | </label> |
696 | 696 | |
697 | 697 | <input |
698 | 698 | class="give-input required" |
699 | 699 | type="email" |
700 | 700 | name="give_email" |
701 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
701 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
702 | 702 | id="give-email" |
703 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
704 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
703 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
704 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
705 | 705 | /> |
706 | 706 | |
707 | 707 | </p> |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | * |
712 | 712 | * @since 1.7 |
713 | 713 | */ |
714 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
714 | + do_action('give_donation_form_after_email', $form_id); |
|
715 | 715 | |
716 | 716 | /** |
717 | 717 | * Fire after personal email field |
718 | 718 | * |
719 | 719 | * @since 1.7 |
720 | 720 | */ |
721 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
721 | + do_action('give_donation_form_user_info', $form_id); |
|
722 | 722 | ?> |
723 | 723 | </fieldset> |
724 | 724 | <?php |
@@ -727,11 +727,11 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @since 1.7 |
729 | 729 | */ |
730 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
730 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
731 | 731 | } |
732 | 732 | |
733 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
733 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
734 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
735 | 735 | |
736 | 736 | /** |
737 | 737 | * Renders the credit card info form. |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return void |
744 | 744 | */ |
745 | -function give_get_cc_form( $form_id ) { |
|
745 | +function give_get_cc_form($form_id) { |
|
746 | 746 | |
747 | 747 | ob_start(); |
748 | 748 | |
@@ -753,53 +753,53 @@ discard block |
||
753 | 753 | * |
754 | 754 | * @param int $form_id The form ID. |
755 | 755 | */ |
756 | - do_action( 'give_before_cc_fields', $form_id ); |
|
756 | + do_action('give_before_cc_fields', $form_id); |
|
757 | 757 | ?> |
758 | 758 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
759 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
760 | - <?php if ( is_ssl() ) : ?> |
|
759 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
760 | + <?php if (is_ssl()) : ?> |
|
761 | 761 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
762 | 762 | <span class="give-icon padlock"></span> |
763 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
763 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
764 | 764 | </div> |
765 | 765 | <?php endif; ?> |
766 | 766 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
767 | 767 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
768 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
768 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
769 | 769 | <span class="give-required-indicator">*</span> |
770 | 770 | <span class="give-tooltip give-icon give-icon-question" |
771 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
771 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
772 | 772 | <span class="card-type"></span> |
773 | 773 | </label> |
774 | 774 | |
775 | 775 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
776 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
776 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
777 | 777 | required aria-required="true"/> |
778 | 778 | </p> |
779 | 779 | |
780 | 780 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
781 | 781 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
782 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
782 | + <?php esc_html_e('CVC', 'give'); ?> |
|
783 | 783 | <span class="give-required-indicator">*</span> |
784 | 784 | <span class="give-tooltip give-icon give-icon-question" |
785 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
785 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
786 | 786 | </label> |
787 | 787 | |
788 | 788 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
789 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
789 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
790 | 790 | required aria-required="true"/> |
791 | 791 | </p> |
792 | 792 | |
793 | 793 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
794 | 794 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
795 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
795 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
796 | 796 | <span class="give-required-indicator">*</span> |
797 | 797 | <span class="give-tooltip give-icon give-icon-question" |
798 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
798 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
799 | 799 | </label> |
800 | 800 | |
801 | 801 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
802 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
802 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
803 | 803 | required aria-required="true"/> |
804 | 804 | </p> |
805 | 805 | <?php |
@@ -810,14 +810,14 @@ discard block |
||
810 | 810 | * |
811 | 811 | * @param int $form_id The form ID. |
812 | 812 | */ |
813 | - do_action( 'give_before_cc_expiration' ); |
|
813 | + do_action('give_before_cc_expiration'); |
|
814 | 814 | ?> |
815 | 815 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
816 | 816 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
817 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
817 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
818 | 818 | <span class="give-required-indicator">*</span> |
819 | 819 | <span class="give-tooltip give-icon give-icon-question" |
820 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
820 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
821 | 821 | </label> |
822 | 822 | |
823 | 823 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | class="card-expiry-year"/> |
827 | 827 | |
828 | 828 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
829 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
829 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
830 | 830 | required aria-required="true"/> |
831 | 831 | </p> |
832 | 832 | <?php |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @param int $form_id The form ID. |
839 | 839 | */ |
840 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
840 | + do_action('give_after_cc_expiration', $form_id); |
|
841 | 841 | ?> |
842 | 842 | </fieldset> |
843 | 843 | <?php |
@@ -848,12 +848,12 @@ discard block |
||
848 | 848 | * |
849 | 849 | * @param int $form_id The form ID. |
850 | 850 | */ |
851 | - do_action( 'give_after_cc_fields', $form_id ); |
|
851 | + do_action('give_after_cc_fields', $form_id); |
|
852 | 852 | |
853 | 853 | echo ob_get_clean(); |
854 | 854 | } |
855 | 855 | |
856 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
856 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
857 | 857 | |
858 | 858 | /** |
859 | 859 | * Outputs the default credit card address fields. |
@@ -864,24 +864,24 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return void |
866 | 866 | */ |
867 | -function give_default_cc_address_fields( $form_id ) { |
|
867 | +function give_default_cc_address_fields($form_id) { |
|
868 | 868 | // Get user info. |
869 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
869 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
870 | 870 | |
871 | 871 | $logged_in = is_user_logged_in(); |
872 | 872 | |
873 | - if ( $logged_in ) { |
|
874 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
873 | + if ($logged_in) { |
|
874 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
875 | 875 | } |
876 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
877 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
878 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
879 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
876 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
877 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
878 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
879 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
880 | 880 | |
881 | 881 | ob_start(); |
882 | 882 | ?> |
883 | 883 | <fieldset id="give_cc_address" class="cc-address"> |
884 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
884 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
885 | 885 | <?php |
886 | 886 | /** |
887 | 887 | * Fires while rendering credit card billing form, before address fields. |
@@ -890,79 +890,79 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @param int $form_id The form ID. |
892 | 892 | */ |
893 | - do_action( 'give_cc_billing_top' ); |
|
893 | + do_action('give_cc_billing_top'); |
|
894 | 894 | ?> |
895 | 895 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
896 | 896 | <label for="card_address" class="give-label"> |
897 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
897 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
898 | 898 | <?php |
899 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
899 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
900 | 900 | <span class="give-required-indicator">*</span> |
901 | 901 | <?php endif; ?> |
902 | 902 | <span class="give-tooltip give-icon give-icon-question" |
903 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
903 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
904 | 904 | </label> |
905 | 905 | |
906 | 906 | <input |
907 | 907 | type="text" |
908 | 908 | id="card_address" |
909 | 909 | name="card_address" |
910 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
911 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
912 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
913 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
910 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
911 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
912 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
913 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
914 | 914 | /> |
915 | 915 | </p> |
916 | 916 | |
917 | 917 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
918 | 918 | <label for="card_address_2" class="give-label"> |
919 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
920 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
919 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
920 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
921 | 921 | <span class="give-required-indicator">*</span> |
922 | 922 | <?php endif; ?> |
923 | 923 | <span class="give-tooltip give-icon give-icon-question" |
924 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
924 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
925 | 925 | </label> |
926 | 926 | |
927 | 927 | <input |
928 | 928 | type="text" |
929 | 929 | id="card_address_2" |
930 | 930 | name="card_address_2" |
931 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
932 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
933 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
934 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
931 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
932 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
933 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
934 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
935 | 935 | /> |
936 | 936 | </p> |
937 | 937 | |
938 | 938 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
939 | 939 | <label for="card_city" class="give-label"> |
940 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
941 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
940 | + <?php esc_html_e('City', 'give'); ?> |
|
941 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
942 | 942 | <span class="give-required-indicator">*</span> |
943 | 943 | <?php endif; ?> |
944 | 944 | <span class="give-tooltip give-icon give-icon-question" |
945 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
945 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
946 | 946 | </label> |
947 | 947 | <input |
948 | 948 | type="text" |
949 | 949 | id="card_city" |
950 | 950 | name="card_city" |
951 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
952 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
953 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
954 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
951 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
952 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
953 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
954 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
955 | 955 | /> |
956 | 956 | </p> |
957 | 957 | |
958 | 958 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
959 | 959 | <label for="card_zip" class="give-label"> |
960 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
961 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
960 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
961 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
962 | 962 | <span class="give-required-indicator">*</span> |
963 | 963 | <?php endif; ?> |
964 | 964 | <span class="give-tooltip give-icon give-icon-question" |
965 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
965 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
966 | 966 | </label> |
967 | 967 | |
968 | 968 | <input |
@@ -970,40 +970,40 @@ discard block |
||
970 | 970 | size="4" |
971 | 971 | id="card_zip" |
972 | 972 | name="card_zip" |
973 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
974 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
975 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
976 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
973 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
974 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
975 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
976 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
977 | 977 | /> |
978 | 978 | </p> |
979 | 979 | |
980 | 980 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
981 | 981 | <label for="billing_country" class="give-label"> |
982 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
983 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
982 | + <?php esc_html_e('Country', 'give'); ?> |
|
983 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
984 | 984 | <span class="give-required-indicator">*</span> |
985 | 985 | <?php endif; ?> |
986 | 986 | <span class="give-tooltip give-icon give-icon-question" |
987 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
987 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
988 | 988 | </label> |
989 | 989 | |
990 | 990 | <select |
991 | 991 | name="billing_country" |
992 | 992 | id="billing_country" |
993 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
994 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
993 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
994 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
995 | 995 | > |
996 | 996 | <?php |
997 | 997 | |
998 | 998 | $selected_country = give_get_country(); |
999 | 999 | |
1000 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1000 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1001 | 1001 | $selected_country = $give_user_info['billing_country']; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | $countries = give_get_country_list(); |
1005 | - foreach ( $countries as $country_code => $country ) { |
|
1006 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1005 | + foreach ($countries as $country_code => $country) { |
|
1006 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1007 | 1007 | } |
1008 | 1008 | ?> |
1009 | 1009 | </select> |
@@ -1013,29 +1013,29 @@ discard block |
||
1013 | 1013 | <?php |
1014 | 1014 | $selected_state = ''; |
1015 | 1015 | |
1016 | - if ( $selected_country === give_get_country() ) { |
|
1016 | + if ($selected_country === give_get_country()) { |
|
1017 | 1017 | // Get defalut selected state by admin. |
1018 | 1018 | $selected_state = give_get_state(); |
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | // Get the last payment made by user states. |
1022 | - if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) { |
|
1022 | + if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) { |
|
1023 | 1023 | $selected_state = $give_user_info['card_state']; |
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | // Get the country code |
1027 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1027 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1028 | 1028 | $selected_country = $give_user_info['billing_country']; |
1029 | 1029 | } |
1030 | 1030 | |
1031 | - $label = __( 'State', 'give' ); |
|
1031 | + $label = __('State', 'give'); |
|
1032 | 1032 | $states_label = give_get_states_label(); |
1033 | 1033 | // Check if $country code exists in the array key for states label. |
1034 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
1035 | - $label = $states_label[ $selected_country ]; |
|
1034 | + if (array_key_exists($selected_country, $states_label)) { |
|
1035 | + $label = $states_label[$selected_country]; |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | - $states = give_get_states( $selected_country ); |
|
1038 | + $states = give_get_states($selected_country); |
|
1039 | 1039 | |
1040 | 1040 | // Get the country list that do not have any states init. |
1041 | 1041 | $no_states_country = give_no_states_country_list(); |
@@ -1044,27 +1044,27 @@ discard block |
||
1044 | 1044 | $states_not_required_country_list = give_states_not_required_country_list(); |
1045 | 1045 | ?> |
1046 | 1046 | <p id="give-card-state-wrap" |
1047 | - class="form-row form-row-last form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> "> |
|
1047 | + class="form-row form-row-last form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> "> |
|
1048 | 1048 | <label for="card_state" class="give-label"> |
1049 | 1049 | <span class="state-label-text"><?php echo $label; ?></span> |
1050 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : |
|
1050 | + <?php if (give_field_is_required('card_state', $form_id)) : |
|
1051 | 1051 | ?> |
1052 | - <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span> |
|
1052 | + <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span> |
|
1053 | 1053 | <?php endif; ?> |
1054 | 1054 | <span class="give-tooltip give-icon give-icon-question" |
1055 | - data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span> |
|
1055 | + data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span> |
|
1056 | 1056 | </label> |
1057 | 1057 | <?php |
1058 | 1058 | |
1059 | - if ( ! empty( $states ) ) : ?> |
|
1059 | + if ( ! empty($states)) : ?> |
|
1060 | 1060 | <select |
1061 | 1061 | name="card_state" |
1062 | 1062 | id="card_state" |
1063 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1064 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1063 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1064 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1065 | 1065 | <?php |
1066 | - foreach ( $states as $state_code => $state ) { |
|
1067 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1066 | + foreach ($states as $state_code => $state) { |
|
1067 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1068 | 1068 | } |
1069 | 1069 | ?> |
1070 | 1070 | </select> |
@@ -1081,14 +1081,14 @@ discard block |
||
1081 | 1081 | * |
1082 | 1082 | * @param int $form_id The form ID. |
1083 | 1083 | */ |
1084 | - do_action( 'give_cc_billing_bottom' ); |
|
1084 | + do_action('give_cc_billing_bottom'); |
|
1085 | 1085 | ?> |
1086 | 1086 | </fieldset> |
1087 | 1087 | <?php |
1088 | 1088 | echo ob_get_clean(); |
1089 | 1089 | } |
1090 | 1090 | |
1091 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1091 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1092 | 1092 | |
1093 | 1093 | |
1094 | 1094 | /** |
@@ -1101,24 +1101,24 @@ discard block |
||
1101 | 1101 | * |
1102 | 1102 | * @return string |
1103 | 1103 | */ |
1104 | -function give_get_register_fields( $form_id ) { |
|
1104 | +function give_get_register_fields($form_id) { |
|
1105 | 1105 | |
1106 | 1106 | global $user_ID; |
1107 | 1107 | |
1108 | - if ( is_user_logged_in() ) { |
|
1109 | - $user_data = get_userdata( $user_ID ); |
|
1108 | + if (is_user_logged_in()) { |
|
1109 | + $user_data = get_userdata($user_ID); |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1112 | + $show_register_form = give_show_login_register_option($form_id); |
|
1113 | 1113 | |
1114 | 1114 | ob_start(); ?> |
1115 | 1115 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1116 | 1116 | |
1117 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1117 | + <?php if ($show_register_form == 'both') { ?> |
|
1118 | 1118 | <div class="give-login-account-wrap"> |
1119 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1120 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1121 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1119 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1120 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1121 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1122 | 1122 | </p> |
1123 | 1123 | <p class="give-loading-text"> |
1124 | 1124 | <span class="give-loading-animation"></span> |
@@ -1134,15 +1134,15 @@ discard block |
||
1134 | 1134 | * |
1135 | 1135 | * @param int $form_id The form ID. |
1136 | 1136 | */ |
1137 | - do_action( 'give_register_fields_before', $form_id ); |
|
1137 | + do_action('give_register_fields_before', $form_id); |
|
1138 | 1138 | ?> |
1139 | 1139 | |
1140 | 1140 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1141 | 1141 | <legend> |
1142 | 1142 | <?php |
1143 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1144 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1145 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1143 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1144 | + if ( ! give_logged_in_only($form_id)) { |
|
1145 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1146 | 1146 | } |
1147 | 1147 | ?> |
1148 | 1148 | </legend> |
@@ -1154,54 +1154,54 @@ discard block |
||
1154 | 1154 | * |
1155 | 1155 | * @param int $form_id The form ID. |
1156 | 1156 | */ |
1157 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1157 | + do_action('give_register_account_fields_before', $form_id); |
|
1158 | 1158 | ?> |
1159 | 1159 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
1160 | 1160 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
1161 | 1161 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1162 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1163 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1162 | + <?php esc_html_e('Username', 'give'); ?> |
|
1163 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1164 | 1164 | <span class="give-required-indicator">*</span> |
1165 | 1165 | <?php } ?> |
1166 | 1166 | <span class="give-tooltip give-icon give-icon-question" |
1167 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1167 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1168 | 1168 | </label> |
1169 | 1169 | |
1170 | 1170 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
1171 | 1171 | type="text" |
1172 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1172 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1173 | 1173 | </div> |
1174 | 1174 | |
1175 | 1175 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1176 | 1176 | class="form-row form-row-one-third form-row-responsive"> |
1177 | 1177 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1178 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1179 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1178 | + <?php esc_html_e('Password', 'give'); ?> |
|
1179 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1180 | 1180 | <span class="give-required-indicator">*</span> |
1181 | 1181 | <?php } ?> |
1182 | 1182 | <span class="give-tooltip give-icon give-icon-question" |
1183 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1183 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1184 | 1184 | </label> |
1185 | 1185 | |
1186 | 1186 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
1187 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
1188 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1187 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
1188 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1189 | 1189 | </div> |
1190 | 1190 | |
1191 | 1191 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
1192 | 1192 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
1193 | 1193 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1194 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1195 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1194 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1195 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1196 | 1196 | <span class="give-required-indicator">*</span> |
1197 | 1197 | <?php } ?> |
1198 | 1198 | <span class="give-tooltip give-icon give-icon-question" |
1199 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1199 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1200 | 1200 | </label> |
1201 | 1201 | |
1202 | 1202 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
1203 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
1204 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1203 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
1204 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1205 | 1205 | </div> |
1206 | 1206 | <?php |
1207 | 1207 | /** |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | * |
1212 | 1212 | * @param int $form_id The form ID. |
1213 | 1213 | */ |
1214 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1214 | + do_action('give_register_account_fields_after', $form_id); |
|
1215 | 1215 | ?> |
1216 | 1216 | </fieldset> |
1217 | 1217 | |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | * |
1224 | 1224 | * @param int $form_id The form ID. |
1225 | 1225 | */ |
1226 | - do_action( 'give_register_fields_after', $form_id ); |
|
1226 | + do_action('give_register_fields_after', $form_id); |
|
1227 | 1227 | ?> |
1228 | 1228 | |
1229 | 1229 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * |
1235 | 1235 | * @since 1.7 |
1236 | 1236 | */ |
1237 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1237 | + do_action('give_donation_form_user_info', $form_id); |
|
1238 | 1238 | ?> |
1239 | 1239 | |
1240 | 1240 | </fieldset> |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | echo ob_get_clean(); |
1243 | 1243 | } |
1244 | 1244 | |
1245 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1245 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1246 | 1246 | |
1247 | 1247 | /** |
1248 | 1248 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1255,27 +1255,27 @@ discard block |
||
1255 | 1255 | * |
1256 | 1256 | * @return string |
1257 | 1257 | */ |
1258 | -function give_get_login_fields( $form_id ) { |
|
1258 | +function give_get_login_fields($form_id) { |
|
1259 | 1259 | |
1260 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1261 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1260 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1261 | + $show_register_form = give_show_login_register_option($form_id); |
|
1262 | 1262 | |
1263 | 1263 | ob_start(); |
1264 | 1264 | ?> |
1265 | 1265 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1266 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1267 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1268 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1266 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1267 | + if ( ! give_logged_in_only($form_id)) { |
|
1268 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1269 | 1269 | } ?> |
1270 | 1270 | </legend> |
1271 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1271 | + <?php if ($show_register_form == 'both') { ?> |
|
1272 | 1272 | <p class="give-new-account-link"> |
1273 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1274 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1273 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1274 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1275 | 1275 | data-action="give_checkout_register"> |
1276 | - <?php esc_html_e( 'Register', 'give' ); |
|
1277 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1278 | - echo ' ' . esc_html__( 'and donate as a guest »', 'give' ); |
|
1276 | + <?php esc_html_e('Register', 'give'); |
|
1277 | + if ( ! give_logged_in_only($form_id)) { |
|
1278 | + echo ' '.esc_html__('and donate as a guest »', 'give'); |
|
1279 | 1279 | } ?> |
1280 | 1280 | </a> |
1281 | 1281 | </p> |
@@ -1291,49 +1291,49 @@ discard block |
||
1291 | 1291 | * |
1292 | 1292 | * @param int $form_id The form ID. |
1293 | 1293 | */ |
1294 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1294 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1295 | 1295 | ?> |
1296 | 1296 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
1297 | 1297 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1298 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1299 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1298 | + <?php esc_html_e('Username', 'give'); ?> |
|
1299 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1300 | 1300 | <span class="give-required-indicator">*</span> |
1301 | 1301 | <?php } ?> |
1302 | 1302 | </label> |
1303 | 1303 | |
1304 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1304 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1305 | 1305 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1306 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1306 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1307 | 1307 | </div> |
1308 | 1308 | |
1309 | 1309 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1310 | 1310 | class="give_login_password form-row form-row-last form-row-responsive"> |
1311 | 1311 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1312 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1313 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1312 | + <?php esc_html_e('Password', 'give'); ?> |
|
1313 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1314 | 1314 | <span class="give-required-indicator">*</span> |
1315 | 1315 | <?php } ?> |
1316 | 1316 | </label> |
1317 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1317 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1318 | 1318 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1319 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1319 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1320 | 1320 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1321 | 1321 | </div> |
1322 | 1322 | |
1323 | 1323 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1324 | 1324 | <span class="give-forgot-password "> |
1325 | 1325 | <a href="<?php echo wp_lostpassword_url() ?>" |
1326 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1326 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1327 | 1327 | </span> |
1328 | 1328 | </div> |
1329 | 1329 | |
1330 | 1330 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1331 | 1331 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1332 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1333 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1332 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1333 | + <?php if ($show_register_form !== 'login') { ?> |
|
1334 | 1334 | <input type="button" data-action="give_cancel_login" |
1335 | 1335 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1336 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1336 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1337 | 1337 | <?php } ?> |
1338 | 1338 | <span class="give-loading-animation"></span> |
1339 | 1339 | </div> |
@@ -1345,14 +1345,14 @@ discard block |
||
1345 | 1345 | * |
1346 | 1346 | * @param int $form_id The form ID. |
1347 | 1347 | */ |
1348 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1348 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1349 | 1349 | ?> |
1350 | 1350 | </fieldset><!--end #give-login-fields--> |
1351 | 1351 | <?php |
1352 | 1352 | echo ob_get_clean(); |
1353 | 1353 | } |
1354 | 1354 | |
1355 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1355 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1356 | 1356 | |
1357 | 1357 | /** |
1358 | 1358 | * Payment Mode Select. |
@@ -1368,9 +1368,9 @@ discard block |
||
1368 | 1368 | * |
1369 | 1369 | * @return void |
1370 | 1370 | */ |
1371 | -function give_payment_mode_select( $form_id ) { |
|
1371 | +function give_payment_mode_select($form_id) { |
|
1372 | 1372 | |
1373 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1373 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1374 | 1374 | |
1375 | 1375 | /** |
1376 | 1376 | * Fires while selecting payment gateways, before the fields. |
@@ -1379,10 +1379,10 @@ discard block |
||
1379 | 1379 | * |
1380 | 1380 | * @param int $form_id The form ID. |
1381 | 1381 | */ |
1382 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1382 | + do_action('give_payment_mode_top', $form_id); |
|
1383 | 1383 | ?> |
1384 | 1384 | |
1385 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1385 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1386 | 1386 | echo 'style="display: none;"'; |
1387 | 1387 | } ?>> |
1388 | 1388 | <?php |
@@ -1393,10 +1393,10 @@ discard block |
||
1393 | 1393 | * |
1394 | 1394 | * @param int $form_id The form ID. |
1395 | 1395 | */ |
1396 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1396 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1397 | 1397 | ?> |
1398 | 1398 | <legend |
1399 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1399 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1400 | 1400 | <span class="give-loading-text"><span |
1401 | 1401 | class="give-loading-animation"></span> |
1402 | 1402 | </span> |
@@ -1409,26 +1409,26 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @since 1.7 |
1411 | 1411 | */ |
1412 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1412 | + do_action('give_payment_mode_before_gateways') |
|
1413 | 1413 | ?> |
1414 | 1414 | <ul id="give-gateway-radio-list"> |
1415 | 1415 | <?php |
1416 | 1416 | /** |
1417 | 1417 | * Loop through the active payment gateways. |
1418 | 1418 | */ |
1419 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1419 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1420 | 1420 | |
1421 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1421 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1422 | 1422 | //Determine the default gateway. |
1423 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1423 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1424 | 1424 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
1425 | 1425 | <li<?php echo $checked_class ?>> |
1426 | 1426 | <input type="radio" name="payment-mode" class="give-gateway" |
1427 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1428 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1429 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1427 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1428 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1429 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1430 | 1430 | class="give-gateway-option" |
1431 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
1431 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
1432 | 1432 | </li> |
1433 | 1433 | <?php |
1434 | 1434 | endforeach; |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | * |
1441 | 1441 | * @since 1.7 |
1442 | 1442 | */ |
1443 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1443 | + do_action('give_payment_mode_after_gateways'); |
|
1444 | 1444 | ?> |
1445 | 1445 | </div> |
1446 | 1446 | <?php |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | * |
1452 | 1452 | * @param int $form_id The form ID. |
1453 | 1453 | */ |
1454 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1454 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1455 | 1455 | ?> |
1456 | 1456 | </fieldset> |
1457 | 1457 | |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | * |
1464 | 1464 | * @param int $form_id The form ID. |
1465 | 1465 | */ |
1466 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1466 | + do_action('give_payment_mode_bottom', $form_id); |
|
1467 | 1467 | ?> |
1468 | 1468 | |
1469 | 1469 | <div id="give_purchase_form_wrap"> |
@@ -1474,7 +1474,7 @@ discard block |
||
1474 | 1474 | * |
1475 | 1475 | * @since 1.7 |
1476 | 1476 | */ |
1477 | - do_action( 'give_donation_form', $form_id ); |
|
1477 | + do_action('give_donation_form', $form_id); |
|
1478 | 1478 | ?> |
1479 | 1479 | |
1480 | 1480 | </div> |
@@ -1485,10 +1485,10 @@ discard block |
||
1485 | 1485 | * |
1486 | 1486 | * @since 1.7 |
1487 | 1487 | */ |
1488 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1488 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1491 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1492 | 1492 | |
1493 | 1493 | /** |
1494 | 1494 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1501,31 +1501,31 @@ discard block |
||
1501 | 1501 | * |
1502 | 1502 | * @return bool |
1503 | 1503 | */ |
1504 | -function give_terms_agreement( $form_id ) { |
|
1505 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1504 | +function give_terms_agreement($form_id) { |
|
1505 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1506 | 1506 | |
1507 | 1507 | // Bailout if per form and global term and conditions is not setup. |
1508 | 1508 | if ( |
1509 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1510 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1509 | + give_is_setting_enabled($form_option, 'global') |
|
1510 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1511 | 1511 | ) { |
1512 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1513 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
1514 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
1512 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1513 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
1514 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
1515 | 1515 | |
1516 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1517 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
1518 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
1519 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
1516 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1517 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
1518 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
1519 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
1520 | 1520 | |
1521 | 1521 | } else { |
1522 | 1522 | return false; |
1523 | 1523 | } |
1524 | 1524 | |
1525 | 1525 | // Bailout: Check if term and conditions text is empty or not. |
1526 | - if ( empty( $terms ) ) { |
|
1527 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
1528 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
1526 | + if (empty($terms)) { |
|
1527 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
1528 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | return false; |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | |
1534 | 1534 | ?> |
1535 | 1535 | <fieldset id="give_terms_agreement"> |
1536 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1536 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1537 | 1537 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1538 | 1538 | <?php |
1539 | 1539 | /** |
@@ -1541,22 +1541,22 @@ discard block |
||
1541 | 1541 | * |
1542 | 1542 | * @since 1.0 |
1543 | 1543 | */ |
1544 | - do_action( 'give_before_terms' ); |
|
1544 | + do_action('give_before_terms'); |
|
1545 | 1545 | |
1546 | - echo wpautop( stripslashes( $terms ) ); |
|
1546 | + echo wpautop(stripslashes($terms)); |
|
1547 | 1547 | /** |
1548 | 1548 | * Fires while rendering terms of agreement, after the fields. |
1549 | 1549 | * |
1550 | 1550 | * @since 1.0 |
1551 | 1551 | */ |
1552 | - do_action( 'give_after_terms' ); |
|
1552 | + do_action('give_after_terms'); |
|
1553 | 1553 | ?> |
1554 | 1554 | </div> |
1555 | 1555 | <div id="give_show_terms"> |
1556 | 1556 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1557 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1557 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1558 | 1558 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1559 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1559 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1560 | 1560 | </div> |
1561 | 1561 | |
1562 | 1562 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | <?php |
1568 | 1568 | } |
1569 | 1569 | |
1570 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1570 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1571 | 1571 | |
1572 | 1572 | /** |
1573 | 1573 | * Checkout Final Total. |
@@ -1580,31 +1580,30 @@ discard block |
||
1580 | 1580 | * |
1581 | 1581 | * @return void |
1582 | 1582 | */ |
1583 | -function give_checkout_final_total( $form_id ) { |
|
1583 | +function give_checkout_final_total($form_id) { |
|
1584 | 1584 | |
1585 | - $total = isset( $_POST['give_total'] ) ? |
|
1586 | - apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) : |
|
1587 | - give_get_default_form_amount( $form_id ); |
|
1585 | + $total = isset($_POST['give_total']) ? |
|
1586 | + apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id); |
|
1588 | 1587 | |
1589 | 1588 | |
1590 | 1589 | //Only proceed if give_total available. |
1591 | - if ( empty( $total ) ) { |
|
1590 | + if (empty($total)) { |
|
1592 | 1591 | return; |
1593 | 1592 | } |
1594 | 1593 | ?> |
1595 | 1594 | <p id="give-final-total-wrap" class="form-wrap "> |
1596 | 1595 | <span class="give-donation-total-label"> |
1597 | - <?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?> |
|
1596 | + <?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?> |
|
1598 | 1597 | </span> |
1599 | 1598 | <span class="give-final-total-amount" |
1600 | - data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>"> |
|
1601 | - <?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ) ); ?> |
|
1599 | + data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>"> |
|
1600 | + <?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false))); ?> |
|
1602 | 1601 | </span> |
1603 | 1602 | </p> |
1604 | 1603 | <?php |
1605 | 1604 | } |
1606 | 1605 | |
1607 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1606 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1608 | 1607 | |
1609 | 1608 | /** |
1610 | 1609 | * Renders the Checkout Submit section. |
@@ -1615,7 +1614,7 @@ discard block |
||
1615 | 1614 | * |
1616 | 1615 | * @return void |
1617 | 1616 | */ |
1618 | -function give_checkout_submit( $form_id ) { |
|
1617 | +function give_checkout_submit($form_id) { |
|
1619 | 1618 | ?> |
1620 | 1619 | <fieldset id="give_purchase_submit"> |
1621 | 1620 | <?php |
@@ -1624,24 +1623,24 @@ discard block |
||
1624 | 1623 | * |
1625 | 1624 | * @since 1.7 |
1626 | 1625 | */ |
1627 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1626 | + do_action('give_donation_form_before_submit', $form_id); |
|
1628 | 1627 | |
1629 | - give_checkout_hidden_fields( $form_id ); |
|
1628 | + give_checkout_hidden_fields($form_id); |
|
1630 | 1629 | |
1631 | - echo give_get_donation_form_submit_button( $form_id ); |
|
1630 | + echo give_get_donation_form_submit_button($form_id); |
|
1632 | 1631 | |
1633 | 1632 | /** |
1634 | 1633 | * Fire after donation form submit. |
1635 | 1634 | * |
1636 | 1635 | * @since 1.7 |
1637 | 1636 | */ |
1638 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1637 | + do_action('give_donation_form_after_submit', $form_id); |
|
1639 | 1638 | ?> |
1640 | 1639 | </fieldset> |
1641 | 1640 | <?php |
1642 | 1641 | } |
1643 | 1642 | |
1644 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1643 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1645 | 1644 | |
1646 | 1645 | /** |
1647 | 1646 | * Give Donation form submit button. |
@@ -1652,10 +1651,10 @@ discard block |
||
1652 | 1651 | * |
1653 | 1652 | * @return string |
1654 | 1653 | */ |
1655 | -function give_get_donation_form_submit_button( $form_id ) { |
|
1654 | +function give_get_donation_form_submit_button($form_id) { |
|
1656 | 1655 | |
1657 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
1658 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1656 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
1657 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1659 | 1658 | ob_start(); |
1660 | 1659 | ?> |
1661 | 1660 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1664,7 +1663,7 @@ discard block |
||
1664 | 1663 | <span class="give-loading-animation"></span> |
1665 | 1664 | </div> |
1666 | 1665 | <?php |
1667 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
1666 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
1668 | 1667 | } |
1669 | 1668 | |
1670 | 1669 | /** |
@@ -1679,17 +1678,17 @@ discard block |
||
1679 | 1678 | * |
1680 | 1679 | * @return mixed |
1681 | 1680 | */ |
1682 | -function give_show_goal_progress( $form_id, $args ) { |
|
1681 | +function give_show_goal_progress($form_id, $args) { |
|
1683 | 1682 | |
1684 | 1683 | ob_start(); |
1685 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1684 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1686 | 1685 | |
1687 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1686 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1688 | 1687 | |
1689 | 1688 | return true; |
1690 | 1689 | } |
1691 | 1690 | |
1692 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1691 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1693 | 1692 | |
1694 | 1693 | |
1695 | 1694 | /** |
@@ -1702,10 +1701,10 @@ discard block |
||
1702 | 1701 | * |
1703 | 1702 | * @return mixed|string |
1704 | 1703 | */ |
1705 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1704 | +function give_get_form_content_placement($form_id, $args) { |
|
1706 | 1705 | $show_content = ''; |
1707 | 1706 | |
1708 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1707 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1709 | 1708 | // Content positions. |
1710 | 1709 | $content_placement = array( |
1711 | 1710 | 'above' => 'give_pre_form', |
@@ -1713,18 +1712,18 @@ discard block |
||
1713 | 1712 | ); |
1714 | 1713 | |
1715 | 1714 | // Check if content position already decoded. |
1716 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1715 | + if (in_array($args['show_content'], $content_placement)) { |
|
1717 | 1716 | return $args['show_content']; |
1718 | 1717 | } |
1719 | 1718 | |
1720 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1719 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1721 | 1720 | |
1722 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1723 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
1721 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
1722 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
1724 | 1723 | |
1725 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
1724 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
1726 | 1725 | // Backward compatibility for _give_content_option for v18. |
1727 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
1726 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
1728 | 1727 | } |
1729 | 1728 | |
1730 | 1729 | return $show_content; |
@@ -1740,20 +1739,20 @@ discard block |
||
1740 | 1739 | * |
1741 | 1740 | * @return void|bool |
1742 | 1741 | */ |
1743 | -function give_form_content( $form_id, $args ) { |
|
1742 | +function give_form_content($form_id, $args) { |
|
1744 | 1743 | |
1745 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1744 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1746 | 1745 | |
1747 | 1746 | // Bailout. |
1748 | - if ( empty( $show_content ) ) { |
|
1747 | + if (empty($show_content)) { |
|
1749 | 1748 | return false; |
1750 | 1749 | } |
1751 | 1750 | |
1752 | 1751 | // Add action according to value. |
1753 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1752 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1754 | 1753 | } |
1755 | 1754 | |
1756 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1755 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1757 | 1756 | |
1758 | 1757 | /** |
1759 | 1758 | * Renders Post Form Content. |
@@ -1767,22 +1766,22 @@ discard block |
||
1767 | 1766 | * |
1768 | 1767 | * @return void |
1769 | 1768 | */ |
1770 | -function give_form_display_content( $form_id, $args ) { |
|
1769 | +function give_form_display_content($form_id, $args) { |
|
1771 | 1770 | |
1772 | - $content = wpautop( give_get_meta( $form_id, '_give_form_content', true ) ); |
|
1773 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1771 | + $content = wpautop(give_get_meta($form_id, '_give_form_content', true)); |
|
1772 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1774 | 1773 | |
1775 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1776 | - $content = apply_filters( 'the_content', $content ); |
|
1774 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1775 | + $content = apply_filters('the_content', $content); |
|
1777 | 1776 | } |
1778 | 1777 | |
1779 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
1778 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
1780 | 1779 | |
1781 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1780 | + echo apply_filters('give_form_content_output', $output); |
|
1782 | 1781 | |
1783 | 1782 | //remove action to prevent content output on addition forms on page. |
1784 | 1783 | //@see: https://github.com/WordImpress/Give/issues/634. |
1785 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1784 | + remove_action($show_content, 'give_form_display_content'); |
|
1786 | 1785 | } |
1787 | 1786 | |
1788 | 1787 | /** |
@@ -1794,7 +1793,7 @@ discard block |
||
1794 | 1793 | * |
1795 | 1794 | * @return void |
1796 | 1795 | */ |
1797 | -function give_checkout_hidden_fields( $form_id ) { |
|
1796 | +function give_checkout_hidden_fields($form_id) { |
|
1798 | 1797 | |
1799 | 1798 | /** |
1800 | 1799 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1803,13 +1802,13 @@ discard block |
||
1803 | 1802 | * |
1804 | 1803 | * @param int $form_id The form ID. |
1805 | 1804 | */ |
1806 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1805 | + do_action('give_hidden_fields_before', $form_id); |
|
1807 | 1806 | |
1808 | - if ( is_user_logged_in() ) { ?> |
|
1807 | + if (is_user_logged_in()) { ?> |
|
1809 | 1808 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1810 | 1809 | <?php } ?> |
1811 | 1810 | <input type="hidden" name="give_action" value="purchase"/> |
1812 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1811 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1813 | 1812 | <?php |
1814 | 1813 | /** |
1815 | 1814 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1818,7 +1817,7 @@ discard block |
||
1818 | 1817 | * |
1819 | 1818 | * @param int $form_id The form ID. |
1820 | 1819 | */ |
1821 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1820 | + do_action('give_hidden_fields_after', $form_id); |
|
1822 | 1821 | |
1823 | 1822 | } |
1824 | 1823 | |
@@ -1833,20 +1832,20 @@ discard block |
||
1833 | 1832 | * |
1834 | 1833 | * @return string $content Filtered content. |
1835 | 1834 | */ |
1836 | -function give_filter_success_page_content( $content ) { |
|
1835 | +function give_filter_success_page_content($content) { |
|
1837 | 1836 | |
1838 | 1837 | $give_options = give_get_settings(); |
1839 | 1838 | |
1840 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1841 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1842 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1839 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1840 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1841 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1843 | 1842 | } |
1844 | 1843 | } |
1845 | 1844 | |
1846 | 1845 | return $content; |
1847 | 1846 | } |
1848 | 1847 | |
1849 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1848 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1850 | 1849 | |
1851 | 1850 | /** |
1852 | 1851 | * Test Mode Frontend Warning. |
@@ -1857,12 +1856,12 @@ discard block |
||
1857 | 1856 | */ |
1858 | 1857 | function give_test_mode_frontend_warning() { |
1859 | 1858 | |
1860 | - if ( give_is_test_mode() ) { |
|
1861 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
1859 | + if (give_is_test_mode()) { |
|
1860 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
1862 | 1861 | } |
1863 | 1862 | } |
1864 | 1863 | |
1865 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1864 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1866 | 1865 | |
1867 | 1866 | /** |
1868 | 1867 | * Members-only Form. |
@@ -1876,21 +1875,21 @@ discard block |
||
1876 | 1875 | * |
1877 | 1876 | * @return string |
1878 | 1877 | */ |
1879 | -function give_members_only_form( $final_output, $args ) { |
|
1878 | +function give_members_only_form($final_output, $args) { |
|
1880 | 1879 | |
1881 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1880 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1882 | 1881 | |
1883 | 1882 | //Sanity Check: Must have form_id & not be logged in. |
1884 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1883 | + if (empty($form_id) || is_user_logged_in()) { |
|
1885 | 1884 | return $final_output; |
1886 | 1885 | } |
1887 | 1886 | |
1888 | 1887 | //Logged in only and Register / Login set to none. |
1889 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1888 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1890 | 1889 | |
1891 | - $final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1890 | + $final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1892 | 1891 | |
1893 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1892 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1894 | 1893 | |
1895 | 1894 | } |
1896 | 1895 | |
@@ -1898,4 +1897,4 @@ discard block |
||
1898 | 1897 | |
1899 | 1898 | } |
1900 | 1899 | |
1901 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1900 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -1068,9 +1068,12 @@ |
||
1068 | 1068 | } |
1069 | 1069 | ?> |
1070 | 1070 | </select> |
1071 | - <?php else : ?> |
|
1071 | + <?php else { |
|
1072 | + : ?> |
|
1072 | 1073 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1073 | - placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/> |
|
1074 | + placeholder="<?php echo $label; |
|
1075 | +} |
|
1076 | +?>" value="<?php echo $selected_state; ?>"/> |
|
1074 | 1077 | <?php endif; ?> |
1075 | 1078 | </p> |
1076 | 1079 | <?php |
@@ -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 | |
@@ -25,52 +25,52 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | // Retrieve existing payment meta. |
43 | 43 | $meta = $payment->get_meta(); |
44 | 44 | $user_info = $payment->user_info; |
45 | 45 | |
46 | 46 | $status = $data['give-payment-status']; |
47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
49 | 49 | |
50 | 50 | // Restrict to our high and low. |
51 | - if ( $hour > 23 ) { |
|
51 | + if ($hour > 23) { |
|
52 | 52 | $hour = 23; |
53 | - } elseif ( $hour < 0 ) { |
|
53 | + } elseif ($hour < 0) { |
|
54 | 54 | $hour = 00; |
55 | 55 | } |
56 | 56 | |
57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
58 | 58 | |
59 | 59 | // Restrict to our high and low. |
60 | - if ( $minute > 59 ) { |
|
60 | + if ($minute > 59) { |
|
61 | 61 | $minute = 59; |
62 | - } elseif ( $minute < 0 ) { |
|
62 | + } elseif ($minute < 0) { |
|
63 | 63 | $minute = 00; |
64 | 64 | } |
65 | 65 | |
66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
67 | 67 | |
68 | 68 | $curr_total = $payment->total; |
69 | - $new_total = give_maybe_sanitize_amount( $data['give-payment-total'] ); |
|
70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
69 | + $new_total = give_maybe_sanitize_amount($data['give-payment-total']); |
|
70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
71 | 71 | |
72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Fires before updating edited donation. |
@@ -80,98 +80,98 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id The ID of the payment. |
82 | 82 | */ |
83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
83 | + do_action('give_update_edited_donation', $payment_id); |
|
84 | 84 | |
85 | 85 | $payment->date = $date; |
86 | 86 | $updated = $payment->save(); |
87 | 87 | |
88 | - if ( 0 === $updated ) { |
|
89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
88 | + if (0 === $updated) { |
|
89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $donor_changed = false; |
93 | 93 | |
94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
95 | 95 | |
96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
98 | 98 | |
99 | - if ( empty( $email ) || empty( $names ) ) { |
|
100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
99 | + if (empty($email) || empty($names)) { |
|
100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
101 | 101 | } |
102 | 102 | |
103 | - $donor = new Give_Donor( $email ); |
|
104 | - if ( empty( $donor->id ) ) { |
|
105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
106 | - $user_id = email_exists( $email ); |
|
107 | - if ( false !== $user_id ) { |
|
103 | + $donor = new Give_Donor($email); |
|
104 | + if (empty($donor->id)) { |
|
105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
106 | + $user_id = email_exists($email); |
|
107 | + if (false !== $user_id) { |
|
108 | 108 | $donor_data['user_id'] = $user_id; |
109 | 109 | } |
110 | 110 | |
111 | - if ( ! $donor->create( $donor_data ) ) { |
|
111 | + if ( ! $donor->create($donor_data)) { |
|
112 | 112 | // Failed to crete the new donor, assume the previous donor. |
113 | 113 | $donor_changed = false; |
114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
114 | + $donor = new Give_Donor($curr_donor_id); |
|
115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | $new_donor_id = $donor->id; |
120 | 120 | |
121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
122 | 122 | |
123 | 123 | $donor_changed = true; |
124 | 124 | |
125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
126 | 126 | |
127 | - $donor = new Give_Donor( $new_donor_id ); |
|
127 | + $donor = new Give_Donor($new_donor_id); |
|
128 | 128 | $email = $donor->email; |
129 | 129 | $names = $donor->name; |
130 | 130 | |
131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
132 | 132 | |
133 | 133 | $donor_changed = true; |
134 | 134 | |
135 | 135 | } else { |
136 | 136 | |
137 | - $donor = new Give_Donor( $curr_donor_id ); |
|
137 | + $donor = new Give_Donor($curr_donor_id); |
|
138 | 138 | $email = $donor->email; |
139 | 139 | $names = $donor->name; |
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Setup first and last name from input values. |
144 | - $names = explode( ' ', $names ); |
|
145 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
144 | + $names = explode(' ', $names); |
|
145 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
146 | 146 | $last_name = ''; |
147 | - if ( ! empty( $names[1] ) ) { |
|
148 | - unset( $names[0] ); |
|
149 | - $last_name = implode( ' ', $names ); |
|
147 | + if ( ! empty($names[1])) { |
|
148 | + unset($names[0]); |
|
149 | + $last_name = implode(' ', $names); |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( $donor_changed ) { |
|
152 | + if ($donor_changed) { |
|
153 | 153 | |
154 | 154 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
155 | - $previous_donor->remove_payment( $payment_id, false ); |
|
156 | - $donor->attach_payment( $payment_id, false ); |
|
155 | + $previous_donor->remove_payment($payment_id, false); |
|
156 | + $donor->attach_payment($payment_id, false); |
|
157 | 157 | |
158 | - if ( 'publish' == $status ) { |
|
158 | + if ('publish' == $status) { |
|
159 | 159 | |
160 | 160 | // Reduce previous user donation count and amount. |
161 | 161 | $previous_donor->decrease_donation_count(); |
162 | - $previous_donor->decrease_value( $curr_total ); |
|
162 | + $previous_donor->decrease_value($curr_total); |
|
163 | 163 | |
164 | 164 | // If donation was completed adjust stats of new donors. |
165 | 165 | $donor->increase_purchase_count(); |
166 | - $donor->increase_value( $new_total ); |
|
166 | + $donor->increase_value($new_total); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | $payment->customer_id = $donor->id; |
170 | 170 | } else { |
171 | 171 | |
172 | - if ( 'publish' === $status ) { |
|
172 | + if ('publish' === $status) { |
|
173 | 173 | // Update user donation stat. |
174 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
174 | + $donor->update_donation_value($curr_total, $new_total); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $payment->total = $new_total; |
185 | 185 | |
186 | 186 | // Check for payment notes. |
187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
187 | + if ( ! empty($data['give-payment-note'])) { |
|
188 | 188 | |
189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
190 | - give_insert_payment_note( $payment_id, $note ); |
|
189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
190 | + give_insert_payment_note($payment_id, $note); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $payment->status = $status; |
196 | 196 | |
197 | 197 | // Adjust total store earnings if the payment total has been changed. |
198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
199 | 199 | |
200 | - if ( $new_total > $curr_total ) { |
|
200 | + if ($new_total > $curr_total) { |
|
201 | 201 | // Increase if our new total is higher. |
202 | 202 | $difference = $new_total - $curr_total; |
203 | - give_increase_total_earnings( $difference ); |
|
203 | + give_increase_total_earnings($difference); |
|
204 | 204 | |
205 | - } elseif ( $curr_total > $new_total ) { |
|
205 | + } elseif ($curr_total > $new_total) { |
|
206 | 206 | // Decrease if our new total is lower. |
207 | 207 | $difference = $curr_total - $new_total; |
208 | - give_decrease_total_earnings( $difference ); |
|
208 | + give_decrease_total_earnings($difference); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | $payment->save(); |
214 | 214 | |
215 | 215 | // Get new give form ID. |
216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
218 | 218 | |
219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
221 | 221 | // Check if user want to transfer current payment to new give form id. |
222 | - if ( $new_form_id != $current_form_id ) { |
|
222 | + if ($new_form_id != $current_form_id) { |
|
223 | 223 | |
224 | 224 | // Get new give form title. |
225 | - $new_form_title = get_the_title( $new_form_id ); |
|
225 | + $new_form_title = get_the_title($new_form_id); |
|
226 | 226 | |
227 | 227 | // Update new give form data in payment data. |
228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,43 +230,43 @@ discard block |
||
230 | 230 | $payment_meta['form_id'] = $new_form_id; |
231 | 231 | |
232 | 232 | // Update price id post meta data for set donation form. |
233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
234 | 234 | $payment_meta['price_id'] = ''; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Update payment give form meta data. |
238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
241 | 241 | |
242 | 242 | // Update price id payment metadata. |
243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // If donation was completed, adjust stats of forms. |
248 | - if ( 'publish' == $status ) { |
|
248 | + if ('publish' == $status) { |
|
249 | 249 | |
250 | 250 | // Decrease sale of old give form. For other payment status. |
251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
252 | 252 | $current_form->decrease_sales(); |
253 | - $current_form->decrease_earnings( $curr_total ); |
|
253 | + $current_form->decrease_earnings($curr_total); |
|
254 | 254 | |
255 | 255 | // Increase sale of new give form. |
256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
257 | 257 | $new_form->increase_sales(); |
258 | - $new_form->increase_earnings( $new_total ); |
|
258 | + $new_form->increase_earnings($new_total); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Re setup payment to update new meta value in object. |
262 | - $payment->update_payment_setup( $payment->ID ); |
|
262 | + $payment->update_payment_setup($payment->ID); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | // Update price id if current form is variable form. |
266 | 266 | /* @var Give_Donate_Form $form */ |
267 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
267 | + $form = new Give_Donate_Form($payment->form_id); |
|
268 | 268 | |
269 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
269 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
270 | 270 | |
271 | 271 | // Get payment meta data. |
272 | 272 | $payment_meta = $payment->get_meta(); |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $price_id = ''; |
276 | 276 | |
277 | 277 | // Get price info |
278 | - if( 0 <= $data['give-variable-price'] ) { |
|
279 | - foreach ( $form->prices as $variable_price ) { |
|
280 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
278 | + if (0 <= $data['give-variable-price']) { |
|
279 | + foreach ($form->prices as $variable_price) { |
|
280 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
281 | 281 | $price_info = $variable_price; |
282 | 282 | break; |
283 | 283 | } |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | // Set price id. |
288 | - if( ! empty( $price_info ) ) { |
|
288 | + if ( ! empty($price_info)) { |
|
289 | 289 | $price_id = $data['give-variable-price']; |
290 | 290 | |
291 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
291 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
292 | 292 | // Set price id to amount match. |
293 | 293 | $price_id = $price_info['_give_id']['level_id']; |
294 | 294 | } |
295 | 295 | |
296 | - } elseif( $form->is_custom_price_mode() ){ |
|
296 | + } elseif ($form->is_custom_price_mode()) { |
|
297 | 297 | $price_id = 'custom'; |
298 | 298 | } |
299 | 299 | |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | $payment_meta['price_id'] = $price_id; |
302 | 302 | |
303 | 303 | // Update payment give form meta data. |
304 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
305 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
304 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
305 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
306 | 306 | |
307 | 307 | // Re setup payment to update new meta value in object. |
308 | - $payment->update_payment_setup( $payment->ID ); |
|
308 | + $payment->update_payment_setup($payment->ID); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @param int $payment_id The ID of the payment. |
318 | 318 | */ |
319 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
319 | + do_action('give_updated_edited_donation', $payment_id); |
|
320 | 320 | |
321 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
321 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
322 | 322 | exit; |
323 | 323 | } |
324 | 324 | |
325 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
325 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Trigger a Donation Deletion. |
@@ -333,48 +333,48 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @return void |
335 | 335 | */ |
336 | -function give_trigger_donation_delete( $data ) { |
|
337 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
336 | +function give_trigger_donation_delete($data) { |
|
337 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
338 | 338 | |
339 | - $payment_id = absint( $data['purchase_id'] ); |
|
339 | + $payment_id = absint($data['purchase_id']); |
|
340 | 340 | |
341 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
342 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
341 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
342 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
343 | 343 | } |
344 | 344 | |
345 | - give_delete_donation( $payment_id ); |
|
346 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
345 | + give_delete_donation($payment_id); |
|
346 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
347 | 347 | give_die(); |
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
351 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * AJAX Store Donation Note |
355 | 355 | */ |
356 | 356 | function give_ajax_store_payment_note() { |
357 | 357 | |
358 | - $payment_id = absint( $_POST['payment_id'] ); |
|
359 | - $note = wp_kses( $_POST['note'], array() ); |
|
358 | + $payment_id = absint($_POST['payment_id']); |
|
359 | + $note = wp_kses($_POST['note'], array()); |
|
360 | 360 | |
361 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
362 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
361 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
362 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
363 | 363 | } |
364 | 364 | |
365 | - if ( empty( $payment_id ) ) { |
|
366 | - die( '-1' ); |
|
365 | + if (empty($payment_id)) { |
|
366 | + die('-1'); |
|
367 | 367 | } |
368 | 368 | |
369 | - if ( empty( $note ) ) { |
|
370 | - die( '-1' ); |
|
369 | + if (empty($note)) { |
|
370 | + die('-1'); |
|
371 | 371 | } |
372 | 372 | |
373 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
374 | - die( give_get_payment_note_html( $note_id ) ); |
|
373 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
374 | + die(give_get_payment_note_html($note_id)); |
|
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
377 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Triggers a donation note deletion without ajax |
@@ -385,24 +385,24 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @return void |
387 | 387 | */ |
388 | -function give_trigger_payment_note_deletion( $data ) { |
|
388 | +function give_trigger_payment_note_deletion($data) { |
|
389 | 389 | |
390 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
390 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
391 | 391 | return; |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
395 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
394 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
395 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
396 | 396 | } |
397 | 397 | |
398 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
398 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
399 | 399 | |
400 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
400 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
401 | 401 | |
402 | - wp_redirect( $edit_order_url ); |
|
402 | + wp_redirect($edit_order_url); |
|
403 | 403 | } |
404 | 404 | |
405 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
405 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Delete a payment note deletion with ajax |
@@ -413,16 +413,16 @@ discard block |
||
413 | 413 | */ |
414 | 414 | function give_ajax_delete_payment_note() { |
415 | 415 | |
416 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
417 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
416 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
417 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
418 | 418 | } |
419 | 419 | |
420 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
421 | - die( '1' ); |
|
420 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
421 | + die('1'); |
|
422 | 422 | } else { |
423 | - die( '-1' ); |
|
423 | + die('-1'); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | } |
427 | 427 | |
428 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
428 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | * @version 1.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } // Exit if accessed directly. |
12 | 12 | |
13 | 13 | // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
14 | -$body = " |
|
14 | +$body = " |
|
15 | 15 | background-color: #f6f6f6; |
16 | 16 | font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; |
17 | 17 | "; |
18 | -$wrapper = " |
|
18 | +$wrapper = " |
|
19 | 19 | width:100%; |
20 | 20 | -webkit-text-size-adjust:none !important; |
21 | 21 | margin:0; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | text-align: center; |
43 | 43 | vertical-align:middle; |
44 | 44 | "; |
45 | -$body_content = " |
|
45 | +$body_content = " |
|
46 | 46 | border-radius:3px !important; |
47 | 47 | font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; |
48 | 48 | "; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | line-height:150%; |
54 | 54 | text-align:left; |
55 | 55 | "; |
56 | -$header_content_h1 = " |
|
56 | +$header_content_h1 = " |
|
57 | 57 | color: #000000; |
58 | 58 | margin:0; |
59 | 59 | padding: 28px 24px; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | font-weight: 500; |
64 | 64 | line-height: 1.2; |
65 | 65 | "; |
66 | -$header_img = give_get_option( 'email_logo', '' ); |
|
66 | +$header_img = give_get_option('email_logo', ''); |
|
67 | 67 | ?> |
68 | 68 | <!DOCTYPE html> |
69 | 69 | <html> |
70 | 70 | <head> |
71 | 71 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
72 | - <title><?php echo get_bloginfo( 'name' ); ?></title> |
|
72 | + <title><?php echo get_bloginfo('name'); ?></title> |
|
73 | 73 | </head> |
74 | 74 | <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="<?php echo $body; ?>"> |
75 | 75 | <div style="<?php echo $wrapper; ?>"> |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | <tr> |
78 | 78 | <td align="center" valign="top"> |
79 | 79 | <?php |
80 | - if ( ! empty( $header_img ) ) : ?> |
|
80 | + if ( ! empty($header_img)) : ?> |
|
81 | 81 | <div id="template_header_image"> |
82 | - <?php echo '<p style="margin-top:0;"><img style="' . $template_image . '" src="' . esc_url( $header_img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>'; ?> |
|
82 | + <?php echo '<p style="margin-top:0;"><img style="'.$template_image.'" src="'.esc_url($header_img).'" alt="'.get_bloginfo('name').'" /></p>'; ?> |
|
83 | 83 | </div> |
84 | 84 | <?php endif; ?> |
85 | 85 | <table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container" style="<?php echo $template_container; ?>"> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @version 1.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
9 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly. |
|
10 | 10 | |
11 | 11 | // {email} is replaced by the content entered in Donations > Settings > Emails |
12 | 12 |
@@ -6,7 +6,10 @@ |
||
6 | 6 | * @version 1.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
10 | + exit; |
|
11 | +} |
|
12 | +// Exit if accessed directly. |
|
10 | 13 | |
11 | 14 | // {email} is replaced by the content entered in Donations > Settings > Emails |
12 | 15 |
@@ -39,8 +39,8 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
42 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
|
43 | - && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
42 | + || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
|
43 | + && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
44 | 44 | ) { |
45 | 45 | |
46 | 46 | $forms_singular_option = give_get_option( 'forms_singular' ); |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | * @return void |
20 | 20 | */ |
21 | 21 | function give_disable_mandrill_nl2br() { |
22 | - add_filter( 'mandrill_nl2br', '__return_false' ); |
|
22 | + add_filter('mandrill_nl2br', '__return_false'); |
|
23 | 23 | } |
24 | 24 | |
25 | -add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' ); |
|
25 | +add_action('give_email_send_before', 'give_disable_mandrill_nl2br'); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -34,30 +34,30 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function give_clear_seo_sitemap_cache_on_settings_change() { |
36 | 36 | // Load required file if the fn 'is_plugin_active' doesn't exists. |
37 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
38 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
37 | + if ( ! function_exists('is_plugin_active')) { |
|
38 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
39 | 39 | } |
40 | 40 | |
41 | - if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
|
42 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
|
43 | - && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
41 | + if ((is_plugin_active('wordpress-seo/wp-seo.php') |
|
42 | + || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) |
|
43 | + && class_exists('WPSEO_Sitemaps_Cache') |
|
44 | 44 | ) { |
45 | 45 | |
46 | - $forms_singular_option = give_get_option( 'forms_singular' ); |
|
47 | - $forms_archive_option = give_get_option( 'forms_singular' ); |
|
46 | + $forms_singular_option = give_get_option('forms_singular'); |
|
47 | + $forms_archive_option = give_get_option('forms_singular'); |
|
48 | 48 | |
49 | 49 | // If there is change detected for Single Form View and Form Archives options then proceed. |
50 | 50 | if ( |
51 | - ( isset( $_POST['forms_singular'] ) && $_POST['forms_singular'] !== $forms_singular_option ) || |
|
52 | - ( isset( $_POST['forms_archives'] ) && $_POST['forms_archives'] !== $forms_archive_option ) |
|
51 | + (isset($_POST['forms_singular']) && $_POST['forms_singular'] !== $forms_singular_option) || |
|
52 | + (isset($_POST['forms_archives']) && $_POST['forms_archives'] !== $forms_archive_option) |
|
53 | 53 | ) { |
54 | 54 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
55 | 55 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
56 | - if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) { |
|
56 | + if (method_exists($yoast_sitemaps_cache, 'clear')) { |
|
57 | 57 | WPSEO_Sitemaps_Cache::clear(); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' ); |
|
63 | +add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change'); |
@@ -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,36 +23,36 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | // Give Forms single post and archive options. |
26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
28 | 28 | |
29 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
29 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
30 | 30 | // Support for old 'GIVE_FORMS_SLUG' constant |
31 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
31 | + if (defined('GIVE_FORMS_SLUG')) { |
|
32 | 32 | $give_forms_slug = GIVE_FORMS_SLUG; |
33 | 33 | } |
34 | 34 | |
35 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
35 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | 36 | 'slug' => $give_forms_slug, |
37 | 37 | 'with_front' => false, |
38 | 38 | ); |
39 | 39 | |
40 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
41 | - 'name' => __( 'Donation Forms', 'give' ), |
|
42 | - 'singular_name' => __( 'Form', 'give' ), |
|
43 | - 'add_new' => __( 'Add Form', 'give' ), |
|
44 | - 'add_new_item' => __( 'Add New Donation Form', 'give' ), |
|
45 | - 'edit_item' => __( 'Edit Donation Form', 'give' ), |
|
46 | - 'new_item' => __( 'New Form', 'give' ), |
|
47 | - 'all_items' => __( 'All Forms', 'give' ), |
|
48 | - 'view_item' => __( 'View Form', 'give' ), |
|
49 | - 'search_items' => __( 'Search Forms', 'give' ), |
|
50 | - 'not_found' => __( 'No forms found.', 'give' ), |
|
51 | - 'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ), |
|
40 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
41 | + 'name' => __('Donation Forms', 'give'), |
|
42 | + 'singular_name' => __('Form', 'give'), |
|
43 | + 'add_new' => __('Add Form', 'give'), |
|
44 | + 'add_new_item' => __('Add New Donation Form', 'give'), |
|
45 | + 'edit_item' => __('Edit Donation Form', 'give'), |
|
46 | + 'new_item' => __('New Form', 'give'), |
|
47 | + 'all_items' => __('All Forms', 'give'), |
|
48 | + 'view_item' => __('View Form', 'give'), |
|
49 | + 'search_items' => __('Search Forms', 'give'), |
|
50 | + 'not_found' => __('No forms found.', 'give'), |
|
51 | + 'not_found_in_trash' => __('No forms found in Trash.', 'give'), |
|
52 | 52 | 'parent_item_colon' => '', |
53 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
54 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ), |
|
55 | - ) ); |
|
53 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
54 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')), |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | // Default give_forms supports. |
58 | 58 | $give_form_supports = array( |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | // Has the user disabled the excerpt? |
67 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
68 | - unset( $give_form_supports[2] ); |
|
67 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
68 | + unset($give_form_supports[2]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Has user disabled the featured image? |
72 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
73 | - unset( $give_form_supports[1] ); |
|
74 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
72 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
73 | + unset($give_form_supports[1]); |
|
74 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $give_forms_args = array( |
@@ -86,42 +86,42 @@ discard block |
||
86 | 86 | 'has_archive' => $give_forms_archives, |
87 | 87 | 'menu_icon' => 'dashicons-give', |
88 | 88 | 'hierarchical' => false, |
89 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
89 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
90 | 90 | ); |
91 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
91 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
92 | 92 | |
93 | 93 | /** Donation Post Type */ |
94 | 94 | $payment_labels = array( |
95 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
96 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
97 | - 'add_new' => __( 'Add New', 'give' ), |
|
98 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
99 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
100 | - 'new_item' => __( 'New Donation', 'give' ), |
|
101 | - 'all_items' => __( 'All Donations', 'give' ), |
|
102 | - 'view_item' => __( 'View Donation', 'give' ), |
|
103 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
104 | - 'not_found' => __( 'No donations found.', 'give' ), |
|
105 | - 'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ), |
|
95 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
96 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
97 | + 'add_new' => __('Add New', 'give'), |
|
98 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
99 | + 'edit_item' => __('Edit Donation', 'give'), |
|
100 | + 'new_item' => __('New Donation', 'give'), |
|
101 | + 'all_items' => __('All Donations', 'give'), |
|
102 | + 'view_item' => __('View Donation', 'give'), |
|
103 | + 'search_items' => __('Search Donations', 'give'), |
|
104 | + 'not_found' => __('No donations found.', 'give'), |
|
105 | + 'not_found_in_trash' => __('No donations found in Trash.', 'give'), |
|
106 | 106 | 'parent_item_colon' => '', |
107 | - 'menu_name' => __( 'Donations', 'give' ), |
|
107 | + 'menu_name' => __('Donations', 'give'), |
|
108 | 108 | ); |
109 | 109 | |
110 | 110 | $payment_args = array( |
111 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
111 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
112 | 112 | 'public' => false, |
113 | 113 | 'query_var' => false, |
114 | 114 | 'rewrite' => false, |
115 | 115 | 'map_meta_cap' => true, |
116 | 116 | 'capability_type' => 'give_payment', |
117 | - 'supports' => array( 'title' ), |
|
117 | + 'supports' => array('title'), |
|
118 | 118 | 'can_export' => true, |
119 | 119 | ); |
120 | - register_post_type( 'give_payment', $payment_args ); |
|
120 | + register_post_type('give_payment', $payment_args); |
|
121 | 121 | |
122 | 122 | } |
123 | 123 | |
124 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
124 | +add_action('init', 'give_setup_post_types', 1); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | /** |
@@ -134,30 +134,30 @@ discard block |
||
134 | 134 | */ |
135 | 135 | function give_setup_taxonomies() { |
136 | 136 | |
137 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
137 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
138 | 138 | |
139 | 139 | /** Categories */ |
140 | 140 | $category_labels = array( |
141 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
142 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
143 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
144 | - 'all_items' => __( 'All Categories', 'give' ), |
|
145 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
146 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
147 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
148 | - 'update_item' => __( 'Update Category', 'give' ), |
|
149 | - 'add_new_item' => __( 'Add New Category', 'give' ), |
|
150 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
151 | - 'menu_name' => __( 'Categories', 'give' ), |
|
141 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
142 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
143 | + 'search_items' => __('Search Categories', 'give'), |
|
144 | + 'all_items' => __('All Categories', 'give'), |
|
145 | + 'parent_item' => __('Parent Category', 'give'), |
|
146 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
147 | + 'edit_item' => __('Edit Category', 'give'), |
|
148 | + 'update_item' => __('Update Category', 'give'), |
|
149 | + 'add_new_item' => __('Add New Category', 'give'), |
|
150 | + 'new_item_name' => __('New Category Name', 'give'), |
|
151 | + 'menu_name' => __('Categories', 'give'), |
|
152 | 152 | ); |
153 | 153 | |
154 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
154 | + $category_args = apply_filters('give_forms_category_args', array( |
|
155 | 155 | 'hierarchical' => true, |
156 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
156 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
157 | 157 | 'show_ui' => true, |
158 | 158 | 'query_var' => 'give_forms_category', |
159 | 159 | 'rewrite' => array( |
160 | - 'slug' => $slug . '/category', |
|
160 | + 'slug' => $slug.'/category', |
|
161 | 161 | 'with_front' => false, |
162 | 162 | 'hierarchical' => true, |
163 | 163 | ), |
@@ -171,33 +171,33 @@ discard block |
||
171 | 171 | ); |
172 | 172 | |
173 | 173 | // Does the user want categories? |
174 | - if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
175 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
176 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
174 | + if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
175 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
176 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** Tags */ |
180 | 180 | $tag_labels = array( |
181 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
182 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
183 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
184 | - 'all_items' => __( 'All Tags', 'give' ), |
|
185 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
186 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
187 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
188 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
189 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
190 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
191 | - 'menu_name' => __( 'Tags', 'give' ), |
|
192 | - 'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ), |
|
181 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
182 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
183 | + 'search_items' => __('Search Tags', 'give'), |
|
184 | + 'all_items' => __('All Tags', 'give'), |
|
185 | + 'parent_item' => __('Parent Tag', 'give'), |
|
186 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
187 | + 'edit_item' => __('Edit Tag', 'give'), |
|
188 | + 'update_item' => __('Update Tag', 'give'), |
|
189 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
190 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
191 | + 'menu_name' => __('Tags', 'give'), |
|
192 | + 'choose_from_most_used' => __('Choose from most used tags.', 'give'), |
|
193 | 193 | ); |
194 | 194 | |
195 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
195 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
196 | 196 | 'hierarchical' => false, |
197 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
197 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
198 | 198 | 'show_ui' => true, |
199 | 199 | 'query_var' => 'give_forms_tag', |
200 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
200 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
201 | 201 | 'capabilities' => array( |
202 | 202 | 'manage_terms' => 'manage_give_form_terms', |
203 | 203 | 'edit_terms' => 'edit_give_form_terms', |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | ) |
208 | 208 | ); |
209 | 209 | |
210 | - if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
211 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
212 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
210 | + if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
211 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
212 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | } |
216 | 216 | |
217 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
217 | +add_action('init', 'give_setup_taxonomies', 0); |
|
218 | 218 | |
219 | 219 | |
220 | 220 | /** |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | */ |
226 | 226 | function give_get_default_form_labels() { |
227 | 227 | $defaults = array( |
228 | - 'singular' => __( 'Form', 'give' ), |
|
229 | - 'plural' => __( 'Forms', 'give' ), |
|
228 | + 'singular' => __('Form', 'give'), |
|
229 | + 'plural' => __('Forms', 'give'), |
|
230 | 230 | ); |
231 | 231 | |
232 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
232 | + return apply_filters('give_default_form_name', $defaults); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return string $defaults['singular'] Singular label |
243 | 243 | */ |
244 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
244 | +function give_get_forms_label_singular($lowercase = false) { |
|
245 | 245 | $defaults = give_get_default_form_labels(); |
246 | 246 | |
247 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
247 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * @since 1.0 |
254 | 254 | * @return string $defaults['plural'] Plural label |
255 | 255 | */ |
256 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
256 | +function give_get_forms_label_plural($lowercase = false) { |
|
257 | 257 | $defaults = give_get_default_form_labels(); |
258 | 258 | |
259 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
259 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -268,24 +268,24 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return string $title New placeholder text |
270 | 270 | */ |
271 | -function give_change_default_title( $title ) { |
|
271 | +function give_change_default_title($title) { |
|
272 | 272 | // If a frontend plugin uses this filter (check extensions before changing this function) |
273 | - if ( ! is_admin() ) { |
|
274 | - $title = __( 'Enter form title here', 'give' ); |
|
273 | + if ( ! is_admin()) { |
|
274 | + $title = __('Enter form title here', 'give'); |
|
275 | 275 | |
276 | 276 | return $title; |
277 | 277 | } |
278 | 278 | |
279 | 279 | $screen = get_current_screen(); |
280 | 280 | |
281 | - if ( 'give_forms' == $screen->post_type ) { |
|
282 | - $title = __( 'Enter form title here', 'give' ); |
|
281 | + if ('give_forms' == $screen->post_type) { |
|
282 | + $title = __('Enter form title here', 'give'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | return $title; |
286 | 286 | } |
287 | 287 | |
288 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
288 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Registers Custom Post Statuses which are used by the Payments |
@@ -295,67 +295,67 @@ discard block |
||
295 | 295 | */ |
296 | 296 | function give_register_post_type_statuses() { |
297 | 297 | // Payment Statuses |
298 | - register_post_status( 'refunded', array( |
|
299 | - 'label' => __( 'Refunded', 'give' ), |
|
298 | + register_post_status('refunded', array( |
|
299 | + 'label' => __('Refunded', 'give'), |
|
300 | 300 | 'public' => true, |
301 | 301 | 'exclude_from_search' => false, |
302 | 302 | 'show_in_admin_all_list' => true, |
303 | 303 | 'show_in_admin_status_list' => true, |
304 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
305 | - ) ); |
|
306 | - register_post_status( 'failed', array( |
|
307 | - 'label' => __( 'Failed', 'give' ), |
|
304 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
305 | + )); |
|
306 | + register_post_status('failed', array( |
|
307 | + 'label' => __('Failed', 'give'), |
|
308 | 308 | 'public' => true, |
309 | 309 | 'exclude_from_search' => false, |
310 | 310 | 'show_in_admin_all_list' => true, |
311 | 311 | 'show_in_admin_status_list' => true, |
312 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
313 | - ) ); |
|
314 | - register_post_status( 'revoked', array( |
|
315 | - 'label' => __( 'Revoked', 'give' ), |
|
312 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
313 | + )); |
|
314 | + register_post_status('revoked', array( |
|
315 | + 'label' => __('Revoked', 'give'), |
|
316 | 316 | 'public' => true, |
317 | 317 | 'exclude_from_search' => false, |
318 | 318 | 'show_in_admin_all_list' => true, |
319 | 319 | 'show_in_admin_status_list' => true, |
320 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
321 | - ) ); |
|
322 | - register_post_status( 'cancelled', array( |
|
323 | - 'label' => __( 'Cancelled', 'give' ), |
|
320 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
321 | + )); |
|
322 | + register_post_status('cancelled', array( |
|
323 | + 'label' => __('Cancelled', 'give'), |
|
324 | 324 | 'public' => true, |
325 | 325 | 'exclude_from_search' => false, |
326 | 326 | 'show_in_admin_all_list' => true, |
327 | 327 | 'show_in_admin_status_list' => true, |
328 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
329 | - ) ); |
|
330 | - register_post_status( 'abandoned', array( |
|
331 | - 'label' => __( 'Abandoned', 'give' ), |
|
328 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
329 | + )); |
|
330 | + register_post_status('abandoned', array( |
|
331 | + 'label' => __('Abandoned', 'give'), |
|
332 | 332 | 'public' => true, |
333 | 333 | 'exclude_from_search' => false, |
334 | 334 | 'show_in_admin_all_list' => true, |
335 | 335 | 'show_in_admin_status_list' => true, |
336 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
337 | - ) ); |
|
338 | - register_post_status( 'processing', array( |
|
339 | - 'label' => _x( 'Processing', 'Processing payment status', 'give' ), |
|
336 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
337 | + )); |
|
338 | + register_post_status('processing', array( |
|
339 | + 'label' => _x('Processing', 'Processing payment status', 'give'), |
|
340 | 340 | 'public' => true, |
341 | 341 | 'exclude_from_search' => false, |
342 | 342 | 'show_in_admin_all_list' => true, |
343 | 343 | 'show_in_admin_status_list' => true, |
344 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' ) |
|
345 | - ) ); |
|
344 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give') |
|
345 | + )); |
|
346 | 346 | |
347 | - register_post_status( 'preapproval', array( |
|
348 | - 'label' => _x( 'Preapproval', 'Preapproval payment status', 'give' ), |
|
347 | + register_post_status('preapproval', array( |
|
348 | + 'label' => _x('Preapproval', 'Preapproval payment status', 'give'), |
|
349 | 349 | 'public' => true, |
350 | 350 | 'exclude_from_search' => false, |
351 | 351 | 'show_in_admin_all_list' => true, |
352 | 352 | 'show_in_admin_status_list' => true, |
353 | - 'label_count' => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ), |
|
354 | - ) ); |
|
353 | + 'label_count' => _n_noop('Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give'), |
|
354 | + )); |
|
355 | 355 | |
356 | 356 | } |
357 | 357 | |
358 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
358 | +add_action('init', 'give_register_post_type_statuses'); |
|
359 | 359 | |
360 | 360 | /** |
361 | 361 | * Updated Messages |
@@ -368,27 +368,27 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return array $messages New post updated messages |
370 | 370 | */ |
371 | -function give_updated_messages( $messages ) { |
|
371 | +function give_updated_messages($messages) { |
|
372 | 372 | global $post, $post_ID; |
373 | 373 | |
374 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) { |
|
374 | + if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) { |
|
375 | 375 | |
376 | 376 | $messages['give_forms'] = array( |
377 | - 1 => __( 'Form updated.', 'give' ), |
|
378 | - 4 => __( 'Form updated.', 'give' ), |
|
379 | - 6 => __( 'Form published.', 'give' ), |
|
380 | - 7 => __( 'Form saved.', 'give' ), |
|
381 | - 8 => __( 'Form submitted.', 'give' ), |
|
377 | + 1 => __('Form updated.', 'give'), |
|
378 | + 4 => __('Form updated.', 'give'), |
|
379 | + 6 => __('Form published.', 'give'), |
|
380 | + 7 => __('Form saved.', 'give'), |
|
381 | + 8 => __('Form submitted.', 'give'), |
|
382 | 382 | ); |
383 | 383 | |
384 | 384 | } else { |
385 | 385 | |
386 | 386 | $messages['give_forms'] = array( |
387 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
388 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
389 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
390 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
391 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
387 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
388 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
389 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
390 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
391 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
392 | 392 | ); |
393 | 393 | |
394 | 394 | } |
@@ -396,24 +396,24 @@ discard block |
||
396 | 396 | return $messages; |
397 | 397 | } |
398 | 398 | |
399 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
399 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Ensure post thumbnail support is turned on |
403 | 403 | */ |
404 | 404 | function give_add_thumbnail_support() { |
405 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
405 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
409 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
410 | - add_theme_support( 'post-thumbnails' ); |
|
409 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
410 | + add_theme_support('post-thumbnails'); |
|
411 | 411 | } |
412 | 412 | |
413 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
413 | + add_post_type_support('give_forms', 'thumbnail'); |
|
414 | 414 | } |
415 | 415 | |
416 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
416 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Give Sidebars |
@@ -424,21 +424,21 @@ discard block |
||
424 | 424 | |
425 | 425 | // Single Give Forms (disabled if single turned off in settings) |
426 | 426 | if ( |
427 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
428 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
427 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
428 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
429 | 429 | ) { |
430 | 430 | |
431 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
432 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
431 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
432 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
433 | 433 | 'id' => 'give-forms-sidebar', |
434 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
434 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
435 | 435 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
436 | 436 | 'after_widget' => '</div>', |
437 | 437 | 'before_title' => '<h3 class="widgettitle widget-title">', |
438 | 438 | 'after_title' => '</h3>', |
439 | - ) ) ); |
|
439 | + ))); |
|
440 | 440 | |
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
444 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | global $give_receipt_args, $payment; |
7 | 7 | |
8 | 8 | // Validation: Ensure $payment var is set. |
9 | -if ( empty( $payment ) ) { |
|
10 | - $payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0; |
|
9 | +if (empty($payment)) { |
|
10 | + $payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // Double-Validation: Check for $payment global. |
14 | -if ( empty( $payment ) ) { |
|
15 | - Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) ); |
|
14 | +if (empty($payment)) { |
|
15 | + Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give')); |
|
16 | 16 | |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $donation_id = $payment->ID; |
21 | -$form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true ); |
|
22 | -$meta = give_get_payment_meta( $donation_id ); |
|
23 | -$donation = give_get_payment_form_title( $meta ); |
|
24 | -$user = give_get_payment_meta_user_info( $donation_id ); |
|
25 | -$email = give_get_payment_user_email( $donation_id ); |
|
21 | +$form_id = give_get_payment_meta($donation_id, '_give_payment_form_id', true); |
|
22 | +$meta = give_get_payment_meta($donation_id); |
|
23 | +$donation = give_get_payment_form_title($meta); |
|
24 | +$user = give_get_payment_meta_user_info($donation_id); |
|
25 | +$email = give_get_payment_user_email($donation_id); |
|
26 | 26 | $status = $payment->post_status; |
27 | -$status_label = give_get_payment_status( $payment, true ); |
|
27 | +$status_label = give_get_payment_status($payment, true); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Generate Donation Receipt Arguments. |
@@ -34,56 +34,56 @@ discard block |
||
34 | 34 | * @since 1.8.8 |
35 | 35 | */ |
36 | 36 | $give_receipt_args['donation_receipt']['donor'] = array( |
37 | - 'name' => __( 'Donor', 'give' ), |
|
38 | - 'value' => $user['first_name'] . ' ' . $user['last_name'], |
|
37 | + 'name' => __('Donor', 'give'), |
|
38 | + 'value' => $user['first_name'].' '.$user['last_name'], |
|
39 | 39 | 'display' => $give_receipt_args['donor'], |
40 | 40 | ); |
41 | 41 | |
42 | 42 | $give_receipt_args['donation_receipt']['date'] = array( |
43 | - 'name' => __( 'Date', 'give' ), |
|
44 | - 'value' => date_i18n( give_date_format(), strtotime( $meta['date'] ) ), |
|
43 | + 'name' => __('Date', 'give'), |
|
44 | + 'value' => date_i18n(give_date_format(), strtotime($meta['date'])), |
|
45 | 45 | 'display' => $give_receipt_args['date'], |
46 | 46 | ); |
47 | 47 | |
48 | 48 | $give_receipt_args['donation_receipt']['total_donation'] = array( |
49 | - 'name' => __( 'Total Donation', 'give' ), |
|
50 | - 'value' => give_payment_amount( $donation_id ), |
|
49 | + 'name' => __('Total Donation', 'give'), |
|
50 | + 'value' => give_payment_amount($donation_id), |
|
51 | 51 | 'display' => true, |
52 | 52 | ); |
53 | 53 | |
54 | 54 | $give_receipt_args['donation_receipt']['donation'] = array( |
55 | - 'name' => __( 'Donation', 'give' ), |
|
55 | + 'name' => __('Donation', 'give'), |
|
56 | 56 | 'value' => $donation, |
57 | 57 | 'display' => true, |
58 | 58 | ); |
59 | 59 | |
60 | 60 | $give_receipt_args['donation_receipt']['donation_status'] = array( |
61 | - 'name' => __( 'Donation Status', 'give' ), |
|
62 | - 'value' => esc_attr( $status ), |
|
61 | + 'name' => __('Donation Status', 'give'), |
|
62 | + 'value' => esc_attr($status), |
|
63 | 63 | 'display' => $give_receipt_args['payment_status'], |
64 | 64 | ); |
65 | 65 | |
66 | 66 | $give_receipt_args['donation_receipt']['donation_id'] = array( |
67 | - 'name' => __( 'Donation ID', 'give' ), |
|
67 | + 'name' => __('Donation ID', 'give'), |
|
68 | 68 | 'value' => $donation_id, |
69 | - 'display' => ($give_receipt_args['payment_id'])?true:false, |
|
69 | + 'display' => ($give_receipt_args['payment_id']) ?true:false, |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $give_receipt_args['donation_receipt']['payment_details'] = array( |
73 | - 'name' => __( 'Payment:', 'give' ), |
|
74 | - 'value' => __( 'Details:', 'give' ), |
|
75 | - 'display' => ($give_receipt_args['payment_id'])?false:true, |
|
73 | + 'name' => __('Payment:', 'give'), |
|
74 | + 'value' => __('Details:', 'give'), |
|
75 | + 'display' => ($give_receipt_args['payment_id']) ?false:true, |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | $give_receipt_args['donation_receipt']['payment_key'] = array( |
79 | - 'name' => __( 'Payment Key', 'give' ), |
|
80 | - 'value' => get_post_meta( $donation_id, '_give_payment_purchase_key', true ), |
|
79 | + 'name' => __('Payment Key', 'give'), |
|
80 | + 'value' => get_post_meta($donation_id, '_give_payment_purchase_key', true), |
|
81 | 81 | 'display' => $give_receipt_args['payment_key'], |
82 | 82 | ); |
83 | 83 | |
84 | 84 | $give_receipt_args['donation_receipt']['payment_method'] = array( |
85 | - 'name' => __( 'Payment Method', 'give' ), |
|
86 | - 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ), |
|
85 | + 'name' => __('Payment Method', 'give'), |
|
86 | + 'value' => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)), |
|
87 | 87 | 'display' => true, |
88 | 88 | ); |
89 | 89 | |
@@ -98,49 +98,49 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @since 1.8.8 |
100 | 100 | */ |
101 | -$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id ); |
|
101 | +$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id); |
|
102 | 102 | |
103 | 103 | // Show payment status notice based on shortcode attribute. |
104 | -if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) { |
|
104 | +if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) { |
|
105 | 105 | $notice_message = ''; |
106 | 106 | $notice_type = 'warning'; |
107 | 107 | |
108 | - switch ( $status ) { |
|
108 | + switch ($status) { |
|
109 | 109 | case 'publish': |
110 | - $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' ); |
|
110 | + $notice_message = __('Payment Complete: Thank you for your donation.', 'give'); |
|
111 | 111 | $notice_type = 'success'; |
112 | 112 | break; |
113 | 113 | case 'pending': |
114 | - $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' ); |
|
114 | + $notice_message = __('Payment Pending: Your donation is currently processing.', 'give'); |
|
115 | 115 | $notice_type = 'warning'; |
116 | 116 | break; |
117 | 117 | case 'refunded': |
118 | - $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' ); |
|
118 | + $notice_message = __('Payment Refunded: Your donation has been refunded.', 'give'); |
|
119 | 119 | $notice_type = 'warning'; |
120 | 120 | break; |
121 | 121 | case 'preapproval': |
122 | - $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' ); |
|
122 | + $notice_message = __('Payment Preapproved: Thank you for your donation.', 'give'); |
|
123 | 123 | $notice_type = 'warning'; |
124 | 124 | break; |
125 | 125 | case 'failed': |
126 | - $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' ); |
|
126 | + $notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give'); |
|
127 | 127 | $notice_type = 'error'; |
128 | 128 | break; |
129 | 129 | case 'cancelled': |
130 | - $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' ); |
|
130 | + $notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give'); |
|
131 | 131 | $notice_type = 'error'; |
132 | 132 | break; |
133 | 133 | case 'abandoned': |
134 | - $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' ); |
|
134 | + $notice_message = __('Payment Abandoned: This donation has not been completed.', 'give'); |
|
135 | 135 | $notice_type = 'error'; |
136 | 136 | break; |
137 | 137 | case 'revoked': |
138 | - $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' ); |
|
138 | + $notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give'); |
|
139 | 139 | $notice_type = 'error'; |
140 | 140 | break; |
141 | 141 | } |
142 | 142 | |
143 | - if ( ! empty( $notice_message ) ) { |
|
143 | + if ( ! empty($notice_message)) { |
|
144 | 144 | /** |
145 | 145 | * Filters payment status notice for receipts. |
146 | 146 | * |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $status Payment status. |
156 | 156 | * @param array $meta Array of meta data related to the payment. |
157 | 157 | */ |
158 | - echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta ); |
|
158 | + echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta); |
|
159 | 159 | } |
160 | 160 | }// End if(). |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param object $payment The payment object. |
170 | 170 | * @param array $give_receipt_args Receipt_argument. |
171 | 171 | */ |
172 | -do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args ); |
|
172 | +do_action('give_payment_receipt_before_table', $payment, $give_receipt_args); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <table id="give_donation_receipt" class="give-table"> |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param object $payment The payment object. |
186 | 186 | * @param array $give_receipt_args Receipt_argument. |
187 | 187 | */ |
188 | - do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args ); |
|
188 | + do_action('give_payment_receipt_header_before', $payment, $give_receipt_args); |
|
189 | 189 | ?> |
190 | 190 | <tr> |
191 | 191 | <th scope="colgroup" colspan="2"> |
192 | - <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span> |
|
192 | + <span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span> |
|
193 | 193 | </th> |
194 | 194 | </tr> |
195 | 195 | <?php |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param object $payment The payment object. |
204 | 204 | * @param array $give_receipt_args Receipt_argument. |
205 | 205 | */ |
206 | - do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args ); |
|
206 | + do_action('give_payment_receipt_header_after', $payment, $give_receipt_args); |
|
207 | 207 | ?> |
208 | 208 | </thead> |
209 | 209 | |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | * @param object $payment The payment object. |
220 | 220 | * @param array $give_receipt_args Receipt_argument. |
221 | 221 | */ |
222 | - do_action( 'give_payment_receipt_before', $payment, $give_receipt_args ); |
|
222 | + do_action('give_payment_receipt_before', $payment, $give_receipt_args); |
|
223 | 223 | ?> |
224 | 224 | |
225 | - <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?> |
|
226 | - <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
225 | + <?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?> |
|
226 | + <?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
227 | 227 | <tr> |
228 | 228 | <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td> |
229 | 229 | <td><?php echo $receipt_item['value']; ?></td> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param object $payment The payment object. |
243 | 243 | * @param array $give_receipt_args Receipt_argument. |
244 | 244 | */ |
245 | - do_action( 'give_payment_receipt_after', $payment, $give_receipt_args ); |
|
245 | + do_action('give_payment_receipt_after', $payment, $give_receipt_args); |
|
246 | 246 | ?> |
247 | 247 | </tbody> |
248 | 248 | </table> |
@@ -258,5 +258,5 @@ discard block |
||
258 | 258 | * @param object $payment The payment object. |
259 | 259 | * @param array $give_receipt_args Receipt_argument. |
260 | 260 | */ |
261 | -do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args ); |
|
261 | +do_action('give_payment_receipt_after_table', $payment, $give_receipt_args); |
|
262 | 262 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: https://givewp.com/documenation/ */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'https://givewp.com/documenation/' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('https://givewp.com/documenation/') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | - <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
209 | - <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
207 | + <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
208 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
209 | + <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
210 | 210 | </ul> |
211 | 211 | |
212 | 212 | </div> |
213 | 213 | |
214 | 214 | <div class="content feature-section-item last-feature"> |
215 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
215 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
217 | 217 | </div> |
218 | 218 | |
219 | 219 | </div> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | public function changelog_screen() { |
235 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
235 | + list($display_version) = explode('-', GIVE_VERSION); |
|
236 | 236 | ?> |
237 | 237 | <div class="wrap about-wrap"> |
238 | 238 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | <p class="about-text"><?php |
241 | 241 | printf( |
242 | 242 | /* translators: %s: Give version */ |
243 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
243 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
244 | 244 | $display_version |
245 | 245 | ); |
246 | 246 | ?></p> |
247 | 247 | <div class="give-badge"><?php |
248 | 248 | printf( |
249 | 249 | /* translators: %s: Give version */ |
250 | - esc_html__( 'Version %s', 'give' ), |
|
250 | + esc_html__('Version %s', 'give'), |
|
251 | 251 | $display_version |
252 | 252 | ); |
253 | 253 | ?></div> |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | <?php $this->tabs(); ?> |
256 | 256 | |
257 | 257 | <div class="changelog"> |
258 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
258 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
259 | 259 | |
260 | 260 | <div class="feature-section"> |
261 | 261 | <?php echo $this->parse_readme(); ?> |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="return-to-dashboard"> |
266 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
266 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
267 | 267 | 'post_type' => 'give_forms', |
268 | 268 | 'page' => 'give-settings' |
269 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
269 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | <?php |
@@ -280,36 +280,36 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function getting_started_screen() { |
283 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
283 | + list($display_version) = explode('-', GIVE_VERSION); |
|
284 | 284 | ?> |
285 | 285 | <div class="wrap about-wrap get-started"> |
286 | 286 | |
287 | 287 | <?php $this->get_welcome_header() ?> |
288 | 288 | |
289 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
289 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
290 | 290 | |
291 | 291 | <?php give_get_newsletter(); ?> |
292 | 292 | |
293 | 293 | <div class="give-badge"><?php |
294 | 294 | printf( |
295 | 295 | /* translators: %s: Give version */ |
296 | - esc_html__( 'Version %s', 'give' ), |
|
296 | + esc_html__('Version %s', 'give'), |
|
297 | 297 | $display_version |
298 | 298 | ); |
299 | 299 | ?></div> |
300 | 300 | |
301 | 301 | <?php $this->tabs(); ?> |
302 | 302 | |
303 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
303 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
304 | 304 | |
305 | 305 | <div class="feature-section clearfix"> |
306 | 306 | |
307 | 307 | <div class="content feature-section-item"> |
308 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
308 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
309 | 309 | |
310 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
310 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
313 | 313 | </div> |
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | </div> |
327 | 327 | |
328 | 328 | <div class="content feature-section-item last-feature"> |
329 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
329 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
330 | 330 | |
331 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
331 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
332 | 332 | </div> |
333 | 333 | |
334 | 334 | </div> |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | <div class="feature-section clearfix"> |
338 | 338 | |
339 | 339 | <div class="content feature-section-item add-content"> |
340 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
340 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
341 | 341 | |
342 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
342 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
343 | 343 | |
344 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
344 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
345 | 345 | </div> |
346 | 346 | |
347 | 347 | <div class="content feature-section-item last-feature"> |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | |
360 | 360 | <div class="content feature-section-item last-feature"> |
361 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
361 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
362 | 362 | |
363 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
363 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
364 | 364 | </div> |
365 | 365 | |
366 | 366 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function credits_screen() { |
383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
384 | 384 | ?> |
385 | 385 | <div class="wrap about-wrap"> |
386 | 386 | |
387 | 387 | <?php $this->get_welcome_header() ?> |
388 | 388 | |
389 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
389 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
390 | 390 | |
391 | 391 | <?php give_get_newsletter(); ?> |
392 | 392 | |
393 | 393 | <div class="give-badge"><?php |
394 | 394 | printf( |
395 | 395 | /* translators: %s: Give version */ |
396 | - esc_html__( 'Version %s', 'give' ), |
|
396 | + esc_html__('Version %s', 'give'), |
|
397 | 397 | $display_version |
398 | 398 | ); |
399 | 399 | ?></div> |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | <p class="about-description"><?php |
404 | 404 | printf( |
405 | 405 | /* translators: %s: https://github.com/WordImpress/give */ |
406 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
407 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
406 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
407 | + esc_url('https://github.com/WordImpress/give') |
|
408 | 408 | ); |
409 | 409 | ?></p> |
410 | 410 | |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * @return string $readme HTML formatted readme file |
422 | 422 | */ |
423 | 423 | public function parse_readme() { |
424 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
424 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
425 | 425 | |
426 | - if ( ! $file ) { |
|
427 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
426 | + if ( ! $file) { |
|
427 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
428 | 428 | } else { |
429 | - $readme = file_get_contents( $file ); |
|
430 | - $readme = nl2br( esc_html( $readme ) ); |
|
431 | - $readme = explode( '== Changelog ==', $readme ); |
|
432 | - $readme = end( $readme ); |
|
433 | - |
|
434 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
435 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
436 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
437 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
438 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
429 | + $readme = file_get_contents($file); |
|
430 | + $readme = nl2br(esc_html($readme)); |
|
431 | + $readme = explode('== Changelog ==', $readme); |
|
432 | + $readme = end($readme); |
|
433 | + |
|
434 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
435 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
436 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
437 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
438 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $readme; |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | public function contributors() { |
453 | 453 | $contributors = $this->get_contributors(); |
454 | 454 | |
455 | - if ( empty( $contributors ) ) { |
|
455 | + if (empty($contributors)) { |
|
456 | 456 | return ''; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $contributor_list = '<ul class="wp-people-group">'; |
460 | 460 | |
461 | - foreach ( $contributors as $contributor ) { |
|
461 | + foreach ($contributors as $contributor) { |
|
462 | 462 | $contributor_list .= '<li class="wp-person">'; |
463 | 463 | $contributor_list .= sprintf( |
464 | 464 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
465 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
466 | - esc_url( $contributor->avatar_url ), |
|
467 | - esc_attr( $contributor->login ) |
|
465 | + esc_url('https://github.com/'.$contributor->login), |
|
466 | + esc_url($contributor->avatar_url), |
|
467 | + esc_attr($contributor->login) |
|
468 | 468 | ); |
469 | 469 | $contributor_list .= sprintf( |
470 | 470 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
471 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
472 | - esc_html( $contributor->login ) |
|
471 | + esc_url('https://github.com/'.$contributor->login), |
|
472 | + esc_html($contributor->login) |
|
473 | 473 | ); |
474 | 474 | $contributor_list .= '</li>'; |
475 | 475 | } |
@@ -487,25 +487,25 @@ discard block |
||
487 | 487 | * @return array $contributors List of contributors |
488 | 488 | */ |
489 | 489 | public function get_contributors() { |
490 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
490 | + $contributors = Give_Cache::get('give_contributors', true); |
|
491 | 491 | |
492 | - if ( false !== $contributors ) { |
|
492 | + if (false !== $contributors) { |
|
493 | 493 | return $contributors; |
494 | 494 | } |
495 | 495 | |
496 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
496 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
497 | 497 | |
498 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
498 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
499 | 499 | return array(); |
500 | 500 | } |
501 | 501 | |
502 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
502 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
503 | 503 | |
504 | - if ( ! is_array( $contributors ) ) { |
|
504 | + if ( ! is_array($contributors)) { |
|
505 | 505 | return array(); |
506 | 506 | } |
507 | 507 | |
508 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
508 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
509 | 509 | |
510 | 510 | return $contributors; |
511 | 511 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function get_welcome_header() { |
519 | 519 | // Badge for welcome page |
520 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
520 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
521 | 521 | ?> |
522 | 522 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
523 | 523 | <?php $this->social_media_elements(); ?> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
611 | 611 | printf( |
612 | 612 | /* translators: %s: Give twitter user @givewp */ |
613 | - esc_html_e( 'Follow %s', 'give' ), |
|
613 | + esc_html_e('Follow %s', 'give'), |
|
614 | 614 | '@givewp' |
615 | 615 | ); |
616 | 616 | ?></a> |
@@ -644,27 +644,27 @@ discard block |
||
644 | 644 | public function welcome() { |
645 | 645 | |
646 | 646 | // Bail if no activation redirect |
647 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) { |
|
647 | + if ( ! Give_Cache::get('_give_activation_redirect', true)) { |
|
648 | 648 | return; |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Delete the redirect transient |
652 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
652 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
653 | 653 | |
654 | 654 | // Bail if activating from network, or bulk |
655 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
655 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | 658 | |
659 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
659 | + $upgrade = get_option('give_version_upgraded_from'); |
|
660 | 660 | |
661 | - if ( ! $upgrade ) { // First time install |
|
662 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
661 | + if ( ! $upgrade) { // First time install |
|
662 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
663 | 663 | exit; |
664 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
664 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
665 | 665 | |
666 | 666 | } else { // Welcome is NOT disabled in settings |
667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
668 | 668 | exit; |
669 | 669 | } |
670 | 670 | } |