@@ -5,11 +5,11 @@ |
||
| 5 | 5 | ?> |
| 6 | 6 | <div id="give-payment-processing"> |
| 7 | 7 | <?php |
| 8 | - Give()->notices->print_frontend_notice( sprintf( |
|
| 8 | + Give()->notices->print_frontend_notice(sprintf( |
|
| 9 | 9 | /* translators: %s: success page URL */ |
| 10 | - __( 'Your donation is processing. This page will reload automatically in 8 seconds. If it does not, click <a href="%s">here</a>.', 'give' ), |
|
| 10 | + __('Your donation is processing. This page will reload automatically in 8 seconds. If it does not, click <a href="%s">here</a>.', 'give'), |
|
| 11 | 11 | give_get_success_page_uri() |
| 12 | - ), true, 'success' ); |
|
| 12 | + ), true, 'success'); |
|
| 13 | 13 | ?> |
| 14 | 14 | <span class="give-loading-animation"></span> |
| 15 | 15 | <script type="text/javascript">setTimeout(function () { |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly. |
|
| 10 | 10 | // This is the footer used if no others are available |
| 11 | 11 | ?> |
| 12 | 12 | <!DOCTYPE html> |
| 13 | 13 | <html> |
| 14 | 14 | <head> |
| 15 | 15 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 16 | - <title><?php echo get_bloginfo( 'name' ); ?></title> |
|
| 16 | + <title><?php echo get_bloginfo('name'); ?></title> |
|
| 17 | 17 | </head> |
| 18 | 18 | <body> |
| 19 | 19 | \ No newline at end of file |
@@ -6,7 +6,10 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | + exit; |
|
| 11 | +} |
|
| 12 | +// Exit if accessed directly. |
|
| 10 | 13 | // This is the footer used if no others are available |
| 11 | 14 | ?> |
| 12 | 15 | <!DOCTYPE html> |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly. |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | <table border="0" cellpadding="10" cellspacing="0" width="100%"> |
| 45 | 45 | <tr> |
| 46 | 46 | <td colspan="2" valign="middle" id="credit" style="<?php echo $credit; ?>"> |
| 47 | - <?php echo wpautop( wp_kses_post( wptexturize( apply_filters( 'give_email_footer_text', '<a href="' . esc_url( home_url() ) . '">' . get_bloginfo( 'name' ) . '</a>' ) ) ) ); ?> |
|
| 47 | + <?php echo wpautop(wp_kses_post(wptexturize(apply_filters('give_email_footer_text', '<a href="'.esc_url(home_url()).'">'.get_bloginfo('name').'</a>')))); ?> |
|
| 48 | 48 | </td> |
| 49 | 49 | </tr> |
| 50 | 50 | </table> |
@@ -6,7 +6,10 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | + exit; |
|
| 11 | +} |
|
| 12 | +// Exit if accessed directly. |
|
| 10 | 13 | |
| 11 | 14 | |
| 12 | 15 | // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly. |
|
| 10 | 10 | |
| 11 | 11 | // {email} is replaced by the content entered in Donations > Settings > Emails |
| 12 | 12 | |
@@ -6,7 +6,10 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | + exit; |
|
| 11 | +} |
|
| 12 | +// Exit if accessed directly. |
|
| 10 | 13 | |
| 11 | 14 | // {email} is replaced by the content entered in Donations > Settings > Emails |
| 12 | 15 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly. |
|
| 10 | 10 | |
| 11 | 11 | // This is the footer used if no others are available |
| 12 | 12 | |
@@ -6,7 +6,10 @@ |
||
| 6 | 6 | * @version 1.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | + exit; |
|
| 11 | +} |
|
| 12 | +// Exit if accessed directly. |
|
| 10 | 13 | |
| 11 | 14 | // This is the footer used if no others are available |
| 12 | 15 | |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | 9 | */ |
| 10 | -$current_user = wp_get_current_user(); |
|
| 10 | +$current_user = wp_get_current_user(); |
|
| 11 | 11 | |
| 12 | -if ( is_user_logged_in() ): |
|
| 12 | +if (is_user_logged_in()): |
|
| 13 | 13 | $user_id = get_current_user_id(); |
| 14 | - $first_name = get_user_meta( $user_id, 'first_name', true ); |
|
| 15 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
| 14 | + $first_name = get_user_meta($user_id, 'first_name', true); |
|
| 15 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
| 16 | 16 | $display_name = $current_user->display_name; |
| 17 | - $address = give_get_donor_address( $user_id ); |
|
| 17 | + $address = give_get_donor_address($user_id); |
|
| 18 | 18 | |
| 19 | - if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! give_get_errors() ): ?> |
|
| 19 | + if (isset($_GET['updated']) && $_GET['updated'] == true && ! give_get_errors()): ?> |
|
| 20 | 20 | <p class="give_success"> |
| 21 | - <strong><?php esc_html_e( 'Success:', 'give' ); ?></strong> <?php esc_html_e( 'Your profile has been updated.', 'give' ); ?> |
|
| 21 | + <strong><?php esc_html_e('Success:', 'give'); ?></strong> <?php esc_html_e('Your profile has been updated.', 'give'); ?> |
|
| 22 | 22 | </p> |
| 23 | 23 | <?php endif; ?> |
| 24 | 24 | |
| 25 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
| 25 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | /** |
@@ -32,38 +32,38 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @since 1.0 |
| 34 | 34 | */ |
| 35 | - do_action( 'give_profile_editor_before' ); |
|
| 35 | + do_action('give_profile_editor_before'); |
|
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
| 39 | 39 | |
| 40 | 40 | <fieldset> |
| 41 | 41 | |
| 42 | - <legend id="give_profile_name_label"><?php esc_html_e( 'Change your Name', 'give' ); ?></legend> |
|
| 42 | + <legend id="give_profile_name_label"><?php esc_html_e('Change your Name', 'give'); ?></legend> |
|
| 43 | 43 | |
| 44 | 44 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
| 45 | - <label for="give_first_name"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
| 46 | - <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
|
| 45 | + <label for="give_first_name"><?php esc_html_e('First Name', 'give'); ?></label> |
|
| 46 | + <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/> |
|
| 47 | 47 | </p> |
| 48 | 48 | |
| 49 | 49 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
| 50 | - <label for="give_last_name"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
| 51 | - <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
|
| 50 | + <label for="give_last_name"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
| 51 | + <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/> |
|
| 52 | 52 | </p> |
| 53 | 53 | |
| 54 | 54 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
| 55 | - <label for="give_display_name"><?php esc_html_e( 'Display Name', 'give' ); ?></label> |
|
| 55 | + <label for="give_display_name"><?php esc_html_e('Display Name', 'give'); ?></label> |
|
| 56 | 56 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
| 57 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
| 58 | - <option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
|
| 57 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
| 58 | + <option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option> |
|
| 59 | 59 | <?php endif; ?> |
| 60 | - <option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
|
| 61 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
| 62 | - <option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
|
| 60 | + <option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option> |
|
| 61 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
| 62 | + <option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option> |
|
| 63 | 63 | <?php endif; ?> |
| 64 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
| 65 | - <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
|
| 66 | - <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
|
| 64 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
| 65 | + <option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option> |
|
| 66 | + <option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option> |
|
| 67 | 67 | <?php endif; ?> |
| 68 | 68 | </select> |
| 69 | 69 | <?php |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @since 1.0 |
| 76 | 76 | */ |
| 77 | - do_action( 'give_profile_editor_name' ); |
|
| 77 | + do_action('give_profile_editor_name'); |
|
| 78 | 78 | ?> |
| 79 | 79 | </p> |
| 80 | 80 | |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_profile_editor_after_name' ); |
|
| 89 | + do_action('give_profile_editor_after_name'); |
|
| 90 | 90 | ?> |
| 91 | 91 | |
| 92 | 92 | <p class="form-row form-row-last form-row-responsive"> |
| 93 | - <label for="give_email"><?php esc_html_e( 'Email Address', 'give' ); ?></label> |
|
| 94 | - <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
|
| 93 | + <label for="give_email"><?php esc_html_e('Email Address', 'give'); ?></label> |
|
| 94 | + <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/> |
|
| 95 | 95 | <?php |
| 96 | 96 | /** |
| 97 | 97 | * Fires in the profile editor shortcode, to the email section. |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @since 1.0 |
| 102 | 102 | */ |
| 103 | - do_action( 'give_profile_editor_email' ); |
|
| 103 | + do_action('give_profile_editor_email'); |
|
| 104 | 104 | ?> |
| 105 | 105 | </p> |
| 106 | 106 | |
@@ -112,45 +112,45 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @since 1.0 |
| 114 | 114 | */ |
| 115 | - do_action( 'give_profile_editor_after_email' ); |
|
| 115 | + do_action('give_profile_editor_after_email'); |
|
| 116 | 116 | ?> |
| 117 | 117 | |
| 118 | - <legend id="give_profile_billing_address_label"><?php esc_html_e( 'Change your Billing Address', 'give' ); ?></legend> |
|
| 118 | + <legend id="give_profile_billing_address_label"><?php esc_html_e('Change your Billing Address', 'give'); ?></legend> |
|
| 119 | 119 | |
| 120 | 120 | <div id="give_profile_billing_address_wrap"> |
| 121 | 121 | |
| 122 | 122 | <p id="give-card-address-wrap" class="form-row form-row-first form-row-responsive"> |
| 123 | - <label for="give_address_line1"><?php esc_html_e( 'Address 1', 'give' ); ?></label> |
|
| 124 | - <input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" value="<?php echo esc_attr( $address['line1'] ); ?>"/> |
|
| 123 | + <label for="give_address_line1"><?php esc_html_e('Address 1', 'give'); ?></label> |
|
| 124 | + <input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" value="<?php echo esc_attr($address['line1']); ?>"/> |
|
| 125 | 125 | </p> |
| 126 | 126 | |
| 127 | 127 | <p id="give-card-address-2-wrap" class="form-row form-row-last form-row-responsive"> |
| 128 | - <label for="give_address_line2"><?php esc_html_e( 'Address 2', 'give' ); ?></label> |
|
| 129 | - <input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" value="<?php echo esc_attr( $address['line2'] ); ?>"/> |
|
| 128 | + <label for="give_address_line2"><?php esc_html_e('Address 2', 'give'); ?></label> |
|
| 129 | + <input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" value="<?php echo esc_attr($address['line2']); ?>"/> |
|
| 130 | 130 | </p> |
| 131 | 131 | |
| 132 | 132 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
| 133 | - <label for="give_address_city"><?php esc_html_e( 'City', 'give' ); ?></label> |
|
| 134 | - <input name="give_address_city" id="give_address_city" class="text give-input" type="text" value="<?php echo esc_attr( $address['city'] ); ?>"/> |
|
| 133 | + <label for="give_address_city"><?php esc_html_e('City', 'give'); ?></label> |
|
| 134 | + <input name="give_address_city" id="give_address_city" class="text give-input" type="text" value="<?php echo esc_attr($address['city']); ?>"/> |
|
| 135 | 135 | </p> |
| 136 | 136 | |
| 137 | 137 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 138 | - <label for="give_address_zip"><?php esc_html_e( 'Zip / Postal Code', 'give' ); ?></label> |
|
| 139 | - <input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" value="<?php echo esc_attr( $address['zip'] ); ?>"/> |
|
| 138 | + <label for="give_address_zip"><?php esc_html_e('Zip / Postal Code', 'give'); ?></label> |
|
| 139 | + <input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" value="<?php echo esc_attr($address['zip']); ?>"/> |
|
| 140 | 140 | </p> |
| 141 | 141 | |
| 142 | 142 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
| 143 | - <label for="give_address_country"><?php esc_html_e( 'Country', 'give' ); ?></label> |
|
| 143 | + <label for="give_address_country"><?php esc_html_e('Country', 'give'); ?></label> |
|
| 144 | 144 | <select name="give_address_country" id="give_address_country" class="select give-select"> |
| 145 | - <?php foreach ( give_get_country_list() as $key => $country ) : ?> |
|
| 146 | - <option value="<?php echo $key; ?>"<?php selected( $address['country'], $key ); ?>><?php echo esc_html( $country ); ?></option> |
|
| 145 | + <?php foreach (give_get_country_list() as $key => $country) : ?> |
|
| 146 | + <option value="<?php echo $key; ?>"<?php selected($address['country'], $key); ?>><?php echo esc_html($country); ?></option> |
|
| 147 | 147 | <?php endforeach; ?> |
| 148 | 148 | </select> |
| 149 | 149 | </p> |
| 150 | 150 | |
| 151 | 151 | <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive"> |
| 152 | - <label for="give_address_state"><?php esc_html_e( 'State / Province / County', 'give' ); ?></label> |
|
| 153 | - <input name="give_address_state" id="give_address_state" class="text give-input" type="text" value="<?php echo esc_attr( $address['state'] ); ?>"/> |
|
| 152 | + <label for="give_address_state"><?php esc_html_e('State / Province / County', 'give'); ?></label> |
|
| 153 | + <input name="give_address_state" id="give_address_state" class="text give-input" type="text" value="<?php echo esc_attr($address['state']); ?>"/> |
|
| 154 | 154 | </p> |
| 155 | 155 | |
| 156 | 156 | <?php |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @since 1.0 |
| 163 | 163 | */ |
| 164 | - do_action( 'give_profile_editor_address' ); |
|
| 164 | + do_action('give_profile_editor_address'); |
|
| 165 | 165 | ?> |
| 166 | 166 | |
| 167 | 167 | </div> |
@@ -174,19 +174,19 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @since 1.0 |
| 176 | 176 | */ |
| 177 | - do_action( 'give_profile_editor_after_address' ); |
|
| 177 | + do_action('give_profile_editor_after_address'); |
|
| 178 | 178 | ?> |
| 179 | 179 | |
| 180 | - <legend id="give_profile_password_label"><?php esc_html_e( 'Change your Password', 'give' ); ?></legend> |
|
| 180 | + <legend id="give_profile_password_label"><?php esc_html_e('Change your Password', 'give'); ?></legend> |
|
| 181 | 181 | |
| 182 | 182 | <div id="give_profile_password_wrap" class="give-clearfix"> |
| 183 | 183 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
| 184 | - <label for="give_new_user_pass1"><?php esc_html_e( 'New Password', 'give' ); ?></label> |
|
| 184 | + <label for="give_new_user_pass1"><?php esc_html_e('New Password', 'give'); ?></label> |
|
| 185 | 185 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
| 186 | 186 | </p> |
| 187 | 187 | |
| 188 | 188 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
| 189 | - <label for="give_new_user_pass2"><?php esc_html_e( 'Re-enter Password', 'give' ); ?></label> |
|
| 189 | + <label for="give_new_user_pass2"><?php esc_html_e('Re-enter Password', 'give'); ?></label> |
|
| 190 | 190 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
| 191 | 191 | <?php |
| 192 | 192 | /** |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @since 1.0 |
| 198 | 198 | */ |
| 199 | - do_action( 'give_profile_editor_password' ); |
|
| 199 | + do_action('give_profile_editor_password'); |
|
| 200 | 200 | ?> |
| 201 | 201 | </p> |
| 202 | 202 | </div> |
| 203 | 203 | |
| 204 | - <p class="give_password_change_notice"><?php esc_html_e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
| 204 | + <p class="give_password_change_notice"><?php esc_html_e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
| 205 | 205 | |
| 206 | 206 | <?php |
| 207 | 207 | /** |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | * |
| 212 | 212 | * @since 1.0 |
| 213 | 213 | */ |
| 214 | - do_action( 'give_profile_editor_after_password' ); |
|
| 214 | + do_action('give_profile_editor_after_password'); |
|
| 215 | 215 | ?> |
| 216 | 216 | |
| 217 | 217 | <p id="give_profile_submit_wrap"> |
| 218 | - <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
| 218 | + <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
| 219 | 219 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
| 220 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
| 221 | - <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php esc_attr_e( 'Save Changes', 'give' ); ?>"/> |
|
| 220 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
| 221 | + <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php esc_attr_e('Save Changes', 'give'); ?>"/> |
|
| 222 | 222 | </p> |
| 223 | 223 | |
| 224 | 224 | </fieldset> |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @since 1.0 |
| 235 | 235 | */ |
| 236 | - do_action( 'give_profile_editor_after' ); |
|
| 236 | + do_action('give_profile_editor_after'); |
|
| 237 | 237 | ?> |
| 238 | 238 | |
| 239 | 239 | <?php |
| 240 | 240 | else: |
| 241 | - esc_html_e( 'You need to login to edit your profile.', 'give' ); |
|
| 241 | + esc_html_e('You need to login to edit your profile.', 'give'); |
|
| 242 | 242 | echo give_login_form(); |
| 243 | 243 | endif; |
@@ -237,7 +237,9 @@ |
||
| 237 | 237 | ?> |
| 238 | 238 | |
| 239 | 239 | <?php |
| 240 | -else: |
|
| 240 | +else { |
|
| 241 | + : |
|
| 241 | 242 | esc_html_e( 'You need to login to edit your profile.', 'give' ); |
| 243 | +} |
|
| 242 | 244 | echo give_login_form(); |
| 243 | 245 | endif; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param array $args An array of form arguments. |
| 23 | 23 | * |
| 24 | - * @return string Donation form. |
|
| 24 | + * @return false|null Donation form. |
|
| 25 | 25 | */ |
| 26 | 26 | function give_get_donation_form( $args = array() ) { |
| 27 | 27 | |
@@ -1488,7 +1488,7 @@ discard block |
||
| 1488 | 1488 | * |
| 1489 | 1489 | * @param int $form_id The form ID. |
| 1490 | 1490 | * |
| 1491 | - * @return bool |
|
| 1491 | + * @return false|null |
|
| 1492 | 1492 | */ |
| 1493 | 1493 | function give_terms_agreement( $form_id ) { |
| 1494 | 1494 | $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
@@ -1666,7 +1666,7 @@ discard block |
||
| 1666 | 1666 | * @param int $form_id The form ID. |
| 1667 | 1667 | * @param array $args An array of form arguments. |
| 1668 | 1668 | * |
| 1669 | - * @return mixed |
|
| 1669 | + * @return boolean |
|
| 1670 | 1670 | */ |
| 1671 | 1671 | function give_show_goal_progress( $form_id, $args ) { |
| 1672 | 1672 | |
@@ -1686,7 +1686,7 @@ discard block |
||
| 1686 | 1686 | * |
| 1687 | 1687 | * @since 1.8 |
| 1688 | 1688 | * |
| 1689 | - * @param $form_id |
|
| 1689 | + * @param integer $form_id |
|
| 1690 | 1690 | * @param $args |
| 1691 | 1691 | * |
| 1692 | 1692 | * @return mixed|string |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | * @param int $form_id The form ID. |
| 1728 | 1728 | * @param array $args An array of form arguments. |
| 1729 | 1729 | * |
| 1730 | - * @return void|bool |
|
| 1730 | + * @return false|null |
|
| 1731 | 1731 | */ |
| 1732 | 1732 | function give_form_content( $form_id, $args ) { |
| 1733 | 1733 | |
@@ -343,7 +343,7 @@ |
||
| 343 | 343 | ?> |
| 344 | 344 | </div> |
| 345 | 345 | <?php |
| 346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 346 | + elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 347 | 347 | ?> |
| 348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 349 | 349 | <?php |
@@ -1057,9 +1057,12 @@ |
||
| 1057 | 1057 | } |
| 1058 | 1058 | ?> |
| 1059 | 1059 | </select> |
| 1060 | - <?php else : ?> |
|
| 1060 | + <?php else { |
|
| 1061 | + : ?> |
|
| 1061 | 1062 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1062 | - placeholder="<?php echo $label; ?>"/> |
|
| 1063 | + placeholder="<?php echo $label; |
|
| 1064 | +} |
|
| 1065 | +?>"/> |
|
| 1063 | 1066 | <?php endif; ?> |
| 1064 | 1067 | </p> |
| 1065 | 1068 | <?php |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,50 +23,50 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID. |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 58 | 58 | if ( |
| 59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 60 | - || ( 'trash' === $form->post_status ) |
|
| 59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 60 | + || ('trash' === $form->post_status) |
|
| 61 | 61 | ) { |
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | //Get the form wrap CSS classes. |
| 66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | //Get the <form> tag wrap CSS classes. |
| 69 | - $form_classes = $form->get_form_classes( $args ); |
|
| 69 | + $form_classes = $form->get_form_classes($args); |
|
| 70 | 70 | |
| 71 | 71 | ob_start(); |
| 72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * @param int $form_id The form ID. |
| 79 | 79 | * @param array $args An array of form arguments. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 85 | 85 | |
| 86 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 86 | + <?php if ($form->is_close_donation_form()) { |
|
| 87 | 87 | |
| 88 | 88 | // Get Goal thank you message. |
| 89 | - $goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
| 89 | + $goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
| 91 | 91 | |
| 92 | 92 | // Print thank you message. |
| 93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
| 93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
| 94 | 94 | |
| 95 | 95 | } else { |
| 96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * 1. if show_title params set to true |
| 99 | 99 | * 2. if admin set form display_style to button |
| 100 | 100 | */ |
| 101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 102 | 102 | if ( |
| 103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
| 104 | - && ! doing_action( 'give_single_form_summary' ) |
|
| 103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
| 104 | + && ! doing_action('give_single_form_summary') |
|
| 105 | 105 | ) { |
| 106 | 106 | echo $form_title; |
| 107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param int $form_id The form ID. |
| 115 | 115 | * @param array $args An array of form arguments. |
| 116 | 116 | */ |
| 117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 117 | + do_action('give_pre_form', $form->ID, $args); |
|
| 118 | 118 | ?> |
| 119 | 119 | |
| 120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 124 | 124 | <input type="hidden" name="give-current-url" |
| 125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 126 | 126 | <input type="hidden" name="give-form-url" |
| 127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 128 | 128 | <input type="hidden" name="give-form-minimum" |
| 129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ), array( 'sanitize' => false ) ); ?>"/> |
|
| 129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID), array('sanitize' => false)); ?>"/> |
|
| 130 | 130 | |
| 131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
| 132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | 140 | // Price ID hidden field for variable (multi-level) donation forms. |
| 141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 141 | + if (give_has_variable_prices($form_id)) { |
|
| 142 | 142 | // Get default selected price ID. |
| 143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 144 | 144 | $price_id = 0; |
| 145 | 145 | //loop through prices. |
| 146 | - foreach ( $prices as $price ) { |
|
| 147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 146 | + foreach ($prices as $price) { |
|
| 147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 148 | 148 | $price_id = $price['_give_id']['level_id']; |
| 149 | 149 | }; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param int $form_id The form ID. |
| 161 | 161 | * @param array $args An array of form arguments. |
| 162 | 162 | */ |
| 163 | - do_action( 'give_donation_form_top', $form->ID, $args ); |
|
| 163 | + do_action('give_donation_form_top', $form->ID, $args); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Fires while outputting donation form, for payment gateway fields. |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param int $form_id The form ID. |
| 171 | 171 | * @param array $args An array of form arguments. |
| 172 | 172 | */ |
| 173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Fires while outputting donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param int $form_id The form ID. |
| 181 | 181 | * @param array $args An array of form arguments. |
| 182 | 182 | */ |
| 183 | - do_action( 'give_donation_form_bottom', $form->ID, $args ); |
|
| 183 | + do_action('give_donation_form_bottom', $form->ID, $args); |
|
| 184 | 184 | |
| 185 | 185 | ?> |
| 186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | * @param int $form_id The form ID. |
| 195 | 195 | * @param array $args An array of form arguments. |
| 196 | 196 | */ |
| 197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 197 | + do_action('give_post_form', $form->ID, $args); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | 201 | |
| 202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 203 | 203 | <?php |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @param int $form_id The form ID. |
| 211 | 211 | * @param array $args An array of form arguments. |
| 212 | 212 | */ |
| 213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 213 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 214 | 214 | |
| 215 | 215 | $final_output = ob_get_clean(); |
| 216 | 216 | |
| 217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return string |
| 233 | 233 | */ |
| 234 | -function give_show_purchase_form( $form_id ) { |
|
| 234 | +function give_show_purchase_form($form_id) { |
|
| 235 | 235 | |
| 236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 237 | 237 | |
| 238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 239 | 239 | $form_id = $_POST['give_form_id']; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @since 1.7 |
| 246 | 246 | */ |
| 247 | - do_action( 'give_payment_fields_top', $form_id ); |
|
| 247 | + do_action('give_payment_fields_top', $form_id); |
|
| 248 | 248 | |
| 249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 249 | + if (give_can_checkout() && isset($form_id)) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Fires while displaying donation form, before registration login. |
| 253 | 253 | * |
| 254 | 254 | * @since 1.7 |
| 255 | 255 | */ |
| 256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Fire when register/login form fields render. |
| 260 | 260 | * |
| 261 | 261 | * @since 1.7 |
| 262 | 262 | */ |
| 263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Fire when credit card form fields render. |
| 267 | 267 | * |
| 268 | 268 | * @since 1.7 |
| 269 | 269 | */ |
| 270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 271 | 271 | |
| 272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
| 273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 274 | 274 | /** |
| 275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param int $form_id The form ID. |
| 280 | 280 | */ |
| 281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 282 | 282 | } else { |
| 283 | 283 | /** |
| 284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param int $form_id The form ID. |
| 289 | 289 | */ |
| 290 | - do_action( 'give_cc_form', $form_id ); |
|
| 290 | + do_action('give_cc_form', $form_id); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @since 1.7 |
| 297 | 297 | */ |
| 298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @since 1.7 |
| 305 | 305 | */ |
| 306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 306 | + do_action('give_donation_form_no_access', $form_id); |
|
| 307 | 307 | |
| 308 | 308 | } |
| 309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.7 |
| 314 | 314 | */ |
| 315 | - do_action( 'give_payment_fields_bottom', $form_id ); |
|
| 315 | + do_action('give_payment_fields_bottom', $form_id); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return void |
| 328 | 328 | */ |
| 329 | -function give_show_register_login_fields( $form_id ) { |
|
| 329 | +function give_show_register_login_fields($form_id) { |
|
| 330 | 330 | |
| 331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 331 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 332 | 332 | |
| 333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 334 | 334 | ?> |
| 335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.7 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 342 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 343 | 343 | ?> |
| 344 | 344 | </div> |
| 345 | 345 | <?php |
| 346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 347 | 347 | ?> |
| 348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @since 1.7 |
| 354 | 354 | */ |
| 355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 355 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 356 | 356 | ?> |
| 357 | 357 | </div> |
| 358 | 358 | <?php |
| 359 | 359 | endif; |
| 360 | 360 | |
| 361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 362 | 362 | /** |
| 363 | 363 | * Fire when user info render. |
| 364 | 364 | * |
| 365 | 365 | * @since 1.7 |
| 366 | 366 | */ |
| 367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 387 | 387 | |
| 388 | 388 | $give_options = give_get_settings(); |
| 389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 390 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false ) ); |
|
| 395 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 390 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false)); |
|
| 395 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
| 402 | 402 | * @param int $form_id The form ID. |
| 403 | 403 | * @param array $args An array of form arguments. |
| 404 | 404 | */ |
| 405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 406 | 406 | |
| 407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
| 408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
| 408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
| 409 | 409 | ?> |
| 410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
| 414 | - <?php if ( $currency_position == 'before' ) { |
|
| 414 | + <?php if ($currency_position == 'before') { |
|
| 415 | 415 | echo $currency_output; |
| 416 | 416 | } ?> |
| 417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 418 | - <?php if ( $currency_position == 'after' ) { |
|
| 418 | + <?php if ($currency_position == 'after') { |
|
| 419 | 419 | echo $currency_output; |
| 420 | 420 | } ?> |
| 421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | ?> |
| 426 | 426 | <div class="give-total-wrap"> |
| 427 | 427 | <div class="give-donation-amount form-row-wide"> |
| 428 | - <?php if ( $currency_position == 'before' ) { |
|
| 428 | + <?php if ($currency_position == 'before') { |
|
| 429 | 429 | echo $currency_output; |
| 430 | 430 | } ?> |
| 431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 434 | - <?php if ( $currency_position == 'after' ) { |
|
| 434 | + <?php if ($currency_position == 'after') { |
|
| 435 | 435 | echo $currency_output; |
| 436 | 436 | } ?> |
| 437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | * @param int $form_id The form ID. |
| 447 | 447 | * @param array $args An array of form arguments. |
| 448 | 448 | */ |
| 449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 450 | 450 | |
| 451 | 451 | //Custom Amount Text |
| 452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
| 452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
| 453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 454 | 454 | <?php } |
| 455 | 455 | |
| 456 | 456 | //Output Variable Pricing Levels. |
| 457 | - if ( $variable_pricing ) { |
|
| 458 | - give_output_levels( $form_id ); |
|
| 457 | + if ($variable_pricing) { |
|
| 458 | + give_output_levels($form_id); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @param int $form_id The form ID. |
| 467 | 467 | * @param array $args An array of form arguments. |
| 468 | 468 | */ |
| 469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | -add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 472 | +add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,30 +480,30 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @return string Donation levels. |
| 482 | 482 | */ |
| 483 | -function give_output_levels( $form_id ) { |
|
| 483 | +function give_output_levels($form_id) { |
|
| 484 | 484 | |
| 485 | 485 | //Get variable pricing. |
| 486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 487 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
| 488 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 489 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 490 | - if ( empty( $custom_amount_text ) ) { |
|
| 491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 487 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
| 488 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 489 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 490 | + if (empty($custom_amount_text)) { |
|
| 491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $output = ''; |
| 495 | 495 | |
| 496 | - switch ( $display_style ) { |
|
| 496 | + switch ($display_style) { |
|
| 497 | 497 | case 'buttons': |
| 498 | 498 | |
| 499 | 499 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 500 | 500 | |
| 501 | - foreach ( $prices as $price ) { |
|
| 502 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price ); |
|
| 503 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 501 | + foreach ($prices as $price) { |
|
| 502 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price); |
|
| 503 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 504 | 504 | |
| 505 | 505 | $output .= '<li>'; |
| 506 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">'; |
|
| 506 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">'; |
|
| 507 | 507 | $output .= $level_text; |
| 508 | 508 | $output .= '</button>'; |
| 509 | 509 | $output .= '</li>'; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | //Custom Amount. |
| 514 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 514 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 515 | 515 | $output .= '<li>'; |
| 516 | 516 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 517 | 517 | $output .= $custom_amount_text; |
@@ -527,22 +527,22 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 529 | 529 | |
| 530 | - foreach ( $prices as $price ) { |
|
| 531 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price ); |
|
| 532 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 530 | + foreach ($prices as $price) { |
|
| 531 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price); |
|
| 532 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 533 | 533 | |
| 534 | 534 | $output .= '<li>'; |
| 535 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">'; |
|
| 536 | - $output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>'; |
|
| 535 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">'; |
|
| 536 | + $output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>'; |
|
| 537 | 537 | $output .= '</li>'; |
| 538 | 538 | |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | //Custom Amount. |
| 542 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 542 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 543 | 543 | $output .= '<li>'; |
| 544 | 544 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 545 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 545 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 546 | 546 | $output .= '</li>'; |
| 547 | 547 | } |
| 548 | 548 | |
@@ -552,23 +552,23 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | case 'dropdown': |
| 554 | 554 | |
| 555 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 556 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 555 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 556 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 557 | 557 | |
| 558 | 558 | //first loop through prices. |
| 559 | - foreach ( $prices as $price ) { |
|
| 560 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price ); |
|
| 561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 559 | + foreach ($prices as $price) { |
|
| 560 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price); |
|
| 561 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 562 | 562 | |
| 563 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">'; |
|
| 563 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">'; |
|
| 564 | 564 | $output .= $level_text; |
| 565 | 565 | $output .= '</option>'; |
| 566 | 566 | |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | //Custom Amount. |
| 570 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 571 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 570 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 571 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | $output .= '</select>'; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | break; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 579 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /** |
@@ -591,27 +591,27 @@ discard block |
||
| 591 | 591 | * |
| 592 | 592 | * @return string Checkout button. |
| 593 | 593 | */ |
| 594 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 594 | +function give_display_checkout_button($form_id, $args) { |
|
| 595 | 595 | |
| 596 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 596 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 597 | 597 | ? $args['display_style'] |
| 598 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
| 598 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
| 599 | 599 | |
| 600 | - if ( 'button' === $display_option ) { |
|
| 600 | + if ('button' === $display_option) { |
|
| 601 | 601 | $display_option = 'modal'; |
| 602 | - } elseif ( $display_option === 'onpage' ) { |
|
| 602 | + } elseif ($display_option === 'onpage') { |
|
| 603 | 603 | return ''; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
| 607 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 606 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
| 607 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 608 | 608 | |
| 609 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 609 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 610 | 610 | |
| 611 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 611 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 614 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | 617 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -622,57 +622,57 @@ discard block |
||
| 622 | 622 | * |
| 623 | 623 | * @return void |
| 624 | 624 | */ |
| 625 | -function give_user_info_fields( $form_id ) { |
|
| 625 | +function give_user_info_fields($form_id) { |
|
| 626 | 626 | // Get user info. |
| 627 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 627 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 628 | 628 | |
| 629 | 629 | /** |
| 630 | 630 | * Fire before user personal information fields |
| 631 | 631 | * |
| 632 | 632 | * @since 1.7 |
| 633 | 633 | */ |
| 634 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 634 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 635 | 635 | ?> |
| 636 | 636 | <fieldset id="give_checkout_user_info"> |
| 637 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 637 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 638 | 638 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
| 639 | 639 | <label class="give-label" for="give-first"> |
| 640 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 641 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 640 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 641 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 642 | 642 | <span class="give-required-indicator">*</span> |
| 643 | 643 | <?php endif ?> |
| 644 | 644 | <span class="give-tooltip give-icon give-icon-question" |
| 645 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 645 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 646 | 646 | </label> |
| 647 | 647 | <input |
| 648 | 648 | class="give-input required" |
| 649 | 649 | type="text" |
| 650 | 650 | name="give_first" |
| 651 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 651 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 652 | 652 | id="give-first" |
| 653 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 654 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 653 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 654 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 655 | 655 | /> |
| 656 | 656 | </p> |
| 657 | 657 | |
| 658 | 658 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
| 659 | 659 | <label class="give-label" for="give-last"> |
| 660 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 661 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 660 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 661 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 662 | 662 | <span class="give-required-indicator">*</span> |
| 663 | 663 | <?php endif ?> |
| 664 | 664 | <span class="give-tooltip give-icon give-icon-question" |
| 665 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 665 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 666 | 666 | </label> |
| 667 | 667 | |
| 668 | 668 | <input |
| 669 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 669 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 670 | 670 | type="text" |
| 671 | 671 | name="give_last" |
| 672 | 672 | id="give-last" |
| 673 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 674 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 675 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 673 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 674 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 675 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 676 | 676 | /> |
| 677 | 677 | </p> |
| 678 | 678 | |
@@ -682,26 +682,26 @@ discard block |
||
| 682 | 682 | * |
| 683 | 683 | * @since 1.7 |
| 684 | 684 | */ |
| 685 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 685 | + do_action('give_donation_form_before_email', $form_id); |
|
| 686 | 686 | ?> |
| 687 | 687 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 688 | 688 | <label class="give-label" for="give-email"> |
| 689 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 690 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 689 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 690 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 691 | 691 | <span class="give-required-indicator">*</span> |
| 692 | 692 | <?php } ?> |
| 693 | 693 | <span class="give-tooltip give-icon give-icon-question" |
| 694 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 694 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 695 | 695 | </label> |
| 696 | 696 | |
| 697 | 697 | <input |
| 698 | 698 | class="give-input required" |
| 699 | 699 | type="email" |
| 700 | 700 | name="give_email" |
| 701 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 701 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 702 | 702 | id="give-email" |
| 703 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 704 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 703 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 704 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 705 | 705 | /> |
| 706 | 706 | |
| 707 | 707 | </p> |
@@ -711,14 +711,14 @@ discard block |
||
| 711 | 711 | * |
| 712 | 712 | * @since 1.7 |
| 713 | 713 | */ |
| 714 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 714 | + do_action('give_donation_form_after_email', $form_id); |
|
| 715 | 715 | |
| 716 | 716 | /** |
| 717 | 717 | * Fire after personal email field |
| 718 | 718 | * |
| 719 | 719 | * @since 1.7 |
| 720 | 720 | */ |
| 721 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 721 | + do_action('give_donation_form_user_info', $form_id); |
|
| 722 | 722 | ?> |
| 723 | 723 | </fieldset> |
| 724 | 724 | <?php |
@@ -727,11 +727,11 @@ discard block |
||
| 727 | 727 | * |
| 728 | 728 | * @since 1.7 |
| 729 | 729 | */ |
| 730 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 730 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 733 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 734 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * Renders the credit card info form. |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | * |
| 743 | 743 | * @return void |
| 744 | 744 | */ |
| 745 | -function give_get_cc_form( $form_id ) { |
|
| 745 | +function give_get_cc_form($form_id) { |
|
| 746 | 746 | |
| 747 | 747 | ob_start(); |
| 748 | 748 | |
@@ -753,53 +753,53 @@ discard block |
||
| 753 | 753 | * |
| 754 | 754 | * @param int $form_id The form ID. |
| 755 | 755 | */ |
| 756 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 756 | + do_action('give_before_cc_fields', $form_id); |
|
| 757 | 757 | ?> |
| 758 | 758 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 759 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 760 | - <?php if ( is_ssl() ) : ?> |
|
| 759 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 760 | + <?php if (is_ssl()) : ?> |
|
| 761 | 761 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 762 | 762 | <span class="give-icon padlock"></span> |
| 763 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 763 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 764 | 764 | </div> |
| 765 | 765 | <?php endif; ?> |
| 766 | 766 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 767 | 767 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 768 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 768 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 769 | 769 | <span class="give-required-indicator">*</span> |
| 770 | 770 | <span class="give-tooltip give-icon give-icon-question" |
| 771 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 771 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 772 | 772 | <span class="card-type"></span> |
| 773 | 773 | </label> |
| 774 | 774 | |
| 775 | 775 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 776 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 776 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 777 | 777 | required aria-required="true"/> |
| 778 | 778 | </p> |
| 779 | 779 | |
| 780 | 780 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
| 781 | 781 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 782 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 782 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 783 | 783 | <span class="give-required-indicator">*</span> |
| 784 | 784 | <span class="give-tooltip give-icon give-icon-question" |
| 785 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 785 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 786 | 786 | </label> |
| 787 | 787 | |
| 788 | 788 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 789 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 789 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 790 | 790 | required aria-required="true"/> |
| 791 | 791 | </p> |
| 792 | 792 | |
| 793 | 793 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 794 | 794 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 795 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 795 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 796 | 796 | <span class="give-required-indicator">*</span> |
| 797 | 797 | <span class="give-tooltip give-icon give-icon-question" |
| 798 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 798 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 799 | 799 | </label> |
| 800 | 800 | |
| 801 | 801 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 802 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 802 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 803 | 803 | required aria-required="true"/> |
| 804 | 804 | </p> |
| 805 | 805 | <?php |
@@ -810,14 +810,14 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @param int $form_id The form ID. |
| 812 | 812 | */ |
| 813 | - do_action( 'give_before_cc_expiration' ); |
|
| 813 | + do_action('give_before_cc_expiration'); |
|
| 814 | 814 | ?> |
| 815 | 815 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
| 816 | 816 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 817 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 817 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 818 | 818 | <span class="give-required-indicator">*</span> |
| 819 | 819 | <span class="give-tooltip give-icon give-icon-question" |
| 820 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 820 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 821 | 821 | </label> |
| 822 | 822 | |
| 823 | 823 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | class="card-expiry-year"/> |
| 827 | 827 | |
| 828 | 828 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 829 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 829 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 830 | 830 | required aria-required="true"/> |
| 831 | 831 | </p> |
| 832 | 832 | <?php |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | * |
| 838 | 838 | * @param int $form_id The form ID. |
| 839 | 839 | */ |
| 840 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 840 | + do_action('give_after_cc_expiration', $form_id); |
|
| 841 | 841 | ?> |
| 842 | 842 | </fieldset> |
| 843 | 843 | <?php |
@@ -848,12 +848,12 @@ discard block |
||
| 848 | 848 | * |
| 849 | 849 | * @param int $form_id The form ID. |
| 850 | 850 | */ |
| 851 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 851 | + do_action('give_after_cc_fields', $form_id); |
|
| 852 | 852 | |
| 853 | 853 | echo ob_get_clean(); |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 856 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 857 | 857 | |
| 858 | 858 | /** |
| 859 | 859 | * Outputs the default credit card address fields. |
@@ -864,24 +864,24 @@ discard block |
||
| 864 | 864 | * |
| 865 | 865 | * @return void |
| 866 | 866 | */ |
| 867 | -function give_default_cc_address_fields( $form_id ) { |
|
| 867 | +function give_default_cc_address_fields($form_id) { |
|
| 868 | 868 | // Get user info. |
| 869 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 869 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 870 | 870 | |
| 871 | 871 | $logged_in = is_user_logged_in(); |
| 872 | 872 | |
| 873 | - if ( $logged_in ) { |
|
| 874 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 873 | + if ($logged_in) { |
|
| 874 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 875 | 875 | } |
| 876 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 877 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 878 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 879 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 876 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 877 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 878 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 879 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 880 | 880 | |
| 881 | 881 | ob_start(); |
| 882 | 882 | ?> |
| 883 | 883 | <fieldset id="give_cc_address" class="cc-address"> |
| 884 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 884 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 885 | 885 | <?php |
| 886 | 886 | /** |
| 887 | 887 | * Fires while rendering credit card billing form, before address fields. |
@@ -890,79 +890,79 @@ discard block |
||
| 890 | 890 | * |
| 891 | 891 | * @param int $form_id The form ID. |
| 892 | 892 | */ |
| 893 | - do_action( 'give_cc_billing_top' ); |
|
| 893 | + do_action('give_cc_billing_top'); |
|
| 894 | 894 | ?> |
| 895 | 895 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
| 896 | 896 | <label for="card_address" class="give-label"> |
| 897 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 897 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 898 | 898 | <?php |
| 899 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 899 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 900 | 900 | <span class="give-required-indicator">*</span> |
| 901 | 901 | <?php endif; ?> |
| 902 | 902 | <span class="give-tooltip give-icon give-icon-question" |
| 903 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 903 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 904 | 904 | </label> |
| 905 | 905 | |
| 906 | 906 | <input |
| 907 | 907 | type="text" |
| 908 | 908 | id="card_address" |
| 909 | 909 | name="card_address" |
| 910 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 911 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 912 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 913 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 910 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 911 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 912 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 913 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 914 | 914 | /> |
| 915 | 915 | </p> |
| 916 | 916 | |
| 917 | 917 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
| 918 | 918 | <label for="card_address_2" class="give-label"> |
| 919 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 920 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 919 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 920 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 921 | 921 | <span class="give-required-indicator">*</span> |
| 922 | 922 | <?php endif; ?> |
| 923 | 923 | <span class="give-tooltip give-icon give-icon-question" |
| 924 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 924 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 925 | 925 | </label> |
| 926 | 926 | |
| 927 | 927 | <input |
| 928 | 928 | type="text" |
| 929 | 929 | id="card_address_2" |
| 930 | 930 | name="card_address_2" |
| 931 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 932 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 933 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 934 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 931 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 932 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 933 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 934 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 935 | 935 | /> |
| 936 | 936 | </p> |
| 937 | 937 | |
| 938 | 938 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
| 939 | 939 | <label for="card_city" class="give-label"> |
| 940 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 941 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 940 | + <?php esc_html_e('City', 'give'); ?> |
|
| 941 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 942 | 942 | <span class="give-required-indicator">*</span> |
| 943 | 943 | <?php endif; ?> |
| 944 | 944 | <span class="give-tooltip give-icon give-icon-question" |
| 945 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 945 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 946 | 946 | </label> |
| 947 | 947 | <input |
| 948 | 948 | type="text" |
| 949 | 949 | id="card_city" |
| 950 | 950 | name="card_city" |
| 951 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 952 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 953 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 954 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 951 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 952 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 953 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 954 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 955 | 955 | /> |
| 956 | 956 | </p> |
| 957 | 957 | |
| 958 | 958 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 959 | 959 | <label for="card_zip" class="give-label"> |
| 960 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 961 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 960 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 961 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 962 | 962 | <span class="give-required-indicator">*</span> |
| 963 | 963 | <?php endif; ?> |
| 964 | 964 | <span class="give-tooltip give-icon give-icon-question" |
| 965 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 965 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 966 | 966 | </label> |
| 967 | 967 | |
| 968 | 968 | <input |
@@ -970,40 +970,40 @@ discard block |
||
| 970 | 970 | size="4" |
| 971 | 971 | id="card_zip" |
| 972 | 972 | name="card_zip" |
| 973 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 974 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 975 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 976 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 973 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 974 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 975 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 976 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 977 | 977 | /> |
| 978 | 978 | </p> |
| 979 | 979 | |
| 980 | 980 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
| 981 | 981 | <label for="billing_country" class="give-label"> |
| 982 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 983 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 982 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 983 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 984 | 984 | <span class="give-required-indicator">*</span> |
| 985 | 985 | <?php endif; ?> |
| 986 | 986 | <span class="give-tooltip give-icon give-icon-question" |
| 987 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 987 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 988 | 988 | </label> |
| 989 | 989 | |
| 990 | 990 | <select |
| 991 | 991 | name="billing_country" |
| 992 | 992 | id="billing_country" |
| 993 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 994 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 993 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 994 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 995 | 995 | > |
| 996 | 996 | <?php |
| 997 | 997 | |
| 998 | 998 | $selected_country = give_get_country(); |
| 999 | 999 | |
| 1000 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1000 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1001 | 1001 | $selected_country = $give_user_info['billing_country']; |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | $countries = give_get_country_list(); |
| 1005 | - foreach ( $countries as $country_code => $country ) { |
|
| 1006 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1005 | + foreach ($countries as $country_code => $country) { |
|
| 1006 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | ?> |
| 1009 | 1009 | </select> |
@@ -1013,19 +1013,19 @@ discard block |
||
| 1013 | 1013 | <?php |
| 1014 | 1014 | $selected_state = give_get_state(); |
| 1015 | 1015 | |
| 1016 | - $label = __( 'State', 'give' ); |
|
| 1016 | + $label = __('State', 'give'); |
|
| 1017 | 1017 | $states_label = give_get_states_label(); |
| 1018 | 1018 | // Check if $country code exists in the array key for states label. |
| 1019 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
| 1020 | - $label = $states_label[ $selected_country ]; |
|
| 1019 | + if (array_key_exists($selected_country, $states_label)) { |
|
| 1020 | + $label = $states_label[$selected_country]; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | - $states = give_get_states( $selected_country ); |
|
| 1023 | + $states = give_get_states($selected_country); |
|
| 1024 | 1024 | |
| 1025 | 1025 | // Get the country list that do not have any states init. |
| 1026 | 1026 | $no_states_country = give_no_states_country_list(); |
| 1027 | 1027 | |
| 1028 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1028 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1029 | 1029 | $selected_state = $give_user_info['card_state']; |
| 1030 | 1030 | } |
| 1031 | 1031 | |
@@ -1033,27 +1033,27 @@ discard block |
||
| 1033 | 1033 | $states_not_required_country_list = give_states_not_required_country_list(); |
| 1034 | 1034 | ?> |
| 1035 | 1035 | <p id="give-card-state-wrap" |
| 1036 | - class="form-row form-row-last form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> "> |
|
| 1036 | + class="form-row form-row-last form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> "> |
|
| 1037 | 1037 | <label for="card_state" class="give-label"> |
| 1038 | 1038 | <span class="state-label-text"><?php echo $label; ?></span> |
| 1039 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : |
|
| 1039 | + <?php if (give_field_is_required('card_state', $form_id)) : |
|
| 1040 | 1040 | ?> |
| 1041 | - <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span> |
|
| 1041 | + <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span> |
|
| 1042 | 1042 | <?php endif; ?> |
| 1043 | 1043 | <span class="give-tooltip give-icon give-icon-question" |
| 1044 | - data-tooltip="<?php esc_attr_e( 'The state or province or county for your billing address.', 'give' ); ?>"></span> |
|
| 1044 | + data-tooltip="<?php esc_attr_e('The state or province or county for your billing address.', 'give'); ?>"></span> |
|
| 1045 | 1045 | </label> |
| 1046 | 1046 | <?php |
| 1047 | 1047 | |
| 1048 | - if ( ! empty( $states ) ) : ?> |
|
| 1048 | + if ( ! empty($states)) : ?> |
|
| 1049 | 1049 | <select |
| 1050 | 1050 | name="card_state" |
| 1051 | 1051 | id="card_state" |
| 1052 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1053 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
| 1052 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1053 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
| 1054 | 1054 | <?php |
| 1055 | - foreach ( $states as $state_code => $state ) { |
|
| 1056 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1055 | + foreach ($states as $state_code => $state) { |
|
| 1056 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1057 | 1057 | } |
| 1058 | 1058 | ?> |
| 1059 | 1059 | </select> |
@@ -1070,14 +1070,14 @@ discard block |
||
| 1070 | 1070 | * |
| 1071 | 1071 | * @param int $form_id The form ID. |
| 1072 | 1072 | */ |
| 1073 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1073 | + do_action('give_cc_billing_bottom'); |
|
| 1074 | 1074 | ?> |
| 1075 | 1075 | </fieldset> |
| 1076 | 1076 | <?php |
| 1077 | 1077 | echo ob_get_clean(); |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1080 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1081 | 1081 | |
| 1082 | 1082 | |
| 1083 | 1083 | /** |
@@ -1090,24 +1090,24 @@ discard block |
||
| 1090 | 1090 | * |
| 1091 | 1091 | * @return string |
| 1092 | 1092 | */ |
| 1093 | -function give_get_register_fields( $form_id ) { |
|
| 1093 | +function give_get_register_fields($form_id) { |
|
| 1094 | 1094 | |
| 1095 | 1095 | global $user_ID; |
| 1096 | 1096 | |
| 1097 | - if ( is_user_logged_in() ) { |
|
| 1098 | - $user_data = get_userdata( $user_ID ); |
|
| 1097 | + if (is_user_logged_in()) { |
|
| 1098 | + $user_data = get_userdata($user_ID); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1101 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1102 | 1102 | |
| 1103 | 1103 | ob_start(); ?> |
| 1104 | 1104 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1105 | 1105 | |
| 1106 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1106 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1107 | 1107 | <div class="give-login-account-wrap"> |
| 1108 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1109 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1110 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1108 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1109 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1110 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1111 | 1111 | </p> |
| 1112 | 1112 | <p class="give-loading-text"> |
| 1113 | 1113 | <span class="give-loading-animation"></span> |
@@ -1123,15 +1123,15 @@ discard block |
||
| 1123 | 1123 | * |
| 1124 | 1124 | * @param int $form_id The form ID. |
| 1125 | 1125 | */ |
| 1126 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1126 | + do_action('give_register_fields_before', $form_id); |
|
| 1127 | 1127 | ?> |
| 1128 | 1128 | |
| 1129 | 1129 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1130 | 1130 | <legend> |
| 1131 | 1131 | <?php |
| 1132 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1133 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1134 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1132 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1133 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1134 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1135 | 1135 | } |
| 1136 | 1136 | ?> |
| 1137 | 1137 | </legend> |
@@ -1143,54 +1143,54 @@ discard block |
||
| 1143 | 1143 | * |
| 1144 | 1144 | * @param int $form_id The form ID. |
| 1145 | 1145 | */ |
| 1146 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1146 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1147 | 1147 | ?> |
| 1148 | 1148 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
| 1149 | 1149 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
| 1150 | 1150 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1151 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1152 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1151 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1152 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1153 | 1153 | <span class="give-required-indicator">*</span> |
| 1154 | 1154 | <?php } ?> |
| 1155 | 1155 | <span class="give-tooltip give-icon give-icon-question" |
| 1156 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1156 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1157 | 1157 | </label> |
| 1158 | 1158 | |
| 1159 | 1159 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1160 | 1160 | type="text" |
| 1161 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1161 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1162 | 1162 | </div> |
| 1163 | 1163 | |
| 1164 | 1164 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1165 | 1165 | class="form-row form-row-one-third form-row-responsive"> |
| 1166 | 1166 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1167 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1168 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1167 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1168 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1169 | 1169 | <span class="give-required-indicator">*</span> |
| 1170 | 1170 | <?php } ?> |
| 1171 | 1171 | <span class="give-tooltip give-icon give-icon-question" |
| 1172 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1172 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1173 | 1173 | </label> |
| 1174 | 1174 | |
| 1175 | 1175 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1176 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1177 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1176 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1177 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1178 | 1178 | </div> |
| 1179 | 1179 | |
| 1180 | 1180 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1181 | 1181 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
| 1182 | 1182 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1183 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1184 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1183 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1184 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1185 | 1185 | <span class="give-required-indicator">*</span> |
| 1186 | 1186 | <?php } ?> |
| 1187 | 1187 | <span class="give-tooltip give-icon give-icon-question" |
| 1188 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1188 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1189 | 1189 | </label> |
| 1190 | 1190 | |
| 1191 | 1191 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1192 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1193 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1192 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1193 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1194 | 1194 | </div> |
| 1195 | 1195 | <?php |
| 1196 | 1196 | /** |
@@ -1200,7 +1200,7 @@ discard block |
||
| 1200 | 1200 | * |
| 1201 | 1201 | * @param int $form_id The form ID. |
| 1202 | 1202 | */ |
| 1203 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1203 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1204 | 1204 | ?> |
| 1205 | 1205 | </fieldset> |
| 1206 | 1206 | |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | * |
| 1213 | 1213 | * @param int $form_id The form ID. |
| 1214 | 1214 | */ |
| 1215 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1215 | + do_action('give_register_fields_after', $form_id); |
|
| 1216 | 1216 | ?> |
| 1217 | 1217 | |
| 1218 | 1218 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | * |
| 1224 | 1224 | * @since 1.7 |
| 1225 | 1225 | */ |
| 1226 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1226 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1227 | 1227 | ?> |
| 1228 | 1228 | |
| 1229 | 1229 | </fieldset> |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | echo ob_get_clean(); |
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1234 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1235 | 1235 | |
| 1236 | 1236 | /** |
| 1237 | 1237 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1244,27 +1244,27 @@ discard block |
||
| 1244 | 1244 | * |
| 1245 | 1245 | * @return string |
| 1246 | 1246 | */ |
| 1247 | -function give_get_login_fields( $form_id ) { |
|
| 1247 | +function give_get_login_fields($form_id) { |
|
| 1248 | 1248 | |
| 1249 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1250 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1249 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1250 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1251 | 1251 | |
| 1252 | 1252 | ob_start(); |
| 1253 | 1253 | ?> |
| 1254 | 1254 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1255 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1256 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1257 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1255 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1256 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1257 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1258 | 1258 | } ?> |
| 1259 | 1259 | </legend> |
| 1260 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1260 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1261 | 1261 | <p class="give-new-account-link"> |
| 1262 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1263 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1262 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1263 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1264 | 1264 | data-action="give_checkout_register"> |
| 1265 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1266 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1267 | - echo ' ' . esc_html__( 'and donate as a guest »', 'give' ); |
|
| 1265 | + <?php esc_html_e('Register', 'give'); |
|
| 1266 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1267 | + echo ' '.esc_html__('and donate as a guest »', 'give'); |
|
| 1268 | 1268 | } ?> |
| 1269 | 1269 | </a> |
| 1270 | 1270 | </p> |
@@ -1280,49 +1280,49 @@ discard block |
||
| 1280 | 1280 | * |
| 1281 | 1281 | * @param int $form_id The form ID. |
| 1282 | 1282 | */ |
| 1283 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1283 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1284 | 1284 | ?> |
| 1285 | 1285 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
| 1286 | 1286 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1287 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1288 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1287 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1288 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1289 | 1289 | <span class="give-required-indicator">*</span> |
| 1290 | 1290 | <?php } ?> |
| 1291 | 1291 | </label> |
| 1292 | 1292 | |
| 1293 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1293 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1294 | 1294 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1295 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1295 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1296 | 1296 | </div> |
| 1297 | 1297 | |
| 1298 | 1298 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1299 | 1299 | class="give_login_password form-row form-row-last form-row-responsive"> |
| 1300 | 1300 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1301 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1302 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1301 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1302 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1303 | 1303 | <span class="give-required-indicator">*</span> |
| 1304 | 1304 | <?php } ?> |
| 1305 | 1305 | </label> |
| 1306 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1306 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1307 | 1307 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1308 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1308 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1309 | 1309 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1310 | 1310 | </div> |
| 1311 | 1311 | |
| 1312 | 1312 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1313 | 1313 | <span class="give-forgot-password "> |
| 1314 | 1314 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1315 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1315 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1316 | 1316 | </span> |
| 1317 | 1317 | </div> |
| 1318 | 1318 | |
| 1319 | 1319 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1320 | 1320 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1321 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1322 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1321 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1322 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1323 | 1323 | <input type="button" data-action="give_cancel_login" |
| 1324 | 1324 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1325 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1325 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1326 | 1326 | <?php } ?> |
| 1327 | 1327 | <span class="give-loading-animation"></span> |
| 1328 | 1328 | </div> |
@@ -1334,14 +1334,14 @@ discard block |
||
| 1334 | 1334 | * |
| 1335 | 1335 | * @param int $form_id The form ID. |
| 1336 | 1336 | */ |
| 1337 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1337 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1338 | 1338 | ?> |
| 1339 | 1339 | </fieldset><!--end #give-login-fields--> |
| 1340 | 1340 | <?php |
| 1341 | 1341 | echo ob_get_clean(); |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1344 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1345 | 1345 | |
| 1346 | 1346 | /** |
| 1347 | 1347 | * Payment Mode Select. |
@@ -1357,9 +1357,9 @@ discard block |
||
| 1357 | 1357 | * |
| 1358 | 1358 | * @return void |
| 1359 | 1359 | */ |
| 1360 | -function give_payment_mode_select( $form_id ) { |
|
| 1360 | +function give_payment_mode_select($form_id) { |
|
| 1361 | 1361 | |
| 1362 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
| 1362 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
| 1363 | 1363 | |
| 1364 | 1364 | /** |
| 1365 | 1365 | * Fires while selecting payment gateways, before the fields. |
@@ -1368,10 +1368,10 @@ discard block |
||
| 1368 | 1368 | * |
| 1369 | 1369 | * @param int $form_id The form ID. |
| 1370 | 1370 | */ |
| 1371 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1371 | + do_action('give_payment_mode_top', $form_id); |
|
| 1372 | 1372 | ?> |
| 1373 | 1373 | |
| 1374 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1374 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1375 | 1375 | echo 'style="display: none;"'; |
| 1376 | 1376 | } ?>> |
| 1377 | 1377 | <?php |
@@ -1382,10 +1382,10 @@ discard block |
||
| 1382 | 1382 | * |
| 1383 | 1383 | * @param int $form_id The form ID. |
| 1384 | 1384 | */ |
| 1385 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1385 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1386 | 1386 | ?> |
| 1387 | 1387 | <legend |
| 1388 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1388 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1389 | 1389 | <span class="give-loading-text"><span |
| 1390 | 1390 | class="give-loading-animation"></span> |
| 1391 | 1391 | </span> |
@@ -1398,26 +1398,26 @@ discard block |
||
| 1398 | 1398 | * |
| 1399 | 1399 | * @since 1.7 |
| 1400 | 1400 | */ |
| 1401 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1401 | + do_action('give_payment_mode_before_gateways') |
|
| 1402 | 1402 | ?> |
| 1403 | 1403 | <ul id="give-gateway-radio-list"> |
| 1404 | 1404 | <?php |
| 1405 | 1405 | /** |
| 1406 | 1406 | * Loop through the active payment gateways. |
| 1407 | 1407 | */ |
| 1408 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1408 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1409 | 1409 | |
| 1410 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1410 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1411 | 1411 | //Determine the default gateway. |
| 1412 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1412 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1413 | 1413 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
| 1414 | 1414 | <li<?php echo $checked_class ?>> |
| 1415 | 1415 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1416 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1417 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1418 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1416 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1417 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1418 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1419 | 1419 | class="give-gateway-option" |
| 1420 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1420 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1421 | 1421 | </li> |
| 1422 | 1422 | <?php |
| 1423 | 1423 | endforeach; |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | * |
| 1430 | 1430 | * @since 1.7 |
| 1431 | 1431 | */ |
| 1432 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1432 | + do_action('give_payment_mode_after_gateways'); |
|
| 1433 | 1433 | ?> |
| 1434 | 1434 | </div> |
| 1435 | 1435 | <?php |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | * |
| 1441 | 1441 | * @param int $form_id The form ID. |
| 1442 | 1442 | */ |
| 1443 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1443 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1444 | 1444 | ?> |
| 1445 | 1445 | </fieldset> |
| 1446 | 1446 | |
@@ -1452,7 +1452,7 @@ discard block |
||
| 1452 | 1452 | * |
| 1453 | 1453 | * @param int $form_id The form ID. |
| 1454 | 1454 | */ |
| 1455 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1455 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1456 | 1456 | ?> |
| 1457 | 1457 | |
| 1458 | 1458 | <div id="give_purchase_form_wrap"> |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | * |
| 1464 | 1464 | * @since 1.7 |
| 1465 | 1465 | */ |
| 1466 | - do_action( 'give_donation_form', $form_id ); |
|
| 1466 | + do_action('give_donation_form', $form_id); |
|
| 1467 | 1467 | ?> |
| 1468 | 1468 | |
| 1469 | 1469 | </div> |
@@ -1474,10 +1474,10 @@ discard block |
||
| 1474 | 1474 | * |
| 1475 | 1475 | * @since 1.7 |
| 1476 | 1476 | */ |
| 1477 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1477 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1480 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1481 | 1481 | |
| 1482 | 1482 | /** |
| 1483 | 1483 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1490,31 +1490,31 @@ discard block |
||
| 1490 | 1490 | * |
| 1491 | 1491 | * @return bool |
| 1492 | 1492 | */ |
| 1493 | -function give_terms_agreement( $form_id ) { |
|
| 1494 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
| 1493 | +function give_terms_agreement($form_id) { |
|
| 1494 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
| 1495 | 1495 | |
| 1496 | 1496 | // Bailout if per form and global term and conditions is not setup. |
| 1497 | 1497 | if ( |
| 1498 | - give_is_setting_enabled( $form_option, 'global' ) |
|
| 1499 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
| 1498 | + give_is_setting_enabled($form_option, 'global') |
|
| 1499 | + && give_is_setting_enabled(give_get_option('terms')) |
|
| 1500 | 1500 | ) { |
| 1501 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1502 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
| 1503 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
| 1501 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1502 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
| 1503 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
| 1504 | 1504 | |
| 1505 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
| 1506 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
| 1507 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
| 1508 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
| 1505 | + } elseif (give_is_setting_enabled($form_option)) { |
|
| 1506 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
| 1507 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
| 1508 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
| 1509 | 1509 | |
| 1510 | 1510 | } else { |
| 1511 | 1511 | return false; |
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | // Bailout: Check if term and conditions text is empty or not. |
| 1515 | - if ( empty( $terms ) ) { |
|
| 1516 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
| 1517 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
| 1515 | + if (empty($terms)) { |
|
| 1516 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
| 1517 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | 1520 | return false; |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | |
| 1523 | 1523 | ?> |
| 1524 | 1524 | <fieldset id="give_terms_agreement"> |
| 1525 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1525 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1526 | 1526 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1527 | 1527 | <?php |
| 1528 | 1528 | /** |
@@ -1530,22 +1530,22 @@ discard block |
||
| 1530 | 1530 | * |
| 1531 | 1531 | * @since 1.0 |
| 1532 | 1532 | */ |
| 1533 | - do_action( 'give_before_terms' ); |
|
| 1533 | + do_action('give_before_terms'); |
|
| 1534 | 1534 | |
| 1535 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1535 | + echo wpautop(stripslashes($terms)); |
|
| 1536 | 1536 | /** |
| 1537 | 1537 | * Fires while rendering terms of agreement, after the fields. |
| 1538 | 1538 | * |
| 1539 | 1539 | * @since 1.0 |
| 1540 | 1540 | */ |
| 1541 | - do_action( 'give_after_terms' ); |
|
| 1541 | + do_action('give_after_terms'); |
|
| 1542 | 1542 | ?> |
| 1543 | 1543 | </div> |
| 1544 | 1544 | <div id="give_show_terms"> |
| 1545 | 1545 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1546 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1546 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1547 | 1547 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1548 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1548 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1549 | 1549 | </div> |
| 1550 | 1550 | |
| 1551 | 1551 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | <?php |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1559 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1560 | 1560 | |
| 1561 | 1561 | /** |
| 1562 | 1562 | * Checkout Final Total. |
@@ -1569,31 +1569,30 @@ discard block |
||
| 1569 | 1569 | * |
| 1570 | 1570 | * @return void |
| 1571 | 1571 | */ |
| 1572 | -function give_checkout_final_total( $form_id ) { |
|
| 1572 | +function give_checkout_final_total($form_id) { |
|
| 1573 | 1573 | |
| 1574 | - $total = isset( $_POST['give_total'] ) ? |
|
| 1575 | - apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) : |
|
| 1576 | - give_get_default_form_amount( $form_id ); |
|
| 1574 | + $total = isset($_POST['give_total']) ? |
|
| 1575 | + apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id); |
|
| 1577 | 1576 | |
| 1578 | 1577 | |
| 1579 | 1578 | //Only proceed if give_total available. |
| 1580 | - if ( empty( $total ) ) { |
|
| 1579 | + if (empty($total)) { |
|
| 1581 | 1580 | return; |
| 1582 | 1581 | } |
| 1583 | 1582 | ?> |
| 1584 | 1583 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1585 | 1584 | <span class="give-donation-total-label"> |
| 1586 | - <?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?> |
|
| 1585 | + <?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?> |
|
| 1587 | 1586 | </span> |
| 1588 | 1587 | <span class="give-final-total-amount" |
| 1589 | - data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>"> |
|
| 1590 | - <?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ) ); ?> |
|
| 1588 | + data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>"> |
|
| 1589 | + <?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false))); ?> |
|
| 1591 | 1590 | </span> |
| 1592 | 1591 | </p> |
| 1593 | 1592 | <?php |
| 1594 | 1593 | } |
| 1595 | 1594 | |
| 1596 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1595 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1597 | 1596 | |
| 1598 | 1597 | /** |
| 1599 | 1598 | * Renders the Checkout Submit section. |
@@ -1604,7 +1603,7 @@ discard block |
||
| 1604 | 1603 | * |
| 1605 | 1604 | * @return void |
| 1606 | 1605 | */ |
| 1607 | -function give_checkout_submit( $form_id ) { |
|
| 1606 | +function give_checkout_submit($form_id) { |
|
| 1608 | 1607 | ?> |
| 1609 | 1608 | <fieldset id="give_purchase_submit"> |
| 1610 | 1609 | <?php |
@@ -1613,24 +1612,24 @@ discard block |
||
| 1613 | 1612 | * |
| 1614 | 1613 | * @since 1.7 |
| 1615 | 1614 | */ |
| 1616 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1615 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1617 | 1616 | |
| 1618 | - give_checkout_hidden_fields( $form_id ); |
|
| 1617 | + give_checkout_hidden_fields($form_id); |
|
| 1619 | 1618 | |
| 1620 | - echo give_get_donation_form_submit_button( $form_id ); |
|
| 1619 | + echo give_get_donation_form_submit_button($form_id); |
|
| 1621 | 1620 | |
| 1622 | 1621 | /** |
| 1623 | 1622 | * Fire after donation form submit. |
| 1624 | 1623 | * |
| 1625 | 1624 | * @since 1.7 |
| 1626 | 1625 | */ |
| 1627 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1626 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1628 | 1627 | ?> |
| 1629 | 1628 | </fieldset> |
| 1630 | 1629 | <?php |
| 1631 | 1630 | } |
| 1632 | 1631 | |
| 1633 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1632 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1634 | 1633 | |
| 1635 | 1634 | /** |
| 1636 | 1635 | * Give Donation form submit button. |
@@ -1641,10 +1640,10 @@ discard block |
||
| 1641 | 1640 | * |
| 1642 | 1641 | * @return string |
| 1643 | 1642 | */ |
| 1644 | -function give_get_donation_form_submit_button( $form_id ) { |
|
| 1643 | +function give_get_donation_form_submit_button($form_id) { |
|
| 1645 | 1644 | |
| 1646 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
| 1647 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1645 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
| 1646 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1648 | 1647 | ob_start(); |
| 1649 | 1648 | ?> |
| 1650 | 1649 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1653,7 +1652,7 @@ discard block |
||
| 1653 | 1652 | <span class="give-loading-animation"></span> |
| 1654 | 1653 | </div> |
| 1655 | 1654 | <?php |
| 1656 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
| 1655 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
| 1657 | 1656 | } |
| 1658 | 1657 | |
| 1659 | 1658 | /** |
@@ -1668,17 +1667,17 @@ discard block |
||
| 1668 | 1667 | * |
| 1669 | 1668 | * @return mixed |
| 1670 | 1669 | */ |
| 1671 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1670 | +function give_show_goal_progress($form_id, $args) { |
|
| 1672 | 1671 | |
| 1673 | 1672 | ob_start(); |
| 1674 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1673 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1675 | 1674 | |
| 1676 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1675 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1677 | 1676 | |
| 1678 | 1677 | return true; |
| 1679 | 1678 | } |
| 1680 | 1679 | |
| 1681 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1680 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1682 | 1681 | |
| 1683 | 1682 | |
| 1684 | 1683 | /** |
@@ -1691,10 +1690,10 @@ discard block |
||
| 1691 | 1690 | * |
| 1692 | 1691 | * @return mixed|string |
| 1693 | 1692 | */ |
| 1694 | -function give_get_form_content_placement( $form_id, $args ) { |
|
| 1693 | +function give_get_form_content_placement($form_id, $args) { |
|
| 1695 | 1694 | $show_content = ''; |
| 1696 | 1695 | |
| 1697 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
| 1696 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
| 1698 | 1697 | // Content positions. |
| 1699 | 1698 | $content_placement = array( |
| 1700 | 1699 | 'above' => 'give_pre_form', |
@@ -1702,18 +1701,18 @@ discard block |
||
| 1702 | 1701 | ); |
| 1703 | 1702 | |
| 1704 | 1703 | // Check if content position already decoded. |
| 1705 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
| 1704 | + if (in_array($args['show_content'], $content_placement)) { |
|
| 1706 | 1705 | return $args['show_content']; |
| 1707 | 1706 | } |
| 1708 | 1707 | |
| 1709 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
| 1708 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
| 1710 | 1709 | |
| 1711 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
| 1712 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
| 1710 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
| 1711 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
| 1713 | 1712 | |
| 1714 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
| 1713 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
| 1715 | 1714 | // Backward compatibility for _give_content_option for v18. |
| 1716 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
| 1715 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
| 1717 | 1716 | } |
| 1718 | 1717 | |
| 1719 | 1718 | return $show_content; |
@@ -1729,20 +1728,20 @@ discard block |
||
| 1729 | 1728 | * |
| 1730 | 1729 | * @return void|bool |
| 1731 | 1730 | */ |
| 1732 | -function give_form_content( $form_id, $args ) { |
|
| 1731 | +function give_form_content($form_id, $args) { |
|
| 1733 | 1732 | |
| 1734 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1733 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1735 | 1734 | |
| 1736 | 1735 | // Bailout. |
| 1737 | - if ( empty( $show_content ) ) { |
|
| 1736 | + if (empty($show_content)) { |
|
| 1738 | 1737 | return false; |
| 1739 | 1738 | } |
| 1740 | 1739 | |
| 1741 | 1740 | // Add action according to value. |
| 1742 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1741 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1743 | 1742 | } |
| 1744 | 1743 | |
| 1745 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1744 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1746 | 1745 | |
| 1747 | 1746 | /** |
| 1748 | 1747 | * Renders Post Form Content. |
@@ -1756,22 +1755,22 @@ discard block |
||
| 1756 | 1755 | * |
| 1757 | 1756 | * @return void |
| 1758 | 1757 | */ |
| 1759 | -function give_form_display_content( $form_id, $args ) { |
|
| 1758 | +function give_form_display_content($form_id, $args) { |
|
| 1760 | 1759 | |
| 1761 | - $content = wpautop( give_get_meta( $form_id, '_give_form_content', true ) ); |
|
| 1762 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1760 | + $content = wpautop(give_get_meta($form_id, '_give_form_content', true)); |
|
| 1761 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1763 | 1762 | |
| 1764 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
| 1765 | - $content = apply_filters( 'the_content', $content ); |
|
| 1763 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
| 1764 | + $content = apply_filters('the_content', $content); |
|
| 1766 | 1765 | } |
| 1767 | 1766 | |
| 1768 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
| 1767 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
| 1769 | 1768 | |
| 1770 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1769 | + echo apply_filters('give_form_content_output', $output); |
|
| 1771 | 1770 | |
| 1772 | 1771 | //remove action to prevent content output on addition forms on page. |
| 1773 | 1772 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1774 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1773 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1775 | 1774 | } |
| 1776 | 1775 | |
| 1777 | 1776 | /** |
@@ -1783,7 +1782,7 @@ discard block |
||
| 1783 | 1782 | * |
| 1784 | 1783 | * @return void |
| 1785 | 1784 | */ |
| 1786 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1785 | +function give_checkout_hidden_fields($form_id) { |
|
| 1787 | 1786 | |
| 1788 | 1787 | /** |
| 1789 | 1788 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1792,13 +1791,13 @@ discard block |
||
| 1792 | 1791 | * |
| 1793 | 1792 | * @param int $form_id The form ID. |
| 1794 | 1793 | */ |
| 1795 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1794 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1796 | 1795 | |
| 1797 | - if ( is_user_logged_in() ) { ?> |
|
| 1796 | + if (is_user_logged_in()) { ?> |
|
| 1798 | 1797 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1799 | 1798 | <?php } ?> |
| 1800 | 1799 | <input type="hidden" name="give_action" value="purchase"/> |
| 1801 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1800 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1802 | 1801 | <?php |
| 1803 | 1802 | /** |
| 1804 | 1803 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1807,7 +1806,7 @@ discard block |
||
| 1807 | 1806 | * |
| 1808 | 1807 | * @param int $form_id The form ID. |
| 1809 | 1808 | */ |
| 1810 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1809 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1811 | 1810 | |
| 1812 | 1811 | } |
| 1813 | 1812 | |
@@ -1822,20 +1821,20 @@ discard block |
||
| 1822 | 1821 | * |
| 1823 | 1822 | * @return string $content Filtered content. |
| 1824 | 1823 | */ |
| 1825 | -function give_filter_success_page_content( $content ) { |
|
| 1824 | +function give_filter_success_page_content($content) { |
|
| 1826 | 1825 | |
| 1827 | 1826 | $give_options = give_get_settings(); |
| 1828 | 1827 | |
| 1829 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1830 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1831 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1828 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1829 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1830 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1832 | 1831 | } |
| 1833 | 1832 | } |
| 1834 | 1833 | |
| 1835 | 1834 | return $content; |
| 1836 | 1835 | } |
| 1837 | 1836 | |
| 1838 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1837 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1839 | 1838 | |
| 1840 | 1839 | /** |
| 1841 | 1840 | * Test Mode Frontend Warning. |
@@ -1846,12 +1845,12 @@ discard block |
||
| 1846 | 1845 | */ |
| 1847 | 1846 | function give_test_mode_frontend_warning() { |
| 1848 | 1847 | |
| 1849 | - if ( give_is_test_mode() ) { |
|
| 1850 | - 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>'; |
|
| 1848 | + if (give_is_test_mode()) { |
|
| 1849 | + 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>'; |
|
| 1851 | 1850 | } |
| 1852 | 1851 | } |
| 1853 | 1852 | |
| 1854 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1853 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1855 | 1854 | |
| 1856 | 1855 | /** |
| 1857 | 1856 | * Members-only Form. |
@@ -1865,21 +1864,21 @@ discard block |
||
| 1865 | 1864 | * |
| 1866 | 1865 | * @return string |
| 1867 | 1866 | */ |
| 1868 | -function give_members_only_form( $final_output, $args ) { |
|
| 1867 | +function give_members_only_form($final_output, $args) { |
|
| 1869 | 1868 | |
| 1870 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1869 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1871 | 1870 | |
| 1872 | 1871 | //Sanity Check: Must have form_id & not be logged in. |
| 1873 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1872 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1874 | 1873 | return $final_output; |
| 1875 | 1874 | } |
| 1876 | 1875 | |
| 1877 | 1876 | //Logged in only and Register / Login set to none. |
| 1878 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1877 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1879 | 1878 | |
| 1880 | - $final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1879 | + $final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1881 | 1880 | |
| 1882 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1881 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1883 | 1882 | |
| 1884 | 1883 | } |
| 1885 | 1884 | |
@@ -1887,4 +1886,4 @@ discard block |
||
| 1887 | 1886 | |
| 1888 | 1887 | } |
| 1889 | 1888 | |
| 1890 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1889 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,52 +25,52 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | -function give_update_payment_details( $data ) { |
|
| 28 | +function give_update_payment_details($data) { |
|
| 29 | 29 | |
| 30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
| 31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
| 31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
| 34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
| 35 | 35 | |
| 36 | 36 | // Retrieve the payment ID. |
| 37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
| 37 | + $payment_id = absint($data['give_payment_id']); |
|
| 38 | 38 | |
| 39 | 39 | /* @var Give_Payment $payment */ |
| 40 | - $payment = new Give_Payment( $payment_id ); |
|
| 40 | + $payment = new Give_Payment($payment_id); |
|
| 41 | 41 | |
| 42 | 42 | // Retrieve existing payment meta. |
| 43 | 43 | $meta = $payment->get_meta(); |
| 44 | 44 | $user_info = $payment->user_info; |
| 45 | 45 | |
| 46 | 46 | $status = $data['give-payment-status']; |
| 47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
| 48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
| 47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
| 48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
| 49 | 49 | |
| 50 | 50 | // Restrict to our high and low. |
| 51 | - if ( $hour > 23 ) { |
|
| 51 | + if ($hour > 23) { |
|
| 52 | 52 | $hour = 23; |
| 53 | - } elseif ( $hour < 0 ) { |
|
| 53 | + } elseif ($hour < 0) { |
|
| 54 | 54 | $hour = 00; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
| 57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
| 58 | 58 | |
| 59 | 59 | // Restrict to our high and low. |
| 60 | - if ( $minute > 59 ) { |
|
| 60 | + if ($minute > 59) { |
|
| 61 | 61 | $minute = 59; |
| 62 | - } elseif ( $minute < 0 ) { |
|
| 62 | + } elseif ($minute < 0) { |
|
| 63 | 63 | $minute = 00; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
| 66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
| 67 | 67 | |
| 68 | 68 | $curr_total = $payment->total; |
| 69 | - $new_total = give_maybe_sanitize_amount( $data['give-payment-total'] ); |
|
| 70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
| 69 | + $new_total = give_maybe_sanitize_amount($data['give-payment-total']); |
|
| 70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
| 71 | 71 | |
| 72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
| 73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
| 72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
| 73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Fires before updating edited donation. |
@@ -80,98 +80,98 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param int $payment_id The ID of the payment. |
| 82 | 82 | */ |
| 83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
| 83 | + do_action('give_update_edited_donation', $payment_id); |
|
| 84 | 84 | |
| 85 | 85 | $payment->date = $date; |
| 86 | 86 | $updated = $payment->save(); |
| 87 | 87 | |
| 88 | - if ( 0 === $updated ) { |
|
| 89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 88 | + if (0 === $updated) { |
|
| 89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $donor_changed = false; |
| 93 | 93 | |
| 94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
| 94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
| 95 | 95 | |
| 96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
| 97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
| 96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
| 97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
| 98 | 98 | |
| 99 | - if ( empty( $email ) || empty( $names ) ) { |
|
| 100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 99 | + if (empty($email) || empty($names)) { |
|
| 100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $donor = new Give_Donor( $email ); |
|
| 104 | - if ( empty( $donor->id ) ) { |
|
| 105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
| 106 | - $user_id = email_exists( $email ); |
|
| 107 | - if ( false !== $user_id ) { |
|
| 103 | + $donor = new Give_Donor($email); |
|
| 104 | + if (empty($donor->id)) { |
|
| 105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
| 106 | + $user_id = email_exists($email); |
|
| 107 | + if (false !== $user_id) { |
|
| 108 | 108 | $donor_data['user_id'] = $user_id; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if ( ! $donor->create( $donor_data ) ) { |
|
| 111 | + if ( ! $donor->create($donor_data)) { |
|
| 112 | 112 | // Failed to crete the new donor, assume the previous donor. |
| 113 | 113 | $donor_changed = false; |
| 114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
| 114 | + $donor = new Give_Donor($curr_donor_id); |
|
| 115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $new_donor_id = $donor->id; |
| 120 | 120 | |
| 121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 122 | 122 | |
| 123 | 123 | $donor_changed = true; |
| 124 | 124 | |
| 125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
| 125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
| 126 | 126 | |
| 127 | - $donor = new Give_Donor( $new_donor_id ); |
|
| 127 | + $donor = new Give_Donor($new_donor_id); |
|
| 128 | 128 | $email = $donor->email; |
| 129 | 129 | $names = $donor->name; |
| 130 | 130 | |
| 131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 132 | 132 | |
| 133 | 133 | $donor_changed = true; |
| 134 | 134 | |
| 135 | 135 | } else { |
| 136 | 136 | |
| 137 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 137 | + $donor = new Give_Donor($curr_donor_id); |
|
| 138 | 138 | $email = $donor->email; |
| 139 | 139 | $names = $donor->name; |
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Setup first and last name from input values. |
| 144 | - $names = explode( ' ', $names ); |
|
| 145 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
| 144 | + $names = explode(' ', $names); |
|
| 145 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
| 146 | 146 | $last_name = ''; |
| 147 | - if ( ! empty( $names[1] ) ) { |
|
| 148 | - unset( $names[0] ); |
|
| 149 | - $last_name = implode( ' ', $names ); |
|
| 147 | + if ( ! empty($names[1])) { |
|
| 148 | + unset($names[0]); |
|
| 149 | + $last_name = implode(' ', $names); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ( $donor_changed ) { |
|
| 152 | + if ($donor_changed) { |
|
| 153 | 153 | |
| 154 | 154 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
| 155 | - $previous_donor->remove_payment( $payment_id, false ); |
|
| 156 | - $donor->attach_payment( $payment_id, false ); |
|
| 155 | + $previous_donor->remove_payment($payment_id, false); |
|
| 156 | + $donor->attach_payment($payment_id, false); |
|
| 157 | 157 | |
| 158 | - if ( 'publish' == $status ) { |
|
| 158 | + if ('publish' == $status) { |
|
| 159 | 159 | |
| 160 | 160 | // Reduce previous user donation count and amount. |
| 161 | 161 | $previous_donor->decrease_donation_count(); |
| 162 | - $previous_donor->decrease_value( $curr_total ); |
|
| 162 | + $previous_donor->decrease_value($curr_total); |
|
| 163 | 163 | |
| 164 | 164 | // If donation was completed adjust stats of new donors. |
| 165 | 165 | $donor->increase_purchase_count(); |
| 166 | - $donor->increase_value( $new_total ); |
|
| 166 | + $donor->increase_value($new_total); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $payment->customer_id = $donor->id; |
| 170 | 170 | } else { |
| 171 | 171 | |
| 172 | - if ( 'publish' === $status ) { |
|
| 172 | + if ('publish' === $status) { |
|
| 173 | 173 | // Update user donation stat. |
| 174 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
| 174 | + $donor->update_donation_value($curr_total, $new_total); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | $payment->total = $new_total; |
| 185 | 185 | |
| 186 | 186 | // Check for payment notes. |
| 187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
| 187 | + if ( ! empty($data['give-payment-note'])) { |
|
| 188 | 188 | |
| 189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
| 190 | - give_insert_payment_note( $payment_id, $note ); |
|
| 189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
| 190 | + give_insert_payment_note($payment_id, $note); |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
| 195 | 195 | $payment->status = $status; |
| 196 | 196 | |
| 197 | 197 | // Adjust total store earnings if the payment total has been changed. |
| 198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
| 198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
| 199 | 199 | |
| 200 | - if ( $new_total > $curr_total ) { |
|
| 200 | + if ($new_total > $curr_total) { |
|
| 201 | 201 | // Increase if our new total is higher. |
| 202 | 202 | $difference = $new_total - $curr_total; |
| 203 | - give_increase_total_earnings( $difference ); |
|
| 203 | + give_increase_total_earnings($difference); |
|
| 204 | 204 | |
| 205 | - } elseif ( $curr_total > $new_total ) { |
|
| 205 | + } elseif ($curr_total > $new_total) { |
|
| 206 | 206 | // Decrease if our new total is lower. |
| 207 | 207 | $difference = $curr_total - $new_total; |
| 208 | - give_decrease_total_earnings( $difference ); |
|
| 208 | + give_decrease_total_earnings($difference); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
| 213 | 213 | $payment->save(); |
| 214 | 214 | |
| 215 | 215 | // Get new give form ID. |
| 216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
| 217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
| 216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
| 217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
| 218 | 218 | |
| 219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
| 220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
| 221 | 221 | // Check if user want to transfer current payment to new give form id. |
| 222 | - if ( $new_form_id != $current_form_id ) { |
|
| 222 | + if ($new_form_id != $current_form_id) { |
|
| 223 | 223 | |
| 224 | 224 | // Get new give form title. |
| 225 | - $new_form_title = get_the_title( $new_form_id ); |
|
| 225 | + $new_form_title = get_the_title($new_form_id); |
|
| 226 | 226 | |
| 227 | 227 | // Update new give form data in payment data. |
| 228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,43 +230,43 @@ discard block |
||
| 230 | 230 | $payment_meta['form_id'] = $new_form_id; |
| 231 | 231 | |
| 232 | 232 | // Update price id post meta data for set donation form. |
| 233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 234 | 234 | $payment_meta['price_id'] = ''; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Update payment give form meta data. |
| 238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
| 239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
| 240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
| 239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
| 240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 241 | 241 | |
| 242 | 242 | // Update price id payment metadata. |
| 243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
| 243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If donation was completed, adjust stats of forms. |
| 248 | - if ( 'publish' == $status ) { |
|
| 248 | + if ('publish' == $status) { |
|
| 249 | 249 | |
| 250 | 250 | // Decrease sale of old give form. For other payment status. |
| 251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
| 251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
| 252 | 252 | $current_form->decrease_sales(); |
| 253 | - $current_form->decrease_earnings( $curr_total ); |
|
| 253 | + $current_form->decrease_earnings($curr_total); |
|
| 254 | 254 | |
| 255 | 255 | // Increase sale of new give form. |
| 256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
| 256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
| 257 | 257 | $new_form->increase_sales(); |
| 258 | - $new_form->increase_earnings( $new_total ); |
|
| 258 | + $new_form->increase_earnings($new_total); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // Re setup payment to update new meta value in object. |
| 262 | - $payment->update_payment_setup( $payment->ID ); |
|
| 262 | + $payment->update_payment_setup($payment->ID); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Update price id if current form is variable form. |
| 266 | 266 | /* @var Give_Donate_Form $form */ |
| 267 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
| 267 | + $form = new Give_Donate_Form($payment->form_id); |
|
| 268 | 268 | |
| 269 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
| 269 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
| 270 | 270 | |
| 271 | 271 | // Get payment meta data. |
| 272 | 272 | $payment_meta = $payment->get_meta(); |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | $price_id = ''; |
| 276 | 276 | |
| 277 | 277 | // Get price info |
| 278 | - if( 0 <= $data['give-variable-price'] ) { |
|
| 279 | - foreach ( $form->prices as $variable_price ) { |
|
| 280 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
| 278 | + if (0 <= $data['give-variable-price']) { |
|
| 279 | + foreach ($form->prices as $variable_price) { |
|
| 280 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
| 281 | 281 | $price_info = $variable_price; |
| 282 | 282 | break; |
| 283 | 283 | } |
@@ -285,15 +285,15 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // Set price id. |
| 288 | - if( ! empty( $price_info ) ) { |
|
| 288 | + if ( ! empty($price_info)) { |
|
| 289 | 289 | $price_id = $data['give-variable-price']; |
| 290 | 290 | |
| 291 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
| 291 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
| 292 | 292 | // Set price id to amount match. |
| 293 | 293 | $price_id = $price_info['_give_id']['level_id']; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - } elseif( $form->is_custom_price_mode() ){ |
|
| 296 | + } elseif ($form->is_custom_price_mode()) { |
|
| 297 | 297 | $price_id = 'custom'; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | $payment_meta['price_id'] = $price_id; |
| 302 | 302 | |
| 303 | 303 | // Update payment give form meta data. |
| 304 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
| 305 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 304 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
| 305 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 306 | 306 | |
| 307 | 307 | // Re setup payment to update new meta value in object. |
| 308 | - $payment->update_payment_setup( $payment->ID ); |
|
| 308 | + $payment->update_payment_setup($payment->ID); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * @param int $payment_id The ID of the payment. |
| 318 | 318 | */ |
| 319 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
| 319 | + do_action('give_updated_edited_donation', $payment_id); |
|
| 320 | 320 | |
| 321 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
| 321 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
| 322 | 322 | exit; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
| 325 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * Trigger a Donation Deletion. |
@@ -333,48 +333,48 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @return void |
| 335 | 335 | */ |
| 336 | -function give_trigger_donation_delete( $data ) { |
|
| 337 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
| 336 | +function give_trigger_donation_delete($data) { |
|
| 337 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
| 338 | 338 | |
| 339 | - $payment_id = absint( $data['purchase_id'] ); |
|
| 339 | + $payment_id = absint($data['purchase_id']); |
|
| 340 | 340 | |
| 341 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 342 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 341 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 342 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - give_delete_donation( $payment_id ); |
|
| 346 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
| 345 | + give_delete_donation($payment_id); |
|
| 346 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
| 347 | 347 | give_die(); |
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
| 351 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | 354 | * AJAX Store Donation Note |
| 355 | 355 | */ |
| 356 | 356 | function give_ajax_store_payment_note() { |
| 357 | 357 | |
| 358 | - $payment_id = absint( $_POST['payment_id'] ); |
|
| 359 | - $note = wp_kses( $_POST['note'], array() ); |
|
| 358 | + $payment_id = absint($_POST['payment_id']); |
|
| 359 | + $note = wp_kses($_POST['note'], array()); |
|
| 360 | 360 | |
| 361 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 362 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 361 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 362 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if ( empty( $payment_id ) ) { |
|
| 366 | - die( '-1' ); |
|
| 365 | + if (empty($payment_id)) { |
|
| 366 | + die('-1'); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if ( empty( $note ) ) { |
|
| 370 | - die( '-1' ); |
|
| 369 | + if (empty($note)) { |
|
| 370 | + die('-1'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
| 374 | - die( give_get_payment_note_html( $note_id ) ); |
|
| 373 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
| 374 | + die(give_get_payment_note_html($note_id)); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
| 377 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Triggers a donation note deletion without ajax |
@@ -385,24 +385,24 @@ discard block |
||
| 385 | 385 | * |
| 386 | 386 | * @return void |
| 387 | 387 | */ |
| 388 | -function give_trigger_payment_note_deletion( $data ) { |
|
| 388 | +function give_trigger_payment_note_deletion($data) { |
|
| 389 | 389 | |
| 390 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
| 390 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
| 391 | 391 | return; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
| 395 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 394 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
| 395 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
| 398 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
| 399 | 399 | |
| 400 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
| 400 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
| 401 | 401 | |
| 402 | - wp_redirect( $edit_order_url ); |
|
| 402 | + wp_redirect($edit_order_url); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
| 405 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
| 406 | 406 | |
| 407 | 407 | /** |
| 408 | 408 | * Delete a payment note deletion with ajax |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | function give_ajax_delete_payment_note() { |
| 415 | 415 | |
| 416 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
| 417 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 416 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
| 417 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
| 421 | - die( '1' ); |
|
| 420 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
| 421 | + die('1'); |
|
| 422 | 422 | } else { |
| 423 | - die( '-1' ); |
|
| 423 | + die('-1'); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
| 428 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - switch ( $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + switch ($column_name) { |
|
| 69 | 69 | default: |
| 70 | - return $item[ $column_name ]; |
|
| 70 | + return $item[$column_name]; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function get_columns() { |
| 82 | 82 | $columns = array( |
| 83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
| 84 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
| 85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
| 86 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
| 87 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
| 83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
| 84 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
| 85 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
| 86 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
| 87 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function get_sortable_columns() { |
| 101 | 101 | return array( |
| 102 | - 'total_donations' => array( 'total_donations', false ) |
|
| 102 | + 'total_donations' => array('total_donations', false) |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return int Current page number |
| 113 | 113 | */ |
| 114 | 114 | public function get_paged() { |
| 115 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 115 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @since 1.0 |
| 124 | 124 | * @return void |
| 125 | 125 | */ |
| 126 | - public function bulk_actions( $which = '' ) { |
|
| 126 | + public function bulk_actions($which = '') { |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
@@ -135,27 +135,27 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param string $which |
| 137 | 137 | */ |
| 138 | - protected function display_tablenav( $which ) { |
|
| 138 | + protected function display_tablenav($which) { |
|
| 139 | 139 | |
| 140 | - if ( 'top' === $which ) { |
|
| 141 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 140 | + if ('top' === $which) { |
|
| 141 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 142 | 142 | } |
| 143 | 143 | ?> |
| 144 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 144 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 145 | 145 | |
| 146 | - <?php if ( 'top' === $which ) { ?> |
|
| 146 | + <?php if ('top' === $which) { ?> |
|
| 147 | 147 | <h3 class="alignleft reports-earnings-title"> |
| 148 | - <span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span> |
|
| 148 | + <span><?php esc_html_e('Donation Methods Report', 'give'); ?></span> |
|
| 149 | 149 | </h3> |
| 150 | 150 | <?php } ?> |
| 151 | 151 | |
| 152 | 152 | <div class="alignright tablenav-right"> |
| 153 | 153 | <div class="actions bulkactions"> |
| 154 | - <?php $this->bulk_actions( $which ); ?> |
|
| 154 | + <?php $this->bulk_actions($which); ?> |
|
| 155 | 155 | </div> |
| 156 | 156 | <?php |
| 157 | - $this->extra_tablenav( $which ); |
|
| 158 | - $this->pagination( $which ); |
|
| 157 | + $this->extra_tablenav($which); |
|
| 158 | + $this->pagination($which); |
|
| 159 | 159 | ?> |
| 160 | 160 | </div> |
| 161 | 161 | |
@@ -177,17 +177,17 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return int |
| 179 | 179 | */ |
| 180 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
| 180 | + public function give_sort_total_donations($old_value, $new_value) { |
|
| 181 | 181 | // If no sort, default to label. |
| 182 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
| 182 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
| 183 | 183 | |
| 184 | 184 | //If no order, default to asc. |
| 185 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
| 185 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
| 186 | 186 | |
| 187 | 187 | //Determine sort order. |
| 188 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
| 188 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
| 189 | 189 | |
| 190 | - return ( $order === 'asc' ) ? $result : -$result; |
|
| 190 | + return ($order === 'asc') ? $result : -$result; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | $gateways = give_get_payment_gateways(); |
| 205 | 205 | $stats = new Give_Payment_Stats(); |
| 206 | 206 | |
| 207 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 207 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 208 | 208 | |
| 209 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 210 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 209 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 210 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 211 | 211 | |
| 212 | 212 | $reports_data[] = array( |
| 213 | 213 | 'ID' => $gateway_id, |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | 'complete_sales' => $complete_count, |
| 216 | 216 | 'pending_sales' => $pending_count, |
| 217 | 217 | 'total_sales' => $complete_count + $pending_count, |
| 218 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
| 218 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
| 219 | 219 | ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | $columns = $this->get_columns(); |
| 237 | 237 | $hidden = array(); // No hidden columns |
| 238 | 238 | $sortable = $this->get_sortable_columns(); |
| 239 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 239 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 240 | 240 | $this->items = $this->reports_data(); |
| 241 | 241 | |
| 242 | 242 | // Sort Array when we are sorting data in array. |
| 243 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
| 243 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
| 244 | 244 | |
| 245 | 245 | } |
| 246 | 246 | } |