@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param array $args An array of form arguments. |
| 23 | 23 | * |
| 24 | - * @return string Donation form. |
|
| 24 | + * @return false|null Donation form. |
|
| 25 | 25 | */ |
| 26 | 26 | function give_get_donation_form( $args = array() ) { |
| 27 | 27 | |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | * |
| 1474 | 1474 | * @param int $form_id The form ID. |
| 1475 | 1475 | * |
| 1476 | - * @return bool |
|
| 1476 | + * @return false|null |
|
| 1477 | 1477 | */ |
| 1478 | 1478 | function give_terms_agreement( $form_id ) { |
| 1479 | 1479 | $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | * @param int $form_id The form ID. |
| 1684 | 1684 | * @param array $args An array of form arguments. |
| 1685 | 1685 | * |
| 1686 | - * @return mixed |
|
| 1686 | + * @return boolean |
|
| 1687 | 1687 | */ |
| 1688 | 1688 | function give_show_goal_progress( $form_id, $args ) { |
| 1689 | 1689 | |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | * |
| 1704 | 1704 | * @since 1.8 |
| 1705 | 1705 | * |
| 1706 | - * @param $form_id |
|
| 1706 | + * @param integer $form_id |
|
| 1707 | 1707 | * @param $args |
| 1708 | 1708 | * |
| 1709 | 1709 | * @return mixed|string |
@@ -1744,7 +1744,7 @@ discard block |
||
| 1744 | 1744 | * @param int $form_id The form ID. |
| 1745 | 1745 | * @param array $args An array of form arguments. |
| 1746 | 1746 | * |
| 1747 | - * @return void|bool |
|
| 1747 | + * @return false|null |
|
| 1748 | 1748 | */ |
| 1749 | 1749 | function give_form_content( $form_id, $args ) { |
| 1750 | 1750 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,50 +23,50 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID. |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 58 | 58 | if ( |
| 59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 60 | - || ( 'trash' === $form->post_status ) |
|
| 59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 60 | + || ('trash' === $form->post_status) |
|
| 61 | 61 | ) { |
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | //Get the form wrap CSS classes. |
| 66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | //Get the <form> tag wrap CSS classes. |
| 69 | - $form_classes = $form->get_form_classes( $args ); |
|
| 69 | + $form_classes = $form->get_form_classes($args); |
|
| 70 | 70 | |
| 71 | 71 | ob_start(); |
| 72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * @param int $form_id The form ID. |
| 79 | 79 | * @param array $args An array of form arguments. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 85 | 85 | |
| 86 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 86 | + <?php if ($form->is_close_donation_form()) { |
|
| 87 | 87 | |
| 88 | 88 | // Get Goal thank you message. |
| 89 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
| 89 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
| 91 | 91 | |
| 92 | 92 | // Print thank you message. |
| 93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
| 93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
| 94 | 94 | |
| 95 | 95 | } else { |
| 96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * 1. if show_title params set to true |
| 99 | 99 | * 2. if admin set form display_style to button |
| 100 | 100 | */ |
| 101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 102 | 102 | if ( |
| 103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
| 104 | - && ! doing_action( 'give_single_form_summary' ) |
|
| 103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
| 104 | + && ! doing_action('give_single_form_summary') |
|
| 105 | 105 | ) { |
| 106 | 106 | echo $form_title; |
| 107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param int $form_id The form ID. |
| 115 | 115 | * @param array $args An array of form arguments. |
| 116 | 116 | */ |
| 117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 117 | + do_action('give_pre_form', $form->ID, $args); |
|
| 118 | 118 | ?> |
| 119 | 119 | |
| 120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 124 | 124 | <input type="hidden" name="give-current-url" |
| 125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 126 | 126 | <input type="hidden" name="give-form-url" |
| 127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 128 | 128 | <input type="hidden" name="give-form-minimum" |
| 129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 130 | 130 | |
| 131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
| 132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | 140 | // Price ID hidden field for variable (mult-level) donation forms. |
| 141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 141 | + if (give_has_variable_prices($form_id)) { |
|
| 142 | 142 | // Get default selected price ID. |
| 143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 144 | 144 | $price_id = 0; |
| 145 | 145 | //loop through prices. |
| 146 | - foreach ( $prices as $price ) { |
|
| 147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 146 | + foreach ($prices as $price) { |
|
| 147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 148 | 148 | $price_id = $price['_give_id']['level_id']; |
| 149 | 149 | }; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param int $form_id The form ID. |
| 161 | 161 | * @param array $args An array of form arguments. |
| 162 | 162 | */ |
| 163 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 163 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Fires while outputing donation form, for payment gatways fields. |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param int $form_id The form ID. |
| 171 | 171 | * @param array $args An array of form arguments. |
| 172 | 172 | */ |
| 173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Fires while outputing donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param int $form_id The form ID. |
| 181 | 181 | * @param array $args An array of form arguments. |
| 182 | 182 | */ |
| 183 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 183 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 184 | 184 | |
| 185 | 185 | ?> |
| 186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | * @param int $form_id The form ID. |
| 195 | 195 | * @param array $args An array of form arguments. |
| 196 | 196 | */ |
| 197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 197 | + do_action('give_post_form', $form->ID, $args); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | 201 | |
| 202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 203 | 203 | <?php |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @param int $form_id The form ID. |
| 211 | 211 | * @param array $args An array of form arguments. |
| 212 | 212 | */ |
| 213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 213 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 214 | 214 | |
| 215 | 215 | $final_output = ob_get_clean(); |
| 216 | 216 | |
| 217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return string |
| 233 | 233 | */ |
| 234 | -function give_show_purchase_form( $form_id ) { |
|
| 234 | +function give_show_purchase_form($form_id) { |
|
| 235 | 235 | |
| 236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 237 | 237 | |
| 238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 239 | 239 | $form_id = $_POST['give_form_id']; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @since 1.7 |
| 246 | 246 | */ |
| 247 | - do_action( 'give_donation_form_top', $form_id ); |
|
| 247 | + do_action('give_donation_form_top', $form_id); |
|
| 248 | 248 | |
| 249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 249 | + if (give_can_checkout() && isset($form_id)) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Fires while displaying donation form, before registration login. |
| 253 | 253 | * |
| 254 | 254 | * @since 1.7 |
| 255 | 255 | */ |
| 256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Fire when register/login form fields render. |
| 260 | 260 | * |
| 261 | 261 | * @since 1.7 |
| 262 | 262 | */ |
| 263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Fire when credit card form fields render. |
| 267 | 267 | * |
| 268 | 268 | * @since 1.7 |
| 269 | 269 | */ |
| 270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 271 | 271 | |
| 272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
| 273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 274 | 274 | /** |
| 275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param int $form_id The form ID. |
| 280 | 280 | */ |
| 281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 282 | 282 | } else { |
| 283 | 283 | /** |
| 284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param int $form_id The form ID. |
| 289 | 289 | */ |
| 290 | - do_action( 'give_cc_form', $form_id ); |
|
| 290 | + do_action('give_cc_form', $form_id); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @since 1.7 |
| 297 | 297 | */ |
| 298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @since 1.7 |
| 305 | 305 | */ |
| 306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 306 | + do_action('give_donation_form_no_access', $form_id); |
|
| 307 | 307 | |
| 308 | 308 | } |
| 309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.7 |
| 314 | 314 | */ |
| 315 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
| 315 | + do_action('give_donation_form_bottom', $form_id); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return void |
| 328 | 328 | */ |
| 329 | -function give_show_register_login_fields( $form_id ) { |
|
| 329 | +function give_show_register_login_fields($form_id) { |
|
| 330 | 330 | |
| 331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 331 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 332 | 332 | |
| 333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 334 | 334 | ?> |
| 335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.7 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 342 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 343 | 343 | ?> |
| 344 | 344 | </div> |
| 345 | 345 | <?php |
| 346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 347 | 347 | ?> |
| 348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @since 1.7 |
| 354 | 354 | */ |
| 355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 355 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 356 | 356 | ?> |
| 357 | 357 | </div> |
| 358 | 358 | <?php |
| 359 | 359 | endif; |
| 360 | 360 | |
| 361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 362 | 362 | /** |
| 363 | 363 | * Fire when user info render. |
| 364 | 364 | * |
| 365 | 365 | * @since 1.7 |
| 366 | 366 | */ |
| 367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 387 | 387 | |
| 388 | 388 | $give_options = give_get_settings(); |
| 389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 390 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 395 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 390 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 395 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
| 402 | 402 | * @param int $form_id The form ID. |
| 403 | 403 | * @param array $args An array of form arguments. |
| 404 | 404 | */ |
| 405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 406 | 406 | |
| 407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
| 408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
| 408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
| 409 | 409 | ?> |
| 410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
| 414 | - <?php if ( $currency_position == 'before' ) { |
|
| 414 | + <?php if ($currency_position == 'before') { |
|
| 415 | 415 | echo $currency_output; |
| 416 | 416 | } ?> |
| 417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 418 | - <?php if ( $currency_position == 'after' ) { |
|
| 418 | + <?php if ($currency_position == 'after') { |
|
| 419 | 419 | echo $currency_output; |
| 420 | 420 | } ?> |
| 421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | ?> |
| 426 | 426 | <div class="give-total-wrap"> |
| 427 | 427 | <div class="give-donation-amount form-row-wide"> |
| 428 | - <?php if ( $currency_position == 'before' ) { |
|
| 428 | + <?php if ($currency_position == 'before') { |
|
| 429 | 429 | echo $currency_output; |
| 430 | 430 | } ?> |
| 431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 434 | - <?php if ( $currency_position == 'after' ) { |
|
| 434 | + <?php if ($currency_position == 'after') { |
|
| 435 | 435 | echo $currency_output; |
| 436 | 436 | } ?> |
| 437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | * @param int $form_id The form ID. |
| 447 | 447 | * @param array $args An array of form arguments. |
| 448 | 448 | */ |
| 449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 450 | 450 | |
| 451 | 451 | //Custom Amount Text |
| 452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
| 452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
| 453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 454 | 454 | <?php } |
| 455 | 455 | |
| 456 | 456 | //Output Variable Pricing Levels. |
| 457 | - if ( $variable_pricing ) { |
|
| 458 | - give_output_levels( $form_id ); |
|
| 457 | + if ($variable_pricing) { |
|
| 458 | + give_output_levels($form_id); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @param int $form_id The form ID. |
| 467 | 467 | * @param array $args An array of form arguments. |
| 468 | 468 | */ |
| 469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 472 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,32 +480,32 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @return string Donation levels. |
| 482 | 482 | */ |
| 483 | -function give_output_levels( $form_id ) { |
|
| 483 | +function give_output_levels($form_id) { |
|
| 484 | 484 | |
| 485 | 485 | //Get variable pricing. |
| 486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 487 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 488 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 489 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 490 | - if ( empty( $custom_amount_text ) ) { |
|
| 491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 487 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 488 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 489 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 490 | + if (empty($custom_amount_text)) { |
|
| 491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $output = ''; |
| 495 | 495 | $counter = 0; |
| 496 | 496 | |
| 497 | - switch ( $display_style ) { |
|
| 497 | + switch ($display_style) { |
|
| 498 | 498 | case 'buttons': |
| 499 | 499 | |
| 500 | 500 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 501 | 501 | |
| 502 | - foreach ( $prices as $price ) { |
|
| 503 | - $counter ++; |
|
| 504 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 505 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 502 | + foreach ($prices as $price) { |
|
| 503 | + $counter++; |
|
| 504 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 505 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 506 | 506 | |
| 507 | 507 | $output .= '<li>'; |
| 508 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 508 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 509 | 509 | $output .= $level_text; |
| 510 | 510 | $output .= '</button>'; |
| 511 | 511 | $output .= '</li>'; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | //Custom Amount. |
| 516 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 516 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 517 | 517 | $output .= '<li>'; |
| 518 | 518 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 519 | 519 | $output .= $custom_amount_text; |
@@ -529,23 +529,23 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 531 | 531 | |
| 532 | - foreach ( $prices as $price ) { |
|
| 533 | - $counter ++; |
|
| 534 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 535 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 532 | + foreach ($prices as $price) { |
|
| 533 | + $counter++; |
|
| 534 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 535 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 536 | 536 | |
| 537 | 537 | $output .= '<li>'; |
| 538 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 539 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 538 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 539 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 540 | 540 | $output .= '</li>'; |
| 541 | 541 | |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | //Custom Amount. |
| 545 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 545 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 546 | 546 | $output .= '<li>'; |
| 547 | 547 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 548 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 548 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 549 | 549 | $output .= '</li>'; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -555,23 +555,23 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | case 'dropdown': |
| 557 | 557 | |
| 558 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 559 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 558 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 559 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 560 | 560 | |
| 561 | 561 | //first loop through prices. |
| 562 | - foreach ( $prices as $price ) { |
|
| 563 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 564 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 562 | + foreach ($prices as $price) { |
|
| 563 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 564 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 565 | 565 | |
| 566 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 566 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 567 | 567 | $output .= $level_text; |
| 568 | 568 | $output .= '</option>'; |
| 569 | 569 | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | //Custom Amount. |
| 573 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 574 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 573 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 574 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | $output .= '</select>'; |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | break; |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 582 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | /** |
@@ -594,27 +594,27 @@ discard block |
||
| 594 | 594 | * |
| 595 | 595 | * @return string Checkout button. |
| 596 | 596 | */ |
| 597 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 597 | +function give_display_checkout_button($form_id, $args) { |
|
| 598 | 598 | |
| 599 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 599 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 600 | 600 | ? $args['display_style'] |
| 601 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 601 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 602 | 602 | |
| 603 | - if ( 'button' === $display_option ) { |
|
| 603 | + if ('button' === $display_option) { |
|
| 604 | 604 | $display_option = 'modal'; |
| 605 | - } elseif ( $display_option === 'onpage' ) { |
|
| 605 | + } elseif ($display_option === 'onpage') { |
|
| 606 | 606 | return ''; |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 610 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 609 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 610 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 611 | 611 | |
| 612 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 612 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 613 | 613 | |
| 614 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 614 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 617 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 618 | 618 | |
| 619 | 619 | /** |
| 620 | 620 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -625,57 +625,57 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | -function give_user_info_fields( $form_id ) { |
|
| 628 | +function give_user_info_fields($form_id) { |
|
| 629 | 629 | // Get user info. |
| 630 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 630 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 631 | 631 | |
| 632 | 632 | /** |
| 633 | 633 | * Fire before user personal information fields |
| 634 | 634 | * |
| 635 | 635 | * @since 1.7 |
| 636 | 636 | */ |
| 637 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 637 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 638 | 638 | ?> |
| 639 | 639 | <fieldset id="give_checkout_user_info"> |
| 640 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 640 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 641 | 641 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
| 642 | 642 | <label class="give-label" for="give-first"> |
| 643 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 644 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 643 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 644 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 645 | 645 | <span class="give-required-indicator">*</span> |
| 646 | 646 | <?php endif ?> |
| 647 | 647 | <span class="give-tooltip give-icon give-icon-question" |
| 648 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 648 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 649 | 649 | </label> |
| 650 | 650 | <input |
| 651 | 651 | class="give-input required" |
| 652 | 652 | type="text" |
| 653 | 653 | name="give_first" |
| 654 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 654 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 655 | 655 | id="give-first" |
| 656 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 656 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 658 | 658 | /> |
| 659 | 659 | </p> |
| 660 | 660 | |
| 661 | 661 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
| 662 | 662 | <label class="give-label" for="give-last"> |
| 663 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 664 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 663 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 664 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 665 | 665 | <span class="give-required-indicator">*</span> |
| 666 | 666 | <?php endif ?> |
| 667 | 667 | <span class="give-tooltip give-icon give-icon-question" |
| 668 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 668 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 669 | 669 | </label> |
| 670 | 670 | |
| 671 | 671 | <input |
| 672 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 672 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 673 | 673 | type="text" |
| 674 | 674 | name="give_last" |
| 675 | 675 | id="give-last" |
| 676 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 677 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 676 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 677 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 679 | 679 | /> |
| 680 | 680 | </p> |
| 681 | 681 | |
@@ -685,26 +685,26 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @since 1.7 |
| 687 | 687 | */ |
| 688 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 688 | + do_action('give_donation_form_before_email', $form_id); |
|
| 689 | 689 | ?> |
| 690 | 690 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 691 | 691 | <label class="give-label" for="give-email"> |
| 692 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 693 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 692 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 693 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 694 | 694 | <span class="give-required-indicator">*</span> |
| 695 | 695 | <?php } ?> |
| 696 | 696 | <span class="give-tooltip give-icon give-icon-question" |
| 697 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 697 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 698 | 698 | </label> |
| 699 | 699 | |
| 700 | 700 | <input |
| 701 | 701 | class="give-input required" |
| 702 | 702 | type="email" |
| 703 | 703 | name="give_email" |
| 704 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 704 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 705 | 705 | id="give-email" |
| 706 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 706 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 708 | 708 | /> |
| 709 | 709 | |
| 710 | 710 | </p> |
@@ -714,14 +714,14 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @since 1.7 |
| 716 | 716 | */ |
| 717 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 717 | + do_action('give_donation_form_after_email', $form_id); |
|
| 718 | 718 | |
| 719 | 719 | /** |
| 720 | 720 | * Fire after personal email field |
| 721 | 721 | * |
| 722 | 722 | * @since 1.7 |
| 723 | 723 | */ |
| 724 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 724 | + do_action('give_donation_form_user_info', $form_id); |
|
| 725 | 725 | ?> |
| 726 | 726 | </fieldset> |
| 727 | 727 | <?php |
@@ -730,11 +730,11 @@ discard block |
||
| 730 | 730 | * |
| 731 | 731 | * @since 1.7 |
| 732 | 732 | */ |
| 733 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 733 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 737 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 736 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 737 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 738 | 738 | |
| 739 | 739 | /** |
| 740 | 740 | * Renders the credit card info form. |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @return void |
| 747 | 747 | */ |
| 748 | -function give_get_cc_form( $form_id ) { |
|
| 748 | +function give_get_cc_form($form_id) { |
|
| 749 | 749 | |
| 750 | 750 | ob_start(); |
| 751 | 751 | |
@@ -756,53 +756,53 @@ discard block |
||
| 756 | 756 | * |
| 757 | 757 | * @param int $form_id The form ID. |
| 758 | 758 | */ |
| 759 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 759 | + do_action('give_before_cc_fields', $form_id); |
|
| 760 | 760 | ?> |
| 761 | 761 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 762 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 763 | - <?php if ( is_ssl() ) : ?> |
|
| 762 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 763 | + <?php if (is_ssl()) : ?> |
|
| 764 | 764 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 765 | 765 | <span class="give-icon padlock"></span> |
| 766 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 766 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 767 | 767 | </div> |
| 768 | 768 | <?php endif; ?> |
| 769 | 769 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 770 | 770 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 771 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 771 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 772 | 772 | <span class="give-required-indicator">*</span> |
| 773 | 773 | <span class="give-tooltip give-icon give-icon-question" |
| 774 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 774 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 775 | 775 | <span class="card-type"></span> |
| 776 | 776 | </label> |
| 777 | 777 | |
| 778 | 778 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 779 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 779 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 780 | 780 | required aria-required="true"/> |
| 781 | 781 | </p> |
| 782 | 782 | |
| 783 | 783 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
| 784 | 784 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 785 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 785 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 786 | 786 | <span class="give-required-indicator">*</span> |
| 787 | 787 | <span class="give-tooltip give-icon give-icon-question" |
| 788 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 788 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 789 | 789 | </label> |
| 790 | 790 | |
| 791 | 791 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 792 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 792 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 793 | 793 | required aria-required="true"/> |
| 794 | 794 | </p> |
| 795 | 795 | |
| 796 | 796 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 797 | 797 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 798 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 798 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 799 | 799 | <span class="give-required-indicator">*</span> |
| 800 | 800 | <span class="give-tooltip give-icon give-icon-question" |
| 801 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 801 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 802 | 802 | </label> |
| 803 | 803 | |
| 804 | 804 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 805 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 805 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 806 | 806 | required aria-required="true"/> |
| 807 | 807 | </p> |
| 808 | 808 | <?php |
@@ -813,14 +813,14 @@ discard block |
||
| 813 | 813 | * |
| 814 | 814 | * @param int $form_id The form ID. |
| 815 | 815 | */ |
| 816 | - do_action( 'give_before_cc_expiration' ); |
|
| 816 | + do_action('give_before_cc_expiration'); |
|
| 817 | 817 | ?> |
| 818 | 818 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
| 819 | 819 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 820 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 820 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 821 | 821 | <span class="give-required-indicator">*</span> |
| 822 | 822 | <span class="give-tooltip give-icon give-icon-question" |
| 823 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 823 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 824 | 824 | </label> |
| 825 | 825 | |
| 826 | 826 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | class="card-expiry-year"/> |
| 830 | 830 | |
| 831 | 831 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 832 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 832 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 833 | 833 | required aria-required="true"/> |
| 834 | 834 | </p> |
| 835 | 835 | <?php |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | * |
| 841 | 841 | * @param int $form_id The form ID. |
| 842 | 842 | */ |
| 843 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 843 | + do_action('give_after_cc_expiration', $form_id); |
|
| 844 | 844 | ?> |
| 845 | 845 | </fieldset> |
| 846 | 846 | <?php |
@@ -851,12 +851,12 @@ discard block |
||
| 851 | 851 | * |
| 852 | 852 | * @param int $form_id The form ID. |
| 853 | 853 | */ |
| 854 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 854 | + do_action('give_after_cc_fields', $form_id); |
|
| 855 | 855 | |
| 856 | 856 | echo ob_get_clean(); |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 859 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * Outputs the default credit card address fields. |
@@ -867,24 +867,24 @@ discard block |
||
| 867 | 867 | * |
| 868 | 868 | * @return void |
| 869 | 869 | */ |
| 870 | -function give_default_cc_address_fields( $form_id ) { |
|
| 870 | +function give_default_cc_address_fields($form_id) { |
|
| 871 | 871 | // Get user info. |
| 872 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 872 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 873 | 873 | |
| 874 | 874 | $logged_in = is_user_logged_in(); |
| 875 | 875 | |
| 876 | - if ( $logged_in ) { |
|
| 877 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 876 | + if ($logged_in) { |
|
| 877 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 878 | 878 | } |
| 879 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 880 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 881 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 882 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 879 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 880 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 881 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 882 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 883 | 883 | |
| 884 | 884 | ob_start(); |
| 885 | 885 | ?> |
| 886 | 886 | <fieldset id="give_cc_address" class="cc-address"> |
| 887 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 887 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 888 | 888 | <?php |
| 889 | 889 | /** |
| 890 | 890 | * Fires while rendering credit card billing form, before address fields. |
@@ -893,79 +893,79 @@ discard block |
||
| 893 | 893 | * |
| 894 | 894 | * @param int $form_id The form ID. |
| 895 | 895 | */ |
| 896 | - do_action( 'give_cc_billing_top' ); |
|
| 896 | + do_action('give_cc_billing_top'); |
|
| 897 | 897 | ?> |
| 898 | 898 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
| 899 | 899 | <label for="card_address" class="give-label"> |
| 900 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 900 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 901 | 901 | <?php |
| 902 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 902 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 903 | 903 | <span class="give-required-indicator">*</span> |
| 904 | 904 | <?php endif; ?> |
| 905 | 905 | <span class="give-tooltip give-icon give-icon-question" |
| 906 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 906 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 907 | 907 | </label> |
| 908 | 908 | |
| 909 | 909 | <input |
| 910 | 910 | type="text" |
| 911 | 911 | id="card_address" |
| 912 | 912 | name="card_address" |
| 913 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 914 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 915 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 913 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 914 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 915 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 917 | 917 | /> |
| 918 | 918 | </p> |
| 919 | 919 | |
| 920 | 920 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
| 921 | 921 | <label for="card_address_2" class="give-label"> |
| 922 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 923 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 922 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 923 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 924 | 924 | <span class="give-required-indicator">*</span> |
| 925 | 925 | <?php endif; ?> |
| 926 | 926 | <span class="give-tooltip give-icon give-icon-question" |
| 927 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 927 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 928 | 928 | </label> |
| 929 | 929 | |
| 930 | 930 | <input |
| 931 | 931 | type="text" |
| 932 | 932 | id="card_address_2" |
| 933 | 933 | name="card_address_2" |
| 934 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 935 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 936 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 934 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 935 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 936 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 938 | 938 | /> |
| 939 | 939 | </p> |
| 940 | 940 | |
| 941 | 941 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
| 942 | 942 | <label for="card_city" class="give-label"> |
| 943 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 944 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 943 | + <?php esc_html_e('City', 'give'); ?> |
|
| 944 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 945 | 945 | <span class="give-required-indicator">*</span> |
| 946 | 946 | <?php endif; ?> |
| 947 | 947 | <span class="give-tooltip give-icon give-icon-question" |
| 948 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 948 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 949 | 949 | </label> |
| 950 | 950 | <input |
| 951 | 951 | type="text" |
| 952 | 952 | id="card_city" |
| 953 | 953 | name="card_city" |
| 954 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 955 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 956 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 954 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 955 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 956 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 958 | 958 | /> |
| 959 | 959 | </p> |
| 960 | 960 | |
| 961 | 961 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 962 | 962 | <label for="card_zip" class="give-label"> |
| 963 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 964 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 963 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 964 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 965 | 965 | <span class="give-required-indicator">*</span> |
| 966 | 966 | <?php endif; ?> |
| 967 | 967 | <span class="give-tooltip give-icon give-icon-question" |
| 968 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 968 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 969 | 969 | </label> |
| 970 | 970 | |
| 971 | 971 | <input |
@@ -973,40 +973,40 @@ discard block |
||
| 973 | 973 | size="4" |
| 974 | 974 | id="card_zip" |
| 975 | 975 | name="card_zip" |
| 976 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 977 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 978 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 976 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 977 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 978 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 980 | 980 | /> |
| 981 | 981 | </p> |
| 982 | 982 | |
| 983 | 983 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
| 984 | 984 | <label for="billing_country" class="give-label"> |
| 985 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 986 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 985 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 986 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 987 | 987 | <span class="give-required-indicator">*</span> |
| 988 | 988 | <?php endif; ?> |
| 989 | 989 | <span class="give-tooltip give-icon give-icon-question" |
| 990 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 990 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 991 | 991 | </label> |
| 992 | 992 | |
| 993 | 993 | <select |
| 994 | 994 | name="billing_country" |
| 995 | 995 | id="billing_country" |
| 996 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 997 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 996 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 997 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 998 | 998 | > |
| 999 | 999 | <?php |
| 1000 | 1000 | |
| 1001 | 1001 | $selected_country = give_get_country(); |
| 1002 | 1002 | |
| 1003 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1003 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1004 | 1004 | $selected_country = $give_user_info['billing_country']; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $countries = give_get_country_list(); |
| 1008 | - foreach ( $countries as $country_code => $country ) { |
|
| 1009 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1008 | + foreach ($countries as $country_code => $country) { |
|
| 1009 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | ?> |
| 1012 | 1012 | </select> |
@@ -1014,37 +1014,37 @@ discard block |
||
| 1014 | 1014 | |
| 1015 | 1015 | <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive"> |
| 1016 | 1016 | <label for="card_state" class="give-label"> |
| 1017 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 1018 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
| 1017 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 1018 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
| 1019 | 1019 | <span class="give-required-indicator">*</span> |
| 1020 | 1020 | <?php endif; ?> |
| 1021 | 1021 | <span class="give-tooltip give-icon give-icon-question" |
| 1022 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 1022 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 1023 | 1023 | </label> |
| 1024 | 1024 | |
| 1025 | 1025 | <?php |
| 1026 | 1026 | $selected_state = give_get_state(); |
| 1027 | - $states = give_get_states( $selected_country ); |
|
| 1027 | + $states = give_get_states($selected_country); |
|
| 1028 | 1028 | |
| 1029 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1029 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1030 | 1030 | $selected_state = $give_user_info['card_state']; |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | - if ( ! empty( $states ) ) : ?> |
|
| 1033 | + if ( ! empty($states)) : ?> |
|
| 1034 | 1034 | <select |
| 1035 | 1035 | name="card_state" |
| 1036 | 1036 | id="card_state" |
| 1037 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1038 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
| 1037 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1038 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
| 1039 | 1039 | <?php |
| 1040 | - foreach ( $states as $state_code => $state ) { |
|
| 1041 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1040 | + foreach ($states as $state_code => $state) { |
|
| 1041 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | ?> |
| 1044 | 1044 | </select> |
| 1045 | 1045 | <?php else : ?> |
| 1046 | 1046 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1047 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1047 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 1048 | 1048 | <?php endif; ?> |
| 1049 | 1049 | </p> |
| 1050 | 1050 | <?php |
@@ -1055,14 +1055,14 @@ discard block |
||
| 1055 | 1055 | * |
| 1056 | 1056 | * @param int $form_id The form ID. |
| 1057 | 1057 | */ |
| 1058 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1058 | + do_action('give_cc_billing_bottom'); |
|
| 1059 | 1059 | ?> |
| 1060 | 1060 | </fieldset> |
| 1061 | 1061 | <?php |
| 1062 | 1062 | echo ob_get_clean(); |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1065 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1066 | 1066 | |
| 1067 | 1067 | |
| 1068 | 1068 | /** |
@@ -1075,24 +1075,24 @@ discard block |
||
| 1075 | 1075 | * |
| 1076 | 1076 | * @return string |
| 1077 | 1077 | */ |
| 1078 | -function give_get_register_fields( $form_id ) { |
|
| 1078 | +function give_get_register_fields($form_id) { |
|
| 1079 | 1079 | |
| 1080 | 1080 | global $user_ID; |
| 1081 | 1081 | |
| 1082 | - if ( is_user_logged_in() ) { |
|
| 1083 | - $user_data = get_userdata( $user_ID ); |
|
| 1082 | + if (is_user_logged_in()) { |
|
| 1083 | + $user_data = get_userdata($user_ID); |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1086 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1087 | 1087 | |
| 1088 | 1088 | ob_start(); ?> |
| 1089 | 1089 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1090 | 1090 | |
| 1091 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1091 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1092 | 1092 | <div class="give-login-account-wrap"> |
| 1093 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1094 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1095 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1093 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1094 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1095 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1096 | 1096 | </p> |
| 1097 | 1097 | <p class="give-loading-text"> |
| 1098 | 1098 | <span class="give-loading-animation"></span> |
@@ -1108,15 +1108,15 @@ discard block |
||
| 1108 | 1108 | * |
| 1109 | 1109 | * @param int $form_id The form ID. |
| 1110 | 1110 | */ |
| 1111 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1111 | + do_action('give_register_fields_before', $form_id); |
|
| 1112 | 1112 | ?> |
| 1113 | 1113 | |
| 1114 | 1114 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1115 | 1115 | <legend> |
| 1116 | 1116 | <?php |
| 1117 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1118 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1119 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1117 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1118 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1119 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | ?> |
| 1122 | 1122 | </legend> |
@@ -1128,54 +1128,54 @@ discard block |
||
| 1128 | 1128 | * |
| 1129 | 1129 | * @param int $form_id The form ID. |
| 1130 | 1130 | */ |
| 1131 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1131 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1132 | 1132 | ?> |
| 1133 | 1133 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
| 1134 | 1134 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
| 1135 | 1135 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1136 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1137 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1136 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1137 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1138 | 1138 | <span class="give-required-indicator">*</span> |
| 1139 | 1139 | <?php } ?> |
| 1140 | 1140 | <span class="give-tooltip give-icon give-icon-question" |
| 1141 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1141 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1142 | 1142 | </label> |
| 1143 | 1143 | |
| 1144 | 1144 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1145 | 1145 | type="text" |
| 1146 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1146 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1147 | 1147 | </div> |
| 1148 | 1148 | |
| 1149 | 1149 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1150 | 1150 | class="form-row form-row-one-third form-row-responsive"> |
| 1151 | 1151 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1152 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1153 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1152 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1153 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1154 | 1154 | <span class="give-required-indicator">*</span> |
| 1155 | 1155 | <?php } ?> |
| 1156 | 1156 | <span class="give-tooltip give-icon give-icon-question" |
| 1157 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1157 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1158 | 1158 | </label> |
| 1159 | 1159 | |
| 1160 | 1160 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1161 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1162 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1161 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1162 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1163 | 1163 | </div> |
| 1164 | 1164 | |
| 1165 | 1165 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1166 | 1166 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
| 1167 | 1167 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1168 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1169 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1168 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1169 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1170 | 1170 | <span class="give-required-indicator">*</span> |
| 1171 | 1171 | <?php } ?> |
| 1172 | 1172 | <span class="give-tooltip give-icon give-icon-question" |
| 1173 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1173 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1174 | 1174 | </label> |
| 1175 | 1175 | |
| 1176 | 1176 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1177 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1178 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1177 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1178 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1179 | 1179 | </div> |
| 1180 | 1180 | <?php |
| 1181 | 1181 | /** |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | * |
| 1186 | 1186 | * @param int $form_id The form ID. |
| 1187 | 1187 | */ |
| 1188 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1188 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1189 | 1189 | ?> |
| 1190 | 1190 | </fieldset> |
| 1191 | 1191 | |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | * |
| 1198 | 1198 | * @param int $form_id The form ID. |
| 1199 | 1199 | */ |
| 1200 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1200 | + do_action('give_register_fields_after', $form_id); |
|
| 1201 | 1201 | ?> |
| 1202 | 1202 | |
| 1203 | 1203 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | * |
| 1209 | 1209 | * @since 1.7 |
| 1210 | 1210 | */ |
| 1211 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1211 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1212 | 1212 | ?> |
| 1213 | 1213 | |
| 1214 | 1214 | </fieldset> |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | echo ob_get_clean(); |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1219 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1220 | 1220 | |
| 1221 | 1221 | /** |
| 1222 | 1222 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1229,27 +1229,27 @@ discard block |
||
| 1229 | 1229 | * |
| 1230 | 1230 | * @return string |
| 1231 | 1231 | */ |
| 1232 | -function give_get_login_fields( $form_id ) { |
|
| 1232 | +function give_get_login_fields($form_id) { |
|
| 1233 | 1233 | |
| 1234 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1235 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1234 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1235 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1236 | 1236 | |
| 1237 | 1237 | ob_start(); |
| 1238 | 1238 | ?> |
| 1239 | 1239 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1240 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1241 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1242 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1240 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1241 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1242 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1243 | 1243 | } ?> |
| 1244 | 1244 | </legend> |
| 1245 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1245 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1246 | 1246 | <p class="give-new-account-link"> |
| 1247 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1248 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1247 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1248 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1249 | 1249 | data-action="give_checkout_register"> |
| 1250 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1251 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1252 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 1250 | + <?php esc_html_e('Register', 'give'); |
|
| 1251 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1252 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 1253 | 1253 | } ?> |
| 1254 | 1254 | </a> |
| 1255 | 1255 | </p> |
@@ -1265,49 +1265,49 @@ discard block |
||
| 1265 | 1265 | * |
| 1266 | 1266 | * @param int $form_id The form ID. |
| 1267 | 1267 | */ |
| 1268 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1268 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1269 | 1269 | ?> |
| 1270 | 1270 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
| 1271 | 1271 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1272 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1273 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1272 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1273 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1274 | 1274 | <span class="give-required-indicator">*</span> |
| 1275 | 1275 | <?php } ?> |
| 1276 | 1276 | </label> |
| 1277 | 1277 | |
| 1278 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1278 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1279 | 1279 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1280 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1280 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1281 | 1281 | </div> |
| 1282 | 1282 | |
| 1283 | 1283 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1284 | 1284 | class="give_login_password form-row form-row-last form-row-responsive"> |
| 1285 | 1285 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1286 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1287 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1286 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1287 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1288 | 1288 | <span class="give-required-indicator">*</span> |
| 1289 | 1289 | <?php } ?> |
| 1290 | 1290 | </label> |
| 1291 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1291 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1292 | 1292 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1293 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1293 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1294 | 1294 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1295 | 1295 | </div> |
| 1296 | 1296 | |
| 1297 | 1297 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1298 | 1298 | <span class="give-forgot-password "> |
| 1299 | 1299 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1300 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1300 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1301 | 1301 | </span> |
| 1302 | 1302 | </div> |
| 1303 | 1303 | |
| 1304 | 1304 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1305 | 1305 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1306 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1307 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1306 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1307 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1308 | 1308 | <input type="button" data-action="give_cancel_login" |
| 1309 | 1309 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1310 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1310 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1311 | 1311 | <?php } ?> |
| 1312 | 1312 | <span class="give-loading-animation"></span> |
| 1313 | 1313 | </div> |
@@ -1319,14 +1319,14 @@ discard block |
||
| 1319 | 1319 | * |
| 1320 | 1320 | * @param int $form_id The form ID. |
| 1321 | 1321 | */ |
| 1322 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1322 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1323 | 1323 | ?> |
| 1324 | 1324 | </fieldset><!--end #give-login-fields--> |
| 1325 | 1325 | <?php |
| 1326 | 1326 | echo ob_get_clean(); |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1329 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1330 | 1330 | |
| 1331 | 1331 | /** |
| 1332 | 1332 | * Payment Mode Select. |
@@ -1342,9 +1342,9 @@ discard block |
||
| 1342 | 1342 | * |
| 1343 | 1343 | * @return void |
| 1344 | 1344 | */ |
| 1345 | -function give_payment_mode_select( $form_id ) { |
|
| 1345 | +function give_payment_mode_select($form_id) { |
|
| 1346 | 1346 | |
| 1347 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
| 1347 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
| 1348 | 1348 | |
| 1349 | 1349 | /** |
| 1350 | 1350 | * Fires while selecting payment gateways, before the fields. |
@@ -1353,10 +1353,10 @@ discard block |
||
| 1353 | 1353 | * |
| 1354 | 1354 | * @param int $form_id The form ID. |
| 1355 | 1355 | */ |
| 1356 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1356 | + do_action('give_payment_mode_top', $form_id); |
|
| 1357 | 1357 | ?> |
| 1358 | 1358 | |
| 1359 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1359 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1360 | 1360 | echo 'style="display: none;"'; |
| 1361 | 1361 | } ?>> |
| 1362 | 1362 | <?php |
@@ -1367,10 +1367,10 @@ discard block |
||
| 1367 | 1367 | * |
| 1368 | 1368 | * @param int $form_id The form ID. |
| 1369 | 1369 | */ |
| 1370 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1370 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1371 | 1371 | ?> |
| 1372 | 1372 | <legend |
| 1373 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1373 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1374 | 1374 | <span class="give-loading-text"><span |
| 1375 | 1375 | class="give-loading-animation"></span> |
| 1376 | 1376 | </span> |
@@ -1383,26 +1383,26 @@ discard block |
||
| 1383 | 1383 | * |
| 1384 | 1384 | * @since 1.7 |
| 1385 | 1385 | */ |
| 1386 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1386 | + do_action('give_payment_mode_before_gateways') |
|
| 1387 | 1387 | ?> |
| 1388 | 1388 | <ul id="give-gateway-radio-list"> |
| 1389 | 1389 | <?php |
| 1390 | 1390 | /** |
| 1391 | 1391 | * Loop through the active payment gateways. |
| 1392 | 1392 | */ |
| 1393 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1393 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1394 | 1394 | |
| 1395 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1395 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1396 | 1396 | //Determine the default gateway. |
| 1397 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1397 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1398 | 1398 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
| 1399 | 1399 | <li<?php echo $checked_class ?>> |
| 1400 | 1400 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1401 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1402 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1403 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1401 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1402 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1403 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1404 | 1404 | class="give-gateway-option" |
| 1405 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1405 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1406 | 1406 | </li> |
| 1407 | 1407 | <?php |
| 1408 | 1408 | endforeach; |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 1.7 |
| 1416 | 1416 | */ |
| 1417 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1417 | + do_action('give_payment_mode_after_gateways'); |
|
| 1418 | 1418 | ?> |
| 1419 | 1419 | </div> |
| 1420 | 1420 | <?php |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | * |
| 1426 | 1426 | * @param int $form_id The form ID. |
| 1427 | 1427 | */ |
| 1428 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1428 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1429 | 1429 | ?> |
| 1430 | 1430 | </fieldset> |
| 1431 | 1431 | |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | * |
| 1438 | 1438 | * @param int $form_id The form ID. |
| 1439 | 1439 | */ |
| 1440 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1440 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1441 | 1441 | ?> |
| 1442 | 1442 | |
| 1443 | 1443 | <div id="give_purchase_form_wrap"> |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | * |
| 1449 | 1449 | * @since 1.7 |
| 1450 | 1450 | */ |
| 1451 | - do_action( 'give_donation_form', $form_id ); |
|
| 1451 | + do_action('give_donation_form', $form_id); |
|
| 1452 | 1452 | ?> |
| 1453 | 1453 | |
| 1454 | 1454 | </div> |
@@ -1459,10 +1459,10 @@ discard block |
||
| 1459 | 1459 | * |
| 1460 | 1460 | * @since 1.7 |
| 1461 | 1461 | */ |
| 1462 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1462 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1465 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1466 | 1466 | |
| 1467 | 1467 | /** |
| 1468 | 1468 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1475,31 +1475,31 @@ discard block |
||
| 1475 | 1475 | * |
| 1476 | 1476 | * @return bool |
| 1477 | 1477 | */ |
| 1478 | -function give_terms_agreement( $form_id ) { |
|
| 1479 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1478 | +function give_terms_agreement($form_id) { |
|
| 1479 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1480 | 1480 | |
| 1481 | 1481 | // Bailout if per form and global term and conditions is not setup. |
| 1482 | 1482 | if ( |
| 1483 | - give_is_setting_enabled( $form_option, 'global' ) |
|
| 1484 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
| 1483 | + give_is_setting_enabled($form_option, 'global') |
|
| 1484 | + && give_is_setting_enabled(give_get_option('terms')) |
|
| 1485 | 1485 | ) { |
| 1486 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1487 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
| 1488 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
| 1486 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1487 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
| 1488 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
| 1489 | 1489 | |
| 1490 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
| 1491 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
| 1492 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1493 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
| 1490 | + } elseif (give_is_setting_enabled($form_option)) { |
|
| 1491 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
| 1492 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1493 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
| 1494 | 1494 | |
| 1495 | 1495 | } else { |
| 1496 | 1496 | return false; |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | // Bailout: Check if term and conditions text is empty or not. |
| 1500 | - if ( empty( $terms ) ) { |
|
| 1501 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
| 1502 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
| 1500 | + if (empty($terms)) { |
|
| 1501 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
| 1502 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | return false; |
@@ -1507,7 +1507,7 @@ discard block |
||
| 1507 | 1507 | |
| 1508 | 1508 | ?> |
| 1509 | 1509 | <fieldset id="give_terms_agreement"> |
| 1510 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1510 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1511 | 1511 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1512 | 1512 | <?php |
| 1513 | 1513 | /** |
@@ -1515,22 +1515,22 @@ discard block |
||
| 1515 | 1515 | * |
| 1516 | 1516 | * @since 1.0 |
| 1517 | 1517 | */ |
| 1518 | - do_action( 'give_before_terms' ); |
|
| 1518 | + do_action('give_before_terms'); |
|
| 1519 | 1519 | |
| 1520 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1520 | + echo wpautop(stripslashes($terms)); |
|
| 1521 | 1521 | /** |
| 1522 | 1522 | * Fires while rendering terms of agreement, after the fields. |
| 1523 | 1523 | * |
| 1524 | 1524 | * @since 1.0 |
| 1525 | 1525 | */ |
| 1526 | - do_action( 'give_after_terms' ); |
|
| 1526 | + do_action('give_after_terms'); |
|
| 1527 | 1527 | ?> |
| 1528 | 1528 | </div> |
| 1529 | 1529 | <div id="give_show_terms"> |
| 1530 | 1530 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1531 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1531 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1532 | 1532 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1533 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1533 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1534 | 1534 | </div> |
| 1535 | 1535 | |
| 1536 | 1536 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | <?php |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1544 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1545 | 1545 | |
| 1546 | 1546 | /** |
| 1547 | 1547 | * Checkout Final Total. |
@@ -1554,29 +1554,29 @@ discard block |
||
| 1554 | 1554 | * |
| 1555 | 1555 | * @return void |
| 1556 | 1556 | */ |
| 1557 | -function give_checkout_final_total( $form_id ) { |
|
| 1557 | +function give_checkout_final_total($form_id) { |
|
| 1558 | 1558 | |
| 1559 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1560 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1559 | + if (isset($_POST['give_total'])) { |
|
| 1560 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1561 | 1561 | } else { |
| 1562 | 1562 | //default total. |
| 1563 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1563 | + $total = give_get_default_form_amount($form_id); |
|
| 1564 | 1564 | } |
| 1565 | 1565 | //Only proceed if give_total available. |
| 1566 | - if ( empty( $total ) ) { |
|
| 1566 | + if (empty($total)) { |
|
| 1567 | 1567 | return; |
| 1568 | 1568 | } |
| 1569 | 1569 | ?> |
| 1570 | 1570 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1571 | 1571 | <span |
| 1572 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1572 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1573 | 1573 | <span class="give-final-total-amount" |
| 1574 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1574 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1575 | 1575 | </p> |
| 1576 | 1576 | <?php |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1579 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1580 | 1580 | |
| 1581 | 1581 | /** |
| 1582 | 1582 | * Renders the Checkout Submit section. |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | * |
| 1588 | 1588 | * @return void |
| 1589 | 1589 | */ |
| 1590 | -function give_checkout_submit( $form_id ) { |
|
| 1590 | +function give_checkout_submit($form_id) { |
|
| 1591 | 1591 | ?> |
| 1592 | 1592 | <fieldset id="give_purchase_submit"> |
| 1593 | 1593 | <?php |
@@ -1596,24 +1596,24 @@ discard block |
||
| 1596 | 1596 | * |
| 1597 | 1597 | * @since 1.7 |
| 1598 | 1598 | */ |
| 1599 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1599 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1600 | 1600 | |
| 1601 | - give_checkout_hidden_fields( $form_id ); |
|
| 1601 | + give_checkout_hidden_fields($form_id); |
|
| 1602 | 1602 | |
| 1603 | - echo give_checkout_button_purchase( $form_id ); |
|
| 1603 | + echo give_checkout_button_purchase($form_id); |
|
| 1604 | 1604 | |
| 1605 | 1605 | /** |
| 1606 | 1606 | * Fire after donation form submit. |
| 1607 | 1607 | * |
| 1608 | 1608 | * @since 1.7 |
| 1609 | 1609 | */ |
| 1610 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1610 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1611 | 1611 | ?> |
| 1612 | 1612 | </fieldset> |
| 1613 | 1613 | <?php |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1616 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1617 | 1617 | |
| 1618 | 1618 | /** |
| 1619 | 1619 | * Give Checkout Button. |
@@ -1626,10 +1626,10 @@ discard block |
||
| 1626 | 1626 | * |
| 1627 | 1627 | * @return string |
| 1628 | 1628 | */ |
| 1629 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1629 | +function give_checkout_button_purchase($form_id) { |
|
| 1630 | 1630 | |
| 1631 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1632 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1631 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1632 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1633 | 1633 | ob_start(); ?> |
| 1634 | 1634 | <div class="give-submit-button-wrap give-clearfix"> |
| 1635 | 1635 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1637,7 +1637,7 @@ discard block |
||
| 1637 | 1637 | <span class="give-loading-animation"></span> |
| 1638 | 1638 | </div> |
| 1639 | 1639 | <?php |
| 1640 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1640 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | /** |
@@ -1651,18 +1651,18 @@ discard block |
||
| 1651 | 1651 | * |
| 1652 | 1652 | * @return void |
| 1653 | 1653 | */ |
| 1654 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1654 | +function give_agree_to_terms_js($form_id) { |
|
| 1655 | 1655 | |
| 1656 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1656 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1657 | 1657 | |
| 1658 | - if ( give_is_setting_enabled( $form_option, array( 'enabled', 'global' ) ) ) { |
|
| 1658 | + if (give_is_setting_enabled($form_option, array('enabled', 'global'))) { |
|
| 1659 | 1659 | ?> |
| 1660 | 1660 | <script type="text/javascript"> |
| 1661 | 1661 | jQuery(document).ready(function ($) { |
| 1662 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1662 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1663 | 1663 | e.preventDefault(); |
| 1664 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1665 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1664 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1665 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1666 | 1666 | return false; |
| 1667 | 1667 | }); |
| 1668 | 1668 | }); |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | } |
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1674 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1675 | 1675 | |
| 1676 | 1676 | /** |
| 1677 | 1677 | * Show Give Goals. |
@@ -1685,17 +1685,17 @@ discard block |
||
| 1685 | 1685 | * |
| 1686 | 1686 | * @return mixed |
| 1687 | 1687 | */ |
| 1688 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1688 | +function give_show_goal_progress($form_id, $args) { |
|
| 1689 | 1689 | |
| 1690 | 1690 | ob_start(); |
| 1691 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1691 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1692 | 1692 | |
| 1693 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1693 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1694 | 1694 | |
| 1695 | 1695 | return true; |
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1698 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1699 | 1699 | |
| 1700 | 1700 | |
| 1701 | 1701 | /** |
@@ -1708,10 +1708,10 @@ discard block |
||
| 1708 | 1708 | * |
| 1709 | 1709 | * @return mixed|string |
| 1710 | 1710 | */ |
| 1711 | -function give_get_form_content_placement( $form_id, $args ) { |
|
| 1711 | +function give_get_form_content_placement($form_id, $args) { |
|
| 1712 | 1712 | $show_content = ''; |
| 1713 | 1713 | |
| 1714 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
| 1714 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
| 1715 | 1715 | // Content positions. |
| 1716 | 1716 | $content_placement = array( |
| 1717 | 1717 | 'above' => 'give_pre_form', |
@@ -1719,18 +1719,18 @@ discard block |
||
| 1719 | 1719 | ); |
| 1720 | 1720 | |
| 1721 | 1721 | // Check if content position already decoded. |
| 1722 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
| 1722 | + if (in_array($args['show_content'], $content_placement)) { |
|
| 1723 | 1723 | return $args['show_content']; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
| 1726 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
| 1727 | 1727 | |
| 1728 | - } elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) { |
|
| 1729 | - $show_content = get_post_meta( $form_id, '_give_content_placement', true ); |
|
| 1728 | + } elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) { |
|
| 1729 | + $show_content = get_post_meta($form_id, '_give_content_placement', true); |
|
| 1730 | 1730 | |
| 1731 | - } elseif ( 'none' !== get_post_meta( $form_id, '_give_content_option', true ) ) { |
|
| 1731 | + } elseif ('none' !== get_post_meta($form_id, '_give_content_option', true)) { |
|
| 1732 | 1732 | // Backward compatibility for _give_content_option for v18. |
| 1733 | - $show_content = get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1733 | + $show_content = get_post_meta($form_id, '_give_content_option', true); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | 1736 | return $show_content; |
@@ -1746,20 +1746,20 @@ discard block |
||
| 1746 | 1746 | * |
| 1747 | 1747 | * @return void|bool |
| 1748 | 1748 | */ |
| 1749 | -function give_form_content( $form_id, $args ) { |
|
| 1749 | +function give_form_content($form_id, $args) { |
|
| 1750 | 1750 | |
| 1751 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1751 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1752 | 1752 | |
| 1753 | 1753 | // Bailout. |
| 1754 | - if ( empty( $show_content ) ) { |
|
| 1754 | + if (empty($show_content)) { |
|
| 1755 | 1755 | return false; |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | 1758 | // Add action according to value. |
| 1759 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1759 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1762 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1763 | 1763 | |
| 1764 | 1764 | /** |
| 1765 | 1765 | * Renders Post Form Content. |
@@ -1773,22 +1773,22 @@ discard block |
||
| 1773 | 1773 | * |
| 1774 | 1774 | * @return void |
| 1775 | 1775 | */ |
| 1776 | -function give_form_display_content( $form_id, $args ) { |
|
| 1776 | +function give_form_display_content($form_id, $args) { |
|
| 1777 | 1777 | |
| 1778 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1779 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1778 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1779 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1780 | 1780 | |
| 1781 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
| 1782 | - $content = apply_filters( 'the_content', $content ); |
|
| 1781 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
| 1782 | + $content = apply_filters('the_content', $content); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
| 1785 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
| 1786 | 1786 | |
| 1787 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1787 | + echo apply_filters('give_form_content_output', $output); |
|
| 1788 | 1788 | |
| 1789 | 1789 | //remove action to prevent content output on addition forms on page. |
| 1790 | 1790 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1791 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1791 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | /** |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | * |
| 1801 | 1801 | * @return void |
| 1802 | 1802 | */ |
| 1803 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1803 | +function give_checkout_hidden_fields($form_id) { |
|
| 1804 | 1804 | |
| 1805 | 1805 | /** |
| 1806 | 1806 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1809,13 +1809,13 @@ discard block |
||
| 1809 | 1809 | * |
| 1810 | 1810 | * @param int $form_id The form ID. |
| 1811 | 1811 | */ |
| 1812 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1812 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1813 | 1813 | |
| 1814 | - if ( is_user_logged_in() ) { ?> |
|
| 1814 | + if (is_user_logged_in()) { ?> |
|
| 1815 | 1815 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1816 | 1816 | <?php } ?> |
| 1817 | 1817 | <input type="hidden" name="give_action" value="purchase"/> |
| 1818 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1818 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1819 | 1819 | <?php |
| 1820 | 1820 | /** |
| 1821 | 1821 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1824,7 +1824,7 @@ discard block |
||
| 1824 | 1824 | * |
| 1825 | 1825 | * @param int $form_id The form ID. |
| 1826 | 1826 | */ |
| 1827 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1827 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1828 | 1828 | |
| 1829 | 1829 | } |
| 1830 | 1830 | |
@@ -1839,20 +1839,20 @@ discard block |
||
| 1839 | 1839 | * |
| 1840 | 1840 | * @return string $content Filtered content. |
| 1841 | 1841 | */ |
| 1842 | -function give_filter_success_page_content( $content ) { |
|
| 1842 | +function give_filter_success_page_content($content) { |
|
| 1843 | 1843 | |
| 1844 | 1844 | $give_options = give_get_settings(); |
| 1845 | 1845 | |
| 1846 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1847 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1848 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1846 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1847 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1848 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1849 | 1849 | } |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | 1852 | return $content; |
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1855 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1856 | 1856 | |
| 1857 | 1857 | /** |
| 1858 | 1858 | * Test Mode Frontend Warning. |
@@ -1863,12 +1863,12 @@ discard block |
||
| 1863 | 1863 | */ |
| 1864 | 1864 | function give_test_mode_frontend_warning() { |
| 1865 | 1865 | |
| 1866 | - if ( give_is_test_mode() ) { |
|
| 1867 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 1866 | + if (give_is_test_mode()) { |
|
| 1867 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 1868 | 1868 | } |
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1871 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1872 | 1872 | |
| 1873 | 1873 | /** |
| 1874 | 1874 | * Members-only Form. |
@@ -1882,21 +1882,21 @@ discard block |
||
| 1882 | 1882 | * |
| 1883 | 1883 | * @return string |
| 1884 | 1884 | */ |
| 1885 | -function give_members_only_form( $final_output, $args ) { |
|
| 1885 | +function give_members_only_form($final_output, $args) { |
|
| 1886 | 1886 | |
| 1887 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1887 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1888 | 1888 | |
| 1889 | 1889 | //Sanity Check: Must have form_id & not be logged in. |
| 1890 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1890 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1891 | 1891 | return $final_output; |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | 1894 | //Logged in only and Register / Login set to none. |
| 1895 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1895 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1896 | 1896 | |
| 1897 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1897 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1898 | 1898 | |
| 1899 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1899 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1900 | 1900 | |
| 1901 | 1901 | } |
| 1902 | 1902 | |
@@ -1904,4 +1904,4 @@ discard block |
||
| 1904 | 1904 | |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1907 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -1042,9 +1042,12 @@ |
||
| 1042 | 1042 | } |
| 1043 | 1043 | ?> |
| 1044 | 1044 | </select> |
| 1045 | - <?php else : ?> |
|
| 1045 | + <?php else { |
|
| 1046 | + : ?> |
|
| 1046 | 1047 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1047 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1048 | + placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
| 1049 | +} |
|
| 1050 | +?>"/> |
|
| 1048 | 1051 | <?php endif; ?> |
| 1049 | 1052 | </p> |
| 1050 | 1053 | <?php |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
| 400 | 400 | 'id' => $prefix . 'form_goal_achieved_message', |
| 401 | 401 | 'type' => 'wysiwyg', |
| 402 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 402 | + 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 403 | 403 | ), |
| 404 | 404 | array( |
| 405 | 405 | 'name' => 'donation_goal_docs', |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | |
| 672 | 672 | <div id="<?php echo $setting['id']; ?>" |
| 673 | 673 | class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
| 674 | - $show_first_tab_content = false; ?>"> |
|
| 674 | + $show_first_tab_content = false; ?>"> |
|
| 675 | 675 | <?php if ( ! empty( $setting['fields'] ) ) : ?> |
| 676 | 676 | <?php foreach ( $setting['fields'] as $field ) : ?> |
| 677 | 677 | <?php give_render_field( $field ); ?> |
@@ -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 = esc_html__( 'Donation Form Options', 'give' ); |
|
| 49 | + $this->metabox_label = esc_html__('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' ), 30 ); |
|
| 55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 30); |
|
| 56 | 56 | |
| 57 | 57 | // Load required scripts. |
| 58 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) ); |
|
| 58 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_script')); |
|
| 59 | 59 | |
| 60 | 60 | // Save form meta. |
| 61 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
| 61 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
| 62 | 62 | |
| 63 | 63 | // cmb2 old setting loaders. |
| 64 | 64 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
| 65 | 65 | // Add offline donations options. |
| 66 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
| 66 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function get_settings() { |
| 88 | 88 | $post_id = give_get_admin_post_id(); |
| 89 | - $price = give_get_form_price( $post_id ); |
|
| 90 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 91 | - $goal = give_get_form_goal( $post_id ); |
|
| 89 | + $price = give_get_form_price($post_id); |
|
| 90 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 91 | + $goal = give_get_form_goal($post_id); |
|
| 92 | 92 | |
| 93 | 93 | // No empty prices - min. 1.00 for new forms |
| 94 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
| 95 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 94 | + if (empty($price) && is_null($post_id)) { |
|
| 95 | + $price = esc_attr(give_format_decimal('1.00')); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // Min. $1.00 for new forms |
| 99 | - if ( empty( $custom_amount_minimum ) ) { |
|
| 100 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 99 | + if (empty($custom_amount_minimum)) { |
|
| 100 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Start with an underscore to hide fields from custom fields list |
@@ -107,215 +107,215 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Repeatable Field Groups |
| 109 | 109 | */ |
| 110 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
| 110 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
| 111 | 111 | 'id' => 'form_field_options', |
| 112 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 112 | + 'title' => esc_html__('Donation Options', 'give'), |
|
| 113 | 113 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
| 114 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 114 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
| 115 | 115 | // Donation Option |
| 116 | 116 | array( |
| 117 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
| 118 | - 'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 119 | - 'id' => $prefix . 'price_option', |
|
| 117 | + 'name' => esc_html__('Donation Option', 'give'), |
|
| 118 | + 'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
| 119 | + 'id' => $prefix.'price_option', |
|
| 120 | 120 | 'type' => 'radio_inline', |
| 121 | 121 | 'default' => 'set', |
| 122 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 123 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
| 124 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
| 125 | - ) ), |
|
| 122 | + 'options' => apply_filters('give_forms_price_options', array( |
|
| 123 | + 'set' => esc_html__('Set Donation', 'give'), |
|
| 124 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
| 125 | + )), |
|
| 126 | 126 | ), |
| 127 | 127 | array( |
| 128 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
| 129 | - 'description' => esc_html__( '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' ), |
|
| 130 | - 'id' => $prefix . 'set_price', |
|
| 128 | + 'name' => esc_html__('Set Donation', 'give'), |
|
| 129 | + 'description' => esc_html__('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'), |
|
| 130 | + 'id' => $prefix.'set_price', |
|
| 131 | 131 | 'type' => 'text_small', |
| 132 | 132 | 'data_type' => 'price', |
| 133 | 133 | 'attributes' => array( |
| 134 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 135 | - 'value' => give_format_decimal( $price ), |
|
| 134 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 135 | + 'value' => give_format_decimal($price), |
|
| 136 | 136 | 'class' => 'give-money-field', |
| 137 | 137 | ), |
| 138 | 138 | ), |
| 139 | 139 | // Display Style |
| 140 | 140 | array( |
| 141 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
| 142 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 143 | - 'id' => $prefix . 'display_style', |
|
| 141 | + 'name' => esc_html__('Display Style', 'give'), |
|
| 142 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
| 143 | + 'id' => $prefix.'display_style', |
|
| 144 | 144 | 'type' => 'radio_inline', |
| 145 | 145 | 'default' => 'buttons', |
| 146 | 146 | 'options' => array( |
| 147 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
| 148 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
| 149 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
| 147 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
| 148 | + 'radios' => esc_html__('Radios', 'give'), |
|
| 149 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
| 150 | 150 | ), |
| 151 | 151 | ), |
| 152 | 152 | // Custom Amount |
| 153 | 153 | array( |
| 154 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
| 155 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 156 | - 'id' => $prefix . 'custom_amount', |
|
| 154 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
| 155 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
| 156 | + 'id' => $prefix.'custom_amount', |
|
| 157 | 157 | 'type' => 'radio_inline', |
| 158 | 158 | 'default' => 'disabled', |
| 159 | 159 | 'options' => array( |
| 160 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 161 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 160 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 161 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 162 | 162 | ), |
| 163 | 163 | ), |
| 164 | 164 | array( |
| 165 | - 'name' => esc_html__( 'Minimum Amount', 'give' ), |
|
| 166 | - 'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ), |
|
| 167 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 165 | + 'name' => esc_html__('Minimum Amount', 'give'), |
|
| 166 | + 'description' => esc_html__('Enter the minimum custom donation amount.', 'give'), |
|
| 167 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 168 | 168 | 'type' => 'text_small', |
| 169 | 169 | 'data_type' => 'price', |
| 170 | 170 | 'attributes' => array( |
| 171 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 172 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
| 171 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 172 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
| 173 | 173 | 'class' => 'give-money-field', |
| 174 | 174 | ), |
| 175 | 175 | ), |
| 176 | 176 | array( |
| 177 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
| 178 | - 'description' => esc_html__( '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' ), |
|
| 179 | - 'id' => $prefix . 'custom_amount_text', |
|
| 177 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
| 178 | + 'description' => esc_html__('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'), |
|
| 179 | + 'id' => $prefix.'custom_amount_text', |
|
| 180 | 180 | 'type' => 'text_medium', |
| 181 | 181 | 'attributes' => array( |
| 182 | 182 | 'rows' => 3, |
| 183 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
| 183 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
| 184 | 184 | ), |
| 185 | 185 | ), |
| 186 | 186 | // Donation Levels: Repeatable CMB2 Group |
| 187 | 187 | array( |
| 188 | - 'id' => $prefix . 'donation_levels', |
|
| 188 | + 'id' => $prefix.'donation_levels', |
|
| 189 | 189 | 'type' => 'group', |
| 190 | 190 | 'options' => array( |
| 191 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
| 192 | - 'header_title' => esc_html__( 'Donation Level', 'give' ), |
|
| 191 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
| 192 | + 'header_title' => esc_html__('Donation Level', 'give'), |
|
| 193 | 193 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 194 | 194 | ), |
| 195 | 195 | // Fields array works the same, except id's only need to be unique for this group. |
| 196 | 196 | // Prefix is not needed. |
| 197 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 197 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
| 198 | 198 | array( |
| 199 | - 'name' => esc_html__( 'ID', 'give' ), |
|
| 200 | - 'id' => $prefix . 'id', |
|
| 199 | + 'name' => esc_html__('ID', 'give'), |
|
| 200 | + 'id' => $prefix.'id', |
|
| 201 | 201 | 'type' => 'levels_id', |
| 202 | 202 | ), |
| 203 | 203 | array( |
| 204 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
| 205 | - 'id' => $prefix . 'amount', |
|
| 204 | + 'name' => esc_html__('Amount', 'give'), |
|
| 205 | + 'id' => $prefix.'amount', |
|
| 206 | 206 | 'type' => 'text_small', |
| 207 | 207 | 'data_type' => 'price', |
| 208 | 208 | 'attributes' => array( |
| 209 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 209 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 210 | 210 | 'class' => 'give-money-field', |
| 211 | 211 | ), |
| 212 | 212 | ), |
| 213 | 213 | array( |
| 214 | - 'name' => esc_html__( 'Text', 'give' ), |
|
| 215 | - 'id' => $prefix . 'text', |
|
| 214 | + 'name' => esc_html__('Text', 'give'), |
|
| 215 | + 'id' => $prefix.'text', |
|
| 216 | 216 | 'type' => 'text', |
| 217 | 217 | 'attributes' => array( |
| 218 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
| 218 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
| 219 | 219 | 'class' => 'give-multilevel-text-field', |
| 220 | 220 | ), |
| 221 | 221 | ), |
| 222 | 222 | array( |
| 223 | - 'name' => esc_html__( 'Default', 'give' ), |
|
| 224 | - 'id' => $prefix . 'default', |
|
| 223 | + 'name' => esc_html__('Default', 'give'), |
|
| 224 | + 'id' => $prefix.'default', |
|
| 225 | 225 | 'type' => 'give_default_radio_inline', |
| 226 | 226 | ), |
| 227 | - ) ), |
|
| 227 | + )), |
|
| 228 | 228 | ), |
| 229 | 229 | array( |
| 230 | 230 | 'name' => 'donation_options_docs', |
| 231 | 231 | 'type' => 'docs_link', |
| 232 | 232 | 'url' => 'http://docs.givewp.com/form-donation-options', |
| 233 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 233 | + 'title' => esc_html__('Donation Options', 'give'), |
|
| 234 | 234 | ), |
| 235 | 235 | ), |
| 236 | 236 | $post_id |
| 237 | 237 | ), |
| 238 | - ) ), |
|
| 238 | + )), |
|
| 239 | 239 | |
| 240 | 240 | /** |
| 241 | 241 | * Display Options |
| 242 | 242 | */ |
| 243 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
| 243 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
| 244 | 244 | 'id' => 'form_display_options', |
| 245 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
| 245 | + 'title' => esc_html__('Form Display', 'give'), |
|
| 246 | 246 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
| 247 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 247 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
| 248 | 248 | array( |
| 249 | - 'name' => esc_html__( 'Display Options', 'give' ), |
|
| 250 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
| 251 | - 'id' => $prefix . 'payment_display', |
|
| 249 | + 'name' => esc_html__('Display Options', 'give'), |
|
| 250 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
| 251 | + 'id' => $prefix.'payment_display', |
|
| 252 | 252 | 'type' => 'radio_inline', |
| 253 | 253 | 'options' => array( |
| 254 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
| 255 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
| 256 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
| 257 | - 'button' => esc_html__( 'Button', 'give' ), |
|
| 254 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
| 255 | + 'modal' => esc_html__('Modal', 'give'), |
|
| 256 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
| 257 | + 'button' => esc_html__('Button', 'give'), |
|
| 258 | 258 | ), |
| 259 | 259 | 'default' => 'onpage', |
| 260 | 260 | ), |
| 261 | 261 | array( |
| 262 | - 'id' => $prefix . 'reveal_label', |
|
| 263 | - 'name' => esc_html__( 'Continue Button', 'give' ), |
|
| 264 | - 'desc' => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
| 262 | + 'id' => $prefix.'reveal_label', |
|
| 263 | + 'name' => esc_html__('Continue Button', 'give'), |
|
| 264 | + 'desc' => esc_html__('The button label for displaying the additional payment fields.', 'give'), |
|
| 265 | 265 | 'type' => 'text_small', |
| 266 | 266 | 'attributes' => array( |
| 267 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
| 267 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
| 268 | 268 | ), |
| 269 | 269 | ), |
| 270 | 270 | array( |
| 271 | - 'id' => $prefix . 'checkout_label', |
|
| 272 | - 'name' => esc_html__( 'Submit Button', 'give' ), |
|
| 273 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
| 271 | + 'id' => $prefix.'checkout_label', |
|
| 272 | + 'name' => esc_html__('Submit Button', 'give'), |
|
| 273 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
| 274 | 274 | 'type' => 'text_small', |
| 275 | 275 | 'attributes' => array( |
| 276 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
| 276 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
| 277 | 277 | ), |
| 278 | 278 | ), |
| 279 | 279 | array( |
| 280 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
| 281 | - 'desc' => esc_html__( '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' ), |
|
| 282 | - 'id' => $prefix . 'default_gateway', |
|
| 280 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
| 281 | + 'desc' => esc_html__('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'), |
|
| 282 | + 'id' => $prefix.'default_gateway', |
|
| 283 | 283 | 'type' => 'default_gateway', |
| 284 | 284 | ), |
| 285 | 285 | array( |
| 286 | - 'name' => esc_html__( 'Guest Donations', 'give' ), |
|
| 287 | - 'desc' => esc_html__( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
| 288 | - 'id' => $prefix . 'logged_in_only', |
|
| 286 | + 'name' => esc_html__('Guest Donations', 'give'), |
|
| 287 | + 'desc' => esc_html__('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
| 288 | + 'id' => $prefix.'logged_in_only', |
|
| 289 | 289 | 'type' => 'radio_inline', |
| 290 | 290 | 'default' => 'enabled', |
| 291 | 291 | 'options' => array( |
| 292 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 293 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 292 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 293 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 294 | 294 | ), |
| 295 | 295 | ), |
| 296 | 296 | array( |
| 297 | - 'name' => esc_html__( 'Registration', 'give' ), |
|
| 298 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 299 | - 'id' => $prefix . 'show_register_form', |
|
| 297 | + 'name' => esc_html__('Registration', 'give'), |
|
| 298 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
| 299 | + 'id' => $prefix.'show_register_form', |
|
| 300 | 300 | 'type' => 'radio', |
| 301 | 301 | 'options' => array( |
| 302 | - 'none' => esc_html__( 'None', 'give' ), |
|
| 303 | - 'registration' => esc_html__( 'Registration', 'give' ), |
|
| 304 | - 'login' => esc_html__( 'Login', 'give' ), |
|
| 305 | - 'both' => esc_html__( 'Registration + Login', 'give' ), |
|
| 302 | + 'none' => esc_html__('None', 'give'), |
|
| 303 | + 'registration' => esc_html__('Registration', 'give'), |
|
| 304 | + 'login' => esc_html__('Login', 'give'), |
|
| 305 | + 'both' => esc_html__('Registration + Login', 'give'), |
|
| 306 | 306 | ), |
| 307 | 307 | 'default' => 'none', |
| 308 | 308 | ), |
| 309 | 309 | array( |
| 310 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
| 310 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
| 311 | 311 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
| 312 | - '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' ) ), |
|
| 313 | - 'id' => $prefix . 'form_floating_labels', |
|
| 312 | + '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')), |
|
| 313 | + 'id' => $prefix.'form_floating_labels', |
|
| 314 | 314 | 'type' => 'radio_inline', |
| 315 | 315 | 'options' => array( |
| 316 | - 'global' => esc_html__( 'Global Option', 'give' ), |
|
| 317 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 318 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 316 | + 'global' => esc_html__('Global Option', 'give'), |
|
| 317 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 318 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 319 | 319 | ), |
| 320 | 320 | 'default' => 'global', |
| 321 | 321 | ), |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | 'name' => 'form_display_docs', |
| 324 | 324 | 'type' => 'docs_link', |
| 325 | 325 | 'url' => 'http://docs.givewp.com/form-display-options', |
| 326 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
| 326 | + 'title' => esc_html__('Form Display', 'give'), |
|
| 327 | 327 | ), |
| 328 | 328 | ), |
| 329 | 329 | $post_id |
@@ -334,191 +334,191 @@ discard block |
||
| 334 | 334 | /** |
| 335 | 335 | * Donation Goals |
| 336 | 336 | */ |
| 337 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
| 337 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
| 338 | 338 | 'id' => 'donation_goal_options', |
| 339 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
| 339 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
| 340 | 340 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
| 341 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
| 341 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
| 342 | 342 | // Goals |
| 343 | 343 | array( |
| 344 | - 'name' => esc_html__( 'Donation Goal', 'give' ), |
|
| 345 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 346 | - 'id' => $prefix . 'goal_option', |
|
| 344 | + 'name' => esc_html__('Donation Goal', 'give'), |
|
| 345 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
| 346 | + 'id' => $prefix.'goal_option', |
|
| 347 | 347 | 'type' => 'radio_inline', |
| 348 | 348 | 'default' => 'disabled', |
| 349 | 349 | 'options' => array( |
| 350 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 351 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 350 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 351 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 352 | 352 | ), |
| 353 | 353 | ), |
| 354 | 354 | array( |
| 355 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
| 356 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
| 357 | - 'id' => $prefix . 'set_goal', |
|
| 355 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
| 356 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
| 357 | + 'id' => $prefix.'set_goal', |
|
| 358 | 358 | 'type' => 'text_small', |
| 359 | 359 | 'data_type' => 'price', |
| 360 | 360 | 'attributes' => array( |
| 361 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
| 362 | - 'value' => give_format_decimal( $goal ), |
|
| 361 | + 'placeholder' => give_format_decimal('0.00'), |
|
| 362 | + 'value' => give_format_decimal($goal), |
|
| 363 | 363 | 'class' => 'give-money-field', |
| 364 | 364 | ), |
| 365 | 365 | ), |
| 366 | 366 | |
| 367 | 367 | array( |
| 368 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
| 369 | - 'description' => esc_html__( '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".', 'give' ), |
|
| 370 | - 'id' => $prefix . 'goal_format', |
|
| 368 | + 'name' => esc_html__('Goal Format', 'give'), |
|
| 369 | + 'description' => esc_html__('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".', 'give'), |
|
| 370 | + 'id' => $prefix.'goal_format', |
|
| 371 | 371 | 'type' => 'radio_inline', |
| 372 | 372 | 'default' => 'amount', |
| 373 | 373 | 'options' => array( |
| 374 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 375 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
| 374 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 375 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
| 376 | 376 | ), |
| 377 | 377 | ), |
| 378 | 378 | array( |
| 379 | - 'name' => esc_html__( 'Progress Bar Color', 'give' ), |
|
| 380 | - 'desc' => esc_html__( 'Customize the color of the goal progress bar.', 'give' ), |
|
| 381 | - 'id' => $prefix . 'goal_color', |
|
| 379 | + 'name' => esc_html__('Progress Bar Color', 'give'), |
|
| 380 | + 'desc' => esc_html__('Customize the color of the goal progress bar.', 'give'), |
|
| 381 | + 'id' => $prefix.'goal_color', |
|
| 382 | 382 | 'type' => 'colorpicker', |
| 383 | 383 | 'default' => '#2bc253', |
| 384 | 384 | ), |
| 385 | 385 | |
| 386 | 386 | array( |
| 387 | - 'name' => esc_html__( 'Close Form', 'give' ), |
|
| 388 | - 'desc' => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 389 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 387 | + 'name' => esc_html__('Close Form', 'give'), |
|
| 388 | + 'desc' => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
| 389 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 390 | 390 | 'type' => 'radio_inline', |
| 391 | 391 | 'default' => 'disabled', |
| 392 | 392 | 'options' => array( |
| 393 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 394 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 393 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 394 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 395 | 395 | ), |
| 396 | 396 | ), |
| 397 | 397 | array( |
| 398 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 399 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
| 400 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 398 | + 'name' => __('Goal Achieved Message', 'give'), |
|
| 399 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
| 400 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 401 | 401 | 'type' => 'wysiwyg', |
| 402 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 402 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
| 403 | 403 | ), |
| 404 | 404 | array( |
| 405 | 405 | 'name' => 'donation_goal_docs', |
| 406 | 406 | 'type' => 'docs_link', |
| 407 | 407 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
| 408 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
| 408 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
| 409 | 409 | ), |
| 410 | 410 | ), |
| 411 | 411 | $post_id |
| 412 | 412 | ), |
| 413 | - ) ), |
|
| 413 | + )), |
|
| 414 | 414 | |
| 415 | 415 | /** |
| 416 | 416 | * Content Field |
| 417 | 417 | */ |
| 418 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
| 418 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
| 419 | 419 | 'id' => 'form_content_options', |
| 420 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 420 | + 'title' => esc_html__('Form Content', 'give'), |
|
| 421 | 421 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
| 422 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 422 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
| 423 | 423 | |
| 424 | 424 | // Donation content. |
| 425 | 425 | array( |
| 426 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
| 427 | - 'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ), |
|
| 428 | - 'id' => $prefix . 'display_content', |
|
| 426 | + 'name' => esc_html__('Display Content', 'give'), |
|
| 427 | + 'description' => esc_html__('Do you want to add custom content to this form?', 'give'), |
|
| 428 | + 'id' => $prefix.'display_content', |
|
| 429 | 429 | 'type' => 'radio_inline', |
| 430 | 430 | 'options' => array( |
| 431 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 432 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 431 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 432 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 433 | 433 | ), |
| 434 | 434 | 'default' => 'disabled', |
| 435 | 435 | ), |
| 436 | 436 | |
| 437 | 437 | // Content placement. |
| 438 | 438 | array( |
| 439 | - 'name' => esc_html__( 'Content Placement', 'give' ), |
|
| 440 | - 'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ), |
|
| 441 | - 'id' => $prefix . 'content_placement', |
|
| 439 | + 'name' => esc_html__('Content Placement', 'give'), |
|
| 440 | + 'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'), |
|
| 441 | + 'id' => $prefix.'content_placement', |
|
| 442 | 442 | 'type' => 'radio_inline', |
| 443 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 444 | - 'give_pre_form' => esc_html__( 'Above fields', 'give' ), |
|
| 445 | - 'give_post_form' => esc_html__( 'Below fields', 'give' ), |
|
| 443 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 444 | + 'give_pre_form' => esc_html__('Above fields', 'give'), |
|
| 445 | + 'give_post_form' => esc_html__('Below fields', 'give'), |
|
| 446 | 446 | ) |
| 447 | 447 | ), |
| 448 | 448 | 'default' => 'give_pre_form', |
| 449 | 449 | ), |
| 450 | 450 | array( |
| 451 | - 'name' => esc_html__( 'Content', 'give' ), |
|
| 452 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
| 453 | - 'id' => $prefix . 'form_content', |
|
| 451 | + 'name' => esc_html__('Content', 'give'), |
|
| 452 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
| 453 | + 'id' => $prefix.'form_content', |
|
| 454 | 454 | 'type' => 'wysiwyg', |
| 455 | 455 | ), |
| 456 | 456 | array( |
| 457 | 457 | 'name' => 'form_content_docs', |
| 458 | 458 | 'type' => 'docs_link', |
| 459 | 459 | 'url' => 'http://docs.givewp.com/form-content', |
| 460 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 460 | + 'title' => esc_html__('Form Content', 'give'), |
|
| 461 | 461 | ), |
| 462 | 462 | ), |
| 463 | 463 | $post_id |
| 464 | 464 | ), |
| 465 | - ) ), |
|
| 465 | + )), |
|
| 466 | 466 | |
| 467 | 467 | /** |
| 468 | 468 | * Terms & Conditions |
| 469 | 469 | */ |
| 470 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
| 470 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
| 471 | 471 | 'id' => 'form_terms_options', |
| 472 | - 'title' => esc_html__( 'Terms & Conditions', 'give' ), |
|
| 472 | + 'title' => esc_html__('Terms & Conditions', 'give'), |
|
| 473 | 473 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
| 474 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 474 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
| 475 | 475 | // Donation Option |
| 476 | 476 | array( |
| 477 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 478 | - 'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
| 479 | - 'id' => $prefix . 'terms_option', |
|
| 477 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
| 478 | + 'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
| 479 | + 'id' => $prefix.'terms_option', |
|
| 480 | 480 | 'type' => 'radio_inline', |
| 481 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 482 | - 'global' => esc_html__( 'Global Option', 'give' ), |
|
| 483 | - 'enabled' => esc_html__( 'Customize', 'give' ), |
|
| 484 | - 'disabled' => esc_html__( 'Disable', 'give' ), |
|
| 481 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 482 | + 'global' => esc_html__('Global Option', 'give'), |
|
| 483 | + 'enabled' => esc_html__('Customize', 'give'), |
|
| 484 | + 'disabled' => esc_html__('Disable', 'give'), |
|
| 485 | 485 | ) |
| 486 | 486 | ), |
| 487 | 487 | 'default' => 'global', |
| 488 | 488 | ), |
| 489 | 489 | array( |
| 490 | - 'id' => $prefix . 'agree_label', |
|
| 491 | - 'name' => esc_html__( 'Agreement Label', 'give' ), |
|
| 492 | - 'desc' => esc_html__( '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' ), |
|
| 490 | + 'id' => $prefix.'agree_label', |
|
| 491 | + 'name' => esc_html__('Agreement Label', 'give'), |
|
| 492 | + 'desc' => esc_html__('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'), |
|
| 493 | 493 | 'type' => 'text', |
| 494 | 494 | 'size' => 'regular', |
| 495 | 495 | 'attributes' => array( |
| 496 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
| 496 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
| 497 | 497 | ), |
| 498 | 498 | ), |
| 499 | 499 | array( |
| 500 | - 'id' => $prefix . 'agree_text', |
|
| 501 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
| 502 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 500 | + 'id' => $prefix.'agree_text', |
|
| 501 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
| 502 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
| 503 | 503 | 'type' => 'wysiwyg', |
| 504 | 504 | ), |
| 505 | 505 | array( |
| 506 | 506 | 'name' => 'terms_docs', |
| 507 | 507 | 'type' => 'docs_link', |
| 508 | 508 | 'url' => 'http://docs.givewp.com/form-terms', |
| 509 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 509 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
| 510 | 510 | ), |
| 511 | 511 | ), |
| 512 | 512 | $post_id |
| 513 | 513 | ), |
| 514 | - ) ), |
|
| 514 | + )), |
|
| 515 | 515 | ); |
| 516 | 516 | |
| 517 | 517 | |
| 518 | 518 | /** |
| 519 | 519 | * Filter the metabox tabbed panel settings. |
| 520 | 520 | */ |
| 521 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
| 521 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
| 522 | 522 | |
| 523 | 523 | // Output. |
| 524 | 524 | return $settings; |
@@ -534,8 +534,8 @@ discard block |
||
| 534 | 534 | add_meta_box( |
| 535 | 535 | $this->get_metabox_ID(), |
| 536 | 536 | $this->get_metabox_label(), |
| 537 | - array( $this, 'output' ), |
|
| 538 | - array( 'give_forms' ), |
|
| 537 | + array($this, 'output'), |
|
| 538 | + array('give_forms'), |
|
| 539 | 539 | 'normal', |
| 540 | 540 | 'high' |
| 541 | 541 | ); |
@@ -551,9 +551,9 @@ discard block |
||
| 551 | 551 | function enqueue_script() { |
| 552 | 552 | global $post; |
| 553 | 553 | |
| 554 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 555 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 556 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 554 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 555 | + wp_enqueue_style('wp-color-picker'); |
|
| 556 | + wp_enqueue_script('wp-color-picker'); |
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
@@ -587,32 +587,32 @@ discard block |
||
| 587 | 587 | public function get_tabs() { |
| 588 | 588 | $tabs = array(); |
| 589 | 589 | |
| 590 | - if ( ! empty( $this->settings ) ) { |
|
| 591 | - foreach ( $this->settings as $setting ) { |
|
| 592 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
| 590 | + if ( ! empty($this->settings)) { |
|
| 591 | + foreach ($this->settings as $setting) { |
|
| 592 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
| 593 | 593 | continue; |
| 594 | 594 | } |
| 595 | 595 | $tab = array( |
| 596 | 596 | 'id' => $setting['id'], |
| 597 | 597 | 'label' => $setting['title'], |
| 598 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
| 598 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
| 599 | 599 | ); |
| 600 | 600 | |
| 601 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 602 | - if ( empty( $setting['sub-fields'] ) ) { |
|
| 601 | + if ($this->has_sub_tab($setting)) { |
|
| 602 | + if (empty($setting['sub-fields'])) { |
|
| 603 | 603 | $tab = array(); |
| 604 | 604 | } else { |
| 605 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
| 605 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
| 606 | 606 | $tab['sub-fields'][] = array( |
| 607 | 607 | 'id' => $sub_fields['id'], |
| 608 | 608 | 'label' => $sub_fields['title'], |
| 609 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
| 609 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
| 610 | 610 | ); |
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - if ( ! empty( $tab ) ) { |
|
| 615 | + if ( ! empty($tab)) { |
|
| 616 | 616 | $tabs[] = $tab; |
| 617 | 617 | } |
| 618 | 618 | } |
@@ -629,27 +629,27 @@ discard block |
||
| 629 | 629 | */ |
| 630 | 630 | public function output() { |
| 631 | 631 | // Bailout. |
| 632 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
| 633 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
| 632 | + if ($form_data_tabs = $this->get_tabs()) { |
|
| 633 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
| 634 | 634 | ?> |
| 635 | 635 | <div class="give-metabox-panel-wrap"> |
| 636 | 636 | <ul class="give-form-data-tabs give-metabox-tabs"> |
| 637 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
| 638 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
| 637 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
| 638 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
| 639 | 639 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
| 640 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
| 640 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
| 641 | 641 | <?php echo $form_data_tab['icon-html']; ?> |
| 642 | 642 | <?php else : ?> |
| 643 | 643 | <span class="give-icon give-icon-default"></span> |
| 644 | 644 | <?php endif; ?> |
| 645 | 645 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 646 | 646 | </a> |
| 647 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
| 647 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
| 648 | 648 | <ul class="give-metabox-sub-tabs give-hidden"> |
| 649 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
| 649 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
| 650 | 650 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
| 651 | 651 | <a href="#<?php echo $sub_tab['id']; ?>"> |
| 652 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
| 652 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
| 653 | 653 | <?php echo $sub_tab['icon-html']; ?> |
| 654 | 654 | <?php else : ?> |
| 655 | 655 | <span class="give-icon give-icon-default"></span> |
@@ -665,30 +665,30 @@ discard block |
||
| 665 | 665 | </ul> |
| 666 | 666 | |
| 667 | 667 | <?php $show_first_tab_content = true; ?> |
| 668 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
| 669 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
| 670 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
| 668 | + <?php foreach ($this->settings as $setting) : ?> |
|
| 669 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
| 670 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
| 671 | 671 | |
| 672 | 672 | <div id="<?php echo $setting['id']; ?>" |
| 673 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
| 673 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
| 674 | 674 | $show_first_tab_content = false; ?>"> |
| 675 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
| 676 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
| 677 | - <?php give_render_field( $field ); ?> |
|
| 675 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
| 676 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
| 677 | + <?php give_render_field($field); ?> |
|
| 678 | 678 | <?php endforeach; ?> |
| 679 | 679 | <?php endif; ?> |
| 680 | 680 | </div> |
| 681 | 681 | |
| 682 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
| 682 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
| 683 | 683 | <?php else: ?> |
| 684 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
| 685 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
| 686 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
| 684 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
| 685 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
| 686 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
| 687 | 687 | <div id="<?php echo $sub_fields['id']; ?>" |
| 688 | 688 | class="panel give_options_panel give-hidden"> |
| 689 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
| 690 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
| 691 | - <?php give_render_field( $sub_field ); ?> |
|
| 689 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
| 690 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
| 691 | + <?php give_render_field($sub_field); ?> |
|
| 692 | 692 | <?php endforeach; ?> |
| 693 | 693 | <?php endif; ?> |
| 694 | 694 | </div> |
@@ -712,9 +712,9 @@ discard block |
||
| 712 | 712 | * |
| 713 | 713 | * @return bool |
| 714 | 714 | */ |
| 715 | - private function has_sub_tab( $field_setting ) { |
|
| 715 | + private function has_sub_tab($field_setting) { |
|
| 716 | 716 | $has_sub_tab = false; |
| 717 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
| 717 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
| 718 | 718 | $has_sub_tab = true; |
| 719 | 719 | } |
| 720 | 720 | |
@@ -728,13 +728,13 @@ discard block |
||
| 728 | 728 | * @return array |
| 729 | 729 | */ |
| 730 | 730 | function cmb2_metabox_settings() { |
| 731 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
| 731 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
| 732 | 732 | $give_forms_settings = $all_cmb2_settings; |
| 733 | 733 | |
| 734 | 734 | // Filter settings: Use only give forms related settings. |
| 735 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
| 736 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
| 737 | - unset( $give_forms_settings[ $index ] ); |
|
| 735 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
| 736 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
| 737 | + unset($give_forms_settings[$index]); |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -752,114 +752,114 @@ discard block |
||
| 752 | 752 | * |
| 753 | 753 | * @return void |
| 754 | 754 | */ |
| 755 | - public function save( $post_id, $post ) { |
|
| 755 | + public function save($post_id, $post) { |
|
| 756 | 756 | |
| 757 | 757 | // $post_id and $post are required. |
| 758 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 758 | + if (empty($post_id) || empty($post)) { |
|
| 759 | 759 | return; |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | // Don't save meta boxes for revisions or autosaves. |
| 763 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 763 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 764 | 764 | return; |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | // Check the nonce. |
| 768 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
| 768 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
| 769 | 769 | return; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 773 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
| 773 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
| 774 | 774 | return; |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | // Check user has permission to edit. |
| 778 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 778 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 779 | 779 | return; |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | // Fire action before saving form meta. |
| 783 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
| 783 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
| 784 | 784 | |
| 785 | 785 | /** |
| 786 | 786 | * Filter the meta key to save. |
| 787 | 787 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
| 788 | 788 | */ |
| 789 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
| 789 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
| 790 | 790 | |
| 791 | 791 | // Save form meta data. |
| 792 | - if ( ! empty( $form_meta_keys ) ) { |
|
| 793 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
| 792 | + if ( ! empty($form_meta_keys)) { |
|
| 793 | + foreach ($form_meta_keys as $form_meta_key) { |
|
| 794 | 794 | |
| 795 | 795 | // Set default value for checkbox fields. |
| 796 | 796 | if ( |
| 797 | - ! isset( $_POST[ $form_meta_key ] ) |
|
| 798 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
| 797 | + ! isset($_POST[$form_meta_key]) |
|
| 798 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
| 799 | 799 | ) { |
| 800 | - $_POST[ $form_meta_key ] = ''; |
|
| 800 | + $_POST[$form_meta_key] = ''; |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
| 804 | - if ( $field_type = $this->get_field_type( $form_meta_key ) ) { |
|
| 805 | - switch ( $field_type ) { |
|
| 803 | + if (isset($_POST[$form_meta_key])) { |
|
| 804 | + if ($field_type = $this->get_field_type($form_meta_key)) { |
|
| 805 | + switch ($field_type) { |
|
| 806 | 806 | case 'textarea': |
| 807 | 807 | case 'wysiwyg': |
| 808 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
| 809 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 808 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
| 809 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 810 | 810 | break; |
| 811 | 811 | |
| 812 | 812 | case 'group': |
| 813 | 813 | $form_meta_value = array(); |
| 814 | 814 | |
| 815 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
| 815 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
| 816 | 816 | |
| 817 | 817 | // Do not save template input field values. |
| 818 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
| 818 | + if ('{{row-count-placeholder}}' === $index) { |
|
| 819 | 819 | continue; |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | $group_meta_value = array(); |
| 823 | - foreach ( $group as $field_id => $field_value ) { |
|
| 824 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
| 823 | + foreach ($group as $field_id => $field_value) { |
|
| 824 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
| 825 | 825 | case 'wysiwyg': |
| 826 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
| 826 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
| 827 | 827 | break; |
| 828 | 828 | |
| 829 | 829 | default: |
| 830 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
| 830 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | - if ( ! empty( $group_meta_value ) ) { |
|
| 835 | - $form_meta_value[ $index ] = $group_meta_value; |
|
| 834 | + if ( ! empty($group_meta_value)) { |
|
| 835 | + $form_meta_value[$index] = $group_meta_value; |
|
| 836 | 836 | } |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | |
| 840 | 840 | // Arrange repeater field keys in order. |
| 841 | - $form_meta_value = array_values( $form_meta_value ); |
|
| 841 | + $form_meta_value = array_values($form_meta_value); |
|
| 842 | 842 | |
| 843 | 843 | // Save data. |
| 844 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 844 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 845 | 845 | break; |
| 846 | 846 | |
| 847 | 847 | default: |
| 848 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
| 848 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
| 849 | 849 | |
| 850 | 850 | // Save data. |
| 851 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 851 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | // Fire after saving form meta key. |
| 855 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
| 855 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
| 856 | 856 | } |
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | // Fire action after saving form meta. |
| 862 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
| 862 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | |
@@ -872,10 +872,10 @@ discard block |
||
| 872 | 872 | * |
| 873 | 873 | * @return string |
| 874 | 874 | */ |
| 875 | - private function get_field_id( $field ) { |
|
| 875 | + private function get_field_id($field) { |
|
| 876 | 876 | $field_id = ''; |
| 877 | 877 | |
| 878 | - if ( array_key_exists( 'id', $field ) ) { |
|
| 878 | + if (array_key_exists('id', $field)) { |
|
| 879 | 879 | $field_id = $field['id']; |
| 880 | 880 | |
| 881 | 881 | } |
@@ -892,12 +892,12 @@ discard block |
||
| 892 | 892 | * |
| 893 | 893 | * @return array |
| 894 | 894 | */ |
| 895 | - private function get_fields_id( $setting ) { |
|
| 895 | + private function get_fields_id($setting) { |
|
| 896 | 896 | $meta_keys = array(); |
| 897 | 897 | |
| 898 | - if ( ! empty( $setting ) ) { |
|
| 899 | - foreach ( $setting['fields'] as $field ) { |
|
| 900 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 898 | + if ( ! empty($setting)) { |
|
| 899 | + foreach ($setting['fields'] as $field) { |
|
| 900 | + if ($field_id = $this->get_field_id($field)) { |
|
| 901 | 901 | $meta_keys[] = $field_id; |
| 902 | 902 | } |
| 903 | 903 | } |
@@ -915,14 +915,14 @@ discard block |
||
| 915 | 915 | * |
| 916 | 916 | * @return array |
| 917 | 917 | */ |
| 918 | - private function get_sub_fields_id( $setting ) { |
|
| 918 | + private function get_sub_fields_id($setting) { |
|
| 919 | 919 | $meta_keys = array(); |
| 920 | 920 | |
| 921 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
| 922 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 923 | - if ( ! empty( $fields['fields'] ) ) { |
|
| 924 | - foreach ( $fields['fields'] as $field ) { |
|
| 925 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 921 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
| 922 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 923 | + if ( ! empty($fields['fields'])) { |
|
| 924 | + foreach ($fields['fields'] as $field) { |
|
| 925 | + if ($field_id = $this->get_field_id($field)) { |
|
| 926 | 926 | $meta_keys[] = $field_id; |
| 927 | 927 | } |
| 928 | 928 | } |
@@ -943,14 +943,14 @@ discard block |
||
| 943 | 943 | private function get_meta_keys_from_settings() { |
| 944 | 944 | $meta_keys = array(); |
| 945 | 945 | |
| 946 | - foreach ( $this->settings as $setting ) { |
|
| 947 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 948 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
| 946 | + foreach ($this->settings as $setting) { |
|
| 947 | + if ($this->has_sub_tab($setting)) { |
|
| 948 | + $meta_key = $this->get_sub_fields_id($setting); |
|
| 949 | 949 | } else { |
| 950 | - $meta_key = $this->get_fields_id( $setting ); |
|
| 950 | + $meta_key = $this->get_fields_id($setting); |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
| 953 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | return $meta_keys; |
@@ -967,10 +967,10 @@ discard block |
||
| 967 | 967 | * |
| 968 | 968 | * @return string |
| 969 | 969 | */ |
| 970 | - function get_field_type( $field_id, $group_id = '' ) { |
|
| 971 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
| 970 | + function get_field_type($field_id, $group_id = '') { |
|
| 971 | + $field = $this->get_setting_field($field_id, $group_id); |
|
| 972 | 972 | |
| 973 | - $type = array_key_exists( 'type', $field ) |
|
| 973 | + $type = array_key_exists('type', $field) |
|
| 974 | 974 | ? $field['type'] |
| 975 | 975 | : ''; |
| 976 | 976 | |
@@ -988,12 +988,12 @@ discard block |
||
| 988 | 988 | * |
| 989 | 989 | * @return array |
| 990 | 990 | */ |
| 991 | - private function get_field( $setting, $field_id ) { |
|
| 991 | + private function get_field($setting, $field_id) { |
|
| 992 | 992 | $setting_field = array(); |
| 993 | 993 | |
| 994 | - if ( ! empty( $setting['fields'] ) ) { |
|
| 995 | - foreach ( $setting['fields'] as $field ) { |
|
| 996 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
| 994 | + if ( ! empty($setting['fields'])) { |
|
| 995 | + foreach ($setting['fields'] as $field) { |
|
| 996 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
| 997 | 997 | $setting_field = $field; |
| 998 | 998 | break; |
| 999 | 999 | } |
@@ -1013,12 +1013,12 @@ discard block |
||
| 1013 | 1013 | * |
| 1014 | 1014 | * @return array |
| 1015 | 1015 | */ |
| 1016 | - private function get_sub_field( $setting, $field_id ) { |
|
| 1016 | + private function get_sub_field($setting, $field_id) { |
|
| 1017 | 1017 | $setting_field = array(); |
| 1018 | 1018 | |
| 1019 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
| 1020 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 1021 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
| 1019 | + if ( ! empty($setting['sub-fields'])) { |
|
| 1020 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 1021 | + if ($field = $this->get_field($fields, $field_id)) { |
|
| 1022 | 1022 | $setting_field = $field; |
| 1023 | 1023 | break; |
| 1024 | 1024 | } |
@@ -1038,17 +1038,17 @@ discard block |
||
| 1038 | 1038 | * |
| 1039 | 1039 | * @return array |
| 1040 | 1040 | */ |
| 1041 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
| 1041 | + function get_setting_field($field_id, $group_id = '') { |
|
| 1042 | 1042 | $setting_field = array(); |
| 1043 | 1043 | |
| 1044 | 1044 | $_field_id = $field_id; |
| 1045 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
| 1045 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
| 1046 | 1046 | |
| 1047 | - if ( ! empty( $this->settings ) ) { |
|
| 1048 | - foreach ( $this->settings as $setting ) { |
|
| 1047 | + if ( ! empty($this->settings)) { |
|
| 1048 | + foreach ($this->settings as $setting) { |
|
| 1049 | 1049 | if ( |
| 1050 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
| 1051 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
| 1050 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
| 1051 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
| 1052 | 1052 | ) { |
| 1053 | 1053 | break; |
| 1054 | 1054 | } |
@@ -1057,9 +1057,9 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | |
| 1059 | 1059 | // Get field from group. |
| 1060 | - if ( ! empty( $group_id ) ) { |
|
| 1061 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1062 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
| 1060 | + if ( ! empty($group_id)) { |
|
| 1061 | + foreach ($setting_field['fields'] as $field) { |
|
| 1062 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
| 1063 | 1063 | $setting_field = $field; |
| 1064 | 1064 | } |
| 1065 | 1065 | } |
@@ -1078,14 +1078,14 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @return mixed |
| 1080 | 1080 | */ |
| 1081 | - function add_offline_donations_setting_tab( $settings ) { |
|
| 1082 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
| 1083 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
| 1081 | + function add_offline_donations_setting_tab($settings) { |
|
| 1082 | + if (give_is_gateway_active('offline')) { |
|
| 1083 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
| 1084 | 1084 | 'id' => 'offline_donations_options', |
| 1085 | - 'title' => esc_html__( 'Offline Donations', 'give' ), |
|
| 1085 | + 'title' => esc_html__('Offline Donations', 'give'), |
|
| 1086 | 1086 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
| 1087 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
| 1088 | - ) ); |
|
| 1087 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
| 1088 | + )); |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | return $settings; |
@@ -725,9 +725,9 @@ |
||
| 725 | 725 | <td class="give-docs-link" colspan="2"> |
| 726 | 726 | <?php |
| 727 | 727 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
| 728 | - . '" target="_blank">' |
|
| 729 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 730 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 728 | + . '" target="_blank">' |
|
| 729 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 730 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 731 | 731 | ?> |
| 732 | 732 | </td> |
| 733 | 733 | </tr><?php |
@@ -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,8 +86,8 @@ discard block |
||
| 86 | 86 | public static function save() { |
| 87 | 87 | $current_tab = give_get_current_setting_tab(); |
| 88 | 88 | |
| 89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
| 90 | - die( __( 'Action failed. Please refresh the page and retry.', 'give' ) ); |
|
| 89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
| 90 | + die(__('Action failed. Please refresh the page and retry.', 'give')); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @since 1.8 |
| 101 | 101 | */ |
| 102 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
| 102 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
| 103 | 103 | |
| 104 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
| 104 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Trigger Action. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @since 1.8 |
| 114 | 114 | */ |
| 115 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
| 115 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @return void |
| 127 | 127 | */ |
| 128 | - public static function add_message( $code, $message ) { |
|
| 129 | - self::$messages[ $code ] = $message; |
|
| 128 | + public static function add_message($code, $message) { |
|
| 129 | + self::$messages[$code] = $message; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return void |
| 141 | 141 | */ |
| 142 | - public static function add_error( $code, $message ) { |
|
| 143 | - self::$errors[ $code ] = $message; |
|
| 142 | + public static function add_error($code, $message) { |
|
| 143 | + self::$errors[$code] = $message; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | $notice_html = ''; |
| 154 | 154 | $classes = 'give-notice settings-error notice is-dismissible'; |
| 155 | 155 | |
| 156 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
| 157 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
| 156 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
| 157 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
| 158 | 158 | |
| 159 | - if ( 0 < count( self::$errors ) ) { |
|
| 160 | - foreach ( self::$errors as $code => $message ) { |
|
| 161 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
| 159 | + if (0 < count(self::$errors)) { |
|
| 160 | + foreach (self::$errors as $code => $message) { |
|
| 161 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( 0 < count( self::$messages ) ) { |
|
| 166 | - foreach ( self::$messages as $code => $message ) { |
|
| 167 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
| 165 | + if (0 < count(self::$messages)) { |
|
| 166 | + foreach (self::$messages as $code => $message) { |
|
| 167 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | self::$setting_filter_prefix = give_get_current_setting_page(); |
| 185 | 185 | |
| 186 | 186 | // Bailout: Exit if setting page is not defined. |
| 187 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
| 187 | + if (empty(self::$setting_filter_prefix)) { |
|
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @since 1.8 |
| 199 | 199 | */ |
| 200 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
| 200 | + do_action(self::$setting_filter_prefix.'_start'); |
|
| 201 | 201 | |
| 202 | 202 | $current_tab = give_get_current_setting_tab(); |
| 203 | 203 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | self::get_settings_pages(); |
| 206 | 206 | |
| 207 | 207 | // Save settings if data has been posted. |
| 208 | - if ( ! empty( $_POST ) ) { |
|
| 208 | + if ( ! empty($_POST)) { |
|
| 209 | 209 | self::save(); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @since 1.8 |
| 220 | 220 | */ |
| 221 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
| 221 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
| 222 | 222 | |
| 223 | 223 | include 'views/html-admin-settings.php'; |
| 224 | 224 | |
@@ -236,25 +236,25 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return string|bool |
| 238 | 238 | */ |
| 239 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
| 239 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
| 240 | 240 | // Bailout. |
| 241 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
| 241 | + if (empty($option_name) && empty($field_id)) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
| 245 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
| 246 | 246 | // Get field value if any. |
| 247 | - $option_value = get_option( $option_name ); |
|
| 247 | + $option_value = get_option($option_name); |
|
| 248 | 248 | |
| 249 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
| 250 | - ? $option_value[ $field_id ] |
|
| 249 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
| 250 | + ? $option_value[$field_id] |
|
| 251 | 251 | : $default; |
| 252 | 252 | } else { |
| 253 | 253 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
| 254 | 254 | $option_name = ! $option_name ? $field_id : $option_name; |
| 255 | 255 | |
| 256 | 256 | // Get option value if any. |
| 257 | - $option_value = get_option( $option_name, $default ); |
|
| 257 | + $option_value = get_option($option_name, $default); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | return $option_value; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @return void |
| 274 | 274 | */ |
| 275 | - public static function output_fields( $options, $option_name = '' ) { |
|
| 275 | + public static function output_fields($options, $option_name = '') { |
|
| 276 | 276 | $current_tab = give_get_current_setting_tab(); |
| 277 | 277 | |
| 278 | 278 | // Field Default values. |
@@ -285,46 +285,46 @@ discard block |
||
| 285 | 285 | 'table_html' => true, |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | - foreach ( $options as $value ) { |
|
| 289 | - if ( ! isset( $value['type'] ) ) { |
|
| 288 | + foreach ($options as $value) { |
|
| 289 | + if ( ! isset($value['type'])) { |
|
| 290 | 290 | continue; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Set title. |
| 294 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
| 294 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
| 295 | 295 | |
| 296 | - $value = wp_parse_args( $value, $defaults ); |
|
| 296 | + $value = wp_parse_args($value, $defaults); |
|
| 297 | 297 | |
| 298 | 298 | // Custom attribute handling. |
| 299 | 299 | $custom_attributes = array(); |
| 300 | 300 | |
| 301 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
| 302 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
| 303 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
| 301 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
| 302 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
| 303 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // Description handling. |
| 308 | - $description = self::get_field_description( $value ); |
|
| 308 | + $description = self::get_field_description($value); |
|
| 309 | 309 | |
| 310 | 310 | // Switch based on type. |
| 311 | - switch ( $value['type'] ) { |
|
| 311 | + switch ($value['type']) { |
|
| 312 | 312 | |
| 313 | 313 | // Section Titles |
| 314 | 314 | case 'title': |
| 315 | - if ( ! empty( $value['title'] ) ) { |
|
| 316 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
| 315 | + if ( ! empty($value['title'])) { |
|
| 316 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if ( ! empty( $value['desc'] ) ) { |
|
| 320 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
| 319 | + if ( ! empty($value['desc'])) { |
|
| 320 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if ( $value['table_html'] ) { |
|
| 324 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
| 323 | + if ($value['table_html']) { |
|
| 324 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if ( ! empty( $value['id'] ) ) { |
|
| 327 | + if ( ! empty($value['id'])) { |
|
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * Trigger Action. |
@@ -333,14 +333,14 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @since 1.8 |
| 335 | 335 | */ |
| 336 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
| 336 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | break; |
| 340 | 340 | |
| 341 | 341 | // Section Ends. |
| 342 | 342 | case 'sectionend': |
| 343 | - if ( ! empty( $value['id'] ) ) { |
|
| 343 | + if ( ! empty($value['id'])) { |
|
| 344 | 344 | |
| 345 | 345 | /** |
| 346 | 346 | * Trigger Action. |
@@ -349,14 +349,14 @@ discard block |
||
| 349 | 349 | * |
| 350 | 350 | * @since 1.8 |
| 351 | 351 | */ |
| 352 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
| 352 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - if ( $value['table_html'] ) { |
|
| 355 | + if ($value['table_html']) { |
|
| 356 | 356 | echo '</table>'; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if ( ! empty( $value['id'] ) ) { |
|
| 359 | + if ( ! empty($value['id'])) { |
|
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | 362 | * Trigger Action. |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * |
| 366 | 366 | * @since 1.8 |
| 367 | 367 | */ |
| 368 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
| 368 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | break; |
@@ -377,22 +377,22 @@ discard block |
||
| 377 | 377 | case 'password' : |
| 378 | 378 | |
| 379 | 379 | $type = $value['type']; |
| 380 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 380 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 381 | 381 | |
| 382 | 382 | ?> |
| 383 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 383 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 384 | 384 | <th scope="row" class="titledesc"> |
| 385 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 385 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 386 | 386 | </th> |
| 387 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 387 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 388 | 388 | <input |
| 389 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 390 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 391 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 392 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 393 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
| 394 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 395 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 389 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 390 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 391 | + type="<?php echo esc_attr($type); ?>" |
|
| 392 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 393 | + value="<?php echo esc_attr($option_value); ?>" |
|
| 394 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 395 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 396 | 396 | /> <?php echo $description; ?> |
| 397 | 397 | </td> |
| 398 | 398 | </tr><?php |
@@ -401,23 +401,23 @@ discard block |
||
| 401 | 401 | // Textarea. |
| 402 | 402 | case 'textarea': |
| 403 | 403 | |
| 404 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 404 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 405 | 405 | |
| 406 | 406 | ?> |
| 407 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 407 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 408 | 408 | <th scope="row" class="titledesc"> |
| 409 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 409 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 410 | 410 | </th> |
| 411 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 411 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 412 | 412 | <textarea |
| 413 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 414 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 415 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 416 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 413 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 414 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 415 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 416 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 417 | 417 | rows="10" |
| 418 | 418 | cols="60" |
| 419 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 420 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
| 419 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 420 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
| 421 | 421 | <?php echo $description; ?> |
| 422 | 422 | </td> |
| 423 | 423 | </tr><?php |
@@ -427,35 +427,35 @@ discard block |
||
| 427 | 427 | case 'select' : |
| 428 | 428 | case 'multiselect' : |
| 429 | 429 | |
| 430 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 430 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 431 | 431 | |
| 432 | 432 | ?> |
| 433 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 433 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 434 | 434 | <th scope="row" class="titledesc"> |
| 435 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 435 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 436 | 436 | </th> |
| 437 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 437 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 438 | 438 | <select |
| 439 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
| 439 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
| 440 | 440 | echo '[]'; |
| 441 | 441 | } ?>" |
| 442 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 443 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 444 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 445 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 446 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
| 442 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 443 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 444 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 445 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 446 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
| 447 | 447 | > |
| 448 | 448 | |
| 449 | 449 | <?php |
| 450 | - if ( ! empty( $value['options'] ) ) { |
|
| 451 | - foreach ( $value['options'] as $key => $val ) { |
|
| 450 | + if ( ! empty($value['options'])) { |
|
| 451 | + foreach ($value['options'] as $key => $val) { |
|
| 452 | 452 | ?> |
| 453 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
| 453 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
| 454 | 454 | |
| 455 | - if ( is_array( $option_value ) ) { |
|
| 456 | - selected( in_array( $key, $option_value ), true ); |
|
| 455 | + if (is_array($option_value)) { |
|
| 456 | + selected(in_array($key, $option_value), true); |
|
| 457 | 457 | } else { |
| 458 | - selected( $option_value, $key ); |
|
| 458 | + selected($option_value, $key); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | ?>><?php echo $val ?></option> |
@@ -471,28 +471,28 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | // Radio inputs. |
| 473 | 473 | case 'radio_inline' : |
| 474 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
| 474 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
| 475 | 475 | case 'radio' : |
| 476 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 476 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 477 | 477 | ?> |
| 478 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 478 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 479 | 479 | <th scope="row" class="titledesc"> |
| 480 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 480 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 481 | 481 | </th> |
| 482 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 482 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 483 | 483 | <fieldset> |
| 484 | 484 | <ul> |
| 485 | 485 | <?php |
| 486 | - foreach ( $value['options'] as $key => $val ) { |
|
| 486 | + foreach ($value['options'] as $key => $val) { |
|
| 487 | 487 | ?> |
| 488 | 488 | <li> |
| 489 | 489 | <label><input |
| 490 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 490 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 491 | 491 | value="<?php echo $key; ?>" |
| 492 | 492 | type="radio" |
| 493 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 494 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 495 | - <?php checked( $key, $option_value ); ?> |
|
| 493 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 494 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 495 | + <?php checked($key, $option_value); ?> |
|
| 496 | 496 | /> <?php echo $val ?></label> |
| 497 | 497 | </li> |
| 498 | 498 | <?php |
@@ -506,21 +506,21 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | // Checkbox input. |
| 508 | 508 | case 'checkbox' : |
| 509 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 509 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 510 | 510 | ?> |
| 511 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 511 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 512 | 512 | <th scope="row" class="titledesc"> |
| 513 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 513 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 514 | 514 | </th> |
| 515 | 515 | <td class="give-forminp"> |
| 516 | 516 | <input |
| 517 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 518 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 517 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 518 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 519 | 519 | type="checkbox" |
| 520 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
| 520 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
| 521 | 521 | value="1" |
| 522 | - <?php checked( $option_value, 'on' ); ?> |
|
| 523 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 522 | + <?php checked($option_value, 'on'); ?> |
|
| 523 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 524 | 524 | /> |
| 525 | 525 | <?php echo $description; ?> |
| 526 | 526 | </td> |
@@ -530,28 +530,28 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | // Multi Checkbox input. |
| 532 | 532 | case 'multicheck' : |
| 533 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 534 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
| 533 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 534 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
| 535 | 535 | ?> |
| 536 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 536 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 537 | 537 | <th scope="row" class="titledesc"> |
| 538 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 538 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 539 | 539 | </th> |
| 540 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 540 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 541 | 541 | <fieldset> |
| 542 | 542 | <ul> |
| 543 | 543 | <?php |
| 544 | - foreach ( $value['options'] as $key => $val ) { |
|
| 544 | + foreach ($value['options'] as $key => $val) { |
|
| 545 | 545 | ?> |
| 546 | 546 | <li> |
| 547 | 547 | <label> |
| 548 | 548 | <input |
| 549 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
| 549 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
| 550 | 550 | value="<?php echo $key; ?>" |
| 551 | 551 | type="checkbox" |
| 552 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 553 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 554 | - <?php if ( in_array( $key, $option_value ) ) { |
|
| 552 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 553 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 554 | + <?php if (in_array($key, $option_value)) { |
|
| 555 | 555 | echo 'checked="checked"'; |
| 556 | 556 | } ?> |
| 557 | 557 | /> <?php echo $val ?> |
@@ -569,25 +569,25 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | // File input field. |
| 571 | 571 | case 'file' : |
| 572 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 572 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 573 | 573 | ?> |
| 574 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 574 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 575 | 575 | <th scope="row" class="titledesc"> |
| 576 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 576 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 577 | 577 | </th> |
| 578 | 578 | <td class="give-forminp"> |
| 579 | 579 | <div class="give-field-wrap"> |
| 580 | 580 | <label for="<?php echo $value['id'] ?>"> |
| 581 | 581 | <input |
| 582 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 583 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 582 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 583 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 584 | 584 | type="text" |
| 585 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
| 585 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
| 586 | 586 | value="<?php echo $option_value; ?>" |
| 587 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 588 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 587 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 588 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 589 | 589 | /> <input class="give-upload-button button" type="button" |
| 590 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
| 590 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
| 591 | 591 | <?php echo $description ?> |
| 592 | 592 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
| 593 | 593 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -602,17 +602,17 @@ discard block |
||
| 602 | 602 | // WordPress Editor. |
| 603 | 603 | case 'wysiwyg' : |
| 604 | 604 | // Get option value. |
| 605 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 605 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 606 | 606 | |
| 607 | 607 | // Get editor settings. |
| 608 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
| 608 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
| 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 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 612 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 613 | 613 | </th> |
| 614 | 614 | <td class="give-forminp"> |
| 615 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
| 615 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
| 616 | 616 | <?php echo $description; ?> |
| 617 | 617 | </td> |
| 618 | 618 | </tr><?php |
@@ -621,9 +621,9 @@ discard block |
||
| 621 | 621 | // Custom: System setting field. |
| 622 | 622 | case 'system_info' : |
| 623 | 623 | ?> |
| 624 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 624 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 625 | 625 | <th scope="row" class="titledesc"> |
| 626 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 626 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 627 | 627 | </th> |
| 628 | 628 | <td class="give-forminp"> |
| 629 | 629 | <?php give_system_info_callback(); ?> |
@@ -634,14 +634,14 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | // Custom: Default gateways setting field. |
| 636 | 636 | case 'default_gateway' : |
| 637 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 637 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 638 | 638 | ?> |
| 639 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 639 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 640 | 640 | <th scope="row" class="titledesc"> |
| 641 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 641 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 642 | 642 | </th> |
| 643 | 643 | <td class="give-forminp"> |
| 644 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
| 644 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
| 645 | 645 | <?php echo $description; ?> |
| 646 | 646 | </td> |
| 647 | 647 | </tr><?php |
@@ -649,14 +649,14 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | // Custom: Enable gateways setting field. |
| 651 | 651 | case 'enabled_gateways' : |
| 652 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 652 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 653 | 653 | ?> |
| 654 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 654 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 655 | 655 | <th scope="row" class="titledesc"> |
| 656 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 656 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 657 | 657 | </th> |
| 658 | 658 | <td class="give-forminp"> |
| 659 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
| 659 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
| 660 | 660 | <?php echo $description; ?> |
| 661 | 661 | </td> |
| 662 | 662 | </tr><?php |
@@ -665,9 +665,9 @@ discard block |
||
| 665 | 665 | // Custom: Email preview buttons field. |
| 666 | 666 | case 'email_preview_buttons' : |
| 667 | 667 | ?> |
| 668 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 668 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 669 | 669 | <th scope="row" class="titledesc"> |
| 670 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 670 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 671 | 671 | </th> |
| 672 | 672 | <td class="give-forminp"> |
| 673 | 673 | <?php give_email_preview_buttons_callback(); ?> |
@@ -684,22 +684,22 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | // Custom: Gateway API key. |
| 686 | 686 | case 'api_key' : |
| 687 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 688 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
| 687 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 688 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
| 689 | 689 | ?> |
| 690 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 690 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 691 | 691 | <th scope="row" class="titledesc"> |
| 692 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 692 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 693 | 693 | </th> |
| 694 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 694 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 695 | 695 | <input |
| 696 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 697 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 698 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 699 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 700 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
| 701 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 702 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 696 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 697 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 698 | + type="<?php echo esc_attr($type); ?>" |
|
| 699 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 700 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
| 701 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 702 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 703 | 703 | /> <?php echo $description; ?> |
| 704 | 704 | </td> |
| 705 | 705 | </tr><?php |
@@ -721,12 +721,12 @@ discard block |
||
| 721 | 721 | // Custom: Give Docs Link field type. |
| 722 | 722 | case 'give_docs_link' : |
| 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 | <td class="give-docs-link" colspan="2"> |
| 726 | 726 | <?php |
| 727 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
| 727 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
| 728 | 728 | . '" target="_blank">' |
| 729 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 729 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title']) |
|
| 730 | 730 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 731 | 731 | ?> |
| 732 | 732 | </td> |
@@ -737,8 +737,8 @@ discard block |
||
| 737 | 737 | // You can add or handle your custom field action. |
| 738 | 738 | default: |
| 739 | 739 | // Get option value. |
| 740 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 741 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
| 740 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 741 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
| 742 | 742 | break; |
| 743 | 743 | } |
| 744 | 744 | } |
@@ -754,15 +754,15 @@ discard block |
||
| 754 | 754 | * |
| 755 | 755 | * @return string The HTML description of the field. |
| 756 | 756 | */ |
| 757 | - public static function get_field_description( $value ) { |
|
| 757 | + public static function get_field_description($value) { |
|
| 758 | 758 | $description = ''; |
| 759 | 759 | |
| 760 | 760 | // Support for both 'description' and 'desc' args. |
| 761 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
| 762 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
| 761 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
| 762 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
| 763 | 763 | |
| 764 | - if ( ! empty( $value ) ) { |
|
| 765 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
| 764 | + if ( ! empty($value)) { |
|
| 765 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | return $description; |
@@ -779,11 +779,11 @@ discard block |
||
| 779 | 779 | * |
| 780 | 780 | * @return array The description and tip as a 2 element array |
| 781 | 781 | */ |
| 782 | - public static function get_field_title( $value ) { |
|
| 783 | - $title = esc_html( $value['title'] ); |
|
| 782 | + public static function get_field_title($value) { |
|
| 783 | + $title = esc_html($value['title']); |
|
| 784 | 784 | |
| 785 | 785 | // If html tag detected then allow them to print. |
| 786 | - if ( strip_tags( $title ) ) { |
|
| 786 | + if (strip_tags($title)) { |
|
| 787 | 787 | $title = $value['title']; |
| 788 | 788 | } |
| 789 | 789 | |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | * |
| 803 | 803 | * @return bool |
| 804 | 804 | */ |
| 805 | - public static function save_fields( $options, $option_name = '' ) { |
|
| 806 | - if ( empty( $_POST ) ) { |
|
| 805 | + public static function save_fields($options, $option_name = '') { |
|
| 806 | + if (empty($_POST)) { |
|
| 807 | 807 | return false; |
| 808 | 808 | } |
| 809 | 809 | |
@@ -811,37 +811,37 @@ discard block |
||
| 811 | 811 | $update_options = array(); |
| 812 | 812 | |
| 813 | 813 | // Loop options and get values to save. |
| 814 | - foreach ( $options as $option ) { |
|
| 815 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
| 814 | + foreach ($options as $option) { |
|
| 815 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
| 816 | 816 | continue; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | // Get posted value. |
| 820 | - if ( strstr( $option['id'], '[' ) ) { |
|
| 821 | - parse_str( $option['id'], $option_name_array ); |
|
| 822 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
| 823 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
| 824 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
| 820 | + if (strstr($option['id'], '[')) { |
|
| 821 | + parse_str($option['id'], $option_name_array); |
|
| 822 | + $field_option_name = current(array_keys($option_name_array)); |
|
| 823 | + $setting_name = key($option_name_array[$field_option_name]); |
|
| 824 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
| 825 | 825 | } else { |
| 826 | 826 | $field_option_name = $option['id']; |
| 827 | 827 | $setting_name = ''; |
| 828 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
| 828 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | // Format the value based on option type. |
| 832 | - switch ( $option['type'] ) { |
|
| 832 | + switch ($option['type']) { |
|
| 833 | 833 | case 'checkbox' : |
| 834 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
| 834 | + $value = is_null($raw_value) ? '' : 'on'; |
|
| 835 | 835 | break; |
| 836 | 836 | case 'wysiwyg' : |
| 837 | 837 | case 'textarea' : |
| 838 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
| 838 | + $value = wp_kses_post(trim($raw_value)); |
|
| 839 | 839 | break; |
| 840 | 840 | case 'multiselect' : |
| 841 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
| 841 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
| 842 | 842 | break; |
| 843 | 843 | default : |
| 844 | - $value = give_clean( $raw_value ); |
|
| 844 | + $value = give_clean($raw_value); |
|
| 845 | 845 | break; |
| 846 | 846 | } |
| 847 | 847 | |
@@ -850,37 +850,37 @@ discard block |
||
| 850 | 850 | * |
| 851 | 851 | * @since 1.8 |
| 852 | 852 | */ |
| 853 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
| 853 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
| 854 | 854 | |
| 855 | 855 | /** |
| 856 | 856 | * Sanitize the value of an option by option name. |
| 857 | 857 | * |
| 858 | 858 | * @since 1.8 |
| 859 | 859 | */ |
| 860 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
| 860 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
| 861 | 861 | |
| 862 | - if ( is_null( $value ) ) { |
|
| 862 | + if (is_null($value)) { |
|
| 863 | 863 | continue; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | // Check if option is an array and handle that differently to single values. |
| 867 | - if ( $field_option_name && $setting_name ) { |
|
| 868 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
| 869 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
| 867 | + if ($field_option_name && $setting_name) { |
|
| 868 | + if ( ! isset($update_options[$field_option_name])) { |
|
| 869 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
| 870 | 870 | } |
| 871 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
| 872 | - $update_options[ $field_option_name ] = array(); |
|
| 871 | + if ( ! is_array($update_options[$field_option_name])) { |
|
| 872 | + $update_options[$field_option_name] = array(); |
|
| 873 | 873 | } |
| 874 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
| 874 | + $update_options[$field_option_name][$setting_name] = $value; |
|
| 875 | 875 | } else { |
| 876 | - $update_options[ $field_option_name ] = $value; |
|
| 876 | + $update_options[$field_option_name] = $value; |
|
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | // Save all options in our array or there own option name i.e. option id. |
| 881 | - if ( empty( $option_name ) ) { |
|
| 882 | - foreach ( $update_options as $name => $value ) { |
|
| 883 | - update_option( $name, $value ); |
|
| 881 | + if (empty($option_name)) { |
|
| 882 | + foreach ($update_options as $name => $value) { |
|
| 883 | + update_option($name, $value); |
|
| 884 | 884 | |
| 885 | 885 | /** |
| 886 | 886 | * Trigger action. |
@@ -889,13 +889,13 @@ discard block |
||
| 889 | 889 | * |
| 890 | 890 | * @since 1.8 |
| 891 | 891 | */ |
| 892 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
| 892 | + do_action("give_save_option_{$name}", $value, $name); |
|
| 893 | 893 | } |
| 894 | 894 | } else { |
| 895 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
| 896 | - $update_options = array_merge( $old_options, $update_options ); |
|
| 895 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
| 896 | + $update_options = array_merge($old_options, $update_options); |
|
| 897 | 897 | |
| 898 | - update_option( $option_name, $update_options ); |
|
| 898 | + update_option($option_name, $update_options); |
|
| 899 | 899 | |
| 900 | 900 | /** |
| 901 | 901 | * Trigger action. |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | * |
| 905 | 905 | * @since 1.8 |
| 906 | 906 | */ |
| 907 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
| 907 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | return true; |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | 'disabled' => __( 'Disabled', 'give' ), |
| 87 | 87 | ) |
| 88 | 88 | ), |
| 89 | - array( |
|
| 90 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
| 91 | - 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
| 92 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
| 93 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
| 94 | - 'type' => 'give_docs_link', |
|
| 95 | - ), |
|
| 89 | + array( |
|
| 90 | + 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
| 91 | + 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
| 92 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
| 93 | + 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
| 94 | + 'type' => 'give_docs_link', |
|
| 95 | + ), |
|
| 96 | 96 | array( |
| 97 | 97 | 'type' => 'sectionend', |
| 98 | 98 | 'id' => 'give_title_gateway_settings_2', |
@@ -145,13 +145,13 @@ discard block |
||
| 145 | 145 | 'textarea_rows' => 6, |
| 146 | 146 | ) |
| 147 | 147 | ), |
| 148 | - array( |
|
| 149 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
| 150 | - 'id' => 'offline_gateway_settings_docs_link', |
|
| 151 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
| 152 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
| 153 | - 'type' => 'give_docs_link', |
|
| 154 | - ), |
|
| 148 | + array( |
|
| 149 | + 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
| 150 | + 'id' => 'offline_gateway_settings_docs_link', |
|
| 151 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
| 152 | + 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
| 153 | + 'type' => 'give_docs_link', |
|
| 154 | + ), |
|
| 155 | 155 | array( |
| 156 | 156 | 'type' => 'sectionend', |
| 157 | 157 | 'id' => 'give_title_gateway_settings_3', |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | 'id' => 'default_gateway', |
| 190 | 190 | 'type' => 'default_gateway' |
| 191 | 191 | ), |
| 192 | - array( |
|
| 193 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
| 194 | - 'id' => 'gateway_settings_docs_link', |
|
| 195 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
| 196 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
| 197 | - 'type' => 'give_docs_link', |
|
| 198 | - ), |
|
| 192 | + array( |
|
| 193 | + 'name' => __( 'Gateways Docs Link', 'give' ), |
|
| 194 | + 'id' => 'gateway_settings_docs_link', |
|
| 195 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
| 196 | + 'title' => __( 'Gateway Settings', 'give' ), |
|
| 197 | + 'type' => 'give_docs_link', |
|
| 198 | + ), |
|
| 199 | 199 | array( |
| 200 | 200 | 'id' => 'give_title_gateway_settings_1', |
| 201 | 201 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Gateways. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'gateways'; |
| 30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
| 30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | $this->default_tab = 'gateways-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 'paypal-standard': |
| 49 | 49 | $settings = array( |
| 50 | 50 | // Section 2: PayPal Standard. |
@@ -53,44 +53,44 @@ discard block |
||
| 53 | 53 | 'id' => 'give_title_gateway_settings_2', |
| 54 | 54 | ), |
| 55 | 55 | array( |
| 56 | - 'name' => __( 'PayPal Email', 'give' ), |
|
| 57 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
| 56 | + 'name' => __('PayPal Email', 'give'), |
|
| 57 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
| 58 | 58 | 'id' => 'paypal_email', |
| 59 | 59 | 'type' => 'email', |
| 60 | 60 | ), |
| 61 | 61 | array( |
| 62 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
| 63 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
| 62 | + 'name' => __('PayPal Page Style', 'give'), |
|
| 63 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
| 64 | 64 | 'id' => 'paypal_page_style', |
| 65 | 65 | 'type' => 'text', |
| 66 | 66 | ), |
| 67 | 67 | array( |
| 68 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
| 69 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
| 68 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
| 69 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
| 70 | 70 | 'id' => 'paypal_button_type', |
| 71 | 71 | 'type' => 'radio_inline', |
| 72 | 72 | 'options' => array( |
| 73 | - 'donation' => __( 'Donation', 'give' ), |
|
| 74 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
| 73 | + 'donation' => __('Donation', 'give'), |
|
| 74 | + 'standard' => __('Standard Transaction', 'give') |
|
| 75 | 75 | ), |
| 76 | 76 | 'default' => 'donation', |
| 77 | 77 | ), |
| 78 | 78 | array( |
| 79 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
| 80 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
| 79 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
| 80 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
| 81 | 81 | 'id' => 'paypal_verification', |
| 82 | 82 | 'type' => 'radio_inline', |
| 83 | 83 | 'default' => 'enabled', |
| 84 | 84 | 'options' => array( |
| 85 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 86 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 85 | + 'enabled' => __('Enabled', 'give'), |
|
| 86 | + 'disabled' => __('Disabled', 'give'), |
|
| 87 | 87 | ) |
| 88 | 88 | ), |
| 89 | 89 | array( |
| 90 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
| 90 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
| 91 | 91 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
| 92 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
| 93 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
| 92 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
| 93 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
| 94 | 94 | 'type' => 'give_docs_link', |
| 95 | 95 | ), |
| 96 | 96 | array( |
@@ -108,19 +108,19 @@ discard block |
||
| 108 | 108 | 'id' => 'give_title_gateway_settings_3', |
| 109 | 109 | ), |
| 110 | 110 | array( |
| 111 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
| 112 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
| 111 | + 'name' => __('Collect Billing Details', 'give'), |
|
| 112 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
| 113 | 113 | 'id' => 'give_offline_donation_enable_billing_fields', |
| 114 | 114 | 'type' => 'radio_inline', |
| 115 | 115 | 'default' => 'disabled', |
| 116 | 116 | 'options' => array( |
| 117 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 118 | - 'disabled' => __( 'Disabled', 'give' ) |
|
| 117 | + 'enabled' => __('Enabled', 'give'), |
|
| 118 | + 'disabled' => __('Disabled', 'give') |
|
| 119 | 119 | ) |
| 120 | 120 | ), |
| 121 | 121 | array( |
| 122 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
| 123 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
| 122 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
| 123 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
| 124 | 124 | 'id' => 'global_offline_donation_content', |
| 125 | 125 | 'default' => give_get_default_offline_donation_content(), |
| 126 | 126 | 'type' => 'wysiwyg', |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | ) |
| 130 | 130 | ), |
| 131 | 131 | array( |
| 132 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
| 133 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
| 132 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
| 133 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
| 134 | 134 | 'id' => 'offline_donation_subject', |
| 135 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
| 135 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
| 136 | 136 | 'type' => 'text' |
| 137 | 137 | ), |
| 138 | 138 | array( |
| 139 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
| 140 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
| 139 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
| 140 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
| 141 | 141 | 'id' => 'global_offline_donation_email', |
| 142 | 142 | 'default' => give_get_default_offline_donation_email_content(), |
| 143 | 143 | 'type' => 'wysiwyg', |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | ) |
| 147 | 147 | ), |
| 148 | 148 | array( |
| 149 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
| 149 | + 'name' => __('Offline Donations Settings Docs Link', 'give'), |
|
| 150 | 150 | 'id' => 'offline_gateway_settings_docs_link', |
| 151 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
| 152 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
| 151 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'), |
|
| 152 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
| 153 | 153 | 'type' => 'give_docs_link', |
| 154 | 154 | ), |
| 155 | 155 | array( |
@@ -167,33 +167,33 @@ discard block |
||
| 167 | 167 | 'type' => 'title' |
| 168 | 168 | ), |
| 169 | 169 | array( |
| 170 | - 'name' => __( 'Test Mode', 'give' ), |
|
| 171 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
| 170 | + 'name' => __('Test Mode', 'give'), |
|
| 171 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
| 172 | 172 | 'id' => 'test_mode', |
| 173 | 173 | 'type' => 'radio_inline', |
| 174 | 174 | 'default' => 'disabled', |
| 175 | 175 | 'options' => array( |
| 176 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 177 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 176 | + 'enabled' => __('Enabled', 'give'), |
|
| 177 | + 'disabled' => __('Disabled', 'give'), |
|
| 178 | 178 | ) |
| 179 | 179 | ), |
| 180 | 180 | array( |
| 181 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
| 182 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
| 181 | + 'name' => __('Enabled Gateways', 'give'), |
|
| 182 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
| 183 | 183 | 'id' => 'gateways', |
| 184 | 184 | 'type' => 'enabled_gateways' |
| 185 | 185 | ), |
| 186 | 186 | array( |
| 187 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 188 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
| 187 | + 'name' => __('Default Gateway', 'give'), |
|
| 188 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
| 189 | 189 | 'id' => 'default_gateway', |
| 190 | 190 | 'type' => 'default_gateway' |
| 191 | 191 | ), |
| 192 | 192 | array( |
| 193 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
| 193 | + 'name' => __('Gateways Docs Link', 'give'), |
|
| 194 | 194 | 'id' => 'gateway_settings_docs_link', |
| 195 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
| 196 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
| 195 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
| 196 | + 'title' => __('Gateway Settings', 'give'), |
|
| 197 | 197 | 'type' => 'give_docs_link', |
| 198 | 198 | ), |
| 199 | 199 | array( |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * Filter the payment gateways settings. |
| 209 | 209 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 210 | 210 | */ |
| 211 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
| 211 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * Filter the settings. |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @param array $settings |
| 219 | 219 | */ |
| 220 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 220 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 221 | 221 | |
| 222 | 222 | // Output. |
| 223 | 223 | return $settings; |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function get_sections() { |
| 233 | 233 | $sections = array( |
| 234 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
| 235 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
| 236 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
| 234 | + 'gateways-settings' => __('Gateways', 'give'), |
|
| 235 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
| 236 | + 'offline-donations' => __('Offline Donations', 'give') |
|
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 239 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) : |
|
| 12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * This class loads the cmb2 settings. |
@@ -52,30 +52,30 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | // Get current tab. |
| 54 | 54 | $this->current_tab = give_get_current_setting_tab(); |
| 55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] ); |
|
| 55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']); |
|
| 56 | 56 | |
| 57 | 57 | // Tab ID. |
| 58 | 58 | $this->id = $this->current_tab; |
| 59 | 59 | |
| 60 | 60 | // Add addon tabs. |
| 61 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 ); |
|
| 61 | + add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); |
|
| 62 | 62 | |
| 63 | 63 | // Add save hook to addons. |
| 64 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 ); |
|
| 64 | + add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); |
|
| 65 | 65 | |
| 66 | 66 | // Add backward compatibility filters plugin settings. |
| 67 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' ); |
|
| 67 | + $setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); |
|
| 68 | 68 | |
| 69 | 69 | // Filter Payment Gateways settings. |
| 70 | - if ( in_array( $this->current_tab, $setting_tabs ) ) { |
|
| 71 | - add_filter( "give_get_settings_{$this->current_tab}", array( |
|
| 70 | + if (in_array($this->current_tab, $setting_tabs)) { |
|
| 71 | + add_filter("give_get_settings_{$this->current_tab}", array( |
|
| 72 | 72 | $this, |
| 73 | 73 | 'get_filtered_addon_settings', |
| 74 | - ), 999999, 1 ); |
|
| 75 | - add_filter( "give_get_sections_{$this->current_tab}", array( |
|
| 74 | + ), 999999, 1); |
|
| 75 | + add_filter("give_get_sections_{$this->current_tab}", array( |
|
| 76 | 76 | $this, |
| 77 | 77 | 'get_filtered_addon_sections', |
| 78 | - ), 999999, 1 ); |
|
| 78 | + ), 999999, 1); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string |
| 90 | 90 | */ |
| 91 | - function set_default_setting_tab( $setting_tab ) { |
|
| 91 | + function set_default_setting_tab($setting_tab) { |
|
| 92 | 92 | $default_tab = ''; |
| 93 | 93 | |
| 94 | 94 | // Set default tab to first setting tab. |
| 95 | - if ( $sections = array_keys( $this->get_sections() ) ) { |
|
| 96 | - $default_tab = current( $sections ); |
|
| 95 | + if ($sections = array_keys($this->get_sections())) { |
|
| 96 | + $default_tab = current($sections); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $default_tab; |
@@ -108,29 +108,29 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return mixed |
| 110 | 110 | */ |
| 111 | - function add_addon_settings_page( $pages ) { |
|
| 111 | + function add_addon_settings_page($pages) { |
|
| 112 | 112 | // Previous setting page. |
| 113 | 113 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
| 114 | 114 | |
| 115 | 115 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
| 116 | - unset( $previous_pages['api'] ); |
|
| 117 | - unset( $previous_pages['system_info'] ); |
|
| 116 | + unset($previous_pages['api']); |
|
| 117 | + unset($previous_pages['system_info']); |
|
| 118 | 118 | |
| 119 | 119 | // Tab is not register. |
| 120 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) ); |
|
| 120 | + $pages_diff = array_keys(array_diff($previous_pages, $pages)); |
|
| 121 | 121 | |
| 122 | 122 | // Merge old settings with new settings. |
| 123 | - $pages = array_merge( $pages, $previous_pages ); |
|
| 123 | + $pages = array_merge($pages, $previous_pages); |
|
| 124 | 124 | |
| 125 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
| 125 | + if (in_array($this->current_tab, $pages_diff)) { |
|
| 126 | 126 | // Filter & actions. |
| 127 | - add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( |
|
| 127 | + add_filter("give_default_setting_tab_section_{$this->current_tab}", array( |
|
| 128 | 128 | $this, |
| 129 | 129 | 'set_default_setting_tab', |
| 130 | - ), 10 ); |
|
| 131 | - add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); |
|
| 132 | - add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); |
|
| 133 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
| 130 | + ), 10); |
|
| 131 | + add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); |
|
| 132 | + add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); |
|
| 133 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | return $pages; |
@@ -146,29 +146,29 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @return mixed |
| 148 | 148 | */ |
| 149 | - function setup_addon_save_hook( $pages ) { |
|
| 149 | + function setup_addon_save_hook($pages) { |
|
| 150 | 150 | $page_ids = array(); |
| 151 | 151 | |
| 152 | - foreach ( $pages as $page ) { |
|
| 153 | - $page_ids = $page->add_settings_page( $page_ids ); |
|
| 152 | + foreach ($pages as $page) { |
|
| 153 | + $page_ids = $page->add_settings_page($page_ids); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // Previous setting page. |
| 157 | 157 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
| 158 | 158 | |
| 159 | 159 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
| 160 | - unset( $previous_pages['api'] ); |
|
| 161 | - unset( $previous_pages['system_info'] ); |
|
| 160 | + unset($previous_pages['api']); |
|
| 161 | + unset($previous_pages['system_info']); |
|
| 162 | 162 | |
| 163 | 163 | // Tab is not register. |
| 164 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) ); |
|
| 164 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids)); |
|
| 165 | 165 | |
| 166 | 166 | // Merge old settings with new settings. |
| 167 | - $pages = array_merge( $page_ids, $previous_pages ); |
|
| 167 | + $pages = array_merge($page_ids, $previous_pages); |
|
| 168 | 168 | |
| 169 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
| 169 | + if (in_array($this->current_tab, $pages_diff)) { |
|
| 170 | 170 | // Filter & actions. |
| 171 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
| 171 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return $pages; |
@@ -183,16 +183,16 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @return string |
| 185 | 185 | */ |
| 186 | - function get_section_name( $field_name ) { |
|
| 186 | + function get_section_name($field_name) { |
|
| 187 | 187 | // Bailout. |
| 188 | - if ( empty( $field_name ) ) { |
|
| 188 | + if (empty($field_name)) { |
|
| 189 | 189 | return $field_name; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $section_name = explode( ' ', $field_name ); |
|
| 192 | + $section_name = explode(' ', $field_name); |
|
| 193 | 193 | |
| 194 | 194 | // Output. |
| 195 | - return strip_tags( implode( ' ', $section_name ) ); |
|
| 195 | + return strip_tags(implode(' ', $section_name)); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return mixed |
| 209 | 209 | */ |
| 210 | - public function en_translation( $translation, $text ) { |
|
| 210 | + public function en_translation($translation, $text) { |
|
| 211 | 211 | return $text; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -221,52 +221,52 @@ discard block |
||
| 221 | 221 | * |
| 222 | 222 | * @return mixed |
| 223 | 223 | */ |
| 224 | - function get_filtered_addon_sections( $sections = array() ) { |
|
| 224 | + function get_filtered_addon_sections($sections = array()) { |
|
| 225 | 225 | // New sections. |
| 226 | 226 | $new_sections = array(); |
| 227 | - $sections_ID = array_keys( $sections ); |
|
| 228 | - $setting_fields = $this->prev_settings->give_settings( $this->current_tab ); |
|
| 227 | + $sections_ID = array_keys($sections); |
|
| 228 | + $setting_fields = $this->prev_settings->give_settings($this->current_tab); |
|
| 229 | 229 | |
| 230 | 230 | // We need untranslated settings for backward compatibility. |
| 231 | - add_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 ); |
|
| 232 | - $en_setting_fields = $this->prev_settings->give_settings( $this->current_tab ); |
|
| 233 | - remove_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 ); |
|
| 231 | + add_filter('gettext', array($this, 'en_translation'), 10, 2); |
|
| 232 | + $en_setting_fields = $this->prev_settings->give_settings($this->current_tab); |
|
| 233 | + remove_filter('gettext', array($this, 'en_translation'), 10, 2); |
|
| 234 | 234 | |
| 235 | - if ( ! empty( $setting_fields ) && ! empty( $setting_fields['fields'] ) ) { |
|
| 235 | + if ( ! empty($setting_fields) && ! empty($setting_fields['fields'])) { |
|
| 236 | 236 | |
| 237 | - foreach ( $setting_fields['fields'] as $index => $field ) { |
|
| 237 | + foreach ($setting_fields['fields'] as $index => $field) { |
|
| 238 | 238 | // Collect new sections from addons. |
| 239 | - if ( 'give_title' !== $field['type'] ) { |
|
| 239 | + if ('give_title' !== $field['type']) { |
|
| 240 | 240 | continue; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Untranslated setting name. |
| 244 | - $en_setting_field_name = isset( $en_setting_fields['fields'][ $index ]['name'] ) ? $en_setting_fields['fields'][ $index ]['name'] : ''; |
|
| 244 | + $en_setting_field_name = isset($en_setting_fields['fields'][$index]['name']) ? $en_setting_fields['fields'][$index]['name'] : ''; |
|
| 245 | 245 | |
| 246 | 246 | // Section name. |
| 247 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : ''; |
|
| 248 | - $section_name = $this->get_section_name( $field['name'] ); |
|
| 247 | + $field['name'] = isset($field['name']) ? $field['name'] : ''; |
|
| 248 | + $section_name = $this->get_section_name($field['name']); |
|
| 249 | 249 | |
| 250 | 250 | // Check if section name exit and section title array is not empty. |
| 251 | - if ( ! empty( $sections ) && ! empty( $en_setting_field_name ) ) { |
|
| 251 | + if ( ! empty($sections) && ! empty($en_setting_field_name)) { |
|
| 252 | 252 | |
| 253 | 253 | // Bailout: Do not load section if it is already exist. |
| 254 | 254 | if ( |
| 255 | - in_array( sanitize_title( $en_setting_field_name ), $sections_ID ) // Check section id. |
|
| 256 | - || in_array( $section_name, $sections ) // Check section name. |
|
| 255 | + in_array(sanitize_title($en_setting_field_name), $sections_ID) // Check section id. |
|
| 256 | + || in_array($section_name, $sections) // Check section name. |
|
| 257 | 257 | ) { |
| 258 | 258 | continue; |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // Collect new sections from addons. |
| 263 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name; |
|
| 263 | + $new_sections[sanitize_title($field['name'])] = $section_name; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // Add new section. |
| 268 | - if ( ! empty( $new_sections ) ) { |
|
| 269 | - $sections = array_merge( $sections, $new_sections ); |
|
| 268 | + if ( ! empty($new_sections)) { |
|
| 269 | + $sections = array_merge($sections, $new_sections); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // Output. |
@@ -284,19 +284,19 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @return array |
| 286 | 286 | */ |
| 287 | - function get_filtered_addon_settings( $settings, $setting_fields = array() ) { |
|
| 287 | + function get_filtered_addon_settings($settings, $setting_fields = array()) { |
|
| 288 | 288 | global $wp_filter; |
| 289 | 289 | |
| 290 | 290 | $new_setting_fields = array(); |
| 291 | 291 | |
| 292 | - if ( ! empty( $settings ) ) { |
|
| 292 | + if ( ! empty($settings)) { |
|
| 293 | 293 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ). |
| 294 | - if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { |
|
| 295 | - foreach ( $settings as $setting ) { |
|
| 294 | + if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { |
|
| 295 | + foreach ($settings as $setting) { |
|
| 296 | 296 | $new_setting_fields[] = $setting; |
| 297 | 297 | |
| 298 | 298 | // We need setting only till first section end. |
| 299 | - if ( 'sectionend' === $setting['type'] ) { |
|
| 299 | + if ('sectionend' === $setting['type']) { |
|
| 300 | 300 | break; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -308,24 +308,24 @@ discard block |
||
| 308 | 308 | $prev_title_field_id = ''; |
| 309 | 309 | |
| 310 | 310 | // Create new setting fields. |
| 311 | - foreach ( $settings as $index => $field ) { |
|
| 311 | + foreach ($settings as $index => $field) { |
|
| 312 | 312 | |
| 313 | 313 | // Bailout: Must need field type to process. |
| 314 | - if ( ! isset( $field['type'] ) ) { |
|
| 314 | + if ( ! isset($field['type'])) { |
|
| 315 | 315 | continue; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // Set wrapper class if any. |
| 319 | - if ( ! empty( $field['row_classes'] ) ) { |
|
| 319 | + if ( ! empty($field['row_classes'])) { |
|
| 320 | 320 | $field['wrapper_class'] = $field['row_classes']; |
| 321 | - unset( $field['row_classes'] ); |
|
| 321 | + unset($field['row_classes']); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name']; |
|
| 325 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc']; |
|
| 324 | + $field['name'] = ! isset($field['name']) ? '' : $field['name']; |
|
| 325 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc']; |
|
| 326 | 326 | |
| 327 | 327 | // Modify cmb2 setting fields. |
| 328 | - switch ( $field['type'] ) { |
|
| 328 | + switch ($field['type']) { |
|
| 329 | 329 | case 'text' : |
| 330 | 330 | case 'file' : |
| 331 | 331 | $field['css'] = 'width:25em;'; |
@@ -349,18 +349,18 @@ discard block |
||
| 349 | 349 | $field['type'] = 'title'; |
| 350 | 350 | |
| 351 | 351 | // Since we are showing sections, so there now ned to show horizontal rules. |
| 352 | - if ( '<hr>' === $field['desc'] ) { |
|
| 352 | + if ('<hr>' === $field['desc']) { |
|
| 353 | 353 | $field['desc'] = ''; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | break; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if ( 'title' === $field['type'] ) { |
|
| 359 | + if ('title' === $field['type']) { |
|
| 360 | 360 | |
| 361 | 361 | // If we do not have first element as title then these field will be skip from frontend |
| 362 | 362 | // because there are not belong to any section, so put all abandon fields under first section. |
| 363 | - if ( $index && empty( $prev_title_field_id ) ) { |
|
| 363 | + if ($index && empty($prev_title_field_id)) { |
|
| 364 | 364 | array_unshift( |
| 365 | 365 | $new_setting_fields, |
| 366 | 366 | array( |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $prev_title_field_id = $field['id']; |
| 375 | 375 | |
| 376 | 376 | continue; |
| 377 | - } elseif ( $index ) { |
|
| 377 | + } elseif ($index) { |
|
| 378 | 378 | // Section end. |
| 379 | 379 | $new_setting_fields[] = array( |
| 380 | 380 | 'type' => 'sectionend', |
@@ -406,52 +406,52 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | // Check if setting page has title section or not. |
| 408 | 408 | // If setting page does not have title section then add title section to it and fix section end array id. |
| 409 | - if ( 'title' !== $new_setting_fields[0]['type'] ) { |
|
| 409 | + if ('title' !== $new_setting_fields[0]['type']) { |
|
| 410 | 410 | array_unshift( |
| 411 | 411 | $new_setting_fields, |
| 412 | 412 | array( |
| 413 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ), |
|
| 413 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''), |
|
| 414 | 414 | 'type' => 'title', |
| 415 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '', |
|
| 416 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ), |
|
| 415 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '', |
|
| 416 | + 'id' => (isset($settings['id']) ? $settings['id'] : ''), |
|
| 417 | 417 | ) |
| 418 | 418 | ); |
| 419 | 419 | |
| 420 | 420 | // Update id in section end array if does not contain. |
| 421 | - if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { |
|
| 422 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' ); |
|
| 421 | + if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { |
|
| 422 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : ''); |
|
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | // Return only section related settings. |
| 427 | - if ( $sections = $this->get_filtered_addon_sections() ) { |
|
| 428 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields ); |
|
| 427 | + if ($sections = $this->get_filtered_addon_sections()) { |
|
| 428 | + $new_setting_fields = $this->get_section_settings($new_setting_fields); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // Third party plugin backward compatibility. |
| 432 | - $wp_filter_keys = array_keys( $wp_filter ); |
|
| 433 | - foreach ( $new_setting_fields as $index => $field ) { |
|
| 434 | - if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { |
|
| 432 | + $wp_filter_keys = array_keys($wp_filter); |
|
| 433 | + foreach ($new_setting_fields as $index => $field) { |
|
| 434 | + if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) { |
|
| 435 | 435 | continue; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | $cmb2_filter_name = "cmb2_render_{$field['type']}"; |
| 439 | 439 | |
| 440 | - if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) { |
|
| 440 | + if (in_array($cmb2_filter_name, $wp_filter_keys)) { |
|
| 441 | 441 | |
| 442 | - if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) { |
|
| 443 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks ); |
|
| 442 | + if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) { |
|
| 443 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks); |
|
| 444 | 444 | } else { |
| 445 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] ); |
|
| 445 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if ( ! empty( $cmb2_filter_arr ) ) { |
|
| 448 | + if ( ! empty($cmb2_filter_arr)) { |
|
| 449 | 449 | // Note: function can be called either globally or with class object, it depends on how developer invoke it. |
| 450 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr ); |
|
| 451 | - add_action( "give_admin_field_{$field['type']}", array( |
|
| 450 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr); |
|
| 451 | + add_action("give_admin_field_{$field['type']}", array( |
|
| 452 | 452 | $this, |
| 453 | 453 | 'addon_setting_field', |
| 454 | - ), 10, 2 ); |
|
| 454 | + ), 10, 2); |
|
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | } |
@@ -472,31 +472,31 @@ discard block |
||
| 472 | 472 | * |
| 473 | 473 | * @return array |
| 474 | 474 | */ |
| 475 | - function get_section_settings( $tab_settings ) { |
|
| 475 | + function get_section_settings($tab_settings) { |
|
| 476 | 476 | $current_section = give_get_current_setting_section(); |
| 477 | 477 | |
| 478 | 478 | // Note: If we are opening default tab for addon setting then it is possible that we will get empty string as current section |
| 479 | 479 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section |
| 480 | 480 | // This is hack to fix this. |
| 481 | - if ( empty( $current_section ) ) { |
|
| 482 | - $current_section = $this->set_default_setting_tab( $current_section ); |
|
| 481 | + if (empty($current_section)) { |
|
| 482 | + $current_section = $this->set_default_setting_tab($current_section); |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $section_start = false; |
| 486 | 486 | $section_end = false; |
| 487 | 487 | $section_only_setting_fields = array(); |
| 488 | 488 | |
| 489 | - foreach ( $tab_settings as $field ) { |
|
| 490 | - if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { |
|
| 489 | + foreach ($tab_settings as $field) { |
|
| 490 | + if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { |
|
| 491 | 491 | $section_start = true; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - if ( ! $section_start || $section_end ) { |
|
| 494 | + if ( ! $section_start || $section_end) { |
|
| 495 | 495 | continue; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - if ( $section_start && ! $section_end ) { |
|
| 499 | - if ( 'sectionend' == $field['type'] ) { |
|
| 498 | + if ($section_start && ! $section_end) { |
|
| 499 | + if ('sectionend' == $field['type']) { |
|
| 500 | 500 | $section_end = true; |
| 501 | 501 | } |
| 502 | 502 | $section_only_setting_fields[] = $field; |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | // Remove title from setting, prevent it from render in setting tab. |
| 507 | 507 | $section_only_setting_fields[0]['title'] = ''; |
| 508 | 508 | |
| 509 | - return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); |
|
| 509 | + return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | |
@@ -520,17 +520,17 @@ discard block |
||
| 520 | 520 | * |
| 521 | 521 | * @return void |
| 522 | 522 | */ |
| 523 | - function addon_setting_field( $field, $saved_value ) { |
|
| 523 | + function addon_setting_field($field, $saved_value) { |
|
| 524 | 524 | // Create object for cmb2 function callback backward compatibility. |
| 525 | 525 | // Note: Do not call any cmb2 function on these objects |
| 526 | - $field_obj = (object) array( 'args' => $field ); |
|
| 527 | - $field_type_obj = (object) array( 'field' => $field_obj ); |
|
| 526 | + $field_obj = (object) array('args' => $field); |
|
| 527 | + $field_type_obj = (object) array('field' => $field_obj); |
|
| 528 | 528 | |
| 529 | - switch ( $this->current_tab ) : |
|
| 529 | + switch ($this->current_tab) : |
|
| 530 | 530 | case 'licenses': |
| 531 | 531 | ?> |
| 532 | 532 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>"> |
| 533 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?> |
|
| 533 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?> |
|
| 534 | 534 | </div> |
| 535 | 535 | <?php break; |
| 536 | 536 | |
@@ -538,22 +538,22 @@ discard block |
||
| 538 | 538 | $colspan = 'colspan="2"'; |
| 539 | 539 | ?> |
| 540 | 540 | <tr valign="top"> |
| 541 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?> |
|
| 541 | + <?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> |
|
| 542 | 542 | <th scope="row" class="titledesc"> |
| 543 | 543 | <label |
| 544 | - for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label> |
|
| 544 | + for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label> |
|
| 545 | 545 | </th> |
| 546 | 546 | <?php $colspan = ''; ?> |
| 547 | 547 | <?php endif; ?> |
| 548 | 548 | <td class="give-forminp" <?php echo $colspan; ?>> |
| 549 | 549 | <?php |
| 550 | - if ( is_array( $field['func']['function'] ) ) { |
|
| 550 | + if (is_array($field['func']['function'])) { |
|
| 551 | 551 | $classname = $field['func']['function'][0]; |
| 552 | 552 | $function_name = $field['func']['function'][1]; |
| 553 | - $classname->$function_name( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
| 553 | + $classname->$function_name($field_obj, $saved_value, '', '', $field_type_obj); |
|
| 554 | 554 | } else { |
| 555 | 555 | $function_name = $field['func']['function']; |
| 556 | - $function_name( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
| 556 | + $function_name($field_obj, $saved_value, '', '', $field_type_obj); |
|
| 557 | 557 | } |
| 558 | 558 | ?> |
| 559 | 559 | </td> |
@@ -571,10 +571,10 @@ discard block |
||
| 571 | 571 | public function get_sections() { |
| 572 | 572 | $sections = array(); |
| 573 | 573 | |
| 574 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
| 575 | - foreach ( $setting_fields['fields'] as $field ) { |
|
| 576 | - if ( 'give_title' == $field['type'] ) { |
|
| 577 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] ); |
|
| 574 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
| 575 | + foreach ($setting_fields['fields'] as $field) { |
|
| 576 | + if ('give_title' == $field['type']) { |
|
| 577 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']); |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | } |
@@ -594,16 +594,16 @@ discard block |
||
| 594 | 594 | |
| 595 | 595 | $new_setting_fields = array(); |
| 596 | 596 | |
| 597 | - if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { |
|
| 598 | - if ( isset( $setting_fields['fields'] ) ) { |
|
| 597 | + if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { |
|
| 598 | + if (isset($setting_fields['fields'])) { |
|
| 599 | 599 | |
| 600 | 600 | $tab_data = array( |
| 601 | 601 | 'id' => $setting_fields['id'], |
| 602 | 602 | 'give_title' => $setting_fields['give_title'], |
| 603 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ), |
|
| 603 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''), |
|
| 604 | 604 | ); |
| 605 | 605 | |
| 606 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data ); |
|
| 606 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data); |
|
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | 609 | |
@@ -620,24 +620,24 @@ discard block |
||
| 620 | 620 | $sections = $this->get_sections(); |
| 621 | 621 | |
| 622 | 622 | // Show section settings only if setting section exist. |
| 623 | - if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) { |
|
| 624 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
| 623 | + if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) { |
|
| 624 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
| 625 | 625 | $GLOBALS['give_hide_save_button'] = true; |
| 626 | 626 | |
| 627 | 627 | return; |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | // Bailout. |
| 631 | - if ( empty( $sections ) ) { |
|
| 631 | + if (empty($sections)) { |
|
| 632 | 632 | return; |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | echo '<ul class="subsubsub">'; |
| 636 | 636 | |
| 637 | - $array_keys = array_keys( $sections ); |
|
| 637 | + $array_keys = array_keys($sections); |
|
| 638 | 638 | |
| 639 | - foreach ( $sections as $id => $label ) { |
|
| 640 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
| 639 | + foreach ($sections as $id => $label) { |
|
| 640 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | echo '</ul><br class="clear" /><hr>'; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | public function output() { |
| 653 | 653 | $settings = $this->get_settings(); |
| 654 | 654 | |
| 655 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 655 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | /** |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | public function save() { |
| 665 | 665 | $settings = $this->get_settings(); |
| 666 | 666 | |
| 667 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
| 667 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
| 668 | 668 | } |
| 669 | 669 | } |
| 670 | 670 | endif; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | case version_compare( $give_version, '1.7', '<' ) : |
| 43 | 43 | give_v17_upgrades(); |
| 44 | 44 | $did_upgrade = true; |
| 45 | - break; |
|
| 45 | + break; |
|
| 46 | 46 | |
| 47 | 47 | case version_compare( $give_version, '1.8', '<' ) : |
| 48 | 48 | give_v18_upgrades(); |
@@ -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 | |
@@ -25,37 +25,37 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_do_automatic_upgrades() { |
| 27 | 27 | $did_upgrade = false; |
| 28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
| 28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
| 29 | 29 | |
| 30 | - if ( ! $give_version ) { |
|
| 30 | + if ( ! $give_version) { |
|
| 31 | 31 | // 1.0 is the first version to use this option so we must add it. |
| 32 | 32 | $give_version = '1.0'; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - switch ( true ) { |
|
| 35 | + switch (true) { |
|
| 36 | 36 | |
| 37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
| 37 | + case version_compare($give_version, '1.6', '<') : |
|
| 38 | 38 | give_v16_upgrades(); |
| 39 | 39 | $did_upgrade = true; |
| 40 | 40 | break; |
| 41 | 41 | |
| 42 | - case version_compare( $give_version, '1.7', '<' ) : |
|
| 42 | + case version_compare($give_version, '1.7', '<') : |
|
| 43 | 43 | give_v17_upgrades(); |
| 44 | 44 | $did_upgrade = true; |
| 45 | 45 | break; |
| 46 | 46 | |
| 47 | - case version_compare( $give_version, '1.8', '<' ) : |
|
| 47 | + case version_compare($give_version, '1.8', '<') : |
|
| 48 | 48 | give_v18_upgrades(); |
| 49 | 49 | $did_upgrade = true; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ( $did_upgrade ) { |
|
| 53 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 52 | + if ($did_upgrade) { |
|
| 53 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
| 58 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
| 57 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
| 58 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Display Upgrade Notices |
@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function give_show_upgrade_notices() { |
| 67 | 67 | // Don't show notices on the upgrades page. |
| 68 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
| 68 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $give_version = get_option( 'give_version' ); |
|
| 72 | + $give_version = get_option('give_version'); |
|
| 73 | 73 | |
| 74 | - if ( ! $give_version ) { |
|
| 74 | + if ( ! $give_version) { |
|
| 75 | 75 | // 1.0 is the first version to use this option so we must add it. |
| 76 | 76 | $give_version = '1.0'; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 79 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 80 | 80 | |
| 81 | 81 | /* |
| 82 | 82 | * NOTICE: |
@@ -87,31 +87,31 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | |
| 89 | 89 | // v1.3.2 Upgrades |
| 90 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
| 90 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
| 91 | 91 | printf( |
| 92 | 92 | /* translators: %s: upgrade URL */ |
| 93 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
| 94 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
| 93 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
| 94 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
| 95 | 95 | ); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // v1.3.4 Upgrades //ensure the user has gone through 1.3.4. |
| 99 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
| 99 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
| 100 | 100 | printf( |
| 101 | 101 | /* translators: %s: upgrade URL */ |
| 102 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
| 103 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
| 102 | + '<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
| 103 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Check if we have a stalled upgrade. |
| 108 | 108 | $resume_upgrade = give_maybe_resume_upgrade(); |
| 109 | - if ( ! empty( $resume_upgrade ) ) { |
|
| 110 | - $resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ); |
|
| 109 | + if ( ! empty($resume_upgrade)) { |
|
| 110 | + $resume_url = add_query_arg($resume_upgrade, admin_url('index.php')); |
|
| 111 | 111 | echo Give_Notices::notice_html( |
| 112 | 112 | sprintf( |
| 113 | - __( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ), |
|
| 114 | - esc_url( $resume_url ) |
|
| 113 | + __('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'), |
|
| 114 | + esc_url($resume_url) |
|
| 115 | 115 | ) |
| 116 | 116 | ); |
| 117 | 117 | |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // v1.8 form metadata upgrades. |
| 122 | - if ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) { |
|
| 122 | + if (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) { |
|
| 123 | 123 | echo Give_Notices::notice_html( |
| 124 | 124 | sprintf( |
| 125 | - esc_html__( 'Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give' ), |
|
| 126 | - '<a class="give-upgrade-link" href="' . esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) . '">', |
|
| 125 | + esc_html__('Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give'), |
|
| 126 | + '<a class="give-upgrade-link" href="'.esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')).'">', |
|
| 127 | 127 | '</a>' |
| 128 | 128 | ) |
| 129 | 129 | ); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | <?php |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
| 154 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Triggers all upgrade functions |
@@ -163,29 +163,29 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | function give_trigger_upgrades() { |
| 165 | 165 | |
| 166 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 167 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 166 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 167 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 168 | 168 | 'response' => 403, |
| 169 | - ) ); |
|
| 169 | + )); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $give_version = get_option( 'give_version' ); |
|
| 172 | + $give_version = get_option('give_version'); |
|
| 173 | 173 | |
| 174 | - if ( ! $give_version ) { |
|
| 174 | + if ( ! $give_version) { |
|
| 175 | 175 | // 1.0 is the first version to use this option so we must add it. |
| 176 | 176 | $give_version = '1.0'; |
| 177 | - add_option( 'give_version', $give_version ); |
|
| 177 | + add_option('give_version', $give_version); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - update_option( 'give_version', GIVE_VERSION ); |
|
| 181 | - delete_option( 'give_doing_upgrade' ); |
|
| 180 | + update_option('give_version', GIVE_VERSION); |
|
| 181 | + delete_option('give_doing_upgrade'); |
|
| 182 | 182 | |
| 183 | - if ( DOING_AJAX ) { |
|
| 184 | - die( 'complete' ); |
|
| 183 | + if (DOING_AJAX) { |
|
| 184 | + die('complete'); |
|
| 185 | 185 | } // End if(). |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
| 188 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * Check if the upgrade routine has been run for a specific action |
@@ -196,15 +196,15 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @return bool If the action has been added to the completed actions array |
| 198 | 198 | */ |
| 199 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
| 199 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
| 200 | 200 | |
| 201 | - if ( empty( $upgrade_action ) ) { |
|
| 201 | + if (empty($upgrade_action)) { |
|
| 202 | 202 | return false; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $completed_upgrades = give_get_completed_upgrades(); |
| 206 | 206 | |
| 207 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
| 207 | + return in_array($upgrade_action, $completed_upgrades); |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
| 217 | 217 | */ |
| 218 | 218 | function give_maybe_resume_upgrade() { |
| 219 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
| 220 | - if ( empty( $doing_upgrade ) ) { |
|
| 219 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
| 220 | + if (empty($doing_upgrade)) { |
|
| 221 | 221 | return false; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return bool If the function was successfully added |
| 235 | 235 | */ |
| 236 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
| 236 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
| 237 | 237 | |
| 238 | - if ( empty( $upgrade_action ) ) { |
|
| 238 | + if (empty($upgrade_action)) { |
|
| 239 | 239 | return false; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,9 +243,9 @@ discard block |
||
| 243 | 243 | $completed_upgrades[] = $upgrade_action; |
| 244 | 244 | |
| 245 | 245 | // Remove any blanks, and only show uniques. |
| 246 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
| 246 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
| 247 | 247 | |
| 248 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
| 248 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | function give_get_completed_upgrades() { |
| 258 | 258 | |
| 259 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
| 259 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
| 260 | 260 | |
| 261 | - if ( false === $completed_upgrades ) { |
|
| 261 | + if (false === $completed_upgrades) { |
|
| 262 | 262 | $completed_upgrades = array(); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -275,31 +275,31 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | function give_v132_upgrade_give_payment_customer_id() { |
| 277 | 277 | global $wpdb; |
| 278 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 279 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 278 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 279 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 280 | 280 | 'response' => 403, |
| 281 | - ) ); |
|
| 281 | + )); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - ignore_user_abort( true ); |
|
| 284 | + ignore_user_abort(true); |
|
| 285 | 285 | |
| 286 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 287 | - @set_time_limit( 0 ); |
|
| 286 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 287 | + @set_time_limit(0); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // UPDATE DB METAKEYS. |
| 291 | 291 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
| 292 | - $query = $wpdb->query( $sql ); |
|
| 292 | + $query = $wpdb->query($sql); |
|
| 293 | 293 | |
| 294 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 295 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
| 296 | - delete_option( 'give_doing_upgrade' ); |
|
| 297 | - wp_redirect( admin_url() ); |
|
| 294 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 295 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
| 296 | + delete_option('give_doing_upgrade'); |
|
| 297 | + wp_redirect(admin_url()); |
|
| 298 | 298 | exit; |
| 299 | 299 | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
| 302 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * Upgrades the Offline Status |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | global $wpdb; |
| 314 | 314 | |
| 315 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 316 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 315 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 316 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 317 | 317 | 'response' => 403, |
| 318 | - ) ); |
|
| 318 | + )); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - ignore_user_abort( true ); |
|
| 321 | + ignore_user_abort(true); |
|
| 322 | 322 | |
| 323 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 324 | - @set_time_limit( 0 ); |
|
| 323 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 324 | + @set_time_limit(0); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | // Get abandoned offline payments. |
@@ -331,31 +331,31 @@ discard block |
||
| 331 | 331 | $where .= "AND ( p.post_status = 'abandoned' )"; |
| 332 | 332 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
| 333 | 333 | |
| 334 | - $sql = $select . $join . $where; |
|
| 335 | - $found_payments = $wpdb->get_col( $sql ); |
|
| 334 | + $sql = $select.$join.$where; |
|
| 335 | + $found_payments = $wpdb->get_col($sql); |
|
| 336 | 336 | |
| 337 | - foreach ( $found_payments as $payment ) { |
|
| 337 | + foreach ($found_payments as $payment) { |
|
| 338 | 338 | |
| 339 | 339 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
| 340 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
| 340 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
| 341 | 341 | |
| 342 | 342 | // 1450124863 = 12/10/2015 20:42:25. |
| 343 | - if ( $modified_time >= 1450124863 ) { |
|
| 343 | + if ($modified_time >= 1450124863) { |
|
| 344 | 344 | |
| 345 | - give_update_payment_status( $payment, 'pending' ); |
|
| 345 | + give_update_payment_status($payment, 'pending'); |
|
| 346 | 346 | |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 351 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
| 352 | - delete_option( 'give_doing_upgrade' ); |
|
| 353 | - wp_redirect( admin_url() ); |
|
| 350 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 351 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
| 352 | + delete_option('give_doing_upgrade'); |
|
| 353 | + wp_redirect(admin_url()); |
|
| 354 | 354 | exit; |
| 355 | 355 | |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
| 358 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * Cleanup User Roles |
@@ -366,17 +366,17 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | function give_v152_cleanup_users() { |
| 368 | 368 | |
| 369 | - $give_version = get_option( 'give_version' ); |
|
| 369 | + $give_version = get_option('give_version'); |
|
| 370 | 370 | |
| 371 | - if ( ! $give_version ) { |
|
| 371 | + if ( ! $give_version) { |
|
| 372 | 372 | // 1.0 is the first version to use this option so we must add it. |
| 373 | 373 | $give_version = '1.0'; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 376 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 377 | 377 | |
| 378 | 378 | // v1.5.2 Upgrades |
| 379 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
| 379 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
| 380 | 380 | |
| 381 | 381 | // Delete all caps with "ss". |
| 382 | 382 | // Also delete all unused "campaign" roles. |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | ); |
| 424 | 424 | |
| 425 | 425 | global $wp_roles; |
| 426 | - foreach ( $delete_caps as $cap ) { |
|
| 427 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 428 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 426 | + foreach ($delete_caps as $cap) { |
|
| 427 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 428 | + $wp_roles->remove_cap($role, $cap); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
@@ -435,15 +435,15 @@ discard block |
||
| 435 | 435 | $roles->add_caps(); |
| 436 | 436 | |
| 437 | 437 | // The Update Ran. |
| 438 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 439 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
| 440 | - delete_option( 'give_doing_upgrade' ); |
|
| 438 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 439 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
| 440 | + delete_option('give_doing_upgrade'); |
|
| 441 | 441 | |
| 442 | 442 | }// End if(). |
| 443 | 443 | |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
| 446 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | 449 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -483,53 +483,53 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | // Get addons license key. |
| 485 | 485 | $addons = array(); |
| 486 | - foreach ( $give_options as $key => $value ) { |
|
| 487 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
| 488 | - $addons[ $key ] = $value; |
|
| 486 | + foreach ($give_options as $key => $value) { |
|
| 487 | + if (false !== strpos($key, '_license_key')) { |
|
| 488 | + $addons[$key] = $value; |
|
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | // Bailout: We do not have any addon license data to upgrade. |
| 493 | - if ( empty( $addons ) ) { |
|
| 493 | + if (empty($addons)) { |
|
| 494 | 494 | return false; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - foreach ( $addons as $key => $addon_license ) { |
|
| 497 | + foreach ($addons as $key => $addon_license) { |
|
| 498 | 498 | |
| 499 | 499 | // Get addon shortname. |
| 500 | - $shortname = str_replace( '_license_key', '', $key ); |
|
| 500 | + $shortname = str_replace('_license_key', '', $key); |
|
| 501 | 501 | |
| 502 | 502 | // Addon license option name. |
| 503 | - $addon_license_option_name = $shortname . '_license_active'; |
|
| 503 | + $addon_license_option_name = $shortname.'_license_active'; |
|
| 504 | 504 | |
| 505 | 505 | // bailout if license is empty. |
| 506 | - if ( empty( $addon_license ) ) { |
|
| 507 | - delete_option( $addon_license_option_name ); |
|
| 506 | + if (empty($addon_license)) { |
|
| 507 | + delete_option($addon_license_option_name); |
|
| 508 | 508 | continue; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | // Get addon name. |
| 512 | 512 | $addon_name = array(); |
| 513 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
| 514 | - foreach ( $addon_name_parts as $name_part ) { |
|
| 513 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
| 514 | + foreach ($addon_name_parts as $name_part) { |
|
| 515 | 515 | |
| 516 | 516 | // Fix addon name |
| 517 | - switch ( $name_part ) { |
|
| 517 | + switch ($name_part) { |
|
| 518 | 518 | case 'authorizenet' : |
| 519 | 519 | $name_part = 'authorize.net'; |
| 520 | 520 | break; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - $addon_name[] = ucfirst( $name_part ); |
|
| 523 | + $addon_name[] = ucfirst($name_part); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $addon_name = implode( ' ', $addon_name ); |
|
| 526 | + $addon_name = implode(' ', $addon_name); |
|
| 527 | 527 | |
| 528 | 528 | // Data to send to the API |
| 529 | 529 | $api_params = array( |
| 530 | 530 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
| 531 | 531 | 'license' => $addon_license, |
| 532 | - 'item_name' => urlencode( $addon_name ), |
|
| 532 | + 'item_name' => urlencode($addon_name), |
|
| 533 | 533 | 'url' => home_url(), |
| 534 | 534 | ); |
| 535 | 535 | |
@@ -544,17 +544,17 @@ discard block |
||
| 544 | 544 | ); |
| 545 | 545 | |
| 546 | 546 | // Make sure there are no errors. |
| 547 | - if ( is_wp_error( $response ) ) { |
|
| 548 | - delete_option( $addon_license_option_name ); |
|
| 547 | + if (is_wp_error($response)) { |
|
| 548 | + delete_option($addon_license_option_name); |
|
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // Tell WordPress to look for updates. |
| 553 | - set_site_transient( 'update_plugins', null ); |
|
| 553 | + set_site_transient('update_plugins', null); |
|
| 554 | 554 | |
| 555 | 555 | // Decode license data. |
| 556 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 557 | - update_option( $addon_license_option_name, $license_data ); |
|
| 556 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
| 557 | + update_option($addon_license_option_name, $license_data); |
|
| 558 | 558 | }// End foreach(). |
| 559 | 559 | } |
| 560 | 560 | |
@@ -584,9 +584,9 @@ discard block |
||
| 584 | 584 | ); |
| 585 | 585 | |
| 586 | 586 | global $wp_roles; |
| 587 | - foreach ( $delete_caps as $cap ) { |
|
| 588 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 589 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 587 | + foreach ($delete_caps as $cap) { |
|
| 588 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 589 | + $wp_roles->remove_cap($role, $cap); |
|
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | function give_v18_upgrades_core_setting() { |
| 621 | 621 | // Core settings which changes from checkbox to radio. |
| 622 | 622 | $core_setting_names = array_merge( |
| 623 | - array_keys( give_v18_renamed_core_settings() ), |
|
| 623 | + array_keys(give_v18_renamed_core_settings()), |
|
| 624 | 624 | array( |
| 625 | 625 | 'uninstall_on_delete', |
| 626 | 626 | 'scripts_footer', |
@@ -632,48 +632,48 @@ discard block |
||
| 632 | 632 | ); |
| 633 | 633 | |
| 634 | 634 | // Bailout: If not any setting define. |
| 635 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
| 635 | + if ($give_settings = get_option('give_settings')) { |
|
| 636 | 636 | |
| 637 | 637 | $setting_changed = false; |
| 638 | 638 | |
| 639 | 639 | // Loop: check each setting field. |
| 640 | - foreach ( $core_setting_names as $setting_name ) { |
|
| 640 | + foreach ($core_setting_names as $setting_name) { |
|
| 641 | 641 | // New setting name. |
| 642 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
| 642 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
| 643 | 643 | |
| 644 | 644 | // Continue: If setting already set. |
| 645 | 645 | if ( |
| 646 | - array_key_exists( $new_setting_name, $give_settings ) |
|
| 647 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
| 646 | + array_key_exists($new_setting_name, $give_settings) |
|
| 647 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
| 648 | 648 | ) { |
| 649 | 649 | continue; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | // Set checkbox value to radio value. |
| 653 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
| 653 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
| 654 | 654 | |
| 655 | 655 | // @see https://github.com/WordImpress/Give/issues/1063 |
| 656 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
| 656 | + if (false !== strpos($setting_name, 'disable_')) { |
|
| 657 | 657 | |
| 658 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
| 659 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
| 658 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
| 659 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
| 660 | 660 | |
| 661 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
| 661 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | // Tell bot to update core setting to db. |
| 665 | - if ( ! $setting_changed ) { |
|
| 665 | + if ( ! $setting_changed) { |
|
| 666 | 666 | $setting_changed = true; |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | // Update setting only if they changed. |
| 671 | - if ( $setting_changed ) { |
|
| 672 | - update_option( 'give_settings', $give_settings ); |
|
| 671 | + if ($setting_changed) { |
|
| 672 | + update_option('give_settings', $give_settings); |
|
| 673 | 673 | } |
| 674 | 674 | }// End if(). |
| 675 | 675 | |
| 676 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
| 676 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | /** |
@@ -683,22 +683,22 @@ discard block |
||
| 683 | 683 | * @return void |
| 684 | 684 | */ |
| 685 | 685 | function give_v18_upgrades_form_metadata() { |
| 686 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 687 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 686 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 687 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 688 | 688 | 'response' => 403, |
| 689 | - ) ); |
|
| 689 | + )); |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - ignore_user_abort( true ); |
|
| 692 | + ignore_user_abort(true); |
|
| 693 | 693 | |
| 694 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 695 | - @set_time_limit( 0 ); |
|
| 694 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 695 | + @set_time_limit(0); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 698 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
| 699 | 699 | |
| 700 | 700 | // form query |
| 701 | - $forms = new WP_Query( array( |
|
| 701 | + $forms = new WP_Query(array( |
|
| 702 | 702 | 'paged' => $step, |
| 703 | 703 | 'status' => 'any', |
| 704 | 704 | 'order' => 'ASC', |
@@ -708,27 +708,27 @@ discard block |
||
| 708 | 708 | ); |
| 709 | 709 | |
| 710 | 710 | |
| 711 | - if ( $forms->have_posts() ) { |
|
| 712 | - while ( $forms->have_posts() ) { |
|
| 711 | + if ($forms->have_posts()) { |
|
| 712 | + while ($forms->have_posts()) { |
|
| 713 | 713 | $forms->the_post(); |
| 714 | 714 | |
| 715 | 715 | // Form content. |
| 716 | 716 | // Note in version 1.8 display content setting split into display content and content placement setting. |
| 717 | 717 | // You can delete _give_content_option in future |
| 718 | - $show_content = get_post_meta( get_the_ID(), '_give_content_option', true ); |
|
| 719 | - if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
| 720 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
| 721 | - update_post_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
| 718 | + $show_content = get_post_meta(get_the_ID(), '_give_content_option', true); |
|
| 719 | + if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) { |
|
| 720 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
| 721 | + update_post_meta(get_the_ID(), '_give_display_content', $field_value); |
|
| 722 | 722 | |
| 723 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
| 724 | - update_post_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
| 723 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
| 724 | + update_post_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | // "Disable" Guest Donation. Checkbox |
| 728 | 728 | // See: https://github.com/WordImpress/Give/issues/1470 |
| 729 | - $guest_donation = get_post_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
| 730 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
| 731 | - update_post_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
| 729 | + $guest_donation = get_post_meta(get_the_ID(), '_give_logged_in_only', true); |
|
| 730 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
| 731 | + update_post_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
| 732 | 732 | |
| 733 | 733 | // Convert yes/no setting field to enabled/disabled. |
| 734 | 734 | $form_radio_settings = array( |
@@ -751,15 +751,15 @@ discard block |
||
| 751 | 751 | '_give_offline_donation_enable_billing_fields_single', |
| 752 | 752 | ); |
| 753 | 753 | |
| 754 | - foreach ( $form_radio_settings as $meta_key ) { |
|
| 754 | + foreach ($form_radio_settings as $meta_key) { |
|
| 755 | 755 | // Get value. |
| 756 | - $field_value = get_post_meta( get_the_ID(), $meta_key, true ); |
|
| 756 | + $field_value = get_post_meta(get_the_ID(), $meta_key, true); |
|
| 757 | 757 | |
| 758 | 758 | // Convert meta value only if it is in yes/no/none. |
| 759 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
| 759 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
| 760 | 760 | |
| 761 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
| 762 | - update_post_meta( get_the_ID(), $meta_key, $field_value ); |
|
| 761 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
| 762 | + update_post_meta(get_the_ID(), $meta_key, $field_value); |
|
| 763 | 763 | } |
| 764 | 764 | } |
| 765 | 765 | }// End while(). |
@@ -767,28 +767,28 @@ discard block |
||
| 767 | 767 | wp_reset_postdata(); |
| 768 | 768 | |
| 769 | 769 | // Forms found so upgrade them |
| 770 | - $step ++; |
|
| 771 | - $redirect = add_query_arg( array( |
|
| 770 | + $step++; |
|
| 771 | + $redirect = add_query_arg(array( |
|
| 772 | 772 | 'page' => 'give-upgrades', |
| 773 | 773 | 'give-upgrade' => 'give_v18_upgrades_form_metadata', |
| 774 | 774 | 'step' => $step, |
| 775 | - ), admin_url( 'index.php' ) ); |
|
| 776 | - wp_redirect( $redirect ); |
|
| 775 | + ), admin_url('index.php')); |
|
| 776 | + wp_redirect($redirect); |
|
| 777 | 777 | exit(); |
| 778 | 778 | |
| 779 | 779 | } else { |
| 780 | 780 | // No more forms found, finish up. |
| 781 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 782 | - delete_option( 'give_doing_upgrade' ); |
|
| 783 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
| 781 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 782 | + delete_option('give_doing_upgrade'); |
|
| 783 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
| 784 | 784 | |
| 785 | 785 | |
| 786 | - wp_redirect( admin_url() ); |
|
| 786 | + wp_redirect(admin_url()); |
|
| 787 | 787 | exit; |
| 788 | 788 | } |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | -add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' ); |
|
| 791 | +add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata'); |
|
| 792 | 792 | |
| 793 | 793 | /** |
| 794 | 794 | * Get list of core setting renamed in version 1.8. |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly. |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Load WP_List_Table if not loaded |
| 17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 17 | +if ( ! class_exists('WP_List_Table')) { |
|
| 18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | global $status, $page; |
| 45 | 45 | |
| 46 | 46 | // Set parent defaults |
| 47 | - parent::__construct( array( |
|
| 48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 50 | - 'ajax' => false,// Does this table support ajax? |
|
| 51 | - ) ); |
|
| 47 | + parent::__construct(array( |
|
| 48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 50 | + 'ajax' => false, // Does this table support ajax? |
|
| 51 | + )); |
|
| 52 | 52 | |
| 53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
| 53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -64,39 +64,39 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | 68 | |
| 69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
| 69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
| 70 | 70 | |
| 71 | - switch ( $column_name ) { |
|
| 71 | + switch ($column_name) { |
|
| 72 | 72 | case 'form' : |
| 73 | - $form_title = get_the_title( $item[ $column_name ] ); |
|
| 74 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title; |
|
| 75 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . $form_title . '</a>'; |
|
| 73 | + $form_title = get_the_title($item[$column_name]); |
|
| 74 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title; |
|
| 75 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.$form_title.'</a>'; |
|
| 76 | 76 | |
| 77 | 77 | case 'user_id' : |
| 78 | - return '<a href="' . |
|
| 79 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
| 80 | - '">' . $item['user_name'] . '</a>'; |
|
| 78 | + return '<a href="'. |
|
| 79 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
| 80 | + '">'.$item['user_name'].'</a>'; |
|
| 81 | 81 | |
| 82 | 82 | case 'amount' : |
| 83 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
| 83 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
| 84 | 84 | |
| 85 | 85 | case 'status' : |
| 86 | 86 | |
| 87 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
| 87 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
| 88 | 88 | |
| 89 | - if ( $payment->mode == 'test' ) { |
|
| 90 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 89 | + if ($payment->mode == 'test') { |
|
| 90 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $value; |
| 94 | 94 | |
| 95 | 95 | case 'payment_id' : |
| 96 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
| 96 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
| 97 | 97 | |
| 98 | 98 | default: |
| 99 | - return $item[ $column_name ]; |
|
| 99 | + return $item[$column_name]; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function get_columns() { |
| 111 | 111 | $columns = array( |
| 112 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
| 113 | - 'user_id' => esc_html__( 'Donor', 'give' ), |
|
| 114 | - 'form' => esc_html__( 'Form', 'give' ), |
|
| 115 | - 'amount' => esc_html__( 'Donation Amount', 'give' ), |
|
| 116 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 117 | - 'payment_id' => esc_html__( 'Transaction ID', 'give' ), |
|
| 118 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 112 | + 'ID' => esc_html__('Log ID', 'give'), |
|
| 113 | + 'user_id' => esc_html__('Donor', 'give'), |
|
| 114 | + 'form' => esc_html__('Form', 'give'), |
|
| 115 | + 'amount' => esc_html__('Donation Amount', 'give'), |
|
| 116 | + 'status' => esc_html__('Status', 'give'), |
|
| 117 | + 'payment_id' => esc_html__('Transaction ID', 'give'), |
|
| 118 | + 'date' => esc_html__('Date', 'give'), |
|
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | 121 | return $columns; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return int Current page number |
| 130 | 130 | */ |
| 131 | 131 | public function get_paged() { |
| 132 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 132 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @return mixed int If User ID, string If Email/Login |
| 141 | 141 | */ |
| 142 | 142 | public function get_filtered_user() { |
| 143 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
| 143 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @return int Download ID |
| 152 | 152 | */ |
| 153 | 153 | public function get_filtered_give_form() { |
| 154 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
| 154 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @return string|bool string If search is present, false otherwise |
| 163 | 163 | */ |
| 164 | 164 | public function get_search() { |
| 165 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 165 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -178,20 +178,20 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @param string $which |
| 180 | 180 | */ |
| 181 | - protected function display_tablenav( $which ) { |
|
| 181 | + protected function display_tablenav($which) { |
|
| 182 | 182 | |
| 183 | - if ( 'top' === $which ) { |
|
| 184 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 183 | + if ('top' === $which) { |
|
| 184 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 185 | 185 | } |
| 186 | 186 | ?> |
| 187 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 187 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 188 | 188 | |
| 189 | 189 | <div class="alignleft actions bulkactions"> |
| 190 | - <?php $this->bulk_actions( $which ); ?> |
|
| 190 | + <?php $this->bulk_actions($which); ?> |
|
| 191 | 191 | </div> |
| 192 | 192 | <?php |
| 193 | - $this->extra_tablenav( $which ); |
|
| 194 | - $this->pagination( $which ); |
|
| 193 | + $this->extra_tablenav($which); |
|
| 194 | + $this->pagination($which); |
|
| 195 | 195 | ?> |
| 196 | 196 | |
| 197 | 197 | <br class="clear"/> |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $meta_query = array(); |
| 216 | 216 | |
| 217 | - if ( $user ) { |
|
| 217 | + if ($user) { |
|
| 218 | 218 | // Show only logs from a specific user |
| 219 | 219 | $meta_query[] = array( |
| 220 | 220 | 'key' => '_give_log_user_id', |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $search = $this->get_search(); |
| 226 | - if ( $search ) { |
|
| 227 | - if ( is_email( $search ) ) { |
|
| 226 | + if ($search) { |
|
| 227 | + if (is_email($search)) { |
|
| 228 | 228 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
| 229 | 229 | $key = '_give_log_user_info'; |
| 230 | 230 | $compare = 'LIKE'; |
@@ -233,32 +233,32 @@ discard block |
||
| 233 | 233 | $key = '_give_log_user_id'; |
| 234 | 234 | $compare = 'LIKE'; |
| 235 | 235 | |
| 236 | - if ( ! is_numeric( $search ) ) { |
|
| 236 | + if ( ! is_numeric($search)) { |
|
| 237 | 237 | // Searching for user by username |
| 238 | - $user = get_user_by( 'login', $search ); |
|
| 238 | + $user = get_user_by('login', $search); |
|
| 239 | 239 | |
| 240 | - if ( $user ) { |
|
| 240 | + if ($user) { |
|
| 241 | 241 | // Found one, set meta value to user's ID |
| 242 | 242 | $search = $user->ID; |
| 243 | 243 | } else { |
| 244 | 244 | // No user found so let's do a real search query |
| 245 | - $users = new WP_User_Query( array( |
|
| 245 | + $users = new WP_User_Query(array( |
|
| 246 | 246 | 'search' => $search, |
| 247 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
| 247 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
| 248 | 248 | 'number' => 1, |
| 249 | 249 | 'fields' => 'ids', |
| 250 | - ) ); |
|
| 250 | + )); |
|
| 251 | 251 | |
| 252 | 252 | $found_user = $users->get_results(); |
| 253 | 253 | |
| 254 | - if ( $found_user ) { |
|
| 254 | + if ($found_user) { |
|
| 255 | 255 | $search = $found_user[0]; |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if ( ! $this->file_search ) { |
|
| 261 | + if ( ! $this->file_search) { |
|
| 262 | 262 | // Meta query only works for non file name searche |
| 263 | 263 | $meta_query[] = array( |
| 264 | 264 | 'key' => $key, |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @since 1.0 |
| 280 | 280 | * @return void |
| 281 | 281 | */ |
| 282 | - function bulk_actions( $which = '' ) { |
|
| 282 | + function bulk_actions($which = '') { |
|
| 283 | 283 | give_log_views(); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -291,24 +291,24 @@ discard block |
||
| 291 | 291 | * @return void |
| 292 | 292 | */ |
| 293 | 293 | public function give_forms_filter() { |
| 294 | - $give_forms = get_posts( array( |
|
| 294 | + $give_forms = get_posts(array( |
|
| 295 | 295 | 'post_type' => 'give_forms', |
| 296 | 296 | 'post_status' => 'any', |
| 297 | - 'posts_per_page' => - 1, |
|
| 297 | + 'posts_per_page' => -1, |
|
| 298 | 298 | 'orderby' => 'title', |
| 299 | 299 | 'order' => 'ASC', |
| 300 | 300 | 'fields' => 'ids', |
| 301 | 301 | 'update_post_meta_cache' => false, |
| 302 | 302 | 'update_post_term_cache' => false, |
| 303 | - ) ); |
|
| 303 | + )); |
|
| 304 | 304 | |
| 305 | - if ( $give_forms ) { |
|
| 305 | + if ($give_forms) { |
|
| 306 | 306 | echo '<select name="form" id="give-log-form-filter">'; |
| 307 | - echo '<option value="0">' . esc_html__( 'All', 'give' ) . '</option>'; |
|
| 308 | - foreach ( $give_forms as $form ) { |
|
| 309 | - $form_title = get_the_title( $form ); |
|
| 310 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form ) : $form_title; |
|
| 311 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( $form_title ) . '</option>'; |
|
| 307 | + echo '<option value="0">'.esc_html__('All', 'give').'</option>'; |
|
| 308 | + foreach ($give_forms as $form) { |
|
| 309 | + $form_title = get_the_title($form); |
|
| 310 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $form) : $form_title; |
|
| 311 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html($form_title).'</option>'; |
|
| 312 | 312 | } |
| 313 | 313 | echo '</select>'; |
| 314 | 314 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | $logs_data = array(); |
| 330 | 330 | $paged = $this->get_paged(); |
| 331 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
| 331 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
| 332 | 332 | $user = $this->get_filtered_user(); |
| 333 | 333 | |
| 334 | 334 | $log_query = array( |
@@ -338,39 +338,39 @@ discard block |
||
| 338 | 338 | 'meta_query' => $this->get_meta_query(), |
| 339 | 339 | ); |
| 340 | 340 | |
| 341 | - $cache_key = give_get_cache_key( 'get_logs', $log_query ); |
|
| 341 | + $cache_key = give_get_cache_key('get_logs', $log_query); |
|
| 342 | 342 | |
| 343 | 343 | // Return result from cache if exist. |
| 344 | - if ( ! ( $logs_data = get_option( $cache_key ) ) ) { |
|
| 344 | + if ( ! ($logs_data = get_option($cache_key))) { |
|
| 345 | 345 | |
| 346 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
| 346 | + $logs = $give_logs->get_connected_logs($log_query); |
|
| 347 | 347 | |
| 348 | - if ( $logs ) { |
|
| 349 | - foreach ( $logs as $log ) { |
|
| 350 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
| 348 | + if ($logs) { |
|
| 349 | + foreach ($logs as $log) { |
|
| 350 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
| 351 | 351 | |
| 352 | 352 | // Make sure this payment hasn't been deleted |
| 353 | - if ( get_post( $payment_id ) ) : |
|
| 354 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 355 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
| 356 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
| 353 | + if (get_post($payment_id)) : |
|
| 354 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
| 355 | + $payment_meta = give_get_payment_meta($payment_id); |
|
| 356 | + $payment_amount = give_get_payment_amount($payment_id); |
|
| 357 | 357 | |
| 358 | 358 | $logs_data[] = array( |
| 359 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
| 359 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
| 360 | 360 | 'payment_id' => $payment_id, |
| 361 | 361 | 'form' => $log->post_parent, |
| 362 | 362 | 'amount' => $payment_amount, |
| 363 | 363 | 'user_id' => $user_info['id'], |
| 364 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
| 365 | - 'date' => get_post_field( 'post_date', $payment_id ), |
|
| 364 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
| 365 | + 'date' => get_post_field('post_date', $payment_id), |
|
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | 368 | endif; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Cache results. |
| 372 | - if ( ! empty( $logs_data ) ) { |
|
| 373 | - add_option( $cache_key, $logs_data, '', 'no' ); |
|
| 372 | + if ( ! empty($logs_data)) { |
|
| 373 | + add_option($cache_key, $logs_data, '', 'no'); |
|
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -398,15 +398,15 @@ discard block |
||
| 398 | 398 | $columns = $this->get_columns(); |
| 399 | 399 | $hidden = array(); |
| 400 | 400 | $sortable = $this->get_sortable_columns(); |
| 401 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 401 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 402 | 402 | $current_page = $this->get_pagenum(); |
| 403 | 403 | $this->items = $this->get_logs(); |
| 404 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
| 404 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
| 405 | 405 | |
| 406 | - $this->set_pagination_args( array( |
|
| 406 | + $this->set_pagination_args(array( |
|
| 407 | 407 | 'total_items' => $total_items, |
| 408 | 408 | 'per_page' => $this->per_page, |
| 409 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 409 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 410 | 410 | ) |
| 411 | 411 | ); |
| 412 | 412 | } |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly. |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Load WP_List_Table if not loaded. |
| 17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 17 | +if ( ! class_exists('WP_List_Table')) { |
|
| 18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function __construct() { |
| 46 | 46 | // Set parent defaults. |
| 47 | - parent::__construct( array( |
|
| 48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 47 | + parent::__construct(array( |
|
| 48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 50 | 50 | 'ajax' => false // Does this table support ajax?. |
| 51 | - ) ); |
|
| 51 | + )); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string Column Name. |
| 64 | 64 | */ |
| 65 | - public function column_default( $item, $column_name ) { |
|
| 65 | + public function column_default($item, $column_name) { |
|
| 66 | 66 | |
| 67 | - switch ( $column_name ) { |
|
| 67 | + switch ($column_name) { |
|
| 68 | 68 | case 'ID' : |
| 69 | 69 | return $item['ID_label']; |
| 70 | 70 | case 'payment_id' : |
| 71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
| 71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
| 72 | 72 | case 'gateway' : |
| 73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
| 73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
| 74 | 74 | case 'error' : |
| 75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
| 75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
| 76 | 76 | default: |
| 77 | - return $item[ $column_name ]; |
|
| 77 | + return $item[$column_name]; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return void |
| 90 | 90 | */ |
| 91 | - public function column_message( $item ) { ?> |
|
| 92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
| 91 | + public function column_message($item) { ?> |
|
| 92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
| 93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
| 94 | 94 | <?php |
| 95 | 95 | |
| 96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
| 96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
| 97 | 97 | |
| 98 | - $serialized = strpos( $log_message, '{"' ); |
|
| 98 | + $serialized = strpos($log_message, '{"'); |
|
| 99 | 99 | |
| 100 | 100 | // Check to see if the log message contains serialized information |
| 101 | - if ( $serialized !== false ) { |
|
| 102 | - $length = strlen( $log_message ) - $serialized; |
|
| 103 | - $intro = substr( $log_message, 0, - $length ); |
|
| 104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
| 101 | + if ($serialized !== false) { |
|
| 102 | + $length = strlen($log_message) - $serialized; |
|
| 103 | + $intro = substr($log_message, 0, - $length); |
|
| 104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
| 105 | 105 | |
| 106 | - echo wpautop( $intro ); |
|
| 107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
| 108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
| 106 | + echo wpautop($intro); |
|
| 107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
| 108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
| 109 | 109 | } else { |
| 110 | 110 | // No serialized data found |
| 111 | - echo wpautop( $log_message ); |
|
| 111 | + echo wpautop($log_message); |
|
| 112 | 112 | } |
| 113 | 113 | ?> |
| 114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function get_columns() { |
| 126 | 126 | $columns = array( |
| 127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
| 128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
| 129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
| 130 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
| 131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
| 127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
| 128 | + 'error' => esc_html__('Error', 'give'), |
|
| 129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
| 130 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
| 131 | + 'date' => esc_html__('Date', 'give'), |
|
| 132 | + 'message' => esc_html__('Details', 'give') |
|
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return int Current page number |
| 144 | 144 | */ |
| 145 | 145 | public function get_paged() { |
| 146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @since 1.0 |
| 154 | 154 | * @return void |
| 155 | 155 | */ |
| 156 | - public function bulk_actions( $which = '' ) { |
|
| 156 | + public function bulk_actions($which = '') { |
|
| 157 | 157 | give_log_views(); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | // Prevent the queries from getting cached. |
| 173 | 173 | // Without this there are occasional memory issues for some installs. |
| 174 | - wp_suspend_cache_addition( true ); |
|
| 174 | + wp_suspend_cache_addition(true); |
|
| 175 | 175 | |
| 176 | 176 | $logs_data = array(); |
| 177 | 177 | $paged = $this->get_paged(); |
@@ -180,17 +180,17 @@ discard block |
||
| 180 | 180 | 'paged' => $paged |
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
| 183 | + $logs = $give_logs->get_connected_logs($log_query); |
|
| 184 | 184 | |
| 185 | - if ( $logs ) { |
|
| 186 | - foreach ( $logs as $log ) { |
|
| 185 | + if ($logs) { |
|
| 186 | + foreach ($logs as $log) { |
|
| 187 | 187 | |
| 188 | 188 | $logs_data[] = array( |
| 189 | 189 | 'ID' => $log->ID, |
| 190 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
| 190 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
| 191 | 191 | 'payment_id' => $log->post_parent, |
| 192 | 192 | 'error' => 'error', |
| 193 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
| 193 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
| 194 | 194 | 'date' => $log->post_date |
| 195 | 195 | ); |
| 196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @param string $which |
| 214 | 214 | */ |
| 215 | - protected function display_tablenav( $which ) { |
|
| 216 | - if ( 'top' === $which ) { |
|
| 217 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 215 | + protected function display_tablenav($which) { |
|
| 216 | + if ('top' === $which) { |
|
| 217 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 218 | 218 | } |
| 219 | 219 | ?> |
| 220 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 220 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 221 | 221 | |
| 222 | 222 | <div class="alignleft actions bulkactions"> |
| 223 | - <?php $this->bulk_actions( $which ); ?> |
|
| 223 | + <?php $this->bulk_actions($which); ?> |
|
| 224 | 224 | </div> |
| 225 | 225 | <?php |
| 226 | - $this->extra_tablenav( $which ); |
|
| 227 | - $this->pagination( $which ); |
|
| 226 | + $this->extra_tablenav($which); |
|
| 227 | + $this->pagination($which); |
|
| 228 | 228 | ?> |
| 229 | 229 | |
| 230 | 230 | <br class="clear"/> |
@@ -251,14 +251,14 @@ discard block |
||
| 251 | 251 | $columns = $this->get_columns(); |
| 252 | 252 | $hidden = array(); // No hidden columns |
| 253 | 253 | $sortable = $this->get_sortable_columns(); |
| 254 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 254 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 255 | 255 | $this->items = $this->get_logs(); |
| 256 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
| 256 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
| 257 | 257 | |
| 258 | - $this->set_pagination_args( array( |
|
| 258 | + $this->set_pagination_args(array( |
|
| 259 | 259 | 'total_items' => $total_items, |
| 260 | 260 | 'per_page' => $this->per_page, |
| 261 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 261 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 262 | 262 | ) |
| 263 | 263 | ); |
| 264 | 264 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | type="radio" |
| 556 | 556 | style="' . esc_attr( $field['style'] ) . '" |
| 557 | 557 | ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
| 558 | - . give_get_custom_attributes( $field ) . ' |
|
| 558 | + . give_get_custom_attributes( $field ) . ' |
|
| 559 | 559 | /> ' . esc_html( $value ) . '</label> |
| 560 | 560 | </li>'; |
| 561 | 561 | } |
@@ -704,9 +704,9 @@ discard block |
||
| 704 | 704 | $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
| 705 | 705 | |
| 706 | 706 | echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
| 707 | - . '" target="_blank">' |
|
| 708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
| 709 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 707 | + . '" target="_blank">' |
|
| 708 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
| 709 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | /** |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; // Exit if accessed directly |
| 13 | 13 | } |
| 14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return bool|string |
| 24 | 24 | */ |
| 25 | -function give_is_field_callback_exist( $field ) { |
|
| 26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
| 25 | +function give_is_field_callback_exist($field) { |
|
| 26 | + return (give_get_field_callback($field) ? true : false); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return bool|string |
| 37 | 37 | */ |
| 38 | -function give_get_field_callback( $field ) { |
|
| 38 | +function give_get_field_callback($field) { |
|
| 39 | 39 | $func_name_prefix = 'give'; |
| 40 | 40 | $func_name = ''; |
| 41 | 41 | |
| 42 | 42 | // Set callback function on basis of cmb2 field name. |
| 43 | - switch ( $field['type'] ) { |
|
| 43 | + switch ($field['type']) { |
|
| 44 | 44 | case 'radio_inline': |
| 45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
| 46 | 46 | break; |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | default: |
| 77 | 77 | |
| 78 | 78 | if ( |
| 79 | - array_key_exists( 'callback', $field ) |
|
| 80 | - && ! empty( $field['callback'] ) |
|
| 79 | + array_key_exists('callback', $field) |
|
| 80 | + && ! empty($field['callback']) |
|
| 81 | 81 | ) { |
| 82 | 82 | $func_name = $field['callback']; |
| 83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @since 1.8 |
| 92 | 92 | */ |
| 93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
| 93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
| 94 | 94 | |
| 95 | 95 | // Exit if not any function exist. |
| 96 | 96 | // Check if render callback exist or not. |
| 97 | - if ( empty( $func_name ) ) { |
|
| 97 | + if (empty($func_name)) { |
|
| 98 | 98 | return false; |
| 99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
| 99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
| 100 | 100 | return false; |
| 101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
| 101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
| 102 | 102 | return false; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return bool |
| 116 | 116 | */ |
| 117 | -function give_render_field( $field ) { |
|
| 117 | +function give_render_field($field) { |
|
| 118 | 118 | |
| 119 | 119 | // Check if render callback exist or not. |
| 120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
| 120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
| 125 | - if ( empty( $field['class'] ) ) { |
|
| 125 | + if (empty($field['class'])) { |
|
| 126 | 126 | $field['class'] = ''; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
| 129 | + if (empty($field['attributes']['class'])) { |
|
| 130 | 130 | $field['attributes']['class'] = ''; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
| 134 | - unset( $field['class'] ); |
|
| 133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
| 134 | + unset($field['class']); |
|
| 135 | 135 | |
| 136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
| 137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
| 137 | + if ( ! empty($field['row_classes'])) { |
|
| 138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
| 139 | - unset( $field['row_classes'] ); |
|
| 139 | + unset($field['row_classes']); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Set field params on basis of cmb2 field name. |
| 143 | - switch ( $field['type'] ) { |
|
| 143 | + switch ($field['type']) { |
|
| 144 | 144 | case 'radio_inline': |
| 145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
| 145 | + if (empty($field['wrapper_class'])) { |
|
| 146 | 146 | $field['wrapper_class'] = ''; |
| 147 | 147 | } |
| 148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | case 'text-small' : |
| 156 | 156 | case 'text_small' : |
| 157 | 157 | // CMB2 compatibility: Set field type to text. |
| 158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
| 158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
| 159 | 159 | |
| 160 | 160 | // CMB2 compatibility: Set data type to price. |
| 161 | 161 | if ( |
| 162 | - empty( $field['data_type'] ) |
|
| 163 | - && ! empty( $field['attributes']['class'] ) |
|
| 162 | + empty($field['data_type']) |
|
| 163 | + && ! empty($field['attributes']['class']) |
|
| 164 | 164 | && ( |
| 165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
| 166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
| 165 | + false !== strpos($field['attributes']['class'], 'money') |
|
| 166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
| 167 | 167 | ) |
| 168 | 168 | ) { |
| 169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
| 182 | 182 | case 'give_default_radio_inline': |
| 183 | 183 | $field['type'] = 'radio'; |
| 184 | 184 | $field['options'] = array( |
| 185 | - 'default' => __( 'Default' ), |
|
| 185 | + 'default' => __('Default'), |
|
| 186 | 186 | ); |
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
| 191 | 191 | // We encourage you to use description param. |
| 192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
| 192 | + $field['description'] = ( ! empty($field['description']) |
|
| 193 | 193 | ? $field['description'] |
| 194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
| 194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
| 195 | 195 | |
| 196 | 196 | // Call render function. |
| 197 | - if ( is_array( $func_name ) ) { |
|
| 198 | - $func_name[0]->$func_name[1]( $field ); |
|
| 197 | + if (is_array($func_name)) { |
|
| 198 | + $func_name[0]->$func_name[1]($field); |
|
| 199 | 199 | } else { |
| 200 | - $func_name( $field ); |
|
| 200 | + $func_name($field); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
| 227 | 227 | * } |
| 228 | 228 | * @return void |
| 229 | 229 | */ |
| 230 | -function give_text_input( $field ) { |
|
| 230 | +function give_text_input($field) { |
|
| 231 | 231 | global $thepostid, $post; |
| 232 | 232 | |
| 233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
| 233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
| 238 | 238 | $field['before_field'] = ''; |
| 239 | 239 | $field['after_field'] = ''; |
| 240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
| 240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
| 241 | 241 | |
| 242 | - switch ( $data_type ) { |
|
| 242 | + switch ($data_type) { |
|
| 243 | 243 | case 'price' : |
| 244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
| 244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
| 245 | 245 | |
| 246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
| 247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
| 246 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
| 247 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
| 248 | 248 | break; |
| 249 | 249 | |
| 250 | 250 | case 'decimal' : |
| 251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
| 252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
| 252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
| 253 | 253 | break; |
| 254 | 254 | |
| 255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | ?> |
| 260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 262 | 262 | <?php echo $field['before_field']; ?> |
| 263 | 263 | <input |
| 264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 266 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 269 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 270 | 270 | /> |
| 271 | 271 | <?php echo $field['after_field']; ?> |
| 272 | 272 | <?php |
| 273 | - echo give_get_field_description( $field ); |
|
| 273 | + echo give_get_field_description($field); |
|
| 274 | 274 | echo '</p>'; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
| 292 | 292 | * } |
| 293 | 293 | * @return void |
| 294 | 294 | */ |
| 295 | -function give_hidden_input( $field ) { |
|
| 295 | +function give_hidden_input($field) { |
|
| 296 | 296 | global $thepostid, $post; |
| 297 | 297 | |
| 298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 300 | 300 | |
| 301 | 301 | // Custom attribute handling |
| 302 | 302 | $custom_attributes = array(); |
| 303 | 303 | |
| 304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 305 | 305 | |
| 306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | ?> |
| 311 | 311 | |
| 312 | 312 | <input |
| 313 | 313 | type="hidden" |
| 314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 314 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 317 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 318 | 318 | /> |
| 319 | 319 | <?php |
| 320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
| 340 | 340 | * } |
| 341 | 341 | * @return void |
| 342 | 342 | */ |
| 343 | -function give_textarea_input( $field ) { |
|
| 343 | +function give_textarea_input($field) { |
|
| 344 | 344 | global $thepostid, $post; |
| 345 | 345 | |
| 346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 350 | 350 | |
| 351 | 351 | ?> |
| 352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 354 | 354 | <textarea |
| 355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 356 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 358 | 358 | rows="10" |
| 359 | 359 | cols="20" |
| 360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
| 360 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
| 362 | 362 | <?php |
| 363 | - echo give_get_field_description( $field ); |
|
| 363 | + echo give_get_field_description($field); |
|
| 364 | 364 | echo '</p>'; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
| 384 | 384 | * } |
| 385 | 385 | * @return void |
| 386 | 386 | */ |
| 387 | -function give_wysiwyg( $field ) { |
|
| 387 | +function give_wysiwyg($field) { |
|
| 388 | 388 | global $thepostid, $post; |
| 389 | 389 | |
| 390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 394 | 394 | |
| 395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
| 395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
| 396 | 396 | $editor_attributes = array( |
| 397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
| 397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
| 398 | 398 | 'textarea_rows' => '10', |
| 399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
| 399 | + 'editor_css' => esc_attr($field['style']), |
|
| 400 | 400 | 'editor_class' => $field['attributes']['class'], |
| 401 | 401 | ); |
| 402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
| 402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
| 403 | 403 | $field['value'], |
| 404 | 404 | $field['unique_field_id'], |
| 405 | 405 | $editor_attributes, |
| 406 | - ) ) ) . '"'; |
|
| 407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
| 406 | + ))).'"'; |
|
| 407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
| 408 | 408 | |
| 409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
| 409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
| 410 | 410 | |
| 411 | 411 | wp_editor( |
| 412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $editor_attributes |
| 415 | 415 | ); |
| 416 | 416 | |
| 417 | - echo give_get_field_description( $field ); |
|
| 417 | + echo give_get_field_description($field); |
|
| 418 | 418 | echo '</div>'; |
| 419 | 419 | } |
| 420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
| 439 | 439 | * } |
| 440 | 440 | * @return void |
| 441 | 441 | */ |
| 442 | -function give_checkbox( $field ) { |
|
| 442 | +function give_checkbox($field) { |
|
| 443 | 443 | global $thepostid, $post; |
| 444 | 444 | |
| 445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
| 450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
| 450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 451 | 451 | ?> |
| 452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 454 | 454 | <input |
| 455 | 455 | type="checkbox" |
| 456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
| 460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
| 461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 457 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
| 460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
| 461 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 462 | 462 | /> |
| 463 | 463 | <?php |
| 464 | - echo give_get_field_description( $field ); |
|
| 464 | + echo give_get_field_description($field); |
|
| 465 | 465 | echo '</p>'; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
| 487 | 487 | * } |
| 488 | 488 | * @return void |
| 489 | 489 | */ |
| 490 | -function give_select( $field ) { |
|
| 490 | +function give_select($field) { |
|
| 491 | 491 | global $thepostid, $post; |
| 492 | 492 | |
| 493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 498 | 498 | ?> |
| 499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 501 | 501 | <select |
| 502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
| 505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 503 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
| 505 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 506 | 506 | > |
| 507 | 507 | <?php |
| 508 | - foreach ( $field['options'] as $key => $value ) { |
|
| 509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
| 508 | + foreach ($field['options'] as $key => $value) { |
|
| 509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
| 510 | 510 | } |
| 511 | 511 | echo '</select>'; |
| 512 | - echo give_get_field_description( $field ); |
|
| 512 | + echo give_get_field_description($field); |
|
| 513 | 513 | echo '</p>'; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
| 536 | 536 | * } |
| 537 | 537 | * @return void |
| 538 | 538 | */ |
| 539 | -function give_radio( $field ) { |
|
| 539 | +function give_radio($field) { |
|
| 540 | 540 | global $thepostid, $post; |
| 541 | 541 | |
| 542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 547 | 547 | |
| 548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
| 548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
| 549 | 549 | |
| 550 | - foreach ( $field['options'] as $key => $value ) { |
|
| 550 | + foreach ($field['options'] as $key => $value) { |
|
| 551 | 551 | |
| 552 | 552 | echo '<li><label><input |
| 553 | - name="' . give_get_field_name( $field ) . '" |
|
| 554 | - value="' . esc_attr( $key ) . '" |
|
| 553 | + name="' . give_get_field_name($field).'" |
|
| 554 | + value="' . esc_attr($key).'" |
|
| 555 | 555 | type="radio" |
| 556 | - style="' . esc_attr( $field['style'] ) . '" |
|
| 557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
| 558 | - . give_get_custom_attributes( $field ) . ' |
|
| 559 | - /> ' . esc_html( $value ) . '</label> |
|
| 556 | + style="' . esc_attr($field['style']).'" |
|
| 557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
| 558 | + . give_get_custom_attributes($field).' |
|
| 559 | + /> ' . esc_html($value).'</label> |
|
| 560 | 560 | </li>'; |
| 561 | 561 | } |
| 562 | 562 | echo '</ul>'; |
| 563 | 563 | |
| 564 | - echo give_get_field_description( $field ); |
|
| 564 | + echo give_get_field_description($field); |
|
| 565 | 565 | echo '</fieldset>'; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
| 585 | 585 | * } |
| 586 | 586 | * @return void |
| 587 | 587 | */ |
| 588 | -function give_colorpicker( $field ) { |
|
| 588 | +function give_colorpicker($field) { |
|
| 589 | 589 | global $thepostid, $post; |
| 590 | 590 | |
| 591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 596 | 596 | $field['type'] = 'text'; |
| 597 | 597 | ?> |
| 598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 600 | 600 | <input |
| 601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 603 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
| 605 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 606 | 606 | /> |
| 607 | 607 | <?php |
| 608 | - echo give_get_field_description( $field ); |
|
| 608 | + echo give_get_field_description($field); |
|
| 609 | 609 | echo '</p>'; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -617,33 +617,33 @@ discard block |
||
| 617 | 617 | * |
| 618 | 618 | * @param array $field |
| 619 | 619 | */ |
| 620 | -function give_media( $field ) { |
|
| 620 | +function give_media($field) { |
|
| 621 | 621 | global $thepostid, $post; |
| 622 | 622 | |
| 623 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 624 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 625 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 626 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 627 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 623 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 624 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 625 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 626 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 627 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 628 | 628 | $field['type'] = 'text'; |
| 629 | 629 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
| 630 | 630 | |
| 631 | 631 | // Allow developer to save attachment ID or attachment url as metadata. |
| 632 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
| 632 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
| 633 | 633 | ?> |
| 634 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 635 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 634 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 635 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 636 | 636 | <input |
| 637 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 638 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 637 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 638 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 639 | 639 | type="text" |
| 640 | 640 | value="<?php echo $field['value']; ?>" |
| 641 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 641 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 642 | 642 | data-fvalue="<?php echo $field['fvalue']; ?>" |
| 643 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 643 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 644 | 644 | /> <input class="give-media-upload button" type="button" |
| 645 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
| 646 | - <?php echo give_get_field_description( $field ); ?> |
|
| 645 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
| 646 | + <?php echo give_get_field_description($field); ?> |
|
| 647 | 647 | </p> |
| 648 | 648 | <?php |
| 649 | 649 | } |
@@ -657,27 +657,27 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @return void |
| 659 | 659 | */ |
| 660 | -function give_default_gateway( $field ) { |
|
| 660 | +function give_default_gateway($field) { |
|
| 661 | 661 | global $thepostid, $post; |
| 662 | 662 | |
| 663 | 663 | // get all active payment gateways. |
| 664 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
| 664 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
| 665 | 665 | $field['options'] = array(); |
| 666 | 666 | |
| 667 | 667 | // Set field option value. |
| 668 | - if ( ! empty( $gateways ) ) { |
|
| 669 | - foreach ( $gateways as $key => $option ) { |
|
| 670 | - $field['options'][ $key ] = $option['admin_label']; |
|
| 668 | + if ( ! empty($gateways)) { |
|
| 669 | + foreach ($gateways as $key => $option) { |
|
| 670 | + $field['options'][$key] = $option['admin_label']; |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | // Add a field to the Give Form admin single post view of this field |
| 675 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 676 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
| 675 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 676 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | // Render select field. |
| 680 | - give_select( $field ); |
|
| 680 | + give_select($field); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -699,13 +699,13 @@ discard block |
||
| 699 | 699 | * @return void |
| 700 | 700 | */ |
| 701 | 701 | |
| 702 | -function give_docs_link( $field ) { |
|
| 703 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 704 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
| 702 | +function give_docs_link($field) { |
|
| 703 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 704 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
| 705 | 705 | |
| 706 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
| 706 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
| 707 | 707 | . '" target="_blank">' |
| 708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
| 708 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $field['title']) |
|
| 709 | 709 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 710 | 710 | } |
| 711 | 711 | |
@@ -721,13 +721,13 @@ discard block |
||
| 721 | 721 | * |
| 722 | 722 | * @return mixed |
| 723 | 723 | */ |
| 724 | -function give_get_field_value( $field, $postid ) { |
|
| 725 | - if ( isset( $field['attributes']['value'] ) ) { |
|
| 724 | +function give_get_field_value($field, $postid) { |
|
| 725 | + if (isset($field['attributes']['value'])) { |
|
| 726 | 726 | return $field['attributes']['value']; |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // Get value from db. |
| 730 | - $field_value = get_post_meta( $postid, $field['id'], true ); |
|
| 730 | + $field_value = get_post_meta($postid, $field['id'], true); |
|
| 731 | 731 | |
| 732 | 732 | /** |
| 733 | 733 | * Filter the field value before apply default value. |
@@ -736,10 +736,10 @@ discard block |
||
| 736 | 736 | * |
| 737 | 737 | * @param mixed $field_value Field value. |
| 738 | 738 | */ |
| 739 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
| 739 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
| 740 | 740 | |
| 741 | 741 | // Set default value if no any data saved to db. |
| 742 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
| 742 | + if ( ! $field_value && isset($field['default'])) { |
|
| 743 | 743 | $field_value = $field['default']; |
| 744 | 744 | } |
| 745 | 745 | |
@@ -756,10 +756,10 @@ discard block |
||
| 756 | 756 | * |
| 757 | 757 | * @return string |
| 758 | 758 | */ |
| 759 | -function give_get_field_description( $field ) { |
|
| 759 | +function give_get_field_description($field) { |
|
| 760 | 760 | $field_desc_html = ''; |
| 761 | - if ( ! empty( $field['description'] ) ) { |
|
| 762 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
| 761 | + if ( ! empty($field['description'])) { |
|
| 762 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | return $field_desc_html; |
@@ -775,18 +775,18 @@ discard block |
||
| 775 | 775 | * |
| 776 | 776 | * @return string |
| 777 | 777 | */ |
| 778 | -function give_get_custom_attributes( $field ) { |
|
| 778 | +function give_get_custom_attributes($field) { |
|
| 779 | 779 | // Custom attribute handling |
| 780 | 780 | $custom_attributes = array(); |
| 781 | 781 | |
| 782 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 782 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 783 | 783 | |
| 784 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 785 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 784 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 785 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | - return implode( ' ', $custom_attributes ); |
|
| 789 | + return implode(' ', $custom_attributes); |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /** |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | * |
| 803 | 803 | * @return string |
| 804 | 804 | */ |
| 805 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
| 806 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
| 805 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
| 806 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * Filter the specific repeater field value |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | * |
| 813 | 813 | * @param string $field_id |
| 814 | 814 | */ |
| 815 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
| 815 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
| 816 | 816 | |
| 817 | 817 | /** |
| 818 | 818 | * Filter the repeater field value |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * |
| 822 | 822 | * @param string $field_id |
| 823 | 823 | */ |
| 824 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
| 824 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
| 825 | 825 | |
| 826 | 826 | return $field_value; |
| 827 | 827 | } |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | * |
| 840 | 840 | * @return string |
| 841 | 841 | */ |
| 842 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
| 842 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
| 843 | 843 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 844 | 844 | |
| 845 | 845 | // Get field id. |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | * |
| 853 | 853 | * @param string $field_id |
| 854 | 854 | */ |
| 855 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
| 855 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | 858 | * Filter the repeater field id |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | * |
| 862 | 862 | * @param string $field_id |
| 863 | 863 | */ |
| 864 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
| 864 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
| 865 | 865 | |
| 866 | 866 | return $field_id; |
| 867 | 867 | } |
@@ -876,8 +876,8 @@ discard block |
||
| 876 | 876 | * |
| 877 | 877 | * @return string |
| 878 | 878 | */ |
| 879 | -function give_get_field_name( $field ) { |
|
| 880 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
| 879 | +function give_get_field_name($field) { |
|
| 880 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
| 881 | 881 | |
| 882 | 882 | /** |
| 883 | 883 | * Filter the field name. |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | * |
| 887 | 887 | * @param string $field_name |
| 888 | 888 | */ |
| 889 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
| 889 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
| 890 | 890 | |
| 891 | 891 | return $field_name; |
| 892 | 892 | } |
@@ -903,39 +903,39 @@ discard block |
||
| 903 | 903 | * |
| 904 | 904 | * @return void |
| 905 | 905 | */ |
| 906 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
| 906 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
| 907 | 907 | global $thepostid, $post; |
| 908 | 908 | |
| 909 | 909 | // Bailout. |
| 910 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
| 910 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
| 911 | 911 | return; |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 915 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 914 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 915 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 916 | 916 | ?> |
| 917 | 917 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
| 918 | 918 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
| 919 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
| 919 | + <?php if ( ! empty($fields['name'])) : ?> |
|
| 920 | 920 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
| 921 | 921 | <?php endif; ?> |
| 922 | 922 | |
| 923 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
| 923 | + <?php if ( ! empty($fields['description'])) : ?> |
|
| 924 | 924 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
| 925 | 925 | <?php endif; ?> |
| 926 | 926 | |
| 927 | 927 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
| 928 | 928 | <?php |
| 929 | - $repeater_field_values = get_post_meta( $thepostid, $fields['id'], true ); |
|
| 930 | - $header_title = isset( $fields['options']['header_title'] ) |
|
| 929 | + $repeater_field_values = get_post_meta($thepostid, $fields['id'], true); |
|
| 930 | + $header_title = isset($fields['options']['header_title']) |
|
| 931 | 931 | ? $fields['options']['header_title'] |
| 932 | - : esc_attr__( 'Group', 'give' ); |
|
| 932 | + : esc_attr__('Group', 'give'); |
|
| 933 | 933 | |
| 934 | 934 | $add_default_donation_field = false; |
| 935 | 935 | |
| 936 | 936 | // Check if level is not created or we have to add default level. |
| 937 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
| 938 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
| 937 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
| 938 | + $repeater_field_values = array_values($repeater_field_values); |
|
| 939 | 939 | } else { |
| 940 | 940 | $fields_count = 1; |
| 941 | 941 | $add_default_donation_field = true; |
@@ -948,59 +948,59 @@ discard block |
||
| 948 | 948 | <div class="give-row-head give-move"> |
| 949 | 949 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
| 950 | 950 | </button> |
| 951 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
| 951 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
| 952 | 952 | <h2> |
| 953 | 953 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 954 | 954 | </h2> |
| 955 | 955 | </div> |
| 956 | 956 | <div class="give-row-body"> |
| 957 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 958 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 957 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 958 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 959 | 959 | continue; |
| 960 | 960 | } ?> |
| 961 | 961 | <?php |
| 962 | 962 | $field['repeat'] = true; |
| 963 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
| 964 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 963 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
| 964 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 965 | 965 | '_', |
| 966 | 966 | '', |
| 967 | - ), $field['repeatable_field_id'] ); |
|
| 967 | + ), $field['repeatable_field_id']); |
|
| 968 | 968 | ?> |
| 969 | - <?php give_render_field( $field ); ?> |
|
| 969 | + <?php give_render_field($field); ?> |
|
| 970 | 970 | <?php endforeach; ?> |
| 971 | 971 | </div> |
| 972 | 972 | </td> |
| 973 | 973 | </tr> |
| 974 | 974 | |
| 975 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
| 975 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
| 976 | 976 | <!--Stored repeater field group--> |
| 977 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
| 977 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
| 978 | 978 | <tr class="give-row"> |
| 979 | 979 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 980 | 980 | <div class="give-row-head give-move"> |
| 981 | 981 | <button type="button" class="handlediv button-link"> |
| 982 | 982 | <span class="toggle-indicator"></span></button> |
| 983 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 983 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 984 | 984 | </sapn> |
| 985 | 985 | <h2> |
| 986 | 986 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 987 | 987 | </h2> |
| 988 | 988 | </div> |
| 989 | 989 | <div class="give-row-body"> |
| 990 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 991 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 990 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 991 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 992 | 992 | continue; |
| 993 | 993 | } ?> |
| 994 | 994 | <?php |
| 995 | 995 | $field['repeat'] = true; |
| 996 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
| 997 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
| 998 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 996 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
| 997 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
| 998 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 999 | 999 | '_', |
| 1000 | 1000 | '', |
| 1001 | - ), $field['repeatable_field_id'] ); |
|
| 1001 | + ), $field['repeatable_field_id']); |
|
| 1002 | 1002 | ?> |
| 1003 | - <?php give_render_field( $field ); ?> |
|
| 1003 | + <?php give_render_field($field); ?> |
|
| 1004 | 1004 | <?php endforeach; ?> |
| 1005 | 1005 | </div> |
| 1006 | 1006 | </td> |
@@ -1008,14 +1008,14 @@ discard block |
||
| 1008 | 1008 | <?php endforeach; |
| 1009 | 1009 | ; ?> |
| 1010 | 1010 | |
| 1011 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
| 1011 | + <?php elseif ($add_default_donation_field) : ?> |
|
| 1012 | 1012 | <!--Default repeater field group--> |
| 1013 | 1013 | <tr class="give-row"> |
| 1014 | 1014 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 1015 | 1015 | <div class="give-row-head give-move"> |
| 1016 | 1016 | <button type="button" class="handlediv button-link"> |
| 1017 | 1017 | <span class="toggle-indicator"></span></button> |
| 1018 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 1018 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 1019 | 1019 | </sapn> |
| 1020 | 1020 | <h2> |
| 1021 | 1021 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1023,19 +1023,19 @@ discard block |
||
| 1023 | 1023 | </div> |
| 1024 | 1024 | <div class="give-row-body"> |
| 1025 | 1025 | <?php |
| 1026 | - foreach ( $fields['fields'] as $field ) : |
|
| 1027 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1026 | + foreach ($fields['fields'] as $field) : |
|
| 1027 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 1028 | 1028 | continue; |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | $field['repeat'] = true; |
| 1032 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
| 1033 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
| 1034 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 1032 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
| 1033 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
| 1034 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 1035 | 1035 | '_', |
| 1036 | 1036 | '', |
| 1037 | - ), $field['repeatable_field_id'] ); |
|
| 1038 | - give_render_field( $field ); |
|
| 1037 | + ), $field['repeatable_field_id']); |
|
| 1038 | + give_render_field($field); |
|
| 1039 | 1039 | endforeach; |
| 1040 | 1040 | ?> |
| 1041 | 1041 | </div> |
@@ -1046,9 +1046,9 @@ discard block |
||
| 1046 | 1046 | <tfoot> |
| 1047 | 1047 | <tr> |
| 1048 | 1048 | <?php |
| 1049 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
| 1049 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
| 1050 | 1050 | ? $add_row_btn_title = $fields['options']['add_button'] |
| 1051 | - : esc_html__( 'Add Row', 'give' ); |
|
| 1051 | + : esc_html__('Add Row', 'give'); |
|
| 1052 | 1052 | ?> |
| 1053 | 1053 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
| 1054 | 1054 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1078,10 +1078,10 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @param string |
| 1080 | 1080 | */ |
| 1081 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
| 1081 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
| 1082 | 1082 | |
| 1083 | 1083 | // Get current tab. |
| 1084 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
| 1084 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
| 1085 | 1085 | |
| 1086 | 1086 | // Output. |
| 1087 | 1087 | return $current_tab; |
@@ -1105,10 +1105,10 @@ discard block |
||
| 1105 | 1105 | * |
| 1106 | 1106 | * @param string |
| 1107 | 1107 | */ |
| 1108 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
| 1108 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
| 1109 | 1109 | |
| 1110 | 1110 | // Get current section. |
| 1111 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
| 1111 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
| 1112 | 1112 | |
| 1113 | 1113 | // Output. |
| 1114 | 1114 | return $current_section; |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | */ |
| 1123 | 1123 | function give_get_current_setting_page() { |
| 1124 | 1124 | // Get current page. |
| 1125 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
| 1125 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
| 1126 | 1126 | |
| 1127 | 1127 | // Output. |
| 1128 | 1128 | return $setting_page; |
@@ -1142,13 +1142,13 @@ discard block |
||
| 1142 | 1142 | * |
| 1143 | 1143 | * @return string |
| 1144 | 1144 | */ |
| 1145 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
| 1146 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
| 1145 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
| 1146 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
| 1147 | 1147 | |
| 1148 | 1148 | if ( |
| 1149 | - ! get_post_meta( $postid, '_give_display_content', true ) |
|
| 1149 | + ! get_post_meta($postid, '_give_display_content', true) |
|
| 1150 | 1150 | && $show_content |
| 1151 | - && ( 'none' !== $show_content ) |
|
| 1151 | + && ('none' !== $show_content) |
|
| 1152 | 1152 | ) { |
| 1153 | 1153 | $field_value = 'enabled'; |
| 1154 | 1154 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | return $field_value; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
| 1159 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
| 1160 | 1160 | |
| 1161 | 1161 | |
| 1162 | 1162 | /** |
@@ -1173,12 +1173,12 @@ discard block |
||
| 1173 | 1173 | * |
| 1174 | 1174 | * @return string |
| 1175 | 1175 | */ |
| 1176 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
| 1177 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
| 1176 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
| 1177 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
| 1178 | 1178 | |
| 1179 | 1179 | if ( |
| 1180 | - ! get_post_meta( $postid, '_give_content_placement', true ) |
|
| 1181 | - && ( 'none' !== $show_content ) |
|
| 1180 | + ! get_post_meta($postid, '_give_content_placement', true) |
|
| 1181 | + && ('none' !== $show_content) |
|
| 1182 | 1182 | ) { |
| 1183 | 1183 | $field_value = $show_content; |
| 1184 | 1184 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | return $field_value; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
| 1189 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
| 1190 | 1190 | |
| 1191 | 1191 | |
| 1192 | 1192 | /** |
@@ -1202,17 +1202,17 @@ discard block |
||
| 1202 | 1202 | * |
| 1203 | 1203 | * @return string |
| 1204 | 1204 | */ |
| 1205 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
| 1206 | - $term_option = get_post_meta( $postid, '_give_terms_option', true ); |
|
| 1205 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
| 1206 | + $term_option = get_post_meta($postid, '_give_terms_option', true); |
|
| 1207 | 1207 | |
| 1208 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
| 1209 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
| 1208 | + if (in_array($term_option, array('none', 'yes'))) { |
|
| 1209 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | return $field_value; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
| 1215 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
| 1216 | 1216 | |
| 1217 | 1217 | |
| 1218 | 1218 | /** |
@@ -1229,17 +1229,17 @@ discard block |
||
| 1229 | 1229 | * |
| 1230 | 1230 | * @return string |
| 1231 | 1231 | */ |
| 1232 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
| 1233 | - $offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
| 1232 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
| 1233 | + $offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
| 1234 | 1234 | |
| 1235 | - if ( 'on' === $offline_donation ) { |
|
| 1235 | + if ('on' === $offline_donation) { |
|
| 1236 | 1236 | $field_value = 'enabled'; |
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | return $field_value; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
| 1242 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
| 1243 | 1243 | |
| 1244 | 1244 | |
| 1245 | 1245 | /** |
@@ -1255,17 +1255,17 @@ discard block |
||
| 1255 | 1255 | * |
| 1256 | 1256 | * @return string |
| 1257 | 1257 | */ |
| 1258 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
| 1259 | - $custom_amount = get_post_meta( $postid, '_give_custom_amount', true ); |
|
| 1258 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
| 1259 | + $custom_amount = get_post_meta($postid, '_give_custom_amount', true); |
|
| 1260 | 1260 | |
| 1261 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
| 1262 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
| 1261 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
| 1262 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | return $field_value; |
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
| 1268 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
| 1269 | 1269 | |
| 1270 | 1270 | |
| 1271 | 1271 | /** |
@@ -1281,17 +1281,17 @@ discard block |
||
| 1281 | 1281 | * |
| 1282 | 1282 | * @return string |
| 1283 | 1283 | */ |
| 1284 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
| 1285 | - $goal_option = get_post_meta( $postid, '_give_goal_option', true ); |
|
| 1284 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
| 1285 | + $goal_option = get_post_meta($postid, '_give_goal_option', true); |
|
| 1286 | 1286 | |
| 1287 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
| 1288 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
| 1287 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
| 1288 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | return $field_value; |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
| 1294 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
| 1295 | 1295 | |
| 1296 | 1296 | /** |
| 1297 | 1297 | * Set value for Donation Goal --> close Form. |
@@ -1307,17 +1307,17 @@ discard block |
||
| 1307 | 1307 | * |
| 1308 | 1308 | * @return string |
| 1309 | 1309 | */ |
| 1310 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
| 1311 | - $close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
| 1310 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
| 1311 | + $close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
| 1312 | 1312 | |
| 1313 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
| 1314 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
| 1313 | + if (in_array($close_form, array('yes', 'no'))) { |
|
| 1314 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | return $field_value; |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
| 1320 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
| 1321 | 1321 | |
| 1322 | 1322 | |
| 1323 | 1323 | /** |
@@ -1333,17 +1333,17 @@ discard block |
||
| 1333 | 1333 | * |
| 1334 | 1334 | * @return string |
| 1335 | 1335 | */ |
| 1336 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
| 1337 | - $guest_donation = get_post_meta( $postid, '_give_logged_in_only', true ); |
|
| 1336 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
| 1337 | + $guest_donation = get_post_meta($postid, '_give_logged_in_only', true); |
|
| 1338 | 1338 | |
| 1339 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
| 1340 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
| 1339 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
| 1340 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | 1343 | return $field_value; |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
| 1346 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
| 1347 | 1347 | |
| 1348 | 1348 | /** |
| 1349 | 1349 | * Set value for Offline Donations --> Offline Donations. |
@@ -1359,17 +1359,17 @@ discard block |
||
| 1359 | 1359 | * |
| 1360 | 1360 | * @return string |
| 1361 | 1361 | */ |
| 1362 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
| 1363 | - $customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true ); |
|
| 1362 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
| 1363 | + $customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true); |
|
| 1364 | 1364 | |
| 1365 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
| 1366 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
| 1365 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
| 1366 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | return $field_value; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
| 1372 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
| 1373 | 1373 | |
| 1374 | 1374 | |
| 1375 | 1375 | /** |
@@ -1384,14 +1384,14 @@ discard block |
||
| 1384 | 1384 | * |
| 1385 | 1385 | * @return mixed |
| 1386 | 1386 | */ |
| 1387 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
| 1387 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
| 1388 | 1388 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 1389 | 1389 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
| 1390 | 1390 | |
| 1391 | 1391 | return $field_id; |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
| 1394 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
| 1395 | 1395 | |
| 1396 | 1396 | /** |
| 1397 | 1397 | * Set repeater field value for multi donation form. |
@@ -1405,13 +1405,13 @@ discard block |
||
| 1405 | 1405 | * |
| 1406 | 1406 | * @return mixed |
| 1407 | 1407 | */ |
| 1408 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
| 1409 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
| 1408 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
| 1409 | + $field_value = $field_group[$field['id']]['level_id']; |
|
| 1410 | 1410 | |
| 1411 | 1411 | return $field_value; |
| 1412 | 1412 | } |
| 1413 | 1413 | |
| 1414 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
| 1414 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
| 1415 | 1415 | |
| 1416 | 1416 | /** |
| 1417 | 1417 | * Set default value for _give_id field. |
@@ -1422,11 +1422,11 @@ discard block |
||
| 1422 | 1422 | * |
| 1423 | 1423 | * @return string |
| 1424 | 1424 | */ |
| 1425 | -function _give_set_field_give_id_default_value( $field ) { |
|
| 1425 | +function _give_set_field_give_id_default_value($field) { |
|
| 1426 | 1426 | return 0; |
| 1427 | 1427 | } |
| 1428 | 1428 | |
| 1429 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
| 1429 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
| 1430 | 1430 | |
| 1431 | 1431 | /** |
| 1432 | 1432 | * Set default value for _give_default field. |
@@ -1437,11 +1437,11 @@ discard block |
||
| 1437 | 1437 | * |
| 1438 | 1438 | * @return string |
| 1439 | 1439 | */ |
| 1440 | -function _give_set_field_give_default_default_value( $field ) { |
|
| 1440 | +function _give_set_field_give_default_default_value($field) { |
|
| 1441 | 1441 | return 'default'; |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
| 1444 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
| 1445 | 1445 | |
| 1446 | 1446 | /** |
| 1447 | 1447 | * Set repeater field editor id for field type wysiwyg. |
@@ -1453,12 +1453,12 @@ discard block |
||
| 1453 | 1453 | * |
| 1454 | 1454 | * @return string |
| 1455 | 1455 | */ |
| 1456 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
| 1457 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
| 1458 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
| 1456 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
| 1457 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
| 1458 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | return $field_name; |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
| 1464 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|