@@ -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,39 +32,39 @@ 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 | - <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
|
41 | + <legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend> |
|
42 | 42 | |
43 | - <h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
|
43 | + <h3 id="give_personal_information_label" class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3> |
|
44 | 44 | |
45 | 45 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
46 | - <label for="give_first_name"><?php _e( 'First Name', 'give' ); ?></label> |
|
47 | - <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
|
46 | + <label for="give_first_name"><?php _e('First Name', 'give'); ?></label> |
|
47 | + <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/> |
|
48 | 48 | </p> |
49 | 49 | |
50 | 50 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
51 | - <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
|
52 | - <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
|
51 | + <label for="give_last_name"><?php _e('Last Name', 'give'); ?></label> |
|
52 | + <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/> |
|
53 | 53 | </p> |
54 | 54 | |
55 | 55 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
56 | - <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
|
56 | + <label for="give_display_name"><?php _e('Display Name', 'give'); ?></label> |
|
57 | 57 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
58 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
59 | - <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> |
|
58 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
59 | + <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> |
|
60 | 60 | <?php endif; ?> |
61 | - <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> |
|
62 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
63 | - <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> |
|
61 | + <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> |
|
62 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
63 | + <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> |
|
64 | 64 | <?php endif; ?> |
65 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
66 | - <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> |
|
67 | - <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> |
|
65 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
66 | + <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> |
|
67 | + <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> |
|
68 | 68 | <?php endif; ?> |
69 | 69 | </select> |
70 | 70 | <?php |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.0 |
77 | 77 | */ |
78 | - do_action( 'give_profile_editor_name' ); |
|
78 | + do_action('give_profile_editor_name'); |
|
79 | 79 | ?> |
80 | 80 | </p> |
81 | 81 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @since 1.0 |
89 | 89 | */ |
90 | - do_action( 'give_profile_editor_after_name' ); |
|
90 | + do_action('give_profile_editor_after_name'); |
|
91 | 91 | ?> |
92 | 92 | |
93 | 93 | <p class="form-row form-row-last form-row-responsive"> |
94 | - <label for="give_email"><?php _e( 'Email Address', 'give' ); ?></label> |
|
95 | - <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"/> |
|
94 | + <label for="give_email"><?php _e('Email Address', 'give'); ?></label> |
|
95 | + <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"/> |
|
96 | 96 | <?php |
97 | 97 | /** |
98 | 98 | * Fires in the profile editor shortcode, to the email section. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @since 1.0 |
103 | 103 | */ |
104 | - do_action( 'give_profile_editor_email' ); |
|
104 | + do_action('give_profile_editor_email'); |
|
105 | 105 | ?> |
106 | 106 | </p> |
107 | 107 | |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | - do_action( 'give_profile_editor_after_email' ); |
|
116 | + do_action('give_profile_editor_after_email'); |
|
117 | 117 | ?> |
118 | 118 | |
119 | - <h3 id="give_profile_billing_address_label" class="give-section-break"><?php _e( 'Change your Billing Address', 'give' ); ?></h3> |
|
119 | + <h3 id="give_profile_billing_address_label" class="give-section-break"><?php _e('Change your Billing Address', 'give'); ?></h3> |
|
120 | 120 | |
121 | 121 | <div id="give_profile_billing_address_wrap"> |
122 | 122 | <?php |
123 | 123 | // Get selected country from address. |
124 | - $selected_country = ( ! empty( $address['country'] ) ? $address['country'] : '' ); |
|
124 | + $selected_country = ( ! empty($address['country']) ? $address['country'] : ''); |
|
125 | 125 | |
126 | 126 | $selected_state = ''; |
127 | - if ( $selected_country === give_get_country() ) { |
|
127 | + if ($selected_country === give_get_country()) { |
|
128 | 128 | // Get default selected state by admin. |
129 | 129 | $selected_state = give_get_state(); |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Get selected state from address. |
133 | - $selected_state = ! empty( $address['state'] ) ? $address['state'] : $selected_state; |
|
133 | + $selected_state = ! empty($address['state']) ? $address['state'] : $selected_state; |
|
134 | 134 | |
135 | - $label = __( 'State', 'give' ); |
|
135 | + $label = __('State', 'give'); |
|
136 | 136 | $states_label = give_get_states_label(); |
137 | 137 | // Check if $country code exists in the array key for states label. |
138 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
139 | - $label = $states_label[ $selected_country ]; |
|
138 | + if (array_key_exists($selected_country, $states_label)) { |
|
139 | + $label = $states_label[$selected_country]; |
|
140 | 140 | } |
141 | 141 | |
142 | - $states = give_get_states( $selected_country ); |
|
142 | + $states = give_get_states($selected_country); |
|
143 | 143 | |
144 | 144 | // Get the country list that do not have any states init. |
145 | 145 | $no_states_country = give_no_states_country_list(); |
@@ -149,39 +149,39 @@ discard block |
||
149 | 149 | ?> |
150 | 150 | |
151 | 151 | <p id="give-card-country-wrap" class="form-row form-row-wide"> |
152 | - <label for="give_address_country"><?php _e( 'Country', 'give' ); ?></label> |
|
152 | + <label for="give_address_country"><?php _e('Country', 'give'); ?></label> |
|
153 | 153 | <select name="give_address_country" id="give_address_country" class="select give-select"> |
154 | - <?php foreach ( give_get_country_list() as $key => $country ) : ?> |
|
155 | - <option value="<?php echo $key; ?>"<?php selected( $selected_country, $key ); ?>><?php echo esc_html( $country ); ?></option> |
|
154 | + <?php foreach (give_get_country_list() as $key => $country) : ?> |
|
155 | + <option value="<?php echo $key; ?>"<?php selected($selected_country, $key); ?>><?php echo esc_html($country); ?></option> |
|
156 | 156 | <?php endforeach; ?> |
157 | 157 | </select> |
158 | 158 | </p> |
159 | 159 | |
160 | 160 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
161 | - <label for="give_address_line1"><?php _e( 'Address 1', 'give' ); ?></label> |
|
161 | + <label for="give_address_line1"><?php _e('Address 1', 'give'); ?></label> |
|
162 | 162 | <input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" |
163 | - value="<?php echo esc_attr( $address['line1'] ); ?>"/> |
|
163 | + value="<?php echo esc_attr($address['line1']); ?>"/> |
|
164 | 164 | </p> |
165 | 165 | |
166 | 166 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
167 | - <label for="give_address_line2"><?php _e( 'Address 2', 'give' ); ?></label> |
|
167 | + <label for="give_address_line2"><?php _e('Address 2', 'give'); ?></label> |
|
168 | 168 | <input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" |
169 | - value="<?php echo esc_attr( $address['line2'] ); ?>"/> |
|
169 | + value="<?php echo esc_attr($address['line2']); ?>"/> |
|
170 | 170 | </p> |
171 | 171 | |
172 | 172 | |
173 | 173 | <p id="give-card-state-wrap" |
174 | - class="form-row form-row-wide <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?>"> |
|
175 | - <label for="give_address_state"><?php _e( 'State / Province / County', 'give' ); ?></label> |
|
174 | + class="form-row form-row-wide <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?>"> |
|
175 | + <label for="give_address_state"><?php _e('State / Province / County', 'give'); ?></label> |
|
176 | 176 | <?php |
177 | - if ( ! empty( $states ) ) : ?> |
|
177 | + if ( ! empty($states)) : ?> |
|
178 | 178 | <select |
179 | 179 | name="give_address_state" |
180 | 180 | id="give_address_state" |
181 | 181 | class="give_address_state" |
182 | 182 | <?php |
183 | - foreach ( $states as $state_code => $state ) { |
|
184 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
183 | + foreach ($states as $state_code => $state) { |
|
184 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | </select> |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | </p> |
195 | 195 | |
196 | 196 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
197 | - <label for="give_address_city"><?php _e( 'City', 'give' ); ?></label> |
|
197 | + <label for="give_address_city"><?php _e('City', 'give'); ?></label> |
|
198 | 198 | <input name="give_address_city" id="give_address_city" class="text give-input" type="text" |
199 | - value="<?php echo esc_attr( $address['city'] ); ?>"/> |
|
199 | + value="<?php echo esc_attr($address['city']); ?>"/> |
|
200 | 200 | </p> |
201 | 201 | |
202 | 202 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
203 | - <label for="give_address_zip"><?php _e( 'Zip / Postal Code', 'give' ); ?></label> |
|
203 | + <label for="give_address_zip"><?php _e('Zip / Postal Code', 'give'); ?></label> |
|
204 | 204 | <input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" |
205 | - value="<?php echo esc_attr( $address['zip'] ); ?>"/> |
|
205 | + value="<?php echo esc_attr($address['zip']); ?>"/> |
|
206 | 206 | </p> |
207 | 207 | |
208 | 208 | <?php |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @since 1.0 |
215 | 215 | */ |
216 | - do_action( 'give_profile_editor_address' ); |
|
216 | + do_action('give_profile_editor_address'); |
|
217 | 217 | ?> |
218 | 218 | |
219 | 219 | </div> |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @since 1.0 |
228 | 228 | */ |
229 | - do_action( 'give_profile_editor_after_address' ); |
|
229 | + do_action('give_profile_editor_after_address'); |
|
230 | 230 | ?> |
231 | 231 | |
232 | - <h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
|
232 | + <h3 id="give_profile_password_label" class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3> |
|
233 | 233 | |
234 | 234 | <div id="give_profile_password_wrap" class="give-clearfix"> |
235 | 235 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
236 | - <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
|
236 | + <label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label> |
|
237 | 237 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
238 | 238 | </p> |
239 | 239 | |
240 | 240 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
241 | - <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
|
241 | + <label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label> |
|
242 | 242 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
243 | 243 | <?php |
244 | 244 | /** |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @since 1.0 |
250 | 250 | */ |
251 | - do_action( 'give_profile_editor_password' ); |
|
251 | + do_action('give_profile_editor_password'); |
|
252 | 252 | ?> |
253 | 253 | </p> |
254 | 254 | </div> |
255 | 255 | |
256 | - <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
256 | + <p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
257 | 257 | |
258 | 258 | <?php |
259 | 259 | /** |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @since 1.0 |
265 | 265 | */ |
266 | - do_action( 'give_profile_editor_after_password' ); |
|
266 | + do_action('give_profile_editor_after_password'); |
|
267 | 267 | ?> |
268 | 268 | |
269 | 269 | <p id="give_profile_submit_wrap"> |
270 | - <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
270 | + <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
271 | 271 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
272 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
273 | - <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
|
272 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
273 | + <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/> |
|
274 | 274 | </p> |
275 | 275 | |
276 | 276 | </fieldset> |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @since 1.0 |
287 | 287 | */ |
288 | - do_action( 'give_profile_editor_after' ); |
|
288 | + do_action('give_profile_editor_after'); |
|
289 | 289 | ?> |
290 | 290 | |
291 | 291 | <?php |
292 | 292 | else: |
293 | - _e( 'You need to login to edit your profile.', 'give' ); |
|
293 | + _e('You need to login to edit your profile.', 'give'); |
|
294 | 294 | echo give_login_form(); |
295 | 295 | endif; |
@@ -185,10 +185,13 @@ discard block |
||
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | </select> |
188 | - <?php else : ?> |
|
188 | + <?php else { |
|
189 | + : ?> |
|
189 | 190 | <input type="text" size="6" name="give_address_state" id="give_address_state" |
190 | 191 | class="give_address_state give-input" |
191 | - placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/> |
|
192 | + placeholder="<?php echo $label; |
|
193 | +} |
|
194 | +?>" value="<?php echo $selected_state; ?>"/> |
|
192 | 195 | <?php endif; |
193 | 196 | ?> |
194 | 197 | </p> |
@@ -289,7 +292,9 @@ discard block |
||
289 | 292 | ?> |
290 | 293 | |
291 | 294 | <?php |
292 | -else: |
|
295 | +else { |
|
296 | + : |
|
293 | 297 | _e( 'You need to login to edit your profile.', 'give' ); |
298 | +} |
|
294 | 299 | echo give_login_form(); |
295 | 300 | endif; |
@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | 28 | // If payment_key query arg exists, return receipt instead of donation history. |
29 | - if ( isset( $_GET['payment_key'] ) ) { |
|
29 | + if (isset($_GET['payment_key'])) { |
|
30 | 30 | ob_start(); |
31 | - echo give_receipt_shortcode( array() ); |
|
32 | - echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">« ' . __( 'Return to All Donations', 'give' ) . '</a>'; |
|
31 | + echo give_receipt_shortcode(array()); |
|
32 | + echo '<a href="'.esc_url(give_get_history_page_uri()).'">« '.__('Return to All Donations', 'give').'</a>'; |
|
33 | 33 | |
34 | 34 | return ob_get_clean(); |
35 | 35 | } |
36 | 36 | |
37 | - $email_access = give_get_option( 'email_access' ); |
|
37 | + $email_access = give_get_option('email_access'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Determine access |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | */ |
45 | 45 | if ( |
46 | 46 | is_user_logged_in() || false !== Give()->session->get_session_expiration() |
47 | - || ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) |
|
47 | + || (give_is_setting_enabled($email_access) && Give()->email_access->token_exists) |
|
48 | 48 | ) { |
49 | 49 | ob_start(); |
50 | - give_get_template_part( 'history', 'donations' ); |
|
50 | + give_get_template_part('history', 'donations'); |
|
51 | 51 | |
52 | 52 | return ob_get_clean(); |
53 | 53 | |
54 | - } elseif ( give_is_setting_enabled( $email_access ) ) { |
|
54 | + } elseif (give_is_setting_enabled($email_access)) { |
|
55 | 55 | // Is Email-based access enabled? |
56 | 56 | ob_start(); |
57 | - give_get_template_part( 'email', 'login-form' ); |
|
57 | + give_get_template_part('email', 'login-form'); |
|
58 | 58 | |
59 | 59 | return ob_get_clean(); |
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
63 | - $output = apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) ); |
|
64 | - $output .= do_shortcode( '[give_login]' ); |
|
63 | + $output = apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false)); |
|
64 | + $output .= do_shortcode('[give_login]'); |
|
65 | 65 | |
66 | 66 | return $output; |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
70 | +add_shortcode('donation_history', 'give_donation_history'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Donation Form Shortcode |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string |
82 | 82 | */ |
83 | -function give_form_shortcode( $atts ) { |
|
84 | - $atts = shortcode_atts( array( |
|
83 | +function give_form_shortcode($atts) { |
|
84 | + $atts = shortcode_atts(array( |
|
85 | 85 | 'id' => '', |
86 | 86 | 'show_title' => true, |
87 | 87 | 'show_goal' => true, |
@@ -89,21 +89,21 @@ discard block |
||
89 | 89 | 'float_labels' => '', |
90 | 90 | 'display_style' => '', |
91 | 91 | 'continue_button_title' => '', |
92 | - ), $atts, 'give_form' ); |
|
92 | + ), $atts, 'give_form'); |
|
93 | 93 | |
94 | 94 | // Convert string to bool. |
95 | - $atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN ); |
|
96 | - $atts['show_goal'] = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN ); |
|
95 | + $atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN); |
|
96 | + $atts['show_goal'] = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN); |
|
97 | 97 | |
98 | 98 | //get the Give Form |
99 | 99 | ob_start(); |
100 | - give_get_donation_form( $atts ); |
|
100 | + give_get_donation_form($atts); |
|
101 | 101 | $final_output = ob_get_clean(); |
102 | 102 | |
103 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
103 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
104 | 104 | } |
105 | 105 | |
106 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
106 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Donation Form Goal Shortcode. |
@@ -116,37 +116,37 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string |
118 | 118 | */ |
119 | -function give_goal_shortcode( $atts ) { |
|
120 | - $atts = shortcode_atts( array( |
|
119 | +function give_goal_shortcode($atts) { |
|
120 | + $atts = shortcode_atts(array( |
|
121 | 121 | 'id' => '', |
122 | 122 | 'show_text' => true, |
123 | 123 | 'show_bar' => true, |
124 | - ), $atts, 'give_goal' ); |
|
124 | + ), $atts, 'give_goal'); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | //get the Give Form. |
128 | 128 | ob_start(); |
129 | 129 | |
130 | 130 | //Sanity check 1: ensure there is an ID Provided. |
131 | - if ( empty( $atts['id'] ) ) { |
|
132 | - Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
131 | + if (empty($atts['id'])) { |
|
132 | + Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | //Sanity check 2: Check the form even has Goals enabled. |
136 | - if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
136 | + if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) { |
|
137 | 137 | |
138 | - Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true ); |
|
138 | + Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true); |
|
139 | 139 | } else { |
140 | 140 | //Passed all sanity checks: output Goal. |
141 | - give_show_goal_progress( $atts['id'], $atts ); |
|
141 | + give_show_goal_progress($atts['id'], $atts); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $final_output = ob_get_clean(); |
145 | 145 | |
146 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
146 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
147 | 147 | } |
148 | 148 | |
149 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
149 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
150 | 150 | |
151 | 151 | |
152 | 152 | /** |
@@ -163,22 +163,22 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return string |
165 | 165 | */ |
166 | -function give_login_form_shortcode( $atts ) { |
|
167 | - $atts = shortcode_atts( array( |
|
166 | +function give_login_form_shortcode($atts) { |
|
167 | + $atts = shortcode_atts(array( |
|
168 | 168 | // Add backward compatibility for redirect attribute. |
169 | 169 | 'redirect' => '', |
170 | 170 | |
171 | 171 | 'login-redirect' => '', |
172 | 172 | 'logout-redirect' => '', |
173 | - ), $atts, 'give_login' ); |
|
173 | + ), $atts, 'give_login'); |
|
174 | 174 | |
175 | 175 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
176 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
176 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
177 | 177 | |
178 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
178 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
179 | 179 | } |
180 | 180 | |
181 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
181 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Register Shortcode. |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @return string |
195 | 195 | */ |
196 | -function give_register_form_shortcode( $atts ) { |
|
197 | - $atts = shortcode_atts( array( |
|
196 | +function give_register_form_shortcode($atts) { |
|
197 | + $atts = shortcode_atts(array( |
|
198 | 198 | 'redirect' => '', |
199 | - ), $atts, 'give_register' ); |
|
199 | + ), $atts, 'give_register'); |
|
200 | 200 | |
201 | - return give_register_form( $atts['redirect'] ); |
|
201 | + return give_register_form($atts['redirect']); |
|
202 | 202 | } |
203 | 203 | |
204 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
204 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Receipt Shortcode. |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return string |
216 | 216 | */ |
217 | -function give_receipt_shortcode( $atts ) { |
|
217 | +function give_receipt_shortcode($atts) { |
|
218 | 218 | |
219 | 219 | global $give_receipt_args, $payment; |
220 | 220 | |
221 | - $give_receipt_args = shortcode_atts( array( |
|
222 | - 'error' => __( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
221 | + $give_receipt_args = shortcode_atts(array( |
|
222 | + 'error' => __('You are missing the payment key to view this donation receipt.', 'give'), |
|
223 | 223 | 'price' => true, |
224 | 224 | 'donor' => true, |
225 | 225 | 'date' => true, |
@@ -228,50 +228,50 @@ discard block |
||
228 | 228 | 'payment_id' => true, |
229 | 229 | 'payment_status' => false, |
230 | 230 | 'status_notice' => true, |
231 | - ), $atts, 'give_receipt' ); |
|
231 | + ), $atts, 'give_receipt'); |
|
232 | 232 | |
233 | 233 | //set $session var |
234 | 234 | $session = give_get_purchase_session(); |
235 | 235 | |
236 | 236 | //set payment key var |
237 | - if ( isset( $_GET['payment_key'] ) ) { |
|
238 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
239 | - } elseif ( $session ) { |
|
237 | + if (isset($_GET['payment_key'])) { |
|
238 | + $payment_key = urldecode($_GET['payment_key']); |
|
239 | + } elseif ($session) { |
|
240 | 240 | $payment_key = $session['purchase_key']; |
241 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
241 | + } elseif ($give_receipt_args['payment_key']) { |
|
242 | 242 | $payment_key = $give_receipt_args['payment_key']; |
243 | 243 | } |
244 | 244 | |
245 | - $email_access = give_get_option( 'email_access' ); |
|
245 | + $email_access = give_get_option('email_access'); |
|
246 | 246 | |
247 | 247 | // No payment_key found & Email Access is Turned on: |
248 | - if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
248 | + if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
249 | 249 | |
250 | 250 | ob_start(); |
251 | 251 | |
252 | - give_get_template_part( 'email-login-form' ); |
|
252 | + give_get_template_part('email-login-form'); |
|
253 | 253 | |
254 | 254 | return ob_get_clean(); |
255 | 255 | |
256 | - } elseif ( ! isset( $payment_key ) ) { |
|
256 | + } elseif ( ! isset($payment_key)) { |
|
257 | 257 | |
258 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
258 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
263 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
262 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
263 | + $user_can_view = give_can_view_receipt($payment_key); |
|
264 | 264 | |
265 | 265 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
266 | - if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
266 | + if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
267 | 267 | |
268 | 268 | ob_start(); |
269 | 269 | |
270 | - give_get_template_part( 'email-login-form' ); |
|
270 | + give_get_template_part('email-login-form'); |
|
271 | 271 | |
272 | 272 | return ob_get_clean(); |
273 | 273 | |
274 | - } elseif ( ! $user_can_view ) { |
|
274 | + } elseif ( ! $user_can_view) { |
|
275 | 275 | |
276 | 276 | global $give_login_redirect; |
277 | 277 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | |
280 | 280 | ob_start(); |
281 | 281 | |
282 | - Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
282 | + Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give'))); |
|
283 | 283 | |
284 | - give_get_template_part( 'shortcode', 'login' ); |
|
284 | + give_get_template_part('shortcode', 'login'); |
|
285 | 285 | |
286 | 286 | $login_form = ob_get_clean(); |
287 | 287 | |
@@ -295,20 +295,20 @@ discard block |
||
295 | 295 | * or if user is logged out and donation was made as a guest, the donation session is checked for |
296 | 296 | * or if user is logged in and the user can view sensitive shop data. |
297 | 297 | */ |
298 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
299 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
298 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
299 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | ob_start(); |
303 | 303 | |
304 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
304 | + give_get_template_part('shortcode', 'receipt'); |
|
305 | 305 | |
306 | 306 | $display = ob_get_clean(); |
307 | 307 | |
308 | 308 | return $display; |
309 | 309 | } |
310 | 310 | |
311 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
311 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
312 | 312 | |
313 | 313 | /** |
314 | 314 | * Profile Editor Shortcode. |
@@ -327,25 +327,25 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return string Output generated from the profile editor |
329 | 329 | */ |
330 | -function give_profile_editor_shortcode( $atts ) { |
|
330 | +function give_profile_editor_shortcode($atts) { |
|
331 | 331 | |
332 | 332 | ob_start(); |
333 | 333 | |
334 | 334 | // Restrict access to donor profile, if donor and user are disconnected. |
335 | - $is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true ); |
|
336 | - if( is_user_logged_in() && $is_donor_disconnected ) { |
|
337 | - Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' ); |
|
335 | + $is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true); |
|
336 | + if (is_user_logged_in() && $is_donor_disconnected) { |
|
337 | + Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error'); |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | |
341 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
341 | + give_get_template_part('shortcode', 'profile-editor'); |
|
342 | 342 | |
343 | 343 | $display = ob_get_clean(); |
344 | 344 | |
345 | 345 | return $display; |
346 | 346 | } |
347 | 347 | |
348 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
348 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
349 | 349 | |
350 | 350 | /** |
351 | 351 | * Process Profile Updater Form. |
@@ -358,30 +358,30 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return bool |
360 | 360 | */ |
361 | -function give_process_profile_editor_updates( $data ) { |
|
361 | +function give_process_profile_editor_updates($data) { |
|
362 | 362 | // Profile field change request |
363 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
363 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | 367 | // Nonce security |
368 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
368 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
369 | 369 | return false; |
370 | 370 | } |
371 | 371 | |
372 | 372 | $user_id = get_current_user_id(); |
373 | - $old_user_data = get_userdata( $user_id ); |
|
374 | - |
|
375 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
376 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
377 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
378 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
379 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
380 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
381 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
382 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
383 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
384 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
373 | + $old_user_data = get_userdata($user_id); |
|
374 | + |
|
375 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
376 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
377 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
378 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
379 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
380 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
381 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
382 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
383 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
384 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
385 | 385 | |
386 | 386 | $userdata = array( |
387 | 387 | 'ID' => $user_id, |
@@ -409,40 +409,40 @@ discard block |
||
409 | 409 | * @param int $user_id The ID of the user. |
410 | 410 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
411 | 411 | */ |
412 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
412 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
413 | 413 | |
414 | 414 | // Make sure to validate passwords for existing Donors |
415 | - give_validate_user_password( $data['give_new_user_pass1'], $data['give_new_user_pass2'] ); |
|
415 | + give_validate_user_password($data['give_new_user_pass1'], $data['give_new_user_pass2']); |
|
416 | 416 | |
417 | - if ( empty( $email ) ) { |
|
417 | + if (empty($email)) { |
|
418 | 418 | // Make sure email should not be empty. |
419 | - give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) ); |
|
419 | + give_set_error('email_empty', __('The email you entered is empty.', 'give')); |
|
420 | 420 | |
421 | - } else if ( ! is_email( $email ) ) { |
|
421 | + } else if ( ! is_email($email)) { |
|
422 | 422 | // Make sure email should be valid. |
423 | - give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
423 | + give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give')); |
|
424 | 424 | |
425 | - } else if ( $email != $old_user_data->user_email ) { |
|
425 | + } else if ($email != $old_user_data->user_email) { |
|
426 | 426 | // Make sure the new email doesn't belong to another user |
427 | - if ( email_exists( $email ) ) { |
|
428 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
427 | + if (email_exists($email)) { |
|
428 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | 432 | // Check for errors |
433 | 433 | $errors = give_get_errors(); |
434 | 434 | |
435 | - if ( $errors ) { |
|
435 | + if ($errors) { |
|
436 | 436 | // Send back to the profile editor if there are errors |
437 | - wp_redirect( $data['give_redirect'] ); |
|
437 | + wp_redirect($data['give_redirect']); |
|
438 | 438 | give_die(); |
439 | 439 | } |
440 | 440 | |
441 | 441 | // Update the user |
442 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
443 | - $updated = wp_update_user( $userdata ); |
|
442 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
443 | + $updated = wp_update_user($userdata); |
|
444 | 444 | |
445 | - if ( $updated ) { |
|
445 | + if ($updated) { |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fires after updating user profile. |
@@ -452,12 +452,12 @@ discard block |
||
452 | 452 | * @param int $user_id The ID of the user. |
453 | 453 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
454 | 454 | */ |
455 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
456 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
455 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
456 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
457 | 457 | give_die(); |
458 | 458 | } |
459 | 459 | |
460 | 460 | return false; |
461 | 461 | } |
462 | 462 | |
463 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
463 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
@@ -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 | |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
58 | 58 | |
59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
60 | - add_action( 'give_donation_form_before_personal_info', array( $this, 'render_frontend_notices' ) ); |
|
61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
60 | + add_action('give_donation_form_before_personal_info', array($this, 'render_frontend_notices')); |
|
61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Backward compatibility for deprecated params. |
65 | 65 | * |
66 | 66 | * @since 1.8.14 |
67 | 67 | */ |
68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public function bc_deprecated_params( $args ) { |
|
83 | + public function bc_deprecated_params($args) { |
|
84 | 84 | /** |
85 | 85 | * Param: auto_dismissible |
86 | 86 | * deprecated in 1.8.14 |
87 | 87 | * |
88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
89 | 89 | */ |
90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
90 | + if (isset($args['auto_dismissible'])) { |
|
91 | + if ( ! empty($args['auto_dismissible'])) { |
|
92 | 92 | $args['dismissible'] = 'auto'; |
93 | 93 | } |
94 | 94 | // unset auto_dismissible as it has been deprecated. |
95 | - unset( $args['auto_dismissible'] ); |
|
95 | + unset($args['auto_dismissible']); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public function register_notice( $notice_args ) { |
|
111 | + public function register_notice($notice_args) { |
|
112 | 112 | // Bailout. |
113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | |
@@ -148,39 +148,39 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.8.14 |
150 | 150 | */ |
151 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
151 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
152 | 152 | |
153 | 153 | // Set extra dismiss links if any. |
154 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
154 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
155 | 155 | |
156 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
156 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
157 | 157 | |
158 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
159 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
160 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
158 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
159 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
160 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
161 | 161 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
162 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
162 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
163 | 163 | '', |
164 | 164 | '_', |
165 | 165 | '', |
166 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
166 | + ), implode('&', $extra_notice_dismiss_link)); |
|
167 | 167 | |
168 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
168 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
174 | + self::$notices[$notice_args['id']] = $notice_args; |
|
175 | 175 | |
176 | 176 | // Auto set show param if not already set. |
177 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
178 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
177 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
178 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // Auto set time interval for shortly. |
182 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
183 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
182 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
183 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | return true; |
@@ -194,44 +194,44 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function render_admin_notices() { |
196 | 196 | // Bailout. |
197 | - if ( empty( self::$notices ) ) { |
|
197 | + if (empty(self::$notices)) { |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | |
201 | 201 | $output = ''; |
202 | 202 | |
203 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
203 | + foreach (self::$notices as $notice_id => $notice) { |
|
204 | 204 | // Check flag set to true to show notice. |
205 | - if ( ! $notice['show'] ) { |
|
205 | + if ( ! $notice['show']) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | 209 | // Check if notice dismissible or not. |
210 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
211 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
210 | + if ( ! self::$has_auto_dismissible_notice) { |
|
211 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // Check if notice dismissible or not. |
215 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
215 | + if ( ! self::$has_dismiss_interval_notice) { |
|
216 | 216 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
217 | 217 | } |
218 | 218 | |
219 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
219 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
220 | 220 | |
221 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
222 | - $output .= sprintf( |
|
223 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s">' . " \n", |
|
221 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
222 | + $output .= sprintf( |
|
223 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s">'." \n", |
|
224 | 224 | $css_id, |
225 | 225 | $css_class, |
226 | - give_clean( $notice['dismissible'] ), |
|
226 | + give_clean($notice['dismissible']), |
|
227 | 227 | $notice['dismissible_type'], |
228 | 228 | $notice['dismiss_interval'], |
229 | 229 | $notice['id'], |
230 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
230 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
231 | 231 | $notice['dismiss_interval_time'] |
232 | 232 | ); |
233 | 233 | |
234 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
234 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
235 | 235 | $output .= "</div> \n"; |
236 | 236 | } |
237 | 237 | |
@@ -249,18 +249,18 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param int $form_id |
251 | 251 | */ |
252 | - public function render_frontend_notices( $form_id = 0 ) { |
|
252 | + public function render_frontend_notices($form_id = 0) { |
|
253 | 253 | $errors = give_get_errors(); |
254 | 254 | |
255 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
255 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
256 | 256 | |
257 | 257 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
258 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
258 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | 261 | |
262 | - if ( $errors ) { |
|
263 | - self::print_frontend_errors( $errors ); |
|
262 | + if ($errors) { |
|
263 | + self::print_frontend_errors($errors); |
|
264 | 264 | |
265 | 265 | give_clear_errors(); |
266 | 266 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @access private |
274 | 274 | */ |
275 | 275 | private function print_js() { |
276 | - if ( self::$has_auto_dismissible_notice ) : |
|
276 | + if (self::$has_auto_dismissible_notice) : |
|
277 | 277 | ?> |
278 | 278 | <script> |
279 | 279 | jQuery(document).ready(function () { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | <?php |
290 | 290 | endif; |
291 | 291 | |
292 | - if ( self::$has_dismiss_interval_notice ) : |
|
292 | + if (self::$has_dismiss_interval_notice) : |
|
293 | 293 | ?> |
294 | 294 | <script> |
295 | 295 | jQuery(document).ready(function () { |
@@ -355,29 +355,29 @@ discard block |
||
355 | 355 | * @access public |
356 | 356 | */ |
357 | 357 | public function dismiss_notices() { |
358 | - $_post = give_clean( $_POST ); |
|
359 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
358 | + $_post = give_clean($_POST); |
|
359 | + $notice_id = esc_attr($_post['notice_id']); |
|
360 | 360 | |
361 | 361 | // Bailout. |
362 | 362 | if ( |
363 | - empty( $notice_id ) || |
|
364 | - empty( $_post['dismissible_type'] ) || |
|
365 | - empty( $_post['dismiss_interval'] ) || |
|
366 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
363 | + empty($notice_id) || |
|
364 | + empty($_post['dismissible_type']) || |
|
365 | + empty($_post['dismiss_interval']) || |
|
366 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
367 | 367 | ) { |
368 | 368 | wp_send_json_error(); |
369 | 369 | } |
370 | 370 | |
371 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
372 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
371 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
372 | + if ('user' === $_post['dismissible_type']) { |
|
373 | 373 | $current_user = wp_get_current_user(); |
374 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
374 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
375 | 375 | } |
376 | 376 | |
377 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
377 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
378 | 378 | |
379 | 379 | // Save option to hide notice. |
380 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
380 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
381 | 381 | |
382 | 382 | wp_send_json_success(); |
383 | 383 | } |
@@ -395,18 +395,18 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @return string |
397 | 397 | */ |
398 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
398 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
399 | 399 | $notice_key = "_give_notice_{$notice_id}"; |
400 | 400 | |
401 | - if ( ! empty( $dismiss_interval ) ) { |
|
401 | + if ( ! empty($dismiss_interval)) { |
|
402 | 402 | $notice_key .= "_{$dismiss_interval}"; |
403 | 403 | } |
404 | 404 | |
405 | - if ( $user_id ) { |
|
405 | + if ($user_id) { |
|
406 | 406 | $notice_key .= "_{$user_id}"; |
407 | 407 | } |
408 | 408 | |
409 | - $notice_key = sanitize_key( $notice_key ); |
|
409 | + $notice_key = sanitize_key($notice_key); |
|
410 | 410 | |
411 | 411 | return $notice_key; |
412 | 412 | } |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return string |
421 | 421 | */ |
422 | - public function get_dismiss_link( $notice_args ) { |
|
422 | + public function get_dismiss_link($notice_args) { |
|
423 | 423 | $notice_args = wp_parse_args( |
424 | 424 | $notice_args, |
425 | 425 | array( |
426 | - 'title' => __( 'Click here', 'give' ), |
|
426 | + 'title' => __('Click here', 'give'), |
|
427 | 427 | 'dismissible_type' => '', |
428 | 428 | 'dismiss_interval' => '', |
429 | 429 | 'dismiss_interval_time' => null, |
@@ -450,31 +450,31 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @return bool|null |
452 | 452 | */ |
453 | - public function is_notice_dismissed( $notice ) { |
|
454 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
453 | + public function is_notice_dismissed($notice) { |
|
454 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
455 | 455 | $is_notice_dismissed = false; |
456 | 456 | |
457 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
457 | + if ('user' === $notice['dismissible_type']) { |
|
458 | 458 | $current_user = wp_get_current_user(); |
459 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
459 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
460 | 460 | } |
461 | 461 | |
462 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
462 | + $notice_data = Give_Cache::get($notice_key, true); |
|
463 | 463 | |
464 | 464 | // Find notice dismiss link status if notice has extra dismissible links. |
465 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
465 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
466 | 466 | |
467 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
468 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
469 | - unset( $new_notice_data['extra_links'] ); |
|
467 | + foreach ($notice['extra_links'] as $extra_link) { |
|
468 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
469 | + unset($new_notice_data['extra_links']); |
|
470 | 470 | |
471 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
471 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
472 | 472 | return $is_notice_dismissed; |
473 | 473 | } |
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
477 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
477 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
478 | 478 | |
479 | 479 | return $is_notice_dismissed; |
480 | 480 | } |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @param array $errors |
490 | 490 | */ |
491 | - public static function print_frontend_errors( $errors ) { |
|
491 | + public static function print_frontend_errors($errors) { |
|
492 | 492 | // Bailout. |
493 | - if ( ! $errors ) { |
|
493 | + if ( ! $errors) { |
|
494 | 494 | return; |
495 | 495 | } |
496 | 496 | |
@@ -505,37 +505,37 @@ discard block |
||
505 | 505 | ); |
506 | 506 | |
507 | 507 | // Note: we will remove give_errors class in future. |
508 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
508 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
509 | 509 | |
510 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
510 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
511 | 511 | |
512 | 512 | // Loop error codes and display errors. |
513 | - foreach ( $errors as $error_id => $error ) { |
|
513 | + foreach ($errors as $error_id => $error) { |
|
514 | 514 | // Backward compatibility v<1.8.11 |
515 | - if ( is_string( $error ) ) { |
|
515 | + if (is_string($error)) { |
|
516 | 516 | $error = array( |
517 | 517 | 'message' => $error, |
518 | 518 | 'notice_args' => array(), |
519 | 519 | ); |
520 | 520 | } |
521 | 521 | |
522 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
522 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
523 | 523 | |
524 | 524 | /** |
525 | 525 | * Filter to modify Frontend Errors args before errors is display. |
526 | 526 | * |
527 | 527 | * @since 1.8.14 |
528 | 528 | */ |
529 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
529 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
530 | 530 | |
531 | 531 | echo sprintf( |
532 | 532 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
533 | 533 | <p><strong>%4$s</strong>: %5$s</p> |
534 | 534 | </div>', |
535 | 535 | $error_id, |
536 | - give_clean( $notice_args['dismissible'] ), |
|
537 | - absint( $notice_args['dismiss_interval'] ), |
|
538 | - esc_html__( 'Error', 'give' ), |
|
536 | + give_clean($notice_args['dismissible']), |
|
537 | + absint($notice_args['dismiss_interval']), |
|
538 | + esc_html__('Error', 'give'), |
|
539 | 539 | $error['message'] |
540 | 540 | ); |
541 | 541 | } |
@@ -557,8 +557,8 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @return string |
559 | 559 | */ |
560 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
561 | - if ( empty( $message ) ) { |
|
560 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
561 | + if (empty($message)) { |
|
562 | 562 | return ''; |
563 | 563 | } |
564 | 564 | |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | 'dismiss_interval' => 5000, |
573 | 573 | ); |
574 | 574 | |
575 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
575 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
576 | 576 | |
577 | 577 | /** |
578 | 578 | * Filter to modify Frontend notice args before notices is display. |
579 | 579 | * |
580 | 580 | * @since 1.8.14 |
581 | 581 | */ |
582 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
582 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
583 | 583 | |
584 | 584 | // Note: we will remove give_errors class in future. |
585 | 585 | $error = sprintf( |
@@ -589,12 +589,12 @@ discard block |
||
589 | 589 | </p> |
590 | 590 | </div>', |
591 | 591 | $notice_type, |
592 | - give_clean( $notice_args['dismissible'] ), |
|
593 | - absint( $notice_args['dismiss_interval'] ), |
|
592 | + give_clean($notice_args['dismissible']), |
|
593 | + absint($notice_args['dismiss_interval']), |
|
594 | 594 | $message |
595 | 595 | ); |
596 | 596 | |
597 | - if ( ! $echo ) { |
|
597 | + if ( ! $echo) { |
|
598 | 598 | return $error; |
599 | 599 | } |
600 | 600 |
@@ -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 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
87 | 87 | */ |
88 | - public function __construct( $args = array() ) { |
|
88 | + public function __construct($args = array()) { |
|
89 | 89 | $defaults = array( |
90 | 90 | 'number' => 20, |
91 | 91 | 'offset' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // 'form' => array(), |
104 | 104 | ); |
105 | 105 | |
106 | - $this->args = wp_parse_args( $args, $defaults ); |
|
106 | + $this->args = wp_parse_args($args, $defaults); |
|
107 | 107 | |
108 | 108 | $this->table_name = Give()->donors->table_name; |
109 | 109 | $this->meta_table_name = Give()->donor_meta->table_name; |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param Give_Donors_Query $this Donors query object. |
148 | 148 | */ |
149 | - do_action( 'give_pre_get_donors', $this ); |
|
149 | + do_action('give_pre_get_donors', $this); |
|
150 | 150 | |
151 | - if ( empty( $this->args['count'] ) ) { |
|
152 | - $this->donors = $wpdb->get_results( $this->get_sql() ); |
|
151 | + if (empty($this->args['count'])) { |
|
152 | + $this->donors = $wpdb->get_results($this->get_sql()); |
|
153 | 153 | } else { |
154 | - $this->donors = $wpdb->get_var( $this->get_sql() ); |
|
154 | + $this->donors = $wpdb->get_var($this->get_sql()); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param Give_Donors_Query $this Donors query object. |
163 | 163 | */ |
164 | - do_action( 'give_post_get_donors', $this ); |
|
164 | + do_action('give_post_get_donors', $this); |
|
165 | 165 | |
166 | 166 | return $this->donors; |
167 | 167 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function get_sql() { |
179 | 179 | global $wpdb; |
180 | 180 | |
181 | - if ( $this->args['number'] < 1 ) { |
|
181 | + if ($this->args['number'] < 1) { |
|
182 | 182 | $this->args['number'] = 999999999999; |
183 | 183 | } |
184 | 184 | |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | |
187 | 187 | |
188 | 188 | // Set offset. |
189 | - if ( empty( $this->args['offset'] ) && ( 0 < $this->args['paged'] ) ) { |
|
190 | - $this->args['offset'] = $this->args['number'] * ( $this->args['paged'] - 1 ); |
|
189 | + if (empty($this->args['offset']) && (0 < $this->args['paged'])) { |
|
190 | + $this->args['offset'] = $this->args['number'] * ($this->args['paged'] - 1); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // Set fields. |
194 | 194 | $fields = "{$this->table_name}.*"; |
195 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
196 | - if ( is_string( $this->args['fields'] ) ) { |
|
195 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
196 | + if (is_string($this->args['fields'])) { |
|
197 | 197 | $fields = "{$this->table_name}.{$this->args['fields']}"; |
198 | - } else if ( is_array( $this->args['fields'] ) ) { |
|
199 | - $fields = "{$this->table_name}." . implode( " , {$this->table_name}.", $this->args['fields'] ); |
|
198 | + } else if (is_array($this->args['fields'])) { |
|
199 | + $fields = "{$this->table_name}.".implode(" , {$this->table_name}.", $this->args['fields']); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | // Set count. |
204 | - if ( ! empty( $this->args['count'] ) ) { |
|
204 | + if ( ! empty($this->args['count'])) { |
|
205 | 205 | $fields = "COUNT({$this->table_name}.id)"; |
206 | 206 | } |
207 | 207 | |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | |
210 | 210 | return $wpdb->prepare( |
211 | 211 | "SELECT {$fields} FROM {$this->table_name} {$where} {$orderby} {$this->args['order']} LIMIT %d,%d;", |
212 | - absint( $this->args['offset'] ), |
|
213 | - absint( $this->args['number'] ) |
|
212 | + absint($this->args['offset']), |
|
213 | + absint($this->args['number']) |
|
214 | 214 | ); |
215 | 215 | } |
216 | 216 | |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | $where = ''; |
228 | 228 | |
229 | 229 | // Get sql query for meta. |
230 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
231 | - $meta_query_object = new WP_Meta_Query( $this->args['meta_query'] ); |
|
230 | + if ( ! empty($this->args['meta_query'])) { |
|
231 | + $meta_query_object = new WP_Meta_Query($this->args['meta_query']); |
|
232 | 232 | $meta_query = $meta_query_object->get_sql( |
233 | 233 | $this->meta_type, |
234 | 234 | $this->table_name, |
235 | 235 | 'id' |
236 | 236 | ); |
237 | - $where = implode( '', $meta_query ); |
|
237 | + $where = implode('', $meta_query); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $where .= 'WHERE 1=1'; |
@@ -261,17 +261,17 @@ discard block |
||
261 | 261 | |
262 | 262 | $where = ''; |
263 | 263 | |
264 | - if ( ! empty( $this->args['email'] ) ) { |
|
264 | + if ( ! empty($this->args['email'])) { |
|
265 | 265 | |
266 | - if ( is_array( $this->args['email'] ) ) { |
|
266 | + if (is_array($this->args['email'])) { |
|
267 | 267 | |
268 | - $emails_count = count( $this->args['email'] ); |
|
269 | - $emails_placeholder = array_fill( 0, $emails_count, '%s' ); |
|
270 | - $emails = implode( ', ', $emails_placeholder ); |
|
268 | + $emails_count = count($this->args['email']); |
|
269 | + $emails_placeholder = array_fill(0, $emails_count, '%s'); |
|
270 | + $emails = implode(', ', $emails_placeholder); |
|
271 | 271 | |
272 | - $where .= $wpdb->prepare( " AND {$this->table_name}.email IN( $emails ) ", $this->args['email'] ); |
|
272 | + $where .= $wpdb->prepare(" AND {$this->table_name}.email IN( $emails ) ", $this->args['email']); |
|
273 | 273 | } else { |
274 | - $where .= $wpdb->prepare( " AND {$this->table_name}.email = %s ", $this->args['email'] ); |
|
274 | + $where .= $wpdb->prepare(" AND {$this->table_name}.email = %s ", $this->args['email']); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $where = ''; |
292 | 292 | |
293 | 293 | // Specific donors. |
294 | - if ( ! empty( $this->args['donor'] ) ) { |
|
295 | - if ( ! is_array( $this->args['donor'] ) ) { |
|
296 | - $this->args['donor'] = explode( ',', $this->args['donor'] ); |
|
294 | + if ( ! empty($this->args['donor'])) { |
|
295 | + if ( ! is_array($this->args['donor'])) { |
|
296 | + $this->args['donor'] = explode(',', $this->args['donor']); |
|
297 | 297 | } |
298 | - $log_ids = implode( ',', array_map( 'intval', $this->args['donor'] ) ); |
|
298 | + $log_ids = implode(',', array_map('intval', $this->args['donor'])); |
|
299 | 299 | |
300 | 300 | $where .= " AND {$this->table_name}.id IN( {$log_ids} ) "; |
301 | 301 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $where = ''; |
317 | 317 | |
318 | 318 | // Donors created for a specific date or in a date range |
319 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
319 | + if ( ! empty($this->args['date_query'])) { |
|
320 | 320 | $date_query_object = new WP_Date_Query( |
321 | 321 | $this->args['date_query'], |
322 | 322 | "{$this->table_name}.date_created" |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $where = ''; |
342 | 342 | |
343 | 343 | // Donors created for a specific date or in a date range |
344 | - if ( ! empty( $this->args['s'] ) && false !== strpos( $this->args['s'], ':' ) ) { |
|
345 | - $search_parts = explode( ':', $this->args['s'] ); |
|
344 | + if ( ! empty($this->args['s']) && false !== strpos($this->args['s'], ':')) { |
|
345 | + $search_parts = explode(':', $this->args['s']); |
|
346 | 346 | |
347 | - if ( ! empty( $search_parts[0] ) ) { |
|
348 | - switch ( $search_parts[0] ) { |
|
347 | + if ( ! empty($search_parts[0])) { |
|
348 | + switch ($search_parts[0]) { |
|
349 | 349 | case 'name': |
350 | 350 | $where = " AND {$this->table_name}.name LIKE '%{$search_parts[1]}%' "; |
351 | 351 | break; |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | $where = ''; |
374 | 374 | |
375 | 375 | // Donors create for specific wp user. |
376 | - if ( ! empty( $this->args['user'] ) ) { |
|
377 | - if ( ! is_array( $this->args['user'] ) ) { |
|
378 | - $this->args['user'] = explode( ',', $this->args['user'] ); |
|
376 | + if ( ! empty($this->args['user'])) { |
|
377 | + if ( ! is_array($this->args['user'])) { |
|
378 | + $this->args['user'] = explode(',', $this->args['user']); |
|
379 | 379 | } |
380 | - $user_ids = implode( ',', array_map( 'intval', $this->args['user'] ) ); |
|
380 | + $user_ids = implode(',', array_map('intval', $this->args['user'])); |
|
381 | 381 | |
382 | 382 | $where .= " AND {$this->table_name}.user_id IN( {$user_ids} ) "; |
383 | 383 | } |
@@ -396,14 +396,13 @@ discard block |
||
396 | 396 | private function get_order_query() { |
397 | 397 | $table_columns = Give()->donors->get_columns(); |
398 | 398 | |
399 | - $this->args['orderby'] = ! array_key_exists( $this->args['orderby'], $table_columns ) ? |
|
400 | - 'id' : |
|
401 | - $this->args['orderby']; |
|
399 | + $this->args['orderby'] = ! array_key_exists($this->args['orderby'], $table_columns) ? |
|
400 | + 'id' : $this->args['orderby']; |
|
402 | 401 | |
403 | - $this->args['orderby'] = esc_sql( $this->args['orderby'] ); |
|
404 | - $this->args['order'] = esc_sql( $this->args['order'] ); |
|
402 | + $this->args['orderby'] = esc_sql($this->args['orderby']); |
|
403 | + $this->args['order'] = esc_sql($this->args['order']); |
|
405 | 404 | |
406 | - switch ( $table_columns[ $this->args['orderby'] ] ) { |
|
405 | + switch ($table_columns[$this->args['orderby']]) { |
|
407 | 406 | case '%d': |
408 | 407 | case '%f': |
409 | 408 | $query = "ORDER BY {$this->table_name}.{$this->args['orderby']}+0"; |
@@ -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 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the from name. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
43 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
44 | 44 | |
45 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
45 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filters the from email. |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
55 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
56 | 56 | |
57 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
57 | + $to_email = give_get_payment_user_email($payment_id); |
|
58 | 58 | |
59 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
59 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filters the donation email receipt subject. |
63 | 63 | * |
64 | 64 | * @since 1.0 |
65 | 65 | */ |
66 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
67 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
66 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
67 | + $subject = give_do_email_tags($subject, $payment_id); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 1.0 |
76 | 76 | */ |
77 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
78 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
77 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
78 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
79 | 79 | |
80 | 80 | $emails = Give()->emails; |
81 | 81 | |
82 | - $emails->__set( 'from_name', $from_name ); |
|
83 | - $emails->__set( 'from_email', $from_email ); |
|
84 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
82 | + $emails->__set('from_name', $from_name); |
|
83 | + $emails->__set('from_email', $from_email); |
|
84 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation receipt's email headers. |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
95 | - $emails->__set( 'headers', $headers ); |
|
94 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
95 | + $emails->__set('headers', $headers); |
|
96 | 96 | |
97 | 97 | //Send the donation receipt. |
98 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
98 | + $emails->send($to_email, $subject, $message, $attachments); |
|
99 | 99 | |
100 | 100 | //If admin notifications are on, send the admin notice. |
101 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
101 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
102 | 102 | /** |
103 | 103 | * Fires in the donation email receipt. |
104 | 104 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int $payment_id Payment id. |
110 | 110 | * @param mixed $payment_data Payment meta data. |
111 | 111 | */ |
112 | - do_action( 'give_admin_donation_email', $payment_id, $payment_data ); |
|
112 | + do_action('give_admin_donation_email', $payment_id, $payment_data); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function give_email_test_donation_receipt() { |
124 | 124 | |
125 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
125 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Filters the from name. |
129 | 129 | * |
130 | 130 | * @since 1.7 |
131 | 131 | */ |
132 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() ); |
|
132 | + $from_name = apply_filters('give_donation_from_name', $from_name, 0, array()); |
|
133 | 133 | |
134 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
134 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters the from email. |
138 | 138 | * |
139 | 139 | * @since 1.7 |
140 | 140 | */ |
141 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() ); |
|
141 | + $from_email = apply_filters('give_donation_from_address', $from_email, 0, array()); |
|
142 | 142 | |
143 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
144 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
145 | - $subject = give_do_email_tags( $subject, 0 ); |
|
143 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
144 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
145 | + $subject = give_do_email_tags($subject, 0); |
|
146 | 146 | |
147 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
147 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
148 | 148 | |
149 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
149 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
150 | 150 | |
151 | 151 | $emails = Give()->emails; |
152 | - $emails->__set( 'from_name', $from_name ); |
|
153 | - $emails->__set( 'from_email', $from_email ); |
|
154 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
152 | + $emails->__set('from_name', $from_name); |
|
153 | + $emails->__set('from_email', $from_email); |
|
154 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
155 | 155 | |
156 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
157 | - $emails->__set( 'headers', $headers ); |
|
156 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
157 | + $emails->__set('headers', $headers); |
|
158 | 158 | |
159 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
159 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
173 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
174 | 174 | |
175 | - $payment_id = absint( $payment_id ); |
|
175 | + $payment_id = absint($payment_id); |
|
176 | 176 | |
177 | - if ( empty( $payment_id ) ) { |
|
177 | + if (empty($payment_id)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
181 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
185 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filters the from name. |
189 | 189 | * |
190 | 190 | * @since 1.0 |
191 | 191 | */ |
192 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
192 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
193 | 193 | |
194 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
194 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filters the from email. |
198 | 198 | * |
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
201 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
202 | 202 | |
203 | 203 | /* translators: %s: payment id */ |
204 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
204 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Filters the donation notification subject. |
208 | 208 | * |
209 | 209 | * @since 1.0 |
210 | 210 | */ |
211 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
212 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
211 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
212 | + $subject = give_do_email_tags($subject, $payment_id); |
|
213 | 213 | |
214 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
215 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
214 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
215 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
216 | 216 | //$headers .= "MIME-Version: 1.0\r\n"; |
217 | 217 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
218 | 218 | |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.0 |
223 | 223 | */ |
224 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
224 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple. |
228 | 228 | * |
229 | 229 | * @since 1.0 |
230 | 230 | */ |
231 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
231 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
232 | 232 | |
233 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
233 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
234 | 234 | |
235 | 235 | $emails = Give()->emails; |
236 | - $emails->__set( 'from_name', $from_name ); |
|
237 | - $emails->__set( 'from_email', $from_email ); |
|
238 | - $emails->__set( 'headers', $headers ); |
|
239 | - $emails->__set( 'heading', __( 'New Donation!', 'give' ) ); |
|
236 | + $emails->__set('from_name', $from_name); |
|
237 | + $emails->__set('from_email', $from_email); |
|
238 | + $emails->__set('headers', $headers); |
|
239 | + $emails->__set('heading', __('New Donation!', 'give')); |
|
240 | 240 | |
241 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
241 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 ); |
|
245 | +add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function give_get_admin_notice_emails() { |
254 | 254 | |
255 | - $email_option = give_get_option( 'admin_notice_emails' ); |
|
255 | + $email_option = give_get_option('admin_notice_emails'); |
|
256 | 256 | |
257 | - $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
258 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
257 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
258 | + $emails = array_map('trim', explode("\n", $emails)); |
|
259 | 259 | |
260 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
260 | + return apply_filters('give_admin_notice_emails', $emails); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
272 | +function give_admin_notices_disabled($payment_id = 0) { |
|
273 | 273 | |
274 | 274 | return apply_filters( |
275 | 275 | 'give_admin_notices_disabled', |
276 | - ! give_is_setting_enabled( give_get_option( 'admin_notices' ) ), |
|
276 | + ! give_is_setting_enabled(give_get_option('admin_notices')), |
|
277 | 277 | $payment_id |
278 | 278 | ); |
279 | 279 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | */ |
289 | 289 | function give_get_default_donation_notification_email() { |
290 | 290 | |
291 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n"; |
|
292 | - $default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
293 | - $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
294 | - $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
295 | - $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
296 | - $default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
297 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n"; |
|
298 | - $default_email_body .= '{sitename}' . "\n"; |
|
291 | + $default_email_body = __('Hi there,', 'give')."\n\n"; |
|
292 | + $default_email_body .= __('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
293 | + $default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n"; |
|
294 | + $default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
295 | + $default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
296 | + $default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
297 | + $default_email_body .= __('Thank you,', 'give')."\n\n"; |
|
298 | + $default_email_body .= '{sitename}'."\n"; |
|
299 | 299 | |
300 | - $custom_message = give_get_option( 'donation_notification' ); |
|
301 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
300 | + $custom_message = give_get_option('donation_notification'); |
|
301 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
302 | 302 | |
303 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
303 | + return apply_filters('give_default_donation_notification_email', $message); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,25 +314,25 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_donation_receipt_email() { |
316 | 316 | |
317 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
318 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
319 | - $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
320 | - $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
321 | - $default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
322 | - $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
323 | - $default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
324 | - $default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
325 | - $default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
326 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
317 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
318 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
319 | + $default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
320 | + $default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
321 | + $default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
322 | + $default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
323 | + $default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
324 | + $default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
325 | + $default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
326 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
327 | 327 | $default_email_body .= "\n\n"; |
328 | - $default_email_body .= __( 'Sincerely,', 'give' ) . "\n"; |
|
329 | - $default_email_body .= '{sitename}' . "\n"; |
|
328 | + $default_email_body .= __('Sincerely,', 'give')."\n"; |
|
329 | + $default_email_body .= '{sitename}'."\n"; |
|
330 | 330 | |
331 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
331 | + $custom_message = give_get_option('donation_receipt'); |
|
332 | 332 | |
333 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
333 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
334 | 334 | |
335 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
335 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -345,22 +345,22 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @return array $email_names |
347 | 347 | */ |
348 | -function give_get_email_names( $user_info, $payment = false ) { |
|
348 | +function give_get_email_names($user_info, $payment = false) { |
|
349 | 349 | $email_names = array(); |
350 | 350 | |
351 | - if ( is_a( $payment, 'Give_Payment' ) ) { |
|
351 | + if (is_a($payment, 'Give_Payment')) { |
|
352 | 352 | |
353 | - if ( $payment->user_id > 0 ) { |
|
353 | + if ($payment->user_id > 0) { |
|
354 | 354 | |
355 | - $user_data = get_userdata( $payment->user_id ); |
|
355 | + $user_data = get_userdata($payment->user_id); |
|
356 | 356 | $email_names['name'] = $payment->first_name; |
357 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
357 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
358 | 358 | $email_names['username'] = $user_data->user_login; |
359 | 359 | |
360 | - } elseif ( ! empty( $payment->first_name ) ) { |
|
360 | + } elseif ( ! empty($payment->first_name)) { |
|
361 | 361 | |
362 | 362 | $email_names['name'] = $payment->first_name; |
363 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
363 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
364 | 364 | $email_names['username'] = $payment->first_name; |
365 | 365 | |
366 | 366 | } else { |
@@ -373,30 +373,30 @@ discard block |
||
373 | 373 | } else { |
374 | 374 | |
375 | 375 | // Support for old serialized data. |
376 | - if ( is_serialized( $user_info ) ) { |
|
376 | + if (is_serialized($user_info)) { |
|
377 | 377 | |
378 | 378 | // Security check. |
379 | - preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches ); |
|
380 | - if ( ! empty( $matches ) ) { |
|
379 | + preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches); |
|
380 | + if ( ! empty($matches)) { |
|
381 | 381 | return array( |
382 | 382 | 'name' => '', |
383 | 383 | 'fullname' => '', |
384 | 384 | 'username' => '', |
385 | 385 | ); |
386 | 386 | } else { |
387 | - $user_info = maybe_unserialize( $user_info ); |
|
387 | + $user_info = maybe_unserialize($user_info); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | } |
391 | 391 | |
392 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
393 | - $user_data = get_userdata( $user_info['id'] ); |
|
392 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
393 | + $user_data = get_userdata($user_info['id']); |
|
394 | 394 | $email_names['name'] = $user_info['first_name']; |
395 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
395 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
396 | 396 | $email_names['username'] = $user_data->user_login; |
397 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
397 | + } elseif (isset($user_info['first_name'])) { |
|
398 | 398 | $email_names['name'] = $user_info['first_name']; |
399 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
399 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
400 | 400 | $email_names['username'] = $user_info['first_name']; |
401 | 401 | } else { |
402 | 402 | $email_names['name'] = $user_info['email']; |
@@ -416,37 +416,37 @@ discard block |
||
416 | 416 | * |
417 | 417 | * @since 1.8.14 |
418 | 418 | */ |
419 | -function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) { |
|
419 | +function give_admin_email_user_donor_disconnection($user_id, $donor_id) { |
|
420 | 420 | |
421 | - $user_id = absint( $user_id ); |
|
422 | - $donor_id = absint( $donor_id ); |
|
421 | + $user_id = absint($user_id); |
|
422 | + $donor_id = absint($donor_id); |
|
423 | 423 | |
424 | 424 | // Bail Out, if user id doesn't exists. |
425 | - if ( empty( $user_id ) ) { |
|
425 | + if (empty($user_id)) { |
|
426 | 426 | return; |
427 | 427 | } |
428 | 428 | |
429 | 429 | // Bail Out, if donor id doesn't exists. |
430 | - if ( empty( $donor_id ) ) { |
|
430 | + if (empty($donor_id)) { |
|
431 | 431 | return; |
432 | 432 | } |
433 | 433 | |
434 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
434 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
435 | 435 | |
436 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
436 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
437 | 437 | |
438 | 438 | /* translators: %s: payment id */ |
439 | - $subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' ); |
|
439 | + $subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give'); |
|
440 | 440 | |
441 | 441 | /** |
442 | 442 | * Filters the Donor-User Disconnection notification subject. |
443 | 443 | * |
444 | 444 | * @since 1.8.14 |
445 | 445 | */ |
446 | - $subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) ); |
|
446 | + $subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject)); |
|
447 | 447 | |
448 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
449 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
448 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
449 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
450 | 450 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
451 | 451 | |
452 | 452 | /** |
@@ -454,25 +454,25 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @since 1.8.14 |
456 | 456 | */ |
457 | - $headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers ); |
|
457 | + $headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers); |
|
458 | 458 | |
459 | - $message = __( 'Hi Admin,', 'give' ) . "\n\n"; |
|
460 | - $message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n"; |
|
461 | - $message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n"; |
|
459 | + $message = __('Hi Admin,', 'give')."\n\n"; |
|
460 | + $message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n"; |
|
461 | + $message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n"; |
|
462 | 462 | $message .= sprintf( |
463 | 463 | '<a href="%1$s">%2$s</a>', |
464 | - esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-message=reconnect-user' ), |
|
465 | - __( 'Reconnect User', 'give' ) . "\n\n" |
|
464 | + esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-message=reconnect-user'), |
|
465 | + __('Reconnect User', 'give')."\n\n" |
|
466 | 466 | ); |
467 | - $message .= __( 'Thank you,', 'give' ) . "\n\n"; |
|
468 | - $message .= '{sitename}' . "\n"; |
|
467 | + $message .= __('Thank you,', 'give')."\n\n"; |
|
468 | + $message .= '{sitename}'."\n"; |
|
469 | 469 | |
470 | 470 | $emails = Give()->emails; |
471 | - $emails->__set( 'from_name', $from_name ); |
|
472 | - $emails->__set( 'from_email', $from_email ); |
|
473 | - $emails->__set( 'headers', $headers ); |
|
474 | - $emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) ); |
|
471 | + $emails->__set('from_name', $from_name); |
|
472 | + $emails->__set('from_email', $from_email); |
|
473 | + $emails->__set('headers', $headers); |
|
474 | + $emails->__set('heading', __('User - Donor Profile Disconnection', 'give')); |
|
475 | 475 | |
476 | - $emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) ); |
|
476 | + $emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message)); |
|
477 | 477 | |
478 | 478 | } |
@@ -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 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_donors_page() { |
26 | 26 | $default_views = give_donor_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_donor_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_donor_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_donors_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_donor_views', $views ); |
|
45 | + return apply_filters('give_donor_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
59 | + return apply_filters('give_donor_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_donors_list() { |
70 | - include dirname( __FILE__ ) . '/class-donor-table.php'; |
|
70 | + include dirname(__FILE__).'/class-donor-table.php'; |
|
71 | 71 | |
72 | 72 | $donors_table = new Give_Donor_List_Table(); |
73 | 73 | $donors_table->prepare_items(); |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | 85 | |
86 | 86 | <hr class="wp-header-end"> |
87 | 87 | |
88 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
88 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
89 | 89 | <?php |
90 | - $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
90 | + $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
91 | 91 | $donors_table->display(); |
92 | 92 | ?> |
93 | 93 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @since 1.0 |
102 | 102 | */ |
103 | - do_action( 'give_donors_table_bottom' ); |
|
103 | + do_action('give_donors_table_bottom'); |
|
104 | 104 | ?> |
105 | 105 | </div> |
106 | 106 | <?php |
@@ -116,33 +116,33 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return void |
118 | 118 | */ |
119 | -function give_render_donor_view( $view, $callbacks ) { |
|
119 | +function give_render_donor_view($view, $callbacks) { |
|
120 | 120 | |
121 | 121 | $render = true; |
122 | 122 | |
123 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
123 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
124 | 124 | |
125 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
126 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
125 | + if ( ! current_user_can($donor_view_role)) { |
|
126 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
127 | 127 | $render = false; |
128 | 128 | } |
129 | 129 | |
130 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
131 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
130 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
131 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
132 | 132 | $render = false; |
133 | 133 | } |
134 | 134 | |
135 | 135 | $donor_id = (int) $_GET['id']; |
136 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
137 | - $donor = new Give_Donor( $donor_id ); |
|
136 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
137 | + $donor = new Give_Donor($donor_id); |
|
138 | 138 | |
139 | 139 | // Reconnect User with Donor profile. |
140 | - if( $reconnect_user_id ) { |
|
141 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
140 | + if ($reconnect_user_id) { |
|
141 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
142 | 142 | } |
143 | 143 | |
144 | - if ( empty( $donor->id ) ) { |
|
145 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
144 | + if (empty($donor->id)) { |
|
145 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
146 | 146 | $render = false; |
147 | 147 | } |
148 | 148 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | |
152 | 152 | <div class='wrap'> |
153 | 153 | |
154 | - <?php if ( give_get_errors() ) : ?> |
|
154 | + <?php if (give_get_errors()) : ?> |
|
155 | 155 | <div class="error settings-error"> |
156 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
156 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
157 | 157 | </div> |
158 | 158 | <?php endif; ?> |
159 | 159 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | <?php |
162 | 162 | printf( |
163 | 163 | /* translators: %s: donor number */ |
164 | - esc_html__( 'Donor %s', 'give' ), |
|
164 | + esc_html__('Donor %s', 'give'), |
|
165 | 165 | $donor_id |
166 | 166 | ); |
167 | 167 | ?> |
@@ -169,26 +169,26 @@ discard block |
||
169 | 169 | |
170 | 170 | <hr class="wp-header-end"> |
171 | 171 | |
172 | - <?php if ( $donor && $render ) : ?> |
|
172 | + <?php if ($donor && $render) : ?> |
|
173 | 173 | |
174 | 174 | <h2 class="nav-tab-wrapper"> |
175 | 175 | <?php |
176 | - foreach ( $donor_tabs as $key => $tab ) : |
|
176 | + foreach ($donor_tabs as $key => $tab) : |
|
177 | 177 | $active = $key === $view ? true : false; |
178 | 178 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
179 | 179 | printf( |
180 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
181 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
182 | - esc_attr( $class ), |
|
183 | - sanitize_html_class( $tab['dashicon'] ), |
|
184 | - esc_html( $tab['title'] ) |
|
180 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
181 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
182 | + esc_attr($class), |
|
183 | + sanitize_html_class($tab['dashicon']), |
|
184 | + esc_html($tab['title']) |
|
185 | 185 | ); |
186 | 186 | endforeach; |
187 | 187 | ?> |
188 | 188 | </h2> |
189 | 189 | |
190 | 190 | <div id="give-donor-card-wrapper"> |
191 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
191 | + <?php $callbacks[$view]($donor) ?> |
|
192 | 192 | </div> |
193 | 193 | |
194 | 194 | <?php endif; ?> |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return void |
210 | 210 | */ |
211 | -function give_donor_view( $donor ) { |
|
211 | +function give_donor_view($donor) { |
|
212 | 212 | |
213 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
213 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
214 | 214 | |
215 | 215 | /** |
216 | 216 | * Fires in donor profile screen, above the donor card. |
@@ -219,32 +219,32 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @param object $donor The donor object being displayed. |
221 | 221 | */ |
222 | - do_action( 'give_donor_card_top', $donor ); |
|
222 | + do_action('give_donor_card_top', $donor); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
226 | 226 | |
227 | - <form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
227 | + <form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
228 | 228 | |
229 | 229 | <div class="donor-info"> |
230 | 230 | |
231 | 231 | <div class="donor-bio-header clearfix"> |
232 | 232 | |
233 | 233 | <div class="avatar-wrap left" id="donor-avatar"> |
234 | - <?php echo get_avatar( $donor->email ); ?> |
|
234 | + <?php echo get_avatar($donor->email); ?> |
|
235 | 235 | </div> |
236 | 236 | |
237 | 237 | <div id="donor-name-wrap" class="left"> |
238 | 238 | <span class="donor-id">#<?php echo $donor->id; ?></span> |
239 | - <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
239 | + <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
240 | 240 | <span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span> |
241 | 241 | </div> |
242 | 242 | <p class="donor-since info-item"> |
243 | - <?php _e( 'Donor since', 'give' ); ?> |
|
244 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
243 | + <?php _e('Donor since', 'give'); ?> |
|
244 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
245 | 245 | </p> |
246 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
247 | - <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
246 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
247 | + <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
248 | 248 | <?php endif; ?> |
249 | 249 | </div> |
250 | 250 | <!-- /donor-bio-header --> |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | <table class="widefat"> |
255 | 255 | <tbody> |
256 | 256 | <tr class="alternate"> |
257 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
257 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
258 | 258 | <td> |
259 | 259 | <span class="donor-user-id info-item edit-item"> |
260 | 260 | <?php |
@@ -271,48 +271,48 @@ discard block |
||
271 | 271 | 'data' => $data_atts, |
272 | 272 | ); |
273 | 273 | |
274 | - if ( ! empty( $user_id ) ) { |
|
275 | - $userdata = get_userdata( $user_id ); |
|
274 | + if ( ! empty($user_id)) { |
|
275 | + $userdata = get_userdata($user_id); |
|
276 | 276 | $user_args['selected'] = $user_id; |
277 | 277 | } |
278 | 278 | |
279 | - echo Give()->html->ajax_user_search( $user_args ); |
|
279 | + echo Give()->html->ajax_user_search($user_args); |
|
280 | 280 | ?> |
281 | 281 | </span> |
282 | 282 | |
283 | 283 | <span class="donor-user-id info-item editable"> |
284 | - <?php if ( ! empty( $userdata ) ) { ?> |
|
285 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
284 | + <?php if ( ! empty($userdata)) { ?> |
|
285 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
286 | 286 | <?php } else { ?> |
287 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
287 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
288 | 288 | <?php } ?> |
289 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?> |
|
289 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?> |
|
290 | 290 | <span class="disconnect-user"> |
291 | 291 | - |
292 | - <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>"> |
|
293 | - <?php _e( 'Disconnect User', 'give' ); ?> |
|
292 | + <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e('Disconnects the current user ID from this donor record.', 'give'); ?>"> |
|
293 | + <?php _e('Disconnect User', 'give'); ?> |
|
294 | 294 | </a> |
295 | 295 | </span> |
296 | 296 | <span class="view-user-profile"> |
297 | 297 | | |
298 | - <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id=' . $donor->user_id; ?>" aria-label="<?php _e( 'View User Profile of current user ID.', 'give' ); ?>"> |
|
299 | - <?php _e( 'View User Profile', 'give' ); ?> |
|
298 | + <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id='.$donor->user_id; ?>" aria-label="<?php _e('View User Profile of current user ID.', 'give'); ?>"> |
|
299 | + <?php _e('View User Profile', 'give'); ?> |
|
300 | 300 | </a> |
301 | 301 | </span> |
302 | 302 | <?php } ?> |
303 | 303 | </span> |
304 | 304 | </td> |
305 | 305 | </tr> |
306 | - <?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?> |
|
306 | + <?php if (isset($donor->user_id) && $donor->user_id > 0) : ?> |
|
307 | 307 | |
308 | 308 | <tr> |
309 | - <th scope="col"><?php _e( 'Address:', 'give' ); ?></th> |
|
309 | + <th scope="col"><?php _e('Address:', 'give'); ?></th> |
|
310 | 310 | <td class="row-title"> |
311 | 311 | |
312 | 312 | <div class="donor-address-wrapper"> |
313 | 313 | |
314 | 314 | <?php |
315 | - $address = get_user_meta( $donor->user_id, '_give_user_address', true ); |
|
315 | + $address = get_user_meta($donor->user_id, '_give_user_address', true); |
|
316 | 316 | $defaults = array( |
317 | 317 | 'line1' => '', |
318 | 318 | 'line2' => '', |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | 'zip' => '', |
323 | 323 | ); |
324 | 324 | |
325 | - $address = wp_parse_args( $address, $defaults ); |
|
325 | + $address = wp_parse_args($address, $defaults); |
|
326 | 326 | ?> |
327 | 327 | |
328 | - <?php if ( ! empty( $address ) ) { ?> |
|
328 | + <?php if ( ! empty($address)) { ?> |
|
329 | 329 | <span class="donor-address info-item editable"> |
330 | 330 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
331 | 331 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | |
343 | 343 | // For State. |
344 | 344 | $selected_state = give_get_state(); |
345 | - $states = give_get_states( $selected_country ); |
|
346 | - $selected_state = ( isset( $address['state'] ) ? $address['state'] : $selected_state ); |
|
345 | + $states = give_get_states($selected_country); |
|
346 | + $selected_state = (isset($address['state']) ? $address['state'] : $selected_state); |
|
347 | 347 | |
348 | 348 | // Get the country list that does not have any states init. |
349 | 349 | $no_states_country = give_no_states_country_list(); |
@@ -351,32 +351,32 @@ discard block |
||
351 | 351 | <span class="donor-address info-item edit-item"> |
352 | 352 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
353 | 353 | <?php |
354 | - foreach ( $countries as $country_code => $country ) { |
|
355 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
354 | + foreach ($countries as $country_code => $country) { |
|
355 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
356 | 356 | } |
357 | 357 | ?> |
358 | 358 | </select> |
359 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
360 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
359 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
360 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
361 | 361 | <?php |
362 | - if ( ! empty( $states ) ) { |
|
362 | + if ( ! empty($states)) { |
|
363 | 363 | ?> |
364 | 364 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
365 | 365 | <?php |
366 | - foreach ( $states as $state_code => $state ) { |
|
367 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
366 | + foreach ($states as $state_code => $state) { |
|
367 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
368 | 368 | } |
369 | 369 | ?> |
370 | 370 | </select> |
371 | 371 | <?php |
372 | 372 | } else { |
373 | 373 | ?> |
374 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ? 'give-hidden' : '' ); ?>" placeholder="<?php _e( 'State / Province / County', 'give' ); ?>" /> |
|
374 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country) ? 'give-hidden' : ''); ?>" placeholder="<?php _e('State / Province / County', 'give'); ?>" /> |
|
375 | 375 | <?php |
376 | 376 | } |
377 | 377 | ?> |
378 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
379 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
378 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
379 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
380 | 380 | </span> |
381 | 381 | |
382 | 382 | </div> |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | |
393 | 393 | <span id="donor-edit-actions" class="edit-item"> |
394 | 394 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" /> |
395 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
395 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
396 | 396 | <input type="hidden" name="give_action" value="edit-donor" /> |
397 | - <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
398 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
397 | + <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
398 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
399 | 399 | </span> |
400 | 400 | |
401 | 401 | </form> |
@@ -410,24 +410,24 @@ discard block |
||
410 | 410 | * |
411 | 411 | * @param object $donor The donor object being displayed. |
412 | 412 | */ |
413 | - do_action( 'give_donor_before_stats', $donor ); |
|
413 | + do_action('give_donor_before_stats', $donor); |
|
414 | 414 | ?> |
415 | 415 | |
416 | 416 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
417 | 417 | <ul> |
418 | 418 | <li> |
419 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
419 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
420 | 420 | <span class="dashicons dashicons-heart"></span> |
421 | 421 | <?php |
422 | 422 | // Completed Donations. |
423 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
424 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
423 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
424 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
425 | 425 | ?> |
426 | 426 | </a> |
427 | 427 | </li> |
428 | 428 | <li> |
429 | 429 | <span class="dashicons dashicons-chart-area"></span> |
430 | - <?php echo give_currency_filter( give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
430 | + <?php echo give_currency_filter(give_format_amount($donor->purchase_value, array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
431 | 431 | </li> |
432 | 432 | <?php |
433 | 433 | /** |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @param object $donor The donor object being displayed. |
441 | 441 | */ |
442 | - do_action( 'give_donor_stats_list', $donor ); |
|
442 | + do_action('give_donor_stats_list', $donor); |
|
443 | 443 | ?> |
444 | 444 | </ul> |
445 | 445 | </div> |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @param object $donor The donor object being displayed. |
454 | 454 | */ |
455 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
455 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
456 | 456 | ?> |
457 | 457 | |
458 | 458 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -465,46 +465,46 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @param object $donor The donor object being displayed. |
467 | 467 | */ |
468 | - do_action( 'give_donor_before_tables', $donor ); |
|
468 | + do_action('give_donor_before_tables', $donor); |
|
469 | 469 | ?> |
470 | 470 | |
471 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
471 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
472 | 472 | |
473 | 473 | <table class="wp-list-table widefat striped emails"> |
474 | 474 | <thead> |
475 | 475 | <tr> |
476 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
477 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
476 | + <th><?php _e('Email', 'give'); ?></th> |
|
477 | + <th><?php _e('Actions', 'give'); ?></th> |
|
478 | 478 | </tr> |
479 | 479 | </thead> |
480 | 480 | |
481 | 481 | <tbody> |
482 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
482 | + <?php if ( ! empty($donor->emails)) { ?> |
|
483 | 483 | |
484 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
484 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
485 | 485 | <tr data-key="<?php echo $key; ?>"> |
486 | 486 | <td> |
487 | 487 | <?php echo $email; ?> |
488 | - <?php if ( 'primary' === $key ) : ?> |
|
488 | + <?php if ('primary' === $key) : ?> |
|
489 | 489 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
490 | 490 | <?php endif; ?> |
491 | 491 | </td> |
492 | 492 | <td> |
493 | - <?php if ( 'primary' !== $key ) : ?> |
|
493 | + <?php if ('primary' !== $key) : ?> |
|
494 | 494 | <?php |
495 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
496 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
497 | - 'email' => rawurlencode( $email ), |
|
495 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
496 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
497 | + 'email' => rawurlencode($email), |
|
498 | 498 | 'give_action' => 'set_donor_primary_email', |
499 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
500 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
501 | - 'email' => rawurlencode( $email ), |
|
499 | + ), $base_url), 'give-set-donor-primary-email'); |
|
500 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
501 | + 'email' => rawurlencode($email), |
|
502 | 502 | 'give_action' => 'remove_donor_email', |
503 | - ), $base_url ), 'give-remove-donor-email' ); |
|
503 | + ), $base_url), 'give-remove-donor-email'); |
|
504 | 504 | ?> |
505 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
505 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
506 | 506 | | |
507 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
507 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
508 | 508 | <?php endif; ?> |
509 | 509 | </td> |
510 | 510 | </tr> |
@@ -514,59 +514,59 @@ discard block |
||
514 | 514 | <td colspan="2" class="add-donor-email-td"> |
515 | 515 | <div class="add-donor-email-wrapper"> |
516 | 516 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" /> |
517 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
518 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
519 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
520 | - <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
517 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
518 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
519 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
520 | + <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
521 | 521 | <span class="spinner"></span> |
522 | 522 | </div> |
523 | 523 | <div class="notice-wrap"></div> |
524 | 524 | </td> |
525 | 525 | </tr> |
526 | 526 | <?php } else { ?> |
527 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr> |
|
527 | + <tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr> |
|
528 | 528 | <?php }// End if(). |
529 | 529 | ?> |
530 | 530 | </tbody> |
531 | 531 | </table> |
532 | 532 | |
533 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
533 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
534 | 534 | <?php |
535 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
536 | - $payments = give_get_payments( array( |
|
535 | + $payment_ids = explode(',', $donor->payment_ids); |
|
536 | + $payments = give_get_payments(array( |
|
537 | 537 | 'post__in' => $payment_ids, |
538 | - ) ); |
|
539 | - $payments = array_slice( $payments, 0, 10 ); |
|
538 | + )); |
|
539 | + $payments = array_slice($payments, 0, 10); |
|
540 | 540 | ?> |
541 | 541 | <table class="wp-list-table widefat striped payments"> |
542 | 542 | <thead> |
543 | 543 | <tr> |
544 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
545 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
546 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
547 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
548 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
544 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
545 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
546 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
547 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
548 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
549 | 549 | </tr> |
550 | 550 | </thead> |
551 | 551 | <tbody> |
552 | - <?php if ( ! empty( $payments ) ) { ?> |
|
553 | - <?php foreach ( $payments as $payment ) : ?> |
|
552 | + <?php if ( ! empty($payments)) { ?> |
|
553 | + <?php foreach ($payments as $payment) : ?> |
|
554 | 554 | <tr> |
555 | 555 | <td><?php echo $payment->ID; ?></td> |
556 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
557 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
558 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
556 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
557 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
558 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
559 | 559 | <td> |
560 | 560 | <?php |
561 | 561 | printf( |
562 | 562 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
563 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
563 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
564 | 564 | sprintf( |
565 | 565 | /* translators: %s: Donation ID */ |
566 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
566 | + esc_attr__('View Donation %s.', 'give'), |
|
567 | 567 | $payment->ID |
568 | 568 | ), |
569 | - __( 'View Donation', 'give' ) |
|
569 | + __('View Donation', 'give') |
|
570 | 570 | ); |
571 | 571 | ?> |
572 | 572 | |
@@ -581,47 +581,47 @@ discard block |
||
581 | 581 | * @param object $donor The donor object being displayed. |
582 | 582 | * @param object $payment The payment object being displayed. |
583 | 583 | */ |
584 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
584 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
585 | 585 | ?> |
586 | 586 | </td> |
587 | 587 | </tr> |
588 | 588 | <?php endforeach; ?> |
589 | 589 | <?php } else { ?> |
590 | 590 | <tr> |
591 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
591 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
592 | 592 | </tr> |
593 | 593 | <?php }// End if(). |
594 | 594 | ?> |
595 | 595 | </tbody> |
596 | 596 | </table> |
597 | 597 | |
598 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
598 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
599 | 599 | <?php |
600 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
600 | + $donations = give_get_users_completed_donations($donor->email); |
|
601 | 601 | ?> |
602 | 602 | <table class="wp-list-table widefat striped donations"> |
603 | 603 | <thead> |
604 | 604 | <tr> |
605 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
606 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
605 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
606 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
607 | 607 | </tr> |
608 | 608 | </thead> |
609 | 609 | <tbody> |
610 | - <?php if ( ! empty( $donations ) ) { ?> |
|
611 | - <?php foreach ( $donations as $donation ) : ?> |
|
610 | + <?php if ( ! empty($donations)) { ?> |
|
611 | + <?php foreach ($donations as $donation) : ?> |
|
612 | 612 | <tr> |
613 | 613 | <td><?php echo $donation->post_title; ?></td> |
614 | 614 | <td> |
615 | 615 | <?php |
616 | 616 | printf( |
617 | 617 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
618 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
618 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
619 | 619 | sprintf( |
620 | 620 | /* translators: %s: form name */ |
621 | - esc_attr__( 'View Form %s.', 'give' ), |
|
621 | + esc_attr__('View Form %s.', 'give'), |
|
622 | 622 | $donation->post_title |
623 | 623 | ), |
624 | - __( 'View Form', 'give' ) |
|
624 | + __('View Form', 'give') |
|
625 | 625 | ); |
626 | 626 | ?> |
627 | 627 | </td> |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | <?php endforeach; ?> |
630 | 630 | <?php } else { ?> |
631 | 631 | <tr> |
632 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
632 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
633 | 633 | </tr> |
634 | 634 | <?php } ?> |
635 | 635 | </tbody> |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * |
644 | 644 | * @param object $donor The donor object being displayed. |
645 | 645 | */ |
646 | - do_action( 'give_donor_after_tables', $donor ); |
|
646 | + do_action('give_donor_after_tables', $donor); |
|
647 | 647 | ?> |
648 | 648 | |
649 | 649 | </div> |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param object $donor The donor object being displayed. |
658 | 658 | */ |
659 | - do_action( 'give_donor_card_bottom', $donor ); |
|
659 | + do_action('give_donor_card_bottom', $donor); |
|
660 | 660 | |
661 | 661 | } |
662 | 662 | |
@@ -669,30 +669,30 @@ discard block |
||
669 | 669 | * |
670 | 670 | * @return void |
671 | 671 | */ |
672 | -function give_donor_notes_view( $donor ) { |
|
672 | +function give_donor_notes_view($donor) { |
|
673 | 673 | |
674 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
675 | - $paged = absint( $paged ); |
|
674 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
675 | + $paged = absint($paged); |
|
676 | 676 | $note_count = $donor->get_notes_count(); |
677 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
678 | - $total_pages = ceil( $note_count / $per_page ); |
|
679 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
677 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
678 | + $total_pages = ceil($note_count / $per_page); |
|
679 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
680 | 680 | ?> |
681 | 681 | |
682 | 682 | <div id="donor-notes-wrapper"> |
683 | 683 | <div class="donor-notes-header"> |
684 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
684 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
685 | 685 | </div> |
686 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
686 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
687 | 687 | |
688 | - <?php if ( 1 == $paged ) : ?> |
|
688 | + <?php if (1 == $paged) : ?> |
|
689 | 689 | <div style="display: block; margin-bottom: 55px;"> |
690 | - <form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
690 | + <form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
691 | 691 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
692 | 692 | <br /> |
693 | 693 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" /> |
694 | 694 | <input type="hidden" name="give_action" value="add-donor-note" /> |
695 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
695 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
696 | 696 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" /> |
697 | 697 | </form> |
698 | 698 | </div> |
@@ -707,26 +707,26 @@ discard block |
||
707 | 707 | 'show_all' => true, |
708 | 708 | ); |
709 | 709 | |
710 | - echo paginate_links( $pagination_args ); |
|
710 | + echo paginate_links($pagination_args); |
|
711 | 711 | ?> |
712 | 712 | |
713 | 713 | <div id="give-donor-notes" class="postbox"> |
714 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
715 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
714 | + <?php if (count($donor_notes) > 0) { ?> |
|
715 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
716 | 716 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
717 | 717 | <span class="note-content-wrap"> |
718 | - <?php echo stripslashes( $note ); ?> |
|
718 | + <?php echo stripslashes($note); ?> |
|
719 | 719 | </span> |
720 | 720 | </div> |
721 | 721 | <?php endforeach; ?> |
722 | 722 | <?php } else { ?> |
723 | 723 | <div class="give-no-donor-notes"> |
724 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
724 | + <?php _e('No donor notes found.', 'give'); ?> |
|
725 | 725 | </div> |
726 | 726 | <?php } ?> |
727 | 727 | </div> |
728 | 728 | |
729 | - <?php echo paginate_links( $pagination_args ); ?> |
|
729 | + <?php echo paginate_links($pagination_args); ?> |
|
730 | 730 | |
731 | 731 | </div> |
732 | 732 | |
@@ -742,9 +742,9 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return void |
744 | 744 | */ |
745 | -function give_donor_delete_view( $donor ) { |
|
745 | +function give_donor_delete_view($donor) { |
|
746 | 746 | |
747 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
747 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
748 | 748 | |
749 | 749 | /** |
750 | 750 | * Fires in donor delete screen, above the content. |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | * |
754 | 754 | * @param object $donor The donor object being displayed. |
755 | 755 | */ |
756 | - do_action( 'give_donor_delete_top', $donor ); |
|
756 | + do_action('give_donor_delete_top', $donor); |
|
757 | 757 | ?> |
758 | 758 | |
759 | 759 | <div class="info-wrapper donor-section"> |
760 | 760 | |
761 | - <form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
761 | + <form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
762 | 762 | |
763 | 763 | <div class="donor-notes-header"> |
764 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
764 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
765 | 765 | </div> |
766 | 766 | |
767 | 767 | |
@@ -769,20 +769,20 @@ discard block |
||
769 | 769 | |
770 | 770 | <span class="delete-donor-options"> |
771 | 771 | <p> |
772 | - <?php echo Give()->html->checkbox( array( |
|
772 | + <?php echo Give()->html->checkbox(array( |
|
773 | 773 | 'name' => 'give-donor-delete-confirm', |
774 | - ) ); ?> |
|
775 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
774 | + )); ?> |
|
775 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
776 | 776 | </p> |
777 | 777 | |
778 | 778 | <p> |
779 | - <?php echo Give()->html->checkbox( array( |
|
779 | + <?php echo Give()->html->checkbox(array( |
|
780 | 780 | 'name' => 'give-donor-delete-records', |
781 | 781 | 'options' => array( |
782 | 782 | 'disabled' => true, |
783 | 783 | ), |
784 | - ) ); ?> |
|
785 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
784 | + )); ?> |
|
785 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
786 | 786 | </p> |
787 | 787 | |
788 | 788 | <?php |
@@ -795,16 +795,16 @@ discard block |
||
795 | 795 | * |
796 | 796 | * @param object $donor The donor object being displayed. |
797 | 797 | */ |
798 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
798 | + do_action('give_donor_delete_inputs', $donor); |
|
799 | 799 | ?> |
800 | 800 | </span> |
801 | 801 | |
802 | 802 | <span id="donor-edit-actions"> |
803 | 803 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" /> |
804 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
804 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
805 | 805 | <input type="hidden" name="give_action" value="delete-donor" /> |
806 | - <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
807 | - <a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
806 | + <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
807 | + <a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
808 | 808 | </span> |
809 | 809 | |
810 | 810 | </div> |
@@ -820,5 +820,5 @@ discard block |
||
820 | 820 | * |
821 | 821 | * @param object $donor The donor object being displayed. |
822 | 822 | */ |
823 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
823 | + do_action('give_donor_delete_bottom', $donor); |
|
824 | 824 | } |
@@ -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,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views. |
25 | 25 | */ |
26 | -function give_register_default_donor_views( $views ) { |
|
26 | +function give_register_default_donor_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_donor_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_donor_notes_view', |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 ); |
|
38 | +add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single donor view. |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_donor_tabs( $tabs ) { |
|
49 | +function give_register_default_donor_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | 52 | 'overview' => array( |
53 | 53 | 'dashicon' => 'dashicons-admin-users', |
54 | - 'title' => __( 'Donor Profile', 'give' ), |
|
54 | + 'title' => __('Donor Profile', 'give'), |
|
55 | 55 | ), |
56 | 56 | 'notes' => array( |
57 | 57 | 'dashicon' => 'dashicons-admin-comments', |
58 | - 'title' => __( 'Donor Notes', 'give' ), |
|
58 | + 'title' => __('Donor Notes', 'give'), |
|
59 | 59 | ), |
60 | 60 | ); |
61 | 61 | |
62 | - return array_merge( $tabs, $default_tabs ); |
|
62 | + return array_merge($tabs, $default_tabs); |
|
63 | 63 | } |
64 | 64 | |
65 | -add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 ); |
|
65 | +add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Register the Delete icon as late as possible so it's at the bottom. |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return array The altered list of tabs, with 'delete' at the bottom. |
75 | 75 | */ |
76 | -function give_register_delete_donor_tab( $tabs ) { |
|
76 | +function give_register_delete_donor_tab($tabs) { |
|
77 | 77 | |
78 | 78 | $tabs['delete'] = array( |
79 | 79 | 'dashicon' => 'dashicons-trash', |
80 | - 'title' => __( 'Delete Donor', 'give' ), |
|
80 | + 'title' => __('Delete Donor', 'give'), |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | return $tabs; |
84 | 84 | } |
85 | 85 | |
86 | -add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 ); |
|
86 | +add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Connect and Reconnect Donor with User profile. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return array |
98 | 98 | */ |
99 | -function give_connect_user_donor_profile( $donor, $donor_data, $address ) { |
|
99 | +function give_connect_user_donor_profile($donor, $donor_data, $address) { |
|
100 | 100 | |
101 | 101 | $donor_id = $donor->id; |
102 | 102 | $previous_user_id = $donor->user_id; |
@@ -110,40 +110,40 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @since 1.0 |
112 | 112 | */ |
113 | - do_action( 'give_pre_edit_donor', $donor_id, $donor_data, $address ); |
|
113 | + do_action('give_pre_edit_donor', $donor_id, $donor_data, $address); |
|
114 | 114 | |
115 | 115 | $output = array(); |
116 | 116 | |
117 | - if ( $donor->update( $donor_data ) ) { |
|
117 | + if ($donor->update($donor_data)) { |
|
118 | 118 | |
119 | - if ( ! empty( $donor->user_id ) && $donor->user_id > 0 ) { |
|
120 | - update_user_meta( $donor->user_id, '_give_user_address', $address ); |
|
119 | + if ( ! empty($donor->user_id) && $donor->user_id > 0) { |
|
120 | + update_user_meta($donor->user_id, '_give_user_address', $address); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Update some donation meta if we need to. |
124 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
124 | + $payments_array = explode(',', $donor->payment_ids); |
|
125 | 125 | |
126 | - if ( $donor->user_id !== $previous_user_id ) { |
|
127 | - foreach ( $payments_array as $payment_id ) { |
|
128 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $donor->user_id ); |
|
126 | + if ($donor->user_id !== $previous_user_id) { |
|
127 | + foreach ($payments_array as $payment_id) { |
|
128 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $donor->user_id); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Fetch disconnected user id, if exists. |
133 | - $disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true ); |
|
133 | + $disconnected_user_id = $donor->get_meta('_give_disconnected_user_id', true); |
|
134 | 134 | |
135 | 135 | // Flag User and Donor Disconnection. |
136 | - delete_user_meta( $disconnected_user_id, '_give_is_donor_disconnected' ); |
|
136 | + delete_user_meta($disconnected_user_id, '_give_is_donor_disconnected'); |
|
137 | 137 | |
138 | 138 | // Check whether the disconnected user id and the reconnected user id are same or not. |
139 | 139 | // If both are same then delete user id store in donor meta. |
140 | - if( $donor_data['user_id'] === $disconnected_user_id ) { |
|
141 | - delete_user_meta( $disconnected_user_id, '_give_disconnected_donor_id' ); |
|
142 | - $donor->delete_meta( '_give_disconnected_user_id' ); |
|
140 | + if ($donor_data['user_id'] === $disconnected_user_id) { |
|
141 | + delete_user_meta($disconnected_user_id, '_give_disconnected_donor_id'); |
|
142 | + $donor->delete_meta('_give_disconnected_user_id'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | $output['success'] = true; |
146 | - $donor_data = array_merge( $donor_data, $address ); |
|
146 | + $donor_data = array_merge($donor_data, $address); |
|
147 | 147 | $output['customer_info'] = $donor_data; |
148 | 148 | |
149 | 149 | } else { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @since 1.0 |
162 | 162 | */ |
163 | - do_action( 'give_post_edit_donor', $donor_id, $donor_data ); |
|
163 | + do_action('give_post_edit_donor', $donor_id, $donor_data); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | return $output; |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
95 | 95 | if ( isset( $_POST['akismet_spam_protection'] ) |
96 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
97 | - && ! give_check_akismet_key() |
|
96 | + && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
97 | + && ! give_check_akismet_key() |
|
98 | 98 | ) { |
99 | 99 | self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
100 | 100 | |
@@ -763,9 +763,9 @@ discard block |
||
763 | 763 | <td class="give-docs-link" colspan="2"> |
764 | 764 | <?php |
765 | 765 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
766 | - . '" target="_blank">' |
|
767 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
768 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
766 | + . '" target="_blank">' |
|
767 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
768 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
769 | 769 | ?> |
770 | 770 | </td> |
771 | 771 | </tr><?php |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | public static function save() { |
87 | 87 | $current_tab = give_get_current_setting_tab(); |
88 | 88 | |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
90 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
91 | 91 | die(); |
92 | 92 | } |
93 | 93 | |
94 | 94 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
95 | - if ( isset( $_POST['akismet_spam_protection'] ) |
|
96 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
95 | + if (isset($_POST['akismet_spam_protection']) |
|
96 | + && give_is_setting_enabled($_POST['akismet_spam_protection']) |
|
97 | 97 | && ! give_check_akismet_key() |
98 | 98 | ) { |
99 | - self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
|
99 | + self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give')); |
|
100 | 100 | |
101 | 101 | return; |
102 | 102 | } |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @since 1.8 |
112 | 112 | */ |
113 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
113 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
114 | 114 | |
115 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
115 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Trigger Action. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @since 1.8 |
125 | 125 | */ |
126 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
126 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return void |
138 | 138 | */ |
139 | - public static function add_message( $code, $message ) { |
|
140 | - self::$messages[ $code ] = $message; |
|
139 | + public static function add_message($code, $message) { |
|
140 | + self::$messages[$code] = $message; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return void |
152 | 152 | */ |
153 | - public static function add_error( $code, $message ) { |
|
154 | - self::$errors[ $code ] = $message; |
|
153 | + public static function add_error($code, $message) { |
|
154 | + self::$errors[$code] = $message; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | $notice_html = ''; |
165 | 165 | $classes = 'give-notice settings-error notice is-dismissible'; |
166 | 166 | |
167 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
168 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
167 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
168 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
169 | 169 | |
170 | - if ( 0 < count( self::$errors ) ) { |
|
171 | - foreach ( self::$errors as $code => $message ) { |
|
172 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
170 | + if (0 < count(self::$errors)) { |
|
171 | + foreach (self::$errors as $code => $message) { |
|
172 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - if ( 0 < count( self::$messages ) ) { |
|
177 | - foreach ( self::$messages as $code => $message ) { |
|
178 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
176 | + if (0 < count(self::$messages)) { |
|
177 | + foreach (self::$messages as $code => $message) { |
|
178 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | self::$setting_filter_prefix = give_get_current_setting_page(); |
196 | 196 | |
197 | 197 | // Bailout: Exit if setting page is not defined. |
198 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
198 | + if (empty(self::$setting_filter_prefix)) { |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @since 1.8 |
210 | 210 | */ |
211 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
211 | + do_action(self::$setting_filter_prefix.'_start'); |
|
212 | 212 | |
213 | 213 | $current_tab = give_get_current_setting_tab(); |
214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | self::get_settings_pages(); |
217 | 217 | |
218 | 218 | // Save settings if data has been posted. |
219 | - if ( ! empty( $_POST ) ) { |
|
219 | + if ( ! empty($_POST)) { |
|
220 | 220 | self::save(); |
221 | 221 | } |
222 | 222 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @since 1.8 |
231 | 231 | */ |
232 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
232 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
233 | 233 | |
234 | 234 | include 'views/html-admin-settings.php'; |
235 | 235 | |
@@ -247,25 +247,25 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return string|bool |
249 | 249 | */ |
250 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
250 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
251 | 251 | // Bailout. |
252 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
252 | + if (empty($option_name) && empty($field_id)) { |
|
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | |
256 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
256 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
257 | 257 | // Get field value if any. |
258 | - $option_value = get_option( $option_name ); |
|
258 | + $option_value = get_option($option_name); |
|
259 | 259 | |
260 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
261 | - ? $option_value[ $field_id ] |
|
260 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
261 | + ? $option_value[$field_id] |
|
262 | 262 | : $default; |
263 | 263 | } else { |
264 | 264 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
265 | 265 | $option_name = ! $option_name ? $field_id : $option_name; |
266 | 266 | |
267 | 267 | // Get option value if any. |
268 | - $option_value = get_option( $option_name, $default ); |
|
268 | + $option_value = get_option($option_name, $default); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $option_value; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return void |
285 | 285 | */ |
286 | - public static function output_fields( $options, $option_name = '' ) { |
|
286 | + public static function output_fields($options, $option_name = '') { |
|
287 | 287 | $current_tab = give_get_current_setting_tab(); |
288 | 288 | |
289 | 289 | // Field Default values. |
@@ -296,52 +296,52 @@ discard block |
||
296 | 296 | 'table_html' => true, |
297 | 297 | ); |
298 | 298 | |
299 | - foreach ( $options as $value ) { |
|
300 | - if ( ! isset( $value['type'] ) ) { |
|
299 | + foreach ($options as $value) { |
|
300 | + if ( ! isset($value['type'])) { |
|
301 | 301 | continue; |
302 | 302 | } |
303 | 303 | |
304 | 304 | // Set title. |
305 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
305 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
306 | 306 | |
307 | 307 | // Set default setting. |
308 | - $value = wp_parse_args( $value, $defaults ); |
|
308 | + $value = wp_parse_args($value, $defaults); |
|
309 | 309 | |
310 | 310 | // Colorpicker field. |
311 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
312 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
311 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
312 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
313 | 313 | |
314 | 314 | |
315 | 315 | // Custom attribute handling. |
316 | 316 | $custom_attributes = array(); |
317 | 317 | |
318 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
319 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
320 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
318 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
319 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
320 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | // Description handling. |
325 | - $description = self::get_field_description( $value ); |
|
325 | + $description = self::get_field_description($value); |
|
326 | 326 | |
327 | 327 | // Switch based on type. |
328 | - switch ( $value['type'] ) { |
|
328 | + switch ($value['type']) { |
|
329 | 329 | |
330 | 330 | // Section Titles |
331 | 331 | case 'title': |
332 | - if ( ! empty( $value['title'] ) ) { |
|
333 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
332 | + if ( ! empty($value['title'])) { |
|
333 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
334 | 334 | } |
335 | 335 | |
336 | - if ( ! empty( $value['desc'] ) ) { |
|
337 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
336 | + if ( ! empty($value['desc'])) { |
|
337 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
338 | 338 | } |
339 | 339 | |
340 | - if ( $value['table_html'] ) { |
|
341 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
340 | + if ($value['table_html']) { |
|
341 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
342 | 342 | } |
343 | 343 | |
344 | - if ( ! empty( $value['id'] ) ) { |
|
344 | + if ( ! empty($value['id'])) { |
|
345 | 345 | |
346 | 346 | /** |
347 | 347 | * Trigger Action. |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @since 1.8 |
352 | 352 | */ |
353 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
353 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | break; |
357 | 357 | |
358 | 358 | // Section Ends. |
359 | 359 | case 'sectionend': |
360 | - if ( ! empty( $value['id'] ) ) { |
|
360 | + if ( ! empty($value['id'])) { |
|
361 | 361 | |
362 | 362 | /** |
363 | 363 | * Trigger Action. |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @since 1.8 |
368 | 368 | */ |
369 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
369 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
370 | 370 | } |
371 | 371 | |
372 | - if ( $value['table_html'] ) { |
|
372 | + if ($value['table_html']) { |
|
373 | 373 | echo '</table>'; |
374 | 374 | } |
375 | 375 | |
376 | - if ( ! empty( $value['id'] ) ) { |
|
376 | + if ( ! empty($value['id'])) { |
|
377 | 377 | |
378 | 378 | /** |
379 | 379 | * Trigger Action. |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * |
383 | 383 | * @since 1.8 |
384 | 384 | */ |
385 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
385 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | break; |
@@ -390,27 +390,27 @@ discard block |
||
390 | 390 | // Standard text inputs and subtypes like 'number'. |
391 | 391 | case 'colorpicker': |
392 | 392 | case 'hidden' : |
393 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
393 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
394 | 394 | case 'text': |
395 | 395 | case 'email': |
396 | 396 | case 'number': |
397 | 397 | case 'password' : |
398 | 398 | $type = $value['type']; |
399 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
399 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
400 | 400 | ?> |
401 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
401 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
402 | 402 | <th scope="row" class="titledesc"> |
403 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
403 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
404 | 404 | </th> |
405 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
405 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
406 | 406 | <input |
407 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
408 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
409 | - type="<?php echo esc_attr( $type ); ?>" |
|
410 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
411 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
412 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
413 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
407 | + name="<?php echo esc_attr($value['id']); ?>" |
|
408 | + id="<?php echo esc_attr($value['id']); ?>" |
|
409 | + type="<?php echo esc_attr($type); ?>" |
|
410 | + style="<?php echo esc_attr($value['css']); ?>" |
|
411 | + value="<?php echo esc_attr($option_value); ?>" |
|
412 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
413 | + <?php echo implode(' ', $custom_attributes); ?> |
|
414 | 414 | /> <?php echo $description; ?> |
415 | 415 | </td> |
416 | 416 | </tr> |
@@ -420,23 +420,23 @@ discard block |
||
420 | 420 | // Textarea. |
421 | 421 | case 'textarea': |
422 | 422 | |
423 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
423 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
424 | 424 | |
425 | 425 | ?> |
426 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
426 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
427 | 427 | <th scope="row" class="titledesc"> |
428 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
428 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
429 | 429 | </th> |
430 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
430 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
431 | 431 | <textarea |
432 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
433 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
434 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
435 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
432 | + name="<?php echo esc_attr($value['id']); ?>" |
|
433 | + id="<?php echo esc_attr($value['id']); ?>" |
|
434 | + style="<?php echo esc_attr($value['css']); ?>" |
|
435 | + class="<?php echo esc_attr($value['class']); ?>" |
|
436 | 436 | rows="10" |
437 | 437 | cols="60" |
438 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
439 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
438 | + <?php echo implode(' ', $custom_attributes); ?> |
|
439 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
440 | 440 | <?php echo $description; ?> |
441 | 441 | </td> |
442 | 442 | </tr><?php |
@@ -446,35 +446,35 @@ discard block |
||
446 | 446 | case 'select' : |
447 | 447 | case 'multiselect' : |
448 | 448 | |
449 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
449 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
450 | 450 | |
451 | 451 | ?> |
452 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
452 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
453 | 453 | <th scope="row" class="titledesc"> |
454 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
454 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
455 | 455 | </th> |
456 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
456 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
457 | 457 | <select |
458 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
458 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
459 | 459 | echo '[]'; |
460 | 460 | } ?>" |
461 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
462 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
463 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
464 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
465 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
461 | + id="<?php echo esc_attr($value['id']); ?>" |
|
462 | + style="<?php echo esc_attr($value['css']); ?>" |
|
463 | + class="<?php echo esc_attr($value['class']); ?>" |
|
464 | + <?php echo implode(' ', $custom_attributes); ?> |
|
465 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
466 | 466 | > |
467 | 467 | |
468 | 468 | <?php |
469 | - if ( ! empty( $value['options'] ) ) { |
|
470 | - foreach ( $value['options'] as $key => $val ) { |
|
469 | + if ( ! empty($value['options'])) { |
|
470 | + foreach ($value['options'] as $key => $val) { |
|
471 | 471 | ?> |
472 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
472 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
473 | 473 | |
474 | - if ( is_array( $option_value ) ) { |
|
475 | - selected( in_array( $key, $option_value ), true ); |
|
474 | + if (is_array($option_value)) { |
|
475 | + selected(in_array($key, $option_value), true); |
|
476 | 476 | } else { |
477 | - selected( $option_value, $key ); |
|
477 | + selected($option_value, $key); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | ?>><?php echo $val ?></option> |
@@ -490,28 +490,28 @@ discard block |
||
490 | 490 | |
491 | 491 | // Radio inputs. |
492 | 492 | case 'radio_inline' : |
493 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
493 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
494 | 494 | case 'radio' : |
495 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
495 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
496 | 496 | ?> |
497 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
497 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
498 | 498 | <th scope="row" class="titledesc"> |
499 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
499 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
500 | 500 | </th> |
501 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
501 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
502 | 502 | <fieldset> |
503 | 503 | <ul> |
504 | 504 | <?php |
505 | - foreach ( $value['options'] as $key => $val ) { |
|
505 | + foreach ($value['options'] as $key => $val) { |
|
506 | 506 | ?> |
507 | 507 | <li> |
508 | 508 | <label><input |
509 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
509 | + name="<?php echo esc_attr($value['id']); ?>" |
|
510 | 510 | value="<?php echo $key; ?>" |
511 | 511 | type="radio" |
512 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
513 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
514 | - <?php checked( $key, $option_value ); ?> |
|
512 | + style="<?php echo esc_attr($value['css']); ?>" |
|
513 | + <?php echo implode(' ', $custom_attributes); ?> |
|
514 | + <?php checked($key, $option_value); ?> |
|
515 | 515 | /> <?php echo $val ?></label> |
516 | 516 | </li> |
517 | 517 | <?php |
@@ -525,21 +525,21 @@ discard block |
||
525 | 525 | |
526 | 526 | // Checkbox input. |
527 | 527 | case 'checkbox' : |
528 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
528 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
529 | 529 | ?> |
530 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
530 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
531 | 531 | <th scope="row" class="titledesc"> |
532 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
532 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
533 | 533 | </th> |
534 | 534 | <td class="give-forminp"> |
535 | 535 | <input |
536 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
537 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
536 | + name="<?php echo esc_attr($value['id']); ?>" |
|
537 | + id="<?php echo esc_attr($value['id']); ?>" |
|
538 | 538 | type="checkbox" |
539 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
539 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
540 | 540 | value="1" |
541 | - <?php checked( $option_value, 'on' ); ?> |
|
542 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
541 | + <?php checked($option_value, 'on'); ?> |
|
542 | + <?php echo implode(' ', $custom_attributes); ?> |
|
543 | 543 | /> |
544 | 544 | <?php echo $description; ?> |
545 | 545 | </td> |
@@ -549,28 +549,28 @@ discard block |
||
549 | 549 | |
550 | 550 | // Multi Checkbox input. |
551 | 551 | case 'multicheck' : |
552 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
553 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
552 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
553 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
554 | 554 | ?> |
555 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
555 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
556 | 556 | <th scope="row" class="titledesc"> |
557 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
557 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
558 | 558 | </th> |
559 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
559 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
560 | 560 | <fieldset> |
561 | 561 | <ul> |
562 | 562 | <?php |
563 | - foreach ( $value['options'] as $key => $val ) { |
|
563 | + foreach ($value['options'] as $key => $val) { |
|
564 | 564 | ?> |
565 | 565 | <li> |
566 | 566 | <label> |
567 | 567 | <input |
568 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
568 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
569 | 569 | value="<?php echo $key; ?>" |
570 | 570 | type="checkbox" |
571 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
572 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
573 | - <?php if ( in_array( $key, $option_value ) ) { |
|
571 | + style="<?php echo esc_attr($value['css']); ?>" |
|
572 | + <?php echo implode(' ', $custom_attributes); ?> |
|
573 | + <?php if (in_array($key, $option_value)) { |
|
574 | 574 | echo 'checked="checked"'; |
575 | 575 | } ?> |
576 | 576 | /> <?php echo $val ?> |
@@ -589,35 +589,35 @@ discard block |
||
589 | 589 | // File input field. |
590 | 590 | case 'file' : |
591 | 591 | case 'media' : |
592 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
593 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
594 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
595 | - |
|
596 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
597 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '#'; |
|
598 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
599 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
592 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
593 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give'); |
|
594 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
595 | + |
|
596 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
597 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '#'; |
|
598 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
599 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
600 | 600 | ?> |
601 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
601 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
602 | 602 | <th scope="row" class="titledesc"> |
603 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
603 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
604 | 604 | </th> |
605 | 605 | <td class="give-forminp"> |
606 | 606 | <div class="give-field-wrap"> |
607 | 607 | <label for="<?php echo $value['id'] ?>"> |
608 | 608 | <input |
609 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
610 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
609 | + name="<?php echo esc_attr($value['id']); ?>" |
|
610 | + id="<?php echo esc_attr($value['id']); ?>" |
|
611 | 611 | type="text" |
612 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
612 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
613 | 613 | value="<?php echo $option_value; ?>" |
614 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
615 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
614 | + style="<?php echo esc_attr($value['css']); ?>" |
|
615 | + <?php echo implode(' ', $custom_attributes); ?> |
|
616 | 616 | /> <input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>"> |
617 | 617 | <?php echo $description ?> |
618 | 618 | <div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
619 | 619 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
620 | - <img src="<?php echo $preview_image_src ; ?>" alt=""> |
|
620 | + <img src="<?php echo $preview_image_src; ?>" alt=""> |
|
621 | 621 | </div> |
622 | 622 | </label> |
623 | 623 | </div> |
@@ -629,17 +629,17 @@ discard block |
||
629 | 629 | // WordPress Editor. |
630 | 630 | case 'wysiwyg' : |
631 | 631 | // Get option value. |
632 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
632 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
633 | 633 | |
634 | 634 | // Get editor settings. |
635 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
635 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
636 | 636 | ?> |
637 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
637 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
638 | 638 | <th scope="row" class="titledesc"> |
639 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
639 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
640 | 640 | </th> |
641 | 641 | <td class="give-forminp"> |
642 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
642 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
643 | 643 | <?php echo $description; ?> |
644 | 644 | </td> |
645 | 645 | </tr><?php |
@@ -648,9 +648,9 @@ discard block |
||
648 | 648 | // Custom: System setting field. |
649 | 649 | case 'system_info' : |
650 | 650 | ?> |
651 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
651 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
652 | 652 | <th scope="row" class="titledesc"> |
653 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
653 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
654 | 654 | </th> |
655 | 655 | <td class="give-forminp"> |
656 | 656 | <?php give_system_info_callback(); ?> |
@@ -661,14 +661,14 @@ discard block |
||
661 | 661 | |
662 | 662 | // Custom: Default gateways setting field. |
663 | 663 | case 'default_gateway' : |
664 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
664 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
665 | 665 | ?> |
666 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
666 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
667 | 667 | <th scope="row" class="titledesc"> |
668 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
668 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
669 | 669 | </th> |
670 | 670 | <td class="give-forminp"> |
671 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
671 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
672 | 672 | <?php echo $description; ?> |
673 | 673 | </td> |
674 | 674 | </tr><?php |
@@ -676,14 +676,14 @@ discard block |
||
676 | 676 | |
677 | 677 | // Custom: Enable gateways setting field. |
678 | 678 | case 'enabled_gateways' : |
679 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
679 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
680 | 680 | ?> |
681 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
681 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
682 | 682 | <th scope="row" class="titledesc"> |
683 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
683 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
684 | 684 | </th> |
685 | 685 | <td class="give-forminp"> |
686 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
686 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
687 | 687 | <?php echo $description; ?> |
688 | 688 | </td> |
689 | 689 | </tr><?php |
@@ -692,9 +692,9 @@ discard block |
||
692 | 692 | // Custom: Email preview buttons field. |
693 | 693 | case 'email_preview_buttons' : |
694 | 694 | ?> |
695 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
695 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
696 | 696 | <th scope="row" class="titledesc"> |
697 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
697 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
698 | 698 | </th> |
699 | 699 | <td class="give-forminp"> |
700 | 700 | <?php give_email_preview_buttons_callback(); ?> |
@@ -711,22 +711,22 @@ discard block |
||
711 | 711 | |
712 | 712 | // Custom: Gateway API key. |
713 | 713 | case 'api_key' : |
714 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
715 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
714 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
715 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
716 | 716 | ?> |
717 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
717 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
718 | 718 | <th scope="row" class="titledesc"> |
719 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
719 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
720 | 720 | </th> |
721 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
721 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
722 | 722 | <input |
723 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
724 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
725 | - type="<?php echo esc_attr( $type ); ?>" |
|
726 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
727 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
728 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
729 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
723 | + name="<?php echo esc_attr($value['id']); ?>" |
|
724 | + id="<?php echo esc_attr($value['id']); ?>" |
|
725 | + type="<?php echo esc_attr($type); ?>" |
|
726 | + style="<?php echo esc_attr($value['css']); ?>" |
|
727 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
728 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
729 | + <?php echo implode(' ', $custom_attributes); ?> |
|
730 | 730 | /> <?php echo $description; ?> |
731 | 731 | </td> |
732 | 732 | </tr><?php |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | * |
744 | 744 | * @since 1.0 |
745 | 745 | */ |
746 | - do_action( "give_logs_view_{$current_section}" ); |
|
746 | + do_action("give_logs_view_{$current_section}"); |
|
747 | 747 | |
748 | 748 | echo $description; |
749 | 749 | break; |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | // Custom: Data field. |
752 | 752 | case 'data' : |
753 | 753 | |
754 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
754 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
755 | 755 | |
756 | 756 | echo $description; |
757 | 757 | break; |
@@ -759,12 +759,12 @@ discard block |
||
759 | 759 | // Custom: Give Docs Link field type. |
760 | 760 | case 'give_docs_link' : |
761 | 761 | ?> |
762 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
762 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
763 | 763 | <td class="give-docs-link" colspan="2"> |
764 | 764 | <?php |
765 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
765 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
766 | 766 | . '" target="_blank">' |
767 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
767 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
768 | 768 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
769 | 769 | ?> |
770 | 770 | </td> |
@@ -775,8 +775,8 @@ discard block |
||
775 | 775 | // You can add or handle your custom field action. |
776 | 776 | default: |
777 | 777 | // Get option value. |
778 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
779 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
778 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
779 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
780 | 780 | break; |
781 | 781 | } |
782 | 782 | } |
@@ -792,15 +792,15 @@ discard block |
||
792 | 792 | * |
793 | 793 | * @return string The HTML description of the field. |
794 | 794 | */ |
795 | - public static function get_field_description( $value ) { |
|
795 | + public static function get_field_description($value) { |
|
796 | 796 | $description = ''; |
797 | 797 | |
798 | 798 | // Support for both 'description' and 'desc' args. |
799 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
800 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
799 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
800 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
801 | 801 | |
802 | - if ( ! empty( $value ) ) { |
|
803 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
802 | + if ( ! empty($value)) { |
|
803 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | return $description; |
@@ -817,11 +817,11 @@ discard block |
||
817 | 817 | * |
818 | 818 | * @return array The description and tip as a 2 element array |
819 | 819 | */ |
820 | - public static function get_field_title( $value ) { |
|
821 | - $title = esc_html( $value['title'] ); |
|
820 | + public static function get_field_title($value) { |
|
821 | + $title = esc_html($value['title']); |
|
822 | 822 | |
823 | 823 | // If html tag detected then allow them to print. |
824 | - if ( strip_tags( $title ) ) { |
|
824 | + if (strip_tags($title)) { |
|
825 | 825 | $title = $value['title']; |
826 | 826 | } |
827 | 827 | |
@@ -840,8 +840,8 @@ discard block |
||
840 | 840 | * |
841 | 841 | * @return bool |
842 | 842 | */ |
843 | - public static function save_fields( $options, $option_name = '' ) { |
|
844 | - if ( empty( $_POST ) ) { |
|
843 | + public static function save_fields($options, $option_name = '') { |
|
844 | + if (empty($_POST)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
@@ -849,37 +849,37 @@ discard block |
||
849 | 849 | $update_options = array(); |
850 | 850 | |
851 | 851 | // Loop options and get values to save. |
852 | - foreach ( $options as $option ) { |
|
853 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
852 | + foreach ($options as $option) { |
|
853 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
854 | 854 | continue; |
855 | 855 | } |
856 | 856 | |
857 | 857 | // Get posted value. |
858 | - if ( strstr( $option['id'], '[' ) ) { |
|
859 | - parse_str( $option['id'], $option_name_array ); |
|
860 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
861 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
862 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
858 | + if (strstr($option['id'], '[')) { |
|
859 | + parse_str($option['id'], $option_name_array); |
|
860 | + $field_option_name = current(array_keys($option_name_array)); |
|
861 | + $setting_name = key($option_name_array[$field_option_name]); |
|
862 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
863 | 863 | } else { |
864 | 864 | $field_option_name = $option['id']; |
865 | 865 | $setting_name = ''; |
866 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
866 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | // Format the value based on option type. |
870 | - switch ( $option['type'] ) { |
|
870 | + switch ($option['type']) { |
|
871 | 871 | case 'checkbox' : |
872 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
872 | + $value = is_null($raw_value) ? '' : 'on'; |
|
873 | 873 | break; |
874 | 874 | case 'wysiwyg' : |
875 | 875 | case 'textarea' : |
876 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
876 | + $value = wp_kses_post(trim($raw_value)); |
|
877 | 877 | break; |
878 | 878 | case 'multiselect' : |
879 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
879 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
880 | 880 | break; |
881 | 881 | default : |
882 | - $value = give_clean( $raw_value ); |
|
882 | + $value = give_clean($raw_value); |
|
883 | 883 | break; |
884 | 884 | } |
885 | 885 | |
@@ -888,37 +888,37 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @since 1.8 |
890 | 890 | */ |
891 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
891 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
892 | 892 | |
893 | 893 | /** |
894 | 894 | * Sanitize the value of an option by option name. |
895 | 895 | * |
896 | 896 | * @since 1.8 |
897 | 897 | */ |
898 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
898 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
899 | 899 | |
900 | - if ( is_null( $value ) ) { |
|
900 | + if (is_null($value)) { |
|
901 | 901 | continue; |
902 | 902 | } |
903 | 903 | |
904 | 904 | // Check if option is an array and handle that differently to single values. |
905 | - if ( $field_option_name && $setting_name ) { |
|
906 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
907 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
905 | + if ($field_option_name && $setting_name) { |
|
906 | + if ( ! isset($update_options[$field_option_name])) { |
|
907 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
908 | 908 | } |
909 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
910 | - $update_options[ $field_option_name ] = array(); |
|
909 | + if ( ! is_array($update_options[$field_option_name])) { |
|
910 | + $update_options[$field_option_name] = array(); |
|
911 | 911 | } |
912 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
912 | + $update_options[$field_option_name][$setting_name] = $value; |
|
913 | 913 | } else { |
914 | - $update_options[ $field_option_name ] = $value; |
|
914 | + $update_options[$field_option_name] = $value; |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | |
918 | 918 | // Save all options in our array or there own option name i.e. option id. |
919 | - if ( empty( $option_name ) ) { |
|
920 | - foreach ( $update_options as $name => $value ) { |
|
921 | - update_option( $name, $value ); |
|
919 | + if (empty($option_name)) { |
|
920 | + foreach ($update_options as $name => $value) { |
|
921 | + update_option($name, $value); |
|
922 | 922 | |
923 | 923 | /** |
924 | 924 | * Trigger action. |
@@ -927,13 +927,13 @@ discard block |
||
927 | 927 | * |
928 | 928 | * @since 1.8 |
929 | 929 | */ |
930 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
930 | + do_action("give_save_option_{$name}", $value, $name); |
|
931 | 931 | } |
932 | 932 | } else { |
933 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
934 | - $update_options = array_merge( $old_options, $update_options ); |
|
933 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
934 | + $update_options = array_merge($old_options, $update_options); |
|
935 | 935 | |
936 | - update_option( $option_name, $update_options ); |
|
936 | + update_option($option_name, $update_options); |
|
937 | 937 | |
938 | 938 | /** |
939 | 939 | * Trigger action. |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | * |
943 | 943 | * @since 1.8 |
944 | 944 | */ |
945 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
945 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
946 | 946 | } |
947 | 947 | |
948 | 948 | return true; |
@@ -10,17 +10,17 @@ |
||
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 | <div class="wrap" id="poststuff"> |
18 | 18 | <div id="give-updates"> |
19 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1> |
|
19 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1> |
|
20 | 20 | <hr class="wp-header-end"> |
21 | 21 | |
22 | 22 | <div class="give-update-panel-content"> |
23 | - <p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give' ); ?></p> |
|
23 | + <p><?php esc_html_e('Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give'); ?></p> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | </div> |