@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -30,54 +30,54 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool|array List of all user donations. |
32 | 32 | */ |
33 | -function give_get_users_donations( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
33 | +function give_get_users_donations($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
34 | 34 | |
35 | - if ( empty( $user ) ) { |
|
35 | + if (empty($user)) { |
|
36 | 36 | $user = get_current_user_id(); |
37 | 37 | } |
38 | 38 | |
39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | - $status = ( 'complete' === $status ) ? 'publish' : $status; |
|
43 | + $status = ('complete' === $status) ? 'publish' : $status; |
|
44 | 44 | $paged = 1; |
45 | 45 | |
46 | - if ( $pagination ) { |
|
47 | - if ( get_query_var( 'paged' ) ) { |
|
48 | - $paged = get_query_var( 'paged' ); |
|
49 | - } elseif ( get_query_var( 'page' ) ) { |
|
50 | - $paged = get_query_var( 'page' ); |
|
46 | + if ($pagination) { |
|
47 | + if (get_query_var('paged')) { |
|
48 | + $paged = get_query_var('paged'); |
|
49 | + } elseif (get_query_var('page')) { |
|
50 | + $paged = get_query_var('page'); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
54 | + $args = apply_filters('give_get_users_donations_args', array( |
|
55 | 55 | 'user' => $user, |
56 | 56 | 'number' => $number, |
57 | 57 | 'status' => $status, |
58 | 58 | 'orderby' => 'date', |
59 | - ) ); |
|
59 | + )); |
|
60 | 60 | |
61 | - if ( $pagination ) { |
|
61 | + if ($pagination) { |
|
62 | 62 | $args['page'] = $paged; |
63 | 63 | } else { |
64 | 64 | $args['nopaging'] = true; |
65 | 65 | } |
66 | 66 | |
67 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
68 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
67 | + $by_user_id = is_numeric($user) ? true : false; |
|
68 | + $donor = new Give_Donor($user, $by_user_id); |
|
69 | 69 | |
70 | - if ( ! empty( $donor->payment_ids ) ) { |
|
70 | + if ( ! empty($donor->payment_ids)) { |
|
71 | 71 | |
72 | - unset( $args['user'] ); |
|
73 | - $args['post__in'] = array_map( 'absint', explode( ',', $donor->payment_ids ) ); |
|
72 | + unset($args['user']); |
|
73 | + $args['post__in'] = array_map('absint', explode(',', $donor->payment_ids)); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | - $donations = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
77 | + $donations = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
78 | 78 | |
79 | 79 | // No donations. |
80 | - if ( ! $donations ) { |
|
80 | + if ( ! $donations) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
@@ -96,65 +96,65 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return bool|object List of unique forms donated by user |
98 | 98 | */ |
99 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
100 | - if ( empty( $user ) ) { |
|
99 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
100 | + if (empty($user)) { |
|
101 | 101 | $user = get_current_user_id(); |
102 | 102 | } |
103 | 103 | |
104 | - if ( empty( $user ) ) { |
|
104 | + if (empty($user)) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
108 | + $by_user_id = is_numeric($user) ? true : false; |
|
109 | 109 | |
110 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
110 | + $donor = new Give_Donor($user, $by_user_id); |
|
111 | 111 | |
112 | - if ( empty( $donor->payment_ids ) ) { |
|
112 | + if (empty($donor->payment_ids)) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // Get all the items donated. |
117 | - $payment_ids = array_reverse( explode( ',', $donor->payment_ids ) ); |
|
118 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
119 | - if ( ! empty( $limit_payments ) ) { |
|
120 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
117 | + $payment_ids = array_reverse(explode(',', $donor->payment_ids)); |
|
118 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
119 | + if ( ! empty($limit_payments)) { |
|
120 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
121 | 121 | } |
122 | 122 | $donation_data = array(); |
123 | - foreach ( $payment_ids as $payment_id ) { |
|
124 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
123 | + foreach ($payment_ids as $payment_id) { |
|
124 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
125 | 125 | } |
126 | 126 | |
127 | - if ( empty( $donation_data ) ) { |
|
127 | + if (empty($donation_data)) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Grab only the post ids "form_id" of the forms donated on this order. |
132 | 132 | $completed_donations_ids = array(); |
133 | - foreach ( $donation_data as $donation_meta ) { |
|
134 | - $completed_donations_ids[] = isset( $donation_meta['form_id'] ) ? $donation_meta['form_id'] : ''; |
|
133 | + foreach ($donation_data as $donation_meta) { |
|
134 | + $completed_donations_ids[] = isset($donation_meta['form_id']) ? $donation_meta['form_id'] : ''; |
|
135 | 135 | } |
136 | 136 | |
137 | - if ( empty( $completed_donations_ids ) ) { |
|
137 | + if (empty($completed_donations_ids)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Only include each donation once. |
142 | - $form_ids = array_unique( $completed_donations_ids ); |
|
142 | + $form_ids = array_unique($completed_donations_ids); |
|
143 | 143 | |
144 | 144 | // Make sure we still have some products and a first item. |
145 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
145 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | - $post_type = get_post_type( $form_ids[0] ); |
|
149 | + $post_type = get_post_type($form_ids[0]); |
|
150 | 150 | |
151 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
151 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
152 | 152 | 'include' => $form_ids, |
153 | 153 | 'post_type' => $post_type, |
154 | - 'posts_per_page' => - 1, |
|
155 | - ) ); |
|
154 | + 'posts_per_page' => -1, |
|
155 | + )); |
|
156 | 156 | |
157 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
157 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return bool True if has donated, false other wise. |
172 | 172 | */ |
173 | -function give_has_donations( $user_id = null ) { |
|
174 | - if ( empty( $user_id ) ) { |
|
173 | +function give_has_donations($user_id = null) { |
|
174 | + if (empty($user_id)) { |
|
175 | 175 | $user_id = get_current_user_id(); |
176 | 176 | } |
177 | 177 | |
178 | - if ( give_get_users_donations( $user_id, 1 ) ) { |
|
178 | + if (give_get_users_donations($user_id, 1)) { |
|
179 | 179 | return true; // User has at least one donation. |
180 | 180 | } |
181 | 181 | |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return array |
198 | 198 | */ |
199 | -function give_get_donation_stats_by_user( $user = '' ) { |
|
199 | +function give_get_donation_stats_by_user($user = '') { |
|
200 | 200 | |
201 | 201 | $field = ''; |
202 | 202 | |
203 | - if ( is_email( $user ) ) { |
|
203 | + if (is_email($user)) { |
|
204 | 204 | $field = 'email'; |
205 | - } elseif ( is_numeric( $user ) ) { |
|
205 | + } elseif (is_numeric($user)) { |
|
206 | 206 | $field = 'user_id'; |
207 | 207 | } |
208 | 208 | |
209 | - $stats = array(); |
|
210 | - $donor = Give()->donors->get_donor_by( $field, $user ); |
|
209 | + $stats = array(); |
|
210 | + $donor = Give()->donors->get_donor_by($field, $user); |
|
211 | 211 | |
212 | - if ( $donor ) { |
|
213 | - $donor = new Give_Donor( $donor->id ); |
|
214 | - $stats['purchases'] = absint( $donor->purchase_count ); |
|
215 | - $stats['total_spent'] = give_maybe_sanitize_amount( $donor->get_total_donation_amount() ); |
|
212 | + if ($donor) { |
|
213 | + $donor = new Give_Donor($donor->id); |
|
214 | + $stats['purchases'] = absint($donor->purchase_count); |
|
215 | + $stats['total_spent'] = give_maybe_sanitize_amount($donor->get_total_donation_amount()); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 1.7 |
222 | 222 | */ |
223 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
223 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
224 | 224 | |
225 | 225 | return $stats; |
226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return int The total number of donations. |
240 | 240 | */ |
241 | -function give_count_donations_of_donor( $user = null ) { |
|
241 | +function give_count_donations_of_donor($user = null) { |
|
242 | 242 | |
243 | 243 | // Logged in? |
244 | - if ( empty( $user ) ) { |
|
244 | + if (empty($user)) { |
|
245 | 245 | $user = get_current_user_id(); |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Email access? |
249 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
249 | + if (empty($user) && Give()->email_access->token_email) { |
|
250 | 250 | $user = Give()->email_access->token_email; |
251 | 251 | } |
252 | 252 | |
253 | - $stats = ! empty( $user ) ? give_get_donation_stats_by_user( $user ) : false; |
|
253 | + $stats = ! empty($user) ? give_get_donation_stats_by_user($user) : false; |
|
254 | 254 | |
255 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
255 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return float The total amount the user has spent |
267 | 267 | */ |
268 | -function give_donation_total_of_user( $user = null ) { |
|
268 | +function give_donation_total_of_user($user = null) { |
|
269 | 269 | |
270 | - $stats = give_get_donation_stats_by_user( $user ); |
|
270 | + $stats = give_get_donation_stats_by_user($user); |
|
271 | 271 | |
272 | 272 | return $stats['total_spent']; |
273 | 273 | } |
@@ -283,40 +283,40 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return bool |
285 | 285 | */ |
286 | -function give_validate_username( $username, $form_id = 0 ) { |
|
286 | +function give_validate_username($username, $form_id = 0) { |
|
287 | 287 | $valid = true; |
288 | 288 | |
289 | 289 | // Validate username. |
290 | - if ( ! empty( $username ) ) { |
|
290 | + if ( ! empty($username)) { |
|
291 | 291 | |
292 | 292 | // Sanitize username. |
293 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
293 | + $sanitized_user_name = sanitize_user($username, false); |
|
294 | 294 | |
295 | 295 | // We have an user name, check if it already exists. |
296 | - if ( username_exists( $username ) ) { |
|
296 | + if (username_exists($username)) { |
|
297 | 297 | // Username already registered. |
298 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
298 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
299 | 299 | $valid = false; |
300 | 300 | |
301 | 301 | // Check if it's valid. |
302 | - } elseif ( $sanitized_user_name !== $username ) { |
|
302 | + } elseif ($sanitized_user_name !== $username) { |
|
303 | 303 | // Invalid username. |
304 | - if ( is_multisite() ) { |
|
305 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
304 | + if (is_multisite()) { |
|
305 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
306 | 306 | $valid = false; |
307 | 307 | } else { |
308 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
308 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
309 | 309 | $valid = false; |
310 | 310 | } |
311 | 311 | } |
312 | 312 | } else { |
313 | 313 | // Username is empty. |
314 | - give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) ); |
|
314 | + give_set_error('username_empty', __('Enter a username.', 'give')); |
|
315 | 315 | $valid = false; |
316 | 316 | |
317 | 317 | // Check if guest checkout is disable for form. |
318 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
319 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
318 | + if ($form_id && give_logged_in_only($form_id)) { |
|
319 | + give_set_error('registration_required', __('You must register or login to complete your donation.', 'give')); |
|
320 | 320 | $valid = false; |
321 | 321 | } |
322 | 322 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @since 1.8 |
332 | 332 | */ |
333 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
333 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
334 | 334 | |
335 | 335 | return $valid; |
336 | 336 | } |
@@ -346,30 +346,30 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return bool |
348 | 348 | */ |
349 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
349 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
350 | 350 | $valid = true; |
351 | 351 | |
352 | - if ( empty( $email ) ) { |
|
352 | + if (empty($email)) { |
|
353 | 353 | // No email. |
354 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
354 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
355 | 355 | $valid = false; |
356 | 356 | |
357 | - } elseif ( email_exists( $email ) ) { |
|
357 | + } elseif (email_exists($email)) { |
|
358 | 358 | // Email already exists. |
359 | - give_set_error( 'email_exists', __( 'Email already exists.', 'give' ) ); |
|
359 | + give_set_error('email_exists', __('Email already exists.', 'give')); |
|
360 | 360 | $valid = false; |
361 | 361 | |
362 | - } elseif ( ! is_email( $email ) ) { |
|
362 | + } elseif ( ! is_email($email)) { |
|
363 | 363 | // Validate email. |
364 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
364 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
365 | 365 | $valid = false; |
366 | 366 | |
367 | - } elseif ( $registering_new_user ) { |
|
367 | + } elseif ($registering_new_user) { |
|
368 | 368 | |
369 | 369 | // If donor email is not primary. |
370 | - if ( ! email_exists( $email ) && give_donor_email_exists( $email ) && give_is_additional_email( $email ) ) { |
|
370 | + if ( ! email_exists($email) && give_donor_email_exists($email) && give_is_additional_email($email)) { |
|
371 | 371 | // Check if email exists. |
372 | - give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) ); |
|
372 | + give_set_error('email_used', __('The email address provided is already active for another user.', 'give')); |
|
373 | 373 | $valid = false; |
374 | 374 | } |
375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @since 1.8 |
385 | 385 | */ |
386 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
386 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
387 | 387 | |
388 | 388 | return $valid; |
389 | 389 | } |
@@ -399,34 +399,34 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return bool |
401 | 401 | */ |
402 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
402 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
403 | 403 | $valid = true; |
404 | 404 | |
405 | 405 | // Passwords Validation For New Donors Only. |
406 | - if ( $registering_new_user ) { |
|
406 | + if ($registering_new_user) { |
|
407 | 407 | // Password or confirmation missing. |
408 | - if ( ! $password ) { |
|
408 | + if ( ! $password) { |
|
409 | 409 | // The password is invalid. |
410 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
410 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
411 | 411 | $valid = false; |
412 | - } elseif ( ! $confirm_password ) { |
|
412 | + } elseif ( ! $confirm_password) { |
|
413 | 413 | // Confirmation password is invalid. |
414 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) ); |
|
414 | + give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give')); |
|
415 | 415 | $valid = false; |
416 | 416 | } |
417 | 417 | } |
418 | 418 | // Passwords Validation For New Donors as well as Existing Donors. |
419 | - if ( $password || $confirm_password ) { |
|
420 | - if ( strlen( $password ) < 6 || strlen( $confirm_password ) < 6 ) { |
|
419 | + if ($password || $confirm_password) { |
|
420 | + if (strlen($password) < 6 || strlen($confirm_password) < 6) { |
|
421 | 421 | // Seems Weak Password. |
422 | - give_set_error( 'password_weak', __( 'Passwords should have at least 6 characters.', 'give' ) ); |
|
422 | + give_set_error('password_weak', __('Passwords should have at least 6 characters.', 'give')); |
|
423 | 423 | $valid = false; |
424 | 424 | } |
425 | - if ( $password && $confirm_password ) { |
|
425 | + if ($password && $confirm_password) { |
|
426 | 426 | // Verify confirmation matches. |
427 | - if ( $password !== $confirm_password ) { |
|
427 | + if ($password !== $confirm_password) { |
|
428 | 428 | // Passwords do not match. |
429 | - give_set_error( 'password_mismatch', __( 'Passwords you entered do not match. Please try again.', 'give' ) ); |
|
429 | + give_set_error('password_mismatch', __('Passwords you entered do not match. Please try again.', 'give')); |
|
430 | 430 | $valid = false; |
431 | 431 | } |
432 | 432 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @since 1.8 |
444 | 444 | */ |
445 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
445 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
446 | 446 | |
447 | 447 | return $valid; |
448 | 448 | } |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | * |
471 | 471 | * @return array The donor's address, if any |
472 | 472 | */ |
473 | -function give_get_donor_address( $donor_id = null, $args = array() ) { |
|
474 | - if ( empty( $donor_id ) ) { |
|
473 | +function give_get_donor_address($donor_id = null, $args = array()) { |
|
474 | + if (empty($donor_id)) { |
|
475 | 475 | $donor_id = get_current_user_id(); |
476 | 476 | } |
477 | 477 | |
@@ -493,33 +493,33 @@ discard block |
||
493 | 493 | |
494 | 494 | |
495 | 495 | // Backward compatibility for user id param. |
496 | - $by_user_id = get_user_by( 'id', $donor_id ) ? true : false; |
|
496 | + $by_user_id = get_user_by('id', $donor_id) ? true : false; |
|
497 | 497 | |
498 | 498 | // Backward compatibility. |
499 | - if ( ! give_has_upgrade_completed( 'v20_upgrades_user_address' ) && $by_user_id ) { |
|
499 | + if ( ! give_has_upgrade_completed('v20_upgrades_user_address') && $by_user_id) { |
|
500 | 500 | return wp_parse_args( |
501 | - (array) get_user_meta( $donor_id, '_give_user_address', true ), |
|
501 | + (array) get_user_meta($donor_id, '_give_user_address', true), |
|
502 | 502 | $default_address |
503 | 503 | ); |
504 | 504 | } |
505 | 505 | |
506 | - $donor = new Give_Donor( $donor_id, $by_user_id ); |
|
506 | + $donor = new Give_Donor($donor_id, $by_user_id); |
|
507 | 507 | |
508 | 508 | if ( |
509 | 509 | ! $donor->id || |
510 | - empty( $donor->address ) || |
|
511 | - ! array_key_exists( $args['address_type'], $donor->address ) |
|
510 | + empty($donor->address) || |
|
511 | + ! array_key_exists($args['address_type'], $donor->address) |
|
512 | 512 | ) { |
513 | 513 | return $default_address; |
514 | 514 | } |
515 | 515 | |
516 | - switch ( true ) { |
|
517 | - case is_string( end( $donor->address[ $args['address_type'] ] ) ): |
|
518 | - $address = wp_parse_args( $donor->address[ $args['address_type'] ], $default_address ); |
|
516 | + switch (true) { |
|
517 | + case is_string(end($donor->address[$args['address_type']])): |
|
518 | + $address = wp_parse_args($donor->address[$args['address_type']], $default_address); |
|
519 | 519 | break; |
520 | 520 | |
521 | - case is_array( end( $donor->address[ $args['address_type'] ] ) ): |
|
522 | - $address = wp_parse_args( array_shift( $donor->address[ $args['address_type'] ] ), $default_address ); |
|
521 | + case is_array(end($donor->address[$args['address_type']])): |
|
522 | + $address = wp_parse_args(array_shift($donor->address[$args['address_type']]), $default_address); |
|
523 | 523 | break; |
524 | 524 | } |
525 | 525 | |
@@ -539,19 +539,19 @@ discard block |
||
539 | 539 | * |
540 | 540 | * @return void |
541 | 541 | */ |
542 | -function give_new_user_notification( $donation_id = 0, $donation_data = array() ) { |
|
542 | +function give_new_user_notification($donation_id = 0, $donation_data = array()) { |
|
543 | 543 | // Bailout. |
544 | 544 | if ( |
545 | - empty( $donation_id ) |
|
546 | - || empty( $donation_data ) |
|
547 | - || ! isset( $_POST['give_create_account'] ) |
|
548 | - || 'on' !== give_clean( $_POST['give_create_account'] ) |
|
545 | + empty($donation_id) |
|
546 | + || empty($donation_data) |
|
547 | + || ! isset($_POST['give_create_account']) |
|
548 | + || 'on' !== give_clean($_POST['give_create_account']) |
|
549 | 549 | ) { |
550 | 550 | return; |
551 | 551 | } |
552 | 552 | |
553 | 553 | // For backward compatibility |
554 | - $user = get_user_by( 'ID', $donation_data['user_info']['id'] ); |
|
554 | + $user = get_user_by('ID', $donation_data['user_info']['id']); |
|
555 | 555 | |
556 | 556 | $donation_data['user_info'] = array_merge( |
557 | 557 | $donation_data['user_info'], |
@@ -564,11 +564,11 @@ discard block |
||
564 | 564 | ) |
565 | 565 | ); |
566 | 566 | |
567 | - do_action( 'give_new-donor-register_email_notification', $donation_data['user_info']['id'], $donation_data['user_info'], $donation_id ); |
|
568 | - do_action( 'give_donor-register_email_notification', $donation_data['user_info']['id'], $donation_data['user_info'], $donation_id ); |
|
567 | + do_action('give_new-donor-register_email_notification', $donation_data['user_info']['id'], $donation_data['user_info'], $donation_id); |
|
568 | + do_action('give_donor-register_email_notification', $donation_data['user_info']['id'], $donation_data['user_info'], $donation_id); |
|
569 | 569 | } |
570 | 570 | |
571 | -add_action( 'give_insert_payment', 'give_new_user_notification', 10, 2 ); |
|
571 | +add_action('give_insert_payment', 'give_new_user_notification', 10, 2); |
|
572 | 572 | |
573 | 573 | |
574 | 574 | /** |
@@ -584,37 +584,37 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @return string |
586 | 586 | */ |
587 | -function give_get_donor_name_by( $id = 0, $from = 'donation' ) { |
|
587 | +function give_get_donor_name_by($id = 0, $from = 'donation') { |
|
588 | 588 | |
589 | 589 | // ID shouldn't be empty. |
590 | - if ( empty( $id ) ) { |
|
590 | + if (empty($id)) { |
|
591 | 591 | return ''; |
592 | 592 | } |
593 | 593 | |
594 | 594 | $name = ''; |
595 | 595 | $title_prefix = ''; |
596 | 596 | |
597 | - switch ( $from ) { |
|
597 | + switch ($from) { |
|
598 | 598 | |
599 | 599 | case 'donation': |
600 | - $title_prefix = give_get_meta( $id, '_give_payment_donor_title_prefix', true ); |
|
601 | - $first_name = give_get_meta( $id, '_give_donor_billing_first_name', true ); |
|
602 | - $last_name = give_get_meta( $id, '_give_donor_billing_last_name', true ); |
|
600 | + $title_prefix = give_get_meta($id, '_give_payment_donor_title_prefix', true); |
|
601 | + $first_name = give_get_meta($id, '_give_donor_billing_first_name', true); |
|
602 | + $last_name = give_get_meta($id, '_give_donor_billing_last_name', true); |
|
603 | 603 | |
604 | 604 | $name = "{$first_name} {$last_name}"; |
605 | 605 | |
606 | 606 | break; |
607 | 607 | |
608 | 608 | case 'donor': |
609 | - $name = Give()->donors->get_column( 'name', $id ); |
|
610 | - $title_prefix = Give()->donor_meta->get_meta( $id, '_give_donor_title_prefix', true ); |
|
609 | + $name = Give()->donors->get_column('name', $id); |
|
610 | + $title_prefix = Give()->donor_meta->get_meta($id, '_give_donor_title_prefix', true); |
|
611 | 611 | |
612 | 612 | break; |
613 | 613 | |
614 | 614 | } |
615 | 615 | |
616 | 616 | // If title prefix is set then prepend it to name. |
617 | - $name = give_get_donor_name_with_title_prefixes( $title_prefix, $name ); |
|
617 | + $name = give_get_donor_name_with_title_prefixes($title_prefix, $name); |
|
618 | 618 | |
619 | 619 | return $name; |
620 | 620 | |
@@ -629,8 +629,8 @@ discard block |
||
629 | 629 | * |
630 | 630 | * @return boolean The user's ID on success, and false on failure. |
631 | 631 | */ |
632 | -function give_donor_email_exists( $email ) { |
|
633 | - if ( Give()->donors->get_donor_by( 'email', $email ) ) { |
|
632 | +function give_donor_email_exists($email) { |
|
633 | + if (Give()->donors->get_donor_by('email', $email)) { |
|
634 | 634 | return true; |
635 | 635 | } |
636 | 636 | return false; |
@@ -645,14 +645,14 @@ discard block |
||
645 | 645 | * |
646 | 646 | * @return bool |
647 | 647 | */ |
648 | -function give_is_additional_email( $email ) { |
|
648 | +function give_is_additional_email($email) { |
|
649 | 649 | global $wpdb; |
650 | 650 | |
651 | 651 | $meta_table = Give()->donor_meta->table_name; |
652 | 652 | $meta_type = Give()->donor_meta->meta_type; |
653 | - $donor_id = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_type}_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $email ) ); |
|
653 | + $donor_id = $wpdb->get_var($wpdb->prepare("SELECT {$meta_type}_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $email)); |
|
654 | 654 | |
655 | - if ( empty( $donor_id ) ) { |
|
655 | + if (empty($donor_id)) { |
|
656 | 656 | return false; |
657 | 657 | } |
658 | 658 |
@@ -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|bool 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 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array Variable prices |
67 | 67 | */ |
68 | -function give_get_variable_price_ids( $form_id = 0 ) { |
|
69 | - if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) { |
|
68 | +function give_get_variable_price_ids($form_id = 0) { |
|
69 | + if ( ! ($prices = give_get_variable_prices($form_id))) { |
|
70 | 70 | return array(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $price_ids = array(); |
74 | - foreach ( $prices as $price ){ |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | $price_ids[] = $price['_give_id']['level_id']; |
76 | 76 | } |
77 | 77 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string $default_price |
91 | 91 | */ |
92 | -function give_get_default_multilevel_amount( $form_id ) { |
|
92 | +function give_get_default_multilevel_amount($form_id) { |
|
93 | 93 | $default_price = '1.00'; |
94 | 94 | |
95 | 95 | // Get default level price data. |
96 | - $default_level = give_form_get_default_level( $form_id ); |
|
97 | - $default_price = isset( $default_level['_give_amount'] ) ? $default_level['_give_amount'] : $default_price; |
|
96 | + $default_level = give_form_get_default_level($form_id); |
|
97 | + $default_price = isset($default_level['_give_amount']) ? $default_level['_give_amount'] : $default_price; |
|
98 | 98 | |
99 | 99 | return $default_price; |
100 | 100 | } |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | * @return string $default_price |
111 | 111 | * @since 1.0 |
112 | 112 | */ |
113 | -function give_get_default_form_amount( $form_id ) { |
|
113 | +function give_get_default_form_amount($form_id) { |
|
114 | 114 | |
115 | - if ( give_has_variable_prices( $form_id ) ) { |
|
115 | + if (give_has_variable_prices($form_id)) { |
|
116 | 116 | |
117 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
117 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
118 | 118 | |
119 | 119 | } else { |
120 | 120 | |
121 | - $default_amount = give_get_meta( $form_id, '_give_set_price', true ); |
|
121 | + $default_amount = give_get_meta($form_id, '_give_set_price', true); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | - return apply_filters( 'give_default_form_amount', $default_amount, $form_id ); |
|
125 | + return apply_filters('give_default_form_amount', $default_amount, $form_id); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return bool |
142 | 142 | */ |
143 | -function give_is_custom_price_mode( $form_id = 0 ) { |
|
143 | +function give_is_custom_price_mode($form_id = 0) { |
|
144 | 144 | |
145 | - if ( empty( $form_id ) ) { |
|
145 | + if (empty($form_id)) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | - $form = new Give_Donate_Form( $form_id ); |
|
149 | + $form = new Give_Donate_Form($form_id); |
|
150 | 150 | |
151 | 151 | return $form->is_custom_price_mode(); |
152 | 152 | } |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /* @var WPDB $wpdb */ |
36 | 36 | global $wpdb; |
37 | 37 | |
38 | - $this->table_name = $wpdb->prefix . 'give_sequential_ordering'; |
|
38 | + $this->table_name = $wpdb->prefix.'give_sequential_ordering'; |
|
39 | 39 | $this->primary_key = 'id'; |
40 | 40 | $this->version = '1.0'; |
41 | 41 | |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | PRIMARY KEY (id) |
109 | 109 | ) {$charset_collate};"; |
110 | 110 | |
111 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
112 | - dbDelta( $sql ); |
|
111 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
112 | + dbDelta($sql); |
|
113 | 113 | |
114 | - if ( ! empty( $payment_ID ) ) { |
|
114 | + if ( ! empty($payment_ID)) { |
|
115 | 115 | $auto_increment = $payment_ID + 1; |
116 | - $wpdb->query( "ALTER TABLE {$this->table_name} AUTO_INCREMENT={$auto_increment};" ); |
|
117 | - give_update_option( 'sequential-ordering_number', $auto_increment ); |
|
116 | + $wpdb->query("ALTER TABLE {$this->table_name} AUTO_INCREMENT={$auto_increment};"); |
|
117 | + give_update_option('sequential-ordering_number', $auto_increment); |
|
118 | 118 | } else { |
119 | - give_update_option( 'sequential-ordering_number', 1 ); |
|
119 | + give_update_option('sequential-ordering_number', 1); |
|
120 | 120 | } |
121 | 121 | |
122 | - update_option( $this->table_name . '_db_version', $this->version, false ); |
|
122 | + update_option($this->table_name.'_db_version', $this->version, false); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public static function verify_nonce() { |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | public static function save() { |
103 | 103 | $current_tab = give_get_current_setting_tab(); |
104 | 104 | |
105 | - if ( ! self::verify_nonce() ) { |
|
106 | - echo '<div class="notice error"><p>' . esc_attr__( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
105 | + if ( ! self::verify_nonce()) { |
|
106 | + echo '<div class="notice error"><p>'.esc_attr__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
107 | 107 | die(); |
108 | 108 | } |
109 | 109 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @since 1.8 |
118 | 118 | */ |
119 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
119 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
120 | 120 | |
121 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
121 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Trigger Action. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @since 1.8 |
131 | 131 | */ |
132 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
132 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return void |
144 | 144 | */ |
145 | - public static function add_message( $code, $message ) { |
|
146 | - self::$messages[ $code ] = $message; |
|
145 | + public static function add_message($code, $message) { |
|
146 | + self::$messages[$code] = $message; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return void |
158 | 158 | */ |
159 | - public static function add_error( $code, $message ) { |
|
160 | - self::$errors[ $code ] = $message; |
|
159 | + public static function add_error($code, $message) { |
|
160 | + self::$errors[$code] = $message; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | $notice_html = ''; |
171 | 171 | $classes = 'give-notice settings-error notice is-dismissible'; |
172 | 172 | |
173 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
174 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
173 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
174 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
175 | 175 | |
176 | - if ( 0 < count( self::$errors ) ) { |
|
177 | - foreach ( self::$errors as $code => $message ) { |
|
176 | + if (0 < count(self::$errors)) { |
|
177 | + foreach (self::$errors as $code => $message) { |
|
178 | 178 | $notice_html .= sprintf( |
179 | 179 | '<div id="setting-error-%1$s" class="%2$s error" style="display: none"><p><strong>%3$s</strong></p></div>', |
180 | 180 | $code, |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - if ( 0 < count( self::$messages ) ) { |
|
188 | - foreach ( self::$messages as $code => $message ) { |
|
187 | + if (0 < count(self::$messages)) { |
|
188 | + foreach (self::$messages as $code => $message) { |
|
189 | 189 | $notice_html .= sprintf( |
190 | 190 | '<div id="setting-error-%1$s" class="%2$s updated" style="display: none"><p><strong>%3$s</strong></p></div>', |
191 | 191 | $code, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
212 | 212 | |
213 | 213 | // Bailout: Exit if setting page is not defined. |
214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
214 | + if (empty(self::$setting_filter_prefix)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @since 1.8 |
226 | 226 | */ |
227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
228 | 228 | |
229 | 229 | $current_tab = give_get_current_setting_tab(); |
230 | 230 | |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | /* @var object $current_setting_obj */ |
235 | 235 | $current_setting_obj = new StdClass; |
236 | 236 | |
237 | - foreach ( $all_setting as $setting ) { |
|
237 | + foreach ($all_setting as $setting) { |
|
238 | 238 | if ( |
239 | - method_exists( $setting, 'get_id' ) && |
|
239 | + method_exists($setting, 'get_id') && |
|
240 | 240 | $current_tab === $setting->get_id() |
241 | 241 | ) { |
242 | 242 | $current_setting_obj = $setting; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // Save settings if data has been posted. |
248 | - if ( isset( $_POST['_give-save-settings'] ) ) { |
|
248 | + if (isset($_POST['_give-save-settings'])) { |
|
249 | 249 | self::save(); |
250 | 250 | } |
251 | 251 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @since 1.8 |
260 | 260 | */ |
261 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
261 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
262 | 262 | |
263 | 263 | include 'views/html-admin-settings.php'; |
264 | 264 | |
@@ -276,25 +276,25 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return string|bool |
278 | 278 | */ |
279 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
279 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
280 | 280 | // Bailout. |
281 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
281 | + if (empty($option_name) && empty($field_id)) { |
|
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | |
285 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
285 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
286 | 286 | // Get field value if any. |
287 | - $option_value = get_option( $option_name ); |
|
287 | + $option_value = get_option($option_name); |
|
288 | 288 | |
289 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
290 | - ? $option_value[ $field_id ] |
|
289 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
290 | + ? $option_value[$field_id] |
|
291 | 291 | : $default; |
292 | 292 | } else { |
293 | 293 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
294 | 294 | $option_name = ! $option_name ? $field_id : $option_name; |
295 | 295 | |
296 | 296 | // Get option value if any. |
297 | - $option_value = get_option( $option_name, $default ); |
|
297 | + $option_value = get_option($option_name, $default); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $option_value; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @return void |
315 | 315 | */ |
316 | - public static function output_fields( $options, $option_name = '' ) { |
|
316 | + public static function output_fields($options, $option_name = '') { |
|
317 | 317 | $current_tab = give_get_current_setting_tab(); |
318 | 318 | |
319 | 319 | // Field Default values. |
@@ -325,62 +325,62 @@ discard block |
||
325 | 325 | 'desc' => '', |
326 | 326 | 'table_html' => true, |
327 | 327 | 'repeat' => false, |
328 | - 'repeat_btn_title' => __( 'Add Field', 'give' ), |
|
328 | + 'repeat_btn_title' => __('Add Field', 'give'), |
|
329 | 329 | ); |
330 | 330 | |
331 | - foreach ( $options as $value ) { |
|
332 | - if ( ! isset( $value['type'] ) ) { |
|
331 | + foreach ($options as $value) { |
|
332 | + if ( ! isset($value['type'])) { |
|
333 | 333 | continue; |
334 | 334 | } |
335 | 335 | |
336 | 336 | // Set title. |
337 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
337 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
338 | 338 | |
339 | 339 | // Set default setting. |
340 | - $value = wp_parse_args( $value, $defaults ); |
|
340 | + $value = wp_parse_args($value, $defaults); |
|
341 | 341 | |
342 | 342 | // Colorpicker field. |
343 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
344 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
343 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
344 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | // Custom attribute handling. |
348 | 348 | $custom_attributes = array(); |
349 | 349 | |
350 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
351 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
352 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
350 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
351 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
352 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | // Description handling. |
357 | - $description = self::get_field_description( $value ); |
|
357 | + $description = self::get_field_description($value); |
|
358 | 358 | |
359 | 359 | // Switch based on type. |
360 | - switch ( $value['type'] ) { |
|
360 | + switch ($value['type']) { |
|
361 | 361 | |
362 | 362 | // Section Titles. |
363 | 363 | case 'title': |
364 | - if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) { |
|
364 | + if ( ! empty($value['title']) || ! empty($value['desc'])) { |
|
365 | 365 | ?> |
366 | 366 | <div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>"> |
367 | - <?php if ( ! empty( $value['title'] ) ) : ?> |
|
368 | - <h2><?php echo self::get_field_title( $value ); ?></h2> |
|
367 | + <?php if ( ! empty($value['title'])) : ?> |
|
368 | + <h2><?php echo self::get_field_title($value); ?></h2> |
|
369 | 369 | <hr> |
370 | 370 | <?php endif; ?> |
371 | 371 | |
372 | - <?php if ( ! empty( $value['desc'] ) ) : ?> |
|
373 | - <?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?> |
|
372 | + <?php if ( ! empty($value['desc'])) : ?> |
|
373 | + <?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?> |
|
374 | 374 | <?php endif; ?> |
375 | 375 | </div> |
376 | 376 | <?php |
377 | 377 | } |
378 | 378 | |
379 | - if ( $value['table_html'] ) { |
|
380 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
379 | + if ($value['table_html']) { |
|
380 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
381 | 381 | } |
382 | 382 | |
383 | - if ( ! empty( $value['id'] ) ) { |
|
383 | + if ( ! empty($value['id'])) { |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * Trigger Action. |
@@ -389,14 +389,14 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @since 1.8 |
391 | 391 | */ |
392 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
392 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | break; |
396 | 396 | |
397 | 397 | // Section Ends. |
398 | 398 | case 'sectionend': |
399 | - if ( ! empty( $value['id'] ) ) { |
|
399 | + if ( ! empty($value['id'])) { |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Trigger Action. |
@@ -405,14 +405,14 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @since 1.8 |
407 | 407 | */ |
408 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
408 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
409 | 409 | } |
410 | 410 | |
411 | - if ( $value['table_html'] ) { |
|
411 | + if ($value['table_html']) { |
|
412 | 412 | echo '</table>'; |
413 | 413 | } |
414 | 414 | |
415 | - if ( ! empty( $value['id'] ) ) { |
|
415 | + if ( ! empty($value['id'])) { |
|
416 | 416 | |
417 | 417 | /** |
418 | 418 | * Trigger Action. |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @since 1.8 |
423 | 423 | */ |
424 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
424 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | break; |
@@ -429,51 +429,51 @@ discard block |
||
429 | 429 | // Standard text inputs and subtypes like 'number'. |
430 | 430 | case 'colorpicker': |
431 | 431 | case 'hidden' : |
432 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
432 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
433 | 433 | case 'text': |
434 | 434 | case 'email': |
435 | 435 | case 'number': |
436 | 436 | case 'password' : |
437 | 437 | $type = $value['type']; |
438 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
438 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
439 | 439 | |
440 | 440 | // Set default value for repeater field if not any value set yet. |
441 | - if ( $value['repeat'] && is_string( $option_value ) ) { |
|
442 | - $option_value = array( $value['default'] ); |
|
441 | + if ($value['repeat'] && is_string($option_value)) { |
|
442 | + $option_value = array($value['default']); |
|
443 | 443 | } |
444 | 444 | ?> |
445 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
445 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
446 | 446 | <th scope="row" class="titledesc"> |
447 | 447 | <label |
448 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
448 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
449 | 449 | </th> |
450 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
451 | - <?php if ( $value['repeat'] ) : ?> |
|
452 | - <?php foreach ( $option_value as $index => $field_value ) : ?> |
|
450 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
451 | + <?php if ($value['repeat']) : ?> |
|
452 | + <?php foreach ($option_value as $index => $field_value) : ?> |
|
453 | 453 | <p> |
454 | 454 | <input |
455 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
456 | - type="<?php echo esc_attr( $type ); ?>" |
|
457 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
458 | - value="<?php echo esc_attr( $field_value ); ?>" |
|
459 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>" |
|
460 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
455 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
456 | + type="<?php echo esc_attr($type); ?>" |
|
457 | + style="<?php echo esc_attr($value['css']); ?>" |
|
458 | + value="<?php echo esc_attr($field_value); ?>" |
|
459 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>" |
|
460 | + <?php echo implode(' ', $custom_attributes); ?> |
|
461 | 461 | /> |
462 | 462 | <span class="give-remove-setting-field" |
463 | - title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span> |
|
463 | + title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span> |
|
464 | 464 | </p> |
465 | 465 | <?php endforeach; ?> |
466 | 466 | <a href="#" data-id="<?php echo $value['id']; ?>" |
467 | 467 | class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
468 | 468 | <?php else : ?> |
469 | 469 | <input |
470 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
471 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
472 | - type="<?php echo esc_attr( $type ); ?>" |
|
473 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
474 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
475 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
476 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
470 | + name="<?php echo esc_attr($value['id']); ?>" |
|
471 | + id="<?php echo esc_attr($value['id']); ?>" |
|
472 | + type="<?php echo esc_attr($type); ?>" |
|
473 | + style="<?php echo esc_attr($value['css']); ?>" |
|
474 | + value="<?php echo esc_attr($option_value); ?>" |
|
475 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
476 | + <?php echo implode(' ', $custom_attributes); ?> |
|
477 | 477 | /> |
478 | 478 | <?php endif; ?> |
479 | 479 | <?php echo $description; ?> |
@@ -484,26 +484,26 @@ discard block |
||
484 | 484 | // Textarea. |
485 | 485 | case 'textarea': |
486 | 486 | |
487 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
487 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
488 | 488 | $default_attributes = array( |
489 | 489 | 'rows' => 10, |
490 | 490 | 'cols' => 60 |
491 | 491 | ); |
492 | - $textarea_attributes = isset( $value['attributes'] ) ? $value['attributes'] : array(); |
|
492 | + $textarea_attributes = isset($value['attributes']) ? $value['attributes'] : array(); |
|
493 | 493 | ?> |
494 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
494 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
495 | 495 | <th scope="row" class="titledesc"> |
496 | 496 | <label |
497 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
497 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
498 | 498 | </th> |
499 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
499 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
500 | 500 | <textarea |
501 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
502 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
503 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
504 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
505 | - <?php echo give_get_attribute_str( $textarea_attributes, $default_attributes ); ?> |
|
506 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
501 | + name="<?php echo esc_attr($value['id']); ?>" |
|
502 | + id="<?php echo esc_attr($value['id']); ?>" |
|
503 | + style="<?php echo esc_attr($value['css']); ?>" |
|
504 | + class="<?php echo esc_attr($value['class']); ?>" |
|
505 | + <?php echo give_get_attribute_str($textarea_attributes, $default_attributes); ?> |
|
506 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
507 | 507 | <?php echo $description; ?> |
508 | 508 | </td> |
509 | 509 | </tr> |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | // Select boxes. |
514 | 514 | case 'select' : |
515 | 515 | case 'multiselect' : |
516 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
516 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
517 | 517 | |
518 | 518 | /** |
519 | 519 | * Insert page in option if missing. |
@@ -521,39 +521,39 @@ discard block |
||
521 | 521 | * Check success_page setting in general settings. |
522 | 522 | */ |
523 | 523 | if ( |
524 | - isset( $value['attributes'] ) && |
|
525 | - false !== strpos( $value['class'], 'give-select-chosen' ) && |
|
526 | - in_array( 'data-search-type', array_keys( $value['attributes' ] ) ) && |
|
527 | - 'pages' === $value['attributes' ]['data-search-type'] && |
|
528 | - ! in_array( $option_value, array_keys( $value['options'] ) ) |
|
524 | + isset($value['attributes']) && |
|
525 | + false !== strpos($value['class'], 'give-select-chosen') && |
|
526 | + in_array('data-search-type', array_keys($value['attributes'])) && |
|
527 | + 'pages' === $value['attributes']['data-search-type'] && |
|
528 | + ! in_array($option_value, array_keys($value['options'])) |
|
529 | 529 | ) { |
530 | - $value['options'][ $option_value ] = get_the_title( $option_value ); |
|
530 | + $value['options'][$option_value] = get_the_title($option_value); |
|
531 | 531 | } |
532 | 532 | ?> |
533 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
533 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
534 | 534 | <th scope="row" class="titledesc"> |
535 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
535 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
536 | 536 | </th> |
537 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
537 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
538 | 538 | <select |
539 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( 'multiselect' === $value['type'] ) echo '[]'; ?>" |
|
540 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
541 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
542 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
543 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
544 | - <?php echo ( 'multiselect' === $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
539 | + name="<?php echo esc_attr($value['id']); ?><?php if ('multiselect' === $value['type']) echo '[]'; ?>" |
|
540 | + id="<?php echo esc_attr($value['id']); ?>" |
|
541 | + style="<?php echo esc_attr($value['css']); ?>" |
|
542 | + class="<?php echo esc_attr($value['class']); ?>" |
|
543 | + <?php echo implode(' ', $custom_attributes); ?> |
|
544 | + <?php echo ('multiselect' === $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
545 | 545 | > |
546 | 546 | |
547 | 547 | <?php |
548 | - if ( ! empty( $value['options'] ) ) { |
|
549 | - foreach ( $value['options'] as $key => $val ) { |
|
548 | + if ( ! empty($value['options'])) { |
|
549 | + foreach ($value['options'] as $key => $val) { |
|
550 | 550 | ?> |
551 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
551 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
552 | 552 | |
553 | - if ( is_array( $option_value ) ) { |
|
554 | - selected( in_array( $key, $option_value ), true ); |
|
553 | + if (is_array($option_value)) { |
|
554 | + selected(in_array($key, $option_value), true); |
|
555 | 555 | } else { |
556 | - selected( $option_value, $key ); |
|
556 | + selected($option_value, $key); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | ?>><?php echo $val ?></option> |
@@ -569,29 +569,29 @@ discard block |
||
569 | 569 | |
570 | 570 | // Radio inputs. |
571 | 571 | case 'radio_inline' : |
572 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
572 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
573 | 573 | case 'radio' : |
574 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
574 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
575 | 575 | ?> |
576 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
576 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
577 | 577 | <th scope="row" class="titledesc"> |
578 | 578 | <label |
579 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
579 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
580 | 580 | </th> |
581 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
581 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
582 | 582 | <fieldset> |
583 | 583 | <ul> |
584 | 584 | <?php |
585 | - foreach ( $value['options'] as $key => $val ) { |
|
585 | + foreach ($value['options'] as $key => $val) { |
|
586 | 586 | ?> |
587 | 587 | <li> |
588 | 588 | <label><input |
589 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
589 | + name="<?php echo esc_attr($value['id']); ?>" |
|
590 | 590 | value="<?php echo $key; ?>" |
591 | 591 | type="radio" |
592 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
593 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
594 | - <?php checked( $key, $option_value ); ?> |
|
592 | + style="<?php echo esc_attr($value['css']); ?>" |
|
593 | + <?php echo implode(' ', $custom_attributes); ?> |
|
594 | + <?php checked($key, $option_value); ?> |
|
595 | 595 | /> <?php echo $val ?></label> |
596 | 596 | </li> |
597 | 597 | <?php |
@@ -605,22 +605,22 @@ discard block |
||
605 | 605 | |
606 | 606 | // Checkbox input. |
607 | 607 | case 'checkbox' : |
608 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
608 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
609 | 609 | ?> |
610 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
610 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
611 | 611 | <th scope="row" class="titledesc"> |
612 | 612 | <label |
613 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
613 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
614 | 614 | </th> |
615 | 615 | <td class="give-forminp"> |
616 | 616 | <input |
617 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
618 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
617 | + name="<?php echo esc_attr($value['id']); ?>" |
|
618 | + id="<?php echo esc_attr($value['id']); ?>" |
|
619 | 619 | type="checkbox" |
620 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
620 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
621 | 621 | value="1" |
622 | - <?php checked( $option_value, 'on' ); ?> |
|
623 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
622 | + <?php checked($option_value, 'on'); ?> |
|
623 | + <?php echo implode(' ', $custom_attributes); ?> |
|
624 | 624 | /> |
625 | 625 | <?php echo $description; ?> |
626 | 626 | </td> |
@@ -630,29 +630,29 @@ discard block |
||
630 | 630 | |
631 | 631 | // Multi Checkbox input. |
632 | 632 | case 'multicheck' : |
633 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
634 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
633 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
634 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
635 | 635 | ?> |
636 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
636 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
637 | 637 | <th scope="row" class="titledesc"> |
638 | 638 | <label |
639 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
639 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
640 | 640 | </th> |
641 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
641 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
642 | 642 | <fieldset> |
643 | 643 | <ul> |
644 | 644 | <?php |
645 | - foreach ( $value['options'] as $key => $val ) { |
|
645 | + foreach ($value['options'] as $key => $val) { |
|
646 | 646 | ?> |
647 | 647 | <li> |
648 | 648 | <label> |
649 | 649 | <input |
650 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
650 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
651 | 651 | value="<?php echo $key; ?>" |
652 | 652 | type="checkbox" |
653 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
654 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
655 | - <?php if ( in_array( $key, $option_value ) ) { |
|
653 | + style="<?php echo esc_attr($value['css']); ?>" |
|
654 | + <?php echo implode(' ', $custom_attributes); ?> |
|
655 | + <?php if (in_array($key, $option_value)) { |
|
656 | 656 | echo 'checked="checked"'; |
657 | 657 | } ?> |
658 | 658 | /> <?php echo $val ?> |
@@ -671,31 +671,31 @@ discard block |
||
671 | 671 | // File input field. |
672 | 672 | case 'file' : |
673 | 673 | case 'media' : |
674 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
675 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $value['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
676 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
677 | - |
|
678 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
679 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : ''; |
|
680 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
681 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
674 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
675 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $value['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
676 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
677 | + |
|
678 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
679 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : ''; |
|
680 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
681 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
682 | 682 | ?> |
683 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
683 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
684 | 684 | <th scope="row" class="titledesc"> |
685 | 685 | <label |
686 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
686 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
687 | 687 | </th> |
688 | 688 | <td class="give-forminp"> |
689 | 689 | <div class="give-field-wrap"> |
690 | 690 | <label for="<?php echo $value['id'] ?>"> |
691 | 691 | <input |
692 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
693 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
692 | + name="<?php echo esc_attr($value['id']); ?>" |
|
693 | + id="<?php echo esc_attr($value['id']); ?>" |
|
694 | 694 | type="text" |
695 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
695 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
696 | 696 | value="<?php echo $option_value; ?>" |
697 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
698 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
697 | + style="<?php echo esc_attr($value['css']); ?>" |
|
698 | + <?php echo implode(' ', $custom_attributes); ?> |
|
699 | 699 | /> <input class="give-upload-button button" type="button" |
700 | 700 | data-fvalue="<?php echo $fvalue; ?>" |
701 | 701 | data-field-type="<?php echo $value['type']; ?>" |
@@ -716,18 +716,18 @@ discard block |
||
716 | 716 | // WordPress Editor. |
717 | 717 | case 'wysiwyg' : |
718 | 718 | // Get option value. |
719 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
719 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
720 | 720 | |
721 | 721 | // Get editor settings. |
722 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
722 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
723 | 723 | ?> |
724 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
724 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
725 | 725 | <th scope="row" class="titledesc"> |
726 | 726 | <label |
727 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
727 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
728 | 728 | </th> |
729 | 729 | <td class="give-forminp"> |
730 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
730 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
731 | 731 | <?php echo $description; ?> |
732 | 732 | </td> |
733 | 733 | </tr><?php |
@@ -735,15 +735,15 @@ discard block |
||
735 | 735 | |
736 | 736 | // Custom: Default gateways setting field. |
737 | 737 | case 'default_gateway' : |
738 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
738 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
739 | 739 | ?> |
740 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
740 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
741 | 741 | <th scope="row" class="titledesc"> |
742 | 742 | <label |
743 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
743 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
744 | 744 | </th> |
745 | 745 | <td class="give-forminp"> |
746 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
746 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
747 | 747 | <?php echo $description; ?> |
748 | 748 | </td> |
749 | 749 | </tr><?php |
@@ -752,13 +752,13 @@ discard block |
||
752 | 752 | // Custom: Email preview buttons field. |
753 | 753 | case 'email_preview_buttons' : |
754 | 754 | ?> |
755 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
755 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
756 | 756 | <th scope="row" class="titledesc"> |
757 | 757 | <label |
758 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
758 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
759 | 759 | </th> |
760 | 760 | <td class="give-forminp"> |
761 | - <?php give_email_preview_buttons_callback( $value ); ?> |
|
761 | + <?php give_email_preview_buttons_callback($value); ?> |
|
762 | 762 | <?php echo $description; ?> |
763 | 763 | </td> |
764 | 764 | </tr><?php |
@@ -772,23 +772,23 @@ discard block |
||
772 | 772 | |
773 | 773 | // Custom: Gateway API key. |
774 | 774 | case 'api_key' : |
775 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
776 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
775 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
776 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
777 | 777 | ?> |
778 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
778 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
779 | 779 | <th scope="row" class="titledesc"> |
780 | 780 | <label |
781 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
781 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
782 | 782 | </th> |
783 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
783 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
784 | 784 | <input |
785 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
786 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
787 | - type="<?php echo esc_attr( $type ); ?>" |
|
788 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
789 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
790 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
791 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
785 | + name="<?php echo esc_attr($value['id']); ?>" |
|
786 | + id="<?php echo esc_attr($value['id']); ?>" |
|
787 | + type="<?php echo esc_attr($type); ?>" |
|
788 | + style="<?php echo esc_attr($value['css']); ?>" |
|
789 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
790 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
791 | + <?php echo implode(' ', $custom_attributes); ?> |
|
792 | 792 | /> <?php echo $description; ?> |
793 | 793 | </td> |
794 | 794 | </tr><?php |
@@ -798,54 +798,53 @@ discard block |
||
798 | 798 | case 'chosen' : |
799 | 799 | |
800 | 800 | // Get option value. |
801 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
802 | - $option_value = is_array( $option_value ) ? array_fill_keys( $option_value, 'selected' ) : $option_value; |
|
803 | - $wrapper_class = ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : ''; |
|
801 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
802 | + $option_value = is_array($option_value) ? array_fill_keys($option_value, 'selected') : $option_value; |
|
803 | + $wrapper_class = ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : ''; |
|
804 | 804 | $type = ''; |
805 | 805 | $allow_new_values = ''; |
806 | - $name = give_get_field_name( $value ); |
|
806 | + $name = give_get_field_name($value); |
|
807 | 807 | |
808 | 808 | // Set attributes based on multiselect datatype. |
809 | - if ( 'multiselect' === $value['data_type'] ) { |
|
809 | + if ('multiselect' === $value['data_type']) { |
|
810 | 810 | $type = 'multiple'; |
811 | 811 | $allow_new_values = 'data-allows-new-values="true"'; |
812 | - $name = $name . '[]'; |
|
813 | - $option_value = empty( $option_value ) ? array() : $option_value; |
|
812 | + $name = $name.'[]'; |
|
813 | + $option_value = empty($option_value) ? array() : $option_value; |
|
814 | 814 | } |
815 | 815 | |
816 | - $title_prefixes_value = ( is_array( $option_value ) && count( $option_value ) > 0 ) ? |
|
817 | - array_merge( $value['options'], $option_value ) : |
|
818 | - $value['options']; |
|
816 | + $title_prefixes_value = (is_array($option_value) && count($option_value) > 0) ? |
|
817 | + array_merge($value['options'], $option_value) : $value['options']; |
|
819 | 818 | |
820 | 819 | ?> |
821 | 820 | <tr valign="top" <?php echo $wrapper_class; ?>> |
822 | 821 | <th scope="row" class="titledesc"> |
823 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_attr( self::get_field_title( $value ) ); ?></label> |
|
822 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_attr(self::get_field_title($value)); ?></label> |
|
824 | 823 | </th> |
825 | - <td class="give-forminp give-forminp-<?php echo esc_attr( $value['type'] ); ?>"> |
|
824 | + <td class="give-forminp give-forminp-<?php echo esc_attr($value['type']); ?>"> |
|
826 | 825 | <select |
827 | 826 | class="give-select-chosen give-chosen-settings" |
828 | - style="<?php echo esc_attr( $value['style'] ); ?>" |
|
829 | - name="<?php echo esc_attr( $name ); ?>" |
|
830 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
827 | + style="<?php echo esc_attr($value['style']); ?>" |
|
828 | + name="<?php echo esc_attr($name); ?>" |
|
829 | + id="<?php echo esc_attr($value['id']); ?>" |
|
831 | 830 | <?php |
832 | 831 | echo "{$type} {$allow_new_values}"; |
833 | - echo implode( ' ', $custom_attributes ); |
|
832 | + echo implode(' ', $custom_attributes); |
|
834 | 833 | ?> |
835 | 834 | > |
836 | 835 | <?php |
837 | - if ( is_array( $title_prefixes_value ) && count( $title_prefixes_value ) > 0 ) { |
|
838 | - foreach ( $title_prefixes_value as $key => $item_value ) { |
|
836 | + if (is_array($title_prefixes_value) && count($title_prefixes_value) > 0) { |
|
837 | + foreach ($title_prefixes_value as $key => $item_value) { |
|
839 | 838 | echo sprintf( |
840 | 839 | '<option %1$s value="%2$s">%2$s</option>', |
841 | - ( 'selected' === $item_value ) ? 'selected="selected"' : '', |
|
842 | - esc_attr( $key ) |
|
840 | + ('selected' === $item_value) ? 'selected="selected"' : '', |
|
841 | + esc_attr($key) |
|
843 | 842 | ); |
844 | 843 | } |
845 | 844 | } |
846 | 845 | ?> |
847 | 846 | </select> |
848 | - <?php echo wp_kses_post( $description ); ?> |
|
847 | + <?php echo wp_kses_post($description); ?> |
|
849 | 848 | </td> |
850 | 849 | </tr> |
851 | 850 | <?php |
@@ -862,7 +861,7 @@ discard block |
||
862 | 861 | * |
863 | 862 | * @since 1.0 |
864 | 863 | */ |
865 | - do_action( "give_logs_view_{$current_section}" ); |
|
864 | + do_action("give_logs_view_{$current_section}"); |
|
866 | 865 | |
867 | 866 | echo $description; |
868 | 867 | break; |
@@ -870,24 +869,24 @@ discard block |
||
870 | 869 | // Custom: Data field. |
871 | 870 | case 'data' : |
872 | 871 | |
873 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
872 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
874 | 873 | |
875 | 874 | echo $description; |
876 | 875 | break; |
877 | 876 | |
878 | 877 | // Custom: Give Docs Link field type. |
879 | 878 | case 'give_docs_link' : |
880 | - $wrapper_class = ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : ''; |
|
879 | + $wrapper_class = ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : ''; |
|
881 | 880 | ?> |
882 | - <tr valign="top" <?php echo esc_html( $wrapper_class ); ?>> |
|
881 | + <tr valign="top" <?php echo esc_html($wrapper_class); ?>> |
|
883 | 882 | <td class="give-docs-link" colspan="2"> |
884 | 883 | <p class="give-docs-link"> |
885 | - <a href="<?php echo esc_url( $value['url'] ); ?>" target="_blank"> |
|
884 | + <a href="<?php echo esc_url($value['url']); ?>" target="_blank"> |
|
886 | 885 | <?php |
887 | 886 | echo sprintf( |
888 | 887 | /* translators: %s Title */ |
889 | - esc_html__( 'Need Help? See docs on "%s"', 'give' ), |
|
890 | - esc_html( $value['title'] ) |
|
888 | + esc_html__('Need Help? See docs on "%s"', 'give'), |
|
889 | + esc_html($value['title']) |
|
891 | 890 | ); |
892 | 891 | ?> |
893 | 892 | <span class="dashicons dashicons-editor-help"></span> |
@@ -901,8 +900,8 @@ discard block |
||
901 | 900 | // You can add or handle your custom field action. |
902 | 901 | default: |
903 | 902 | // Get option value. |
904 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
905 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
903 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
904 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
906 | 905 | break; |
907 | 906 | } |
908 | 907 | } |
@@ -918,15 +917,15 @@ discard block |
||
918 | 917 | * |
919 | 918 | * @return string The HTML description of the field. |
920 | 919 | */ |
921 | - public static function get_field_description( $value ) { |
|
920 | + public static function get_field_description($value) { |
|
922 | 921 | $description = ''; |
923 | 922 | |
924 | 923 | // Support for both 'description' and 'desc' args. |
925 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
926 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
924 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
925 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
927 | 926 | |
928 | - if ( ! empty( $value ) ) { |
|
929 | - $description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>'; |
|
927 | + if ( ! empty($value)) { |
|
928 | + $description = '<div class="give-field-description">'.wp_kses_post($value).'</div>'; |
|
930 | 929 | } |
931 | 930 | |
932 | 931 | return $description; |
@@ -943,11 +942,11 @@ discard block |
||
943 | 942 | * |
944 | 943 | * @return array The description and tip as a 2 element array |
945 | 944 | */ |
946 | - public static function get_field_title( $value ) { |
|
947 | - $title = esc_html( $value['title'] ); |
|
945 | + public static function get_field_title($value) { |
|
946 | + $title = esc_html($value['title']); |
|
948 | 947 | |
949 | 948 | // If html tag detected then allow them to print. |
950 | - if ( strip_tags( $title ) ) { |
|
949 | + if (strip_tags($title)) { |
|
951 | 950 | $title = $value['title']; |
952 | 951 | } |
953 | 952 | |
@@ -966,8 +965,8 @@ discard block |
||
966 | 965 | * |
967 | 966 | * @return bool |
968 | 967 | */ |
969 | - public static function save_fields( $options, $option_name = '' ) { |
|
970 | - if ( empty( $_POST ) ) { |
|
968 | + public static function save_fields($options, $option_name = '') { |
|
969 | + if (empty($_POST)) { |
|
971 | 970 | return false; |
972 | 971 | } |
973 | 972 | |
@@ -975,38 +974,38 @@ discard block |
||
975 | 974 | $update_options = array(); |
976 | 975 | |
977 | 976 | // Loop options and get values to save. |
978 | - foreach ( $options as $option ) { |
|
979 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
977 | + foreach ($options as $option) { |
|
978 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
980 | 979 | continue; |
981 | 980 | } |
982 | 981 | |
983 | 982 | // Get posted value. |
984 | - if ( strstr( $option['id'], '[' ) ) { |
|
985 | - parse_str( $option['id'], $option_name_array ); |
|
986 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
987 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
988 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
983 | + if (strstr($option['id'], '[')) { |
|
984 | + parse_str($option['id'], $option_name_array); |
|
985 | + $field_option_name = current(array_keys($option_name_array)); |
|
986 | + $setting_name = key($option_name_array[$field_option_name]); |
|
987 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
989 | 988 | } else { |
990 | 989 | $field_option_name = $option['id']; |
991 | 990 | $setting_name = ''; |
992 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
991 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
993 | 992 | } |
994 | 993 | |
995 | 994 | // Format the value based on option type. |
996 | - switch ( $option['type'] ) { |
|
995 | + switch ($option['type']) { |
|
997 | 996 | case 'checkbox' : |
998 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
997 | + $value = is_null($raw_value) ? '' : 'on'; |
|
999 | 998 | break; |
1000 | 999 | case 'wysiwyg' : |
1001 | 1000 | case 'textarea' : |
1002 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
1001 | + $value = wp_kses_post(trim($raw_value)); |
|
1003 | 1002 | break; |
1004 | 1003 | case 'multiselect' : |
1005 | 1004 | case 'chosen' : |
1006 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
1005 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
1007 | 1006 | break; |
1008 | 1007 | default : |
1009 | - $value = give_clean( $raw_value ); |
|
1008 | + $value = give_clean($raw_value); |
|
1010 | 1009 | break; |
1011 | 1010 | } |
1012 | 1011 | |
@@ -1015,37 +1014,37 @@ discard block |
||
1015 | 1014 | * |
1016 | 1015 | * @since 1.8 |
1017 | 1016 | */ |
1018 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
1017 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
1019 | 1018 | |
1020 | 1019 | /** |
1021 | 1020 | * Sanitize the value of an option by option name. |
1022 | 1021 | * |
1023 | 1022 | * @since 1.8 |
1024 | 1023 | */ |
1025 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
1024 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
1026 | 1025 | |
1027 | - if ( is_null( $value ) ) { |
|
1026 | + if (is_null($value)) { |
|
1028 | 1027 | continue; |
1029 | 1028 | } |
1030 | 1029 | |
1031 | 1030 | // Check if option is an array and handle that differently to single values. |
1032 | - if ( $field_option_name && $setting_name ) { |
|
1033 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
1034 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
1031 | + if ($field_option_name && $setting_name) { |
|
1032 | + if ( ! isset($update_options[$field_option_name])) { |
|
1033 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
1035 | 1034 | } |
1036 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
1037 | - $update_options[ $field_option_name ] = array(); |
|
1035 | + if ( ! is_array($update_options[$field_option_name])) { |
|
1036 | + $update_options[$field_option_name] = array(); |
|
1038 | 1037 | } |
1039 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
1038 | + $update_options[$field_option_name][$setting_name] = $value; |
|
1040 | 1039 | } else { |
1041 | - $update_options[ $field_option_name ] = $value; |
|
1040 | + $update_options[$field_option_name] = $value; |
|
1042 | 1041 | } |
1043 | 1042 | } |
1044 | 1043 | |
1045 | 1044 | // Save all options in our array or there own option name i.e. option id. |
1046 | - if ( empty( $option_name ) ) { |
|
1047 | - foreach ( $update_options as $name => $value ) { |
|
1048 | - update_option( $name, $value, false ); |
|
1045 | + if (empty($option_name)) { |
|
1046 | + foreach ($update_options as $name => $value) { |
|
1047 | + update_option($name, $value, false); |
|
1049 | 1048 | |
1050 | 1049 | /** |
1051 | 1050 | * Trigger action. |
@@ -1054,13 +1053,13 @@ discard block |
||
1054 | 1053 | * |
1055 | 1054 | * @since 1.8 |
1056 | 1055 | */ |
1057 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
1056 | + do_action("give_save_option_{$name}", $value, $name); |
|
1058 | 1057 | } |
1059 | 1058 | } else { |
1060 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
1061 | - $update_options = array_merge( $old_options, $update_options ); |
|
1059 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
1060 | + $update_options = array_merge($old_options, $update_options); |
|
1062 | 1061 | |
1063 | - update_option( $option_name, $update_options, false ); |
|
1062 | + update_option($option_name, $update_options, false); |
|
1064 | 1063 | |
1065 | 1064 | /** |
1066 | 1065 | * Trigger action. |
@@ -1069,7 +1068,7 @@ discard block |
||
1069 | 1068 | * |
1070 | 1069 | * @since 1.8 |
1071 | 1070 | */ |
1072 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name, $old_options ); |
|
1071 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name, $old_options); |
|
1073 | 1072 | } |
1074 | 1073 | |
1075 | 1074 | return true; |
@@ -1098,21 +1097,21 @@ discard block |
||
1098 | 1097 | * |
1099 | 1098 | * @return bool |
1100 | 1099 | */ |
1101 | - public static function is_setting_page( $tab = '', $section = '' ) { |
|
1100 | + public static function is_setting_page($tab = '', $section = '') { |
|
1102 | 1101 | $is_setting_page = false; |
1103 | 1102 | |
1104 | - if( ! is_admin() ) { |
|
1103 | + if ( ! is_admin()) { |
|
1105 | 1104 | return $is_setting_page; |
1106 | 1105 | } |
1107 | 1106 | |
1108 | 1107 | // Check fo setting tab. |
1109 | - if ( ! empty( $tab ) ) { |
|
1110 | - $is_setting_page = ( $tab === give_get_current_setting_tab() ); |
|
1108 | + if ( ! empty($tab)) { |
|
1109 | + $is_setting_page = ($tab === give_get_current_setting_tab()); |
|
1111 | 1110 | } |
1112 | 1111 | |
1113 | 1112 | // Check fo setting section. |
1114 | - if ( ! empty( $section ) ) { |
|
1115 | - $is_setting_page = ( $section === give_get_current_setting_section() ); |
|
1113 | + if ( ! empty($section)) { |
|
1114 | + $is_setting_page = ($section === give_get_current_setting_section()); |
|
1116 | 1115 | } |
1117 | 1116 | |
1118 | 1117 | return $is_setting_page; |
@@ -465,9 +465,12 @@ discard block |
||
465 | 465 | <?php endforeach; ?> |
466 | 466 | <a href="#" data-id="<?php echo $value['id']; ?>" |
467 | 467 | class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
468 | - <?php else : ?> |
|
468 | + <?php else { |
|
469 | + : ?> |
|
469 | 470 | <input |
470 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
471 | + name="<?php echo esc_attr( $value['id'] ); |
|
472 | +} |
|
473 | +?>" |
|
471 | 474 | id="<?php echo esc_attr( $value['id'] ); ?>" |
472 | 475 | type="<?php echo esc_attr( $type ); ?>" |
473 | 476 | style="<?php echo esc_attr( $value['css'] ); ?>" |
@@ -536,7 +539,10 @@ discard block |
||
536 | 539 | </th> |
537 | 540 | <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
538 | 541 | <select |
539 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( 'multiselect' === $value['type'] ) echo '[]'; ?>" |
|
542 | + name="<?php echo esc_attr( $value['id'] ); ?><?php if ( 'multiselect' === $value['type'] ) { |
|
543 | + echo '[]'; |
|
544 | +} |
|
545 | +?>" |
|
540 | 546 | id="<?php echo esc_attr( $value['id'] ); ?>" |
541 | 547 | style="<?php echo esc_attr( $value['css'] ); ?>" |
542 | 548 | class="<?php echo esc_attr( $value['class'] ); ?>" |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 2.2.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'Give_Form_Duplicator' ) ) { |
|
12 | +if ( ! class_exists('Give_Form_Duplicator')) { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Give_Form_Duplicator class |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | public function __construct() { |
23 | 23 | |
24 | 24 | // Add the 'Clone Form' to Row Actions. |
25 | - add_filter( 'post_row_actions', array( $this, 'row_action' ), 10, 2 ); |
|
25 | + add_filter('post_row_actions', array($this, 'row_action'), 10, 2); |
|
26 | 26 | |
27 | 27 | // Run admin_action hook. |
28 | - add_action( 'admin_action_give_duplicate_form', array( $this, 'handler' ) ); |
|
28 | + add_action('admin_action_give_duplicate_form', array($this, 'handler')); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return array |
41 | 41 | */ |
42 | - public function row_action( $actions, $post ) { |
|
42 | + public function row_action($actions, $post) { |
|
43 | 43 | |
44 | 44 | // @codingStandardsIgnoreStart |
45 | 45 | |
46 | - if ( isset( $_GET['post_type'] ) && 'give_forms' === give_clean( $_GET['post_type'] ) ) { // WPCS: input var ok. |
|
47 | - if ( current_user_can( 'edit_posts' ) ) { |
|
46 | + if (isset($_GET['post_type']) && 'give_forms' === give_clean($_GET['post_type'])) { // WPCS: input var ok. |
|
47 | + if (current_user_can('edit_posts')) { |
|
48 | 48 | $actions['duplicate_form'] = sprintf( |
49 | 49 | '<a href="%1$s">%2$s</a>', |
50 | - wp_nonce_url( add_query_arg( |
|
50 | + wp_nonce_url(add_query_arg( |
|
51 | 51 | array( |
52 | 52 | 'action' => 'give_duplicate_form', |
53 | 53 | 'form_id' => $post->ID, |
54 | 54 | ), |
55 | - admin_url( 'admin.php' ) |
|
56 | - ), 'give-duplicate-form' ), |
|
57 | - __( 'Duplicate', 'give' ) |
|
55 | + admin_url('admin.php') |
|
56 | + ), 'give-duplicate-form'), |
|
57 | + __('Duplicate', 'give') |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | } |
@@ -76,28 +76,28 @@ discard block |
||
76 | 76 | // Validate action. |
77 | 77 | // @codingStandardsIgnoreStart |
78 | 78 | if ( |
79 | - ! isset( $_REQUEST['form_id'] ) |
|
80 | - || ! isset( $_REQUEST['action'] ) |
|
81 | - || ( 'give_duplicate_form' !== $_REQUEST['action'] ) |
|
79 | + ! isset($_REQUEST['form_id']) |
|
80 | + || ! isset($_REQUEST['action']) |
|
81 | + || ('give_duplicate_form' !== $_REQUEST['action']) |
|
82 | 82 | ) { |
83 | - wp_die( esc_html__( 'Form ID not found in the query string', 'give' ) ); |
|
83 | + wp_die(esc_html__('Form ID not found in the query string', 'give')); |
|
84 | 84 | |
85 | - } elseif ( ! wp_verify_nonce( give_clean( $_REQUEST['_wpnonce'] ), 'give-duplicate-form' ) ) { |
|
85 | + } elseif ( ! wp_verify_nonce(give_clean($_REQUEST['_wpnonce']), 'give-duplicate-form')) { |
|
86 | 86 | |
87 | - wp_die( esc_html__( 'Nonce verification failed', 'give' ) ); |
|
87 | + wp_die(esc_html__('Nonce verification failed', 'give')); |
|
88 | 88 | } |
89 | 89 | // @codingStandardsIgnoreEnd |
90 | 90 | |
91 | - $form_id = give_clean( $_REQUEST['form_id'] ); // @codingStandardsIgnoreLine |
|
92 | - $post_data = get_post( $form_id ); |
|
91 | + $form_id = give_clean($_REQUEST['form_id']); // @codingStandardsIgnoreLine |
|
92 | + $post_data = get_post($form_id); |
|
93 | 93 | $current_user = wp_get_current_user(); |
94 | 94 | $error_notice = sprintf( |
95 | 95 | /* translators: %s: Form ID */ |
96 | - esc_html__( 'Cloning failed. Form with ID %s does not exist.', 'give' ), |
|
97 | - absint( $form_id ) |
|
96 | + esc_html__('Cloning failed. Form with ID %s does not exist.', 'give'), |
|
97 | + absint($form_id) |
|
98 | 98 | ); |
99 | 99 | |
100 | - if ( isset( $post_data ) && null !== $post_data ) { |
|
100 | + if (isset($post_data) && null !== $post_data) { |
|
101 | 101 | |
102 | 102 | $args = array( |
103 | 103 | 'comment_status' => $post_data->comment_status, |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | ); |
117 | 117 | |
118 | 118 | // Get the ID of the cloned post. |
119 | - $duplicate_form_id = wp_insert_post( $args ); |
|
119 | + $duplicate_form_id = wp_insert_post($args); |
|
120 | 120 | |
121 | - $this->duplicate_taxonomies( $duplicate_form_id, $post_data ); |
|
122 | - $this->duplicate_meta_data( $duplicate_form_id, $post_data ); |
|
123 | - $this->reset_stats( $duplicate_form_id ); |
|
121 | + $this->duplicate_taxonomies($duplicate_form_id, $post_data); |
|
122 | + $this->duplicate_meta_data($duplicate_form_id, $post_data); |
|
123 | + $this->reset_stats($duplicate_form_id); |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Fire the action |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param int $duplicate_form_id Duplicated form ID. |
131 | 131 | * @param int $form_id Form ID. |
132 | 132 | */ |
133 | - do_action( 'give_form_duplicated', $duplicate_form_id, $form_id ); |
|
133 | + do_action('give_form_duplicated', $duplicate_form_id, $form_id); |
|
134 | 134 | |
135 | - if ( ! is_wp_error( $duplicate_form_id ) ) { |
|
135 | + if ( ! is_wp_error($duplicate_form_id)) { |
|
136 | 136 | // Redirect to the cloned form editor page. |
137 | 137 | wp_safe_redirect( |
138 | 138 | add_query_arg( |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | 'action' => 'edit', |
141 | 141 | 'post' => $duplicate_form_id, |
142 | 142 | ), |
143 | - admin_url( 'post.php' ) |
|
143 | + admin_url('post.php') |
|
144 | 144 | ) |
145 | 145 | ); |
146 | 146 | } else { |
147 | - wp_die( $error_notice ); // @codingStandardsIgnoreLine |
|
147 | + wp_die($error_notice); // @codingStandardsIgnoreLine |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | exit; |
151 | 151 | |
152 | 152 | } else { |
153 | 153 | |
154 | - wp_die( $error_notice ); // @codingStandardsIgnoreLine |
|
154 | + wp_die($error_notice); // @codingStandardsIgnoreLine |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | * @param int $new_form_id New form ID. |
166 | 166 | * @param WP_Post $old_form Old form object. |
167 | 167 | */ |
168 | - private function duplicate_taxonomies( $new_form_id, $old_form ) { |
|
168 | + private function duplicate_taxonomies($new_form_id, $old_form) { |
|
169 | 169 | // Get the taxonomies of the post type `give_forms`. |
170 | - $taxonomies = get_object_taxonomies( $old_form->post_type ); |
|
170 | + $taxonomies = get_object_taxonomies($old_form->post_type); |
|
171 | 171 | |
172 | - foreach ( $taxonomies as $taxonomy ) { |
|
172 | + foreach ($taxonomies as $taxonomy) { |
|
173 | 173 | |
174 | 174 | $post_terms = wp_get_object_terms( |
175 | 175 | $old_form->ID, |
@@ -198,28 +198,28 @@ discard block |
||
198 | 198 | * @param int $new_form_id New Form ID. |
199 | 199 | * @param WP_Post $old_form Old form object. |
200 | 200 | */ |
201 | - private function duplicate_meta_data( $new_form_id, $old_form ) { |
|
201 | + private function duplicate_meta_data($new_form_id, $old_form) { |
|
202 | 202 | global $wpdb; |
203 | 203 | |
204 | 204 | // Clone the metadata of the form. |
205 | - $post_meta_query = $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->formmeta} WHERE form_id=%s", $old_form->ID ); |
|
205 | + $post_meta_query = $wpdb->prepare("SELECT meta_key, meta_value FROM {$wpdb->formmeta} WHERE form_id=%s", $old_form->ID); |
|
206 | 206 | |
207 | - $post_meta_data = $wpdb->get_results( $post_meta_query ); // WPCS: db call ok. WPCS: cache ok. WPCS: unprepared SQL OK. |
|
207 | + $post_meta_data = $wpdb->get_results($post_meta_query); // WPCS: db call ok. WPCS: cache ok. WPCS: unprepared SQL OK. |
|
208 | 208 | |
209 | - if ( ! empty( $post_meta_data ) ) { |
|
209 | + if ( ! empty($post_meta_data)) { |
|
210 | 210 | |
211 | 211 | $duplicate_query = "INSERT INTO {$wpdb->formmeta} (form_id, meta_key, meta_value) "; |
212 | 212 | $duplicate_query_select = array(); |
213 | 213 | |
214 | - foreach ( $post_meta_data as $meta_data ) { |
|
214 | + foreach ($post_meta_data as $meta_data) { |
|
215 | 215 | $meta_key = $meta_data->meta_key; |
216 | 216 | $meta_value = $meta_data->meta_value; |
217 | - $duplicate_query_select[] = $wpdb->prepare( 'SELECT %s, %s, %s', $new_form_id, $meta_key, $meta_value ); |
|
217 | + $duplicate_query_select[] = $wpdb->prepare('SELECT %s, %s, %s', $new_form_id, $meta_key, $meta_value); |
|
218 | 218 | } |
219 | 219 | |
220 | - $duplicate_query .= implode( ' UNION ALL ', $duplicate_query_select ); |
|
220 | + $duplicate_query .= implode(' UNION ALL ', $duplicate_query_select); |
|
221 | 221 | |
222 | - $wpdb->query( $duplicate_query ); // WPCS: db call ok. WPCS: cache ok. WPCS: unprepared SQL OK. |
|
222 | + $wpdb->query($duplicate_query); // WPCS: db call ok. WPCS: cache ok. WPCS: unprepared SQL OK. |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
@@ -231,18 +231,18 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @param int $new_form_id New Form ID. |
233 | 233 | */ |
234 | - private function reset_stats( $new_form_id ) { |
|
234 | + private function reset_stats($new_form_id) { |
|
235 | 235 | global $wpdb; |
236 | 236 | |
237 | - $meta_keys = array( '_give_form_sales', '_give_form_earnings' ); |
|
237 | + $meta_keys = array('_give_form_sales', '_give_form_earnings'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Fire the filter |
241 | 241 | * |
242 | 242 | * @since 2.2.0 |
243 | 243 | */ |
244 | - $meta_keys = apply_filters( 'give_duplicate_form_reset_stat_meta_keys', $meta_keys ); |
|
245 | - $meta_keys = 'meta_key=\'' . implode( '\' OR meta_key=\'', $meta_keys ) . '\''; |
|
244 | + $meta_keys = apply_filters('give_duplicate_form_reset_stat_meta_keys', $meta_keys); |
|
245 | + $meta_keys = 'meta_key=\''.implode('\' OR meta_key=\'', $meta_keys).'\''; |
|
246 | 246 | |
247 | 247 | $wpdb->query( |
248 | 248 | $wpdb->prepare( |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | |
65 | 65 | // Maintain active tab query parameter after save. |
66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function get_settings() { |
89 | 89 | $post_id = give_get_admin_post_id(); |
90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
91 | 91 | |
92 | 92 | // Start with an underscore to hide fields from custom fields list |
93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Repeatable Field Groups |
98 | 98 | */ |
99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
100 | 100 | 'id' => 'form_field_options', |
101 | - 'title' => __( 'Donation Options', 'give' ), |
|
101 | + 'title' => __('Donation Options', 'give'), |
|
102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
104 | 104 | // Donation Option. |
105 | 105 | array( |
106 | - 'name' => __( 'Donation Option', 'give' ), |
|
107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
108 | - 'id' => $prefix . 'price_option', |
|
106 | + 'name' => __('Donation Option', 'give'), |
|
107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
108 | + 'id' => $prefix.'price_option', |
|
109 | 109 | 'type' => 'radio_inline', |
110 | 110 | 'default' => 'multi', |
111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
113 | - 'set' => __( 'Set Donation', 'give' ), |
|
114 | - ) ), |
|
111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
113 | + 'set' => __('Set Donation', 'give'), |
|
114 | + )), |
|
115 | 115 | ), |
116 | 116 | array( |
117 | - 'name' => __( 'Set Donation', 'give' ), |
|
118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
119 | - 'id' => $prefix . 'set_price', |
|
117 | + 'name' => __('Set Donation', 'give'), |
|
118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
119 | + 'id' => $prefix.'set_price', |
|
120 | 120 | 'type' => 'text_small', |
121 | 121 | 'data_type' => 'price', |
122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | ), |
127 | 127 | // Display Style. |
128 | 128 | array( |
129 | - 'name' => __( 'Display Style', 'give' ), |
|
130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
131 | - 'id' => $prefix . 'display_style', |
|
129 | + 'name' => __('Display Style', 'give'), |
|
130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
131 | + 'id' => $prefix.'display_style', |
|
132 | 132 | 'type' => 'radio_inline', |
133 | 133 | 'default' => 'buttons', |
134 | 134 | 'options' => array( |
135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
136 | - 'radios' => __( 'Radios', 'give' ), |
|
137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
135 | + 'buttons' => __('Buttons', 'give'), |
|
136 | + 'radios' => __('Radios', 'give'), |
|
137 | + 'dropdown' => __('Dropdown', 'give'), |
|
138 | 138 | ), |
139 | 139 | 'wrapper_class' => 'give-hidden', |
140 | 140 | ), |
141 | 141 | // Custom Amount. |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'disabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Donation Limit', 'give' ), |
|
155 | - 'description' => __( 'Set the minimum and maximum amount for all gateways.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_range', |
|
154 | + 'name' => __('Donation Limit', 'give'), |
|
155 | + 'description' => __('Set the minimum and maximum amount for all gateways.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_range', |
|
157 | 157 | 'type' => 'donation_limit', |
158 | 158 | 'wrapper_class' => 'give-hidden', |
159 | 159 | 'data_type' => 'price', |
@@ -162,43 +162,43 @@ discard block |
||
162 | 162 | 'class' => 'give-money-field', |
163 | 163 | ), |
164 | 164 | 'options' => array( |
165 | - 'display_label' => __( 'Donation Limits: ', 'give' ), |
|
166 | - 'minimum' => give_format_decimal( '1.00', false, false ), |
|
167 | - 'maximum' => give_format_decimal( '999999.99', false, false ), |
|
165 | + 'display_label' => __('Donation Limits: ', 'give'), |
|
166 | + 'minimum' => give_format_decimal('1.00', false, false), |
|
167 | + 'maximum' => give_format_decimal('999999.99', false, false), |
|
168 | 168 | ), |
169 | 169 | ), |
170 | 170 | array( |
171 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
172 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
173 | - 'id' => $prefix . 'custom_amount_text', |
|
171 | + 'name' => __('Custom Amount Text', 'give'), |
|
172 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
173 | + 'id' => $prefix.'custom_amount_text', |
|
174 | 174 | 'type' => 'text_medium', |
175 | 175 | 'attributes' => array( |
176 | 176 | 'rows' => 3, |
177 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
177 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
178 | 178 | ), |
179 | 179 | 'wrapper_class' => 'give-hidden', |
180 | 180 | ), |
181 | 181 | // Donation Levels. |
182 | 182 | array( |
183 | - 'id' => $prefix . 'donation_levels', |
|
183 | + 'id' => $prefix.'donation_levels', |
|
184 | 184 | 'type' => 'group', |
185 | 185 | 'options' => array( |
186 | - 'add_button' => __( 'Add Level', 'give' ), |
|
187 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
186 | + 'add_button' => __('Add Level', 'give'), |
|
187 | + 'header_title' => __('Donation Level', 'give'), |
|
188 | 188 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
189 | 189 | ), |
190 | 190 | 'wrapper_class' => 'give-hidden', |
191 | 191 | // Fields array works the same, except id's only need to be unique for this group. |
192 | 192 | // Prefix is not needed. |
193 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
193 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
194 | 194 | array( |
195 | - 'name' => __( 'ID', 'give' ), |
|
196 | - 'id' => $prefix . 'id', |
|
195 | + 'name' => __('ID', 'give'), |
|
196 | + 'id' => $prefix.'id', |
|
197 | 197 | 'type' => 'levels_id', |
198 | 198 | ), |
199 | 199 | array( |
200 | - 'name' => __( 'Amount', 'give' ), |
|
201 | - 'id' => $prefix . 'amount', |
|
200 | + 'name' => __('Amount', 'give'), |
|
201 | + 'id' => $prefix.'amount', |
|
202 | 202 | 'type' => 'text_small', |
203 | 203 | 'data_type' => 'price', |
204 | 204 | 'attributes' => array( |
@@ -207,95 +207,95 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | array( |
210 | - 'name' => __( 'Text', 'give' ), |
|
211 | - 'id' => $prefix . 'text', |
|
210 | + 'name' => __('Text', 'give'), |
|
211 | + 'id' => $prefix.'text', |
|
212 | 212 | 'type' => 'text', |
213 | 213 | 'attributes' => array( |
214 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
214 | + 'placeholder' => __('Donation Level', 'give'), |
|
215 | 215 | 'class' => 'give-multilevel-text-field', |
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => __( 'Default', 'give' ), |
|
220 | - 'id' => $prefix . 'default', |
|
219 | + 'name' => __('Default', 'give'), |
|
220 | + 'id' => $prefix.'default', |
|
221 | 221 | 'type' => 'give_default_radio_inline', |
222 | 222 | ), |
223 | - ) ), |
|
223 | + )), |
|
224 | 224 | ), |
225 | 225 | array( |
226 | 226 | 'name' => 'donation_options_docs', |
227 | 227 | 'type' => 'docs_link', |
228 | 228 | 'url' => 'http://docs.givewp.com/form-donation-options', |
229 | - 'title' => __( 'Donation Options', 'give' ), |
|
229 | + 'title' => __('Donation Options', 'give'), |
|
230 | 230 | ), |
231 | 231 | ), |
232 | 232 | $post_id |
233 | 233 | ), |
234 | - ) ), |
|
234 | + )), |
|
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Display Options |
238 | 238 | */ |
239 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
239 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
240 | 240 | 'id' => 'form_display_options', |
241 | - 'title' => __( 'Form Display', 'give' ), |
|
241 | + 'title' => __('Form Display', 'give'), |
|
242 | 242 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
243 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
243 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
244 | 244 | array( |
245 | - 'name' => __( 'Display Options', 'give' ), |
|
246 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
247 | - 'id' => $prefix . 'payment_display', |
|
245 | + 'name' => __('Display Options', 'give'), |
|
246 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
247 | + 'id' => $prefix.'payment_display', |
|
248 | 248 | 'type' => 'radio_inline', |
249 | 249 | 'options' => array( |
250 | - 'onpage' => __( 'All Fields', 'give' ), |
|
251 | - 'modal' => __( 'Modal', 'give' ), |
|
252 | - 'reveal' => __( 'Reveal', 'give' ), |
|
253 | - 'button' => __( 'Button', 'give' ), |
|
250 | + 'onpage' => __('All Fields', 'give'), |
|
251 | + 'modal' => __('Modal', 'give'), |
|
252 | + 'reveal' => __('Reveal', 'give'), |
|
253 | + 'button' => __('Button', 'give'), |
|
254 | 254 | ), |
255 | 255 | 'default' => 'onpage', |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'id' => $prefix . 'reveal_label', |
|
259 | - 'name' => __( 'Continue Button', 'give' ), |
|
260 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
258 | + 'id' => $prefix.'reveal_label', |
|
259 | + 'name' => __('Continue Button', 'give'), |
|
260 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
261 | 261 | 'type' => 'text_small', |
262 | 262 | 'attributes' => array( |
263 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
263 | + 'placeholder' => __('Donate Now', 'give'), |
|
264 | 264 | ), |
265 | 265 | 'wrapper_class' => 'give-hidden', |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Name Title Prefix', 'give' ), |
|
284 | - 'desc' => __( 'Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give' ), |
|
285 | - 'id' => $prefix . 'name_title_prefix', |
|
283 | + 'name' => __('Name Title Prefix', 'give'), |
|
284 | + 'desc' => __('Do you want to add a name title prefix dropdown field before the donor\'s first name field? This will display a dropdown with options such as Mrs, Miss, Ms, Sir, and Dr for donor to choose from.', 'give'), |
|
285 | + 'id' => $prefix.'name_title_prefix', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'options' => array( |
288 | - 'global' => __( 'Global Option', 'give' ), |
|
289 | - 'required' => __( 'Required', 'give' ), |
|
290 | - 'optional' => __( 'Optional', 'give' ), |
|
291 | - 'disabled' => __( 'Disabled', 'give' ), |
|
288 | + 'global' => __('Global Option', 'give'), |
|
289 | + 'required' => __('Required', 'give'), |
|
290 | + 'optional' => __('Optional', 'give'), |
|
291 | + 'disabled' => __('Disabled', 'give'), |
|
292 | 292 | ), |
293 | 293 | 'default' => 'global', |
294 | 294 | ), |
295 | 295 | array( |
296 | - 'name' => __( 'Title Prefixes', 'give' ), |
|
297 | - 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
|
298 | - 'id' => $prefix . 'title_prefixes', |
|
296 | + 'name' => __('Title Prefixes', 'give'), |
|
297 | + 'desc' => __('Add or remove salutations from the dropdown using the field above.', 'give'), |
|
298 | + 'id' => $prefix.'title_prefixes', |
|
299 | 299 | 'type' => 'chosen', |
300 | 300 | 'data_type' => 'multiselect', |
301 | 301 | 'style' => 'width: 100%', |
@@ -303,77 +303,77 @@ discard block |
||
303 | 303 | 'options' => give_get_default_title_prefixes(), |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => __( 'Company Donations', 'give' ), |
|
307 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
|
308 | - 'id' => $prefix . 'company_field', |
|
306 | + 'name' => __('Company Donations', 'give'), |
|
307 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name?', 'give'), |
|
308 | + 'id' => $prefix.'company_field', |
|
309 | 309 | 'type' => 'radio_inline', |
310 | 310 | 'default' => 'global', |
311 | 311 | 'options' => array( |
312 | - 'global' => __( 'Global Option', 'give' ), |
|
313 | - 'required' => __( 'Required', 'give' ), |
|
314 | - 'optional' => __( 'Optional', 'give' ), |
|
315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
312 | + 'global' => __('Global Option', 'give'), |
|
313 | + 'required' => __('Required', 'give'), |
|
314 | + 'optional' => __('Optional', 'give'), |
|
315 | + 'disabled' => __('Disabled', 'give'), |
|
316 | 316 | |
317 | 317 | ), |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Anonymous Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
|
320 | + 'name' => __('Anonymous Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give'), |
|
322 | 322 | 'id' => "{$prefix}anonymous_donation", |
323 | 323 | 'type' => 'radio_inline', |
324 | 324 | 'default' => 'global', |
325 | 325 | 'options' => array( |
326 | - 'global' => __( 'Global Option', 'give' ), |
|
327 | - 'enabled' => __( 'Enabled', 'give' ), |
|
328 | - 'disabled' => __( 'Disabled', 'give' ), |
|
326 | + 'global' => __('Global Option', 'give'), |
|
327 | + 'enabled' => __('Enabled', 'give'), |
|
328 | + 'disabled' => __('Disabled', 'give'), |
|
329 | 329 | ), |
330 | 330 | ), |
331 | 331 | array( |
332 | - 'name' => __( 'Donor Comment', 'give' ), |
|
333 | - 'desc' => __( 'Would you like donors to give option to add his/her thought while donaitng.', 'give' ), |
|
332 | + 'name' => __('Donor Comment', 'give'), |
|
333 | + 'desc' => __('Would you like donors to give option to add his/her thought while donaitng.', 'give'), |
|
334 | 334 | 'id' => "{$prefix}donor_comment", |
335 | 335 | 'type' => 'radio_inline', |
336 | 336 | 'default' => 'global', |
337 | 337 | 'options' => array( |
338 | - 'global' => __( 'Global Option', 'give' ), |
|
339 | - 'enabled' => __( 'Enabled', 'give' ), |
|
340 | - 'disabled' => __( 'Disabled', 'give' ), |
|
338 | + 'global' => __('Global Option', 'give'), |
|
339 | + 'enabled' => __('Enabled', 'give'), |
|
340 | + 'disabled' => __('Disabled', 'give'), |
|
341 | 341 | ), |
342 | 342 | ), |
343 | 343 | array( |
344 | - 'name' => __( 'Guest Donations', 'give' ), |
|
345 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
346 | - 'id' => $prefix . 'logged_in_only', |
|
344 | + 'name' => __('Guest Donations', 'give'), |
|
345 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
346 | + 'id' => $prefix.'logged_in_only', |
|
347 | 347 | 'type' => 'radio_inline', |
348 | 348 | 'default' => 'enabled', |
349 | 349 | 'options' => array( |
350 | - 'enabled' => __( 'Enabled', 'give' ), |
|
351 | - 'disabled' => __( 'Disabled', 'give' ), |
|
350 | + 'enabled' => __('Enabled', 'give'), |
|
351 | + 'disabled' => __('Disabled', 'give'), |
|
352 | 352 | ), |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => __( 'Registration', 'give' ), |
|
356 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
357 | - 'id' => $prefix . 'show_register_form', |
|
355 | + 'name' => __('Registration', 'give'), |
|
356 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
357 | + 'id' => $prefix.'show_register_form', |
|
358 | 358 | 'type' => 'radio', |
359 | 359 | 'options' => array( |
360 | - 'none' => __( 'None', 'give' ), |
|
361 | - 'registration' => __( 'Registration', 'give' ), |
|
362 | - 'login' => __( 'Login', 'give' ), |
|
363 | - 'both' => __( 'Registration + Login', 'give' ), |
|
360 | + 'none' => __('None', 'give'), |
|
361 | + 'registration' => __('Registration', 'give'), |
|
362 | + 'login' => __('Login', 'give'), |
|
363 | + 'both' => __('Registration + Login', 'give'), |
|
364 | 364 | ), |
365 | 365 | 'default' => 'none', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Floating Labels', 'give' ), |
|
368 | + 'name' => __('Floating Labels', 'give'), |
|
369 | 369 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
370 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
371 | - 'id' => $prefix . 'form_floating_labels', |
|
370 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
371 | + 'id' => $prefix.'form_floating_labels', |
|
372 | 372 | 'type' => 'radio_inline', |
373 | 373 | 'options' => array( |
374 | - 'global' => __( 'Global Option', 'give' ), |
|
375 | - 'enabled' => __( 'Enabled', 'give' ), |
|
376 | - 'disabled' => __( 'Disabled', 'give' ), |
|
374 | + 'global' => __('Global Option', 'give'), |
|
375 | + 'enabled' => __('Enabled', 'give'), |
|
376 | + 'disabled' => __('Disabled', 'give'), |
|
377 | 377 | ), |
378 | 378 | 'default' => 'global', |
379 | 379 | ), |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | 'name' => 'form_display_docs', |
382 | 382 | 'type' => 'docs_link', |
383 | 383 | 'url' => 'http://docs.givewp.com/form-display-options', |
384 | - 'title' => __( 'Form Display', 'give' ), |
|
384 | + 'title' => __('Form Display', 'give'), |
|
385 | 385 | ), |
386 | 386 | ), |
387 | 387 | $post_id |
@@ -392,42 +392,42 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * Donation Goals |
394 | 394 | */ |
395 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
395 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
396 | 396 | 'id' => 'donation_goal_options', |
397 | - 'title' => __( 'Donation Goal', 'give' ), |
|
397 | + 'title' => __('Donation Goal', 'give'), |
|
398 | 398 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
399 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
399 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
400 | 400 | // Goals |
401 | 401 | array( |
402 | - 'name' => __( 'Donation Goal', 'give' ), |
|
403 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
404 | - 'id' => $prefix . 'goal_option', |
|
402 | + 'name' => __('Donation Goal', 'give'), |
|
403 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
404 | + 'id' => $prefix.'goal_option', |
|
405 | 405 | 'type' => 'radio_inline', |
406 | 406 | 'default' => 'disabled', |
407 | 407 | 'options' => array( |
408 | - 'enabled' => __( 'Enabled', 'give' ), |
|
409 | - 'disabled' => __( 'Disabled', 'give' ), |
|
408 | + 'enabled' => __('Enabled', 'give'), |
|
409 | + 'disabled' => __('Disabled', 'give'), |
|
410 | 410 | ), |
411 | 411 | ), |
412 | 412 | |
413 | 413 | array( |
414 | - 'name' => __( 'Goal Format', 'give' ), |
|
415 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ), |
|
416 | - 'id' => $prefix . 'goal_format', |
|
414 | + 'name' => __('Goal Format', 'give'), |
|
415 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give'), |
|
416 | + 'id' => $prefix.'goal_format', |
|
417 | 417 | 'type' => 'donation_form_goal', |
418 | 418 | 'default' => 'amount', |
419 | 419 | 'options' => array( |
420 | - 'amount' => __( 'Amount Raised', 'give' ), |
|
421 | - 'percentage' => __( 'Percentage Raised', 'give' ), |
|
422 | - 'donation' => __( 'Number of Donations', 'give' ), |
|
423 | - 'donors' => __( 'Number of Donors', 'give' ), |
|
420 | + 'amount' => __('Amount Raised', 'give'), |
|
421 | + 'percentage' => __('Percentage Raised', 'give'), |
|
422 | + 'donation' => __('Number of Donations', 'give'), |
|
423 | + 'donors' => __('Number of Donors', 'give'), |
|
424 | 424 | ), |
425 | 425 | ), |
426 | 426 | |
427 | 427 | array( |
428 | - 'name' => __( 'Goal Amount', 'give' ), |
|
429 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
430 | - 'id' => $prefix . 'set_goal', |
|
428 | + 'name' => __('Goal Amount', 'give'), |
|
429 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
430 | + 'id' => $prefix.'set_goal', |
|
431 | 431 | 'type' => 'text_small', |
432 | 432 | 'data_type' => 'price', |
433 | 433 | 'attributes' => array( |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | 'wrapper_class' => 'give-hidden', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'id' => $prefix . 'number_of_donation_goal', |
|
441 | - 'name' => __( 'Donation Goal', 'give' ), |
|
442 | - 'desc' => __( 'Set the total number of donations as a goal.', 'give' ), |
|
440 | + 'id' => $prefix.'number_of_donation_goal', |
|
441 | + 'name' => __('Donation Goal', 'give'), |
|
442 | + 'desc' => __('Set the total number of donations as a goal.', 'give'), |
|
443 | 443 | 'type' => 'number', |
444 | 444 | 'default' => 1, |
445 | 445 | 'attributes' => array( |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | ), |
448 | 448 | ), |
449 | 449 | array( |
450 | - 'id' => $prefix . 'number_of_donor_goal', |
|
451 | - 'name' => __( 'Donor Goal', 'give' ), |
|
452 | - 'desc' => __( 'Set the total number of donors as a goal.', 'give' ), |
|
450 | + 'id' => $prefix.'number_of_donor_goal', |
|
451 | + 'name' => __('Donor Goal', 'give'), |
|
452 | + 'desc' => __('Set the total number of donors as a goal.', 'give'), |
|
453 | 453 | 'type' => 'number', |
454 | 454 | 'default' => 1, |
455 | 455 | 'attributes' => array( |
@@ -457,85 +457,85 @@ discard block |
||
457 | 457 | ), |
458 | 458 | ), |
459 | 459 | array( |
460 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
461 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
462 | - 'id' => $prefix . 'goal_color', |
|
460 | + 'name' => __('Progress Bar Color', 'give'), |
|
461 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
462 | + 'id' => $prefix.'goal_color', |
|
463 | 463 | 'type' => 'colorpicker', |
464 | 464 | 'default' => '#2bc253', |
465 | 465 | 'wrapper_class' => 'give-hidden', |
466 | 466 | ), |
467 | 467 | |
468 | 468 | array( |
469 | - 'name' => __( 'Close Form', 'give' ), |
|
470 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
471 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
469 | + 'name' => __('Close Form', 'give'), |
|
470 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
471 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
472 | 472 | 'type' => 'radio_inline', |
473 | 473 | 'default' => 'disabled', |
474 | 474 | 'options' => array( |
475 | - 'enabled' => __( 'Enabled', 'give' ), |
|
476 | - 'disabled' => __( 'Disabled', 'give' ), |
|
475 | + 'enabled' => __('Enabled', 'give'), |
|
476 | + 'disabled' => __('Disabled', 'give'), |
|
477 | 477 | ), |
478 | 478 | 'wrapper_class' => 'give-hidden', |
479 | 479 | ), |
480 | 480 | array( |
481 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
482 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
483 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
481 | + 'name' => __('Goal Achieved Message', 'give'), |
|
482 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
483 | + 'id' => $prefix.'form_goal_achieved_message', |
|
484 | 484 | 'type' => 'wysiwyg', |
485 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
485 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
486 | 486 | 'wrapper_class' => 'give-hidden', |
487 | 487 | ), |
488 | 488 | array( |
489 | 489 | 'name' => 'donation_goal_docs', |
490 | 490 | 'type' => 'docs_link', |
491 | 491 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
492 | - 'title' => __( 'Donation Goal', 'give' ), |
|
492 | + 'title' => __('Donation Goal', 'give'), |
|
493 | 493 | ), |
494 | 494 | ), |
495 | 495 | $post_id |
496 | 496 | ), |
497 | - ) ), |
|
497 | + )), |
|
498 | 498 | |
499 | 499 | /** |
500 | 500 | * Content Field |
501 | 501 | */ |
502 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
502 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
503 | 503 | 'id' => 'form_content_options', |
504 | - 'title' => __( 'Form Content', 'give' ), |
|
504 | + 'title' => __('Form Content', 'give'), |
|
505 | 505 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
506 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
506 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
507 | 507 | |
508 | 508 | // Donation content. |
509 | 509 | array( |
510 | - 'name' => __( 'Display Content', 'give' ), |
|
511 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
512 | - 'id' => $prefix . 'display_content', |
|
510 | + 'name' => __('Display Content', 'give'), |
|
511 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
512 | + 'id' => $prefix.'display_content', |
|
513 | 513 | 'type' => 'radio_inline', |
514 | 514 | 'options' => array( |
515 | - 'enabled' => __( 'Enabled', 'give' ), |
|
516 | - 'disabled' => __( 'Disabled', 'give' ), |
|
515 | + 'enabled' => __('Enabled', 'give'), |
|
516 | + 'disabled' => __('Disabled', 'give'), |
|
517 | 517 | ), |
518 | 518 | 'default' => 'disabled', |
519 | 519 | ), |
520 | 520 | |
521 | 521 | // Content placement. |
522 | 522 | array( |
523 | - 'name' => __( 'Content Placement', 'give' ), |
|
524 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
525 | - 'id' => $prefix . 'content_placement', |
|
523 | + 'name' => __('Content Placement', 'give'), |
|
524 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
525 | + 'id' => $prefix.'content_placement', |
|
526 | 526 | 'type' => 'radio_inline', |
527 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
528 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
529 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
527 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
528 | + 'give_pre_form' => __('Above fields', 'give'), |
|
529 | + 'give_post_form' => __('Below fields', 'give'), |
|
530 | 530 | ) |
531 | 531 | ), |
532 | 532 | 'default' => 'give_pre_form', |
533 | 533 | 'wrapper_class' => 'give-hidden', |
534 | 534 | ), |
535 | 535 | array( |
536 | - 'name' => __( 'Content', 'give' ), |
|
537 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
538 | - 'id' => $prefix . 'form_content', |
|
536 | + 'name' => __('Content', 'give'), |
|
537 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
538 | + 'id' => $prefix.'form_content', |
|
539 | 539 | 'type' => 'wysiwyg', |
540 | 540 | 'wrapper_class' => 'give-hidden', |
541 | 541 | ), |
@@ -543,51 +543,51 @@ discard block |
||
543 | 543 | 'name' => 'form_content_docs', |
544 | 544 | 'type' => 'docs_link', |
545 | 545 | 'url' => 'http://docs.givewp.com/form-content', |
546 | - 'title' => __( 'Form Content', 'give' ), |
|
546 | + 'title' => __('Form Content', 'give'), |
|
547 | 547 | ), |
548 | 548 | ), |
549 | 549 | $post_id |
550 | 550 | ), |
551 | - ) ), |
|
551 | + )), |
|
552 | 552 | |
553 | 553 | /** |
554 | 554 | * Terms & Conditions |
555 | 555 | */ |
556 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
556 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
557 | 557 | 'id' => 'form_terms_options', |
558 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
558 | + 'title' => __('Terms & Conditions', 'give'), |
|
559 | 559 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
560 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
560 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
561 | 561 | // Donation Option |
562 | 562 | array( |
563 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
564 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
565 | - 'id' => $prefix . 'terms_option', |
|
563 | + 'name' => __('Terms and Conditions', 'give'), |
|
564 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
565 | + 'id' => $prefix.'terms_option', |
|
566 | 566 | 'type' => 'radio_inline', |
567 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
568 | - 'global' => __( 'Global Option', 'give' ), |
|
569 | - 'enabled' => __( 'Customize', 'give' ), |
|
570 | - 'disabled' => __( 'Disable', 'give' ), |
|
567 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
568 | + 'global' => __('Global Option', 'give'), |
|
569 | + 'enabled' => __('Customize', 'give'), |
|
570 | + 'disabled' => __('Disable', 'give'), |
|
571 | 571 | ) |
572 | 572 | ), |
573 | 573 | 'default' => 'global', |
574 | 574 | ), |
575 | 575 | array( |
576 | - 'id' => $prefix . 'agree_label', |
|
577 | - 'name' => __( 'Agreement Label', 'give' ), |
|
578 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
576 | + 'id' => $prefix.'agree_label', |
|
577 | + 'name' => __('Agreement Label', 'give'), |
|
578 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
579 | 579 | 'type' => 'textarea', |
580 | 580 | 'attributes' => array( |
581 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
581 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
582 | 582 | 'rows' => 1 |
583 | 583 | ), |
584 | 584 | 'wrapper_class' => 'give-hidden', |
585 | 585 | ), |
586 | 586 | array( |
587 | - 'id' => $prefix . 'agree_text', |
|
588 | - 'name' => __( 'Agreement Text', 'give' ), |
|
589 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
590 | - 'default' => give_get_option( 'agreement_text' ), |
|
587 | + 'id' => $prefix.'agree_text', |
|
588 | + 'name' => __('Agreement Text', 'give'), |
|
589 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
590 | + 'default' => give_get_option('agreement_text'), |
|
591 | 591 | 'type' => 'wysiwyg', |
592 | 592 | 'wrapper_class' => 'give-hidden', |
593 | 593 | ), |
@@ -595,18 +595,18 @@ discard block |
||
595 | 595 | 'name' => 'terms_docs', |
596 | 596 | 'type' => 'docs_link', |
597 | 597 | 'url' => 'http://docs.givewp.com/form-terms', |
598 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
598 | + 'title' => __('Terms and Conditions', 'give'), |
|
599 | 599 | ), |
600 | 600 | ), |
601 | 601 | $post_id |
602 | 602 | ), |
603 | - ) ), |
|
603 | + )), |
|
604 | 604 | ); |
605 | 605 | |
606 | 606 | /** |
607 | 607 | * Filter the metabox tabbed panel settings. |
608 | 608 | */ |
609 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
609 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
610 | 610 | |
611 | 611 | // Output. |
612 | 612 | return $settings; |
@@ -623,19 +623,19 @@ discard block |
||
623 | 623 | add_meta_box( |
624 | 624 | $this->get_metabox_ID(), |
625 | 625 | $this->get_metabox_label(), |
626 | - array( $this, 'output' ), |
|
627 | - array( 'give_forms' ), |
|
626 | + array($this, 'output'), |
|
627 | + array('give_forms'), |
|
628 | 628 | 'normal', |
629 | 629 | 'high' |
630 | 630 | ); |
631 | 631 | |
632 | 632 | // Show Goal Metabox only if goal is enabled. |
633 | - if ( give_is_setting_enabled( give_get_meta( give_get_admin_post_id(), '_give_goal_option', true ) ) ) { |
|
633 | + if (give_is_setting_enabled(give_get_meta(give_get_admin_post_id(), '_give_goal_option', true))) { |
|
634 | 634 | add_meta_box( |
635 | 635 | 'give-form-goal-stats', |
636 | - __( 'Goal Statistics', 'give' ), |
|
637 | - array( $this, 'output_goal' ), |
|
638 | - array( 'give_forms' ), |
|
636 | + __('Goal Statistics', 'give'), |
|
637 | + array($this, 'output_goal'), |
|
638 | + array('give_forms'), |
|
639 | 639 | 'side', |
640 | 640 | 'low' |
641 | 641 | ); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | function enqueue_script() { |
655 | 655 | global $post; |
656 | 656 | |
657 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
657 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
658 | 658 | |
659 | 659 | } |
660 | 660 | } |
@@ -692,32 +692,32 @@ discard block |
||
692 | 692 | public function get_tabs() { |
693 | 693 | $tabs = array(); |
694 | 694 | |
695 | - if ( ! empty( $this->settings ) ) { |
|
696 | - foreach ( $this->settings as $setting ) { |
|
697 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
695 | + if ( ! empty($this->settings)) { |
|
696 | + foreach ($this->settings as $setting) { |
|
697 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
698 | 698 | continue; |
699 | 699 | } |
700 | 700 | $tab = array( |
701 | 701 | 'id' => $setting['id'], |
702 | 702 | 'label' => $setting['title'], |
703 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
703 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
704 | 704 | ); |
705 | 705 | |
706 | - if ( $this->has_sub_tab( $setting ) ) { |
|
707 | - if ( empty( $setting['sub-fields'] ) ) { |
|
706 | + if ($this->has_sub_tab($setting)) { |
|
707 | + if (empty($setting['sub-fields'])) { |
|
708 | 708 | $tab = array(); |
709 | 709 | } else { |
710 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
710 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
711 | 711 | $tab['sub-fields'][] = array( |
712 | 712 | 'id' => $sub_fields['id'], |
713 | 713 | 'label' => $sub_fields['title'], |
714 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
714 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
715 | 715 | ); |
716 | 716 | } |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
720 | - if ( ! empty( $tab ) ) { |
|
720 | + if ( ! empty($tab)) { |
|
721 | 721 | $tabs[] = $tab; |
722 | 722 | } |
723 | 723 | } |
@@ -735,35 +735,35 @@ discard block |
||
735 | 735 | */ |
736 | 736 | public function output() { |
737 | 737 | // Bailout. |
738 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
739 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
740 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
738 | + if ($form_data_tabs = $this->get_tabs()) : |
|
739 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
740 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
741 | 741 | ?> |
742 | 742 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
743 | 743 | <div class="give-metabox-panel-wrap"> |
744 | 744 | <ul class="give-form-data-tabs give-metabox-tabs"> |
745 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
745 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
746 | 746 | <?php |
747 | 747 | // Determine if current tab is active. |
748 | 748 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
749 | 749 | ?> |
750 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
750 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
751 | 751 | <a href="#<?php echo $form_data_tab['id']; ?>" |
752 | 752 | data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
753 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
753 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
754 | 754 | <?php echo $form_data_tab['icon-html']; ?> |
755 | 755 | <?php else : ?> |
756 | 756 | <span class="give-icon give-icon-default"></span> |
757 | 757 | <?php endif; ?> |
758 | 758 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
759 | 759 | </a> |
760 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
760 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
761 | 761 | <ul class="give-metabox-sub-tabs give-hidden"> |
762 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
762 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
763 | 763 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
764 | 764 | <a href="#<?php echo $sub_tab['id']; ?>" |
765 | 765 | data-tab-id="<?php echo $sub_tab['id']; ?>"> |
766 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
766 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
767 | 767 | <?php echo $sub_tab['icon-html']; ?> |
768 | 768 | <?php else : ?> |
769 | 769 | <span class="give-icon give-icon-default"></span> |
@@ -778,30 +778,30 @@ discard block |
||
778 | 778 | <?php endforeach; ?> |
779 | 779 | </ul> |
780 | 780 | |
781 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
782 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
781 | + <?php foreach ($this->settings as $setting) : ?> |
|
782 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
783 | 783 | <?php |
784 | 784 | // Determine if current panel is active. |
785 | 785 | $is_active = $active_tab === $setting['id'] ? true : false; |
786 | 786 | ?> |
787 | 787 | <div id="<?php echo $setting['id']; ?>" |
788 | - class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
789 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
790 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
791 | - <?php give_render_field( $field ); ?> |
|
788 | + class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
789 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
790 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
791 | + <?php give_render_field($field); ?> |
|
792 | 792 | <?php endforeach; ?> |
793 | 793 | <?php endif; ?> |
794 | 794 | </div> |
795 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
795 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
796 | 796 | |
797 | 797 | |
798 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
799 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
800 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
798 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
799 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
800 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
801 | 801 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
802 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
803 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
804 | - <?php give_render_field( $sub_field ); ?> |
|
802 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
803 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
804 | + <?php give_render_field($sub_field); ?> |
|
805 | 805 | <?php endforeach; ?> |
806 | 806 | <?php endif; ?> |
807 | 807 | </div> |
@@ -824,9 +824,9 @@ discard block |
||
824 | 824 | * |
825 | 825 | * @return void |
826 | 826 | */ |
827 | - public function output_goal( $post ) { |
|
827 | + public function output_goal($post) { |
|
828 | 828 | |
829 | - echo give_admin_form_goal_stats( $post->ID ); |
|
829 | + echo give_admin_form_goal_stats($post->ID); |
|
830 | 830 | |
831 | 831 | } |
832 | 832 | |
@@ -839,9 +839,9 @@ discard block |
||
839 | 839 | * |
840 | 840 | * @return bool |
841 | 841 | */ |
842 | - private function has_sub_tab( $field_setting ) { |
|
842 | + private function has_sub_tab($field_setting) { |
|
843 | 843 | $has_sub_tab = false; |
844 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
844 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
845 | 845 | $has_sub_tab = true; |
846 | 846 | } |
847 | 847 | |
@@ -856,13 +856,13 @@ discard block |
||
856 | 856 | * @return array |
857 | 857 | */ |
858 | 858 | function cmb2_metabox_settings() { |
859 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
859 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
860 | 860 | $give_forms_settings = $all_cmb2_settings; |
861 | 861 | |
862 | 862 | // Filter settings: Use only give forms related settings. |
863 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
864 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
865 | - unset( $give_forms_settings[ $index ] ); |
|
863 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
864 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
865 | + unset($give_forms_settings[$index]); |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
@@ -880,100 +880,100 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @return void |
882 | 882 | */ |
883 | - public function save( $post_id, $post ) { |
|
883 | + public function save($post_id, $post) { |
|
884 | 884 | |
885 | 885 | // $post_id and $post are required. |
886 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
886 | + if (empty($post_id) || empty($post)) { |
|
887 | 887 | return; |
888 | 888 | } |
889 | 889 | |
890 | 890 | // Don't save meta boxes for revisions or autosaves. |
891 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
891 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
892 | 892 | return; |
893 | 893 | } |
894 | 894 | |
895 | 895 | // Check the nonce. |
896 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
896 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
897 | 897 | return; |
898 | 898 | } |
899 | 899 | |
900 | 900 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
901 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
901 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
902 | 902 | return; |
903 | 903 | } |
904 | 904 | |
905 | 905 | // Check user has permission to edit. |
906 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
906 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
907 | 907 | return; |
908 | 908 | } |
909 | 909 | |
910 | 910 | // Fire action before saving form meta. |
911 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
911 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
912 | 912 | |
913 | 913 | /** |
914 | 914 | * Filter the meta key to save. |
915 | 915 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
916 | 916 | */ |
917 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
917 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
918 | 918 | |
919 | 919 | // Save form meta data. |
920 | - if ( ! empty( $form_meta_keys ) ) { |
|
921 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
920 | + if ( ! empty($form_meta_keys)) { |
|
921 | + foreach ($form_meta_keys as $form_meta_key) { |
|
922 | 922 | |
923 | 923 | // Set default value for checkbox fields. |
924 | 924 | if ( |
925 | - ! isset( $_POST[ $form_meta_key ] ) && |
|
926 | - in_array( $this->get_field_type( $form_meta_key ), array( 'checkbox', 'chosen' ) ) |
|
925 | + ! isset($_POST[$form_meta_key]) && |
|
926 | + in_array($this->get_field_type($form_meta_key), array('checkbox', 'chosen')) |
|
927 | 927 | ) { |
928 | - $_POST[ $form_meta_key ] = ''; |
|
928 | + $_POST[$form_meta_key] = ''; |
|
929 | 929 | } |
930 | 930 | |
931 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
932 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
933 | - if ( ! empty( $setting_field['type'] ) ) { |
|
934 | - switch ( $setting_field['type'] ) { |
|
931 | + if (isset($_POST[$form_meta_key])) { |
|
932 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
933 | + if ( ! empty($setting_field['type'])) { |
|
934 | + switch ($setting_field['type']) { |
|
935 | 935 | case 'textarea': |
936 | 936 | case 'wysiwyg': |
937 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
937 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
938 | 938 | break; |
939 | 939 | |
940 | 940 | case 'donation_limit' : |
941 | - $form_meta_value = $_POST[ $form_meta_key ]; |
|
941 | + $form_meta_value = $_POST[$form_meta_key]; |
|
942 | 942 | break; |
943 | 943 | |
944 | 944 | case 'group': |
945 | 945 | $form_meta_value = array(); |
946 | 946 | |
947 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
947 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
948 | 948 | |
949 | 949 | // Do not save template input field values. |
950 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
950 | + if ('{{row-count-placeholder}}' === $index) { |
|
951 | 951 | continue; |
952 | 952 | } |
953 | 953 | |
954 | 954 | $group_meta_value = array(); |
955 | - foreach ( $group as $field_id => $field_value ) { |
|
956 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
955 | + foreach ($group as $field_id => $field_value) { |
|
956 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
957 | 957 | case 'wysiwyg': |
958 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
958 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
959 | 959 | break; |
960 | 960 | |
961 | 961 | default: |
962 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
962 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - if ( ! empty( $group_meta_value ) ) { |
|
967 | - $form_meta_value[ $index ] = $group_meta_value; |
|
966 | + if ( ! empty($group_meta_value)) { |
|
967 | + $form_meta_value[$index] = $group_meta_value; |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
971 | 971 | // Arrange repeater field keys in order. |
972 | - $form_meta_value = array_values( $form_meta_value ); |
|
972 | + $form_meta_value = array_values($form_meta_value); |
|
973 | 973 | break; |
974 | 974 | |
975 | 975 | default: |
976 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
976 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
977 | 977 | }// End switch(). |
978 | 978 | |
979 | 979 | /** |
@@ -983,38 +983,38 @@ discard block |
||
983 | 983 | */ |
984 | 984 | $form_meta_value = apply_filters( |
985 | 985 | 'give_pre_save_form_meta_value', |
986 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
986 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
987 | 987 | $form_meta_key, |
988 | 988 | $this, |
989 | 989 | $post_id |
990 | 990 | ); |
991 | 991 | |
992 | 992 | // Range slider. |
993 | - if ( 'donation_limit' === $setting_field['type'] ) { |
|
993 | + if ('donation_limit' === $setting_field['type']) { |
|
994 | 994 | |
995 | 995 | // Sanitize amount for db. |
996 | - $form_meta_value = array_map( 'give_sanitize_amount_for_db', $form_meta_value ); |
|
996 | + $form_meta_value = array_map('give_sanitize_amount_for_db', $form_meta_value); |
|
997 | 997 | |
998 | 998 | // Store it to form meta. |
999 | - give_update_meta( $post_id, $form_meta_key . '_minimum', $form_meta_value['minimum'] ); |
|
1000 | - give_update_meta( $post_id, $form_meta_key . '_maximum', $form_meta_value['maximum'] ); |
|
999 | + give_update_meta($post_id, $form_meta_key.'_minimum', $form_meta_value['minimum']); |
|
1000 | + give_update_meta($post_id, $form_meta_key.'_maximum', $form_meta_value['maximum']); |
|
1001 | 1001 | } else { |
1002 | 1002 | // Save data. |
1003 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
1003 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // Verify and delete form meta based on the form status. |
1007 | - give_set_form_closed_status( $post_id ); |
|
1007 | + give_set_form_closed_status($post_id); |
|
1008 | 1008 | |
1009 | 1009 | // Fire after saving form meta key. |
1010 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
1010 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
1011 | 1011 | }// End if(). |
1012 | 1012 | }// End if(). |
1013 | 1013 | }// End foreach(). |
1014 | 1014 | }// End if(). |
1015 | 1015 | |
1016 | 1016 | // Fire action after saving form meta. |
1017 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
1017 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | |
@@ -1027,10 +1027,10 @@ discard block |
||
1027 | 1027 | * |
1028 | 1028 | * @return string |
1029 | 1029 | */ |
1030 | - private function get_field_id( $field ) { |
|
1030 | + private function get_field_id($field) { |
|
1031 | 1031 | $field_id = ''; |
1032 | 1032 | |
1033 | - if ( array_key_exists( 'id', $field ) ) { |
|
1033 | + if (array_key_exists('id', $field)) { |
|
1034 | 1034 | $field_id = $field['id']; |
1035 | 1035 | |
1036 | 1036 | } |
@@ -1047,16 +1047,16 @@ discard block |
||
1047 | 1047 | * |
1048 | 1048 | * @return array |
1049 | 1049 | */ |
1050 | - private function get_fields_id( $setting ) { |
|
1050 | + private function get_fields_id($setting) { |
|
1051 | 1051 | $meta_keys = array(); |
1052 | 1052 | |
1053 | 1053 | if ( |
1054 | - ! empty( $setting ) |
|
1055 | - && array_key_exists( 'fields', $setting ) |
|
1056 | - && ! empty( $setting['fields'] ) |
|
1054 | + ! empty($setting) |
|
1055 | + && array_key_exists('fields', $setting) |
|
1056 | + && ! empty($setting['fields']) |
|
1057 | 1057 | ) { |
1058 | - foreach ( $setting['fields'] as $field ) { |
|
1059 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1058 | + foreach ($setting['fields'] as $field) { |
|
1059 | + if ($field_id = $this->get_field_id($field)) { |
|
1060 | 1060 | $meta_keys[] = $field_id; |
1061 | 1061 | } |
1062 | 1062 | } |
@@ -1074,14 +1074,14 @@ discard block |
||
1074 | 1074 | * |
1075 | 1075 | * @return array |
1076 | 1076 | */ |
1077 | - private function get_sub_fields_id( $setting ) { |
|
1077 | + private function get_sub_fields_id($setting) { |
|
1078 | 1078 | $meta_keys = array(); |
1079 | 1079 | |
1080 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
1081 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1082 | - if ( ! empty( $fields['fields'] ) ) { |
|
1083 | - foreach ( $fields['fields'] as $field ) { |
|
1084 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1080 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
1081 | + foreach ($setting['sub-fields'] as $fields) { |
|
1082 | + if ( ! empty($fields['fields'])) { |
|
1083 | + foreach ($fields['fields'] as $field) { |
|
1084 | + if ($field_id = $this->get_field_id($field)) { |
|
1085 | 1085 | $meta_keys[] = $field_id; |
1086 | 1086 | } |
1087 | 1087 | } |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | private function get_meta_keys_from_settings() { |
1104 | 1104 | $meta_keys = array(); |
1105 | 1105 | |
1106 | - foreach ( $this->settings as $setting ) { |
|
1107 | - $meta_key = $this->get_fields_id( $setting ); |
|
1106 | + foreach ($this->settings as $setting) { |
|
1107 | + $meta_key = $this->get_fields_id($setting); |
|
1108 | 1108 | |
1109 | - if ( $this->has_sub_tab( $setting ) ) { |
|
1110 | - $meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) ); |
|
1109 | + if ($this->has_sub_tab($setting)) { |
|
1110 | + $meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting)); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
1113 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | return $meta_keys; |
@@ -1127,10 +1127,10 @@ discard block |
||
1127 | 1127 | * |
1128 | 1128 | * @return string |
1129 | 1129 | */ |
1130 | - function get_field_type( $field_id, $group_id = '' ) { |
|
1131 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
1130 | + function get_field_type($field_id, $group_id = '') { |
|
1131 | + $field = $this->get_setting_field($field_id, $group_id); |
|
1132 | 1132 | |
1133 | - $type = array_key_exists( 'type', $field ) |
|
1133 | + $type = array_key_exists('type', $field) |
|
1134 | 1134 | ? $field['type'] |
1135 | 1135 | : ''; |
1136 | 1136 | |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | * |
1149 | 1149 | * @return array |
1150 | 1150 | */ |
1151 | - private function get_field( $setting, $field_id ) { |
|
1151 | + private function get_field($setting, $field_id) { |
|
1152 | 1152 | $setting_field = array(); |
1153 | 1153 | |
1154 | - if ( ! empty( $setting['fields'] ) ) { |
|
1155 | - foreach ( $setting['fields'] as $field ) { |
|
1156 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1154 | + if ( ! empty($setting['fields'])) { |
|
1155 | + foreach ($setting['fields'] as $field) { |
|
1156 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1157 | 1157 | $setting_field = $field; |
1158 | 1158 | break; |
1159 | 1159 | } |
@@ -1173,12 +1173,12 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @return array |
1175 | 1175 | */ |
1176 | - private function get_sub_field( $setting, $field_id ) { |
|
1176 | + private function get_sub_field($setting, $field_id) { |
|
1177 | 1177 | $setting_field = array(); |
1178 | 1178 | |
1179 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1180 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1181 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1179 | + if ( ! empty($setting['sub-fields'])) { |
|
1180 | + foreach ($setting['sub-fields'] as $fields) { |
|
1181 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1182 | 1182 | $setting_field = $field; |
1183 | 1183 | break; |
1184 | 1184 | } |
@@ -1198,17 +1198,17 @@ discard block |
||
1198 | 1198 | * |
1199 | 1199 | * @return array |
1200 | 1200 | */ |
1201 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1201 | + function get_setting_field($field_id, $group_id = '') { |
|
1202 | 1202 | $setting_field = array(); |
1203 | 1203 | |
1204 | 1204 | $_field_id = $field_id; |
1205 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1205 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1206 | 1206 | |
1207 | - if ( ! empty( $this->settings ) ) { |
|
1208 | - foreach ( $this->settings as $setting ) { |
|
1207 | + if ( ! empty($this->settings)) { |
|
1208 | + foreach ($this->settings as $setting) { |
|
1209 | 1209 | if ( |
1210 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1211 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1210 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1211 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1212 | 1212 | ) { |
1213 | 1213 | break; |
1214 | 1214 | } |
@@ -1216,9 +1216,9 @@ discard block |
||
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Get field from group. |
1219 | - if ( ! empty( $group_id ) ) { |
|
1220 | - foreach ( $setting_field['fields'] as $field ) { |
|
1221 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1219 | + if ( ! empty($group_id)) { |
|
1220 | + foreach ($setting_field['fields'] as $field) { |
|
1221 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1222 | 1222 | $setting_field = $field; |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1237,14 +1237,14 @@ discard block |
||
1237 | 1237 | * |
1238 | 1238 | * @return mixed |
1239 | 1239 | */ |
1240 | - function add_offline_donations_setting_tab( $settings ) { |
|
1241 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1242 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1240 | + function add_offline_donations_setting_tab($settings) { |
|
1241 | + if (give_is_gateway_active('offline')) { |
|
1242 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1243 | 1243 | 'id' => 'offline_donations_options', |
1244 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1244 | + 'title' => __('Offline Donations', 'give'), |
|
1245 | 1245 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1246 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1247 | - ) ); |
|
1246 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1247 | + )); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | return $settings; |
@@ -1262,41 +1262,37 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @return mixed |
1264 | 1264 | */ |
1265 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1266 | - switch ( $setting_field['type'] ) { |
|
1265 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1266 | + switch ($setting_field['type']) { |
|
1267 | 1267 | case 'group': |
1268 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1269 | - foreach ( $setting_field['fields'] as $field ) { |
|
1270 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1268 | + if ( ! empty($setting_field['fields'])) { |
|
1269 | + foreach ($setting_field['fields'] as $field) { |
|
1270 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1271 | 1271 | continue; |
1272 | 1272 | } |
1273 | 1273 | |
1274 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1275 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1274 | + foreach ($meta_value as $index => $meta_data) { |
|
1275 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1276 | 1276 | continue; |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ? |
|
1280 | - give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) : |
|
1281 | - ( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ? |
|
1282 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1283 | - 0 ); |
|
1279 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ? |
|
1280 | + give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ? |
|
1281 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1284 | 1282 | } |
1285 | 1283 | } |
1286 | 1284 | } |
1287 | 1285 | break; |
1288 | 1286 | |
1289 | 1287 | default: |
1290 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1288 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1291 | 1289 | $meta_value = $meta_value ? |
1292 | - give_sanitize_amount_for_db( $meta_value ) : |
|
1293 | - ( in_array( $setting_field['id'], array( |
|
1290 | + give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array( |
|
1294 | 1291 | '_give_set_price', |
1295 | 1292 | '_give_custom_amount_minimum', |
1296 | 1293 | '_give_set_goal' |
1297 | - ) ) ? |
|
1298 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1299 | - 0 ); |
|
1294 | + )) ? |
|
1295 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1300 | 1296 | } |
1301 | 1297 | } |
1302 | 1298 | |
@@ -1314,12 +1310,12 @@ discard block |
||
1314 | 1310 | * |
1315 | 1311 | * @return string The URL after redirect. |
1316 | 1312 | */ |
1317 | - public function maintain_active_tab( $location, $post_id ) { |
|
1313 | + public function maintain_active_tab($location, $post_id) { |
|
1318 | 1314 | if ( |
1319 | - 'give_forms' === get_post_type( $post_id ) && |
|
1320 | - ! empty( $_POST['give_form_active_tab'] ) |
|
1315 | + 'give_forms' === get_post_type($post_id) && |
|
1316 | + ! empty($_POST['give_form_active_tab']) |
|
1321 | 1317 | ) { |
1322 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
1318 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
1323 | 1319 | } |
1324 | 1320 | |
1325 | 1321 | return $location; |
@@ -752,9 +752,12 @@ discard block |
||
752 | 752 | data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
753 | 753 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
754 | 754 | <?php echo $form_data_tab['icon-html']; ?> |
755 | - <?php else : ?> |
|
755 | + <?php else { |
|
756 | + : ?> |
|
756 | 757 | <span class="give-icon give-icon-default"></span> |
757 | - <?php endif; ?> |
|
758 | + <?php endif; |
|
759 | +} |
|
760 | +?> |
|
758 | 761 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
759 | 762 | </a> |
760 | 763 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -765,9 +768,12 @@ discard block |
||
765 | 768 | data-tab-id="<?php echo $sub_tab['id']; ?>"> |
766 | 769 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
767 | 770 | <?php echo $sub_tab['icon-html']; ?> |
768 | - <?php else : ?> |
|
771 | + <?php else { |
|
772 | + : ?> |
|
769 | 773 | <span class="give-icon give-icon-default"></span> |
770 | - <?php endif; ?> |
|
774 | + <?php endif; |
|
775 | +} |
|
776 | +?> |
|
771 | 777 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
772 | 778 | </a> |
773 | 779 | </li> |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = __( 'Display Options', 'give' ); |
|
30 | + $this->label = __('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,65 +53,65 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => __('Default Give Styles', 'give'), |
|
57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
67 | + 'name' => __('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
70 | 70 | 'a' => array( |
71 | 71 | 'href' => array(), |
72 | 72 | 'target' => array(), |
73 | 73 | ), |
74 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
74 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
75 | 75 | 'id' => 'floatlabels', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'default' => 'disabled', |
78 | 78 | 'options' => array( |
79 | - 'enabled' => __( 'Enabled', 'give' ), |
|
80 | - 'disabled' => __( 'Disabled', 'give' ), |
|
79 | + 'enabled' => __('Enabled', 'give'), |
|
80 | + 'disabled' => __('Disabled', 'give'), |
|
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
84 | + 'name' => __('Welcome Screen', 'give'), |
|
85 | 85 | /* translators: %s: about page URL */ |
86 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( |
|
86 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array( |
|
87 | 87 | 'a' => array( |
88 | 88 | 'href' => array(), |
89 | 89 | 'target' => array(), |
90 | 90 | ), |
91 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
91 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
92 | 92 | 'id' => 'welcome', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Name Title Prefix', 'give' ), |
|
102 | - 'desc' => __( 'Do you want a Name Title Prefix field to appear before First Name?', 'give' ), |
|
101 | + 'name' => __('Name Title Prefix', 'give'), |
|
102 | + 'desc' => __('Do you want a Name Title Prefix field to appear before First Name?', 'give'), |
|
103 | 103 | 'id' => 'name_title_prefix', |
104 | 104 | 'type' => 'radio_inline', |
105 | 105 | 'default' => 'disabled', |
106 | 106 | 'options' => array( |
107 | - 'disabled' => __( 'Disabled', 'give' ), |
|
108 | - 'required' => __( 'Required', 'give' ), |
|
109 | - 'optional' => __( 'Optional', 'give' ), |
|
107 | + 'disabled' => __('Disabled', 'give'), |
|
108 | + 'required' => __('Required', 'give'), |
|
109 | + 'optional' => __('Optional', 'give'), |
|
110 | 110 | ), |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Title Prefixes', 'give' ), |
|
114 | - 'desc' => __( 'Add or remove salutations from the dropdown using the field above.', 'give' ), |
|
113 | + 'name' => __('Title Prefixes', 'give'), |
|
114 | + 'desc' => __('Add or remove salutations from the dropdown using the field above.', 'give'), |
|
115 | 115 | 'id' => 'title_prefixes', |
116 | 116 | 'type' => 'chosen', |
117 | 117 | 'data_type' => 'multiselect', |
@@ -120,44 +120,44 @@ discard block |
||
120 | 120 | 'options' => give_get_default_title_prefixes(), |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Company Field', 'give' ), |
|
124 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name fields on all donation forms? You can enable this option per form as well.', 'give' ), |
|
123 | + 'name' => __('Company Field', 'give'), |
|
124 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name fields on all donation forms? You can enable this option per form as well.', 'give'), |
|
125 | 125 | 'id' => 'company_field', |
126 | 126 | 'type' => 'radio_inline', |
127 | 127 | 'default' => 'disabled', |
128 | 128 | 'options' => array( |
129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
130 | - 'required' => __( 'Required', 'give' ), |
|
131 | - 'optional' => __( 'Optional', 'give' ), |
|
129 | + 'disabled' => __('Disabled', 'give'), |
|
130 | + 'required' => __('Required', 'give'), |
|
131 | + 'optional' => __('Optional', 'give'), |
|
132 | 132 | ), |
133 | 133 | ), |
134 | 134 | array( |
135 | - 'name' => __( 'Anonymous Donations', 'give' ), |
|
136 | - 'desc' => __( 'Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give' ), |
|
135 | + 'name' => __('Anonymous Donations', 'give'), |
|
136 | + 'desc' => __('Do you want to provide donors the ability mark himself/herself anonymous while giving. This will prevent their information from appearing publicly on your website but you will still receive their information for your records in the admin panel.', 'give'), |
|
137 | 137 | 'id' => 'anonymous_donation', |
138 | 138 | 'type' => 'radio_inline', |
139 | 139 | 'default' => 'disabled', |
140 | 140 | 'options' => array( |
141 | - 'enabled' => __( 'Enabled', 'give' ), |
|
142 | - 'disabled' => __( 'Disabled', 'give' ), |
|
141 | + 'enabled' => __('Enabled', 'give'), |
|
142 | + 'disabled' => __('Disabled', 'give'), |
|
143 | 143 | ), |
144 | 144 | ), |
145 | 145 | array( |
146 | - 'name' => __( 'Donor Comment', 'give' ), |
|
147 | - 'desc' => __( 'Do you want to provide donors the ability to add a note to his/her donation? The note will display publicly on the donor wall if they do not select to give anonymously.', 'give' ), |
|
146 | + 'name' => __('Donor Comment', 'give'), |
|
147 | + 'desc' => __('Do you want to provide donors the ability to add a note to his/her donation? The note will display publicly on the donor wall if they do not select to give anonymously.', 'give'), |
|
148 | 148 | 'id' => 'donor_comment', |
149 | 149 | 'type' => 'radio_inline', |
150 | 150 | 'default' => 'disabled', |
151 | 151 | 'options' => array( |
152 | - 'enabled' => __( 'Enabled', 'give' ), |
|
153 | - 'disabled' => __( 'Disabled', 'give' ), |
|
152 | + 'enabled' => __('Enabled', 'give'), |
|
153 | + 'disabled' => __('Disabled', 'give'), |
|
154 | 154 | ), |
155 | 155 | ), |
156 | 156 | array( |
157 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
157 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
158 | 158 | 'id' => 'display_settings_docs_link', |
159 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
160 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
159 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
160 | + 'title' => __('Display Options Settings', 'give'), |
|
161 | 161 | 'type' => 'give_docs_link', |
162 | 162 | ), |
163 | 163 | array( |
@@ -174,78 +174,78 @@ discard block |
||
174 | 174 | 'type' => 'title', |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => __( 'Form Single Views', 'give' ), |
|
178 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
177 | + 'name' => __('Form Single Views', 'give'), |
|
178 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
179 | 179 | 'id' => 'forms_singular', |
180 | 180 | 'type' => 'radio_inline', |
181 | 181 | 'default' => 'enabled', |
182 | 182 | 'options' => array( |
183 | - 'enabled' => __( 'Enabled', 'give' ), |
|
184 | - 'disabled' => __( 'Disabled', 'give' ), |
|
183 | + 'enabled' => __('Enabled', 'give'), |
|
184 | + 'disabled' => __('Disabled', 'give'), |
|
185 | 185 | ), |
186 | 186 | ), |
187 | 187 | array( |
188 | - 'name' => __( 'Form Archives', 'give' ), |
|
189 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( |
|
188 | + 'name' => __('Form Archives', 'give'), |
|
189 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array( |
|
190 | 190 | 'a' => array( |
191 | 191 | 'href' => array(), |
192 | 192 | 'target' => array(), |
193 | 193 | ), |
194 | - ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
194 | + )), esc_url(admin_url('options-permalink.php'))), |
|
195 | 195 | 'id' => 'forms_archives', |
196 | 196 | 'type' => 'radio_inline', |
197 | 197 | 'default' => 'enabled', |
198 | 198 | 'options' => array( |
199 | - 'enabled' => __( 'Enabled', 'give' ), |
|
200 | - 'disabled' => __( 'Disabled', 'give' ), |
|
199 | + 'enabled' => __('Enabled', 'give'), |
|
200 | + 'disabled' => __('Disabled', 'give'), |
|
201 | 201 | ), |
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
205 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
204 | + 'name' => __('Form Excerpts', 'give'), |
|
205 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
206 | 206 | 'id' => 'forms_excerpt', |
207 | 207 | 'type' => 'radio_inline', |
208 | 208 | 'default' => 'enabled', |
209 | 209 | 'options' => array( |
210 | - 'enabled' => __( 'Enabled', 'give' ), |
|
211 | - 'disabled' => __( 'Disabled', 'give' ), |
|
210 | + 'enabled' => __('Enabled', 'give'), |
|
211 | + 'disabled' => __('Disabled', 'give'), |
|
212 | 212 | ), |
213 | 213 | ), |
214 | 214 | array( |
215 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
216 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
215 | + 'name' => __('Form Featured Image', 'give'), |
|
216 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
217 | 217 | 'id' => 'form_featured_img', |
218 | 218 | 'type' => 'radio_inline', |
219 | 219 | 'default' => 'enabled', |
220 | 220 | 'options' => array( |
221 | - 'enabled' => __( 'Enabled', 'give' ), |
|
222 | - 'disabled' => __( 'Disabled', 'give' ), |
|
221 | + 'enabled' => __('Enabled', 'give'), |
|
222 | + 'disabled' => __('Disabled', 'give'), |
|
223 | 223 | ), |
224 | 224 | ), |
225 | 225 | array( |
226 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
227 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
226 | + 'name' => __('Featured Image Size', 'give'), |
|
227 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
228 | 228 | 'id' => 'featured_image_size', |
229 | 229 | 'type' => 'select', |
230 | 230 | 'default' => 'large', |
231 | 231 | 'options' => give_get_featured_image_sizes(), |
232 | 232 | ), |
233 | 233 | array( |
234 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
235 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
234 | + 'name' => __('Single Form Sidebar', 'give'), |
|
235 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
236 | 236 | 'id' => 'form_sidebar', |
237 | 237 | 'type' => 'radio_inline', |
238 | 238 | 'default' => 'enabled', |
239 | 239 | 'options' => array( |
240 | - 'enabled' => __( 'Enabled', 'give' ), |
|
241 | - 'disabled' => __( 'Disabled', 'give' ), |
|
240 | + 'enabled' => __('Enabled', 'give'), |
|
241 | + 'disabled' => __('Disabled', 'give'), |
|
242 | 242 | ), |
243 | 243 | ), |
244 | 244 | array( |
245 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
245 | + 'name' => __('Post Types Docs Link', 'give'), |
|
246 | 246 | 'id' => 'post_types_settings_docs_link', |
247 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
248 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
247 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
248 | + 'title' => __('Post Types Settings', 'give'), |
|
249 | 249 | 'type' => 'give_docs_link', |
250 | 250 | ), |
251 | 251 | array( |
@@ -262,32 +262,32 @@ discard block |
||
262 | 262 | 'type' => 'title', |
263 | 263 | ), |
264 | 264 | array( |
265 | - 'name' => __( 'Form Categories', 'give' ), |
|
266 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
265 | + 'name' => __('Form Categories', 'give'), |
|
266 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
267 | 267 | 'id' => 'categories', |
268 | 268 | 'type' => 'radio_inline', |
269 | 269 | 'default' => 'disabled', |
270 | 270 | 'options' => array( |
271 | - 'enabled' => __( 'Enabled', 'give' ), |
|
272 | - 'disabled' => __( 'Disabled', 'give' ), |
|
271 | + 'enabled' => __('Enabled', 'give'), |
|
272 | + 'disabled' => __('Disabled', 'give'), |
|
273 | 273 | ), |
274 | 274 | ), |
275 | 275 | array( |
276 | - 'name' => __( 'Form Tags', 'give' ), |
|
277 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
276 | + 'name' => __('Form Tags', 'give'), |
|
277 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
278 | 278 | 'id' => 'tags', |
279 | 279 | 'type' => 'radio_inline', |
280 | 280 | 'default' => 'disabled', |
281 | 281 | 'options' => array( |
282 | - 'enabled' => __( 'Enabled', 'give' ), |
|
283 | - 'disabled' => __( 'Disabled', 'give' ), |
|
282 | + 'enabled' => __('Enabled', 'give'), |
|
283 | + 'disabled' => __('Disabled', 'give'), |
|
284 | 284 | ), |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
287 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
288 | 288 | 'id' => 'taxonomies_settings_docs_link', |
289 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
290 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
289 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
290 | + 'title' => __('Taxonomies Settings', 'give'), |
|
291 | 291 | 'type' => 'give_docs_link', |
292 | 292 | ), |
293 | 293 | array( |
@@ -304,37 +304,37 @@ discard block |
||
304 | 304 | 'type' => 'title', |
305 | 305 | ), |
306 | 306 | array( |
307 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
308 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
307 | + 'name' => __('Terms and Conditions', 'give'), |
|
308 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
309 | 309 | 'id' => 'terms', |
310 | 310 | 'type' => 'radio_inline', |
311 | 311 | 'default' => 'disabled', |
312 | 312 | 'options' => array( |
313 | - 'enabled' => __( 'Enabled', 'give' ), |
|
314 | - 'disabled' => __( 'Disabled', 'give' ), |
|
313 | + 'enabled' => __('Enabled', 'give'), |
|
314 | + 'disabled' => __('Disabled', 'give'), |
|
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
319 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
318 | + 'name' => __('Agree to Terms Label', 'give'), |
|
319 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
320 | 320 | 'id' => 'agree_to_terms_label', |
321 | 321 | 'attributes' => array( |
322 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
322 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
323 | 323 | 'rows' => 1 |
324 | 324 | ), |
325 | 325 | 'type' => 'textarea', |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'name' => __( 'Agreement Text', 'give' ), |
|
329 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
328 | + 'name' => __('Agreement Text', 'give'), |
|
329 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
330 | 330 | 'id' => 'agreement_text', |
331 | 331 | 'type' => 'wysiwyg', |
332 | 332 | ), |
333 | 333 | array( |
334 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
334 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
335 | 335 | 'id' => 'terms_settings_docs_link', |
336 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
337 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
336 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
337 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
338 | 338 | 'type' => 'give_docs_link', |
339 | 339 | ), |
340 | 340 | array( |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * Filter the display options settings. |
350 | 350 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
351 | 351 | */ |
352 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
352 | + $settings = apply_filters('give_settings_display', $settings); |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Filter the settings. |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param array $settings |
360 | 360 | */ |
361 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
361 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
362 | 362 | |
363 | 363 | // Output. |
364 | 364 | return $settings; |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function get_sections() { |
374 | 374 | $sections = array( |
375 | - 'display-settings' => __( 'Display', 'give' ), |
|
376 | - 'post-types' => __( 'Post Types', 'give' ), |
|
377 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
378 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ), |
|
375 | + 'display-settings' => __('Display', 'give'), |
|
376 | + 'post-types' => __('Post Types', 'give'), |
|
377 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
378 | + 'term-and-conditions' => __('Terms and Conditions', 'give'), |
|
379 | 379 | ); |
380 | 380 | |
381 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
381 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | - add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) ); |
|
36 | + add_action('give_admin_field_email_notification', array($this, 'email_notification_setting')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $settings = array(); |
47 | 47 | $current_section = give_get_current_setting_section(); |
48 | 48 | |
49 | - switch ( $current_section ) { |
|
49 | + switch ($current_section) { |
|
50 | 50 | case 'email-settings' : |
51 | 51 | $settings = array( |
52 | 52 | |
53 | 53 | // Section 1: Email Notification Listing. |
54 | 54 | array( |
55 | - 'desc' => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ), |
|
55 | + 'desc' => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'), |
|
56 | 56 | 'type' => 'title', |
57 | 57 | 'id' => 'give_email_notification_settings', |
58 | 58 | 'table_html' => false, |
@@ -67,42 +67,42 @@ discard block |
||
67 | 67 | |
68 | 68 | // Section 2: Email Sender Setting |
69 | 69 | array( |
70 | - 'title' => __( 'Email Sender Options', 'give' ), |
|
70 | + 'title' => __('Email Sender Options', 'give'), |
|
71 | 71 | 'id' => 'give_title_email_settings_1', |
72 | 72 | 'type' => 'title', |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'email_template', |
76 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
77 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
76 | + 'name' => esc_html__('Email Template', 'give'), |
|
77 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
78 | 78 | 'type' => 'select', |
79 | 79 | 'options' => give_get_email_templates(), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'id' => 'email_logo', |
83 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
84 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
83 | + 'name' => esc_html__('Logo', 'give'), |
|
84 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
85 | 85 | 'type' => 'file', |
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'from_name', |
89 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
90 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
91 | - 'default' => get_bloginfo( 'name' ), |
|
89 | + 'name' => esc_html__('From Name', 'give'), |
|
90 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
91 | + 'default' => get_bloginfo('name'), |
|
92 | 92 | 'type' => 'text', |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'id' => 'from_email', |
96 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
97 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
98 | - 'default' => get_bloginfo( 'admin_email' ), |
|
96 | + 'name' => esc_html__('From Email', 'give'), |
|
97 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
98 | + 'default' => get_bloginfo('admin_email'), |
|
99 | 99 | 'type' => 'text', |
100 | 100 | ), |
101 | 101 | array( |
102 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
102 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
103 | 103 | 'id' => 'donation_notification_settings_docs_link', |
104 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
105 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
104 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
105 | + 'title' => __('Donation Notification Settings', 'give'), |
|
106 | 106 | 'type' => 'give_docs_link', |
107 | 107 | ), |
108 | 108 | array( |
@@ -120,19 +120,19 @@ discard block |
||
120 | 120 | 'type' => 'title' |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Admin Email Address', 'give' ), |
|
123 | + 'name' => __('Admin Email Address', 'give'), |
|
124 | 124 | 'id' => "contact_admin_email", |
125 | - 'desc' => sprintf( '%1$s <code>{admin_email}</code> %2$s', __( 'By default, the', 'give' ), __( 'tag will use your WordPress admin email. If you would like to customize this address you can do so in the field above.', 'give' ) ), |
|
125 | + 'desc' => sprintf('%1$s <code>{admin_email}</code> %2$s', __('By default, the', 'give'), __('tag will use your WordPress admin email. If you would like to customize this address you can do so in the field above.', 'give')), |
|
126 | 126 | 'type' => 'text', |
127 | 127 | 'default' => give_email_admin_email(), |
128 | 128 | |
129 | 129 | ), |
130 | 130 | array( |
131 | - 'name' => __( 'Offline Mailing Address', 'give' ), |
|
131 | + 'name' => __('Offline Mailing Address', 'give'), |
|
132 | 132 | 'id' => "contact_offline_mailing_address", |
133 | - 'desc' => sprintf( '%1$s <code>{offline_mailing_address}</code> %2$s', __( 'Set the mailing address to where you would like your donors to send their offline donations. This will customize the', 'give' ), __( 'email tag for the Offline Donations payment gateway.', 'give' ) ), |
|
133 | + 'desc' => sprintf('%1$s <code>{offline_mailing_address}</code> %2$s', __('Set the mailing address to where you would like your donors to send their offline donations. This will customize the', 'give'), __('email tag for the Offline Donations payment gateway.', 'give')), |
|
134 | 134 | 'type' => 'wysiwyg', |
135 | - 'default' => ' <em>' . get_bloginfo( 'sitename' ) . '</em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', |
|
135 | + 'default' => ' <em>'.get_bloginfo('sitename').'</em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', |
|
136 | 136 | ), |
137 | 137 | array( |
138 | 138 | 'id' => 'give_title_general_settings_4', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Filter the emails settings. |
148 | 148 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
149 | 149 | */ |
150 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
150 | + $settings = apply_filters('give_settings_emails', $settings); |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Filter the settings. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param array $settings |
158 | 158 | */ |
159 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
159 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
160 | 160 | |
161 | 161 | // Output. |
162 | 162 | return $settings; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_sections() { |
172 | 172 | $sections = array( |
173 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
174 | - 'contact' => esc_html__( 'Contact Information', 'give' ), |
|
173 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
174 | + 'contact' => esc_html__('Contact Information', 'give'), |
|
175 | 175 | ); |
176 | 176 | |
177 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
177 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function email_notification_setting() { |
187 | 187 | // Load email notification table. |
188 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php'; |
|
188 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php'; |
|
189 | 189 | |
190 | 190 | // Init table. |
191 | 191 | $email_notifications_table = new Give_Email_Notification_Table(); |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | */ |
206 | 206 | public function output() { |
207 | - if ( $this->enable_save ) { |
|
208 | - $GLOBALS['give_hide_save_button'] = apply_filters( 'give_hide_save_button_on_email_admin_setting_page', false ); |
|
207 | + if ($this->enable_save) { |
|
208 | + $GLOBALS['give_hide_save_button'] = apply_filters('give_hide_save_button_on_email_admin_setting_page', false); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $settings = $this->get_settings(); |
212 | 212 | |
213 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
213 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly. |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = __( 'General', 'give' ); |
|
30 | + $this->label = __('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_save_settings_give_settings', array( $this, '__give_change_donation_stating_number' ), 10, 3 ); |
|
36 | - add_action( 'give_admin_field_give_sequential_donation_code_preview', array( $this, '__render_give_sequential_donation_code_preview' ), 10, 3 ); |
|
37 | - add_action( 'give_admin_field_give_unlock_all_settings', array( $this, '__render_give_unlock_all_settings' ), 10, 3 ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_save_settings_give_settings', array($this, '__give_change_donation_stating_number'), 10, 3); |
|
36 | + add_action('give_admin_field_give_sequential_donation_code_preview', array($this, '__render_give_sequential_donation_code_preview'), 10, 3); |
|
37 | + add_action('give_admin_field_give_unlock_all_settings', array($this, '__render_give_unlock_all_settings'), 10, 3); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | parent::__construct(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $settings = array(); |
51 | 51 | $current_section = give_get_current_setting_section(); |
52 | 52 | |
53 | - switch ( $current_section ) { |
|
53 | + switch ($current_section) { |
|
54 | 54 | case 'access-control': |
55 | 55 | $settings = array( |
56 | 56 | // Section 3: Access control. |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'id' => 'session_lifetime', |
63 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
64 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
63 | + 'name' => __('Session Lifetime', 'give'), |
|
64 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
65 | 65 | 'type' => 'select', |
66 | 66 | 'options' => array( |
67 | - '86400' => __( '24 Hours', 'give' ), |
|
68 | - '172800' => __( '48 Hours', 'give' ), |
|
69 | - '259200' => __( '72 Hours', 'give' ), |
|
70 | - '604800' => __( '1 Week', 'give' ), |
|
67 | + '86400' => __('24 Hours', 'give'), |
|
68 | + '172800' => __('48 Hours', 'give'), |
|
69 | + '259200' => __('72 Hours', 'give'), |
|
70 | + '604800' => __('1 Week', 'give'), |
|
71 | 71 | ), |
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'id' => 'limit_display_donations', |
75 | - 'name' => __( 'Limit Donations Displayed', 'give' ), |
|
76 | - 'desc' => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ), |
|
75 | + 'name' => __('Limit Donations Displayed', 'give'), |
|
76 | + 'desc' => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'), |
|
77 | 77 | 'default' => '1', |
78 | 78 | 'type' => 'number', |
79 | 79 | 'css' => 'width:50px;', |
@@ -83,47 +83,47 @@ discard block |
||
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | array( |
86 | - 'name' => __( 'Email Access', 'give' ), |
|
87 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
86 | + 'name' => __('Email Access', 'give'), |
|
87 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
88 | 88 | 'id' => 'email_access', |
89 | 89 | 'type' => 'radio_inline', |
90 | 90 | 'default' => 'disabled', |
91 | 91 | 'options' => array( |
92 | - 'enabled' => __( 'Enabled', 'give' ), |
|
93 | - 'disabled' => __( 'Disabled', 'give' ), |
|
92 | + 'enabled' => __('Enabled', 'give'), |
|
93 | + 'disabled' => __('Disabled', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | - 'name' => __( 'Enable reCAPTCHA', 'give' ), |
|
98 | - 'desc' => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ), |
|
97 | + 'name' => __('Enable reCAPTCHA', 'give'), |
|
98 | + 'desc' => __('Would you like to enable the reCAPTCHA feature?', 'give'), |
|
99 | 99 | 'id' => 'enable_recaptcha', |
100 | 100 | 'type' => 'radio_inline', |
101 | 101 | 'default' => 'disabled', |
102 | 102 | 'options' => array( |
103 | - 'enabled' => __( 'Enabled', 'give' ), |
|
104 | - 'disabled' => __( 'Disabled', 'give' ), |
|
103 | + 'enabled' => __('Enabled', 'give'), |
|
104 | + 'disabled' => __('Disabled', 'give'), |
|
105 | 105 | ), |
106 | 106 | ), |
107 | 107 | array( |
108 | 108 | 'id' => 'recaptcha_key', |
109 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
109 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
110 | 110 | /* translators: %s: https://www.google.com/recaptcha/ */ |
111 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
111 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
112 | 112 | 'default' => '', |
113 | 113 | 'type' => 'text', |
114 | 114 | ), |
115 | 115 | array( |
116 | 116 | 'id' => 'recaptcha_secret', |
117 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
118 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
117 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
118 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
119 | 119 | 'default' => '', |
120 | 120 | 'type' => 'text', |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Access Control Docs Link', 'give' ), |
|
123 | + 'name' => __('Access Control Docs Link', 'give'), |
|
124 | 124 | 'id' => 'access_control_docs_link', |
125 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
126 | - 'title' => __( 'Access Control', 'give' ), |
|
125 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
126 | + 'title' => __('Access Control', 'give'), |
|
127 | 127 | 'type' => 'give_docs_link', |
128 | 128 | ), |
129 | 129 | array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'currency-settings' : |
137 | - $currency_position_before = __( 'Before - %s‎10', 'give' ); |
|
138 | - $currency_position_after = __( 'After - 10%s‏', 'give' ); |
|
137 | + $currency_position_before = __('Before - %s‎10', 'give'); |
|
138 | + $currency_position_after = __('After - 10%s‏', 'give'); |
|
139 | 139 | |
140 | 140 | $settings = array( |
141 | 141 | // Section 2: Currency |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | 'id' => 'give_title_general_settings_2', |
145 | 145 | ), |
146 | 146 | array( |
147 | - 'name' => __( 'Currency Settings', 'give' ), |
|
147 | + 'name' => __('Currency Settings', 'give'), |
|
148 | 148 | 'desc' => '', |
149 | 149 | 'type' => 'give_title', |
150 | 150 | 'id' => 'give_title_general_settings_2', |
151 | 151 | ), |
152 | 152 | array( |
153 | - 'name' => __( 'Currency', 'give' ), |
|
154 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
153 | + 'name' => __('Currency', 'give'), |
|
154 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
155 | 155 | 'id' => 'currency', |
156 | 156 | 'class' => 'give-select-chosen', |
157 | 157 | 'type' => 'select', |
@@ -159,51 +159,51 @@ discard block |
||
159 | 159 | 'default' => 'USD', |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Currency Position', 'give' ), |
|
163 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
162 | + 'name' => __('Currency Position', 'give'), |
|
163 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
164 | 164 | 'id' => 'currency_position', |
165 | 165 | 'type' => 'select', |
166 | 166 | 'options' => array( |
167 | 167 | /* translators: %s: currency symbol */ |
168 | - 'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ), |
|
168 | + 'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())), |
|
169 | 169 | /* translators: %s: currency symbol */ |
170 | - 'after' => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ), |
|
170 | + 'after' => sprintf($currency_position_after, give_currency_symbol(give_get_currency())), |
|
171 | 171 | ), |
172 | 172 | 'default' => 'before', |
173 | 173 | 'attributes' => array( |
174 | - 'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ), |
|
175 | - 'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ), |
|
174 | + 'data-before-template' => sprintf($currency_position_before, '{currency_pos}'), |
|
175 | + 'data-after-template' => sprintf($currency_position_after, '{currency_pos}'), |
|
176 | 176 | ), |
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
180 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
179 | + 'name' => __('Thousands Separator', 'give'), |
|
180 | + 'desc' => __('The symbol (typically , or .) to separate thousands.', 'give'), |
|
181 | 181 | 'id' => 'thousands_separator', |
182 | 182 | 'type' => 'text', |
183 | 183 | 'default' => ',', |
184 | 184 | 'css' => 'width:12em;', |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
188 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
187 | + 'name' => __('Decimal Separator', 'give'), |
|
188 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
189 | 189 | 'id' => 'decimal_separator', |
190 | 190 | 'type' => 'text', |
191 | 191 | 'default' => '.', |
192 | 192 | 'css' => 'width:12em;', |
193 | 193 | ), |
194 | 194 | array( |
195 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
196 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
195 | + 'name' => __('Number of Decimals', 'give'), |
|
196 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
197 | 197 | 'id' => 'number_decimals', |
198 | 198 | 'type' => 'text', |
199 | 199 | 'default' => 2, |
200 | 200 | 'css' => 'width:12em;', |
201 | 201 | ), |
202 | 202 | array( |
203 | - 'name' => __( 'Currency Options Docs Link', 'give' ), |
|
203 | + 'name' => __('Currency Options Docs Link', 'give'), |
|
204 | 204 | 'id' => 'currency_settings_docs_link', |
205 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
206 | - 'title' => __( 'Currency Settings', 'give' ), |
|
205 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
206 | + 'title' => __('Currency Settings', 'give'), |
|
207 | 207 | 'type' => 'give_docs_link', |
208 | 208 | ), |
209 | 209 | array( |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | $countries = give_get_country(); |
220 | 220 | |
221 | 221 | // get the list of the states of which default country is selected. |
222 | - $states = give_get_states( $countries ); |
|
222 | + $states = give_get_states($countries); |
|
223 | 223 | |
224 | 224 | // Get the country list that does not have any states init. |
225 | 225 | $no_states_country = give_no_states_country_list(); |
226 | 226 | |
227 | 227 | $states_label = give_get_states_label(); |
228 | 228 | $country = give_get_country(); |
229 | - $label = __( 'State', 'give' ); |
|
229 | + $label = __('State', 'give'); |
|
230 | 230 | // Check if $country code exists in the array key for states label. |
231 | - if ( array_key_exists( $country, $states_label ) ) { |
|
232 | - $label = $states_label[ $country ]; |
|
231 | + if (array_key_exists($country, $states_label)) { |
|
232 | + $label = $states_label[$country]; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -240,58 +240,58 @@ discard block |
||
240 | 240 | 'id' => 'give_title_general_settings_1', |
241 | 241 | ), |
242 | 242 | array( |
243 | - 'name' => __( 'General Settings', 'give' ), |
|
243 | + 'name' => __('General Settings', 'give'), |
|
244 | 244 | 'desc' => '', |
245 | 245 | 'type' => 'give_title', |
246 | 246 | 'id' => 'give_title_general_settings_1', |
247 | 247 | ), |
248 | 248 | array( |
249 | - 'name' => __( 'Success Page', 'give' ), |
|
249 | + 'name' => __('Success Page', 'give'), |
|
250 | 250 | /* translators: %s: [give_receipt] */ |
251 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
251 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
252 | 252 | 'id' => 'success_page', |
253 | 253 | 'class' => 'give-select give-select-chosen', |
254 | 254 | 'type' => 'select', |
255 | - 'options' => give_cmb2_get_post_options( array( |
|
255 | + 'options' => give_cmb2_get_post_options(array( |
|
256 | 256 | 'post_type' => 'page', |
257 | 257 | 'numberposts' => 30, |
258 | - ) ), |
|
258 | + )), |
|
259 | 259 | 'attributes' => array( |
260 | 260 | 'data-search-type' => 'pages' |
261 | 261 | ) |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
265 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
264 | + 'name' => __('Failed Donation Page', 'give'), |
|
265 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
266 | 266 | 'class' => 'give-select give-select-chosen', |
267 | 267 | 'id' => 'failure_page', |
268 | 268 | 'type' => 'select', |
269 | - 'options' => give_cmb2_get_post_options( array( |
|
269 | + 'options' => give_cmb2_get_post_options(array( |
|
270 | 270 | 'post_type' => 'page', |
271 | 271 | 'numberposts' => 30, |
272 | - ) ), |
|
272 | + )), |
|
273 | 273 | 'attributes' => array( |
274 | 274 | 'data-search-type' => 'pages' |
275 | 275 | ) |
276 | 276 | ), |
277 | 277 | array( |
278 | - 'name' => __( 'Donation History Page', 'give' ), |
|
278 | + 'name' => __('Donation History Page', 'give'), |
|
279 | 279 | /* translators: %s: [donation_history] */ |
280 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
280 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
281 | 281 | 'id' => 'history_page', |
282 | 282 | 'class' => 'give-select give-select-chosen', |
283 | 283 | 'type' => 'select', |
284 | - 'options' => give_cmb2_get_post_options( array( |
|
284 | + 'options' => give_cmb2_get_post_options(array( |
|
285 | 285 | 'post_type' => 'page', |
286 | 286 | 'numberposts' => 30, |
287 | - ) ), |
|
287 | + )), |
|
288 | 288 | 'attributes' => array( |
289 | 289 | 'data-search-type' => 'pages' |
290 | 290 | ) |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => __( 'Base Country', 'give' ), |
|
294 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
293 | + 'name' => __('Base Country', 'give'), |
|
294 | + 'desc' => __('The country your site operates from.', 'give'), |
|
295 | 295 | 'id' => 'base_country', |
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => give_get_country_list(), |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | * @since 1.8.14 |
308 | 308 | */ |
309 | 309 | array( |
310 | - 'wrapper_class' => ( array_key_exists( $countries, $no_states_country ) ? 'give-hidden' : '' ), |
|
311 | - 'name' => __( 'Base State/Province', 'give' ), |
|
312 | - 'desc' => __( 'The state/province your site operates from.', 'give' ), |
|
310 | + 'wrapper_class' => (array_key_exists($countries, $no_states_country) ? 'give-hidden' : ''), |
|
311 | + 'name' => __('Base State/Province', 'give'), |
|
312 | + 'desc' => __('The state/province your site operates from.', 'give'), |
|
313 | 313 | 'id' => 'base_state', |
314 | - 'type' => ( empty( $states ) ? 'text' : 'select' ), |
|
315 | - 'class' => ( empty( $states ) ? '' : 'give-select give-select-chosen' ), |
|
314 | + 'type' => (empty($states) ? 'text' : 'select'), |
|
315 | + 'class' => (empty($states) ? '' : 'give-select give-select-chosen'), |
|
316 | 316 | 'options' => $states, |
317 | 317 | 'attributes' => array( |
318 | 318 | 'data-search-type' => 'no_ajax', |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | ), |
321 | 321 | ), |
322 | 322 | array( |
323 | - 'name' => __( 'General Options Docs Link', 'give' ), |
|
323 | + 'name' => __('General Options Docs Link', 'give'), |
|
324 | 324 | 'id' => 'general_options_docs_link', |
325 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
326 | - 'title' => __( 'General Options', 'give' ), |
|
325 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
326 | + 'title' => __('General Options', 'give'), |
|
327 | 327 | 'type' => 'give_docs_link', |
328 | 328 | ), |
329 | 329 | array( |
@@ -343,48 +343,48 @@ discard block |
||
343 | 343 | 'type' => 'title' |
344 | 344 | ), |
345 | 345 | array( |
346 | - 'name' => __( 'Sequential Ordering', 'give' ), |
|
346 | + 'name' => __('Sequential Ordering', 'give'), |
|
347 | 347 | 'id' => "{$current_section}_status", |
348 | - 'desc' => __( 'Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give' ), |
|
348 | + 'desc' => __('Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give'), |
|
349 | 349 | 'type' => 'radio_inline', |
350 | 350 | 'default' => 'disabled', |
351 | 351 | 'options' => array( |
352 | - 'enabled' => __( 'Enabled', 'give' ), |
|
353 | - 'disabled' => __( 'Disabled', 'give' ) |
|
352 | + 'enabled' => __('Enabled', 'give'), |
|
353 | + 'disabled' => __('Disabled', 'give') |
|
354 | 354 | ) |
355 | 355 | ), |
356 | 356 | array( |
357 | - 'name' => __( 'Next Donation Number', 'give' ), |
|
357 | + 'name' => __('Next Donation Number', 'give'), |
|
358 | 358 | 'id' => "{$current_section}_number", |
359 | 359 | 'desc' => sprintf( |
360 | - __( 'The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
361 | - '<code>' . Give()->seq_donation_number->get_next_number() . '</code>' |
|
360 | + __('The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give'), |
|
361 | + '<code>'.Give()->seq_donation_number->get_next_number().'</code>' |
|
362 | 362 | ), |
363 | 363 | 'type' => 'number', |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => __( 'Number Prefix', 'give' ), |
|
366 | + 'name' => __('Number Prefix', 'give'), |
|
367 | 367 | 'id' => "{$current_section}_number_prefix", |
368 | 368 | 'desc' => sprintf( |
369 | - __( 'The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
369 | + __('The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
370 | 370 | '<code>-</code>' |
371 | 371 | ), |
372 | 372 | 'type' => 'text', |
373 | 373 | ), |
374 | 374 | array( |
375 | - 'name' => __( 'Number Suffix', 'give' ), |
|
375 | + 'name' => __('Number Suffix', 'give'), |
|
376 | 376 | 'id' => "{$current_section}_number_suffix", |
377 | 377 | 'desc' => sprintf( |
378 | - __( 'The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
378 | + __('The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
379 | 379 | '<code>-</code>' |
380 | 380 | ), |
381 | 381 | 'type' => 'text', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => __( 'Number Padding', 'give' ), |
|
384 | + 'name' => __('Number Padding', 'give'), |
|
385 | 385 | 'id' => "{$current_section}_number_padding", |
386 | 386 | 'desc' => sprintf( |
387 | - __( 'The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give' ), |
|
387 | + __('The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give'), |
|
388 | 388 | '<code>4</code>', |
389 | 389 | '<code>1</code>', |
390 | 390 | '<code>0001</code>' |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | 'default' => '0', |
394 | 394 | ), |
395 | 395 | array( |
396 | - 'name' => __( 'Donation ID Preview', 'give' ), |
|
396 | + 'name' => __('Donation ID Preview', 'give'), |
|
397 | 397 | 'id' => "{$current_section}_preview", |
398 | 398 | 'type' => 'give_sequential_donation_code_preview', |
399 | - 'desc' => __( 'A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give' ), |
|
399 | + 'desc' => __('A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give'), |
|
400 | 400 | ), |
401 | 401 | array( |
402 | - 'name' => __( 'Sequential Ordering Docs Link', 'give' ), |
|
402 | + 'name' => __('Sequential Ordering Docs Link', 'give'), |
|
403 | 403 | 'id' => "{$current_section}_doc link", |
404 | - 'url' => esc_url( 'http://docs.givewp.com/settings-sequential-ordering' ), |
|
405 | - 'title' => __( 'Sequential Ordering', 'give' ), |
|
404 | + 'url' => esc_url('http://docs.givewp.com/settings-sequential-ordering'), |
|
405 | + 'title' => __('Sequential Ordering', 'give'), |
|
406 | 406 | 'type' => 'give_docs_link', |
407 | 407 | ), |
408 | 408 | array( |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * Filter the general settings. |
417 | 417 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
418 | 418 | */ |
419 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
419 | + $settings = apply_filters('give_settings_general', $settings); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Filter the settings. |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @param array $settings |
427 | 427 | */ |
428 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
428 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
429 | 429 | |
430 | 430 | // Output. |
431 | 431 | return $settings; |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function get_sections() { |
441 | 441 | $sections = array( |
442 | - 'general-settings' => __( 'General', 'give' ), |
|
443 | - 'currency-settings' => __( 'Currency', 'give' ), |
|
444 | - 'access-control' => __( 'Access Control', 'give' ), |
|
445 | - 'sequential-ordering' => __( 'Sequential Ordering', 'give' ), |
|
442 | + 'general-settings' => __('General', 'give'), |
|
443 | + 'currency-settings' => __('Currency', 'give'), |
|
444 | + 'access-control' => __('Access Control', 'give'), |
|
445 | + 'sequential-ordering' => __('Sequential Ordering', 'give'), |
|
446 | 446 | ); |
447 | 447 | |
448 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
448 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -461,23 +461,23 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return bool |
463 | 463 | */ |
464 | - public function __give_change_donation_stating_number( $update_options, $option_name, $old_options ) { |
|
465 | - if ( ! isset( $_POST['sequential-ordering_number'] ) ) { |
|
464 | + public function __give_change_donation_stating_number($update_options, $option_name, $old_options) { |
|
465 | + if ( ! isset($_POST['sequential-ordering_number'])) { |
|
466 | 466 | return false; |
467 | 467 | } |
468 | 468 | |
469 | - if ( ( $next_number = Give()->seq_donation_number->get_next_number() ) > $update_options['sequential-ordering_number'] ) { |
|
470 | - give_update_option( 'sequential-ordering_number', $next_number ); |
|
469 | + if (($next_number = Give()->seq_donation_number->get_next_number()) > $update_options['sequential-ordering_number']) { |
|
470 | + give_update_option('sequential-ordering_number', $next_number); |
|
471 | 471 | |
472 | 472 | Give_Admin_Settings::add_error( |
473 | 473 | 'give-invalid-sequential-starting-number', |
474 | 474 | sprintf( |
475 | - __( 'Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
475 | + __('Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give'), |
|
476 | 476 | $next_number |
477 | 477 | ) |
478 | 478 | ); |
479 | - } elseif ( $update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number'] ) { |
|
480 | - update_option( '_give_reset_sequential_number', 1, false ); |
|
479 | + } elseif ($update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number']) { |
|
480 | + update_option('_give_reset_sequential_number', 1, false); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | return true; |
@@ -492,16 +492,16 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param $field |
494 | 494 | */ |
495 | - public function __render_give_sequential_donation_code_preview( $field ) { |
|
495 | + public function __render_give_sequential_donation_code_preview($field) { |
|
496 | 496 | ?> |
497 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
497 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
498 | 498 | <th scope="row" class="titledesc"> |
499 | 499 | <label |
500 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
500 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
501 | 501 | </th> |
502 | 502 | <td class="give-forminp"> |
503 | - <input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled> |
|
504 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
503 | + <input id="<?php echo esc_attr($field['id']); ?>" class="give-input-field" type="text" disabled> |
|
504 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
505 | 505 | </td> |
506 | 506 | </tr> |
507 | 507 | <?php |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | * |
517 | 517 | * @param $field |
518 | 518 | */ |
519 | - public function __render_give_unlock_all_settings( $field ) { |
|
519 | + public function __render_give_unlock_all_settings($field) { |
|
520 | 520 | ?> |
521 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
521 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
522 | 522 | <th scope="row" class="titledesc"> |
523 | 523 | <label |
524 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
524 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
525 | 525 | </th> |
526 | 526 | <td class="give-forminp"> |
527 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
528 | - <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __( 'Unlock all settings', 'give' ); ?></a> |
|
527 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
528 | + <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __('Unlock all settings', 'give'); ?></a> |
|
529 | 529 | </td> |
530 | 530 | </tr> |
531 | 531 | <?php |