@@ -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 |
@@ -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 does 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); |
@@ -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,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 | /** |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | public function __construct() { |
127 | 127 | |
128 | 128 | // Set parent defaults. |
129 | - parent::__construct( array( |
|
130 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
131 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
132 | - 'ajax' => false, // Does this table support ajax? |
|
133 | - ) ); |
|
129 | + parent::__construct(array( |
|
130 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
131 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
132 | + 'ajax' => false, // Does this table support ajax? |
|
133 | + )); |
|
134 | 134 | |
135 | 135 | $this->process_bulk_action(); |
136 | 136 | $this->get_payment_counts(); |
137 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
137 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,55 +143,55 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function advanced_filters() { |
146 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
147 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
148 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
149 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
150 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
151 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; |
|
146 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
147 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
148 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
149 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
150 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
151 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; |
|
152 | 152 | ?> |
153 | 153 | <div id="give-payment-filters" class="give-filters"> |
154 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
154 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
155 | 155 | <div id="give-payment-date-filters"> |
156 | 156 | <div class="give-filter give-filter-half"> |
157 | 157 | <label for="start-date" |
158 | - class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label> |
|
158 | + class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label> |
|
159 | 159 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
160 | 160 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
161 | 161 | </div> |
162 | 162 | <div class="give-filter give-filter-half"> |
163 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label> |
|
163 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label> |
|
164 | 164 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
165 | 165 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
166 | 166 | </div> |
167 | 167 | </div> |
168 | 168 | <div id="give-payment-form-filter" class="give-filter"> |
169 | 169 | <label for="give-donation-forms-filter" |
170 | - class="give-donation-forms-filter-label"><?php esc_html_e( 'Form', 'give' ); ?></label> |
|
170 | + class="give-donation-forms-filter-label"><?php esc_html_e('Form', 'give'); ?></label> |
|
171 | 171 | <?php |
172 | 172 | // Filter Donations by Donation Forms. |
173 | - echo Give()->html->forms_dropdown( array( |
|
173 | + echo Give()->html->forms_dropdown(array( |
|
174 | 174 | 'name' => 'form_id', |
175 | 175 | 'id' => 'give-donation-forms-filter', |
176 | 176 | 'class' => 'give-donation-forms-filter', |
177 | 177 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. |
178 | 178 | 'chosen' => true, |
179 | - 'number' => - 1, |
|
180 | - ) ); |
|
179 | + 'number' => -1, |
|
180 | + )); |
|
181 | 181 | ?> |
182 | 182 | </div> |
183 | 183 | |
184 | - <?php if ( ! empty( $status ) ) : ?> |
|
185 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
184 | + <?php if ( ! empty($status)) : ?> |
|
185 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
186 | 186 | <?php endif; ?> |
187 | 187 | |
188 | 188 | <div class="give-filter"> |
189 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
|
189 | + <?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> |
|
190 | 190 | <?php |
191 | 191 | // Clear active filters button. |
192 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?> |
|
193 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
194 | - class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a> |
|
192 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?> |
|
193 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
194 | + class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a> |
|
195 | 195 | <?php endif; ?> |
196 | 196 | </div> |
197 | 197 | </div> |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return void |
212 | 212 | */ |
213 | - public function search_box( $text, $input_id ) { |
|
214 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
213 | + public function search_box($text, $input_id) { |
|
214 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - $input_id = $input_id . '-search-input'; |
|
218 | + $input_id = $input_id.'-search-input'; |
|
219 | 219 | |
220 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
221 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
220 | + if ( ! empty($_REQUEST['orderby'])) { |
|
221 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
222 | 222 | } |
223 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
224 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
223 | + if ( ! empty($_REQUEST['order'])) { |
|
224 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
225 | 225 | } |
226 | 226 | ?> |
227 | 227 | <div class="give-filter give-filter-search" role="search"> |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @since 1.7 |
235 | 235 | */ |
236 | - do_action( 'give_payment_history_search' ); |
|
236 | + do_action('give_payment_history_search'); |
|
237 | 237 | ?> |
238 | 238 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
239 | 239 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
240 | - <?php submit_button( $text, 'button', false, false, array( |
|
240 | + <?php submit_button($text, 'button', false, false, array( |
|
241 | 241 | 'ID' => 'search-submit', |
242 | - ) ); ?><br /> |
|
242 | + )); ?><br /> |
|
243 | 243 | </div> |
244 | 244 | <?php |
245 | 245 | } |
@@ -253,48 +253,48 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function get_views() { |
255 | 255 | |
256 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
256 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
257 | 257 | $views = array(); |
258 | 258 | $tabs = array( |
259 | 259 | 'all' => array( |
260 | 260 | 'total_count', |
261 | - esc_html__( 'All', 'give' ), |
|
261 | + esc_html__('All', 'give'), |
|
262 | 262 | ), |
263 | 263 | 'publish' => array( |
264 | 264 | 'complete_count', |
265 | - esc_html__( 'Completed', 'give' ), |
|
265 | + esc_html__('Completed', 'give'), |
|
266 | 266 | ), |
267 | 267 | 'pending' => array( |
268 | 268 | 'pending_count', |
269 | - esc_html__( 'Pending', 'give' ), |
|
269 | + esc_html__('Pending', 'give'), |
|
270 | 270 | ), |
271 | 271 | 'processing' => array( |
272 | 272 | 'processing_count', |
273 | - esc_html__( 'Processing', 'give' ), |
|
273 | + esc_html__('Processing', 'give'), |
|
274 | 274 | ), |
275 | 275 | 'refunded' => array( |
276 | 276 | 'refunded_count', |
277 | - esc_html__( 'Refunded', 'give' ), |
|
277 | + esc_html__('Refunded', 'give'), |
|
278 | 278 | ), |
279 | 279 | 'revoked' => array( |
280 | 280 | 'revoked_count', |
281 | - esc_html__( 'Revoked', 'give' ), |
|
281 | + esc_html__('Revoked', 'give'), |
|
282 | 282 | ), |
283 | 283 | 'failed' => array( |
284 | 284 | 'failed_count', |
285 | - esc_html__( 'Failed', 'give' ), |
|
285 | + esc_html__('Failed', 'give'), |
|
286 | 286 | ), |
287 | 287 | 'cancelled' => array( |
288 | 288 | 'cancelled_count', |
289 | - esc_html__( 'Cancelled', 'give' ), |
|
289 | + esc_html__('Cancelled', 'give'), |
|
290 | 290 | ), |
291 | 291 | 'abandoned' => array( |
292 | 292 | 'abandoned_count', |
293 | - esc_html__( 'Abandoned', 'give' ), |
|
293 | + esc_html__('Abandoned', 'give'), |
|
294 | 294 | ), |
295 | 295 | ); |
296 | 296 | |
297 | - foreach ( $tabs as $key => $tab ) { |
|
297 | + foreach ($tabs as $key => $tab) { |
|
298 | 298 | $count_key = $tab[0]; |
299 | 299 | $name = $tab[1]; |
300 | 300 | $count = $this->$count_key; |
@@ -309,19 +309,19 @@ discard block |
||
309 | 309 | * @param string $key Current view tab value. |
310 | 310 | * @param int $count Number of donation inside the tab. |
311 | 311 | */ |
312 | - if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { |
|
312 | + if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { |
|
313 | 313 | |
314 | - $views[ $key ] = sprintf( |
|
314 | + $views[$key] = sprintf( |
|
315 | 315 | '<a href="%s" %s >%s <span class="count">(%s)</span></a>', |
316 | - esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ) ) ), |
|
317 | - ( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '', |
|
316 | + esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false))), |
|
317 | + (('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '', |
|
318 | 318 | $name, |
319 | 319 | $count |
320 | 320 | ); |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | - return apply_filters( 'give_payments_table_views', $views ); |
|
324 | + return apply_filters('give_payments_table_views', $views); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -334,15 +334,15 @@ discard block |
||
334 | 334 | public function get_columns() { |
335 | 335 | $columns = array( |
336 | 336 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
337 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
338 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
339 | - 'status' => esc_html__( 'Status', 'give' ), |
|
340 | - 'date' => esc_html__( 'Date', 'give' ), |
|
341 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
342 | - 'details' => esc_html__( 'Details', 'give' ), |
|
337 | + 'donation' => esc_html__('Donation', 'give'), |
|
338 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
339 | + 'status' => esc_html__('Status', 'give'), |
|
340 | + 'date' => esc_html__('Date', 'give'), |
|
341 | + 'amount' => esc_html__('Amount', 'give'), |
|
342 | + 'details' => esc_html__('Details', 'give'), |
|
343 | 343 | ); |
344 | 344 | |
345 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
345 | + return apply_filters('give_payments_table_columns', $columns); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -354,14 +354,14 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function get_sortable_columns() { |
356 | 356 | $columns = array( |
357 | - 'donation' => array( 'ID', true ), |
|
358 | - 'donation_form' => array( 'donation_form', false ), |
|
359 | - 'status' => array( 'status', false ), |
|
360 | - 'amount' => array( 'amount', false ), |
|
361 | - 'date' => array( 'date', false ), |
|
357 | + 'donation' => array('ID', true), |
|
358 | + 'donation_form' => array('donation_form', false), |
|
359 | + 'status' => array('status', false), |
|
360 | + 'amount' => array('amount', false), |
|
361 | + 'date' => array('date', false), |
|
362 | 362 | ); |
363 | 363 | |
364 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
364 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
@@ -387,55 +387,55 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @return string Column Name |
389 | 389 | */ |
390 | - public function column_default( $payment, $column_name ) { |
|
390 | + public function column_default($payment, $column_name) { |
|
391 | 391 | |
392 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
393 | - $row_actions = $this->get_row_actions( $payment ); |
|
392 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
393 | + $row_actions = $this->get_row_actions($payment); |
|
394 | 394 | |
395 | - switch ( $column_name ) { |
|
395 | + switch ($column_name) { |
|
396 | 396 | case 'donation' : |
397 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
398 | - $value .= $this->get_donor_email( $payment ); |
|
399 | - $value .= $this->row_actions( $row_actions ); |
|
397 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
398 | + $value .= $this->get_donor_email($payment); |
|
399 | + $value .= $this->row_actions($row_actions); |
|
400 | 400 | break; |
401 | 401 | |
402 | 402 | case 'amount' : |
403 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
404 | - $value = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); |
|
405 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
403 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
404 | + $value = give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); |
|
405 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
406 | 406 | break; |
407 | 407 | |
408 | 408 | case 'donation_form' : |
409 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
410 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
411 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
409 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
410 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
411 | + $level = give_get_payment_form_title($payment->meta, true); |
|
412 | 412 | |
413 | - if ( ! empty( $level ) ) { |
|
413 | + if ( ! empty($level)) { |
|
414 | 414 | $value .= $level; |
415 | 415 | } |
416 | 416 | |
417 | 417 | break; |
418 | 418 | |
419 | 419 | case 'date' : |
420 | - $date = strtotime( $payment->date ); |
|
421 | - $value = date_i18n( give_date_format(), $date ); |
|
420 | + $date = strtotime($payment->date); |
|
421 | + $value = date_i18n(give_date_format(), $date); |
|
422 | 422 | break; |
423 | 423 | |
424 | 424 | case 'status' : |
425 | - $value = $this->get_payment_status( $payment ); |
|
425 | + $value = $this->get_payment_status($payment); |
|
426 | 426 | break; |
427 | 427 | |
428 | 428 | case 'details' : |
429 | - $value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
429 | + $value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
430 | 430 | break; |
431 | 431 | |
432 | 432 | default: |
433 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
433 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
434 | 434 | break; |
435 | 435 | |
436 | 436 | }// End switch(). |
437 | 437 | |
438 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
438 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -448,17 +448,17 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return string Data shown in the Email column |
450 | 450 | */ |
451 | - public function get_donor_email( $payment ) { |
|
451 | + public function get_donor_email($payment) { |
|
452 | 452 | |
453 | - $email = give_get_payment_user_email( $payment->ID ); |
|
453 | + $email = give_get_payment_user_email($payment->ID); |
|
454 | 454 | |
455 | - if ( empty( $email ) ) { |
|
456 | - $email = esc_html__( '(unknown)', 'give' ); |
|
455 | + if (empty($email)) { |
|
456 | + $email = esc_html__('(unknown)', 'give'); |
|
457 | 457 | } |
458 | 458 | |
459 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
459 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
460 | 460 | |
461 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
461 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -470,32 +470,32 @@ discard block |
||
470 | 470 | * |
471 | 471 | * @return array $actions |
472 | 472 | */ |
473 | - function get_row_actions( $payment ) { |
|
473 | + function get_row_actions($payment) { |
|
474 | 474 | |
475 | 475 | $actions = array(); |
476 | - $email = give_get_payment_user_email( $payment->ID ); |
|
476 | + $email = give_get_payment_user_email($payment->ID); |
|
477 | 477 | |
478 | 478 | // Add search term string back to base URL. |
479 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
480 | - if ( ! empty( $search_terms ) ) { |
|
481 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
479 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
480 | + if ( ! empty($search_terms)) { |
|
481 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
482 | 482 | } |
483 | 483 | |
484 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
484 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
485 | 485 | |
486 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
486 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
487 | 487 | 'give-action' => 'email_links', |
488 | 488 | 'purchase_id' => $payment->ID, |
489 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
489 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
490 | 490 | |
491 | 491 | } |
492 | 492 | |
493 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
493 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
494 | 494 | 'give-action' => 'delete_payment', |
495 | 495 | 'purchase_id' => $payment->ID, |
496 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
496 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
497 | 497 | |
498 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
498 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -509,10 +509,10 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @return string Data shown in the Email column |
511 | 511 | */ |
512 | - function get_payment_status( $payment ) { |
|
513 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
514 | - if ( $payment->mode == 'test' ) { |
|
515 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
512 | + function get_payment_status($payment) { |
|
513 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
514 | + if ($payment->mode == 'test') { |
|
515 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | return $value; |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return string Displays a checkbox. |
530 | 530 | */ |
531 | - public function column_cb( $payment ) { |
|
532 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
531 | + public function column_cb($payment) { |
|
532 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | /** |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | * |
543 | 543 | * @return string Displays a checkbox. |
544 | 544 | */ |
545 | - public function get_payment_id( $payment ) { |
|
546 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
545 | + public function get_payment_id($payment) { |
|
546 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -556,32 +556,32 @@ discard block |
||
556 | 556 | * |
557 | 557 | * @return string Data shown in the User column |
558 | 558 | */ |
559 | - public function get_donor( $payment ) { |
|
559 | + public function get_donor($payment) { |
|
560 | 560 | |
561 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
562 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
563 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
561 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
562 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
563 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
564 | 564 | |
565 | 565 | $value = ''; |
566 | - if ( ! empty( $donor_id ) ) { |
|
566 | + if ( ! empty($donor_id)) { |
|
567 | 567 | |
568 | 568 | // Check whether the donor name and WP_User name is same or not. |
569 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
570 | - $value .= $donor_billing_name . ' ('; |
|
569 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
570 | + $value .= $donor_billing_name.' ('; |
|
571 | 571 | } |
572 | 572 | |
573 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
573 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
574 | 574 | |
575 | 575 | // Check whether the donor name and WP_User name is same or not. |
576 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
576 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
577 | 577 | $value .= ')'; |
578 | 578 | } |
579 | 579 | } else { |
580 | - $email = give_get_payment_user_email( $payment->ID ); |
|
581 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
580 | + $email = give_get_payment_user_email($payment->ID); |
|
581 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
582 | 582 | } |
583 | 583 | |
584 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
584 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -593,20 +593,20 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function get_bulk_actions() { |
595 | 595 | $actions = array( |
596 | - 'delete' => __( 'Delete', 'give' ), |
|
597 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
598 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
599 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
600 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
601 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
602 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
603 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
604 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
605 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
606 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
596 | + 'delete' => __('Delete', 'give'), |
|
597 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
598 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
599 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
600 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
601 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
602 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
603 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
604 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
605 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
606 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
607 | 607 | ); |
608 | 608 | |
609 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
609 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
@@ -617,63 +617,63 @@ discard block |
||
617 | 617 | * @return void |
618 | 618 | */ |
619 | 619 | public function process_bulk_action() { |
620 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
620 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
621 | 621 | $action = $this->current_action(); |
622 | 622 | |
623 | - if ( ! is_array( $ids ) ) { |
|
624 | - $ids = array( $ids ); |
|
623 | + if ( ! is_array($ids)) { |
|
624 | + $ids = array($ids); |
|
625 | 625 | } |
626 | 626 | |
627 | - if ( empty( $action ) ) { |
|
627 | + if (empty($action)) { |
|
628 | 628 | return; |
629 | 629 | } |
630 | 630 | |
631 | - foreach ( $ids as $id ) { |
|
631 | + foreach ($ids as $id) { |
|
632 | 632 | |
633 | 633 | // Detect when a bulk action is being triggered. |
634 | - switch ( $this->current_action() ) { |
|
634 | + switch ($this->current_action()) { |
|
635 | 635 | |
636 | 636 | case'delete': |
637 | - give_delete_donation( $id ); |
|
637 | + give_delete_donation($id); |
|
638 | 638 | break; |
639 | 639 | |
640 | 640 | case 'set-status-publish': |
641 | - give_update_payment_status( $id, 'publish' ); |
|
641 | + give_update_payment_status($id, 'publish'); |
|
642 | 642 | break; |
643 | 643 | |
644 | 644 | case 'set-status-pending': |
645 | - give_update_payment_status( $id, 'pending' ); |
|
645 | + give_update_payment_status($id, 'pending'); |
|
646 | 646 | break; |
647 | 647 | |
648 | 648 | case 'set-status-processing': |
649 | - give_update_payment_status( $id, 'processing' ); |
|
649 | + give_update_payment_status($id, 'processing'); |
|
650 | 650 | break; |
651 | 651 | |
652 | 652 | case 'set-status-refunded': |
653 | - give_update_payment_status( $id, 'refunded' ); |
|
653 | + give_update_payment_status($id, 'refunded'); |
|
654 | 654 | break; |
655 | 655 | case 'set-status-revoked': |
656 | - give_update_payment_status( $id, 'revoked' ); |
|
656 | + give_update_payment_status($id, 'revoked'); |
|
657 | 657 | break; |
658 | 658 | |
659 | 659 | case 'set-status-failed': |
660 | - give_update_payment_status( $id, 'failed' ); |
|
660 | + give_update_payment_status($id, 'failed'); |
|
661 | 661 | break; |
662 | 662 | |
663 | 663 | case 'set-status-cancelled': |
664 | - give_update_payment_status( $id, 'cancelled' ); |
|
664 | + give_update_payment_status($id, 'cancelled'); |
|
665 | 665 | break; |
666 | 666 | |
667 | 667 | case 'set-status-abandoned': |
668 | - give_update_payment_status( $id, 'abandoned' ); |
|
668 | + give_update_payment_status($id, 'abandoned'); |
|
669 | 669 | break; |
670 | 670 | |
671 | 671 | case 'set-status-preapproval': |
672 | - give_update_payment_status( $id, 'preapproval' ); |
|
672 | + give_update_payment_status($id, 'preapproval'); |
|
673 | 673 | break; |
674 | 674 | |
675 | 675 | case 'resend-receipt': |
676 | - give_email_donation_receipt( $id, false ); |
|
676 | + give_email_donation_receipt($id, false); |
|
677 | 677 | break; |
678 | 678 | }// End switch(). |
679 | 679 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @param int $id The ID of the payment. |
686 | 686 | * @param string $current_action The action that is being triggered. |
687 | 687 | */ |
688 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
688 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
689 | 689 | }// End foreach(). |
690 | 690 | |
691 | 691 | } |
@@ -701,31 +701,31 @@ discard block |
||
701 | 701 | |
702 | 702 | $args = array(); |
703 | 703 | |
704 | - if ( isset( $_GET['user'] ) ) { |
|
705 | - $args['user'] = urldecode( $_GET['user'] ); |
|
706 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
707 | - $args['donor'] = absint( $_GET['donor'] ); |
|
708 | - } elseif ( isset( $_GET['s'] ) ) { |
|
709 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
710 | - if ( $is_user ) { |
|
711 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
712 | - unset( $args['s'] ); |
|
704 | + if (isset($_GET['user'])) { |
|
705 | + $args['user'] = urldecode($_GET['user']); |
|
706 | + } elseif (isset($_GET['donor'])) { |
|
707 | + $args['donor'] = absint($_GET['donor']); |
|
708 | + } elseif (isset($_GET['s'])) { |
|
709 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
710 | + if ($is_user) { |
|
711 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
712 | + unset($args['s']); |
|
713 | 713 | } else { |
714 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
714 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
718 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
719 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
718 | + if ( ! empty($_GET['start-date'])) { |
|
719 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
720 | 720 | } |
721 | 721 | |
722 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
723 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
722 | + if ( ! empty($_GET['end-date'])) { |
|
723 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
724 | 724 | } |
725 | 725 | |
726 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
726 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
727 | 727 | |
728 | - $payment_count = give_count_payments( $args ); |
|
728 | + $payment_count = give_count_payments($args); |
|
729 | 729 | $this->complete_count = $payment_count->publish; |
730 | 730 | $this->pending_count = $payment_count->pending; |
731 | 731 | $this->processing_count = $payment_count->processing; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $this->cancelled_count = $payment_count->cancelled; |
736 | 736 | $this->abandoned_count = $payment_count->abandoned; |
737 | 737 | |
738 | - foreach ( $payment_count as $count ) { |
|
738 | + foreach ($payment_count as $count) { |
|
739 | 739 | $this->total_count += $count; |
740 | 740 | } |
741 | 741 | } |
@@ -750,28 +750,28 @@ discard block |
||
750 | 750 | public function payments_data() { |
751 | 751 | |
752 | 752 | $per_page = $this->per_page; |
753 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
754 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
755 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
756 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
757 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
758 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
759 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
760 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
761 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
762 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
763 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
764 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
765 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
766 | - |
|
767 | - if ( ! empty( $search ) ) { |
|
753 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
754 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
755 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
756 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
757 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
758 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
759 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
760 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
761 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
762 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
763 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
764 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
765 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
766 | + |
|
767 | + if ( ! empty($search)) { |
|
768 | 768 | $status = 'any'; // Force all payment statuses when searching. |
769 | 769 | } |
770 | 770 | |
771 | 771 | $args = array( |
772 | 772 | 'output' => 'payments', |
773 | 773 | 'number' => $per_page, |
774 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
774 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
775 | 775 | 'orderby' => $orderby, |
776 | 776 | 'order' => $order, |
777 | 777 | 'user' => $user, |
@@ -787,12 +787,12 @@ discard block |
||
787 | 787 | 'give_forms' => $form_id, |
788 | 788 | ); |
789 | 789 | |
790 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
790 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
791 | 791 | $args['search_in_notes'] = true; |
792 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
792 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
793 | 793 | } |
794 | 794 | |
795 | - $p_query = new Give_Payments_Query( $args ); |
|
795 | + $p_query = new Give_Payments_Query($args); |
|
796 | 796 | |
797 | 797 | return $p_query->get_payments(); |
798 | 798 | |
@@ -812,17 +812,17 @@ discard block |
||
812 | 812 | */ |
813 | 813 | public function prepare_items() { |
814 | 814 | |
815 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
815 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
816 | 816 | |
817 | 817 | $columns = $this->get_columns(); |
818 | 818 | $hidden = array(); // No hidden columns. |
819 | 819 | $sortable = $this->get_sortable_columns(); |
820 | 820 | $data = $this->payments_data(); |
821 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
821 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
822 | 822 | |
823 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
823 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
824 | 824 | |
825 | - switch ( $status ) { |
|
825 | + switch ($status) { |
|
826 | 826 | case 'publish': |
827 | 827 | $total_items = $this->complete_count; |
828 | 828 | break; |
@@ -852,20 +852,20 @@ discard block |
||
852 | 852 | break; |
853 | 853 | default: |
854 | 854 | // Retrieve the count of the non-default-Give status. |
855 | - $count = wp_count_posts( 'give_payment' ); |
|
856 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
855 | + $count = wp_count_posts('give_payment'); |
|
856 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
857 | 857 | break; |
858 | 858 | } |
859 | 859 | |
860 | 860 | $this->items = $data; |
861 | 861 | |
862 | - $this->set_pagination_args( array( |
|
862 | + $this->set_pagination_args(array( |
|
863 | 863 | 'total_items' => $total_items, |
864 | 864 | // We have to calculate the total number of items. |
865 | 865 | 'per_page' => $this->per_page, |
866 | 866 | // We have to determine how many items to show on a page. |
867 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
867 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
868 | 868 | // We have to calculate the total number of pages. |
869 | - ) ); |
|
869 | + )); |
|
870 | 870 | } |
871 | 871 | } |
@@ -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 | } |
@@ -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 | |
@@ -18,30 +18,30 @@ discard block |
||
18 | 18 | ?> |
19 | 19 | <div class="wrap" id="poststuff"> |
20 | 20 | <div id="give-updates"> |
21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
22 | 22 | <div class="give-update-panel-content"> |
23 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
23 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <?php $update_counter = 1; ?> |
27 | 27 | |
28 | 28 | <?php $db_updates = $give_updates->get_db_update_count(); ?> |
29 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
30 | - <?php $db_update_url = add_query_arg( array( |
|
29 | + <?php if ( ! empty($db_updates)) : ?> |
|
30 | + <?php $db_update_url = add_query_arg(array( |
|
31 | 31 | 'type' => 'database', |
32 | - ) ); ?> |
|
32 | + )); ?> |
|
33 | 33 | <div id="give-db-updates"> |
34 | 34 | <div class="postbox-container"> |
35 | 35 | <div class="postbox"> |
36 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
36 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
37 | 37 | <div class="inside"> |
38 | 38 | <div class="panel-content"> |
39 | - <p><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now ></a>', 'give' ), $db_update_url ); ?></p> |
|
39 | + <p><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now ></a>', 'give'), $db_update_url); ?></p> |
|
40 | 40 | </div> |
41 | 41 | <div class="progress-container give-hidden"> |
42 | 42 | <p class="update-message" data-update-count="<?php echo $db_updates; ?>" |
43 | 43 | data-resume-update="<?php echo $give_updates->resume_updates(); ?>"> |
44 | - <strong><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong></p> |
|
44 | + <strong><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong></p> |
|
45 | 45 | <div class="progress-content"></div> |
46 | 46 | </div> |
47 | 47 | </div> |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | <?php endif; ?> |
53 | 53 | |
54 | 54 | <?php $plugin_updates = $give_updates->get_plugin_update_count(); ?> |
55 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
56 | - <?php $plugin_update_url = add_query_arg( array( |
|
55 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
56 | + <?php $plugin_update_url = add_query_arg(array( |
|
57 | 57 | 's' => 'Give', |
58 | - ), admin_url( '/plugins.php' ) ); ?> |
|
58 | + ), admin_url('/plugins.php')); ?> |
|
59 | 59 | <div id="give-plugin-updates"> |
60 | 60 | <div class="postbox-container"> |
61 | 61 | <div class="postbox"> |
62 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
62 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
63 | 63 | <div class="inside"> |
64 | 64 | <div class="panel-content"> |
65 | - <p><?php echo sprintf( __( 'There are %1$s Give %2$s that need to be updated. <a href="%3$s">Update now ></a>', 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
|
65 | + <p><?php echo sprintf(__('There are %1$s Give %2$s that need to be updated. <a href="%3$s">Update now ></a>', 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), $plugin_update_url); ?></p> |
|
66 | 66 | <?php include_once 'plugins-update-section.php'; ?> |
67 | 67 | </div> |
68 | 68 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function get_predefined_dates() { |
95 | 95 | $predefined = array( |
96 | - 'today' => esc_html__( 'Today', 'give' ), |
|
97 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
98 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
99 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
100 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
101 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
102 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
103 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
104 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
105 | - 'last_year' => esc_html__( 'Last Year', 'give' ) |
|
96 | + 'today' => esc_html__('Today', 'give'), |
|
97 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
98 | + 'this_week' => esc_html__('This Week', 'give'), |
|
99 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
100 | + 'this_month' => esc_html__('This Month', 'give'), |
|
101 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
102 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
103 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
104 | + 'this_year' => esc_html__('This Year', 'give'), |
|
105 | + 'last_year' => esc_html__('Last Year', 'give') |
|
106 | 106 | ); |
107 | 107 | |
108 | - return apply_filters( 'give_stats_predefined_dates', $predefined ); |
|
108 | + return apply_filters('give_stats_predefined_dates', $predefined); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function setup_dates( $_start_date = 'this_month', $_end_date = false ) { |
|
124 | + public function setup_dates($_start_date = 'this_month', $_end_date = false) { |
|
125 | 125 | |
126 | - if ( empty( $_start_date ) ) { |
|
126 | + if (empty($_start_date)) { |
|
127 | 127 | $_start_date = 'this_month'; |
128 | 128 | } |
129 | 129 | |
130 | - if ( empty( $_end_date ) ) { |
|
130 | + if (empty($_end_date)) { |
|
131 | 131 | $_end_date = $_start_date; |
132 | 132 | } |
133 | 133 | |
134 | - $this->start_date = $this->convert_date( $_start_date ); |
|
135 | - $this->end_date = $this->convert_date( $_end_date, true ); |
|
134 | + $this->start_date = $this->convert_date($_start_date); |
|
135 | + $this->end_date = $this->convert_date($_end_date, true); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return array|WP_Error If the date is invalid, a WP_Error object will be returned. |
150 | 150 | */ |
151 | - public function convert_date( $date, $end_date = false ) { |
|
151 | + public function convert_date($date, $end_date = false) { |
|
152 | 152 | |
153 | 153 | $this->timestamp = false; |
154 | 154 | $second = $end_date ? 59 : 0; |
155 | 155 | $minute = $end_date ? 59 : 0; |
156 | 156 | $hour = $end_date ? 23 : 0; |
157 | 157 | $day = 1; |
158 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
159 | - $year = date( 'Y', current_time( 'timestamp' ) ); |
|
158 | + $month = date('n', current_time('timestamp')); |
|
159 | + $year = date('Y', current_time('timestamp')); |
|
160 | 160 | |
161 | - if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) { |
|
161 | + if (array_key_exists((string) $date, $this->get_predefined_dates())) { |
|
162 | 162 | |
163 | 163 | // This is a predefined date rate, such as last_week |
164 | - switch ( $date ) { |
|
164 | + switch ($date) { |
|
165 | 165 | |
166 | 166 | case 'this_month' : |
167 | 167 | |
168 | - if ( $end_date ) { |
|
168 | + if ($end_date) { |
|
169 | 169 | |
170 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
170 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
171 | 171 | $hour = 23; |
172 | 172 | $minute = 59; |
173 | 173 | $second = 59; |
@@ -177,28 +177,28 @@ discard block |
||
177 | 177 | |
178 | 178 | case 'last_month' : |
179 | 179 | |
180 | - if ( $month == 1 ) { |
|
180 | + if ($month == 1) { |
|
181 | 181 | |
182 | 182 | $month = 12; |
183 | - $year --; |
|
183 | + $year--; |
|
184 | 184 | |
185 | 185 | } else { |
186 | 186 | |
187 | - $month --; |
|
187 | + $month--; |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | - if ( $end_date ) { |
|
192 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
191 | + if ($end_date) { |
|
192 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | break; |
196 | 196 | |
197 | 197 | case 'today' : |
198 | 198 | |
199 | - $day = date( 'd', current_time( 'timestamp' ) ); |
|
199 | + $day = date('d', current_time('timestamp')); |
|
200 | 200 | |
201 | - if ( $end_date ) { |
|
201 | + if ($end_date) { |
|
202 | 202 | $hour = 23; |
203 | 203 | $minute = 59; |
204 | 204 | $second = 59; |
@@ -208,23 +208,23 @@ discard block |
||
208 | 208 | |
209 | 209 | case 'yesterday' : |
210 | 210 | |
211 | - $day = date( 'd', current_time( 'timestamp' ) ) - 1; |
|
211 | + $day = date('d', current_time('timestamp')) - 1; |
|
212 | 212 | |
213 | 213 | // Check if Today is the first day of the month (meaning subtracting one will get us 0) |
214 | - if ( $day < 1 ) { |
|
214 | + if ($day < 1) { |
|
215 | 215 | |
216 | 216 | // If current month is 1 |
217 | - if ( 1 == $month ) { |
|
217 | + if (1 == $month) { |
|
218 | 218 | |
219 | 219 | $year -= 1; // Today is January 1, so skip back to last day of December |
220 | 220 | $month = 12; |
221 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
221 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
222 | 222 | |
223 | 223 | } else { |
224 | 224 | |
225 | 225 | // Go back one month and get the last day of the month |
226 | 226 | $month -= 1; |
227 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
227 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | } |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | |
234 | 234 | case 'this_week' : |
235 | 235 | |
236 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
237 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
236 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
237 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
238 | 238 | |
239 | - if ( $today < $days_to_week_start ) { |
|
239 | + if ($today < $days_to_week_start) { |
|
240 | 240 | |
241 | - if ( $month > 1 ) { |
|
241 | + if ($month > 1) { |
|
242 | 242 | $month -= 1; |
243 | 243 | } else { |
244 | 244 | $month = 12; |
@@ -246,19 +246,19 @@ discard block |
||
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - if ( ! $end_date ) { |
|
249 | + if ( ! $end_date) { |
|
250 | 250 | |
251 | 251 | // Getting the start day |
252 | 252 | |
253 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
254 | - $day += get_option( 'start_of_week' ); |
|
253 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
254 | + $day += get_option('start_of_week'); |
|
255 | 255 | |
256 | 256 | } else { |
257 | 257 | |
258 | 258 | // Getting the end day |
259 | 259 | |
260 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
261 | - $day += get_option( 'start_of_week' ) + 6; |
|
260 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
261 | + $day += get_option('start_of_week') + 6; |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | |
267 | 267 | case 'last_week' : |
268 | 268 | |
269 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
270 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
269 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
270 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
271 | 271 | |
272 | - if ( $today < $days_to_week_start ) { |
|
272 | + if ($today < $days_to_week_start) { |
|
273 | 273 | |
274 | - if ( $month > 1 ) { |
|
274 | + if ($month > 1) { |
|
275 | 275 | $month -= 1; |
276 | 276 | } else { |
277 | 277 | $month = 12; |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! $end_date ) { |
|
282 | + if ( ! $end_date) { |
|
283 | 283 | |
284 | 284 | // Getting the start day |
285 | 285 | |
286 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
287 | - $day += get_option( 'start_of_week' ); |
|
286 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
287 | + $day += get_option('start_of_week'); |
|
288 | 288 | |
289 | 289 | } else { |
290 | 290 | |
291 | 291 | // Getting the end day |
292 | 292 | |
293 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
294 | - $day += get_option( 'start_of_week' ) + 6; |
|
293 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
294 | + $day += get_option('start_of_week') + 6; |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | |
@@ -299,39 +299,39 @@ discard block |
||
299 | 299 | |
300 | 300 | case 'this_quarter' : |
301 | 301 | |
302 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
302 | + $month_now = date('n', current_time('timestamp')); |
|
303 | 303 | |
304 | - if ( $month_now <= 3 ) { |
|
304 | + if ($month_now <= 3) { |
|
305 | 305 | |
306 | - if ( ! $end_date ) { |
|
306 | + if ( ! $end_date) { |
|
307 | 307 | $month = 1; |
308 | 308 | } else { |
309 | 309 | $month = 3; |
310 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
310 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
311 | 311 | $hour = 23; |
312 | 312 | $minute = 59; |
313 | 313 | $second = 59; |
314 | 314 | } |
315 | 315 | |
316 | - } else if ( $month_now <= 6 ) { |
|
316 | + } else if ($month_now <= 6) { |
|
317 | 317 | |
318 | - if ( ! $end_date ) { |
|
318 | + if ( ! $end_date) { |
|
319 | 319 | $month = 4; |
320 | 320 | } else { |
321 | 321 | $month = 6; |
322 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
322 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
323 | 323 | $hour = 23; |
324 | 324 | $minute = 59; |
325 | 325 | $second = 59; |
326 | 326 | } |
327 | 327 | |
328 | - } else if ( $month_now <= 9 ) { |
|
328 | + } else if ($month_now <= 9) { |
|
329 | 329 | |
330 | - if ( ! $end_date ) { |
|
330 | + if ( ! $end_date) { |
|
331 | 331 | $month = 7; |
332 | 332 | } else { |
333 | 333 | $month = 9; |
334 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
334 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
335 | 335 | $hour = 23; |
336 | 336 | $minute = 59; |
337 | 337 | $second = 59; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | |
340 | 340 | } else { |
341 | 341 | |
342 | - if ( ! $end_date ) { |
|
342 | + if ( ! $end_date) { |
|
343 | 343 | $month = 10; |
344 | 344 | } else { |
345 | 345 | $month = 12; |
346 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
346 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
347 | 347 | $hour = 23; |
348 | 348 | $minute = 59; |
349 | 349 | $second = 59; |
@@ -355,40 +355,40 @@ discard block |
||
355 | 355 | |
356 | 356 | case 'last_quarter' : |
357 | 357 | |
358 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
358 | + $month_now = date('n', current_time('timestamp')); |
|
359 | 359 | |
360 | - if ( $month_now <= 3 ) { |
|
360 | + if ($month_now <= 3) { |
|
361 | 361 | |
362 | - if ( ! $end_date ) { |
|
362 | + if ( ! $end_date) { |
|
363 | 363 | $month = 10; |
364 | 364 | } else { |
365 | 365 | $year -= 1; |
366 | 366 | $month = 12; |
367 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
367 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
368 | 368 | $hour = 23; |
369 | 369 | $minute = 59; |
370 | 370 | $second = 59; |
371 | 371 | } |
372 | 372 | |
373 | - } else if ( $month_now <= 6 ) { |
|
373 | + } else if ($month_now <= 6) { |
|
374 | 374 | |
375 | - if ( ! $end_date ) { |
|
375 | + if ( ! $end_date) { |
|
376 | 376 | $month = 1; |
377 | 377 | } else { |
378 | 378 | $month = 3; |
379 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
379 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
380 | 380 | $hour = 23; |
381 | 381 | $minute = 59; |
382 | 382 | $second = 59; |
383 | 383 | } |
384 | 384 | |
385 | - } else if ( $month_now <= 9 ) { |
|
385 | + } else if ($month_now <= 9) { |
|
386 | 386 | |
387 | - if ( ! $end_date ) { |
|
387 | + if ( ! $end_date) { |
|
388 | 388 | $month = 4; |
389 | 389 | } else { |
390 | 390 | $month = 6; |
391 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
391 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
392 | 392 | $hour = 23; |
393 | 393 | $minute = 59; |
394 | 394 | $second = 59; |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | |
397 | 397 | } else { |
398 | 398 | |
399 | - if ( ! $end_date ) { |
|
399 | + if ( ! $end_date) { |
|
400 | 400 | $month = 7; |
401 | 401 | } else { |
402 | 402 | $month = 9; |
403 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
403 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
404 | 404 | $hour = 23; |
405 | 405 | $minute = 59; |
406 | 406 | $second = 59; |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | |
413 | 413 | case 'this_year' : |
414 | 414 | |
415 | - if ( ! $end_date ) { |
|
415 | + if ( ! $end_date) { |
|
416 | 416 | $month = 1; |
417 | 417 | } else { |
418 | 418 | $month = 12; |
419 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
419 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
420 | 420 | $hour = 23; |
421 | 421 | $minute = 59; |
422 | 422 | $second = 59; |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | case 'last_year' : |
428 | 428 | |
429 | 429 | $year -= 1; |
430 | - if ( ! $end_date ) { |
|
430 | + if ( ! $end_date) { |
|
431 | 431 | $month = 1; |
432 | 432 | } else { |
433 | 433 | $month = 12; |
434 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
434 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
435 | 435 | $hour = 23; |
436 | 436 | $minute = 59; |
437 | 437 | $second = 59; |
@@ -442,30 +442,30 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | - } else if ( is_numeric( $date ) ) { |
|
445 | + } else if (is_numeric($date)) { |
|
446 | 446 | |
447 | 447 | // return $date unchanged since it is a timestamp |
448 | 448 | $this->timestamp = true; |
449 | 449 | |
450 | - } else if ( false !== strtotime( $date ) ) { |
|
450 | + } else if (false !== strtotime($date)) { |
|
451 | 451 | |
452 | - $date = strtotime( $date, current_time( 'timestamp' ) ); |
|
453 | - $year = date( 'Y', $date ); |
|
454 | - $month = date( 'm', $date ); |
|
455 | - $day = date( 'd', $date ); |
|
452 | + $date = strtotime($date, current_time('timestamp')); |
|
453 | + $year = date('Y', $date); |
|
454 | + $month = date('m', $date); |
|
455 | + $day = date('d', $date); |
|
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | - return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) ); |
|
459 | + return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give')); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - if ( false === $this->timestamp ) { |
|
463 | + if (false === $this->timestamp) { |
|
464 | 464 | // Create an exact timestamp |
465 | - $date = mktime( $hour, $minute, $second, $month, $day, $year ); |
|
465 | + $date = mktime($hour, $minute, $second, $month, $day, $year); |
|
466 | 466 | } |
467 | 467 | |
468 | - return apply_filters( 'give_stats_date', $date, $end_date, $this ); |
|
468 | + return apply_filters('give_stats_date', $date, $end_date, $this); |
|
469 | 469 | |
470 | 470 | } |
471 | 471 | |
@@ -481,33 +481,33 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @return string |
483 | 483 | */ |
484 | - public function count_where( $where = '' ) { |
|
484 | + public function count_where($where = '') { |
|
485 | 485 | // Only get payments in our date range |
486 | 486 | |
487 | 487 | $start_where = ''; |
488 | 488 | $end_where = ''; |
489 | 489 | |
490 | - if ( $this->start_date ) { |
|
490 | + if ($this->start_date) { |
|
491 | 491 | |
492 | - if ( $this->timestamp ) { |
|
492 | + if ($this->timestamp) { |
|
493 | 493 | $format = 'Y-m-d H:i:s'; |
494 | 494 | } else { |
495 | 495 | $format = 'Y-m-d 00:00:00'; |
496 | 496 | } |
497 | 497 | |
498 | - $start_date = date( $format, $this->start_date ); |
|
498 | + $start_date = date($format, $this->start_date); |
|
499 | 499 | $start_where = " AND p.post_date >= '{$start_date}'"; |
500 | 500 | } |
501 | 501 | |
502 | - if ( $this->end_date ) { |
|
502 | + if ($this->end_date) { |
|
503 | 503 | |
504 | - if ( $this->timestamp ) { |
|
504 | + if ($this->timestamp) { |
|
505 | 505 | $format = 'Y-m-d H:i:s'; |
506 | 506 | } else { |
507 | 507 | $format = 'Y-m-d 23:59:59'; |
508 | 508 | } |
509 | 509 | |
510 | - $end_date = date( $format, $this->end_date ); |
|
510 | + $end_date = date($format, $this->end_date); |
|
511 | 511 | |
512 | 512 | $end_where = " AND p.post_date <= '{$end_date}'"; |
513 | 513 | } |
@@ -529,34 +529,34 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function payments_where( $where = '' ) { |
|
532 | + public function payments_where($where = '') { |
|
533 | 533 | |
534 | 534 | global $wpdb; |
535 | 535 | |
536 | 536 | $start_where = ''; |
537 | 537 | $end_where = ''; |
538 | 538 | |
539 | - if ( ! is_wp_error( $this->start_date ) ) { |
|
539 | + if ( ! is_wp_error($this->start_date)) { |
|
540 | 540 | |
541 | - if ( $this->timestamp ) { |
|
541 | + if ($this->timestamp) { |
|
542 | 542 | $format = 'Y-m-d H:i:s'; |
543 | 543 | } else { |
544 | 544 | $format = 'Y-m-d 00:00:00'; |
545 | 545 | } |
546 | 546 | |
547 | - $start_date = date( $format, $this->start_date ); |
|
547 | + $start_date = date($format, $this->start_date); |
|
548 | 548 | $start_where = " AND $wpdb->posts.post_date >= '{$start_date}'"; |
549 | 549 | } |
550 | 550 | |
551 | - if ( ! is_wp_error( $this->end_date ) ) { |
|
551 | + if ( ! is_wp_error($this->end_date)) { |
|
552 | 552 | |
553 | - if ( $this->timestamp ) { |
|
553 | + if ($this->timestamp) { |
|
554 | 554 | $format = 'Y-m-d H:i:s'; |
555 | 555 | } else { |
556 | 556 | $format = 'Y-m-d 23:59:59'; |
557 | 557 | } |
558 | 558 | |
559 | - $end_date = date( $format, $this->end_date ); |
|
559 | + $end_date = date($format, $this->end_date); |
|
560 | 560 | |
561 | 561 | $end_where = " AND $wpdb->posts.post_date <= '{$end_date}'"; |
562 | 562 | } |