@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | //validate display_style and float_labels value |
93 | 93 | if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
94 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
94 | + || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
95 | 95 | ) { |
96 | 96 | |
97 | 97 | $atts[ $key ] = ''; |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | */ |
170 | 170 | function give_login_form_shortcode( $atts, $content = null ) { |
171 | 171 | $atts = shortcode_atts( array( |
172 | - // Add backward compatibility for redirect attribute. |
|
173 | - 'redirect' => '', |
|
172 | + // Add backward compatibility for redirect attribute. |
|
173 | + 'redirect' => '', |
|
174 | 174 | |
175 | 175 | 'login-redirect' => '', |
176 | 176 | 'logout-redirect' => '', |
177 | 177 | ), $atts, 'give_login' ); |
178 | 178 | |
179 | - // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
|
180 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' ); |
|
179 | + // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
|
180 | + $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' ); |
|
181 | 181 | |
182 | 182 | return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
183 | 183 | } |
@@ -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,28 +25,28 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | - $email_access = give_get_option( 'email_access' ); |
|
28 | + $email_access = give_get_option('email_access'); |
|
29 | 29 | |
30 | 30 | //Is user logged in? Does a session exist? Does an email-access token exist? |
31 | - if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) { |
|
31 | + if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) { |
|
32 | 32 | ob_start(); |
33 | - give_get_template_part( 'history', 'donations' ); |
|
33 | + give_get_template_part('history', 'donations'); |
|
34 | 34 | |
35 | 35 | return ob_get_clean(); |
36 | 36 | } //Is Email-based access enabled? |
37 | - elseif ( $email_access == 'on' ) { |
|
37 | + elseif ($email_access == 'on') { |
|
38 | 38 | |
39 | 39 | ob_start(); |
40 | - give_get_template_part( 'email', 'login-form' ); |
|
40 | + give_get_template_part('email', 'login-form'); |
|
41 | 41 | |
42 | 42 | return ob_get_clean(); |
43 | 43 | } else { |
44 | - $message = esc_html__( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ); |
|
45 | - echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message ); |
|
44 | + $message = esc_html__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'); |
|
45 | + echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
49 | +add_shortcode('donation_history', 'give_donation_history'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Donation Form Shortcode |
@@ -60,53 +60,53 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | -function give_form_shortcode( $atts, $content = null ) { |
|
64 | - $atts = shortcode_atts( array( |
|
63 | +function give_form_shortcode($atts, $content = null) { |
|
64 | + $atts = shortcode_atts(array( |
|
65 | 65 | 'id' => '', |
66 | 66 | 'show_title' => true, |
67 | 67 | 'show_goal' => true, |
68 | 68 | 'show_content' => '', |
69 | 69 | 'float_labels' => '', |
70 | 70 | 'display_style' => '', |
71 | - ), $atts, 'give_form' ); |
|
71 | + ), $atts, 'give_form'); |
|
72 | 72 | |
73 | - foreach ( $atts as $key => $value ) { |
|
73 | + foreach ($atts as $key => $value) { |
|
74 | 74 | //convert shortcode_atts values to booleans |
75 | - if ( $key == 'show_title' ) { |
|
76 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
77 | - } elseif ( $key == 'show_goal' ) { |
|
78 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
75 | + if ($key == 'show_title') { |
|
76 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
77 | + } elseif ($key == 'show_goal') { |
|
78 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | //validate show_content value |
82 | - if ( $key == 'show_content' ) { |
|
83 | - if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) { |
|
84 | - $atts[ $key ] = ''; |
|
85 | - } else if ( $value == 'above' ) { |
|
86 | - $atts[ $key ] = 'give_pre_form'; |
|
87 | - } else if ( $value == 'below' ) { |
|
88 | - $atts[ $key ] = 'give_post_form'; |
|
82 | + if ($key == 'show_content') { |
|
83 | + if ( ! in_array($value, array('none', 'above', 'below'))) { |
|
84 | + $atts[$key] = ''; |
|
85 | + } else if ($value == 'above') { |
|
86 | + $atts[$key] = 'give_pre_form'; |
|
87 | + } else if ($value == 'below') { |
|
88 | + $atts[$key] = 'give_post_form'; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | //validate display_style and float_labels value |
93 | - if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
|
94 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
93 | + if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal'))) |
|
94 | + || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled'))) |
|
95 | 95 | ) { |
96 | 96 | |
97 | - $atts[ $key ] = ''; |
|
97 | + $atts[$key] = ''; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | //get the Give Form |
102 | 102 | ob_start(); |
103 | - give_get_donation_form( $atts ); |
|
103 | + give_get_donation_form($atts); |
|
104 | 104 | $final_output = ob_get_clean(); |
105 | 105 | |
106 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
106 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
107 | 107 | } |
108 | 108 | |
109 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
109 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Donation Form Goal Shortcode. |
@@ -120,37 +120,37 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | -function give_goal_shortcode( $atts, $content = null ) { |
|
124 | - $atts = shortcode_atts( array( |
|
123 | +function give_goal_shortcode($atts, $content = null) { |
|
124 | + $atts = shortcode_atts(array( |
|
125 | 125 | 'id' => '', |
126 | 126 | 'show_text' => true, |
127 | 127 | 'show_bar' => true, |
128 | - ), $atts, 'give_goal' ); |
|
128 | + ), $atts, 'give_goal'); |
|
129 | 129 | |
130 | 130 | |
131 | 131 | //get the Give Form. |
132 | 132 | ob_start(); |
133 | 133 | |
134 | 134 | //Sanity check 1: ensure there is an ID Provided. |
135 | - if ( empty( $atts['id'] ) ) { |
|
136 | - give_output_error( esc_html__( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
135 | + if (empty($atts['id'])) { |
|
136 | + give_output_error(esc_html__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | //Sanity check 2: Check the form even has Goals enabled. |
140 | - $goal_option = get_post_meta( $atts['id'], '_give_goal_option', true ); |
|
141 | - if ( empty( $goal_option ) || $goal_option !== 'yes' ) { |
|
142 | - give_output_error( esc_html__( 'The form does not have Goals enabled.', 'give' ), true ); |
|
140 | + $goal_option = get_post_meta($atts['id'], '_give_goal_option', true); |
|
141 | + if (empty($goal_option) || $goal_option !== 'yes') { |
|
142 | + give_output_error(esc_html__('The form does not have Goals enabled.', 'give'), true); |
|
143 | 143 | } else { |
144 | 144 | //Passed all sanity checks: output Goal. |
145 | - give_show_goal_progress( $atts['id'], $atts ); |
|
145 | + give_show_goal_progress($atts['id'], $atts); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | $final_output = ob_get_clean(); |
149 | 149 | |
150 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
150 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
151 | 151 | } |
152 | 152 | |
153 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
153 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | /** |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | * @uses give_login_form() |
168 | 168 | * @return string |
169 | 169 | */ |
170 | -function give_login_form_shortcode( $atts, $content = null ) { |
|
171 | - $atts = shortcode_atts( array( |
|
170 | +function give_login_form_shortcode($atts, $content = null) { |
|
171 | + $atts = shortcode_atts(array( |
|
172 | 172 | // Add backward compatibility for redirect attribute. |
173 | 173 | 'redirect' => '', |
174 | 174 | |
175 | 175 | 'login-redirect' => '', |
176 | 176 | 'logout-redirect' => '', |
177 | - ), $atts, 'give_login' ); |
|
177 | + ), $atts, 'give_login'); |
|
178 | 178 | |
179 | 179 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
180 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' ); |
|
180 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
181 | 181 | |
182 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
182 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
183 | 183 | } |
184 | 184 | |
185 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
185 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Register Shortcode. |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | * @uses give_register_form() |
198 | 198 | * @return string |
199 | 199 | */ |
200 | -function give_register_form_shortcode( $atts, $content = null ) { |
|
201 | - $atts = shortcode_atts( array( |
|
200 | +function give_register_form_shortcode($atts, $content = null) { |
|
201 | + $atts = shortcode_atts(array( |
|
202 | 202 | 'redirect' => '', |
203 | - ), $atts, 'give_register' ); |
|
203 | + ), $atts, 'give_register'); |
|
204 | 204 | |
205 | - return give_register_form( $atts['redirect'] ); |
|
205 | + return give_register_form($atts['redirect']); |
|
206 | 206 | } |
207 | 207 | |
208 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
208 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
209 | 209 | |
210 | 210 | |
211 | 211 | /** |
@@ -220,62 +220,62 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | -function give_receipt_shortcode( $atts, $content = null ) { |
|
223 | +function give_receipt_shortcode($atts, $content = null) { |
|
224 | 224 | |
225 | 225 | global $give_receipt_args, $payment; |
226 | 226 | |
227 | - $give_receipt_args = shortcode_atts( array( |
|
228 | - 'error' => esc_html__( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
227 | + $give_receipt_args = shortcode_atts(array( |
|
228 | + 'error' => esc_html__('You are missing the payment key to view this donation receipt.', 'give'), |
|
229 | 229 | 'price' => true, |
230 | 230 | 'donor' => true, |
231 | 231 | 'date' => true, |
232 | 232 | 'payment_key' => false, |
233 | 233 | 'payment_method' => true, |
234 | 234 | 'payment_id' => true |
235 | - ), $atts, 'give_receipt' ); |
|
235 | + ), $atts, 'give_receipt'); |
|
236 | 236 | |
237 | 237 | //set $session var |
238 | 238 | $session = give_get_purchase_session(); |
239 | 239 | |
240 | 240 | //set payment key var |
241 | - if ( isset( $_GET['payment_key'] ) ) { |
|
242 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
243 | - } elseif ( $session ) { |
|
241 | + if (isset($_GET['payment_key'])) { |
|
242 | + $payment_key = urldecode($_GET['payment_key']); |
|
243 | + } elseif ($session) { |
|
244 | 244 | $payment_key = $session['purchase_key']; |
245 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
245 | + } elseif ($give_receipt_args['payment_key']) { |
|
246 | 246 | $payment_key = $give_receipt_args['payment_key']; |
247 | 247 | } |
248 | 248 | |
249 | - $email_access = give_get_option( 'email_access' ); |
|
249 | + $email_access = give_get_option('email_access'); |
|
250 | 250 | |
251 | 251 | // No payment_key found & Email Access is Turned on: |
252 | - if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
252 | + if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
253 | 253 | |
254 | 254 | ob_start(); |
255 | 255 | |
256 | - give_get_template_part( 'email-login-form' ); |
|
256 | + give_get_template_part('email-login-form'); |
|
257 | 257 | |
258 | 258 | return ob_get_clean(); |
259 | 259 | |
260 | - } elseif ( ! isset( $payment_key ) ) { |
|
260 | + } elseif ( ! isset($payment_key)) { |
|
261 | 261 | |
262 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
262 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
263 | 263 | |
264 | 264 | } |
265 | 265 | |
266 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
267 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
266 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
267 | + $user_can_view = give_can_view_receipt($payment_key); |
|
268 | 268 | |
269 | 269 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
270 | - if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
270 | + if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
271 | 271 | |
272 | 272 | ob_start(); |
273 | 273 | |
274 | - give_get_template_part( 'email-login-form' ); |
|
274 | + give_get_template_part('email-login-form'); |
|
275 | 275 | |
276 | 276 | return ob_get_clean(); |
277 | 277 | |
278 | - } elseif ( ! $user_can_view ) { |
|
278 | + } elseif ( ! $user_can_view) { |
|
279 | 279 | |
280 | 280 | global $give_login_redirect; |
281 | 281 | |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | |
284 | 284 | ob_start(); |
285 | 285 | |
286 | - give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
286 | + give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation receipt.', 'give'))); |
|
287 | 287 | |
288 | - give_get_template_part( 'shortcode', 'login' ); |
|
288 | + give_get_template_part('shortcode', 'login'); |
|
289 | 289 | |
290 | 290 | $login_form = ob_get_clean(); |
291 | 291 | |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | * or if user is logged in and the user can view sensitive shop data. |
301 | 301 | * |
302 | 302 | */ |
303 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
304 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
303 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
304 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | ob_start(); |
308 | 308 | |
309 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
309 | + give_get_template_part('shortcode', 'receipt'); |
|
310 | 310 | |
311 | 311 | $display = ob_get_clean(); |
312 | 312 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | } |
317 | 317 | |
318 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
318 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Profile Editor Shortcode. |
@@ -335,18 +335,18 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @return string Output generated from the profile editor |
337 | 337 | */ |
338 | -function give_profile_editor_shortcode( $atts, $content = null ) { |
|
338 | +function give_profile_editor_shortcode($atts, $content = null) { |
|
339 | 339 | |
340 | 340 | ob_start(); |
341 | 341 | |
342 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
342 | + give_get_template_part('shortcode', 'profile-editor'); |
|
343 | 343 | |
344 | 344 | $display = ob_get_clean(); |
345 | 345 | |
346 | 346 | return $display; |
347 | 347 | } |
348 | 348 | |
349 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
349 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Process Profile Updater Form. |
@@ -359,30 +359,30 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return bool |
361 | 361 | */ |
362 | -function give_process_profile_editor_updates( $data ) { |
|
362 | +function give_process_profile_editor_updates($data) { |
|
363 | 363 | // Profile field change request |
364 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
364 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
365 | 365 | return false; |
366 | 366 | } |
367 | 367 | |
368 | 368 | // Nonce security |
369 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
369 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | |
373 | 373 | $user_id = get_current_user_id(); |
374 | - $old_user_data = get_userdata( $user_id ); |
|
375 | - |
|
376 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
377 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
378 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
379 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
380 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
381 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
382 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
383 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
384 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
385 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
374 | + $old_user_data = get_userdata($user_id); |
|
375 | + |
|
376 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
377 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
378 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
379 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
380 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
381 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
382 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
383 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
384 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
385 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
386 | 386 | |
387 | 387 | $userdata = array( |
388 | 388 | 'ID' => $user_id, |
@@ -410,38 +410,38 @@ discard block |
||
410 | 410 | * @param int $user_id The ID of the user. |
411 | 411 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
412 | 412 | */ |
413 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
413 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
414 | 414 | |
415 | 415 | // New password |
416 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
417 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
418 | - give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
416 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
417 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
418 | + give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give')); |
|
419 | 419 | } else { |
420 | 420 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
424 | 424 | // Make sure the new email doesn't belong to another user |
425 | - if ( $email != $old_user_data->user_email ) { |
|
426 | - if ( email_exists( $email ) ) { |
|
427 | - give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
425 | + if ($email != $old_user_data->user_email) { |
|
426 | + if (email_exists($email)) { |
|
427 | + give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give')); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | 431 | // Check for errors |
432 | 432 | $errors = give_get_errors(); |
433 | 433 | |
434 | - if ( $errors ) { |
|
434 | + if ($errors) { |
|
435 | 435 | // Send back to the profile editor if there are errors |
436 | - wp_redirect( $data['give_redirect'] ); |
|
436 | + wp_redirect($data['give_redirect']); |
|
437 | 437 | give_die(); |
438 | 438 | } |
439 | 439 | |
440 | 440 | // Update the user |
441 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
442 | - $updated = wp_update_user( $userdata ); |
|
441 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
442 | + $updated = wp_update_user($userdata); |
|
443 | 443 | |
444 | - if ( $updated ) { |
|
444 | + if ($updated) { |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Fires after updating user profile. |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | * @param int $user_id The ID of the user. |
452 | 452 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
453 | 453 | */ |
454 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
455 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
454 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
455 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
456 | 456 | give_die(); |
457 | 457 | } |
458 | 458 | |
459 | 459 | return false; |
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
462 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
|
463 | 463 |
@@ -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,13 +23,13 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return bool true if has variable prices, false otherwise |
25 | 25 | */ |
26 | -function give_has_variable_prices( $form_id = 0 ) { |
|
26 | +function give_has_variable_prices($form_id = 0) { |
|
27 | 27 | |
28 | - if ( empty( $form_id ) ) { |
|
28 | + if (empty($form_id)) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - $form = new Give_Donate_Form( $form_id ); |
|
32 | + $form = new Give_Donate_Form($form_id); |
|
33 | 33 | |
34 | 34 | return $form->has_variable_prices(); |
35 | 35 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array Variable prices |
46 | 46 | */ |
47 | -function give_get_variable_prices( $form_id = 0 ) { |
|
47 | +function give_get_variable_prices($form_id = 0) { |
|
48 | 48 | |
49 | - if ( empty( $form_id ) ) { |
|
49 | + if (empty($form_id)) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $form = new Give_Donate_Form( $form_id ); |
|
53 | + $form = new Give_Donate_Form($form_id); |
|
54 | 54 | |
55 | 55 | return $form->prices; |
56 | 56 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return string $default_price |
69 | 69 | */ |
70 | -function give_get_default_multilevel_amount( $form_id ) { |
|
70 | +function give_get_default_multilevel_amount($form_id) { |
|
71 | 71 | $default_price = '1.00'; |
72 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
72 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
73 | 73 | |
74 | - foreach ( $prices as $price ) { |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | |
76 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
76 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
77 | 77 | $default_price = $price['_give_amount']; |
78 | 78 | } |
79 | 79 | |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $default_price |
95 | 95 | * @since 1.0 |
96 | 96 | */ |
97 | -function give_get_default_form_amount( $form_id ) { |
|
97 | +function give_get_default_form_amount($form_id) { |
|
98 | 98 | |
99 | - if ( give_has_variable_prices( $form_id ) ) { |
|
99 | + if (give_has_variable_prices($form_id)) { |
|
100 | 100 | |
101 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
101 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | - $default_amount = get_post_meta( $form_id, '_give_set_price', true ); |
|
105 | + $default_amount = get_post_meta($form_id, '_give_set_price', true); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return bool |
125 | 125 | */ |
126 | -function give_is_custom_price_mode( $form_id = 0 ) { |
|
126 | +function give_is_custom_price_mode($form_id = 0) { |
|
127 | 127 | |
128 | - if ( empty( $form_id ) ) { |
|
128 | + if (empty($form_id)) { |
|
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | |
132 | - $form = new Give_Donate_Form( $form_id ); |
|
132 | + $form = new Give_Donate_Form($form_id); |
|
133 | 133 | |
134 | 134 | return $form->is_custom_price_mode(); |
135 | 135 | } |
136 | 136 | \ No newline at end of file |
@@ -544,7 +544,7 @@ |
||
544 | 544 | |
545 | 545 | if( $payment_total_diff > 0 ) { |
546 | 546 | $this->increase_value( $payment_total_diff ); |
547 | - }else{ |
|
547 | + } else{ |
|
548 | 548 | // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
549 | 549 | $this->decrease_value( -$payment_total_diff ); |
550 | 550 | } |
@@ -565,12 +565,12 @@ discard block |
||
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Decrease/Increase a customer's lifetime value. |
568 | - * |
|
569 | - * This function will update donation stat on basis of current amount and new amount donation difference. |
|
570 | - * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat. |
|
571 | - * |
|
568 | + * |
|
569 | + * This function will update donation stat on basis of current amount and new amount donation difference. |
|
570 | + * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat. |
|
571 | + * |
|
572 | 572 | * @since 1.0 |
573 | - * @access public |
|
573 | + * @access public |
|
574 | 574 | * |
575 | 575 | * @param float $curr_amount Current Donation amount. |
576 | 576 | * @param float $new_amount New (changed) Donation amount. |
@@ -578,35 +578,35 @@ discard block |
||
578 | 578 | * @return mixed If successful, the new donation stat value, otherwise false. |
579 | 579 | */ |
580 | 580 | public function update_donation_value( $curr_amount, $new_amount ) { |
581 | - /** |
|
582 | - * Payment total difference value can be: |
|
583 | - * zero (in case amount not change) |
|
584 | - * or -ve (in case amount decrease) |
|
585 | - * or +ve (in case amount increase) |
|
586 | - */ |
|
587 | - $payment_total_diff = $new_amount - $curr_amount; |
|
588 | - |
|
589 | - // We do not need to update donation stat if donation did not change. |
|
590 | - if( ! $payment_total_diff ) { |
|
591 | - return false; |
|
592 | - } |
|
593 | - |
|
594 | - |
|
595 | - if( $payment_total_diff > 0 ) { |
|
596 | - $this->increase_value( $payment_total_diff ); |
|
597 | - }else{ |
|
598 | - // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
|
599 | - $this->decrease_value( -$payment_total_diff ); |
|
600 | - } |
|
601 | - |
|
602 | - return $this->purchase_value; |
|
581 | + /** |
|
582 | + * Payment total difference value can be: |
|
583 | + * zero (in case amount not change) |
|
584 | + * or -ve (in case amount decrease) |
|
585 | + * or +ve (in case amount increase) |
|
586 | + */ |
|
587 | + $payment_total_diff = $new_amount - $curr_amount; |
|
588 | + |
|
589 | + // We do not need to update donation stat if donation did not change. |
|
590 | + if( ! $payment_total_diff ) { |
|
591 | + return false; |
|
592 | + } |
|
593 | + |
|
594 | + |
|
595 | + if( $payment_total_diff > 0 ) { |
|
596 | + $this->increase_value( $payment_total_diff ); |
|
597 | + }else{ |
|
598 | + // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
|
599 | + $this->decrease_value( -$payment_total_diff ); |
|
600 | + } |
|
601 | + |
|
602 | + return $this->purchase_value; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
606 | 606 | * Get the parsed notes for a customer as an array. |
607 | 607 | * |
608 | 608 | * @since 1.0 |
609 | - * @access public |
|
609 | + * @access public |
|
610 | 610 | * |
611 | 611 | * @param integer $length The number of notes to get. |
612 | 612 | * @param integer $paged What note to start at. |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * Get the total number of notes we have after parsing. |
632 | 632 | * |
633 | 633 | * @since 1.0 |
634 | - * @access public |
|
634 | + * @access public |
|
635 | 635 | * |
636 | 636 | * @return int The number of notes for the customer. |
637 | 637 | */ |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * Add a note for the customer. |
649 | 649 | * |
650 | 650 | * @since 1.0 |
651 | - * @access public |
|
651 | + * @access public |
|
652 | 652 | * |
653 | 653 | * @param string $note The note to add. Default is empty. |
654 | 654 | * |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * Get the notes column for the customer |
691 | 691 | * |
692 | 692 | * @since 1.0 |
693 | - * @access private |
|
693 | + * @access private |
|
694 | 694 | * |
695 | 695 | * @return string The Notes for the customer, non-parsed. |
696 | 696 | */ |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * Sanitize the data for update/create |
769 | 769 | * |
770 | 770 | * @since 1.0 |
771 | - * @access private |
|
771 | + * @access private |
|
772 | 772 | * |
773 | 773 | * @param array $data The data to sanitize. |
774 | 774 | * |
@@ -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 | |
@@ -134,29 +134,29 @@ discard block |
||
134 | 134 | * @param bool $_id_or_email |
135 | 135 | * @param bool $by_user_id |
136 | 136 | */ |
137 | - public function __construct( $_id_or_email = false, $by_user_id = false ) { |
|
137 | + public function __construct($_id_or_email = false, $by_user_id = false) { |
|
138 | 138 | |
139 | 139 | $this->db = new Give_DB_Customers; |
140 | 140 | |
141 | - if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) { |
|
141 | + if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | |
145 | - $by_user_id = is_bool( $by_user_id ) ? $by_user_id : false; |
|
145 | + $by_user_id = is_bool($by_user_id) ? $by_user_id : false; |
|
146 | 146 | |
147 | - if ( is_numeric( $_id_or_email ) ) { |
|
147 | + if (is_numeric($_id_or_email)) { |
|
148 | 148 | $field = $by_user_id ? 'user_id' : 'id'; |
149 | 149 | } else { |
150 | 150 | $field = 'email'; |
151 | 151 | } |
152 | 152 | |
153 | - $customer = $this->db->get_customer_by( $field, $_id_or_email ); |
|
153 | + $customer = $this->db->get_customer_by($field, $_id_or_email); |
|
154 | 154 | |
155 | - if ( empty( $customer ) || ! is_object( $customer ) ) { |
|
155 | + if (empty($customer) || ! is_object($customer)) { |
|
156 | 156 | return false; |
157 | 157 | } |
158 | 158 | |
159 | - $this->setup_customer( $customer ); |
|
159 | + $this->setup_customer($customer); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return bool If the setup was successful or not. |
174 | 174 | */ |
175 | - private function setup_customer( $customer ) { |
|
175 | + private function setup_customer($customer) { |
|
176 | 176 | |
177 | - if ( ! is_object( $customer ) ) { |
|
177 | + if ( ! is_object($customer)) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
181 | - foreach ( $customer as $key => $value ) { |
|
181 | + foreach ($customer as $key => $value) { |
|
182 | 182 | |
183 | - switch ( $key ) { |
|
183 | + switch ($key) { |
|
184 | 184 | |
185 | 185 | case 'notes': |
186 | 186 | $this->$key = $this->get_notes(); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | // Customer ID and email are the only things that are necessary, make sure they exist |
198 | - if ( ! empty( $this->id ) && ! empty( $this->email ) ) { |
|
198 | + if ( ! empty($this->id) && ! empty($this->email)) { |
|
199 | 199 | return true; |
200 | 200 | } |
201 | 201 | |
@@ -209,16 +209,16 @@ discard block |
||
209 | 209 | * @since 1.0 |
210 | 210 | * @access public |
211 | 211 | */ |
212 | - public function __get( $key ) { |
|
212 | + public function __get($key) { |
|
213 | 213 | |
214 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
214 | + if (method_exists($this, 'get_'.$key)) { |
|
215 | 215 | |
216 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
216 | + return call_user_func(array($this, 'get_'.$key)); |
|
217 | 217 | |
218 | 218 | } else { |
219 | 219 | |
220 | 220 | /* translators: %s: property key */ |
221 | - return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
221 | + return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @return mixed False if not a valid creation, Customer ID if user is found or valid creation. |
236 | 236 | */ |
237 | - public function create( $data = array() ) { |
|
237 | + public function create($data = array()) { |
|
238 | 238 | |
239 | - if ( $this->id != 0 || empty( $data ) ) { |
|
239 | + if ($this->id != 0 || empty($data)) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
@@ -244,34 +244,34 @@ discard block |
||
244 | 244 | 'payment_ids' => '' |
245 | 245 | ); |
246 | 246 | |
247 | - $args = wp_parse_args( $data, $defaults ); |
|
248 | - $args = $this->sanitize_columns( $args ); |
|
247 | + $args = wp_parse_args($data, $defaults); |
|
248 | + $args = $this->sanitize_columns($args); |
|
249 | 249 | |
250 | - if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) { |
|
250 | + if (empty($args['email']) || ! is_email($args['email'])) { |
|
251 | 251 | return false; |
252 | 252 | } |
253 | 253 | |
254 | - if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) { |
|
255 | - $args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) ); |
|
254 | + if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) { |
|
255 | + $args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids']))); |
|
256 | 256 | } |
257 | 257 | |
258 | - do_action( 'give_customer_pre_create', $args ); |
|
258 | + do_action('give_customer_pre_create', $args); |
|
259 | 259 | |
260 | 260 | $created = false; |
261 | 261 | |
262 | 262 | // The DB class 'add' implies an update if the customer being asked to be created already exists |
263 | - if ( $this->db->add( $data ) ) { |
|
263 | + if ($this->db->add($data)) { |
|
264 | 264 | |
265 | 265 | // We've successfully added/updated the customer, reset the class vars with the new data |
266 | - $customer = $this->db->get_customer_by( 'email', $args['email'] ); |
|
266 | + $customer = $this->db->get_customer_by('email', $args['email']); |
|
267 | 267 | |
268 | 268 | // Setup the customer data with the values from DB |
269 | - $this->setup_customer( $customer ); |
|
269 | + $this->setup_customer($customer); |
|
270 | 270 | |
271 | 271 | $created = $this->id; |
272 | 272 | } |
273 | 273 | |
274 | - do_action( 'give_customer_post_create', $created, $args ); |
|
274 | + do_action('give_customer_post_create', $created, $args); |
|
275 | 275 | |
276 | 276 | return $created; |
277 | 277 | |
@@ -287,27 +287,27 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return bool If the update was successful or not. |
289 | 289 | */ |
290 | - public function update( $data = array() ) { |
|
290 | + public function update($data = array()) { |
|
291 | 291 | |
292 | - if ( empty( $data ) ) { |
|
292 | + if (empty($data)) { |
|
293 | 293 | return false; |
294 | 294 | } |
295 | 295 | |
296 | - $data = $this->sanitize_columns( $data ); |
|
296 | + $data = $this->sanitize_columns($data); |
|
297 | 297 | |
298 | - do_action( 'give_customer_pre_update', $this->id, $data ); |
|
298 | + do_action('give_customer_pre_update', $this->id, $data); |
|
299 | 299 | |
300 | 300 | $updated = false; |
301 | 301 | |
302 | - if ( $this->db->update( $this->id, $data ) ) { |
|
302 | + if ($this->db->update($this->id, $data)) { |
|
303 | 303 | |
304 | - $customer = $this->db->get_customer_by( 'id', $this->id ); |
|
305 | - $this->setup_customer( $customer ); |
|
304 | + $customer = $this->db->get_customer_by('id', $this->id); |
|
305 | + $this->setup_customer($customer); |
|
306 | 306 | |
307 | 307 | $updated = true; |
308 | 308 | } |
309 | 309 | |
310 | - do_action( 'give_customer_post_update', $updated, $this->id, $data ); |
|
310 | + do_action('give_customer_post_update', $updated, $this->id, $data); |
|
311 | 311 | |
312 | 312 | return $updated; |
313 | 313 | } |
@@ -325,44 +325,44 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return bool If the attachment was successfuly. |
327 | 327 | */ |
328 | - public function attach_payment( $payment_id = 0, $update_stats = true ) { |
|
328 | + public function attach_payment($payment_id = 0, $update_stats = true) { |
|
329 | 329 | |
330 | - if ( empty( $payment_id ) ) { |
|
330 | + if (empty($payment_id)) { |
|
331 | 331 | return false; |
332 | 332 | } |
333 | 333 | |
334 | - if ( empty( $this->payment_ids ) ) { |
|
334 | + if (empty($this->payment_ids)) { |
|
335 | 335 | |
336 | 336 | $new_payment_ids = $payment_id; |
337 | 337 | |
338 | 338 | } else { |
339 | 339 | |
340 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
340 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
341 | 341 | |
342 | - if ( in_array( $payment_id, $payment_ids ) ) { |
|
342 | + if (in_array($payment_id, $payment_ids)) { |
|
343 | 343 | $update_stats = false; |
344 | 344 | } |
345 | 345 | |
346 | 346 | $payment_ids[] = $payment_id; |
347 | 347 | |
348 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
348 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
349 | 349 | |
350 | 350 | } |
351 | 351 | |
352 | - do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id ); |
|
352 | + do_action('give_customer_pre_attach_payment', $payment_id, $this->id); |
|
353 | 353 | |
354 | - $payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
354 | + $payment_added = $this->update(array('payment_ids' => $new_payment_ids)); |
|
355 | 355 | |
356 | - if ( $payment_added ) { |
|
356 | + if ($payment_added) { |
|
357 | 357 | |
358 | 358 | $this->payment_ids = $new_payment_ids; |
359 | 359 | |
360 | 360 | // We added this payment successfully, increment the stats |
361 | - if ( $update_stats ) { |
|
362 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
361 | + if ($update_stats) { |
|
362 | + $payment_amount = give_get_payment_amount($payment_id); |
|
363 | 363 | |
364 | - if ( ! empty( $payment_amount ) ) { |
|
365 | - $this->increase_value( $payment_amount ); |
|
364 | + if ( ! empty($payment_amount)) { |
|
365 | + $this->increase_value($payment_amount); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | $this->increase_purchase_count(); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | } |
372 | 372 | |
373 | - do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id ); |
|
373 | + do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id); |
|
374 | 374 | |
375 | 375 | return $payment_added; |
376 | 376 | } |
@@ -388,50 +388,50 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @return boolean If the removal was successful. |
390 | 390 | */ |
391 | - public function remove_payment( $payment_id = 0, $update_stats = true ) { |
|
391 | + public function remove_payment($payment_id = 0, $update_stats = true) { |
|
392 | 392 | |
393 | - if ( empty( $payment_id ) ) { |
|
393 | + if (empty($payment_id)) { |
|
394 | 394 | return false; |
395 | 395 | } |
396 | 396 | |
397 | - $payment = new Give_Payment( $payment_id ); |
|
397 | + $payment = new Give_Payment($payment_id); |
|
398 | 398 | |
399 | - if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) { |
|
399 | + if ('publish' !== $payment->status && 'revoked' !== $payment->status) { |
|
400 | 400 | $update_stats = false; |
401 | 401 | } |
402 | 402 | |
403 | 403 | $new_payment_ids = ''; |
404 | 404 | |
405 | - if ( ! empty( $this->payment_ids ) ) { |
|
405 | + if ( ! empty($this->payment_ids)) { |
|
406 | 406 | |
407 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
407 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
408 | 408 | |
409 | - $pos = array_search( $payment_id, $payment_ids ); |
|
410 | - if ( false === $pos ) { |
|
409 | + $pos = array_search($payment_id, $payment_ids); |
|
410 | + if (false === $pos) { |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | - unset( $payment_ids[ $pos ] ); |
|
415 | - $payment_ids = array_filter( $payment_ids ); |
|
414 | + unset($payment_ids[$pos]); |
|
415 | + $payment_ids = array_filter($payment_ids); |
|
416 | 416 | |
417 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
417 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
418 | 418 | |
419 | 419 | } |
420 | 420 | |
421 | - do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id ); |
|
421 | + do_action('give_customer_pre_remove_payment', $payment_id, $this->id); |
|
422 | 422 | |
423 | - $payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
423 | + $payment_removed = $this->update(array('payment_ids' => $new_payment_ids)); |
|
424 | 424 | |
425 | - if ( $payment_removed ) { |
|
425 | + if ($payment_removed) { |
|
426 | 426 | |
427 | 427 | $this->payment_ids = $new_payment_ids; |
428 | 428 | |
429 | - if ( $update_stats ) { |
|
429 | + if ($update_stats) { |
|
430 | 430 | // We removed this payment successfully, decrement the stats |
431 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
431 | + $payment_amount = give_get_payment_amount($payment_id); |
|
432 | 432 | |
433 | - if ( ! empty( $payment_amount ) ) { |
|
434 | - $this->decrease_value( $payment_amount ); |
|
433 | + if ( ! empty($payment_amount)) { |
|
434 | + $this->decrease_value($payment_amount); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | $this->decrease_purchase_count(); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | - do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id ); |
|
442 | + do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id); |
|
443 | 443 | |
444 | 444 | return $payment_removed; |
445 | 445 | |
@@ -455,22 +455,22 @@ discard block |
||
455 | 455 | * |
456 | 456 | * @return int The purchase count. |
457 | 457 | */ |
458 | - public function increase_purchase_count( $count = 1 ) { |
|
458 | + public function increase_purchase_count($count = 1) { |
|
459 | 459 | |
460 | 460 | // Make sure it's numeric and not negative. |
461 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
461 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
462 | 462 | return false; |
463 | 463 | } |
464 | 464 | |
465 | 465 | $new_total = (int) $this->purchase_count + (int) $count; |
466 | 466 | |
467 | - do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id ); |
|
467 | + do_action('give_customer_pre_increase_purchase_count', $count, $this->id); |
|
468 | 468 | |
469 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
469 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
470 | 470 | $this->purchase_count = $new_total; |
471 | 471 | } |
472 | 472 | |
473 | - do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id ); |
|
473 | + do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id); |
|
474 | 474 | |
475 | 475 | return $this->purchase_count; |
476 | 476 | } |
@@ -485,26 +485,26 @@ discard block |
||
485 | 485 | * |
486 | 486 | * @return mixed If successful, the new count, otherwise false. |
487 | 487 | */ |
488 | - public function decrease_purchase_count( $count = 1 ) { |
|
488 | + public function decrease_purchase_count($count = 1) { |
|
489 | 489 | |
490 | 490 | // Make sure it's numeric and not negative |
491 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
491 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
492 | 492 | return false; |
493 | 493 | } |
494 | 494 | |
495 | 495 | $new_total = (int) $this->purchase_count - (int) $count; |
496 | 496 | |
497 | - if ( $new_total < 0 ) { |
|
497 | + if ($new_total < 0) { |
|
498 | 498 | $new_total = 0; |
499 | 499 | } |
500 | 500 | |
501 | - do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id ); |
|
501 | + do_action('give_customer_pre_decrease_purchase_count', $count, $this->id); |
|
502 | 502 | |
503 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
503 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
504 | 504 | $this->purchase_count = $new_total; |
505 | 505 | } |
506 | 506 | |
507 | - do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id ); |
|
507 | + do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id); |
|
508 | 508 | |
509 | 509 | return $this->purchase_count; |
510 | 510 | } |
@@ -519,17 +519,17 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return mixed If successful, the new value, otherwise false. |
521 | 521 | */ |
522 | - public function increase_value( $value = 0.00 ) { |
|
522 | + public function increase_value($value = 0.00) { |
|
523 | 523 | |
524 | - $new_value = floatval( $this->purchase_value ) + $value; |
|
524 | + $new_value = floatval($this->purchase_value) + $value; |
|
525 | 525 | |
526 | - do_action( 'give_customer_pre_increase_value', $value, $this->id ); |
|
526 | + do_action('give_customer_pre_increase_value', $value, $this->id); |
|
527 | 527 | |
528 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
528 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
529 | 529 | $this->purchase_value = $new_value; |
530 | 530 | } |
531 | 531 | |
532 | - do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id ); |
|
532 | + do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id); |
|
533 | 533 | |
534 | 534 | return $this->purchase_value; |
535 | 535 | } |
@@ -544,21 +544,21 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return mixed If successful, the new value, otherwise false. |
546 | 546 | */ |
547 | - public function decrease_value( $value = 0.00 ) { |
|
547 | + public function decrease_value($value = 0.00) { |
|
548 | 548 | |
549 | - $new_value = floatval( $this->purchase_value ) - $value; |
|
549 | + $new_value = floatval($this->purchase_value) - $value; |
|
550 | 550 | |
551 | - if ( $new_value < 0 ) { |
|
551 | + if ($new_value < 0) { |
|
552 | 552 | $new_value = 0.00; |
553 | 553 | } |
554 | 554 | |
555 | - do_action( 'give_customer_pre_decrease_value', $value, $this->id ); |
|
555 | + do_action('give_customer_pre_decrease_value', $value, $this->id); |
|
556 | 556 | |
557 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
557 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
558 | 558 | $this->purchase_value = $new_value; |
559 | 559 | } |
560 | 560 | |
561 | - do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id ); |
|
561 | + do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id); |
|
562 | 562 | |
563 | 563 | return $this->purchase_value; |
564 | 564 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * |
578 | 578 | * @return mixed If successful, the new donation stat value, otherwise false. |
579 | 579 | */ |
580 | - public function update_donation_value( $curr_amount, $new_amount ) { |
|
580 | + public function update_donation_value($curr_amount, $new_amount) { |
|
581 | 581 | /** |
582 | 582 | * Payment total difference value can be: |
583 | 583 | * zero (in case amount not change) |
@@ -587,14 +587,14 @@ discard block |
||
587 | 587 | $payment_total_diff = $new_amount - $curr_amount; |
588 | 588 | |
589 | 589 | // We do not need to update donation stat if donation did not change. |
590 | - if( ! $payment_total_diff ) { |
|
590 | + if ( ! $payment_total_diff) { |
|
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | |
594 | 594 | |
595 | - if( $payment_total_diff > 0 ) { |
|
596 | - $this->increase_value( $payment_total_diff ); |
|
597 | - }else{ |
|
595 | + if ($payment_total_diff > 0) { |
|
596 | + $this->increase_value($payment_total_diff); |
|
597 | + } else { |
|
598 | 598 | // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
599 | 599 | $this->decrease_value( -$payment_total_diff ); |
600 | 600 | } |
@@ -613,15 +613,15 @@ discard block |
||
613 | 613 | * |
614 | 614 | * @return array The notes requested. |
615 | 615 | */ |
616 | - public function get_notes( $length = 20, $paged = 1 ) { |
|
616 | + public function get_notes($length = 20, $paged = 1) { |
|
617 | 617 | |
618 | - $length = is_numeric( $length ) ? $length : 20; |
|
619 | - $offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0; |
|
618 | + $length = is_numeric($length) ? $length : 20; |
|
619 | + $offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0; |
|
620 | 620 | |
621 | 621 | $all_notes = $this->get_raw_notes(); |
622 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
622 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
623 | 623 | |
624 | - $desired_notes = array_slice( $notes_array, $offset, $length ); |
|
624 | + $desired_notes = array_slice($notes_array, $offset, $length); |
|
625 | 625 | |
626 | 626 | return $desired_notes; |
627 | 627 | |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | public function get_notes_count() { |
639 | 639 | |
640 | 640 | $all_notes = $this->get_raw_notes(); |
641 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
641 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
642 | 642 | |
643 | - return count( $notes_array ); |
|
643 | + return count($notes_array); |
|
644 | 644 | |
645 | 645 | } |
646 | 646 | |
@@ -654,32 +654,32 @@ discard block |
||
654 | 654 | * |
655 | 655 | * @return string|boolean The new note if added successfully, false otherwise. |
656 | 656 | */ |
657 | - public function add_note( $note = '' ) { |
|
657 | + public function add_note($note = '') { |
|
658 | 658 | |
659 | - $note = trim( $note ); |
|
660 | - if ( empty( $note ) ) { |
|
659 | + $note = trim($note); |
|
660 | + if (empty($note)) { |
|
661 | 661 | return false; |
662 | 662 | } |
663 | 663 | |
664 | 664 | $notes = $this->get_raw_notes(); |
665 | 665 | |
666 | - if ( empty( $notes ) ) { |
|
666 | + if (empty($notes)) { |
|
667 | 667 | $notes = ''; |
668 | 668 | } |
669 | 669 | |
670 | - $note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note; |
|
671 | - $new_note = apply_filters( 'give_customer_add_note_string', $note_string ); |
|
672 | - $notes .= "\n\n" . $new_note; |
|
670 | + $note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note; |
|
671 | + $new_note = apply_filters('give_customer_add_note_string', $note_string); |
|
672 | + $notes .= "\n\n".$new_note; |
|
673 | 673 | |
674 | - do_action( 'give_customer_pre_add_note', $new_note, $this->id ); |
|
674 | + do_action('give_customer_pre_add_note', $new_note, $this->id); |
|
675 | 675 | |
676 | - $updated = $this->update( array( 'notes' => $notes ) ); |
|
676 | + $updated = $this->update(array('notes' => $notes)); |
|
677 | 677 | |
678 | - if ( $updated ) { |
|
678 | + if ($updated) { |
|
679 | 679 | $this->notes = $this->get_notes(); |
680 | 680 | } |
681 | 681 | |
682 | - do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id ); |
|
682 | + do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id); |
|
683 | 683 | |
684 | 684 | // Return the formatted note, so we can test, as well as update any displays |
685 | 685 | return $new_note; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | */ |
697 | 697 | private function get_raw_notes() { |
698 | 698 | |
699 | - $all_notes = $this->db->get_column( 'notes', $this->id ); |
|
699 | + $all_notes = $this->db->get_column('notes', $this->id); |
|
700 | 700 | |
701 | 701 | return $all_notes; |
702 | 702 | |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * |
714 | 714 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
715 | 715 | */ |
716 | - public function get_meta( $meta_key = '', $single = true ) { |
|
717 | - return Give()->customer_meta->get_meta( $this->id, $meta_key, $single ); |
|
716 | + public function get_meta($meta_key = '', $single = true) { |
|
717 | + return Give()->customer_meta->get_meta($this->id, $meta_key, $single); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
@@ -729,8 +729,8 @@ discard block |
||
729 | 729 | * |
730 | 730 | * @return bool False for failure. True for success. |
731 | 731 | */ |
732 | - public function add_meta( $meta_key = '', $meta_value, $unique = false ) { |
|
733 | - return Give()->customer_meta->add_meta( $this->id, $meta_key, $meta_value, $unique ); |
|
732 | + public function add_meta($meta_key = '', $meta_value, $unique = false) { |
|
733 | + return Give()->customer_meta->add_meta($this->id, $meta_key, $meta_value, $unique); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @return bool False on failure, true if success. |
747 | 747 | */ |
748 | - public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) { |
|
749 | - return Give()->customer_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value ); |
|
748 | + public function update_meta($meta_key = '', $meta_value, $prev_value = '') { |
|
749 | + return Give()->customer_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | /** |
@@ -760,8 +760,8 @@ discard block |
||
760 | 760 | * |
761 | 761 | * @return bool False for failure. True for success. |
762 | 762 | */ |
763 | - public function delete_meta( $meta_key = '', $meta_value = '' ) { |
|
764 | - return Give()->customer_meta->delete_meta( $this->id, $meta_key, $meta_value ); |
|
763 | + public function delete_meta($meta_key = '', $meta_value = '') { |
|
764 | + return Give()->customer_meta->delete_meta($this->id, $meta_key, $meta_value); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -774,51 +774,51 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @return array The sanitized data, based off column defaults. |
776 | 776 | */ |
777 | - private function sanitize_columns( $data ) { |
|
777 | + private function sanitize_columns($data) { |
|
778 | 778 | |
779 | 779 | $columns = $this->db->get_columns(); |
780 | 780 | $default_values = $this->db->get_column_defaults(); |
781 | 781 | |
782 | - foreach ( $columns as $key => $type ) { |
|
782 | + foreach ($columns as $key => $type) { |
|
783 | 783 | |
784 | 784 | // Only sanitize data that we were provided |
785 | - if ( ! array_key_exists( $key, $data ) ) { |
|
785 | + if ( ! array_key_exists($key, $data)) { |
|
786 | 786 | continue; |
787 | 787 | } |
788 | 788 | |
789 | - switch ( $type ) { |
|
789 | + switch ($type) { |
|
790 | 790 | |
791 | 791 | case '%s': |
792 | - if ( 'email' == $key ) { |
|
793 | - $data[ $key ] = sanitize_email( $data[ $key ] ); |
|
794 | - } elseif ( 'notes' == $key ) { |
|
795 | - $data[ $key ] = strip_tags( $data[ $key ] ); |
|
792 | + if ('email' == $key) { |
|
793 | + $data[$key] = sanitize_email($data[$key]); |
|
794 | + } elseif ('notes' == $key) { |
|
795 | + $data[$key] = strip_tags($data[$key]); |
|
796 | 796 | } else { |
797 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
797 | + $data[$key] = sanitize_text_field($data[$key]); |
|
798 | 798 | } |
799 | 799 | break; |
800 | 800 | |
801 | 801 | case '%d': |
802 | - if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) { |
|
803 | - $data[ $key ] = $default_values[ $key ]; |
|
802 | + if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) { |
|
803 | + $data[$key] = $default_values[$key]; |
|
804 | 804 | } else { |
805 | - $data[ $key ] = absint( $data[ $key ] ); |
|
805 | + $data[$key] = absint($data[$key]); |
|
806 | 806 | } |
807 | 807 | break; |
808 | 808 | |
809 | 809 | case '%f': |
810 | 810 | // Convert what was given to a float |
811 | - $value = floatval( $data[ $key ] ); |
|
811 | + $value = floatval($data[$key]); |
|
812 | 812 | |
813 | - if ( ! is_float( $value ) ) { |
|
814 | - $data[ $key ] = $default_values[ $key ]; |
|
813 | + if ( ! is_float($value)) { |
|
814 | + $data[$key] = $default_values[$key]; |
|
815 | 815 | } else { |
816 | - $data[ $key ] = $value; |
|
816 | + $data[$key] = $value; |
|
817 | 817 | } |
818 | 818 | break; |
819 | 819 | |
820 | 820 | default: |
821 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
821 | + $data[$key] = sanitize_text_field($data[$key]); |
|
822 | 822 | break; |
823 | 823 | |
824 | 824 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public $error = ''; |
24 | 24 | |
25 | 25 | private $verify_throttle; |
26 | - private $token_expiration; |
|
26 | + private $token_expiration; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Give_Email_Access constructor. |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @return bool |
244 | 244 | */ |
245 | 245 | function is_valid_verify_key( $token ) { |
246 | - /* @var WPDB $wpdb */ |
|
246 | + /* @var WPDB $wpdb */ |
|
247 | 247 | global $wpdb; |
248 | 248 | |
249 | 249 | // See if the verify_key exists |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function __construct() { |
99 | 99 | |
100 | 100 | // get it started |
101 | - add_action( 'init', array( $this, 'init' ) ); |
|
101 | + add_action('init', array($this, 'init')); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -113,30 +113,30 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function init() { |
115 | 115 | |
116 | - $is_enabled = give_get_option( 'email_access' ); |
|
116 | + $is_enabled = give_get_option('email_access'); |
|
117 | 117 | |
118 | 118 | //Non-logged in users only |
119 | - if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) { |
|
119 | + if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | 123 | //Are db columns setup? |
124 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
125 | - if ( empty( $is_setup ) ) { |
|
124 | + $is_setup = give_get_option('email_access_installed'); |
|
125 | + if (empty($is_setup)) { |
|
126 | 126 | $this->create_columns(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Timeouts |
130 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
131 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
130 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
131 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
132 | 132 | |
133 | 133 | // Setup login |
134 | 134 | $this->check_for_token(); |
135 | 135 | |
136 | - if ( $this->token_exists ) { |
|
137 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
138 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
139 | - add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) ); |
|
136 | + if ($this->token_exists) { |
|
137 | + add_filter('give_can_view_receipt', '__return_true'); |
|
138 | + add_filter('give_user_pending_verification', '__return_false'); |
|
139 | + add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args')); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -150,25 +150,25 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | - public function can_send_email( $customer_id ) { |
|
153 | + public function can_send_email($customer_id) { |
|
154 | 154 | /* @var WPDB $wpdb */ |
155 | 155 | global $wpdb; |
156 | 156 | |
157 | 157 | // Prevent multiple emails within X minutes |
158 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
158 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
159 | 159 | |
160 | 160 | // Does a user row exist? |
161 | 161 | $exists = (int) $wpdb->get_var( |
162 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
162 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
163 | 163 | ); |
164 | 164 | |
165 | - if ( 0 < $exists ) { |
|
165 | + if (0 < $exists) { |
|
166 | 166 | $row_id = (int) $wpdb->get_var( |
167 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
167 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
168 | 168 | ); |
169 | 169 | |
170 | - if ( $row_id < 1 ) { |
|
171 | - give_set_error( 'give_email_access_attempts_exhausted', esc_html__( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
170 | + if ($row_id < 1) { |
|
171 | + give_set_error('give_email_access_attempts_exhausted', esc_html__('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
172 | 172 | |
173 | 173 | return false; |
174 | 174 | } |
@@ -188,34 +188,34 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return void |
190 | 190 | */ |
191 | - public function send_email( $customer_id, $email ) { |
|
191 | + public function send_email($customer_id, $email) { |
|
192 | 192 | |
193 | - $verify_key = wp_generate_password( 20, false ); |
|
193 | + $verify_key = wp_generate_password(20, false); |
|
194 | 194 | |
195 | 195 | // Generate a new verify key |
196 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
196 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
197 | 197 | |
198 | 198 | // Get the purchase history URL |
199 | - $page_id = give_get_option( 'history_page' ); |
|
199 | + $page_id = give_get_option('history_page'); |
|
200 | 200 | |
201 | - $access_url = add_query_arg( array( |
|
201 | + $access_url = add_query_arg(array( |
|
202 | 202 | 'give_nl' => $verify_key, |
203 | - ), get_permalink( $page_id ) ); |
|
203 | + ), get_permalink($page_id)); |
|
204 | 204 | |
205 | 205 | //Nice subject and message |
206 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( esc_html__( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
206 | + $subject = apply_filters('give_email_access_token_subject', sprintf(esc_html__('Your Access Link to %s', 'give'), get_bloginfo('name'))); |
|
207 | 207 | |
208 | - $message = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
209 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . esc_html__( 'Access My Donation Details »', 'give' ) . '</a>' . "\n\n"; |
|
208 | + $message = esc_html__('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
209 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.esc_html__('Access My Donation Details »', 'give').'</a>'."\n\n"; |
|
210 | 210 | $message .= "\n\n"; |
211 | - $message .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
212 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
211 | + $message .= esc_html__('Sincerely,', 'give')."\n"; |
|
212 | + $message .= get_bloginfo('name')."\n"; |
|
213 | 213 | |
214 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
214 | + $message = apply_filters('give_email_access_token_message', $message); |
|
215 | 215 | |
216 | 216 | // Send the email |
217 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', esc_html__( 'Your Access Link', 'give' ) ) ); |
|
218 | - Give()->emails->send( $email, $subject, $message ); |
|
217 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', esc_html__('Your Access Link', 'give'))); |
|
218 | + Give()->emails->send($email, $subject, $message); |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function check_for_token() { |
231 | 231 | |
232 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
232 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
233 | 233 | |
234 | 234 | // Check for cookie |
235 | - if ( empty( $token ) ) { |
|
236 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
235 | + if (empty($token)) { |
|
236 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
237 | 237 | } |
238 | 238 | |
239 | - if ( ! empty( $token ) ) { |
|
240 | - if ( ! $this->is_valid_token( $token ) ) { |
|
241 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
239 | + if ( ! empty($token)) { |
|
240 | + if ( ! $this->is_valid_token($token)) { |
|
241 | + if ( ! $this->is_valid_verify_key($token)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | 246 | $this->token_exists = true; |
247 | 247 | // Set cookie |
248 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
249 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
248 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
249 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -260,18 +260,18 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return bool |
262 | 262 | */ |
263 | - public function is_valid_token( $token ) { |
|
263 | + public function is_valid_token($token) { |
|
264 | 264 | |
265 | 265 | global $wpdb; |
266 | 266 | |
267 | 267 | // Make sure token isn't expired |
268 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
268 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
269 | 269 | |
270 | 270 | $email = $wpdb->get_var( |
271 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
271 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
272 | 272 | ); |
273 | 273 | |
274 | - if ( ! empty( $email ) ) { |
|
274 | + if ( ! empty($email)) { |
|
275 | 275 | $this->token_email = $email; |
276 | 276 | $this->token = $token; |
277 | 277 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | //Set error only if email access form isn't being submitted |
282 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
283 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Your access token has expired. Please request a new one below:', 'give' ) ); |
|
282 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
283 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Your access token has expired. Please request a new one below:', 'give')); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -300,25 +300,25 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return void |
302 | 302 | */ |
303 | - public function set_verify_key( $customer_id, $email, $verify_key ) { |
|
303 | + public function set_verify_key($customer_id, $email, $verify_key) { |
|
304 | 304 | global $wpdb; |
305 | 305 | |
306 | - $now = date( 'Y-m-d H:i:s' ); |
|
306 | + $now = date('Y-m-d H:i:s'); |
|
307 | 307 | |
308 | 308 | // Insert or update? |
309 | 309 | $row_id = (int) $wpdb->get_var( |
310 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
310 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
311 | 311 | ); |
312 | 312 | |
313 | 313 | // Update |
314 | - if ( ! empty( $row_id ) ) { |
|
314 | + if ( ! empty($row_id)) { |
|
315 | 315 | $wpdb->query( |
316 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
316 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
317 | 317 | ); |
318 | 318 | } // Insert |
319 | 319 | else { |
320 | 320 | $wpdb->query( |
321 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
321 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
322 | 322 | ); |
323 | 323 | } |
324 | 324 | } |
@@ -333,21 +333,21 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @return bool |
335 | 335 | */ |
336 | - public function is_valid_verify_key( $token ) { |
|
336 | + public function is_valid_verify_key($token) { |
|
337 | 337 | /* @var WPDB $wpdb */ |
338 | 338 | global $wpdb; |
339 | 339 | |
340 | 340 | // See if the verify_key exists |
341 | 341 | $row = $wpdb->get_row( |
342 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
342 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
343 | 343 | ); |
344 | 344 | |
345 | - $now = date( 'Y-m-d H:i:s' ); |
|
345 | + $now = date('Y-m-d H:i:s'); |
|
346 | 346 | |
347 | 347 | // Set token |
348 | - if ( ! empty( $row ) ) { |
|
348 | + if ( ! empty($row)) { |
|
349 | 349 | $wpdb->query( |
350 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
350 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
351 | 351 | ); |
352 | 352 | |
353 | 353 | $this->token_email = $row->email; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return mixed |
373 | 373 | */ |
374 | - public function users_purchases_args( $args ) { |
|
374 | + public function users_purchases_args($args) { |
|
375 | 375 | $args['user'] = $this->token_email; |
376 | 376 | |
377 | 377 | return $args; |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | global $wpdb; |
393 | 393 | |
394 | 394 | //Create columns in customers table |
395 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
395 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
396 | 396 | |
397 | 397 | //Columns added properly |
398 | - if ( $query ) { |
|
399 | - give_update_option( 'email_access_installed', 1 ); |
|
398 | + if ($query) { |
|
399 | + give_update_option('email_access_installed', 1); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | } |
@@ -781,8 +781,11 @@ |
||
781 | 781 | } |
782 | 782 | ?> |
783 | 783 | </select> |
784 | - <?php else : ?> |
|
785 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
784 | + <?php else { |
|
785 | + : ?> |
|
786 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
787 | +} |
|
788 | +?>"/> |
|
786 | 789 | <?php endif; ?> |
787 | 790 | </p> |
788 | 791 | <?php do_action( 'give_cc_billing_bottom' ); ?> |
@@ -1189,10 +1189,10 @@ |
||
1189 | 1189 | |
1190 | 1190 | function give_show_goal_progress( $form_id, $args ) { |
1191 | 1191 | |
1192 | - ob_start(); |
|
1193 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1192 | + ob_start(); |
|
1193 | + give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1194 | 1194 | |
1195 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1195 | + echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1196 | 1196 | |
1197 | 1197 | return true; |
1198 | 1198 | } |
@@ -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 | |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | * @param int $form_id The form ID. |
1578 | 1578 | * @param array $args An array of form arguments. |
1579 | 1579 | * |
1580 | - * @return mixed |
|
1580 | + * @return boolean |
|
1581 | 1581 | */ |
1582 | 1582 | function give_show_goal_progress( $form_id, $args ) { |
1583 | 1583 |
@@ -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,47 +23,47 @@ 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 = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(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 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | 62 | //Get the form wrap CSS classes. |
63 | - $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
64 | 64 | |
65 | 65 | //Get the <form> tag wrap CSS classes. |
66 | - $form_classes = $form->get_form_classes($args); |
|
66 | + $form_classes = $form->get_form_classes($args); |
|
67 | 67 | |
68 | 68 | ob_start(); |
69 | 69 | |
@@ -75,25 +75,25 @@ discard block |
||
75 | 75 | * @param int $form_id The form ID. |
76 | 76 | * @param array $args An array of form arguments. |
77 | 77 | */ |
78 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
78 | + do_action('give_pre_form_output', $form->ID, $args); |
|
79 | 79 | |
80 | 80 | ?> |
81 | 81 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
82 | 82 | |
83 | - <?php if ( $form->is_close_donation_form() ) { |
|
83 | + <?php if ($form->is_close_donation_form()) { |
|
84 | 84 | |
85 | 85 | //Get Goal thank you message. |
86 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
87 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
86 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
87 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
88 | 88 | |
89 | 89 | //Print thank you message. |
90 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
90 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
91 | 91 | |
92 | 92 | } else { |
93 | 93 | |
94 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
94 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
95 | 95 | |
96 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
96 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | * @param int $form_id The form ID. |
106 | 106 | * @param array $args An array of form arguments. |
107 | 107 | */ |
108 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
108 | + do_action('give_pre_form', $form->ID, $args); |
|
109 | 109 | ?> |
110 | 110 | |
111 | 111 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
112 | 112 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
113 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
114 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
115 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
116 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
113 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
114 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
115 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
116 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
117 | 117 | |
118 | 118 | <!-- The following field is for robots only, invisible to humans: --> |
119 | 119 | <span class="give-hidden" style="display: none !important;"> |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | <?php |
125 | 125 | |
126 | 126 | //Price ID hidden field for variable (mult-level) donation forms |
127 | - if ( give_has_variable_prices( $form_id ) ) { |
|
127 | + if (give_has_variable_prices($form_id)) { |
|
128 | 128 | //get default selected price ID |
129 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
129 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
130 | 130 | $price_id = 0; |
131 | 131 | //loop through prices |
132 | - foreach ( $prices as $price ) { |
|
133 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
132 | + foreach ($prices as $price) { |
|
133 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
134 | 134 | $price_id = $price['_give_id']['level_id']; |
135 | 135 | }; |
136 | 136 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $form_id The form ID. |
147 | 147 | * @param array $args An array of form arguments. |
148 | 148 | */ |
149 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
149 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Fires while outputing donation form, for payment gatways fields. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param int $form_id The form ID. |
157 | 157 | * @param array $args An array of form arguments. |
158 | 158 | */ |
159 | - do_action( 'give_donation_mode_select', $form->ID, $args ); |
|
159 | + do_action('give_donation_mode_select', $form->ID, $args); |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Fires while outputing donation form, after all other fields. |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param int $form_id The form ID. |
167 | 167 | * @param array $args An array of form arguments. |
168 | 168 | */ |
169 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
169 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
170 | 170 | |
171 | 171 | ?> |
172 | 172 | </form> |
@@ -180,12 +180,12 @@ 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_post_form', $form->ID, $args ); |
|
183 | + do_action('give_post_form', $form->ID, $args); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | |
188 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
188 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
189 | 189 | <?php |
190 | 190 | |
191 | 191 | /** |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | * @param int $form_id The form ID. |
197 | 197 | * @param array $args An array of form arguments. |
198 | 198 | */ |
199 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
199 | + do_action('give_post_form_output', $form->ID, $args); |
|
200 | 200 | |
201 | 201 | $final_output = ob_get_clean(); |
202 | 202 | |
203 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
203 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string |
219 | 219 | */ |
220 | -function give_show_purchase_form( $form_id ) { |
|
220 | +function give_show_purchase_form($form_id) { |
|
221 | 221 | |
222 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
222 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
223 | 223 | |
224 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
224 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
225 | 225 | $form_id = $_POST['give_form_id']; |
226 | 226 | } |
227 | 227 | |
@@ -230,33 +230,33 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @since 1.7 |
232 | 232 | */ |
233 | - do_action( 'give_donation_form_top', $form_id ); |
|
233 | + do_action('give_donation_form_top', $form_id); |
|
234 | 234 | |
235 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
235 | + if (give_can_checkout() && isset($form_id)) { |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires while displaying donation form, before registration login. |
239 | 239 | * |
240 | 240 | * @since 1.7 |
241 | 241 | */ |
242 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
242 | + do_action('give_donation_form_before_register_login', $form_id); |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Fire when register/login form fields render. |
246 | 246 | * |
247 | 247 | * @since 1.7 |
248 | 248 | */ |
249 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
249 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Fire when credit card form fields render. |
253 | 253 | * |
254 | 254 | * @since 1.7 |
255 | 255 | */ |
256 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
256 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
257 | 257 | |
258 | 258 | // Load the credit card form and allow gateways to load their own if they wish |
259 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
259 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
260 | 260 | /** |
261 | 261 | * Fires while displaying donation form, credit card form fields for a given gateway. |
262 | 262 | * |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @param int $form_id The form ID. |
266 | 266 | */ |
267 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
267 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
268 | 268 | } else { |
269 | 269 | /** |
270 | 270 | * Fires while displaying donation form, credit card form fields. |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @param int $form_id The form ID. |
275 | 275 | */ |
276 | - do_action( 'give_cc_form', $form_id ); |
|
276 | + do_action('give_cc_form', $form_id); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @since 1.7 |
283 | 283 | */ |
284 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
284 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
285 | 285 | |
286 | 286 | } else { |
287 | 287 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @since 1.7 |
291 | 291 | */ |
292 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
292 | + do_action('give_donation_form_no_access', $form_id); |
|
293 | 293 | |
294 | 294 | } |
295 | 295 | |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.7 |
300 | 300 | */ |
301 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
301 | + do_action('give_donation_form_bottom', $form_id); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
304 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Give Show Login/Register Form Fields. |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return void |
314 | 314 | */ |
315 | -function give_show_register_login_fields( $form_id ) { |
|
315 | +function give_show_register_login_fields($form_id) { |
|
316 | 316 | |
317 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
317 | + $show_register_form = give_show_login_register_option($form_id); |
|
318 | 318 | |
319 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
319 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
320 | 320 | ?> |
321 | 321 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
322 | 322 | <?php |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @since 1.7 |
327 | 327 | */ |
328 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
328 | + do_action('give_donation_form_register_fields', $form_id); |
|
329 | 329 | ?> |
330 | 330 | </div> |
331 | 331 | <?php |
332 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
332 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
333 | 333 | ?> |
334 | 334 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
335 | 335 | <?php |
@@ -338,23 +338,23 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @since 1.7 |
340 | 340 | */ |
341 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
341 | + do_action('give_donation_form_login_fields', $form_id); |
|
342 | 342 | ?> |
343 | 343 | </div> |
344 | 344 | <?php |
345 | 345 | endif; |
346 | 346 | |
347 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
347 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
348 | 348 | /** |
349 | 349 | * Fire when user info render. |
350 | 350 | * |
351 | 351 | * @since 1.7 |
352 | 352 | */ |
353 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
353 | + do_action('give_donation_form_after_user_info', $form_id); |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
357 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
358 | 358 | |
359 | 359 | /** |
360 | 360 | * Donation Amount Field. |
@@ -368,17 +368,17 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return void |
370 | 370 | */ |
371 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
371 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
372 | 372 | |
373 | 373 | global $give_options; |
374 | 374 | |
375 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
376 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
377 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
378 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
379 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
380 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
381 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
375 | + $variable_pricing = give_has_variable_prices($form_id); |
|
376 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
377 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
378 | + $symbol = give_currency_symbol(give_get_currency()); |
|
379 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
380 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
381 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
382 | 382 | |
383 | 383 | /** |
384 | 384 | * Fires while displaying donation form, before donation level fields. |
@@ -388,19 +388,19 @@ discard block |
||
388 | 388 | * @param int $form_id The form ID. |
389 | 389 | * @param array $args An array of form arguments. |
390 | 390 | */ |
391 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
391 | + do_action('give_before_donation_levels', $form_id, $args); |
|
392 | 392 | |
393 | 393 | //Set Price, No Custom Amount Allowed means hidden price field |
394 | - if ( $allow_custom_amount == 'no' ) { |
|
394 | + if ($allow_custom_amount == 'no') { |
|
395 | 395 | ?> |
396 | - <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
396 | + <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
397 | 397 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required> |
398 | 398 | <div class="set-price give-donation-amount form-row-wide"> |
399 | - <?php if ( $currency_position == 'before' ) { |
|
399 | + <?php if ($currency_position == 'before') { |
|
400 | 400 | echo $currency_output; |
401 | 401 | } ?> |
402 | 402 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
403 | - <?php if ( $currency_position == 'after' ) { |
|
403 | + <?php if ($currency_position == 'after') { |
|
404 | 404 | echo $currency_output; |
405 | 405 | } ?> |
406 | 406 | </div> |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | ?> |
411 | 411 | <div class="give-total-wrap"> |
412 | 412 | <div class="give-donation-amount form-row-wide"> |
413 | - <?php if ( $currency_position == 'before' ) { |
|
413 | + <?php if ($currency_position == 'before') { |
|
414 | 414 | echo $currency_output; |
415 | 415 | } ?> |
416 | - <label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
416 | + <label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
417 | 417 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
418 | - <?php if ( $currency_position == 'after' ) { |
|
418 | + <?php if ($currency_position == 'after') { |
|
419 | 419 | echo $currency_output; |
420 | 420 | } ?> |
421 | 421 | </div> |
@@ -430,16 +430,16 @@ discard block |
||
430 | 430 | * @param int $form_id The form ID. |
431 | 431 | * @param array $args An array of form arguments. |
432 | 432 | */ |
433 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
433 | + do_action('give_after_donation_amount', $form_id, $args); |
|
434 | 434 | |
435 | 435 | //Custom Amount Text |
436 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
436 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
437 | 437 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
438 | 438 | <?php } |
439 | 439 | |
440 | 440 | //Output Variable Pricing Levels |
441 | - if ( $variable_pricing ) { |
|
442 | - give_output_levels( $form_id ); |
|
441 | + if ($variable_pricing) { |
|
442 | + give_output_levels($form_id); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -450,10 +450,10 @@ discard block |
||
450 | 450 | * @param int $form_id The form ID. |
451 | 451 | * @param array $args An array of form arguments. |
452 | 452 | */ |
453 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
453 | + do_action('give_after_donation_levels', $form_id, $args); |
|
454 | 454 | } |
455 | 455 | |
456 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
456 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -464,32 +464,32 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @return string Donation levels. |
466 | 466 | */ |
467 | -function give_output_levels( $form_id ) { |
|
467 | +function give_output_levels($form_id) { |
|
468 | 468 | |
469 | 469 | //Get variable pricing |
470 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
471 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
472 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
473 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
474 | - if ( empty( $custom_amount_text ) ) { |
|
475 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
470 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
471 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
472 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
473 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
474 | + if (empty($custom_amount_text)) { |
|
475 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | $output = ''; |
479 | 479 | $counter = 0; |
480 | 480 | |
481 | - switch ( $display_style ) { |
|
481 | + switch ($display_style) { |
|
482 | 482 | case 'buttons': |
483 | 483 | |
484 | 484 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
485 | 485 | |
486 | - foreach ( $prices as $price ) { |
|
487 | - $counter ++; |
|
488 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
489 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
486 | + foreach ($prices as $price) { |
|
487 | + $counter++; |
|
488 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
489 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
490 | 490 | |
491 | 491 | $output .= '<li>'; |
492 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
492 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
493 | 493 | $output .= $level_text; |
494 | 494 | $output .= '</button>'; |
495 | 495 | $output .= '</li>'; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | //Custom Amount |
500 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
500 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
501 | 501 | $output .= '<li>'; |
502 | 502 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
503 | 503 | $output .= $custom_amount_text; |
@@ -513,23 +513,23 @@ discard block |
||
513 | 513 | |
514 | 514 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
515 | 515 | |
516 | - foreach ( $prices as $price ) { |
|
517 | - $counter ++; |
|
518 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
519 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
516 | + foreach ($prices as $price) { |
|
517 | + $counter++; |
|
518 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
519 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
520 | 520 | |
521 | 521 | $output .= '<li>'; |
522 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
523 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
522 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
523 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
524 | 524 | $output .= '</li>'; |
525 | 525 | |
526 | 526 | } |
527 | 527 | |
528 | 528 | //Custom Amount |
529 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
529 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
530 | 530 | $output .= '<li>'; |
531 | 531 | $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">'; |
532 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
532 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
533 | 533 | $output .= '</li>'; |
534 | 534 | } |
535 | 535 | |
@@ -539,23 +539,23 @@ discard block |
||
539 | 539 | |
540 | 540 | case 'dropdown': |
541 | 541 | |
542 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
543 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
542 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
543 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
544 | 544 | |
545 | 545 | //first loop through prices |
546 | - foreach ( $prices as $price ) { |
|
547 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
548 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
546 | + foreach ($prices as $price) { |
|
547 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
548 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
549 | 549 | |
550 | - $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'] ) . '">'; |
|
550 | + $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']).'">'; |
|
551 | 551 | $output .= $level_text; |
552 | 552 | $output .= '</option>'; |
553 | 553 | |
554 | 554 | } |
555 | 555 | |
556 | 556 | //Custom Amount |
557 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
558 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
557 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
558 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | $output .= '</select>'; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | break; |
564 | 564 | } |
565 | 565 | |
566 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
566 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
@@ -578,26 +578,26 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return string Checkout button. |
580 | 580 | */ |
581 | -function give_display_checkout_button( $form_id, $args ) { |
|
581 | +function give_display_checkout_button($form_id, $args) { |
|
582 | 582 | |
583 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
583 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
584 | 584 | ? $args['display_style'] |
585 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
585 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
586 | 586 | |
587 | 587 | //no btn for onpage |
588 | - if ( $display_option === 'onpage' ) { |
|
588 | + if ($display_option === 'onpage') { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
592 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
593 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
592 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
593 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
594 | 594 | |
595 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
595 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
596 | 596 | |
597 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
597 | + echo apply_filters('give_display_checkout_button', $output); |
|
598 | 598 | } |
599 | 599 | |
600 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
600 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
601 | 601 | |
602 | 602 | /** |
603 | 603 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -608,10 +608,10 @@ discard block |
||
608 | 608 | * |
609 | 609 | * @return void |
610 | 610 | */ |
611 | -function give_user_info_fields( $form_id ) { |
|
611 | +function give_user_info_fields($form_id) { |
|
612 | 612 | |
613 | - if ( is_user_logged_in() ) : |
|
614 | - $user_data = get_userdata( get_current_user_id() ); |
|
613 | + if (is_user_logged_in()) : |
|
614 | + $user_data = get_userdata(get_current_user_id()); |
|
615 | 615 | endif; |
616 | 616 | |
617 | 617 | /** |
@@ -619,35 +619,35 @@ discard block |
||
619 | 619 | * |
620 | 620 | * @since 1.7 |
621 | 621 | */ |
622 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
622 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
623 | 623 | ?> |
624 | 624 | <fieldset id="give_checkout_user_info"> |
625 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
625 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
626 | 626 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
627 | 627 | <label class="give-label" for="give-first"> |
628 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
629 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
628 | + <?php esc_html_e('First Name', 'give'); ?> |
|
629 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
630 | 630 | <span class="give-required-indicator">*</span> |
631 | 631 | <?php } ?> |
632 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
632 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
633 | 633 | </label> |
634 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
634 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
635 | 635 | echo ' required '; |
636 | 636 | } ?>/> |
637 | 637 | </p> |
638 | 638 | |
639 | 639 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
640 | 640 | <label class="give-label" for="give-last"> |
641 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
642 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
641 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
642 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
643 | 643 | <span class="give-required-indicator">*</span> |
644 | 644 | <?php } ?> |
645 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
645 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
646 | 646 | </label> |
647 | 647 | |
648 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
648 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
649 | 649 | echo ' required'; |
650 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
650 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
651 | 651 | echo ' required '; |
652 | 652 | } ?> /> |
653 | 653 | </p> |
@@ -658,18 +658,18 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @since 1.7 |
660 | 660 | */ |
661 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
661 | + do_action('give_donation_form_before_email', $form_id); |
|
662 | 662 | ?> |
663 | 663 | <p id="give-email-wrap" class="form-row form-row-wide"> |
664 | 664 | <label class="give-label" for="give-email"> |
665 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
666 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
665 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
666 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
667 | 667 | <span class="give-required-indicator">*</span> |
668 | 668 | <?php } ?> |
669 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
669 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
670 | 670 | </label> |
671 | 671 | |
672 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
672 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
673 | 673 | echo ' required '; |
674 | 674 | } ?>/> |
675 | 675 | |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @since 1.7 |
682 | 682 | */ |
683 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
683 | + do_action('give_donation_form_after_email', $form_id); |
|
684 | 684 | |
685 | 685 | /** |
686 | 686 | * Fire after personal email field |
687 | 687 | * |
688 | 688 | * @since 1.7 |
689 | 689 | */ |
690 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
690 | + do_action('give_donation_form_user_info', $form_id); |
|
691 | 691 | ?> |
692 | 692 | </fieldset> |
693 | 693 | <?php |
@@ -696,11 +696,11 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @since 1.7 |
698 | 698 | */ |
699 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
699 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
700 | 700 | } |
701 | 701 | |
702 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
703 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
702 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
703 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
704 | 704 | |
705 | 705 | /** |
706 | 706 | * Renders the credit card info form. |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * |
712 | 712 | * @return void |
713 | 713 | */ |
714 | -function give_get_cc_form( $form_id ) { |
|
714 | +function give_get_cc_form($form_id) { |
|
715 | 715 | |
716 | 716 | ob_start(); |
717 | 717 | |
@@ -722,45 +722,45 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @param int $form_id The form ID. |
724 | 724 | */ |
725 | - do_action( 'give_before_cc_fields', $form_id ); |
|
725 | + do_action('give_before_cc_fields', $form_id); |
|
726 | 726 | ?> |
727 | 727 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
728 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
729 | - <?php if ( is_ssl() ) : ?> |
|
728 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
729 | + <?php if (is_ssl()) : ?> |
|
730 | 730 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
731 | 731 | <span class="give-icon padlock"></span> |
732 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
732 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
733 | 733 | </div> |
734 | 734 | <?php endif; ?> |
735 | 735 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
736 | 736 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
737 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
737 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
738 | 738 | <span class="give-required-indicator">*</span> |
739 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
739 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
740 | 740 | <span class="card-type"></span> |
741 | 741 | </label> |
742 | 742 | |
743 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/> |
|
743 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/> |
|
744 | 744 | </p> |
745 | 745 | |
746 | 746 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
747 | 747 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
748 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
748 | + <?php esc_html_e('CVC', 'give'); ?> |
|
749 | 749 | <span class="give-required-indicator">*</span> |
750 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
750 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
751 | 751 | </label> |
752 | 752 | |
753 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" required/> |
|
753 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" required/> |
|
754 | 754 | </p> |
755 | 755 | |
756 | 756 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
757 | 757 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
758 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
758 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
759 | 759 | <span class="give-required-indicator">*</span> |
760 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
760 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
761 | 761 | </label> |
762 | 762 | |
763 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/> |
|
763 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/> |
|
764 | 764 | </p> |
765 | 765 | <?php |
766 | 766 | /** |
@@ -770,19 +770,19 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @param int $form_id The form ID. |
772 | 772 | */ |
773 | - do_action( 'give_before_cc_expiration' ); |
|
773 | + do_action('give_before_cc_expiration'); |
|
774 | 774 | ?> |
775 | 775 | <p class="card-expiration form-row form-row-one-third"> |
776 | 776 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
777 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
777 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
778 | 778 | <span class="give-required-indicator">*</span> |
779 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
779 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
780 | 780 | </label> |
781 | 781 | |
782 | 782 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
783 | 783 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
784 | 784 | |
785 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/> |
|
785 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/> |
|
786 | 786 | </p> |
787 | 787 | <?php |
788 | 788 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | * |
793 | 793 | * @param int $form_id The form ID. |
794 | 794 | */ |
795 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
795 | + do_action('give_after_cc_expiration', $form_id); |
|
796 | 796 | ?> |
797 | 797 | </fieldset> |
798 | 798 | <?php |
@@ -803,12 +803,12 @@ discard block |
||
803 | 803 | * |
804 | 804 | * @param int $form_id The form ID. |
805 | 805 | */ |
806 | - do_action( 'give_after_cc_fields', $form_id ); |
|
806 | + do_action('give_after_cc_fields', $form_id); |
|
807 | 807 | |
808 | 808 | echo ob_get_clean(); |
809 | 809 | } |
810 | 810 | |
811 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
811 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
812 | 812 | |
813 | 813 | /** |
814 | 814 | * Outputs the default credit card address fields. |
@@ -819,22 +819,22 @@ discard block |
||
819 | 819 | * |
820 | 820 | * @return void |
821 | 821 | */ |
822 | -function give_default_cc_address_fields( $form_id ) { |
|
822 | +function give_default_cc_address_fields($form_id) { |
|
823 | 823 | |
824 | 824 | $logged_in = is_user_logged_in(); |
825 | 825 | |
826 | - if ( $logged_in ) { |
|
827 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
826 | + if ($logged_in) { |
|
827 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
828 | 828 | } |
829 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
830 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
831 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
832 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
829 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
830 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
831 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
832 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
833 | 833 | |
834 | 834 | ob_start(); |
835 | 835 | ?> |
836 | 836 | <fieldset id="give_cc_address" class="cc-address"> |
837 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
837 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
838 | 838 | <?php |
839 | 839 | /** |
840 | 840 | * Fires while rendering credit card billing form, before address fields. |
@@ -843,97 +843,97 @@ discard block |
||
843 | 843 | * |
844 | 844 | * @param int $form_id The form ID. |
845 | 845 | */ |
846 | - do_action( 'give_cc_billing_top' ); |
|
846 | + do_action('give_cc_billing_top'); |
|
847 | 847 | ?> |
848 | 848 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
849 | 849 | <label for="card_address" class="give-label"> |
850 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
850 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
851 | 851 | <?php |
852 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
852 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
853 | 853 | <span class="give-required-indicator">*</span> |
854 | 854 | <?php } ?> |
855 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
855 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
856 | 856 | </label> |
857 | 857 | |
858 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
858 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
859 | 859 | echo ' required'; |
860 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
860 | + } ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
861 | 861 | echo ' required '; |
862 | 862 | } ?>/> |
863 | 863 | </p> |
864 | 864 | |
865 | 865 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
866 | 866 | <label for="card_address_2" class="give-label"> |
867 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
868 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
867 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
868 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
869 | 869 | <span class="give-required-indicator">*</span> |
870 | 870 | <?php } ?> |
871 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
871 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
872 | 872 | </label> |
873 | 873 | |
874 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
874 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
875 | 875 | echo ' required'; |
876 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
876 | + } ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
877 | 877 | echo ' required '; |
878 | 878 | } ?>/> |
879 | 879 | </p> |
880 | 880 | |
881 | 881 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
882 | 882 | <label for="card_city" class="give-label"> |
883 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
884 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
883 | + <?php esc_html_e('City', 'give'); ?> |
|
884 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
885 | 885 | <span class="give-required-indicator">*</span> |
886 | 886 | <?php } ?> |
887 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
887 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
888 | 888 | </label> |
889 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
889 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
890 | 890 | echo ' required'; |
891 | - } ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
891 | + } ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
892 | 892 | echo ' required '; |
893 | 893 | } ?>/> |
894 | 894 | </p> |
895 | 895 | |
896 | 896 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
897 | 897 | <label for="card_zip" class="give-label"> |
898 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
899 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
898 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
899 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
900 | 900 | <span class="give-required-indicator">*</span> |
901 | 901 | <?php } ?> |
902 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
902 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
903 | 903 | </label> |
904 | 904 | |
905 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
905 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
906 | 906 | echo ' required'; |
907 | - } ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
907 | + } ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
908 | 908 | echo ' required '; |
909 | 909 | } ?>/> |
910 | 910 | </p> |
911 | 911 | |
912 | 912 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
913 | 913 | <label for="billing_country" class="give-label"> |
914 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
915 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
914 | + <?php esc_html_e('Country', 'give'); ?> |
|
915 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
916 | 916 | <span class="give-required-indicator">*</span> |
917 | 917 | <?php } ?> |
918 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
918 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
919 | 919 | </label> |
920 | 920 | |
921 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
921 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
922 | 922 | echo ' required'; |
923 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
923 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
924 | 924 | echo ' required '; |
925 | 925 | } ?>> |
926 | 926 | <?php |
927 | 927 | |
928 | 928 | $selected_country = give_get_country(); |
929 | 929 | |
930 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
930 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
931 | 931 | $selected_country = $user_address['country']; |
932 | 932 | } |
933 | 933 | |
934 | 934 | $countries = give_get_country_list(); |
935 | - foreach ( $countries as $country_code => $country ) { |
|
936 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
935 | + foreach ($countries as $country_code => $country) { |
|
936 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
937 | 937 | } |
938 | 938 | ?> |
939 | 939 | </select> |
@@ -941,35 +941,35 @@ discard block |
||
941 | 941 | |
942 | 942 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
943 | 943 | <label for="card_state" class="give-label"> |
944 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
945 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
944 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
945 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
946 | 946 | <span class="give-required-indicator">*</span> |
947 | 947 | <?php } ?> |
948 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
948 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
949 | 949 | </label> |
950 | 950 | |
951 | 951 | <?php |
952 | 952 | $selected_state = give_get_state(); |
953 | - $states = give_get_states( $selected_country ); |
|
953 | + $states = give_get_states($selected_country); |
|
954 | 954 | |
955 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
955 | + if ($logged_in && ! empty($user_address['state'])) { |
|
956 | 956 | $selected_state = $user_address['state']; |
957 | 957 | } |
958 | 958 | |
959 | - if ( ! empty( $states ) ) : ?> |
|
960 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
959 | + if ( ! empty($states)) : ?> |
|
960 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
961 | 961 | echo ' required'; |
962 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
962 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
963 | 963 | echo ' required '; |
964 | 964 | } ?>> |
965 | 965 | <?php |
966 | - foreach ( $states as $state_code => $state ) { |
|
967 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
966 | + foreach ($states as $state_code => $state) { |
|
967 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
968 | 968 | } |
969 | 969 | ?> |
970 | 970 | </select> |
971 | 971 | <?php else : ?> |
972 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
972 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
973 | 973 | <?php endif; ?> |
974 | 974 | </p> |
975 | 975 | <?php |
@@ -980,14 +980,14 @@ discard block |
||
980 | 980 | * |
981 | 981 | * @param int $form_id The form ID. |
982 | 982 | */ |
983 | - do_action( 'give_cc_billing_bottom' ); |
|
983 | + do_action('give_cc_billing_bottom'); |
|
984 | 984 | ?> |
985 | 985 | </fieldset> |
986 | 986 | <?php |
987 | 987 | echo ob_get_clean(); |
988 | 988 | } |
989 | 989 | |
990 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
990 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
991 | 991 | |
992 | 992 | |
993 | 993 | /** |
@@ -999,26 +999,26 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return string |
1001 | 1001 | */ |
1002 | -function give_get_register_fields( $form_id ) { |
|
1002 | +function give_get_register_fields($form_id) { |
|
1003 | 1003 | |
1004 | 1004 | global $user_ID; |
1005 | 1005 | |
1006 | - if ( is_user_logged_in() ) { |
|
1007 | - $user_data = get_userdata( $user_ID ); |
|
1006 | + if (is_user_logged_in()) { |
|
1007 | + $user_data = get_userdata($user_ID); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1010 | + $show_register_form = give_show_login_register_option($form_id); |
|
1011 | 1011 | |
1012 | 1012 | ob_start(); ?> |
1013 | 1013 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1014 | 1014 | |
1015 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1015 | + <?php if ($show_register_form == 'both') { ?> |
|
1016 | 1016 | <div class="give-login-account-wrap"> |
1017 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1018 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1017 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1018 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1019 | 1019 | </p> |
1020 | 1020 | <p class="give-loading-text"> |
1021 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
1021 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
1022 | 1022 | </div> |
1023 | 1023 | <?php } ?> |
1024 | 1024 | |
@@ -1030,15 +1030,15 @@ discard block |
||
1030 | 1030 | * |
1031 | 1031 | * @param int $form_id The form ID. |
1032 | 1032 | */ |
1033 | - do_action( 'give_register_fields_before', $form_id ); |
|
1033 | + do_action('give_register_fields_before', $form_id); |
|
1034 | 1034 | ?> |
1035 | 1035 | |
1036 | 1036 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1037 | 1037 | <legend> |
1038 | 1038 | <?php |
1039 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1040 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1041 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1039 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1040 | + if ( ! give_logged_in_only($form_id)) { |
|
1041 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1042 | 1042 | } |
1043 | 1043 | ?> |
1044 | 1044 | </legend> |
@@ -1050,42 +1050,42 @@ discard block |
||
1050 | 1050 | * |
1051 | 1051 | * @param int $form_id The form ID. |
1052 | 1052 | */ |
1053 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1053 | + do_action('give_register_account_fields_before', $form_id); |
|
1054 | 1054 | ?> |
1055 | 1055 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
1056 | 1056 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1057 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1058 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1057 | + <?php esc_html_e('Username', 'give'); ?> |
|
1058 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1059 | 1059 | <span class="give-required-indicator">*</span> |
1060 | 1060 | <?php } ?> |
1061 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1061 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1062 | 1062 | </label> |
1063 | 1063 | |
1064 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
1064 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
1065 | 1065 | </div> |
1066 | 1066 | |
1067 | 1067 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
1068 | 1068 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1069 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1070 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1069 | + <?php esc_html_e('Password', 'give'); ?> |
|
1070 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1071 | 1071 | <span class="give-required-indicator">*</span> |
1072 | 1072 | <?php } ?> |
1073 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1073 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1074 | 1074 | </label> |
1075 | 1075 | |
1076 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
1076 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
1077 | 1077 | </div> |
1078 | 1078 | |
1079 | 1079 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
1080 | 1080 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1081 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1082 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1081 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1082 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1083 | 1083 | <span class="give-required-indicator">*</span> |
1084 | 1084 | <?php } ?> |
1085 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1085 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1086 | 1086 | </label> |
1087 | 1087 | |
1088 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
1088 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
1089 | 1089 | </div> |
1090 | 1090 | <?php |
1091 | 1091 | /** |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @param int $form_id The form ID. |
1097 | 1097 | */ |
1098 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1098 | + do_action('give_register_account_fields_after', $form_id); |
|
1099 | 1099 | ?> |
1100 | 1100 | </fieldset> |
1101 | 1101 | |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | * |
1108 | 1108 | * @param int $form_id The form ID. |
1109 | 1109 | */ |
1110 | - do_action( 'give_register_fields_after', $form_id ); |
|
1110 | + do_action('give_register_fields_after', $form_id); |
|
1111 | 1111 | ?> |
1112 | 1112 | |
1113 | 1113 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * |
1119 | 1119 | * @since 1.7 |
1120 | 1120 | */ |
1121 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1121 | + do_action('give_donation_form_user_info', $form_id); |
|
1122 | 1122 | ?> |
1123 | 1123 | |
1124 | 1124 | </fieldset> |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | echo ob_get_clean(); |
1127 | 1127 | } |
1128 | 1128 | |
1129 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
1129 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
1130 | 1130 | |
1131 | 1131 | /** |
1132 | 1132 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1139,31 +1139,31 @@ discard block |
||
1139 | 1139 | * |
1140 | 1140 | * @return string |
1141 | 1141 | */ |
1142 | -function give_get_login_fields( $form_id ) { |
|
1142 | +function give_get_login_fields($form_id) { |
|
1143 | 1143 | |
1144 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1145 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1144 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1145 | + $show_register_form = give_show_login_register_option($form_id); |
|
1146 | 1146 | |
1147 | 1147 | ob_start(); |
1148 | 1148 | ?> |
1149 | 1149 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1150 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1151 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1152 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1150 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1151 | + if ( ! give_logged_in_only($form_id)) { |
|
1152 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1153 | 1153 | } ?> |
1154 | 1154 | </legend> |
1155 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1155 | + <?php if ($show_register_form == 'both') { ?> |
|
1156 | 1156 | <p class="give-new-account-link"> |
1157 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1158 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
1159 | - <?php esc_html_e( 'Register', 'give' ); |
|
1160 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1161 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
1157 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1158 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
1159 | + <?php esc_html_e('Register', 'give'); |
|
1160 | + if ( ! give_logged_in_only($form_id)) { |
|
1161 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
1162 | 1162 | } ?> |
1163 | 1163 | </a> |
1164 | 1164 | </p> |
1165 | 1165 | <p class="give-loading-text"> |
1166 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
1166 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
1167 | 1167 | <?php } ?> |
1168 | 1168 | <?php |
1169 | 1169 | /** |
@@ -1173,44 +1173,44 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @param int $form_id The form ID. |
1175 | 1175 | */ |
1176 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1176 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1177 | 1177 | ?> |
1178 | 1178 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
1179 | 1179 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1180 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1181 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1180 | + <?php esc_html_e('Username', 'give'); ?> |
|
1181 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1182 | 1182 | <span class="give-required-indicator">*</span> |
1183 | 1183 | <?php } ?> |
1184 | 1184 | </label> |
1185 | 1185 | |
1186 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
1186 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
1187 | 1187 | echo 'required '; |
1188 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/> |
|
1188 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/> |
|
1189 | 1189 | </div> |
1190 | 1190 | |
1191 | 1191 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
1192 | 1192 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1193 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1194 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1193 | + <?php esc_html_e('Password', 'give'); ?> |
|
1194 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1195 | 1195 | <span class="give-required-indicator">*</span> |
1196 | 1196 | <?php } ?> |
1197 | 1197 | </label> |
1198 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
1198 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
1199 | 1199 | echo 'required '; |
1200 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/> |
|
1200 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/> |
|
1201 | 1201 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1202 | 1202 | </div> |
1203 | 1203 | |
1204 | 1204 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1205 | 1205 | <span class="give-forgot-password "> |
1206 | - <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1206 | + <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1207 | 1207 | </span> |
1208 | 1208 | </div> |
1209 | 1209 | |
1210 | 1210 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1211 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1212 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1213 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1211 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1212 | + <?php if ($show_register_form !== 'login') { ?> |
|
1213 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1214 | 1214 | <?php } ?> |
1215 | 1215 | <span class="give-loading-animation"></span> |
1216 | 1216 | </div> |
@@ -1222,14 +1222,14 @@ discard block |
||
1222 | 1222 | * |
1223 | 1223 | * @param int $form_id The form ID. |
1224 | 1224 | */ |
1225 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1225 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1226 | 1226 | ?> |
1227 | 1227 | </fieldset><!--end #give-login-fields--> |
1228 | 1228 | <?php |
1229 | 1229 | echo ob_get_clean(); |
1230 | 1230 | } |
1231 | 1231 | |
1232 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1232 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1233 | 1233 | |
1234 | 1234 | /** |
1235 | 1235 | * Payment Mode Select. |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @return void |
1247 | 1247 | */ |
1248 | -function give_payment_mode_select( $form_id ) { |
|
1248 | +function give_payment_mode_select($form_id) { |
|
1249 | 1249 | |
1250 | 1250 | $gateways = give_get_enabled_payment_gateways(); |
1251 | 1251 | |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | * |
1257 | 1257 | * @param int $form_id The form ID. |
1258 | 1258 | */ |
1259 | - do_action( 'give_donation_mode_top', $form_id ); ?> |
|
1259 | + do_action('give_donation_mode_top', $form_id); ?> |
|
1260 | 1260 | |
1261 | 1261 | <fieldset id="give-payment-mode-select"> |
1262 | 1262 | <?php |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | * |
1268 | 1268 | * @param int $form_id The form ID. |
1269 | 1269 | */ |
1270 | - do_action( 'give_donation_mode_before_gateways_wrap' ); |
|
1270 | + do_action('give_donation_mode_before_gateways_wrap'); |
|
1271 | 1271 | ?> |
1272 | 1272 | <div id="give-payment-mode-wrap"> |
1273 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1274 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
1273 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1274 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
1275 | 1275 | </legend> |
1276 | 1276 | <?php |
1277 | 1277 | /** |
@@ -1279,14 +1279,14 @@ discard block |
||
1279 | 1279 | * |
1280 | 1280 | * @since 1.7 |
1281 | 1281 | */ |
1282 | - do_action( 'give_donation_mode_before_gateways' ) |
|
1282 | + do_action('give_donation_mode_before_gateways') |
|
1283 | 1283 | ?> |
1284 | 1284 | <ul id="give-gateway-radio-list"> |
1285 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
1286 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
1285 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
1286 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
1287 | 1287 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
1288 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
1289 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
1288 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
1289 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
1290 | 1290 | echo '</label></li>'; |
1291 | 1291 | endforeach; ?> |
1292 | 1292 | </ul> |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | * |
1297 | 1297 | * @since 1.7 |
1298 | 1298 | */ |
1299 | - do_action( 'give_donation_mode_after_gateways' ); |
|
1299 | + do_action('give_donation_mode_after_gateways'); |
|
1300 | 1300 | ?> |
1301 | 1301 | </div> |
1302 | 1302 | <?php |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | * |
1308 | 1308 | * @param int $form_id The form ID. |
1309 | 1309 | */ |
1310 | - do_action( 'give_donation_mode_after_gateways_wrap' ); |
|
1310 | + do_action('give_donation_mode_after_gateways_wrap'); |
|
1311 | 1311 | ?> |
1312 | 1312 | </fieldset> |
1313 | 1313 | |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | * |
1320 | 1320 | * @param int $form_id The form ID. |
1321 | 1321 | */ |
1322 | - do_action( 'give_donation_mode_bottom', $form_id ); |
|
1322 | + do_action('give_donation_mode_bottom', $form_id); |
|
1323 | 1323 | ?> |
1324 | 1324 | |
1325 | 1325 | <div id="give_purchase_form_wrap"> |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | * |
1331 | 1331 | * @since 1.7 |
1332 | 1332 | */ |
1333 | - do_action( 'give_donation_form', $form_id ); |
|
1333 | + do_action('give_donation_form', $form_id); |
|
1334 | 1334 | ?> |
1335 | 1335 | |
1336 | 1336 | </div> |
@@ -1341,10 +1341,10 @@ discard block |
||
1341 | 1341 | * |
1342 | 1342 | * @since 1.7 |
1343 | 1343 | */ |
1344 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1344 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1347 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1348 | 1348 | |
1349 | 1349 | /** |
1350 | 1350 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1357,46 +1357,46 @@ discard block |
||
1357 | 1357 | * |
1358 | 1358 | * @return void |
1359 | 1359 | */ |
1360 | -function give_terms_agreement( $form_id ) { |
|
1360 | +function give_terms_agreement($form_id) { |
|
1361 | 1361 | |
1362 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1363 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1364 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1362 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1363 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1364 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1365 | 1365 | |
1366 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1366 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1367 | 1367 | <fieldset id="give_terms_agreement"> |
1368 | - <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
1368 | + <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
1369 | 1369 | <?php |
1370 | 1370 | /** |
1371 | 1371 | * Fires while rendering terms of agreement, before the fields. |
1372 | 1372 | * |
1373 | 1373 | * @since 1.0 |
1374 | 1374 | */ |
1375 | - do_action( 'give_before_terms' ); |
|
1375 | + do_action('give_before_terms'); |
|
1376 | 1376 | |
1377 | - echo wpautop( stripslashes( $terms ) ); |
|
1377 | + echo wpautop(stripslashes($terms)); |
|
1378 | 1378 | /** |
1379 | 1379 | * Fires while rendering terms of agreement, after the fields. |
1380 | 1380 | * |
1381 | 1381 | * @since 1.0 |
1382 | 1382 | */ |
1383 | - do_action( 'give_after_terms' ); |
|
1383 | + do_action('give_after_terms'); |
|
1384 | 1384 | ?> |
1385 | 1385 | </div> |
1386 | 1386 | <div id="give_show_terms"> |
1387 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1388 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1387 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1388 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1389 | 1389 | </div> |
1390 | 1390 | |
1391 | 1391 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1392 | - <label for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label> |
|
1392 | + <label for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label> |
|
1393 | 1393 | |
1394 | 1394 | </fieldset> |
1395 | 1395 | <?php |
1396 | 1396 | } |
1397 | 1397 | } |
1398 | 1398 | |
1399 | -add_action( 'give_donation_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1399 | +add_action('give_donation_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1400 | 1400 | |
1401 | 1401 | /** |
1402 | 1402 | * Checkout Final Total. |
@@ -1409,27 +1409,27 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @return void |
1411 | 1411 | */ |
1412 | -function give_checkout_final_total( $form_id ) { |
|
1412 | +function give_checkout_final_total($form_id) { |
|
1413 | 1413 | |
1414 | - if ( isset( $_POST['give_total'] ) ) { |
|
1415 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1414 | + if (isset($_POST['give_total'])) { |
|
1415 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1416 | 1416 | } else { |
1417 | 1417 | //default total |
1418 | - $total = give_get_default_form_amount( $form_id ); |
|
1418 | + $total = give_get_default_form_amount($form_id); |
|
1419 | 1419 | } |
1420 | 1420 | //Only proceed if give_total available |
1421 | - if ( empty( $total ) ) { |
|
1421 | + if (empty($total)) { |
|
1422 | 1422 | return; |
1423 | 1423 | } |
1424 | 1424 | ?> |
1425 | 1425 | <p id="give-final-total-wrap" class="form-wrap "> |
1426 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1427 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1426 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1427 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1428 | 1428 | </p> |
1429 | 1429 | <?php |
1430 | 1430 | } |
1431 | 1431 | |
1432 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1432 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1433 | 1433 | |
1434 | 1434 | /** |
1435 | 1435 | * Renders the Checkout Submit section. |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | * |
1441 | 1441 | * @return void |
1442 | 1442 | */ |
1443 | -function give_checkout_submit( $form_id ) { |
|
1443 | +function give_checkout_submit($form_id) { |
|
1444 | 1444 | ?> |
1445 | 1445 | <fieldset id="give_purchase_submit"> |
1446 | 1446 | <?php |
@@ -1449,24 +1449,24 @@ discard block |
||
1449 | 1449 | * |
1450 | 1450 | * @since 1.7 |
1451 | 1451 | */ |
1452 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1452 | + do_action('give_donation_form_before_submit', $form_id); |
|
1453 | 1453 | |
1454 | - give_checkout_hidden_fields( $form_id ); |
|
1454 | + give_checkout_hidden_fields($form_id); |
|
1455 | 1455 | |
1456 | - echo give_checkout_button_purchase( $form_id ); |
|
1456 | + echo give_checkout_button_purchase($form_id); |
|
1457 | 1457 | |
1458 | 1458 | /** |
1459 | 1459 | * Fire after donation form submit. |
1460 | 1460 | * |
1461 | 1461 | * @since 1.7 |
1462 | 1462 | */ |
1463 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1463 | + do_action('give_donation_form_after_submit', $form_id); |
|
1464 | 1464 | ?> |
1465 | 1465 | </fieldset> |
1466 | 1466 | <?php |
1467 | 1467 | } |
1468 | 1468 | |
1469 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1469 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1470 | 1470 | |
1471 | 1471 | /** |
1472 | 1472 | * Give Checkout Button. |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * |
1480 | 1480 | * @return string |
1481 | 1481 | */ |
1482 | -function give_checkout_button_purchase( $form_id ) { |
|
1482 | +function give_checkout_button_purchase($form_id) { |
|
1483 | 1483 | |
1484 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1485 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1484 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1485 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1486 | 1486 | ob_start(); ?> |
1487 | 1487 | <div class="give-submit-button-wrap give-clearfix"> |
1488 | 1488 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
1489 | 1489 | <span class="give-loading-animation"></span> |
1490 | 1490 | </div> |
1491 | 1491 | <?php |
1492 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1492 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | /** |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | * |
1504 | 1504 | * @return void |
1505 | 1505 | */ |
1506 | -function give_agree_to_terms_js( $form_id ) { |
|
1506 | +function give_agree_to_terms_js($form_id) { |
|
1507 | 1507 | |
1508 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1508 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1509 | 1509 | |
1510 | - if ( $form_option === 'yes' ) { |
|
1510 | + if ($form_option === 'yes') { |
|
1511 | 1511 | ?> |
1512 | 1512 | <script type="text/javascript"> |
1513 | 1513 | jQuery(document).ready(function ($) { |
1514 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
1514 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1515 | 1515 | e.preventDefault(); |
1516 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1517 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
1516 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
1517 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1518 | 1518 | return false; |
1519 | 1519 | }); |
1520 | 1520 | }); |
@@ -1523,7 +1523,7 @@ discard block |
||
1523 | 1523 | } |
1524 | 1524 | } |
1525 | 1525 | |
1526 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1526 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1527 | 1527 | |
1528 | 1528 | /** |
1529 | 1529 | * Show Give Goals. |
@@ -1537,17 +1537,17 @@ discard block |
||
1537 | 1537 | * |
1538 | 1538 | * @return mixed |
1539 | 1539 | */ |
1540 | -function give_show_goal_progress( $form_id, $args ) { |
|
1540 | +function give_show_goal_progress($form_id, $args) { |
|
1541 | 1541 | |
1542 | 1542 | ob_start(); |
1543 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1543 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1544 | 1544 | |
1545 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1545 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1546 | 1546 | |
1547 | 1547 | return true; |
1548 | 1548 | } |
1549 | 1549 | |
1550 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1550 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1551 | 1551 | |
1552 | 1552 | /** |
1553 | 1553 | * Adds Actions to Render Form Content. |
@@ -1559,19 +1559,19 @@ discard block |
||
1559 | 1559 | * |
1560 | 1560 | * @return void |
1561 | 1561 | */ |
1562 | -function give_form_content( $form_id, $args ) { |
|
1562 | +function give_form_content($form_id, $args) { |
|
1563 | 1563 | |
1564 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1564 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1565 | 1565 | ? $args['show_content'] |
1566 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1566 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1567 | 1567 | |
1568 | - if ( $show_content !== 'none' ) { |
|
1568 | + if ($show_content !== 'none') { |
|
1569 | 1569 | //add action according to value |
1570 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1570 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1571 | 1571 | } |
1572 | 1572 | } |
1573 | 1573 | |
1574 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1574 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1575 | 1575 | |
1576 | 1576 | /** |
1577 | 1577 | * Renders Post Form Content. |
@@ -1585,24 +1585,24 @@ discard block |
||
1585 | 1585 | * |
1586 | 1586 | * @return void |
1587 | 1587 | */ |
1588 | -function give_form_display_content( $form_id, $args ) { |
|
1588 | +function give_form_display_content($form_id, $args) { |
|
1589 | 1589 | |
1590 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1591 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1590 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1591 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1592 | 1592 | ? $args['show_content'] |
1593 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1593 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1594 | 1594 | |
1595 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1596 | - $content = apply_filters( 'the_content', $content ); |
|
1595 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1596 | + $content = apply_filters('the_content', $content); |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1599 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1600 | 1600 | |
1601 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1601 | + echo apply_filters('give_form_content_output', $output); |
|
1602 | 1602 | |
1603 | 1603 | //remove action to prevent content output on addition forms on page |
1604 | 1604 | //@see: https://github.com/WordImpress/Give/issues/634 |
1605 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1605 | + remove_action($show_content, 'give_form_display_content'); |
|
1606 | 1606 | } |
1607 | 1607 | |
1608 | 1608 | /** |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | * |
1615 | 1615 | * @return void |
1616 | 1616 | */ |
1617 | -function give_checkout_hidden_fields( $form_id ) { |
|
1617 | +function give_checkout_hidden_fields($form_id) { |
|
1618 | 1618 | |
1619 | 1619 | /** |
1620 | 1620 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1623,13 +1623,13 @@ discard block |
||
1623 | 1623 | * |
1624 | 1624 | * @param int $form_id The form ID. |
1625 | 1625 | */ |
1626 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1626 | + do_action('give_hidden_fields_before', $form_id); |
|
1627 | 1627 | |
1628 | - if ( is_user_logged_in() ) { ?> |
|
1628 | + if (is_user_logged_in()) { ?> |
|
1629 | 1629 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1630 | 1630 | <?php } ?> |
1631 | 1631 | <input type="hidden" name="give_action" value="purchase"/> |
1632 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1632 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1633 | 1633 | <?php |
1634 | 1634 | /** |
1635 | 1635 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | * |
1639 | 1639 | * @param int $form_id The form ID. |
1640 | 1640 | */ |
1641 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1641 | + do_action('give_hidden_fields_after', $form_id); |
|
1642 | 1642 | |
1643 | 1643 | } |
1644 | 1644 | |
@@ -1653,20 +1653,20 @@ discard block |
||
1653 | 1653 | * |
1654 | 1654 | * @return string $content Filtered content. |
1655 | 1655 | */ |
1656 | -function give_filter_success_page_content( $content ) { |
|
1656 | +function give_filter_success_page_content($content) { |
|
1657 | 1657 | |
1658 | 1658 | global $give_options; |
1659 | 1659 | |
1660 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1661 | - if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1662 | - $content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1660 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1661 | + if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) { |
|
1662 | + $content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content); |
|
1663 | 1663 | } |
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | return $content; |
1667 | 1667 | } |
1668 | 1668 | |
1669 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1669 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1670 | 1670 | |
1671 | 1671 | /** |
1672 | 1672 | * Test Mode Frontend Warning. |
@@ -1677,14 +1677,14 @@ discard block |
||
1677 | 1677 | */ |
1678 | 1678 | function give_test_mode_frontend_warning() { |
1679 | 1679 | |
1680 | - $test_mode = give_get_option( 'test_mode' ); |
|
1680 | + $test_mode = give_get_option('test_mode'); |
|
1681 | 1681 | |
1682 | - if ( $test_mode == 'on' ) { |
|
1683 | - 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>'; |
|
1682 | + if ($test_mode == 'on') { |
|
1683 | + 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>'; |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | |
1687 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1687 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1688 | 1688 | |
1689 | 1689 | /** |
1690 | 1690 | * Members-only Form. |
@@ -1698,21 +1698,21 @@ discard block |
||
1698 | 1698 | * |
1699 | 1699 | * @return string |
1700 | 1700 | */ |
1701 | -function give_members_only_form( $final_output, $args ) { |
|
1701 | +function give_members_only_form($final_output, $args) { |
|
1702 | 1702 | |
1703 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1703 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1704 | 1704 | |
1705 | 1705 | //Sanity Check: Must have form_id & not be logged in |
1706 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1706 | + if (empty($form_id) || is_user_logged_in()) { |
|
1707 | 1707 | return $final_output; |
1708 | 1708 | } |
1709 | 1709 | |
1710 | 1710 | //Logged in only and Register / Login set to none |
1711 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1711 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1712 | 1712 | |
1713 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1713 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1714 | 1714 | |
1715 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1715 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1716 | 1716 | |
1717 | 1717 | } |
1718 | 1718 | |
@@ -1720,4 +1720,4 @@ discard block |
||
1720 | 1720 | |
1721 | 1721 | } |
1722 | 1722 | |
1723 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1723 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -64,11 +64,14 @@ |
||
64 | 64 | }, 250 ); |
65 | 65 | </script> |
66 | 66 | |
67 | - <?php else : ?> |
|
67 | + <?php else { |
|
68 | + : ?> |
|
68 | 69 | |
69 | 70 | <div id="give-upgrade-status"> |
70 | 71 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | + <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); |
|
73 | +} |
|
74 | +?> |
|
72 | 75 | <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
73 | 76 | </p> |
74 | 77 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_upgrades_screen() { |
24 | - $action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : ''; |
|
25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
29 | - $steps = round( ( $total / $number ), 0 ); |
|
24 | + $action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : ''; |
|
25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
29 | + $steps = round(($total / $number), 0); |
|
30 | 30 | |
31 | 31 | $doing_upgrade_args = array( |
32 | 32 | 'page' => 'give-upgrades', |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | 'custom' => $custom, |
37 | 37 | 'steps' => $steps |
38 | 38 | ); |
39 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
40 | - if ( $step > $steps ) { |
|
39 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
40 | + if ($step > $steps) { |
|
41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
42 | 42 | $steps = $step; |
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | - <h1><?php esc_html_e( 'Give - Upgrades', 'give' ); ?></h1> |
|
46 | + <h1><?php esc_html_e('Give - Upgrades', 'give'); ?></h1> |
|
47 | 47 | |
48 | - <?php if ( ! empty( $action ) ) : ?> |
|
48 | + <?php if ( ! empty($action)) : ?> |
|
49 | 49 | |
50 | 50 | <div id="give-upgrade-status"> |
51 | - <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
52 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
51 | + <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
52 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
53 | 53 | </p> |
54 | 54 | |
55 | - <?php if ( ! empty( $total ) ) : ?> |
|
55 | + <?php if ( ! empty($total)) : ?> |
|
56 | 56 | <p> |
57 | - <strong><?php printf( esc_html__( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong> |
|
57 | + <strong><?php printf(esc_html__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong> |
|
58 | 58 | </p> |
59 | 59 | <?php endif; ?> |
60 | 60 | </div> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | <div id="give-upgrade-status"> |
70 | 70 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
71 | + <?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
72 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
73 | 73 | </p> |
74 | 74 | </div> |
75 | 75 | <script type="text/javascript"> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'give_profile_editor' ); |
|
23 | + parent::__construct('give_profile_editor'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_receipt' ); |
|
24 | + parent::__construct('give_receipt'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'listbox', |
41 | 41 | 'name' => 'price', |
42 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
42 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
43 | 43 | 'options' => array( |
44 | - 'true' => esc_html__( 'Show', 'give' ), |
|
45 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
44 | + 'true' => esc_html__('Show', 'give'), |
|
45 | + 'false' => esc_html__('Hide', 'give'), |
|
46 | 46 | ), |
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'listbox', |
50 | 50 | 'name' => 'donor', |
51 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
51 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
52 | 52 | 'options' => array( |
53 | - 'true' => esc_html__( 'Show', 'give' ), |
|
54 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
53 | + 'true' => esc_html__('Show', 'give'), |
|
54 | + 'false' => esc_html__('Hide', 'give'), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'date', |
60 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
60 | + 'label' => esc_html__('Show Date:', 'give'), |
|
61 | 61 | 'options' => array( |
62 | - 'true' => esc_html__( 'Show', 'give' ), |
|
63 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
62 | + 'true' => esc_html__('Show', 'give'), |
|
63 | + 'false' => esc_html__('Hide', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | 'type' => 'listbox', |
68 | 68 | 'name' => 'payment_key', |
69 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
69 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
70 | 70 | 'options' => array( |
71 | - 'true' => esc_html__( 'Show', 'give' ), |
|
72 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
71 | + 'true' => esc_html__('Show', 'give'), |
|
72 | + 'false' => esc_html__('Hide', 'give'), |
|
73 | 73 | ), |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'type' => 'listbox', |
77 | 77 | 'name' => 'payment_method', |
78 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
78 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'payment_id', |
87 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
87 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
88 | 88 | 'options' => array( |
89 | - 'true' => esc_html__( 'Show', 'give' ), |
|
90 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
89 | + 'true' => esc_html__('Show', 'give'), |
|
90 | + 'false' => esc_html__('Hide', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_History extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'donation_history' ); |
|
23 | + parent::__construct('donation_history'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |